[Intel-gfx] [PATCH igt] igt/gem_fence_thrash, gem_mmap_gtt: Don't let the device sleep

Chris Wilson chris at chris-wilson.co.uk
Wed Aug 23 14:13:55 UTC 2017


These tests are not intended to exercise runtime pm, but the device
going to sleep in the middle of these tests can significantly slow them
down as the GTT mmapping is torn down and must be rebuilt. This can be a
major nuisance if the device autosuspends many times a second.

These tests differ from typical applications as they are not doing any
rendering or utilizing the display which would ordinarily keep the
device awake.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/gem_fence_thrash.c | 17 +++++++++++++++++
 tests/gem_mmap_gtt.c     | 15 ++++++++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/tests/gem_fence_thrash.c b/tests/gem_fence_thrash.c
index 3e1edb73..03e971aa 100644
--- a/tests/gem_fence_thrash.c
+++ b/tests/gem_fence_thrash.c
@@ -287,10 +287,27 @@ static int run_test(int threads_per_fence, void *f, int tiling,
 	return 0;
 }
 
+static int wakeref_open(int device)
+{
+	int dir, fd;
+
+	dir = igt_debugfs_dir(device);
+	fd = openat(dir, "i915_wakeref_user", O_RDONLY);
+	close(dir);
+
+	return fd;
+}
+
 igt_main
 {
 	igt_skip_on_simulation();
 
+	igt_fixture {
+		int fd = drm_open_driver(DRIVER_INTEL);
+		wakeref_open(fd);
+		close(fd);
+	}
+
 	igt_subtest("bo-write-verify-none")
 		igt_assert(run_test(0, bo_write_verify, I915_TILING_NONE, 80) == 0);
 
diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c
index 61c08406..fc44cfb5 100644
--- a/tests/gem_mmap_gtt.c
+++ b/tests/gem_mmap_gtt.c
@@ -864,6 +864,17 @@ run_without_prefault(int fd,
 	igt_enable_prefault();
 }
 
+static int wakeref_open(int device)
+{
+	int dir, fd;
+
+	dir = igt_debugfs_dir(device);
+	fd = openat(dir, "i915_wakeref_user", O_RDONLY);
+	close(dir);
+
+	return fd;
+}
+
 int fd;
 
 igt_main
@@ -871,8 +882,10 @@ igt_main
 	if (igt_run_in_simulation())
 		OBJECT_SIZE = 1 * 1024 * 1024;
 
-	igt_fixture
+	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
+		wakeref_open(fd);
+	}
 
 	igt_subtest("basic")
 		test_access(fd);
-- 
2.14.1



More information about the Intel-gfx mailing list