summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2016-10-18 12:37:20 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2016-10-18 13:52:02 +0100
commit27d30707410c4a89480effa75bb6792331ca3342 (patch)
treed30f83a49e47befe22373a146bfce855b0264ab8
parentf7fe18ad10d228a203588a7427d3681da874f993 (diff)
drmtest: Install exithandler for i915, even in multidriver tests
If we opened the driver multiple times, we would not flush i915 if it was opened second. The persistence of one test state into a second can upset third parties, e.g. prime_vgem upsetting vgem_basic (due to references from i915.ko to vgem.ko preventing module unload). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
-rw-r--r--lib/drmtest.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c
index 40bbff6e..5d3aaa83 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -344,14 +344,18 @@ int drm_open_driver(int chipset)
fd = __drm_open_driver(chipset);
igt_skip_on_f(fd<0, "No known gpu found\n");
- if (__sync_fetch_and_add(&open_count, 1))
- return fd;
-
+ /* For i915, at least, we ensure that the driver is idle before
+ * starting a test and we install an exit handler to wait until
+ * idle before quitting.
+ */
if (is_i915_device(fd)) {
- gem_quiescent_gpu(fd);
- igt_install_exit_handler(quiescent_gpu_at_exit);
+ if (__sync_fetch_and_add(&open_count, 1) == 0) {
+ gem_quiescent_gpu(fd);
+
+ at_exit_drm_fd = __drm_open_driver(chipset);
+ igt_install_exit_handler(quiescent_gpu_at_exit);
+ }
}
- at_exit_drm_fd = __drm_open_driver(chipset);
return fd;
}