[igt-dev] [PATCH i-g-t 2/3] lib/i915: Report I915_SCHEDULER_CAP_ENGINE_BUSY_STATS

Chris Wilson chris at chris-wilson.co.uk
Thu Jul 4 16:15:49 UTC 2019


Hook the new capability bit alongside the existing scheduler reporting.

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

diff --git a/lib/i915/gem_scheduler.c b/lib/i915/gem_scheduler.c
index 1ea910387..1beb85dec 100644
--- a/lib/i915/gem_scheduler.c
+++ b/lib/i915/gem_scheduler.c
@@ -118,6 +118,19 @@ bool gem_scheduler_has_semaphores(int fd)
 		I915_SCHEDULER_CAP_SEMAPHORES;
 }
 
+/**
+ * gem_scheduler_has_engine_busy_stats:
+ * @fd: open i915 drm file descriptor
+ *
+ * Feature test macro to query whether the driver supports reporting accurate
+ * per-engine utilisation.
+ */
+bool gem_scheduler_has_engine_busy_stats(int fd)
+{
+	return gem_scheduler_capability(fd) &
+		I915_SCHEDULER_CAP_ENGINE_BUSY_STATS;
+}
+
 /**
  * gem_scheduler_print_capability:
  * @fd: open i915 drm file descriptor
@@ -138,4 +151,6 @@ void gem_scheduler_print_capability(int fd)
 		igt_info(" - With preemption enabled\n");
 	if (caps & I915_SCHEDULER_CAP_SEMAPHORES)
 		igt_info(" - With HW semaphores enabled\n");
+	if (caps & I915_SCHEDULER_CAP_ENGINE_BUSY_STATS)
+		igt_info(" - With engine busy statistics\n");
 }
diff --git a/lib/i915/gem_scheduler.h b/lib/i915/gem_scheduler.h
index f9049d128..14bd4cac4 100644
--- a/lib/i915/gem_scheduler.h
+++ b/lib/i915/gem_scheduler.h
@@ -31,6 +31,7 @@ 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_semaphores(int fd);
+bool gem_scheduler_has_engine_busy_stats(int fd);
 void gem_scheduler_print_capability(int fd);
 
 #endif /* GEM_SCHEDULER_H */
-- 
2.20.1



More information about the igt-dev mailing list