From: Dave Airlie <airl...@redhat.com>

v2: Don't expose the SDMA queue and use the CIK check also in the
    second if. (Bas)

Reviewed-by: Bas Nieuwenhuizen <b...@basnieuwenhuizen.nl>
---
 src/amd/vulkan/radv_device.c | 52 ++++++++++++++++++++++++++++++++++----------
 1 file changed, 41 insertions(+), 11 deletions(-)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 2e802d2b7e..7ae5c1bb86 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -553,20 +553,50 @@ void radv_GetPhysicalDeviceQueueFamilyProperties(
        uint32_t*                                   pCount,
        VkQueueFamilyProperties*                    pQueueFamilyProperties)
 {
+       RADV_FROM_HANDLE(radv_physical_device, pdevice, physicalDevice);
+       int num_queue_families = 1;
+       bool all_queues = env_var_as_boolean("RADV_SHOW_QUEUES", true);
+       int idx;
+       if (all_queues && pdevice->rad_info.chip_class >= CIK) {
+               if (pdevice->rad_info.compute_rings > 0)
+                       num_queue_families++;
+       }
+
        if (pQueueFamilyProperties == NULL) {
-               *pCount = 1;
+               *pCount = num_queue_families;
                return;
        }
-       assert(*pCount >= 1);
-
-       *pQueueFamilyProperties = (VkQueueFamilyProperties) {
-               .queueFlags = VK_QUEUE_GRAPHICS_BIT |
-               VK_QUEUE_COMPUTE_BIT |
-               VK_QUEUE_TRANSFER_BIT,
-               .queueCount = 1,
-               .timestampValidBits = 64,
-               .minImageTransferGranularity = (VkExtent3D) { 1, 1, 1 },
-       };
+
+       if (!*pCount)
+               return;
+
+       idx = 0;
+       if (*pCount >= 1) {
+               pQueueFamilyProperties[idx] = (VkQueueFamilyProperties) {
+                       .queueFlags = VK_QUEUE_GRAPHICS_BIT |
+                       VK_QUEUE_COMPUTE_BIT |
+                       VK_QUEUE_TRANSFER_BIT,
+                       .queueCount = 1,
+                       .timestampValidBits = 64,
+                       .minImageTransferGranularity = (VkExtent3D) { 1, 1, 1 },
+               };
+               idx++;
+       }
+
+       if (!all_queues)
+               return;
+
+       if (pdevice->rad_info.compute_rings > 0 && pdevice->rad_info.chip_class 
>= CIK) {
+               if (*pCount > idx) {
+                       pQueueFamilyProperties[idx] = (VkQueueFamilyProperties) 
{
+                               .queueFlags = VK_QUEUE_COMPUTE_BIT | 
VK_QUEUE_TRANSFER_BIT,
+                               .queueCount = pdevice->rad_info.compute_rings,
+                               .timestampValidBits = 64,
+                               .minImageTransferGranularity = (VkExtent3D) { 
1, 1, 1 },
+                       };
+                       idx++;
+               }
+       }
 }
 
 void radv_GetPhysicalDeviceMemoryProperties(
-- 
2.11.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to