diff mbox series

[i-g-t,2/3] lib/i915: Report I915_SCHEDULER_CAP_ENGINE_BUSY_STATS

Message ID 20190704161550.15109-2-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [i-g-t,1/3] uapi/i915: Sync to bf73fc0fa9cf | expand

Commit Message

Chris Wilson July 4, 2019, 4:15 p.m. UTC
Hook the new capability bit alongside the existing scheduler reporting.

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

Patch

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 */