radeonsi: pack si_pm4_state

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14122>
This commit is contained in:
Marek Olšák 2021-12-08 18:32:33 -05:00
parent 3ea5beca1f
commit 005fc20a34
2 changed files with 10 additions and 8 deletions

View file

@ -30,6 +30,7 @@
static void si_pm4_cmd_begin(struct si_pm4_state *state, unsigned opcode)
{
assert(state->ndw < SI_PM4_MAX_DW);
assert(opcode <= 254);
state->last_opcode = opcode;
state->last_pm4 = state->ndw++;
}
@ -38,7 +39,7 @@ void si_pm4_cmd_add(struct si_pm4_state *state, uint32_t dw)
{
assert(state->ndw < SI_PM4_MAX_DW);
state->pm4[state->ndw++] = dw;
state->last_opcode = -1;
state->last_opcode = 255; /* invalid opcode */
}
static void si_pm4_cmd_end(struct si_pm4_state *state, bool predicate)
@ -84,6 +85,7 @@ void si_pm4_set_reg(struct si_pm4_state *state, unsigned reg, uint32_t val)
state->pm4[state->ndw++] = reg;
}
assert(reg <= UINT16_MAX);
state->last_reg = reg;
state->pm4[state->ndw++] = val;
si_pm4_cmd_end(state, false);

View file

@ -46,17 +46,17 @@ struct si_atom {
struct si_pm4_state {
/* PKT3_SET_*_REG handling */
unsigned last_opcode;
unsigned last_reg;
unsigned last_pm4;
/* commands for the DE */
unsigned ndw;
uint32_t pm4[SI_PM4_MAX_DW];
uint16_t last_reg; /* register offset in dwords */
uint16_t last_pm4;
uint16_t ndw; /* number of dwords in pm4 */
uint8_t last_opcode;
/* For shader states only */
bool is_shader;
struct si_atom atom;
/* commands for the DE */
uint32_t pm4[SI_PM4_MAX_DW];
};
void si_pm4_cmd_add(struct si_pm4_state *state, uint32_t dw);