From 6d8ab53303331a2438ab7c89c94be31c44e70bb1 Mon Sep 17 00:00:00 2001 From: Tapani Pälli Date: Tue, 23 Jan 2018 14:01:00 +0200 Subject: anv: implement VK_EXT_global_priority extension MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v2: add ANV_CONTEXT_REALTIME_PRIORITY (Chris) use unreachable with unknown priority (Samuel) v3: add stubs in gem_stubs.c (Emil) use priority defines from gen_defines.h v4: cleanup, add anv_gem_set_context_param (Jason) Signed-off-by: Tapani Pälli Reviewed-by: Samuel Iglesias Gonsálvez (v2) Reviewed-by: Chris Wilson (v2) Reviewed-by: Emil Velikov (v3) Reviewed-by: Jason Ekstrand --- src/intel/vulkan/anv_gem.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/intel/vulkan/anv_gem.c') diff --git a/src/intel/vulkan/anv_gem.c b/src/intel/vulkan/anv_gem.c index 34c09891086..93072c7d3b8 100644 --- a/src/intel/vulkan/anv_gem.c +++ b/src/intel/vulkan/anv_gem.c @@ -30,6 +30,7 @@ #include #include "anv_private.h" +#include "common/gen_defines.h" static int anv_ioctl(int fd, unsigned long request, void *arg) @@ -302,6 +303,22 @@ close_and_return: return swizzled; } +int +anv_gem_set_context_priority(struct anv_device *device, + int priority) +{ + return anv_gem_set_context_param(device->fd, device->context_id, + I915_CONTEXT_PARAM_PRIORITY, + priority); +} + +bool +anv_gem_has_context_priority(int fd) +{ + return !anv_gem_set_context_param(fd, 0, I915_CONTEXT_PARAM_PRIORITY, + GEN_CONTEXT_MEDIUM_PRIORITY); +} + int anv_gem_create_context(struct anv_device *device) { @@ -324,6 +341,21 @@ anv_gem_destroy_context(struct anv_device *device, int context) return anv_ioctl(device->fd, DRM_IOCTL_I915_GEM_CONTEXT_DESTROY, &destroy); } +int +anv_gem_set_context_param(int fd, int context, uint32_t param, uint64_t value) +{ + struct drm_i915_gem_context_param p = { + .ctx_id = context, + .param = param, + .value = value, + }; + int err = 0; + + if (anv_ioctl(fd, DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, &p)) + err = -errno; + return err; +} + int anv_gem_get_context_param(int fd, int context, uint32_t param, uint64_t *value) { -- cgit v1.2.3