diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-10-28 12:12:33 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2017-11-12 13:19:11 +0000 |
commit | f370d5903689f37620e006f004a91d6bdeac7c16 (patch) | |
tree | af638d1277b90a6ca0449f4ddbeed8bb8aa2026f | |
parent | 7d75119b7f23fb49af52463da9bcd62e64fe6a6f (diff) |
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 <chris@chris-wilson.co.uk>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
-rw-r--r-- | lib/i915/gem_submission.c | 17 |
1 files changed, 16 insertions, 1 deletions
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 <stdbool.h> +#include <sys/ioctl.h> + +#include <i915_drm.h> #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; } |