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 <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38998>
This commit is contained in:
Lucas Stach 2025-12-17 15:43:24 +01:00 committed by Marge Bot
parent d7d690b47f
commit 57dc4cf4fb

View file

@ -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