Mesa (main): v3dv: use wait stage for wait semaphores to decide about binning syncs

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu May 5 09:28:00 UTC 2022


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

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Wed May  4 11:07:07 2022 +0200

v3dv: use wait stage for wait semaphores to decide about binning syncs

If the wait stage for a semaphore doesn't involve geometry stages we
don't need a binning sync.

Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16322>

---

 src/broadcom/vulkan/v3dv_queue.c | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/src/broadcom/vulkan/v3dv_queue.c b/src/broadcom/vulkan/v3dv_queue.c
index 68d94129d14..eb78bef9bc3 100644
--- a/src/broadcom/vulkan/v3dv_queue.c
+++ b/src/broadcom/vulkan/v3dv_queue.c
@@ -659,9 +659,9 @@ handle_cl_job(struct v3dv_queue *queue,
    assert(bo_idx == submit.bo_handle_count);
    submit.bo_handles = (uintptr_t)(void *)bo_handles;
 
-   /* We need a binning sync if we are waiting on a semaphore or if the job
-    * comes after a pipeline barrier that involves geometry stages
-    * (needs_bcl_sync).
+   /* We need a binning sync if we are waiting on a semaphore with a wait stage
+    * that involves the geometry pipeline, or if the job comes after a pipeline
+    * barrier that involves geometry stages (needs_bcl_sync).
     *
     * We need a render sync if the job doesn't need a binning sync but has
     * still been flagged for serialization. It should be noted that RCL jobs
@@ -673,9 +673,20 @@ handle_cl_job(struct v3dv_queue *queue,
     * command buffer after the first job where we should be able to track bcl
     * dependencies strictly through barriers.
     */
-   const bool needs_bcl_sync =
-      sync_info->wait_count > 0 || job->needs_bcl_sync;
-   const bool needs_rcl_sync = job->serialize && !needs_bcl_sync;
+   bool needs_bcl_sync = job->needs_bcl_sync;
+   for (int i = 0; !needs_bcl_sync && i < sync_info->wait_count; i++) {
+      needs_bcl_sync = sync_info->waits[i].stage_mask &
+         (VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT |
+          VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT |
+          VK_PIPELINE_STAGE_ALL_COMMANDS_BIT |
+          VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT |
+          VK_PIPELINE_STAGE_VERTEX_INPUT_BIT |
+          VK_PIPELINE_STAGE_VERTEX_SHADER_BIT |
+          VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT |
+          VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT |
+          VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT);
+   }
+   bool needs_rcl_sync = job->serialize && !needs_bcl_sync;
 
    /* Replace single semaphore settings whenever our kernel-driver supports
     * multiple semaphores extension.



More information about the mesa-commit mailing list