Lines Matching refs:rctx
37 static void r600_set_streamout_enable(struct r600_common_context *rctx, bool enable);
45 struct r600_common_context *rctx = (struct r600_common_context *)ctx; in r600_create_so_target() local
54 u_suballocator_alloc(rctx->allocator_zeroed_memory, 4, 4, in r600_create_so_target()
82 void r600_streamout_buffers_dirty(struct r600_common_context *rctx) in r600_streamout_buffers_dirty() argument
84 struct r600_atom *begin = &rctx->streamout.begin_atom; in r600_streamout_buffers_dirty()
85 unsigned num_bufs = util_bitcount(rctx->streamout.enabled_mask); in r600_streamout_buffers_dirty()
86 unsigned num_bufs_appended = util_bitcount(rctx->streamout.enabled_mask & in r600_streamout_buffers_dirty()
87 rctx->streamout.append_bitmask); in r600_streamout_buffers_dirty()
92 rctx->streamout.num_dw_for_end = in r600_streamout_buffers_dirty()
100 if (rctx->family >= CHIP_RS780 && rctx->family <= CHIP_RV740) in r600_streamout_buffers_dirty()
106 (rctx->family > CHIP_R600 && rctx->family < CHIP_RS780 ? 2 : 0); /* SURFACE_BASE_UPDATE */ in r600_streamout_buffers_dirty()
108 rctx->set_atom_dirty(rctx, begin, true); in r600_streamout_buffers_dirty()
110 r600_set_streamout_enable(rctx, true); in r600_streamout_buffers_dirty()
118 struct r600_common_context *rctx = (struct r600_common_context *)ctx; in r600_set_streamout_targets() local
123 if (rctx->streamout.num_targets && rctx->streamout.begin_emitted) { in r600_set_streamout_targets()
124 r600_emit_streamout_end(rctx); in r600_set_streamout_targets()
129 …pipe_so_target_reference((struct pipe_stream_output_target**)&rctx->streamout.targets[i], targets[… in r600_set_streamout_targets()
138 for (; i < rctx->streamout.num_targets; i++) { in r600_set_streamout_targets()
139 pipe_so_target_reference((struct pipe_stream_output_target**)&rctx->streamout.targets[i], NULL); in r600_set_streamout_targets()
142 rctx->streamout.enabled_mask = enabled_mask; in r600_set_streamout_targets()
144 rctx->streamout.num_targets = num_targets; in r600_set_streamout_targets()
145 rctx->streamout.append_bitmask = append_bitmask; in r600_set_streamout_targets()
148 r600_streamout_buffers_dirty(rctx); in r600_set_streamout_targets()
150 rctx->set_atom_dirty(rctx, &rctx->streamout.begin_atom, false); in r600_set_streamout_targets()
151 r600_set_streamout_enable(rctx, false); in r600_set_streamout_targets()
155 static void r600_flush_vgt_streamout(struct r600_common_context *rctx) in r600_flush_vgt_streamout() argument
157 struct radeon_winsys_cs *cs = rctx->gfx.cs; in r600_flush_vgt_streamout()
161 if (rctx->chip_class >= EVERGREEN) { in r600_flush_vgt_streamout()
181 static void r600_emit_streamout_begin(struct r600_common_context *rctx, struct r600_atom *atom) in r600_emit_streamout_begin() argument
183 struct radeon_winsys_cs *cs = rctx->gfx.cs; in r600_emit_streamout_begin()
184 struct r600_so_target **t = rctx->streamout.targets; in r600_emit_streamout_begin()
185 uint16_t *stride_in_dw = rctx->streamout.stride_in_dw; in r600_emit_streamout_begin()
188 r600_flush_vgt_streamout(rctx); in r600_emit_streamout_begin()
190 for (i = 0; i < rctx->streamout.num_targets; i++) { in r600_emit_streamout_begin()
206 r600_emit_reloc(rctx, &rctx->gfx, r600_resource(t[i]->b.buffer), in r600_emit_streamout_begin()
211 if (rctx->family >= CHIP_RS780 && rctx->family <= CHIP_RV740) { in r600_emit_streamout_begin()
216 r600_emit_reloc(rctx, &rctx->gfx, r600_resource(t[i]->b.buffer), in r600_emit_streamout_begin()
220 if (rctx->streamout.append_bitmask & (1 << i) && t[i]->buf_filled_size_valid) { in r600_emit_streamout_begin()
233 r600_emit_reloc(rctx, &rctx->gfx, t[i]->buf_filled_size, in r600_emit_streamout_begin()
247 if (rctx->family > CHIP_R600 && rctx->family < CHIP_RV770) { in r600_emit_streamout_begin()
251 rctx->streamout.begin_emitted = true; in r600_emit_streamout_begin()
254 void r600_emit_streamout_end(struct r600_common_context *rctx) in r600_emit_streamout_end() argument
256 struct radeon_winsys_cs *cs = rctx->gfx.cs; in r600_emit_streamout_end()
257 struct r600_so_target **t = rctx->streamout.targets; in r600_emit_streamout_end()
261 r600_flush_vgt_streamout(rctx); in r600_emit_streamout_end()
263 for (i = 0; i < rctx->streamout.num_targets; i++) { in r600_emit_streamout_end()
277 r600_emit_reloc(rctx, &rctx->gfx, t[i]->buf_filled_size, in r600_emit_streamout_end()
289 rctx->streamout.begin_emitted = false; in r600_emit_streamout_end()
290 rctx->flags |= R600_CONTEXT_STREAMOUT_FLUSH; in r600_emit_streamout_end()
300 static void r600_emit_streamout_enable(struct r600_common_context *rctx, in r600_emit_streamout_enable() argument
304 unsigned strmout_config_val = S_028B94_STREAMOUT_0_EN(r600_get_strmout_en(rctx)); in r600_emit_streamout_enable()
306 unsigned strmout_buffer_val = rctx->streamout.hw_enabled_mask & in r600_emit_streamout_enable()
307 rctx->streamout.enabled_stream_buffers_mask; in r600_emit_streamout_enable()
309 if (rctx->chip_class >= EVERGREEN) { in r600_emit_streamout_enable()
314 S_028B94_STREAMOUT_1_EN(r600_get_strmout_en(rctx)) | in r600_emit_streamout_enable()
315 S_028B94_STREAMOUT_2_EN(r600_get_strmout_en(rctx)) | in r600_emit_streamout_enable()
316 S_028B94_STREAMOUT_3_EN(r600_get_strmout_en(rctx)); in r600_emit_streamout_enable()
318 radeon_set_context_reg(rctx->gfx.cs, strmout_buffer_reg, strmout_buffer_val); in r600_emit_streamout_enable()
319 radeon_set_context_reg(rctx->gfx.cs, strmout_config_reg, strmout_config_val); in r600_emit_streamout_enable()
322 static void r600_set_streamout_enable(struct r600_common_context *rctx, bool enable) in r600_set_streamout_enable() argument
324 bool old_strmout_en = r600_get_strmout_en(rctx); in r600_set_streamout_enable()
325 unsigned old_hw_enabled_mask = rctx->streamout.hw_enabled_mask; in r600_set_streamout_enable()
327 rctx->streamout.streamout_enabled = enable; in r600_set_streamout_enable()
329 rctx->streamout.hw_enabled_mask = rctx->streamout.enabled_mask | in r600_set_streamout_enable()
330 (rctx->streamout.enabled_mask << 4) | in r600_set_streamout_enable()
331 (rctx->streamout.enabled_mask << 8) | in r600_set_streamout_enable()
332 (rctx->streamout.enabled_mask << 12); in r600_set_streamout_enable()
334 if ((old_strmout_en != r600_get_strmout_en(rctx)) || in r600_set_streamout_enable()
335 (old_hw_enabled_mask != rctx->streamout.hw_enabled_mask)) { in r600_set_streamout_enable()
336 rctx->set_atom_dirty(rctx, &rctx->streamout.enable_atom, true); in r600_set_streamout_enable()
340 void r600_update_prims_generated_query_state(struct r600_common_context *rctx, in r600_update_prims_generated_query_state() argument
344 bool old_strmout_en = r600_get_strmout_en(rctx); in r600_update_prims_generated_query_state()
346 rctx->streamout.num_prims_gen_queries += diff; in r600_update_prims_generated_query_state()
347 assert(rctx->streamout.num_prims_gen_queries >= 0); in r600_update_prims_generated_query_state()
349 rctx->streamout.prims_gen_query_enabled = in r600_update_prims_generated_query_state()
350 rctx->streamout.num_prims_gen_queries != 0; in r600_update_prims_generated_query_state()
352 if (old_strmout_en != r600_get_strmout_en(rctx)) { in r600_update_prims_generated_query_state()
353 rctx->set_atom_dirty(rctx, &rctx->streamout.enable_atom, true); in r600_update_prims_generated_query_state()
358 void r600_streamout_init(struct r600_common_context *rctx) in r600_streamout_init() argument
360 rctx->b.create_stream_output_target = r600_create_so_target; in r600_streamout_init()
361 rctx->b.stream_output_target_destroy = r600_so_target_destroy; in r600_streamout_init()
362 rctx->streamout.begin_atom.emit = r600_emit_streamout_begin; in r600_streamout_init()
363 rctx->streamout.enable_atom.emit = r600_emit_streamout_enable; in r600_streamout_init()
364 rctx->streamout.enable_atom.num_dw = 6; in r600_streamout_init()