From 1811ccf1256662ae5d0c2b6f26916e8369497d1d Mon Sep 17 00:00:00 2001 From: Bas Nieuwenhuizen Date: Fri, 10 Feb 2017 21:23:04 +0100 Subject: radv: Fix radv_GetPhysicalDeviceQueueFamilyProperties2KHR. The struct have different size, so the arrays have different stride. Signed-off-by: Bas Nieuwenhuizen Reviewed-by: Dave Airlie --- src/amd/vulkan/radv_device.c | 45 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) (limited to 'src/amd/vulkan') diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 8a54a2ad03b..fff31259028 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( -- cgit v1.2.3