radeonsi: replace SI_PM4_MAX_DW with a max_dw field
it will vary 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:
parent
005fc20a34
commit
a031cd3c2f
|
@ -29,7 +29,9 @@
|
|||
|
||||
static void si_pm4_cmd_begin(struct si_pm4_state *state, unsigned opcode)
|
||||
{
|
||||
assert(state->ndw < SI_PM4_MAX_DW);
|
||||
if (!state->max_dw)
|
||||
state->max_dw = ARRAY_SIZE(state->pm4);
|
||||
assert(state->ndw < state->max_dw);
|
||||
assert(opcode <= 254);
|
||||
state->last_opcode = opcode;
|
||||
state->last_pm4 = state->ndw++;
|
||||
|
@ -37,7 +39,9 @@ static void si_pm4_cmd_begin(struct si_pm4_state *state, unsigned opcode)
|
|||
|
||||
void si_pm4_cmd_add(struct si_pm4_state *state, uint32_t dw)
|
||||
{
|
||||
assert(state->ndw < SI_PM4_MAX_DW);
|
||||
if (!state->max_dw)
|
||||
state->max_dw = ARRAY_SIZE(state->pm4);
|
||||
assert(state->ndw < state->max_dw);
|
||||
state->pm4[state->ndw++] = dw;
|
||||
state->last_opcode = 255; /* invalid opcode */
|
||||
}
|
||||
|
@ -78,7 +82,10 @@ void si_pm4_set_reg(struct si_pm4_state *state, unsigned reg, uint32_t val)
|
|||
|
||||
reg >>= 2;
|
||||
|
||||
assert(state->ndw + 2 <= SI_PM4_MAX_DW);
|
||||
if (!state->max_dw)
|
||||
state->max_dw = ARRAY_SIZE(state->pm4);
|
||||
|
||||
assert(state->ndw + 2 <= state->max_dw);
|
||||
|
||||
if (opcode != state->last_opcode || reg != (state->last_reg + 1)) {
|
||||
si_pm4_cmd_begin(state, opcode);
|
||||
|
|
|
@ -31,9 +31,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* TODO: This is high because of cs_preamble with ac_set_reg_cu_en. */
|
||||
#define SI_PM4_MAX_DW 480
|
||||
|
||||
// forward defines
|
||||
struct si_context;
|
||||
|
||||
|
@ -56,7 +53,8 @@ struct si_pm4_state {
|
|||
struct si_atom atom;
|
||||
|
||||
/* commands for the DE */
|
||||
uint32_t pm4[SI_PM4_MAX_DW];
|
||||
uint16_t max_dw;
|
||||
uint32_t pm4[480];
|
||||
};
|
||||
|
||||
void si_pm4_cmd_add(struct si_pm4_state *state, uint32_t dw);
|
||||
|
|
Loading…
Reference in New Issue