Lines Matching refs:state
35 void si_pm4_cmd_begin(struct si_pm4_state *state, unsigned opcode) in si_pm4_cmd_begin() argument
37 state->last_opcode = opcode; in si_pm4_cmd_begin()
38 state->last_pm4 = state->ndw++; in si_pm4_cmd_begin()
41 void si_pm4_cmd_add(struct si_pm4_state *state, uint32_t dw) in si_pm4_cmd_add() argument
43 state->pm4[state->ndw++] = dw; in si_pm4_cmd_add()
46 void si_pm4_cmd_end(struct si_pm4_state *state, bool predicate) in si_pm4_cmd_end() argument
49 count = state->ndw - state->last_pm4 - 2; in si_pm4_cmd_end()
50 state->pm4[state->last_pm4] = PKT3(state->last_opcode, in si_pm4_cmd_end()
53 assert(state->ndw <= SI_PM4_MAX_DW); in si_pm4_cmd_end()
56 void si_pm4_set_reg(struct si_pm4_state *state, unsigned reg, uint32_t val) in si_pm4_set_reg() argument
78 if (opcode != state->last_opcode || reg != (state->last_reg + 1)) { in si_pm4_set_reg()
79 si_pm4_cmd_begin(state, opcode); in si_pm4_set_reg()
80 si_pm4_cmd_add(state, reg); in si_pm4_set_reg()
83 state->last_reg = reg; in si_pm4_set_reg()
84 si_pm4_cmd_add(state, val); in si_pm4_set_reg()
85 si_pm4_cmd_end(state, false); in si_pm4_set_reg()
88 void si_pm4_add_bo(struct si_pm4_state *state, in si_pm4_add_bo() argument
92 unsigned idx = state->nbo++; in si_pm4_add_bo()
95 si_resource_reference(&state->bo[idx], bo); in si_pm4_add_bo()
96 state->bo_usage[idx] = usage; in si_pm4_add_bo()
99 void si_pm4_sh_data_begin(struct si_pm4_state *state) in si_pm4_sh_data_begin() argument
101 si_pm4_cmd_begin(state, PKT3_NOP); in si_pm4_sh_data_begin()
104 void si_pm4_sh_data_add(struct si_pm4_state *state, uint32_t dw) in si_pm4_sh_data_add() argument
106 si_pm4_cmd_add(state, dw); in si_pm4_sh_data_add()
109 void si_pm4_sh_data_end(struct si_pm4_state *state, unsigned reg) in si_pm4_sh_data_end() argument
111 unsigned offs = state->last_pm4 + 1; in si_pm4_sh_data_end()
114 if (state->ndw == offs) { in si_pm4_sh_data_end()
115 state->ndw--; in si_pm4_sh_data_end()
119 si_pm4_cmd_end(state, false); in si_pm4_sh_data_end()
121 si_pm4_cmd_begin(state, PKT3_SET_SH_REG_OFFSET); in si_pm4_sh_data_end()
122 si_pm4_cmd_add(state, (reg - SI_SH_REG_OFFSET) >> 2); in si_pm4_sh_data_end()
123 state->relocs[state->nrelocs++] = state->ndw; in si_pm4_sh_data_end()
124 si_pm4_cmd_add(state, offs << 2); in si_pm4_sh_data_end()
125 si_pm4_cmd_add(state, 0); in si_pm4_sh_data_end()
126 si_pm4_cmd_end(state, false); in si_pm4_sh_data_end()
129 void si_pm4_inval_shader_cache(struct si_pm4_state *state) in si_pm4_inval_shader_cache() argument
131 state->cp_coher_cntl |= S_0085F0_SH_ICACHE_ACTION_ENA(1); in si_pm4_inval_shader_cache()
132 state->cp_coher_cntl |= S_0085F0_SH_KCACHE_ACTION_ENA(1); in si_pm4_inval_shader_cache()
135 void si_pm4_inval_texture_cache(struct si_pm4_state *state) in si_pm4_inval_texture_cache() argument
137 state->cp_coher_cntl |= S_0085F0_TC_ACTION_ENA(1); in si_pm4_inval_texture_cache()
140 void si_pm4_inval_vertex_cache(struct si_pm4_state *state) in si_pm4_inval_vertex_cache() argument
143 state->cp_coher_cntl |= S_0085F0_TC_ACTION_ENA(1); in si_pm4_inval_vertex_cache()
146 void si_pm4_inval_fb_cache(struct si_pm4_state *state, unsigned nr_cbufs) in si_pm4_inval_fb_cache() argument
148 state->cp_coher_cntl |= S_0085F0_CB_ACTION_ENA(1); in si_pm4_inval_fb_cache()
149 state->cp_coher_cntl |= ((1 << nr_cbufs) - 1) << S_0085F0_CB0_DEST_BASE_ENA_SHIFT; in si_pm4_inval_fb_cache()
152 void si_pm4_inval_zsbuf_cache(struct si_pm4_state *state) in si_pm4_inval_zsbuf_cache() argument
154 state->cp_coher_cntl |= S_0085F0_DB_ACTION_ENA(1) | S_0085F0_DB_DEST_BASE_ENA(1); in si_pm4_inval_zsbuf_cache()
158 struct si_pm4_state *state, in si_pm4_free_state() argument
161 if (state == NULL) in si_pm4_free_state()
164 if (idx != ~0 && rctx->emitted.array[idx] == state) { in si_pm4_free_state()
168 for (int i = 0; i < state->nbo; ++i) { in si_pm4_free_state()
169 si_resource_reference(&state->bo[i], NULL); in si_pm4_free_state()
171 FREE(state); in si_pm4_free_state()
179 struct si_pm4_state *state = rctx->queued.array[i]; in si_pm4_sync_flags() local
181 if (!state || rctx->emitted.array[i] == state) in si_pm4_sync_flags()
184 cp_coher_cntl |= state->cp_coher_cntl; in si_pm4_sync_flags()
194 struct si_pm4_state *state = rctx->queued.array[i]; in si_pm4_dirty_dw() local
196 if (!state || rctx->emitted.array[i] == state) in si_pm4_dirty_dw()
199 count += state->ndw; in si_pm4_dirty_dw()
205 void si_pm4_emit(struct r600_context *rctx, struct si_pm4_state *state) in si_pm4_emit() argument
208 for (int i = 0; i < state->nbo; ++i) { in si_pm4_emit()
209 r600_context_bo_reloc(rctx, state->bo[i], in si_pm4_emit()
210 state->bo_usage[i]); in si_pm4_emit()
213 memcpy(&cs->buf[cs->cdw], state->pm4, state->ndw * 4); in si_pm4_emit()
215 for (int i = 0; i < state->nrelocs; ++i) { in si_pm4_emit()
216 cs->buf[cs->cdw + state->relocs[i]] += cs->cdw << 2; in si_pm4_emit()
219 cs->cdw += state->ndw; in si_pm4_emit()
225 struct si_pm4_state *state = rctx->queued.array[i]; in si_pm4_emit_dirty() local
227 if (!state || rctx->emitted.array[i] == state) in si_pm4_emit_dirty()
230 si_pm4_emit(rctx, state); in si_pm4_emit_dirty()
231 rctx->emitted.array[i] = state; in si_pm4_emit_dirty()