radv: only expose permitted global queue priorities
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

It's the responsability of the application to check for
VK_ERROR_NOT_PERMITTED, but filtering not permitted priorities seems
better.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13775
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37076>
This commit is contained in:
Samuel Pitoiset 2025-08-26 20:13:23 +02:00 committed by Marge Bot
parent 43cba046e6
commit f289e8eddc
3 changed files with 35 additions and 22 deletions

View file

@ -2657,12 +2657,21 @@ radv_get_physical_device_queue_family_properties(struct radv_physical_device *pd
*pCount = idx;
}
static const VkQueueGlobalPriority radv_global_queue_priorities[] = {
VK_QUEUE_GLOBAL_PRIORITY_LOW,
VK_QUEUE_GLOBAL_PRIORITY_MEDIUM,
VK_QUEUE_GLOBAL_PRIORITY_HIGH,
VK_QUEUE_GLOBAL_PRIORITY_REALTIME,
};
static void
radv_get_global_queue_priorities(struct radv_physical_device *pdev, VkQueueFamilyGlobalPriorityProperties *prop)
{
struct radeon_winsys *ws = pdev->ws;
prop->priorityCount = 0;
for (uint32_t p = VK_QUEUE_GLOBAL_PRIORITY_LOW; p <= VK_QUEUE_GLOBAL_PRIORITY_REALTIME; p <<= 1) {
if (ws->ctx_is_priority_permitted(ws, vk_to_radeon_priority(p)) != VK_SUCCESS)
continue;
prop->priorities[prop->priorityCount++] = p;
assert(prop->priorityCount < VK_MAX_GLOBAL_PRIORITY_SIZE);
}
}
VKAPI_ATTR void VKAPI_CALL
radv_GetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice, uint32_t *pCount,
@ -2686,9 +2695,8 @@ radv_GetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice, ui
switch (ext->sType) {
case VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES: {
VkQueueFamilyGlobalPriorityProperties *prop = (VkQueueFamilyGlobalPriorityProperties *)ext;
STATIC_ASSERT(ARRAY_SIZE(radv_global_queue_priorities) <= VK_MAX_GLOBAL_PRIORITY_SIZE);
prop->priorityCount = ARRAY_SIZE(radv_global_queue_priorities);
memcpy(&prop->priorities, radv_global_queue_priorities, sizeof(radv_global_queue_priorities));
radv_get_global_queue_priorities(pdev, prop);
break;
}
case VK_STRUCTURE_TYPE_QUEUE_FAMILY_QUERY_RESULT_STATUS_PROPERTIES_KHR: {

View file

@ -31,19 +31,7 @@ radv_get_queue_global_priority(const VkDeviceQueueGlobalPriorityCreateInfo *pObj
if (!pObj)
return RADEON_CTX_PRIORITY_MEDIUM;
switch (pObj->globalPriority) {
case VK_QUEUE_GLOBAL_PRIORITY_REALTIME:
return RADEON_CTX_PRIORITY_REALTIME;
case VK_QUEUE_GLOBAL_PRIORITY_HIGH:
return RADEON_CTX_PRIORITY_HIGH;
case VK_QUEUE_GLOBAL_PRIORITY_MEDIUM:
return RADEON_CTX_PRIORITY_MEDIUM;
case VK_QUEUE_GLOBAL_PRIORITY_LOW:
return RADEON_CTX_PRIORITY_LOW;
default:
UNREACHABLE("Illegal global priority value");
return RADEON_CTX_PRIORITY_INVALID;
}
return vk_to_radeon_priority(pObj->globalPriority);
}
static VkResult

View file

@ -117,4 +117,21 @@ enum amd_ip_type radv_queue_ring(const struct radv_queue *queue);
enum amd_ip_type radv_queue_family_to_ring(const struct radv_physical_device *dev, enum radv_queue_family f);
static inline enum radeon_ctx_priority
vk_to_radeon_priority(VkQueueGlobalPriority priority)
{
switch (priority) {
case VK_QUEUE_GLOBAL_PRIORITY_REALTIME:
return RADEON_CTX_PRIORITY_REALTIME;
case VK_QUEUE_GLOBAL_PRIORITY_HIGH:
return RADEON_CTX_PRIORITY_HIGH;
case VK_QUEUE_GLOBAL_PRIORITY_MEDIUM:
return RADEON_CTX_PRIORITY_MEDIUM;
case VK_QUEUE_GLOBAL_PRIORITY_LOW:
return RADEON_CTX_PRIORITY_LOW;
default:
return RADEON_CTX_PRIORITY_INVALID;
}
}
#endif /* RADV_QUEUE_H */