anv: only signal wsi fence BO on last command buffer
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Sun, 6 Dec 2020 21:22:45 +0000 (23:22 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 9 Feb 2021 21:08:52 +0000 (21:08 +0000)
I'm pretty sure this doesn't fix anything because the WSI code only
use a single VkSubmitInfo, but better be safe.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: ccb7d606f1a293 ("anv: Use submit-time implicit sync instead of allocate-time")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8934>

src/intel/vulkan/anv_queue.c

index 6f2bdc0..220a024 100644 (file)
@@ -1351,7 +1351,8 @@ VkResult anv_QueueSubmit(
             num_in_semaphores = pSubmits[i].waitSemaphoreCount;
          }
 
-         if (j == pSubmits[i].commandBufferCount - 1) {
+         const bool is_last_cmd_buffer = j == pSubmits[i].commandBufferCount - 1;
+         if (is_last_cmd_buffer) {
             /* Only the last batch gets the out semaphores */
             out_semaphores = pSubmits[i].pSignalSemaphores;
             out_values = signal_values;
@@ -1361,7 +1362,8 @@ VkResult anv_QueueSubmit(
          result = anv_queue_submit(queue, cmd_buffer,
                                    in_semaphores, in_values, num_in_semaphores,
                                    out_semaphores, out_values, num_out_semaphores,
-                                   wsi_signal_bo, execbuf_fence,
+                                   is_last_cmd_buffer ? wsi_signal_bo : NULL,
+                                   execbuf_fence,
                                    perf_info ? perf_info->counterPassIndex : 0);
          if (result != VK_SUCCESS)
             goto out;