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

Author: Benjamin Cheng <[email protected]>
Date:   Sun Apr  3 19:03:56 2022 -0400

vulkan/queue: Destroy wait temps if they are skipped

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6223
Fixes: 8a11d2a31bf9 ("vulkan: Add a dummy sync type")
Reviewed-by: Jason Ekstrand <[email protected]>
Tested-by: Jakob Bornecrantz <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15727>
(cherry picked from commit 4489933842168df2e8705b4461ba0636ad670faf)

---

 .pick_status.json             |  2 +-
 src/vulkan/runtime/vk_queue.c | 10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 08880c2e217..a4657bc784d 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -652,7 +652,7 @@
         "description": "vulkan/queue: Destroy wait temps if they are skipped",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "because_sha": "8a11d2a31bf931deca05c79871aeaf1441fb777e"
     },
     {
diff --git a/src/vulkan/runtime/vk_queue.c b/src/vulkan/runtime/vk_queue.c
index a1ff0ba0283..9aef3e9505d 100644
--- a/src/vulkan/runtime/vk_queue.c
+++ b/src/vulkan/runtime/vk_queue.c
@@ -293,8 +293,16 @@ vk_queue_submit_final(struct vk_queue *queue,
          continue;
 
       /* Waits on dummy vk_syncs are no-ops */
-      if (vk_sync_type_is_dummy(submit->waits[i].sync->type))
+      if (vk_sync_type_is_dummy(submit->waits[i].sync->type)) {
+         /* We are about to lose track of this wait, if it has a temporary
+          * we need to destroy it now, as vk_queue_submit_cleanup will not
+          * know about it */
+         if (submit->_wait_temps[i] != NULL) {
+            vk_sync_destroy(queue->base.device, submit->_wait_temps[i]);
+            submit->waits[i].sync = NULL;
+         }
          continue;
+      }
 
       /* For emulated timelines, we have a binary vk_sync associated with
        * each time point and pass the binary vk_sync to the driver.

Reply via email to