[Mesa-dev] [HACK 19/21] anv: Set context priorities based on queue priorities
Jason Ekstrand
jason at jlekstrand.net
Fri Apr 14 17:38:06 UTC 2017
This patch will never be committed because Vulkan queue priorities are
supposed to be local to the device and not cross process boundaries.
---
src/intel/vulkan/anv_device.c | 12 ++++++++++++
src/intel/vulkan/anv_gem.c | 13 +++++++++++++
src/intel/vulkan/anv_gem_stubs.c | 7 +++++++
src/intel/vulkan/anv_private.h | 2 ++
4 files changed, 34 insertions(+)
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 2885bb6..f853905 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1068,6 +1068,18 @@ VkResult anv_CreateDevice(
goto fail_fd;
}
+ if (pCreateInfo->pQueueCreateInfos &&
+ pCreateInfo->pQueueCreateInfos->pQueuePriorities) {
+ float priority = *pCreateInfo->pQueueCreateInfos->pQueuePriorities;
+ int kernel_priority = 1023 * priority - 1023;
+ int ret = anv_gem_set_context_param(device, 6, kernel_priority);
+ if (ret == -1) {
+ result = vk_errorf(VK_ERROR_INITIALIZATION_FAILED,
+ "Setting I915_CONTEXT_PARAM_PRIORITY failed: %m");
+ goto fail_fd;
+ }
+ }
+
device->info = physical_device->info;
device->isl_dev = physical_device->isl_dev;
diff --git a/src/intel/vulkan/anv_gem.c b/src/intel/vulkan/anv_gem.c
index ffdc5a1..e331fbb 100644
--- a/src/intel/vulkan/anv_gem.c
+++ b/src/intel/vulkan/anv_gem.c
@@ -231,6 +231,19 @@ anv_gem_get_param(int fd, uint32_t param)
return 0;
}
+int
+anv_gem_set_context_param(struct anv_device *device,
+ uint64_t param, uint64_t value)
+{
+ struct drm_i915_gem_context_param args = {
+ .ctx_id = device->context_id,
+ .param = param,
+ .value = value,
+ };
+
+ return anv_ioctl(device->fd, DRM_IOCTL_I915_GEM_CONTEXT_SETPARAM, &args);
+}
+
bool
anv_gem_get_bit6_swizzle(int fd, uint32_t tiling)
{
diff --git a/src/intel/vulkan/anv_gem_stubs.c b/src/intel/vulkan/anv_gem_stubs.c
index a63e96d..d93009f 100644
--- a/src/intel/vulkan/anv_gem_stubs.c
+++ b/src/intel/vulkan/anv_gem_stubs.c
@@ -126,6 +126,13 @@ anv_gem_get_param(int fd, uint32_t param)
unreachable("Unused");
}
+int
+anv_gem_set_context_param(struct anv_device *device,
+ uint64_t param, uint64_t value)
+{
+ unreachable("Unused");
+}
+
bool
anv_gem_get_bit6_swizzle(int fd, uint32_t tiling)
{
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index a083a07..b99c93c 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -800,6 +800,8 @@ int anv_gem_set_caching(struct anv_device *device, uint32_t gem_handle, uint32_t
int anv_gem_set_domain(struct anv_device *device, uint32_t gem_handle,
uint32_t read_domains, uint32_t write_domain);
int anv_gem_sync_file_merge(struct anv_device *device, int fd1, int fd2);
+int anv_gem_set_context_param(struct anv_device *device,
+ uint64_t param, uint64_t value);
VkResult anv_bo_init_new(struct anv_bo *bo, struct anv_device *device, uint64_t size);
--
2.5.0.400.gff86faf
More information about the mesa-dev
mailing list