Mesa (master): v3d: fix flushing of SSBOs and shader images

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 13 06:29:06 UTC 2019


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

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Fri Aug  9 13:02:32 2019 +0200

v3d: fix flushing of SSBOs and shader images

If the current draw call includes SSBOs, then we must flush any jobs
that are writing to the same SSBOs (so that our SSBOs reads are correct),
as well as jobs reading from the same SSBO (so that our SSBO writes don't
stomp previous SSBO reads).

The exact same logic applies to shader images. In this case we were already
flushing previous writes, but we should also flush previous reads.

Note that We don't need to call v3d_flush_jobs_reading_resource() and
v3d_flush_jobs_writing_resource() separately though, since flushing
jobs that read a resource also flushes those writing to it.

Suggested-by: Eric Anholt <eric at anholt.net>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/gallium/drivers/v3d/v3dx_draw.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/v3d/v3dx_draw.c b/src/gallium/drivers/v3d/v3dx_draw.c
index fec9d54c25b..00cbc984e4d 100644
--- a/src/gallium/drivers/v3d/v3dx_draw.c
+++ b/src/gallium/drivers/v3d/v3dx_draw.c
@@ -166,12 +166,18 @@ v3d_predraw_check_stage_inputs(struct pipe_context *pctx,
                         v3d_flush_jobs_writing_resource(v3d, cb->buffer, false);
         }
 
-        /* Flush writes to our image views */
+        /* Flush reads/writes to our SSBOs */
+        foreach_bit(i, v3d->ssbo[s].enabled_mask) {
+                struct pipe_shader_buffer *sb = &v3d->ssbo[s].sb[i];
+                if (sb->buffer)
+                        v3d_flush_jobs_reading_resource(v3d, sb->buffer);
+        }
+
+        /* Flush reads/writes to our image views */
         foreach_bit(i, v3d->shaderimg[s].enabled_mask) {
                 struct v3d_image_view *view = &v3d->shaderimg[s].si[i];
 
-                v3d_flush_jobs_writing_resource(v3d, view->base.resource,
-                                                false);
+                v3d_flush_jobs_reading_resource(v3d, view->base.resource);
         }
 
         /* Flush writes to our vertex buffers (i.e. from transform feedback) */




More information about the mesa-commit mailing list