diff options
author | Tapani Pälli <[email protected]> | 2018-01-23 14:01:00 +0200 |
---|---|---|
committer | Tapani Pälli <[email protected]> | 2018-02-28 14:36:57 +0200 |
commit | 6d8ab53303331a2438ab7c89c94be31c44e70bb1 (patch) | |
tree | b8f2cdab7f690e779186123c4d9fda666cc23b76 /src/intel/vulkan/anv_gem.c | |
parent | 5960023cf4abcd610ae646b094d04cb29f8b4986 (diff) |
anv: implement VK_EXT_global_priority extension
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 <[email protected]>
Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]> (v2)
Reviewed-by: Chris Wilson <[email protected]> (v2)
Reviewed-by: Emil Velikov <[email protected]> (v3)
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_gem.c')
-rw-r--r-- | src/intel/vulkan/anv_gem.c | 32 |
1 files changed, 32 insertions, 0 deletions
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 <fcntl.h> #include "anv_private.h" +#include "common/gen_defines.h" static int anv_ioctl(int fd, unsigned long request, void *arg) @@ -303,6 +304,22 @@ close_and_return: } 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) { struct drm_i915_gem_context_create create = { 0 }; @@ -325,6 +342,21 @@ anv_gem_destroy_context(struct anv_device *device, int context) } 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) { struct drm_i915_gem_context_param gp = { |