summaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_gem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/intel/vulkan/anv_gem.c')
-rw-r--r--src/intel/vulkan/anv_gem.c32
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 = {