From 773ac7cc60357b91a5747217b926cca7ef71a5c1 Mon Sep 17 00:00:00 2001 From: Mika Kuoppala Date: Tue, 8 Nov 2016 12:31:06 +0200 Subject: lib: substitute cxt BAN_PERIOD with BANNABLE Context BAN_PERIOD will get depracated so subsitute it with BANNABLE property. Make ctx param test to accept both variants for now until kernel changes have landed, to not break BAT. v2: check against - EINVAL on get/set ban as it can return -EPERM v3: better naming for get/set (Chris) Cc: Chris Wilson Reviewed-by: Chris Wilson Signed-off-by: Mika Kuoppala --- lib/ioctl_wrappers.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'lib/ioctl_wrappers.c') diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c index 8b75b9d4..9d67a19c 100644 --- a/lib/ioctl_wrappers.c +++ b/lib/ioctl_wrappers.c @@ -962,9 +962,21 @@ void gem_context_require_param(int fd, uint64_t param) igt_require(igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM, &p) == 0); } -void gem_context_require_ban_period(int fd) +void gem_context_require_bannable(int fd) { static int has_ban_period = -1; + static int has_bannable = -1; + + if (has_bannable < 0) { + struct local_i915_gem_context_param p; + + p.context = 0; + p.param = LOCAL_CONTEXT_PARAM_BANNABLE; + p.value = 0; + p.size = 0; + + has_bannable = igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM, &p) == 0; + } if (has_ban_period < 0) { struct local_i915_gem_context_param p; @@ -977,7 +989,7 @@ void gem_context_require_ban_period(int fd) has_ban_period = igt_ioctl(fd, LOCAL_IOCTL_I915_GEM_CONTEXT_GETPARAM, &p) == 0; } - igt_require(has_ban_period); + igt_require(has_ban_period || has_bannable); } int __gem_userptr(int fd, void *ptr, int size, int read_only, uint32_t flags, uint32_t *handle) -- cgit v1.2.3