From 77ab87e5a71d71d9e0cbb5df5eb84df443a03fa5 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Tue, 7 Mar 2023 21:02:44 +0100 Subject: [PATCH] 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 Reviewed-by: Christian Gmeiner Part-of: --- 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); }