lavapipe: Use VK_OUTARRAY for GetPhysicalDeviceQueueFamilyProperties[2]

This fixes bugs with lavapipe's hand-rolled pCount handling.  The driver
is supposed to set *pCount to the number of queues actually written in
the case where it's initialized to a value that's too large.  It's also
supposed to handle *pCount being too small.

Fixes: b38879f8c5 ("vallium: initial import of the vulkan frontend")
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15459>
This commit is contained in:
Jason Ekstrand 2022-03-18 09:54:37 -05:00
parent 91cb714dc1
commit dc8fdab71e

View file

@ -1132,13 +1132,11 @@ VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceQueueFamilyProperties(
uint32_t* pCount,
VkQueueFamilyProperties* pQueueFamilyProperties)
{
if (pQueueFamilyProperties == NULL) {
*pCount = 1;
return;
}
VK_OUTARRAY_MAKE(out, pQueueFamilyProperties, pCount);
assert(*pCount >= 1);
lvp_get_physical_device_queue_family_properties(pQueueFamilyProperties);
vk_outarray_append(&out, p) {
lvp_get_physical_device_queue_family_properties(p);
}
}
VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceQueueFamilyProperties2(
@ -1146,13 +1144,11 @@ VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceQueueFamilyProperties2(
uint32_t* pCount,
VkQueueFamilyProperties2 *pQueueFamilyProperties)
{
if (pQueueFamilyProperties == NULL) {
*pCount = 1;
return;
}
VK_OUTARRAY_MAKE(out, pQueueFamilyProperties, pCount);
assert(*pCount >= 1);
lvp_get_physical_device_queue_family_properties(&pQueueFamilyProperties->queueFamilyProperties);
vk_outarray_append(&out, p) {
lvp_get_physical_device_queue_family_properties(&p->queueFamilyProperties);
}
}
VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceMemoryProperties(