venus: support VK_KHR_global_priority

as well as the prior versions promoted from.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33594>
This commit is contained in:
Yiwei Zhang 2025-02-17 01:58:33 -08:00 committed by Marge Bot
parent 696ee859ef
commit e488b5e45e
3 changed files with 39 additions and 12 deletions

View file

@ -512,7 +512,7 @@ Vulkan 1.3 -- all DONE: anv, lvp, nvk, radv, tu, vn, v3dv
Vulkan 1.4 -- all DONE: anv, lvp, nvk, radv/gfx8+, tu/a7xx+
VK_KHR_dynamic_rendering_local_read DONE (anv, lvp, nvk, radv, tu)
VK_KHR_global_priority DONE (anv, lvp, nvk, panvk, radv, tu)
VK_KHR_global_priority DONE (anv, 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, radv, tu, v3dv, vn)
VK_KHR_load_store_op_none DONE (anv, lvp, nvk, radv, tu, v3dv, vn)
@ -610,8 +610,8 @@ Khronos extensions that are not part of any Vulkan version:
VK_EXT_filter_cubic DONE (tu/a650+)
VK_EXT_fragment_density_map DONE (tu)
VK_EXT_fragment_shader_interlock DONE (anv, radv/gfx9+, vn)
VK_EXT_global_priority DONE (anv, hasvk, panvk, radv, tu)
VK_EXT_global_priority_query DONE (anv, hasvk, panvk, radv, tu)
VK_EXT_global_priority DONE (anv, hasvk, panvk, radv, tu, vn)
VK_EXT_global_priority_query DONE (anv, hasvk, panvk, radv, tu, vn)
VK_EXT_graphics_pipeline_library DONE (anv, lvp, nvk, panvk, radv, tu, vn)
VK_EXT_headless_surface DONE (anv, dzn, hasvk, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn)
VK_EXT_image_2d_view_of_3d DONE (anv, hasvk, lvp, nvk, radv, tu, vn)

View file

