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 <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2015-04-13 10:48:08 +01:00
parent 2e526ae9cd
commit 9fd6e07369

View File

@ -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);