From: Marek Olšák Date: Sun, 16 Jul 2023 13:46:15 +0000 (-0400) Subject: radeonsi: add a simple version of si_pm4_emit_state for non-shader states X-Git-Tag: upstream/23.3.3~3157 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c3129b2b83955277f9dc73f4acb0dfb0ad50e566;p=platform%2Fupstream%2Fmesa.git radeonsi: add a simple version of si_pm4_emit_state for non-shader states Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- diff --git a/src/gallium/drivers/radeonsi/si_pm4.c b/src/gallium/drivers/radeonsi/si_pm4.c index 9263f35..58badc4 100644 --- a/src/gallium/drivers/radeonsi/si_pm4.c +++ b/src/gallium/drivers/radeonsi/si_pm4.c @@ -340,19 +340,23 @@ void si_pm4_emit_state(struct si_context *sctx, unsigned index) /* 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); - } - radeon_begin(cs); radeon_emit_array(state->pm4, state->ndw); radeon_end(); + sctx->emitted.array[index] = state; +} + +void si_pm4_emit_shader(struct si_context *sctx, unsigned index) +{ + struct si_pm4_state *state = sctx->queued.array[index]; + + si_pm4_emit_state(sctx, index); + + radeon_add_to_buffer_list(sctx, &sctx->gfx_cs, ((struct si_shader*)state)->bo, + RADEON_USAGE_READ | RADEON_PRIO_SHADER_BINARY); 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 922314e..39f72ed 100644 --- a/src/gallium/drivers/radeonsi/si_pm4.h +++ b/src/gallium/drivers/radeonsi/si_pm4.h @@ -39,7 +39,6 @@ struct si_pm4_state { bool packed_is_padded; /* whether SET_*_REG_PAIRS_PACKED is padded to an even number of regs */ /* For shader states only */ - bool is_shader; struct si_atom atom; /* commands for the DE */ @@ -63,6 +62,7 @@ void si_pm4_free_state(struct si_context *sctx, struct si_pm4_state *state, unsi void si_pm4_emit_commands(struct si_context *sctx, struct si_pm4_state *state); void si_pm4_emit_state(struct si_context *sctx, unsigned index); +void si_pm4_emit_shader(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.c b/src/gallium/drivers/radeonsi/si_state.c index 2b7e6d9..83bbf09 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -5413,8 +5413,16 @@ void si_init_state_compute_functions(struct si_context *sctx) void si_init_state_functions(struct si_context *sctx) { - for (unsigned i = 0; i < ARRAY_SIZE(sctx->atoms.s.pm4_states); i++) - sctx->atoms.s.pm4_states[i].emit = si_pm4_emit_state; + sctx->atoms.s.pm4_states[SI_STATE_IDX(blend)].emit = si_pm4_emit_state; + sctx->atoms.s.pm4_states[SI_STATE_IDX(rasterizer)].emit = si_pm4_emit_state; + sctx->atoms.s.pm4_states[SI_STATE_IDX(dsa)].emit = si_pm4_emit_state; + sctx->atoms.s.pm4_states[SI_STATE_IDX(poly_offset)].emit = si_pm4_emit_state; + sctx->atoms.s.pm4_states[SI_STATE_IDX(ls)].emit = si_pm4_emit_shader; + sctx->atoms.s.pm4_states[SI_STATE_IDX(hs)].emit = si_pm4_emit_shader; + sctx->atoms.s.pm4_states[SI_STATE_IDX(es)].emit = si_pm4_emit_shader; + sctx->atoms.s.pm4_states[SI_STATE_IDX(gs)].emit = si_pm4_emit_shader; + sctx->atoms.s.pm4_states[SI_STATE_IDX(vs)].emit = si_pm4_emit_shader; + sctx->atoms.s.pm4_states[SI_STATE_IDX(ps)].emit = si_pm4_emit_shader; sctx->atoms.s.framebuffer.emit = si_emit_framebuffer_state; sctx->atoms.s.db_render_state.emit = si_emit_db_render_state; diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.cpp b/src/gallium/drivers/radeonsi/si_state_shaders.cpp index d8cfc8e..4c6d6b0 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.cpp +++ b/src/gallium/drivers/radeonsi/si_state_shaders.cpp @@ -612,7 +612,6 @@ si_get_shader_pm4_state(struct si_shader *shader, void (*emit_func)(struct si_context *ctx, unsigned index)) { si_pm4_clear_state(&shader->pm4, shader->selector->screen, false); - shader->pm4.is_shader = true; shader->pm4.atom.emit = emit_func; return &shader->pm4; }