From c21ce0401458417287e9419abb09ac945c588e65 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 16 Jul 2023 07:42:50 -0400 Subject: [PATCH] radeonsi: move code around si_pm4_emit_state into si_pm4_emit_state Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/gallium/drivers/radeonsi/si_pm4.c | 8 +++++++- src/gallium/drivers/radeonsi/si_pm4.h | 2 +- src/gallium/drivers/radeonsi/si_state_draw.cpp | 8 +------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/radeonsi/si_pm4.c b/src/gallium/drivers/radeonsi/si_pm4.c index d3542ab..e6e51c7 100644 --- a/src/gallium/drivers/radeonsi/si_pm4.c +++ b/src/gallium/drivers/radeonsi/si_pm4.c @@ -332,10 +332,14 @@ void si_pm4_emit_commands(struct si_context *sctx, struct si_pm4_state *state) radeon_end(); } -void si_pm4_emit_state(struct si_context *sctx, struct si_pm4_state *state) +void si_pm4_emit_state(struct si_context *sctx, unsigned index) { + struct si_pm4_state *state = sctx->queued.array[index]; struct radeon_cmdbuf *cs = &sctx->gfx_cs; + /* All places should unset dirty_states if this doesn't pass. */ + assert(state && state != sctx->emitted.array[index]); + if (state->is_shader) { radeon_add_to_buffer_list(sctx, cs, ((struct si_shader*)state)->bo, RADEON_USAGE_READ | RADEON_PRIO_SHADER_BINARY); @@ -347,6 +351,8 @@ void si_pm4_emit_state(struct si_context *sctx, struct si_pm4_state *state) if (state->atom.emit) state->atom.emit(sctx, -1); + + sctx->emitted.array[index] = state; } void si_pm4_reset_emitted(struct si_context *sctx) diff --git a/src/gallium/drivers/radeonsi/si_pm4.h b/src/gallium/drivers/radeonsi/si_pm4.h index 2483dea..922314e 100644 --- a/src/gallium/drivers/radeonsi/si_pm4.h +++ b/src/gallium/drivers/radeonsi/si_pm4.h @@ -62,7 +62,7 @@ void si_pm4_clear_state(struct si_pm4_state *state, struct si_screen *sscreen, void si_pm4_free_state(struct si_context *sctx, struct si_pm4_state *state, unsigned idx); void si_pm4_emit_commands(struct si_context *sctx, struct si_pm4_state *state); -void si_pm4_emit_state(struct si_context *sctx, struct si_pm4_state *state); +void si_pm4_emit_state(struct si_context *sctx, unsigned index); void si_pm4_reset_emitted(struct si_context *sctx); struct si_pm4_state *si_pm4_create_sized(struct si_screen *sscreen, unsigned max_dw, bool is_compute_queue); diff --git a/src/gallium/drivers/radeonsi/si_state_draw.cpp b/src/gallium/drivers/radeonsi/si_state_draw.cpp index 0c7250a..c830aad 100644 --- a/src/gallium/drivers/radeonsi/si_state_draw.cpp +++ b/src/gallium/drivers/radeonsi/si_state_draw.cpp @@ -1954,13 +1954,7 @@ static void si_emit_all_states(struct si_context *sctx, unsigned skip_atom_mask) if (mask) { do { unsigned i = u_bit_scan(&mask); - struct si_pm4_state *state = sctx->queued.array[i]; - - /* All places should unset dirty_states if this doesn't pass. */ - assert(state && state != sctx->emitted.array[i]); - - si_pm4_emit_state(sctx, state); - sctx->emitted.array[i] = state; + si_pm4_emit_state(sctx, i); } while (mask); sctx->dirty_states = 0; -- 2.7.4