Mesa (main): vulkan/wsi: handle queue families properly for non-concurrent sharing mode.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Mar 2 21:21:22 UTC 2022


Module: Mesa
Branch: main
Commit: 48b3ef625e1909c1be31fbe10adb53734af38eb4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=48b3ef625e1909c1be31fbe10adb53734af38eb4

Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Feb 21 15:43:39 2022 +1000

vulkan/wsi: handle queue families properly for non-concurrent sharing mode.

"queueFamilyIndexCount is the number of queue families having access to the image(s) of the
swapchain when imageSharingMode is VK_SHARING_MODE_CONCURRENT.
pQueueFamilyIndices is a pointer to an array of queue family indices having access to the
images(s) of the swapchain when imageSharingMode is VK_SHARING_MODE_CONCURRENT."

If the type isn't concurrent, don't attempt to access the arrays.

dEQP-VK.wsi.xlib.swapchain.create.exclusive_nonzero_queues on lavapipe.

Fixes: 5b13d74583513 ("vulkan/wsi/drm: Break create_native_image in pieces")
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15101>

---

 src/vulkan/wsi/wsi_common.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index 5351b83a4f3..5c89e7ceb1f 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -362,16 +362,22 @@ wsi_configure_image(const struct wsi_swapchain *chain,
                     struct wsi_image_info *info)
 {
    memset(info, 0, sizeof(*info));
+   uint32_t *queue_family_indices;
 
-   uint32_t *queue_family_indices =
-      vk_alloc(&chain->alloc,
-               sizeof(*queue_family_indices) *
-               pCreateInfo->queueFamilyIndexCount,
-               8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
-   if (!queue_family_indices)
-      goto err_oom;
-   for (uint32_t i = 0; i < pCreateInfo->queueFamilyIndexCount; i++)
-      queue_family_indices[i] = pCreateInfo->pQueueFamilyIndices[i];
+   if (pCreateInfo->imageSharingMode == VK_SHARING_MODE_CONCURRENT) {
+      queue_family_indices =
+         vk_alloc(&chain->alloc,
+                  sizeof(*queue_family_indices) *
+                  pCreateInfo->queueFamilyIndexCount,
+                  8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+      if (!queue_family_indices)
+         goto err_oom;
+
+      for (uint32_t i = 0; i < pCreateInfo->queueFamilyIndexCount; i++)
+         queue_family_indices[i] = pCreateInfo->pQueueFamilyIndices[i];
+   } else {
+      queue_family_indices = NULL;
+   }
 
    info->create = (VkImageCreateInfo) {
       .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,



More information about the mesa-commit mailing list