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++;
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 */
}
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);
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;
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);