[igt-dev] [PATCH i-g-t 04/13] lib/i915: Pretty print HW semaphores

Chris Wilson chris at chris-wilson.co.uk
Mon Feb 4 08:36:05 UTC 2019


Include whether the scheduler is using HW semaphore assistance in our
pretty debug strings, and make the caps known for requires.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 lib/i915/gem_scheduler.c | 16 ++++++++++++++++
 lib/i915/gem_scheduler.h |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/lib/i915/gem_scheduler.c b/lib/i915/gem_scheduler.c
index 8e5e60311..cd14622d6 100644
--- a/lib/i915/gem_scheduler.c
+++ b/lib/i915/gem_scheduler.c
@@ -117,6 +117,20 @@ bool gem_scheduler_has_pmu_support(int fd)
 	       LOCAL_I915_SCHEDULER_CAP_PMU;
 }
 
+/**
+ * gem_scheduler_has_semaphores:
+ * @fd: open i915 drm file descriptor
+ *
+ * Feature test macro to query whether the driver supports using HW semaphores
+ * to schedule dependencies in parallel (using the HW to delay execution until
+ * ready to reduce latency).
+ */
+bool gem_scheduler_has_semaphores(int fd)
+{
+	return gem_scheduler_capability(fd) &
+	       LOCAL_I915_SCHEDULER_CAP_SEMAPHORES;
+}
+
 /**
  * gem_scheduler_print_capability:
  * @fd: open i915 drm file descriptor
@@ -135,6 +149,8 @@ void gem_scheduler_print_capability(int fd)
 		igt_info(" - With priority sorting\n");
 	if (caps & LOCAL_I915_SCHEDULER_CAP_PREEMPTION)
 		igt_info(" - With preemption enabled\n");
+	if (caps & LOCAL_I915_SCHEDULER_CAP_SEMAPHORES)
+		igt_info(" - With HW semaphores enabled\n");
 	if (caps & LOCAL_I915_SCHEDULER_CAP_PMU)
 		igt_info(" - With PMU support\n");
 }
diff --git a/lib/i915/gem_scheduler.h b/lib/i915/gem_scheduler.h
index d57f08dad..32778e7dd 100644
--- a/lib/i915/gem_scheduler.h
+++ b/lib/i915/gem_scheduler.h
@@ -28,12 +28,14 @@
 #define LOCAL_I915_SCHEDULER_CAP_PRIORITY	(1 << 1)
 #define LOCAL_I915_SCHEDULER_CAP_PREEMPTION	(1 << 2)
 #define LOCAL_I915_SCHEDULER_CAP_PMU		(1 << 3)
+#define LOCAL_I915_SCHEDULER_CAP_SEMAPHORES	(1 << 4)
 
 unsigned gem_scheduler_capability(int fd);
 bool gem_scheduler_enabled(int fd);
 bool gem_scheduler_has_ctx_priority(int fd);
 bool gem_scheduler_has_preemption(int fd);
 bool gem_scheduler_has_pmu_support(int fd);
+bool gem_scheduler_has_semaphores(int fd);
 void gem_scheduler_print_capability(int fd);
 
 #endif /* GEM_SCHEDULER_H */
-- 
2.20.1



More information about the igt-dev mailing list