Mesa (staging/22.1): venus: fix the queue init failure path

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 17 16:05:09 UTC 2022


Module: Mesa
Branch: staging/22.1
Commit: 0e3d908eb2be2cb72d10ba59d0bc975658d299ab
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0e3d908eb2be2cb72d10ba59d0bc975658d299ab

Author: Yiwei Zhang <zzyiwei at chromium.org>
Date:   Fri May 20 20:47:32 2022 +0000

venus: fix the queue init failure path

The prior behavior can ignore certain failure result, and might also
clean up queues that are never initialized.

Fixes: ddd75330559 ("venus: initial support for queue/fence/semaphore")

Signed-off-by: Yiwei Zhang <zzyiwei at chromium.org>
Reviewed-by: Chad Versace <chadversary at chromium.org>
Reviewed-by: Ryan Neph <ryanneph at google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16731>
(cherry picked from commit cb8dfa496627c38c49dd747d3ea97d44b8dc9662)

---

 .pick_status.json             |  2 +-
 src/virtio/vulkan/vn_device.c | 20 +++++++++-----------
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 23a3bf0408f..d0020e9e712 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -553,7 +553,7 @@
         "description": "venus: fix the queue init failure path",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "ddd753305598c8ac097542c0366508c47b423dce"
     },
diff --git a/src/virtio/vulkan/vn_device.c b/src/virtio/vulkan/vn_device.c
index 14cc2efe9ad..6e04afbd4a0 100644
--- a/src/virtio/vulkan/vn_device.c
+++ b/src/virtio/vulkan/vn_device.c
@@ -89,28 +89,26 @@ vn_device_init_queues(struct vn_device *dev,
    if (!queues)
       return VK_ERROR_OUT_OF_HOST_MEMORY;
 
-   VkResult result = VK_SUCCESS;
    count = 0;
    for (uint32_t i = 0; i < create_info->queueCreateInfoCount; i++) {
+      VkResult result;
+
       const VkDeviceQueueCreateInfo *queue_info =
          &create_info->pQueueCreateInfos[i];
       for (uint32_t j = 0; j < queue_info->queueCount; j++) {
          result = vn_queue_init(dev, &queues[count], queue_info, j);
-         if (result != VK_SUCCESS)
-            break;
+         if (result != VK_SUCCESS) {
+            for (uint32_t k = 0; k < count; k++)
+               vn_queue_fini(&queues[k]);
+            vk_free(alloc, queues);
+
+            return result;
+         }
 
          count++;
       }
    }
 
-   if (result != VK_SUCCESS) {
-      for (uint32_t i = 0; i < count; i++)
-         vn_queue_fini(&queues[i]);
-      vk_free(alloc, queues);
-
-      return result;
-   }
-
    dev->queues = queues;
    dev->queue_count = count;
 



More information about the mesa-commit mailing list