From f370d5903689f37620e006f004a91d6bdeac7c16 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 28 Oct 2017 12:12:33 +0100 Subject: lib/i915: Query semaphore status using GETPARAM Wherever possible we want to use existing ioctls rather than poking the volatile modparams, in this case we already provide I915_PARAM_HAS_SEMAPHORES so we have no excuse to peek i915.semaphores. Signed-off-by: Chris Wilson Reviewed-by: Lionel Landwerlin --- lib/i915/gem_submission.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'lib/i915') diff --git a/lib/i915/gem_submission.c b/lib/i915/gem_submission.c index 2a57e7ab..882d4f41 100644 --- a/lib/i915/gem_submission.c +++ b/lib/i915/gem_submission.c @@ -22,6 +22,9 @@ */ #include +#include + +#include #include "igt_core.h" #include "igt_sysfs.h" @@ -41,6 +44,18 @@ * semaphores for synchronization between engines. */ +static bool has_semaphores(int fd, int dir) +{ + int val = 0; + struct drm_i915_getparam gp = { + gp.param = I915_PARAM_HAS_SEMAPHORES, + gp.value = &val, + }; + if (ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp) < 0) + val = igt_sysfs_get_boolean(dir, "semaphores"); + return val; +} + /** * gem_submission_method: * @fd: open i915 drm file descriptor @@ -69,7 +84,7 @@ unsigned gem_submission_method(int fd) goto out; } - active = igt_sysfs_get_boolean(dir, "semaphores"); + active = has_semaphores(fd, dir); if (active) { flags |= GEM_SUBMISSION_SEMAPHORES; } -- cgit v1.2.3