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 <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22104>
This commit is contained in:
Lucas Stach 2023-03-07 21:02:44 +01:00 committed by Marge Bot
parent e7ee11f89a
commit 77ab87e5a7

View file

@ -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);
}