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

Author: Lucas Stach <[email protected]>
Date:   Fri Mar 17 17:25:11 2023 +0100

etnaviv: fix texture barrier implementation

The current implementation has a number of issues:
- it doesn't flush the depth cache, even though this can also be changed
  due to fragment shader operations and thus is included in the definition
  of glTextureBarrier
- it doesn't flush the vertex sampler cache
- it doesn't stall the pipeline until the flushes are done

Fix those issues and drop the comment, as it's pretty clear from the
code what is being done.

Signed-off-by: Lucas Stach <[email protected]>
Reviewed-by: Christian Gmeiner <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22104>

---

 src/gallium/drivers/etnaviv/etnaviv_texture.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture.c 
b/src/gallium/drivers/etnaviv/etnaviv_texture.c
index 5797412f34f..c629bdab3f6 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_texture.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_texture.c
@@ -337,9 +337,13 @@ static void
 etna_texture_barrier(struct pipe_context *pctx, unsigned flags)
 {
    struct etna_context *ctx = etna_context(pctx);
-   /* clear color and texture cache to make sure that texture unit reads
-    * what has been written */
-   etna_set_state(ctx->stream, VIVS_GL_FLUSH_CACHE, VIVS_GL_FLUSH_CACHE_COLOR 
| VIVS_GL_FLUSH_CACHE_TEXTURE);
+
+   etna_set_state(ctx->stream, VIVS_GL_FLUSH_CACHE,
+                  VIVS_GL_FLUSH_CACHE_COLOR | VIVS_GL_FLUSH_CACHE_DEPTH |
+                  VIVS_GL_FLUSH_CACHE_TEXTURE);
+   etna_set_state(ctx->stream, VIVS_GL_FLUSH_CACHE,
+                  VIVS_GL_FLUSH_CACHE_TEXTUREVS);
+   etna_stall(ctx->stream, SYNC_RECIPIENT_RA, SYNC_RECIPIENT_PE);
 }
 
 uint32_t

Reply via email to