Lines Matching refs:state

30 static void si_pm4_cmd_begin(struct si_pm4_state *state, unsigned opcode)
32 if (!state->max_dw)
33 state->max_dw = ARRAY_SIZE(state->pm4);
34 assert(state->ndw < state->max_dw);
36 state->last_opcode = opcode;
37 state->last_pm4 = state->ndw++;
40 void si_pm4_cmd_add(struct si_pm4_state *state, uint32_t dw)
42 if (!state->max_dw)
43 state->max_dw = ARRAY_SIZE(state->pm4);
44 assert(state->ndw < state->max_dw);
45 state->pm4[state->ndw++] = dw;
46 state->last_opcode = 255; /* invalid opcode */
49 static void si_pm4_cmd_end(struct si_pm4_state *state, bool predicate)
52 count = state->ndw - state->last_pm4 - 2;
53 state->pm4[state->last_pm4] = PKT3(state->last_opcode, count, predicate);
56 static void si_pm4_set_reg_custom(struct si_pm4_state *state, unsigned reg, uint32_t val,
61 if (!state->max_dw)
62 state->max_dw = ARRAY_SIZE(state->pm4);
64 assert(state->ndw + 2 <= state->max_dw);
66 if (opcode != state->last_opcode || reg != (state->last_reg + 1)) {
67 si_pm4_cmd_begin(state, opcode);
68 state->pm4[state->ndw++] = reg | (idx << 28);
72 state->last_reg = reg;
73 state->pm4[state->ndw++] = val;
74 si_pm4_cmd_end(state, false);
77 void si_pm4_set_reg(struct si_pm4_state *state, unsigned reg, uint32_t val)
104 si_pm4_set_reg_custom(state, reg, val, opcode, 0);
107 void si_pm4_set_reg_idx3(struct si_pm4_state *state, unsigned reg, uint32_t val)
111 si_pm4_set_reg_custom(state, reg - SI_SH_REG_OFFSET, val, PKT3_SET_SH_REG_INDEX, 3);
114 void si_pm4_clear_state(struct si_pm4_state *state)
116 state->ndw = 0;
119 void si_pm4_free_state(struct si_context *sctx, struct si_pm4_state *state, unsigned idx)
121 if (!state)
125 if (sctx->emitted.array[idx] == state)
128 if (sctx->queued.array[idx] == state) {
134 FREE(state);
137 void si_pm4_emit(struct si_context *sctx, struct si_pm4_state *state)
141 if (state->is_shader) {
142 radeon_add_to_buffer_list(sctx, &sctx->gfx_cs, ((struct si_shader*)state)->bo,
147 radeon_emit_array(state->pm4, state->ndw);
150 if (state->atom.emit)
151 state->atom.emit(sctx);
161 struct si_pm4_state *state = sctx->queued.array[i];
163 if (state && state->is_shader) {