radv/wsi: Re-use transfer queue if it exists

This avoids writing past the end of pdev->vk_queue_to_radv if all the
queue families are available.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/14834
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
(cherry picked from commit 656b3814c2)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41269>
This commit is contained in:
Benjamin Cheng 2026-04-24 09:08:53 -04:00 committed by Eric Engestrom
parent 14a4a478c4
commit ac3699b9b7
2 changed files with 15 additions and 3 deletions

View file

@ -74,7 +74,7 @@
"description": "radv/wsi: Re-use transfer queue if it exists",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -50,10 +50,22 @@ radv_wsi_get_prime_blit_queue(VkDevice _device)
if (pdev->info.gfx_level >= GFX9 && !(instance->debug_flags & RADV_DEBUG_NO_DMA_BLIT)) {
pdev->vk_queue_to_radv[pdev->num_queues++] = RADV_QUEUE_TRANSFER;
uint32_t queue_family_index = pdev->num_queues;
for (uint32_t i = 0; i < pdev->num_queues; i++) {
if (pdev->vk_queue_to_radv[i] == RADV_QUEUE_TRANSFER) {
queue_family_index = i;
break;
}
}
if (queue_family_index == pdev->num_queues) {
assert(pdev->num_queues < RADV_MAX_QUEUE_FAMILIES);
pdev->vk_queue_to_radv[pdev->num_queues++] = RADV_QUEUE_TRANSFER;
}
const VkDeviceQueueCreateInfo queue_create = {
.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
.queueFamilyIndex = pdev->num_queues - 1,
.queueFamilyIndex = queue_family_index,
.queueCount = 1,
};