From 9fd6e07369837ee268097e7aae4c8dea05431fa1 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 13 Apr 2015 10:48:08 +0100 Subject: igt/prime_self_import: Ensure driver state is consistent between counts Similar to gem_flink_race, we need to make sure that when we count objects, the driver is in an identical state. We do this by flushing all work before counting. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90003 Signed-off-by: Chris Wilson --- tests/prime_self_import.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests/prime_self_import.c') diff --git a/tests/prime_self_import.c b/tests/prime_self_import.c index 20eb1150..4fd372d9 100644 --- a/tests/prime_self_import.c +++ b/tests/prime_self_import.c @@ -220,7 +220,7 @@ static int get_object_count(void) FILE *file; int ret, scanned; - igt_drop_caches_set(DROP_RETIRE); + igt_drop_caches_set(DROP_RETIRE | DROP_ACTIVE); file = igt_debugfs_fopen("i915_gem_objects", "r"); @@ -262,6 +262,7 @@ static void test_reimport_close_race(void) * up the counts */ fake = drm_open_any(); + gem_quiescent_gpu(fake); obj_count = get_object_count(); num_threads = sysconf(_SC_NPROCESSORS_ONLN); @@ -293,6 +294,7 @@ static void test_reimport_close_race(void) close(fds[0]); close(fds[1]); + gem_quiescent_gpu(fake); obj_count = get_object_count() - obj_count; igt_info("leaked %i objects\n", obj_count); @@ -352,6 +354,7 @@ static void test_export_close_race(void) * up the counts */ fake = drm_open_any(); + gem_quiescent_gpu(fake); obj_count = get_object_count(); fd = drm_open_any(); @@ -374,6 +377,7 @@ static void test_export_close_race(void) close(fd); + gem_quiescent_gpu(fake); obj_count = get_object_count() - obj_count; igt_info("leaked %i objects\n", obj_count); -- cgit v1.2.3