From 177805cc03ead02029a9d36844af8da2ef30b6c3 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sun, 13 Mar 2022 05:42:10 +1000 Subject: [PATCH] radv: try and fix internal transfer queue mapping The WSI code wants to remain generic and try and use vulkan APIs, even though these queues aren't exposed through the API. Add the transfer queue to the end of the queues. Reviewed-by: Bas Nieuwenhuizen Tested-by: Mike Lothian Part-of: --- src/amd/vulkan/radv_device.c | 8 ++++++-- src/amd/vulkan/radv_private.h | 1 + src/amd/vulkan/radv_wsi.c | 5 ++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index afc22391e6a..2325c44fe58 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -568,15 +568,19 @@ radv_is_conformant(const struct radv_physical_device *pdevice) static void radv_physical_device_init_queue_table(struct radv_physical_device *pdevice) { - pdevice->vk_queue_to_radv[0] = RADV_QUEUE_GENERAL; + int idx = 0; + pdevice->vk_queue_to_radv[idx] = RADV_QUEUE_GENERAL; + idx++; for (unsigned i = 1; i < RADV_MAX_QUEUE_FAMILIES; i++) pdevice->vk_queue_to_radv[i] = RADV_MAX_QUEUE_FAMILIES + 1; if (pdevice->rad_info.num_rings[RING_COMPUTE] > 0 && !(pdevice->instance->debug_flags & RADV_DEBUG_NO_COMPUTE_QUEUE)) { - pdevice->vk_queue_to_radv[1] = RADV_QUEUE_COMPUTE; + pdevice->vk_queue_to_radv[idx] = RADV_QUEUE_COMPUTE; + idx++; } + pdevice->num_queues = idx; } static VkResult diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 1bcc590d24e..f950a82f815 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -326,6 +326,7 @@ struct radv_physical_device { nir_shader_compiler_options nir_options[MESA_VULKAN_SHADER_STAGES]; enum radv_queue_family vk_queue_to_radv[RADV_MAX_QUEUE_FAMILIES]; + uint32_t num_queues; }; struct radv_instance { diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c index 57743ac0e2c..72b21659502 100644 --- a/src/amd/vulkan/radv_wsi.c +++ b/src/amd/vulkan/radv_wsi.c @@ -60,11 +60,14 @@ radv_wsi_get_prime_blit_queue(VkDevice _device) if (device->physical_device->rad_info.chip_class >= GFX9 && !(device->physical_device->instance->debug_flags & RADV_DEBUG_NO_DMA_BLIT)) { + + device->physical_device->vk_queue_to_radv[device->physical_device->num_queues++] = RADV_QUEUE_TRANSFER; const VkDeviceQueueCreateInfo queue_create = { .sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO, - .queueFamilyIndex = RADV_QUEUE_TRANSFER, + .queueFamilyIndex = device->physical_device->num_queues - 1, .queueCount = 1, }; + device->private_sdma_queue = vk_zalloc(&device->vk.alloc, sizeof(struct radv_queue), 8, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);