etnaviv: flush shader caches when UBO content is modified

Shader load/stores are cached by the shader L1 cache. As UBOs on etnaviv
are implemented as regular loads from the constant buffer, this cache
needs to be flushed whenever the content of a constant buffer is modified.

Fixes most of the currently failing dEQP-GLES3.functional.ubo.* on GC3000.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31527>
This commit is contained in:
Lucas Stach 2024-10-04 14:04:30 +02:00 committed by Marge Bot
parent 78b614b333
commit a422ebc500
4 changed files with 6 additions and 0 deletions

View file

@ -143,6 +143,7 @@ struct etna_context {
ETNA_DIRTY_TEXTURE_CACHES = (1 << 18),
ETNA_DIRTY_DERIVE_TS = (1 << 19),
ETNA_DIRTY_SCISSOR_CLIP = (1 << 20),
ETNA_DIRTY_SHADER_CACHES = (1 << 21),
} dirty;
struct slab_child_pool transfer_pool;

View file

@ -259,6 +259,8 @@ etna_emit_state(struct etna_context *ctx)
to_flush |= VIVS_GL_FLUSH_CACHE_TEXTURE;
to_flush_separate |= VIVS_GL_FLUSH_CACHE_TEXTUREVS;
}
if (unlikely(dirty & ETNA_DIRTY_SHADER_CACHES))
to_flush |= VIVS_GL_FLUSH_CACHE_SHADER_L1;
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)) {

View file

@ -101,6 +101,7 @@ etna_set_constant_buffer(struct pipe_context *pctx,
if (!cb->buffer) {
struct pipe_constant_buffer *cb = &so->cb[index];
u_upload_data(pctx->const_uploader, 0, cb->buffer_size, 16, cb->user_buffer, &cb->buffer_offset, &cb->buffer);
ctx->dirty |= ETNA_DIRTY_SHADER_CACHES;
}
so->enabled_mask |= 1 << index;

View file

@ -164,6 +164,8 @@ etna_transfer_unmap(struct pipe_context *pctx, struct pipe_transfer *ptrans)
if (rsc->base.bind & PIPE_BIND_SAMPLER_VIEW)
ctx->dirty |= ETNA_DIRTY_TEXTURE_CACHES;
if (rsc->base.bind & PIPE_BIND_CONSTANT_BUFFER)
ctx->dirty |= ETNA_DIRTY_SHADER_CACHES;
}
/* We need to have the patched data ready for the GPU. */