From 25b5a74b7f096c870bd2d0fa6e058d5f1acca45b Mon Sep 17 00:00:00 2001 From: Daniele Ceraolo Spurio Date: Fri, 3 Feb 2017 14:45:30 -0800 Subject: tests/gem_exec_params: add test for exec_fence params Added a subtest for invalid FENCE_IN usage, updated invalid-flag subtest and made the rsvd2 test skip when exec fences are available. Signed-off-by: Daniele Ceraolo Spurio Reviewed-by: Chris Wilson --- lib/ioctl_wrappers.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'lib/ioctl_wrappers.c') diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index ccc5ccf5..cd0c24ba 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -1433,6 +1433,35 @@ bool gem_has_softpin(int fd) return has_softpin; } +#define LOCAL_PARAM_HAS_EXEC_FENCE 44 +/** + * gem_has_exec_fence: + * @fd: open i915 drm file descriptor + * + * Feature test macro to query whether in/out fence support in execbuffer is + * available. + * + * Returns: Whether fence support is available + */ +bool gem_has_exec_fence(int fd) +{ + static int has_exec_fence = -1; + + if (has_exec_fence < 0) { + struct drm_i915_getparam gp; + + memset(&gp, 0, sizeof(gp)); + gp.param = LOCAL_PARAM_HAS_EXEC_FENCE; + gp.value = &has_exec_fence; + + has_exec_fence = 0; + ioctl(fd, DRM_IOCTL_I915_GETPARAM, &gp, sizeof(gp)); + errno = 0; + } + + return has_exec_fence; +} + /** * gem_require_caching: * @fd: open i915 drm file descriptor -- cgit v1.2.3