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

Author: Lucas Stach <[email protected]>
Date:   Tue Mar  7 21:02:44 2023 +0100

etnaviv: flush VS texture cache when texture data is changed

If a sampler resource is changed the vertex texture caches also need to
be flushed, as those are separate from the fragment texture caches.

It seems that some cores need the VS sampler cache flush to be in a
separate state. I have seen no adverse effects of merging the TEXTUREVS
flush into a single flush state emission on GC3000 and up, but the blob
always emits the vertex sampler cache flush as a separate state, so do
the same here to avoid nasty surprises.

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_emit.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_emit.c 
b/src/gallium/drivers/etnaviv/etnaviv_emit.c
index ddf1397c22e..3753a521324 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_emit.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c
@@ -230,20 +230,27 @@ etna_emit_state(struct etna_context *ctx)
    uint32_t dirty = ctx->dirty;
 
    /* Pre-processing: see what caches we need to flush before making state 
changes. */
-   uint32_t to_flush = 0;
+   uint32_t to_flush = 0, to_flush_separate = 0;
    if (unlikely(dirty & (ETNA_DIRTY_BLEND)))
       to_flush |= VIVS_GL_FLUSH_CACHE_COLOR;
    if (unlikely(dirty & ETNA_DIRTY_ZSA))
       to_flush |= VIVS_GL_FLUSH_CACHE_DEPTH;
-   if (unlikely(dirty & (ETNA_DIRTY_TEXTURE_CACHES)))
+   if (unlikely(dirty & (ETNA_DIRTY_TEXTURE_CACHES))) {
       to_flush |= VIVS_GL_FLUSH_CACHE_TEXTURE;
+      to_flush_separate |= VIVS_GL_FLUSH_CACHE_TEXTUREVS;
+   }
    if (unlikely(dirty & (ETNA_DIRTY_FRAMEBUFFER))) /* Framebuffer config 
changed? */
       to_flush |= VIVS_GL_FLUSH_CACHE_COLOR | VIVS_GL_FLUSH_CACHE_DEPTH;
-   if (DBG_ENABLED(ETNA_DBG_CFLUSH_ALL))
-      to_flush |= VIVS_GL_FLUSH_CACHE_TEXTURE | VIVS_GL_FLUSH_CACHE_COLOR | 
VIVS_GL_FLUSH_CACHE_DEPTH;
+   if (DBG_ENABLED(ETNA_DBG_CFLUSH_ALL)) {
+      to_flush |= VIVS_GL_FLUSH_CACHE_TEXTURE | VIVS_GL_FLUSH_CACHE_COLOR |
+                  VIVS_GL_FLUSH_CACHE_DEPTH;
+      to_flush_separate |= VIVS_GL_FLUSH_CACHE_TEXTUREVS;
+   }
 
    if (to_flush) {
       etna_set_state(stream, VIVS_GL_FLUSH_CACHE, to_flush);
+      if (to_flush_separate)
+         etna_set_state(stream, VIVS_GL_FLUSH_CACHE, to_flush_separate);
       etna_stall(stream, SYNC_RECIPIENT_RA, SYNC_RECIPIENT_PE);
    }
 

Reply via email to