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

Author: Iago Toral Quiroga <[email protected]>
Date:   Wed Jul 27 10:42:38 2022 +0200

v3dv: tell job_compute_frame_tiling whether we want to use double-buffer mode

We want to have control over the double-buffer setting here so we can control
explicitly from the driver when we want to enable this mode.

Reviewed-by: Alejandro PiƱeiro <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17854>

---

 src/broadcom/vulkan/v3dv_cmd_buffer.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/src/broadcom/vulkan/v3dv_cmd_buffer.c 
b/src/broadcom/vulkan/v3dv_cmd_buffer.c
index 6e60204148e..f1ba1a94aa1 100644
--- a/src/broadcom/vulkan/v3dv_cmd_buffer.c
+++ b/src/broadcom/vulkan/v3dv_cmd_buffer.c
@@ -357,7 +357,8 @@ job_compute_frame_tiling(struct v3dv_job *job,
                          uint32_t layers,
                          uint32_t render_target_count,
                          uint8_t max_internal_bpp,
-                         bool msaa)
+                         bool msaa,
+                         bool double_buffer)
 {
    assert(job);
    struct v3dv_frame_tiling *tiling = &job->frame_tiling;
@@ -368,18 +369,9 @@ job_compute_frame_tiling(struct v3dv_job *job,
    tiling->render_target_count = render_target_count;
    tiling->msaa = msaa;
    tiling->internal_bpp = max_internal_bpp;
+   tiling->double_buffer = double_buffer;
 
-   /* We can use double-buffer when MSAA is disabled to reduce tile store
-    * overhead.
-    *
-    * FIXME: if we are emitting any tile loads the hardware will serialize
-    * loads and stores across tiles effectivley disabling double buffering,
-    * so we would want to check for that and not enable it in that case to
-    * avoid reducing the tile size.
-    */
-   tiling->double_buffer =
-      unlikely(V3D_DEBUG & V3D_DEBUG_DOUBLE_BUFFER) && !msaa;
-
+   /* Double-buffer is incompatible with MSAA */
    assert(!tiling->msaa || !tiling->double_buffer);
 
    v3d_choose_tile_size(render_target_count, max_internal_bpp,
@@ -478,11 +470,18 @@ v3dv_job_start_frame(struct v3dv_job *job,
 {
    assert(job);
 
+   /* FIXME: if we are emitting any tile loads the hardware will serialize
+    * loads and stores across tiles effectively disabling double buffering,
+    * so we would want to check for that and not enable it in that case to
+    * avoid reducing the tile size.
+    */
+   bool double_buffer = unlikely(V3D_DEBUG & V3D_DEBUG_DOUBLE_BUFFER) && !msaa;
+
    /* Start by computing frame tiling spec for this job */
    const struct v3dv_frame_tiling *tiling =
-      job_compute_frame_tiling(job,
-                               width, height, layers,
-                               render_target_count, max_internal_bpp, msaa);
+      job_compute_frame_tiling(job, width, height, layers,
+                               render_target_count, max_internal_bpp,
+                               msaa, double_buffer);
 
    v3dv_cl_ensure_space_with_branch(&job->bcl, 256);
    v3dv_return_if_oom(NULL, job);

Reply via email to