From 57dc4cf4fba8c93b0a9a6de20e871d0fdf646bdd Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Wed, 17 Dec 2025 15:43:24 +0100 Subject: [PATCH] etnaviv: don't emit steering state when uniforms are unchanged The steering bits tell the GPU which caches to invalidate on the subsequent uniform state writes. There is no point in writing those steering bits when there are no uniforms to emit. Signed-off-by: Lucas Stach Reviewed-by: Christian Gmeiner Part-of: --- src/gallium/drivers/etnaviv/etnaviv_emit.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_emit.c b/src/gallium/drivers/etnaviv/etnaviv_emit.c index f002f000751..86acf80c682 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_emit.c +++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c @@ -800,19 +800,17 @@ etna_emit_state(struct etna_context *ctx) etna_stall(stream, SYNC_RECIPIENT_RA, SYNC_RECIPIENT_PE); } } else { - /* ideally this cache would only be flushed if there are VS uniform changes */ - if (need_steering) - etna_set_state(stream, VIVS_SH_CONTROL, 0x0); - - if (dirty & (uniform_dirty_bits | ctx->shader.vs->uniforms_dirty_bits)) + if (dirty & (uniform_dirty_bits | ctx->shader.vs->uniforms_dirty_bits)) { + if (need_steering) + etna_set_state(stream, VIVS_SH_CONTROL, 0x0); etna_uniforms_write(ctx, ctx->shader.vs, ctx->constant_buffer[MESA_SHADER_VERTEX].cb); + } - /* ideally this cache would only be flushed if there are PS uniform changes */ - if (need_steering) - etna_set_state(stream, VIVS_SH_CONTROL, VIVS_SH_CONTROL_PS_UNIFORM); - - if (dirty & (uniform_dirty_bits | ctx->shader.fs->uniforms_dirty_bits)) + if (dirty & (uniform_dirty_bits | ctx->shader.fs->uniforms_dirty_bits)) { + if (need_steering) + etna_set_state(stream, VIVS_SH_CONTROL, VIVS_SH_CONTROL_PS_UNIFORM); etna_uniforms_write(ctx, ctx->shader.fs, ctx->constant_buffer[MESA_SHADER_FRAGMENT].cb); + } } /**** End of state update ****/ #undef EMIT_STATE