From 71ad19eb8fe4f0eecae3bf063e107293b90b9abc Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 3 Feb 2019 12:46:44 +0000 Subject: lib/i915: Pretty print HW semaphores 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 Reviewed-by: Antonio Argenziano --- lib/i915/gem_scheduler.c | 32 ++++++++++++++++++++++++-------- lib/i915/gem_scheduler.h | 5 ++--- 2 files changed, 26 insertions(+), 11 deletions(-) (limited to 'lib/i915') diff --git a/lib/i915/gem_scheduler.c b/lib/i915/gem_scheduler.c index ad156306..1ea91038 100644 --- a/lib/i915/gem_scheduler.c +++ b/lib/i915/gem_scheduler.c @@ -67,7 +67,7 @@ unsigned gem_scheduler_capability(int fd) } /** - * gem_has_scheduler: + * gem_scheduler_enabled: * @fd: open i915 drm file descriptor * * Feature test macro to query whether the driver has scheduling capability. @@ -75,11 +75,11 @@ unsigned gem_scheduler_capability(int fd) bool gem_scheduler_enabled(int fd) { return gem_scheduler_capability(fd) & - LOCAL_I915_SCHEDULER_CAP_ENABLED; + I915_SCHEDULER_CAP_ENABLED; } /** - * gem_has_ctx_priority: + * gem_scheduler_has_ctx_priority: * @fd: open i915 drm file descriptor * * Feature test macro to query whether the driver supports assigning custom @@ -88,11 +88,11 @@ bool gem_scheduler_enabled(int fd) bool gem_scheduler_has_ctx_priority(int fd) { return gem_scheduler_capability(fd) & - LOCAL_I915_SCHEDULER_CAP_PRIORITY; + I915_SCHEDULER_CAP_PRIORITY; } /** - * gem_has_preemption: + * gem_scheduler_has_preemption: * @fd: open i915 drm file descriptor * * Feature test macro to query whether the driver supports preempting active @@ -101,7 +101,21 @@ bool gem_scheduler_has_ctx_priority(int fd) bool gem_scheduler_has_preemption(int fd) { return gem_scheduler_capability(fd) & - LOCAL_I915_SCHEDULER_CAP_PREEMPTION; + I915_SCHEDULER_CAP_PREEMPTION; +} + +/** + * 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) & + I915_SCHEDULER_CAP_SEMAPHORES; } /** @@ -118,8 +132,10 @@ void gem_scheduler_print_capability(int fd) return; igt_info("Has kernel scheduler\n"); - if (caps & LOCAL_I915_SCHEDULER_CAP_PRIORITY) + if (caps & I915_SCHEDULER_CAP_PRIORITY) igt_info(" - With priority sorting\n"); - if (caps & LOCAL_I915_SCHEDULER_CAP_PREEMPTION) + if (caps & I915_SCHEDULER_CAP_PREEMPTION) igt_info(" - With preemption enabled\n"); + if (caps & I915_SCHEDULER_CAP_SEMAPHORES) + igt_info(" - With HW semaphores enabled\n"); } diff --git a/lib/i915/gem_scheduler.h b/lib/i915/gem_scheduler.h index 9fcb0266..f9049d12 100644 --- a/lib/i915/gem_scheduler.h +++ b/lib/i915/gem_scheduler.h @@ -24,14 +24,13 @@ #ifndef GEM_SCHEDULER_H #define GEM_SCHEDULER_H -#define LOCAL_I915_SCHEDULER_CAP_ENABLED (1 << 0) -#define LOCAL_I915_SCHEDULER_CAP_PRIORITY (1 << 1) -#define LOCAL_I915_SCHEDULER_CAP_PREEMPTION (1 << 2) +#include 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_semaphores(int fd); void gem_scheduler_print_capability(int fd); #endif /* GEM_SCHEDULER_H */ -- cgit v1.2.3