From 784b77257b023b5debb05dceb397b4ba6092ae21 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 21 Jul 2014 09:12:43 +0100 Subject: igt/gem_userptr_blits: New tests, old issues Introduce a new test to keep that we clean up on process exit (if the userptr is busy or it has been gtt mmapped). This revealed a few bugs in the existing tests so clean those up. Signed-off-by: Chris Wilson --- tests/eviction_common.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tests/eviction_common.c') diff --git a/tests/eviction_common.c b/tests/eviction_common.c index 6c6eab46..6de68a2b 100644 --- a/tests/eviction_common.c +++ b/tests/eviction_common.c @@ -35,6 +35,7 @@ struct igt_eviction_test_ops { uint32_t (*create)(int fd, int size); + void (*flink)(uint32_t old_handle, uint32_t new_handle); void (*close)(int fd, uint32_t bo); int (*copy)(int fd, uint32_t dst, uint32_t src, uint32_t *all_bo, int nr_bos); @@ -190,6 +191,7 @@ static int forking_evictions(int fd, struct igt_eviction_test_ops *ops, } else bo_count = working_surfaces; + igt_assert(working_surfaces <= bo_count); igt_require(intel_check_memory(bo_count, surface_size, CHECK_RAM | CHECK_SWAP)); bo = malloc(bo_count*sizeof(*bo)); @@ -215,10 +217,12 @@ static int forking_evictions(int fd, struct igt_eviction_test_ops *ops, /* We can overwrite the bo array since we're forked. */ for (l = 0; l < bo_count; l++) { - uint32_t flink; + uint32_t handle = bo[l]; + uint32_t flink = gem_flink(fd, bo[l]); - flink = gem_flink(fd, bo[l]); bo[l] = gem_open(realfd, flink); + if (ops->flink) + ops->flink(handle, bo[l]); } } -- cgit v1.2.3