kk: Enable VK_(EXT/KHR)_global_priority and VK_EXT_global_priority_query

Same as NVK, only currently exposes medium priority as default.

Reviewed-by: Arcady Goldmints-Orlov <arcady@lunarg.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41286>
This commit is contained in:
squidbus 2026-04-30 00:39:53 -07:00 committed by Marge Bot
parent f74a5dd0cf
commit 640b4cb96c
3 changed files with 45 additions and 3 deletions

View file

@ -520,7 +520,7 @@ Vulkan 1.3 -- all DONE: anv, hk, kk, lvp, nvk, panvk/v10+, radv, tu, vn, v3dv
Vulkan 1.4 -- all DONE: anv, hk, lvp, nvk, panvk/v10+, radv/gfx8+, tu/a7xx+, vn
VK_KHR_dynamic_rendering_local_read DONE (anv, lvp, nvk, panvk, radv, tu, vn)
VK_KHR_global_priority DONE (anv, lvp, nvk, panvk, radv, tu, vn)
VK_KHR_global_priority DONE (anv, kk, lvp, nvk, panvk, radv, tu, vn)
VK_KHR_index_type_uint8 DONE (anv, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn)
VK_KHR_line_rasterization DONE (anv, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn)
VK_KHR_load_store_op_none DONE (anv, kk, lvp, nvk, panvk, radv, tu, v3dv, vn)
@ -643,8 +643,8 @@ Khronos extensions that are not part of any Vulkan version:
VK_EXT_fragment_density_map DONE (tu)
VK_EXT_fragment_density_map_offset DONE (tu)
VK_EXT_fragment_shader_interlock DONE (anv, lvp, radv/gfx9+, vn)
VK_EXT_global_priority DONE (anv, hasvk, panvk, radv, tu, vn, hk, lvp)
VK_EXT_global_priority_query DONE (anv, hasvk, panvk, radv, tu, vn, hk, lvp)
VK_EXT_global_priority DONE (anv, hasvk, kk, panvk, radv, tu, vn, hk, lvp)
VK_EXT_global_priority_query DONE (anv, hasvk, kk, panvk, radv, tu, vn, hk, lvp)
VK_EXT_graphics_pipeline_library DONE (anv, hk, lvp, nvk, panvk, radv, tu, vn)
VK_EXT_hdr_metadata DONE (anv, hk, lvp, nvk, panvk, radv, tu, v3dv, vn)
VK_EXT_headless_surface DONE (anv, dzn, hasvk, hk, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn)

View file

@ -115,11 +115,14 @@ kk_get_device_extensions(const struct kk_instance *instance,
.EXT_ycbcr_2plane_444_formats = true,
/* Vulkan 1.4 */
.KHR_global_priority = true,
.KHR_load_store_op_none = true,
.KHR_map_memory2 = true,
.KHR_push_descriptor = true,
.KHR_shader_expect_assume = true,
.KHR_vertex_attribute_divisor = true,
.EXT_global_priority = true,
.EXT_global_priority_query = true,
.EXT_vertex_attribute_divisor = true,
/* Optional extensions */
@ -276,6 +279,7 @@ kk_get_device_features(
.vulkanMemoryModelDeviceScope = true,
/* Vulkan 1.4 */
.globalPriorityQuery = true,
.pushDescriptor = true,
.vertexAttributeInstanceRateDivisor = true,
.vertexAttributeInstanceRateZeroDivisor = true,
@ -1039,6 +1043,22 @@ kk_GetPhysicalDeviceQueueFamilyProperties2(
0; /* TODO_KOSMICKRISP Timestamp queries */
p->queueFamilyProperties.minImageTransferGranularity =
(VkExtent3D){1, 1, 1};
vk_foreach_struct(ext, p->pNext)
{
switch (ext->sType) {
case VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES: {
VkQueueFamilyGlobalPriorityProperties *p = (void *)ext;
p->priorityCount = 1;
p->priorities[0] = VK_QUEUE_GLOBAL_PRIORITY_MEDIUM;
break;
}
default:
vk_debug_ignored_stype(ext->sType);
break;
}
}
}
}
}

View file

@ -91,6 +91,28 @@ kk_queue_init(struct kk_device *dev, struct kk_queue *queue,
const VkDeviceQueueCreateInfo *pCreateInfo,
uint32_t index_in_family)
{
const VkDeviceQueueGlobalPriorityCreateInfo *priority_info =
vk_find_struct_const(pCreateInfo->pNext,
DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO);
const VkQueueGlobalPriority global_priority =
priority_info ? priority_info->globalPriority :
VK_QUEUE_GLOBAL_PRIORITY_MEDIUM;
/* From the Vulkan 1.3.295 spec:
*
* "If the globalPriorityQuery feature is enabled and the requested
* global priority is not reported via
* VkQueueFamilyGlobalPriorityPropertiesKHR, the driver implementation
* must fail the queue creation. In this scenario,
* VK_ERROR_INITIALIZATION_FAILED is returned."
*/
if (dev->vk.enabled_features.globalPriorityQuery &&
global_priority != VK_QUEUE_GLOBAL_PRIORITY_MEDIUM)
return VK_ERROR_INITIALIZATION_FAILED;
if (global_priority > VK_QUEUE_GLOBAL_PRIORITY_MEDIUM)
return VK_ERROR_NOT_PERMITTED;
VkResult result;
result = vk_queue_init(&queue->vk, &dev->vk, pCreateInfo, index_in_family);