Mesa (main): lavapipe: Use VK_OUTARRAY for GetPhysicalDeviceQueueFamilyProperties[2]
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Mar 18 17:23:12 UTC 2022
Module: Mesa
Branch: main
Commit: dc8fdab71efdc3e516f2a8abdfdc2dec05fce448
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=dc8fdab71efdc3e516f2a8abdfdc2dec05fce448
Author: Jason Ekstrand <jason.ekstrand at collabora.com>
Date: Fri Mar 18 09:54:37 2022 -0500
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: b38879f8c5f5 ("vallium: initial import of the vulkan frontend")
Acked-by: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15459>
---
src/gallium/frontends/lavapipe/lvp_device.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c
index ca75bde73da..dece67c2bc9 100644
--- a/src/gallium/frontends/lavapipe/lvp_device.c
+++ b/src/gallium/frontends/lavapipe/lvp_device.c
@@ -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(
More information about the mesa-commit
mailing list