mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
radv: only expose permitted global queue priorities
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:
parent
43cba046e6
commit
f289e8eddc
3 changed files with 35 additions and 22 deletions
|
|
@ -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: {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue