Home | History | Annotate | Download | only in radeonsi

Lines Matching refs:state

34 void si_pm4_cmd_begin(struct si_pm4_state *state, unsigned opcode)
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 state->pm4[state->ndw++] = dw;
45 void si_pm4_cmd_end(struct si_pm4_state *state, bool predicate)
48 count = state->ndw - state->last_pm4 - 2;
49 state->pm4[state->last_pm4] =
50 PKT3(state->last_opcode, count, predicate)
51 | PKT3_SHADER_TYPE_S(state->compute_pkt);
53 assert(state->ndw <= SI_PM4_MAX_DW);
56 void si_pm4_set_reg(struct si_pm4_state *state, unsigned reg, uint32_t val)
83 if (opcode != state->last_opcode || reg != (state->last_reg + 1)) {
84 si_pm4_cmd_begin(state, opcode);
85 si_pm4_cmd_add(state, reg);
88 state->last_reg = reg;
89 si_pm4_cmd_add(state, val);
90 si_pm4_cmd_end(state, false);
93 void si_pm4_add_bo(struct si_pm4_state *state,
98 unsigned idx = state->nbo++;
101 r600_resource_reference(&state->bo[idx], bo);
102 state->bo_usage[idx] = usage;
103 state->bo_priority[idx] = priority;
106 void si_pm4_clear_state(struct si_pm4_state *state)
108 for (int i = 0; i < state->nbo; ++i)
109 r600_resource_reference(&state->bo[i], NULL);
110 r600_resource_reference(&state->indirect_buffer, NULL);
111 state->nbo = 0;
112 state->ndw = 0;
115 void si_pm4_free_state_simple(struct si_pm4_state *state)
117 si_pm4_clear_state(state);
118 FREE(state);
122 struct si_pm4_state *state,
125 if (!state)
128 if (idx != ~0 && sctx->emitted.array[idx] == state) {
132 si_pm4_free_state_simple(state);
135 void si_pm4_emit(struct si_context *sctx, struct si_pm4_state *state)
139 for (int i = 0; i < state->nbo; ++i) {
140 radeon_add_to_buffer_list(&sctx->b, &sctx->b.gfx, state->bo[i],
141 state->bo_usage[i], state->bo_priority[i]);
144 if (!state->indirect_buffer) {
145 radeon_emit_array(cs, state->pm4, state->ndw);
147 struct r600_resource *ib = state->indirect_buffer;
163 struct si_pm4_state *state = sctx->queued.array[i];
165 if (!state || sctx->emitted.array[i] == state)
168 si_pm4_emit(sctx, state);
169 sctx->emitted.array[i] = state;
179 struct si_pm4_state *state)
182 unsigned aligned_ndw = align(state->ndw, 8);
188 assert(state->ndw);
191 r600_resource_reference(&state->indirect_buffer, NULL);
192 state->indirect_buffer = (struct r600_resource*)
195 if (!state->indirect_buffer)
200 for (int i = state->ndw; i < aligned_ndw; i++)
201 state->pm4[i] = 0x80000000; /* type2 nop packet */
203 for (int i = state->ndw; i < aligned_ndw; i++)
204 state->pm4[i] = 0xffff1000; /* type3 nop packet */
207 pipe_buffer_write(&sctx->b.b, &state->indirect_buffer->b.b,
208 0, aligned_ndw *4, state->pm4);