diff options
author | Michał Winiarski <michal.winiarski@intel.com> | 2017-10-16 11:05:14 +0200 |
---|---|---|
committer | Arkadiusz Hiler <arkadiusz.hiler@intel.com> | 2017-10-17 10:26:30 +0300 |
commit | f6dfe556659f5473e4bf13cc8d4770ac39c7d678 (patch) | |
tree | d28fb03f0832c680e67771df4722cc3ccd3b9302 /lib/igt_gt.c | |
parent | d4d976de7e022cb56a2dbfe96c4ab10549e24acc (diff) |
lib: Extract helpers for determining submission method
Couple of tests are using either determining submission method, or
pretty printing. Let's move those to helpers in lib.
v2: s/igt_show/gem_show
Signed-off-by: Michał Winiarski <michal.winiarski@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Katarzyna Dec <katarzyna.dec@intel.com>
Cc: Petri Latvala <petri.latvala@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Katarzyna Dec <katarzyna.dec@intel.com>
Acked-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Diffstat (limited to 'lib/igt_gt.c')
-rw-r--r-- | lib/igt_gt.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/lib/igt_gt.c b/lib/igt_gt.c index f6cc20b0..601b03f6 100644 --- a/lib/igt_gt.c +++ b/lib/igt_gt.c @@ -607,3 +607,66 @@ bool gem_can_store_dword(int fd, unsigned int engine) return true; } + +/** + * gem_submission_method: + * @fd: open i915 drm file descriptor + * + * Returns: Submission method bitmap. + */ +unsigned gem_submission_method(int fd) +{ + unsigned flags = 0; + bool active; + int dir; + + dir = igt_sysfs_open_parameters(fd); + if (dir < 0) + return 0; + + active = igt_sysfs_get_boolean(dir, "enable_guc_submission"); + if (active) { + flags |= GEM_SUBMISSION_GUC | GEM_SUBMISSION_EXECLISTS; + goto out; + } + + active = igt_sysfs_get_boolean(dir, "enable_execlists"); + if (active) { + flags |= GEM_SUBMISSION_EXECLISTS; + goto out; + } + + active = igt_sysfs_get_boolean(dir, "semaphores"); + if (active) { + flags |= GEM_SUBMISSION_SEMAPHORES; + } + +out: + close(dir); + return flags; +} + + +/** + * gem_has_semaphores: + * @fd: open i915 drm file descriptor + * + * Feature test macro to query whether the driver is using semaphores for + * synchronization between engines. + */ +bool gem_has_semaphores(int fd) +{ + return gem_submission_method(fd) & GEM_SUBMISSION_SEMAPHORES; +} + +/** + * gem_has_execlists: + * @fd: open i915 drm file descriptor + * + * Feature test macro to query whether the driver is using execlists as a + * hardware submission method. + */ +bool gem_has_execlists(int fd) +{ + return gem_submission_method(fd) & GEM_SUBMISSION_EXECLISTS; +} |