Mesa (staging/22.0): lavapipe: Use VK_OUTARRAY for GetPhysicalDeviceQueueFamilyProperties[2]

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 14 21:33:37 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: 886bbfedf1e41c9671c91768e75f77e9fdd5445c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=886bbfedf1e41c9671c91768e75f77e9fdd5445c

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>
(cherry picked from commit dc8fdab71efdc3e516f2a8abdfdc2dec05fce448)

---

 .pick_status.json                           |  2 +-
 src/gallium/frontends/lavapipe/lvp_device.c | 20 ++++++++------------
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index e5522cef3bc..ba2f27b0f4b 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -8900,7 +8900,7 @@
         "description": "lavapipe: Use VK_OUTARRAY for GetPhysicalDeviceQueueFamilyProperties[2]",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 5,
+        "resolution": 1,
         "because_sha": "b38879f8c5f57b7f1802e433e33181bdf5e72aef"
     },
     {
diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c
index 8809cb2b2cb..7863fe9527e 100644
--- a/src/gallium/frontends/lavapipe/lvp_device.c
+++ b/src/gallium/frontends/lavapipe/lvp_device.c
@@ -1056,13 +1056,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(
@@ -1070,13 +1068,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