summaryrefslogtreecommitdiff
path: root/tests/eviction_common.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-07-21 09:12:43 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-07-21 16:32:42 +0100
commit784b77257b023b5debb05dceb397b4ba6092ae21 (patch)
treee63bcc97d9af47402da2cf8f7a52782a2e877c91 /tests/eviction_common.c
parentacca724b42252d608b18373be82a2dfa817d4225 (diff)
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 <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/eviction_common.c')
-rw-r--r--tests/eviction_common.c8
1 files changed, 6 insertions, 2 deletions
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]);
}
}