[Intel-gfx] [PATCH igt] igt/gem_exec_scheduler: HAS_SCHEDULER no longer means HAS_PREEMPTION

Chris Wilson chris at chris-wilson.co.uk
Mon Sep 25 20:48:35 UTC 2017


Michal wants to limit machines that can do preemption, which means that
we no longer can assume that if we have a scheduler for execbuf, that
implies we have preemption.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/gem_exec_schedule.c | 35 +++++++++++++++++++++++++++--------
 1 file changed, 27 insertions(+), 8 deletions(-)

diff --git a/tests/gem_exec_schedule.c b/tests/gem_exec_schedule.c
index 0b1925f1..377f8a88 100644
--- a/tests/gem_exec_schedule.c
+++ b/tests/gem_exec_schedule.c
@@ -33,6 +33,7 @@
 #include "igt_sysfs.h"
 
 #define LOCAL_PARAM_HAS_SCHEDULER 41
+#define LOCAL_PARAM_HAS_PREEMPTION 50
 #define LOCAL_CONTEXT_PARAM_PRIORITY 6
 
 #define LO 0
@@ -878,6 +879,18 @@ static bool has_scheduler(int fd)
 	return has > 0;
 }
 
+static bool has_preemption(int fd)
+{
+	drm_i915_getparam_t gp;
+	int has = -1;
+
+	gp.param = LOCAL_PARAM_HAS_PREEMPTION;
+	gp.value = &has;
+	drmIoctl(fd, DRM_IOCTL_I915_GETPARAM, &gp);
+
+	return has > 0;
+}
+
 #define HAVE_EXECLISTS 0x1
 #define HAVE_GUC 0x2
 static unsigned print_welcome(int fd)
@@ -969,17 +982,23 @@ igt_main
 				igt_subtest_f("promotion-%s", e->name)
 					promotion(fd, e->exec_id | e->flags);
 
-				igt_subtest_f("preempt-%s", e->name)
-					preempt(fd, e->exec_id | e->flags, 0);
+				igt_subtest_group {
+					igt_fixture {
+						igt_require(has_preemption(fd));
+					}
+
+					igt_subtest_f("preempt-%s", e->name)
+						preempt(fd, e->exec_id | e->flags, 0);
 
-				igt_subtest_f("preempt-contexts-%s", e->name)
-					preempt(fd, e->exec_id | e->flags, NEW_CTX);
+					igt_subtest_f("preempt-contexts-%s", e->name)
+						preempt(fd, e->exec_id | e->flags, NEW_CTX);
 
-				igt_subtest_f("preempt-other-%s", e->name)
-					preempt_other(fd, e->exec_id | e->flags);
+					igt_subtest_f("preempt-other-%s", e->name)
+						preempt_other(fd, e->exec_id | e->flags);
 
-				igt_subtest_f("preempt-self-%s", e->name)
-					preempt_self(fd, e->exec_id | e->flags);
+					igt_subtest_f("preempt-self-%s", e->name)
+						preempt_self(fd, e->exec_id | e->flags);
+				}
 
 				igt_subtest_f("deep-%s", e->name)
 					deep(fd, e->exec_id | e->flags);
-- 
2.14.1



More information about the Intel-gfx mailing list