@ -161,6 +161,7 @@ vn_physical_device_init_features(struct vn_physical_device *physical_dev)
ycbcr_2plane_444_formats;
/* Vulkan 1.4 */
VkPhysicalDeviceGlobalPriorityQueryFeatures global_priority_query;
VkPhysicalDeviceIndexTypeUint8Features index_type_uint8;
VkPhysicalDeviceLineRasterizationFeatures line_rasterization;
VkPhysicalDeviceMaintenance5Features maintenance5;
@ -275,6 +276,7 @@ vn_physical_device_init_features(struct vn_physical_device *physical_dev)
VN_ADD_PNEXT_EXT(feats2, YCBCR_2_PLANE_444_FORMATS_FEATURES_EXT, local_feats.ycbcr_2plane_444_formats, exts->EXT_ycbcr_2plane_444_formats);
/* Vulkan 1.4 */
VN_ADD_PNEXT_EXT(feats2, GLOBAL_PRIORITY_QUERY_FEATURES, local_feats.global_priority_query, exts->KHR_global_priority || exts->EXT_global_priority_query);
VN_ADD_PNEXT_EXT(feats2, INDEX_TYPE_UINT8_FEATURES, local_feats.index_type_uint8, exts->KHR_index_type_uint8 || exts->EXT_index_type_uint8);
VN_ADD_PNEXT_EXT(feats2, LINE_RASTERIZATION_FEATURES, local_feats.line_rasterization, exts->KHR_line_rasterization || exts->EXT_line_rasterization);
VN_ADD_PNEXT_EXT(feats2, MAINTENANCE_5_FEATURES, local_feats.maintenance5, exts->KHR_maintenance5);
@ -688,15 +690,26 @@ vn_physical_device_init_queue_family_properties(
vn_call_vkGetPhysicalDeviceQueueFamilyProperties2(
ring, vn_physical_device_to_handle(physical_dev), &count, NULL);
VkQueueFamilyProperties2 *props =
vk_alloc(alloc, sizeof(*props) * count, VN_DEFAULT_ALIGN,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (!props)
const bool can_query_prio =
physical_dev->base.base.supported_features.globalPriorityQuery;
VkQueueFamilyProperties2 *props;
VkQueueFamilyGlobalPriorityProperties *prio_props;
VK_MULTIALLOC(ma);
vk_multialloc_add(&ma, &props, __typeof__(*props), count);
if (can_query_prio)
vk_multialloc_add(&ma, &prio_props, __typeof__(*prio_props), count);
if (!vk_multialloc_zalloc(&ma, alloc, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE))
return VK_ERROR_OUT_OF_HOST_MEMORY;
for (uint32_t i = 0; i < count; i++) {
props[i].sType = VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2;
props[i].pNext = NULL;
if (can_query_prio) {
prio_props[i].sType =
VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES;
props[i].pNext = &prio_props[i];
}
}
vn_call_vkGetPhysicalDeviceQueueFamilyProperties2(
ring, vn_physical_device_to_handle(physical_dev), &count, props);
@ -744,6 +757,7 @@ vn_physical_device_init_queue_family_properties(
physical_dev->sparse_binding_disabled = true;
physical_dev->queue_family_properties = props;
physical_dev->global_priority_properties = prio_props;
physical_dev->queue_family_count = non_sparse_only_count;
return VK_SUCCESS;
@ -1101,6 +1115,7 @@ vn_physical_device_get_passthrough_extensions(
.EXT_ycbcr_2plane_444_formats = true,
/* promoted to VK_VERSION_1_4 */
.KHR_global_priority = true,
.KHR_index_type_uint8 = true,
.KHR_line_rasterization = true,
.KHR_load_store_op_none = true,
@ -1134,6 +1149,8 @@ vn_physical_device_get_passthrough_extensions(
.EXT_dynamic_rendering_unused_attachments = true,
.EXT_external_memory_acquire_unmodified = true,
.EXT_fragment_shader_interlock = true,
.EXT_global_priority = true,
.EXT_global_priority_query = true,
.EXT_graphics_pipeline_library = !VN_DEBUG(NO_GPL),
.EXT_image_2d_view_of_3d = true,
.EXT_image_drm_format_modifier = true,
@ -1391,14 +1408,14 @@ vn_physical_device_init(struct vn_physical_device *physical_dev)
vn_physical_device_init_external_semaphore_handles(physical_dev);
vn_physical_device_init_supported_extensions(physical_dev);
vn_physical_device_init_features(physical_dev);
vn_physical_device_init_properties(physical_dev);
/* global priority props caching relies on initialized features */
result = vn_physical_device_init_queue_family_properties(physical_dev);
if (result != VK_SUCCESS)
goto fail;
/* TODO query all caps with minimal round trips */
vn_physical_device_init_features(physical_dev);
vn_physical_device_init_properties(physical_dev);
if (physical_dev->sparse_binding_disabled)
vn_physical_device_disable_sparse_binding(physical_dev);
@ -1822,7 +1839,16 @@ vn_GetPhysicalDeviceQueueFamilyProperties2(
pQueueFamilyProperties, pQueueFamilyPropertyCount);
for (uint32_t i = 0; i < physical_dev->queue_family_count; i++) {
vk_outarray_append_typed(VkQueueFamilyProperties2, &out, props) {
*props = physical_dev->queue_family_properties[i];
props->queueFamilyProperties =
physical_dev->queue_family_properties[i].queueFamilyProperties;
VkQueueFamilyGlobalPriorityProperties *prio_props = vk_find_struct(
props->pNext, QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES);
if (prio_props) {
void *pnext = prio_props->pNext;
*prio_props = physical_dev->global_priority_properties[i];
prio_props->pNext = pnext;
}
}
}
}

View file

@ -81,6 +81,7 @@ struct vn_physical_device {
VkDriverId renderer_driver_id;
VkQueueFamilyProperties2 *queue_family_properties;
VkQueueFamilyGlobalPriorityProperties *global_priority_properties;
uint32_t queue_family_count;
bool sparse_binding_disabled;
/* Track the queue family index to emulate a second queue. -1 means no