Module: Mesa
Branch: master
Commit: 1811ccf1256662ae5d0c2b6f26916e8369497d1d
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1811ccf1256662ae5d0c2b6f26916e8369497d1d

Author: Bas Nieuwenhuizen <b...@basnieuwenhuizen.nl>
Date:   Fri Feb 10 21:23:04 2017 +0100

radv: Fix radv_GetPhysicalDeviceQueueFamilyProperties2KHR.

The struct have different size, so the arrays have different stride.

Signed-off-by: Bas Nieuwenhuizen <ba...@google.com>
Reviewed-by: Dave Airlie <airl...@redhat.com>

---

 src/amd/vulkan/radv_device.c | 45 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 36 insertions(+), 9 deletions(-)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 8a54a2a..fff3125 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -623,12 +623,11 @@ void radv_GetPhysicalDeviceProperties2KHR(
        return radv_GetPhysicalDeviceProperties(physicalDevice, 
&pProperties->properties);
 }
 
-void radv_GetPhysicalDeviceQueueFamilyProperties(
-       VkPhysicalDevice                            physicalDevice,
+static void radv_get_physical_device_queue_family_properties(
+       struct radv_physical_device*                pdevice,
        uint32_t*                                   pCount,
-       VkQueueFamilyProperties*                    pQueueFamilyProperties)
+       VkQueueFamilyProperties**                    pQueueFamilyProperties)
 {
-       RADV_FROM_HANDLE(radv_physical_device, pdevice, physicalDevice);
        int num_queue_families = 1;
        int idx;
        if (pdevice->rad_info.compute_rings > 0 &&
@@ -646,7 +645,7 @@ void radv_GetPhysicalDeviceQueueFamilyProperties(
 
        idx = 0;
        if (*pCount >= 1) {
-               pQueueFamilyProperties[idx] = (VkQueueFamilyProperties) {
+               *pQueueFamilyProperties[idx] = (VkQueueFamilyProperties) {
                        .queueFlags = VK_QUEUE_GRAPHICS_BIT |
                        VK_QUEUE_COMPUTE_BIT |
                        VK_QUEUE_TRANSFER_BIT,
@@ -661,7 +660,7 @@ void radv_GetPhysicalDeviceQueueFamilyProperties(
            pdevice->rad_info.chip_class >= CIK &&
            !(pdevice->instance->debug_flags & RADV_DEBUG_NO_COMPUTE_QUEUE)) {
                if (*pCount > idx) {
-                       pQueueFamilyProperties[idx] = (VkQueueFamilyProperties) 
{
+                       *pQueueFamilyProperties[idx] = 
(VkQueueFamilyProperties) {
                                .queueFlags = VK_QUEUE_COMPUTE_BIT | 
VK_QUEUE_TRANSFER_BIT,
                                .queueCount = pdevice->rad_info.compute_rings,
                                .timestampValidBits = 64,
@@ -673,14 +672,42 @@ void radv_GetPhysicalDeviceQueueFamilyProperties(
        *pCount = idx;
 }
 
+void radv_GetPhysicalDeviceQueueFamilyProperties(
+       VkPhysicalDevice                            physicalDevice,
+       uint32_t*                                   pCount,
+       VkQueueFamilyProperties*                    pQueueFamilyProperties)
+{
+       RADV_FROM_HANDLE(radv_physical_device, pdevice, physicalDevice);
+       if (!pQueueFamilyProperties) {
+               return 
radv_get_physical_device_queue_family_properties(pdevice, pCount, NULL);
+               return;
+       }
+       VkQueueFamilyProperties *properties[] = {
+               pQueueFamilyProperties + 0,
+               pQueueFamilyProperties + 1,
+               pQueueFamilyProperties + 2,
+       };
+       radv_get_physical_device_queue_family_properties(pdevice, pCount, 
properties);
+       assert(*pCount <= 3);
+}
+
 void radv_GetPhysicalDeviceQueueFamilyProperties2KHR(
        VkPhysicalDevice                            physicalDevice,
        uint32_t*                                   pCount,
        VkQueueFamilyProperties2KHR                *pQueueFamilyProperties)
 {
-       return radv_GetPhysicalDeviceQueueFamilyProperties(physicalDevice,
-                                                          pCount,
-                                                          
&pQueueFamilyProperties->queueFamilyProperties);
+       RADV_FROM_HANDLE(radv_physical_device, pdevice, physicalDevice);
+       if (!pQueueFamilyProperties) {
+               return 
radv_get_physical_device_queue_family_properties(pdevice, pCount, NULL);
+               return;
+       }
+       VkQueueFamilyProperties *properties[] = {
+               &pQueueFamilyProperties[0].queueFamilyProperties,
+               &pQueueFamilyProperties[1].queueFamilyProperties,
+               &pQueueFamilyProperties[2].queueFamilyProperties,
+       };
+       radv_get_physical_device_queue_family_properties(pdevice, pCount, 
properties);
+       assert(*pCount <= 3);
 }
 
 void radv_GetPhysicalDeviceMemoryProperties(

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

Reply via email to