anv: Only wait for queue sync if execbuf was properly executed
authorJosé Roberto de Souza <jose.souza@intel.com>
Tue, 16 Aug 2022 20:57:55 +0000 (13:57 -0700)
committerMarge Bot <emma+marge@anholt.net>
Mon, 22 Aug 2022 22:04:52 +0000 (22:04 +0000)
In case execbuf failed it would block execution until the maximum
timeout if DEBUG_SYNC is enabled.

While at it also removing the shadowing of result that would cause
the function result to not have its values updated in case
vk_sync_wait() returns a error.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18110>

src/intel/vulkan/anv_batch_chain.c

index 389ae18..e81df2f 100644 (file)
@@ -2264,11 +2264,9 @@ anv_queue_exec_locked(struct anv_queue *queue,
    if (ret)
       result = vk_queue_set_lost(&queue->vk, "execbuf2 failed: %m");
 
-   if (queue->sync) {
-      VkResult result = vk_sync_wait(&device->vk,
-                                     queue->sync, 0,
-                                     VK_SYNC_WAIT_COMPLETE,
-                                     UINT64_MAX);
+   if (result == VK_SUCCESS && queue->sync) {
+      result = vk_sync_wait(&device->vk, queue->sync, 0,
+                            VK_SYNC_WAIT_COMPLETE, UINT64_MAX);
       if (result != VK_SUCCESS)
          result = vk_queue_set_lost(&queue->vk, "sync wait failed");
    }