1b8e80941Smrg/*
2b8e80941Smrg * Copyright 2013 Advanced Micro Devices, Inc.
3b8e80941Smrg *
4b8e80941Smrg * Permission is hereby granted, free of charge, to any person obtaining a
5b8e80941Smrg * copy of this software and associated documentation files (the "Software"),
6b8e80941Smrg * to deal in the Software without restriction, including without limitation
7b8e80941Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8b8e80941Smrg * and/or sell copies of the Software, and to permit persons to whom the
9b8e80941Smrg * Software is furnished to do so, subject to the following conditions:
10b8e80941Smrg *
11b8e80941Smrg * The above copyright notice and this permission notice (including the next
12b8e80941Smrg * paragraph) shall be included in all copies or substantial portions of the
13b8e80941Smrg * Software.
14b8e80941Smrg *
15b8e80941Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16b8e80941Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17b8e80941Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18b8e80941Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19b8e80941Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20b8e80941Smrg * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21b8e80941Smrg * SOFTWARE.
22b8e80941Smrg *
23b8e80941Smrg * Authors: Marek Olšák <maraeo@gmail.com>
24b8e80941Smrg *
25b8e80941Smrg */
26b8e80941Smrg
27b8e80941Smrg#include "r600_pipe_common.h"
28b8e80941Smrg#include "r600_cs.h"
29b8e80941Smrg
30b8e80941Smrg#include "util/u_memory.h"
31b8e80941Smrg#include "evergreend.h"
32b8e80941Smrg
33b8e80941Smrg#define R_008490_CP_STRMOUT_CNTL		     0x008490
34b8e80941Smrg#define R_028AB0_VGT_STRMOUT_EN                      0x028AB0
35b8e80941Smrg#define R_028B20_VGT_STRMOUT_BUFFER_EN               0x028B20
36b8e80941Smrg
37b8e80941Smrgstatic void r600_set_streamout_enable(struct r600_common_context *rctx, bool enable);
38b8e80941Smrg
39b8e80941Smrgstatic struct pipe_stream_output_target *
40b8e80941Smrgr600_create_so_target(struct pipe_context *ctx,
41b8e80941Smrg		      struct pipe_resource *buffer,
42b8e80941Smrg		      unsigned buffer_offset,
43b8e80941Smrg		      unsigned buffer_size)
44b8e80941Smrg{
45b8e80941Smrg	struct r600_common_context *rctx = (struct r600_common_context *)ctx;
46b8e80941Smrg	struct r600_so_target *t;
47b8e80941Smrg	struct r600_resource *rbuffer = (struct r600_resource*)buffer;
48b8e80941Smrg
49b8e80941Smrg	t = CALLOC_STRUCT(r600_so_target);
50b8e80941Smrg	if (!t) {
51b8e80941Smrg		return NULL;
52b8e80941Smrg	}
53b8e80941Smrg
54b8e80941Smrg	u_suballocator_alloc(rctx->allocator_zeroed_memory, 4, 4,
55b8e80941Smrg			     &t->buf_filled_size_offset,
56b8e80941Smrg			     (struct pipe_resource**)&t->buf_filled_size);
57b8e80941Smrg	if (!t->buf_filled_size) {
58b8e80941Smrg		FREE(t);
59b8e80941Smrg		return NULL;
60b8e80941Smrg	}
61b8e80941Smrg
62b8e80941Smrg	t->b.reference.count = 1;
63b8e80941Smrg	t->b.context = ctx;
64b8e80941Smrg	pipe_resource_reference(&t->b.buffer, buffer);
65b8e80941Smrg	t->b.buffer_offset = buffer_offset;
66b8e80941Smrg	t->b.buffer_size = buffer_size;
67b8e80941Smrg
68b8e80941Smrg	util_range_add(&rbuffer->valid_buffer_range, buffer_offset,
69b8e80941Smrg		       buffer_offset + buffer_size);
70b8e80941Smrg	return &t->b;
71b8e80941Smrg}
72b8e80941Smrg
73b8e80941Smrgstatic void r600_so_target_destroy(struct pipe_context *ctx,
74b8e80941Smrg				   struct pipe_stream_output_target *target)
75b8e80941Smrg{
76b8e80941Smrg	struct r600_so_target *t = (struct r600_so_target*)target;
77b8e80941Smrg	pipe_resource_reference(&t->b.buffer, NULL);
78b8e80941Smrg	r600_resource_reference(&t->buf_filled_size, NULL);
79b8e80941Smrg	FREE(t);
80b8e80941Smrg}
81b8e80941Smrg
82b8e80941Smrgvoid r600_streamout_buffers_dirty(struct r600_common_context *rctx)
83b8e80941Smrg{
84b8e80941Smrg	struct r600_atom *begin = &rctx->streamout.begin_atom;
85b8e80941Smrg	unsigned num_bufs = util_bitcount(rctx->streamout.enabled_mask);
86b8e80941Smrg	unsigned num_bufs_appended = util_bitcount(rctx->streamout.enabled_mask &
87b8e80941Smrg						   rctx->streamout.append_bitmask);
88b8e80941Smrg
89b8e80941Smrg	if (!num_bufs)
90b8e80941Smrg		return;
91b8e80941Smrg
92b8e80941Smrg	rctx->streamout.num_dw_for_end =
93b8e80941Smrg		12 + /* flush_vgt_streamout */
94b8e80941Smrg		num_bufs * 11; /* STRMOUT_BUFFER_UPDATE, BUFFER_SIZE */
95b8e80941Smrg
96b8e80941Smrg	begin->num_dw = 12; /* flush_vgt_streamout */
97b8e80941Smrg
98b8e80941Smrg	begin->num_dw += num_bufs * 7; /* SET_CONTEXT_REG */
99b8e80941Smrg
100b8e80941Smrg	if (rctx->family >= CHIP_RS780 && rctx->family <= CHIP_RV740)
101b8e80941Smrg		begin->num_dw += num_bufs * 5; /* STRMOUT_BASE_UPDATE */
102b8e80941Smrg
103b8e80941Smrg	begin->num_dw +=
104b8e80941Smrg		num_bufs_appended * 8 + /* STRMOUT_BUFFER_UPDATE */
105b8e80941Smrg		(num_bufs - num_bufs_appended) * 6 + /* STRMOUT_BUFFER_UPDATE */
106b8e80941Smrg		(rctx->family > CHIP_R600 && rctx->family < CHIP_RS780 ? 2 : 0); /* SURFACE_BASE_UPDATE */
107b8e80941Smrg
108b8e80941Smrg	rctx->set_atom_dirty(rctx, begin, true);
109b8e80941Smrg
110b8e80941Smrg	r600_set_streamout_enable(rctx, true);
111b8e80941Smrg}
112b8e80941Smrg
113b8e80941Smrgvoid r600_set_streamout_targets(struct pipe_context *ctx,
114b8e80941Smrg				unsigned num_targets,
115b8e80941Smrg				struct pipe_stream_output_target **targets,
116b8e80941Smrg				const unsigned *offsets)
117b8e80941Smrg{
118b8e80941Smrg	struct r600_common_context *rctx = (struct r600_common_context *)ctx;
119b8e80941Smrg	unsigned i;
120b8e80941Smrg        unsigned enabled_mask = 0, append_bitmask = 0;
121b8e80941Smrg
122b8e80941Smrg	/* Stop streamout. */
123b8e80941Smrg	if (rctx->streamout.num_targets && rctx->streamout.begin_emitted) {
124b8e80941Smrg		r600_emit_streamout_end(rctx);
125b8e80941Smrg	}
126b8e80941Smrg
127b8e80941Smrg	/* Set the new targets. */
128b8e80941Smrg	for (i = 0; i < num_targets; i++) {
129b8e80941Smrg		pipe_so_target_reference((struct pipe_stream_output_target**)&rctx->streamout.targets[i], targets[i]);
130b8e80941Smrg		if (!targets[i])
131b8e80941Smrg			continue;
132b8e80941Smrg
133b8e80941Smrg		r600_context_add_resource_size(ctx, targets[i]->buffer);
134b8e80941Smrg		enabled_mask |= 1 << i;
135b8e80941Smrg		if (offsets[i] == ((unsigned)-1))
136b8e80941Smrg			append_bitmask |= 1 << i;
137b8e80941Smrg	}
138b8e80941Smrg	for (; i < rctx->streamout.num_targets; i++) {
139b8e80941Smrg		pipe_so_target_reference((struct pipe_stream_output_target**)&rctx->streamout.targets[i], NULL);
140b8e80941Smrg	}
141b8e80941Smrg
142b8e80941Smrg	rctx->streamout.enabled_mask = enabled_mask;
143b8e80941Smrg
144b8e80941Smrg	rctx->streamout.num_targets = num_targets;
145b8e80941Smrg	rctx->streamout.append_bitmask = append_bitmask;
146b8e80941Smrg
147b8e80941Smrg	if (num_targets) {
148b8e80941Smrg		r600_streamout_buffers_dirty(rctx);
149b8e80941Smrg	} else {
150b8e80941Smrg		rctx->set_atom_dirty(rctx, &rctx->streamout.begin_atom, false);
151b8e80941Smrg		r600_set_streamout_enable(rctx, false);
152b8e80941Smrg	}
153b8e80941Smrg}
154b8e80941Smrg
155b8e80941Smrgstatic void r600_flush_vgt_streamout(struct r600_common_context *rctx)
156b8e80941Smrg{
157b8e80941Smrg	struct radeon_cmdbuf *cs = rctx->gfx.cs;
158b8e80941Smrg	unsigned reg_strmout_cntl;
159b8e80941Smrg
160b8e80941Smrg	/* The register is at different places on different ASICs. */
161b8e80941Smrg	if (rctx->chip_class >= EVERGREEN) {
162b8e80941Smrg		reg_strmout_cntl = R_0084FC_CP_STRMOUT_CNTL;
163b8e80941Smrg	} else {
164b8e80941Smrg		reg_strmout_cntl = R_008490_CP_STRMOUT_CNTL;
165b8e80941Smrg	}
166b8e80941Smrg
167b8e80941Smrg	radeon_set_config_reg(cs, reg_strmout_cntl, 0);
168b8e80941Smrg
169b8e80941Smrg	radeon_emit(cs, PKT3(PKT3_EVENT_WRITE, 0, 0));
170b8e80941Smrg	radeon_emit(cs, EVENT_TYPE(EVENT_TYPE_SO_VGTSTREAMOUT_FLUSH) | EVENT_INDEX(0));
171b8e80941Smrg
172b8e80941Smrg	radeon_emit(cs, PKT3(PKT3_WAIT_REG_MEM, 5, 0));
173b8e80941Smrg	radeon_emit(cs, WAIT_REG_MEM_EQUAL); /* wait until the register is equal to the reference value */
174b8e80941Smrg	radeon_emit(cs, reg_strmout_cntl >> 2);  /* register */
175b8e80941Smrg	radeon_emit(cs, 0);
176b8e80941Smrg	radeon_emit(cs, S_0084FC_OFFSET_UPDATE_DONE(1)); /* reference value */
177b8e80941Smrg	radeon_emit(cs, S_0084FC_OFFSET_UPDATE_DONE(1)); /* mask */
178b8e80941Smrg	radeon_emit(cs, 4); /* poll interval */
179b8e80941Smrg}
180b8e80941Smrg
181b8e80941Smrgstatic void r600_emit_streamout_begin(struct r600_common_context *rctx, struct r600_atom *atom)
182b8e80941Smrg{
183b8e80941Smrg	struct radeon_cmdbuf *cs = rctx->gfx.cs;
184b8e80941Smrg	struct r600_so_target **t = rctx->streamout.targets;
185b8e80941Smrg	uint16_t *stride_in_dw = rctx->streamout.stride_in_dw;
186b8e80941Smrg	unsigned i, update_flags = 0;
187b8e80941Smrg
188b8e80941Smrg	r600_flush_vgt_streamout(rctx);
189b8e80941Smrg
190b8e80941Smrg	for (i = 0; i < rctx->streamout.num_targets; i++) {
191b8e80941Smrg		if (!t[i])
192b8e80941Smrg			continue;
193b8e80941Smrg
194b8e80941Smrg		t[i]->stride_in_dw = stride_in_dw[i];
195b8e80941Smrg
196b8e80941Smrg		uint64_t va = r600_resource(t[i]->b.buffer)->gpu_address;
197b8e80941Smrg
198b8e80941Smrg		update_flags |= SURFACE_BASE_UPDATE_STRMOUT(i);
199b8e80941Smrg
200b8e80941Smrg		radeon_set_context_reg_seq(cs, R_028AD0_VGT_STRMOUT_BUFFER_SIZE_0 + 16*i, 3);
201b8e80941Smrg		radeon_emit(cs, (t[i]->b.buffer_offset +
202b8e80941Smrg				 t[i]->b.buffer_size) >> 2);	/* BUFFER_SIZE (in DW) */
203b8e80941Smrg		radeon_emit(cs, stride_in_dw[i]);		/* VTX_STRIDE (in DW) */
204b8e80941Smrg		radeon_emit(cs, va >> 8);			/* BUFFER_BASE */
205b8e80941Smrg
206b8e80941Smrg		r600_emit_reloc(rctx, &rctx->gfx, r600_resource(t[i]->b.buffer),
207b8e80941Smrg				RADEON_USAGE_WRITE, RADEON_PRIO_SHADER_RW_BUFFER);
208b8e80941Smrg
209b8e80941Smrg		/* R7xx requires this packet after updating BUFFER_BASE.
210b8e80941Smrg		 * Without this, R7xx locks up. */
211b8e80941Smrg		if (rctx->family >= CHIP_RS780 && rctx->family <= CHIP_RV740) {
212b8e80941Smrg			radeon_emit(cs, PKT3(PKT3_STRMOUT_BASE_UPDATE, 1, 0));
213b8e80941Smrg			radeon_emit(cs, i);
214b8e80941Smrg			radeon_emit(cs, va >> 8);
215b8e80941Smrg
216b8e80941Smrg			r600_emit_reloc(rctx, &rctx->gfx, r600_resource(t[i]->b.buffer),
217b8e80941Smrg					RADEON_USAGE_WRITE, RADEON_PRIO_SHADER_RW_BUFFER);
218b8e80941Smrg		}
219b8e80941Smrg
220b8e80941Smrg		if (rctx->streamout.append_bitmask & (1 << i) && t[i]->buf_filled_size_valid) {
221b8e80941Smrg			uint64_t va = t[i]->buf_filled_size->gpu_address +
222b8e80941Smrg				      t[i]->buf_filled_size_offset;
223b8e80941Smrg
224b8e80941Smrg			/* Append. */
225b8e80941Smrg			radeon_emit(cs, PKT3(PKT3_STRMOUT_BUFFER_UPDATE, 4, 0));
226b8e80941Smrg			radeon_emit(cs, STRMOUT_SELECT_BUFFER(i) |
227b8e80941Smrg				    STRMOUT_OFFSET_SOURCE(STRMOUT_OFFSET_FROM_MEM)); /* control */
228b8e80941Smrg			radeon_emit(cs, 0); /* unused */
229b8e80941Smrg			radeon_emit(cs, 0); /* unused */
230b8e80941Smrg			radeon_emit(cs, va); /* src address lo */
231b8e80941Smrg			radeon_emit(cs, va >> 32); /* src address hi */
232b8e80941Smrg
233b8e80941Smrg			r600_emit_reloc(rctx,  &rctx->gfx, t[i]->buf_filled_size,
234b8e80941Smrg					RADEON_USAGE_READ, RADEON_PRIO_SO_FILLED_SIZE);
235b8e80941Smrg		} else {
236b8e80941Smrg			/* Start from the beginning. */
237b8e80941Smrg			radeon_emit(cs, PKT3(PKT3_STRMOUT_BUFFER_UPDATE, 4, 0));
238b8e80941Smrg			radeon_emit(cs, STRMOUT_SELECT_BUFFER(i) |
239b8e80941Smrg				    STRMOUT_OFFSET_SOURCE(STRMOUT_OFFSET_FROM_PACKET)); /* control */
240b8e80941Smrg			radeon_emit(cs, 0); /* unused */
241b8e80941Smrg			radeon_emit(cs, 0); /* unused */
242b8e80941Smrg			radeon_emit(cs, t[i]->b.buffer_offset >> 2); /* buffer offset in DW */
243b8e80941Smrg			radeon_emit(cs, 0); /* unused */
244b8e80941Smrg		}
245b8e80941Smrg	}
246b8e80941Smrg
247b8e80941Smrg	if (rctx->family > CHIP_R600 && rctx->family < CHIP_RV770) {
248b8e80941Smrg		radeon_emit(cs, PKT3(PKT3_SURFACE_BASE_UPDATE, 0, 0));
249b8e80941Smrg		radeon_emit(cs, update_flags);
250b8e80941Smrg	}
251b8e80941Smrg	rctx->streamout.begin_emitted = true;
252b8e80941Smrg}
253b8e80941Smrg
254b8e80941Smrgvoid r600_emit_streamout_end(struct r600_common_context *rctx)
255b8e80941Smrg{
256b8e80941Smrg	struct radeon_cmdbuf *cs = rctx->gfx.cs;
257b8e80941Smrg	struct r600_so_target **t = rctx->streamout.targets;
258b8e80941Smrg	unsigned i;
259b8e80941Smrg	uint64_t va;
260b8e80941Smrg
261b8e80941Smrg	r600_flush_vgt_streamout(rctx);
262b8e80941Smrg
263b8e80941Smrg	for (i = 0; i < rctx->streamout.num_targets; i++) {
264b8e80941Smrg		if (!t[i])
265b8e80941Smrg			continue;
266b8e80941Smrg
267b8e80941Smrg		va = t[i]->buf_filled_size->gpu_address + t[i]->buf_filled_size_offset;
268b8e80941Smrg		radeon_emit(cs, PKT3(PKT3_STRMOUT_BUFFER_UPDATE, 4, 0));
269b8e80941Smrg		radeon_emit(cs, STRMOUT_SELECT_BUFFER(i) |
270b8e80941Smrg			    STRMOUT_OFFSET_SOURCE(STRMOUT_OFFSET_NONE) |
271b8e80941Smrg			    STRMOUT_STORE_BUFFER_FILLED_SIZE); /* control */
272b8e80941Smrg		radeon_emit(cs, va);     /* dst address lo */
273b8e80941Smrg		radeon_emit(cs, va >> 32); /* dst address hi */
274b8e80941Smrg		radeon_emit(cs, 0); /* unused */
275b8e80941Smrg		radeon_emit(cs, 0); /* unused */
276b8e80941Smrg
277b8e80941Smrg		r600_emit_reloc(rctx,  &rctx->gfx, t[i]->buf_filled_size,
278b8e80941Smrg				RADEON_USAGE_WRITE, RADEON_PRIO_SO_FILLED_SIZE);
279b8e80941Smrg
280b8e80941Smrg		/* Zero the buffer size. The counters (primitives generated,
281b8e80941Smrg		 * primitives emitted) may be enabled even if there is not
282b8e80941Smrg		 * buffer bound. This ensures that the primitives-emitted query
283b8e80941Smrg		 * won't increment. */
284b8e80941Smrg		radeon_set_context_reg(cs, R_028AD0_VGT_STRMOUT_BUFFER_SIZE_0 + 16*i, 0);
285b8e80941Smrg
286b8e80941Smrg		t[i]->buf_filled_size_valid = true;
287b8e80941Smrg	}
288b8e80941Smrg
289b8e80941Smrg	rctx->streamout.begin_emitted = false;
290b8e80941Smrg	rctx->flags |= R600_CONTEXT_STREAMOUT_FLUSH;
291b8e80941Smrg}
292b8e80941Smrg
293b8e80941Smrg/* STREAMOUT CONFIG DERIVED STATE
294b8e80941Smrg *
295b8e80941Smrg * Streamout must be enabled for the PRIMITIVES_GENERATED query to work.
296b8e80941Smrg * The buffer mask is an independent state, so no writes occur if there
297b8e80941Smrg * are no buffers bound.
298b8e80941Smrg */
299b8e80941Smrg
300b8e80941Smrgstatic void r600_emit_streamout_enable(struct r600_common_context *rctx,
301b8e80941Smrg				       struct r600_atom *atom)
302b8e80941Smrg{
303b8e80941Smrg	unsigned strmout_config_reg = R_028AB0_VGT_STRMOUT_EN;
304b8e80941Smrg	unsigned strmout_config_val = S_028B94_STREAMOUT_0_EN(r600_get_strmout_en(rctx));
305b8e80941Smrg	unsigned strmout_buffer_reg = R_028B20_VGT_STRMOUT_BUFFER_EN;
306b8e80941Smrg	unsigned strmout_buffer_val = rctx->streamout.hw_enabled_mask &
307b8e80941Smrg				      rctx->streamout.enabled_stream_buffers_mask;
308b8e80941Smrg
309b8e80941Smrg	if (rctx->chip_class >= EVERGREEN) {
310b8e80941Smrg		strmout_buffer_reg = R_028B98_VGT_STRMOUT_BUFFER_CONFIG;
311b8e80941Smrg
312b8e80941Smrg		strmout_config_reg = R_028B94_VGT_STRMOUT_CONFIG;
313b8e80941Smrg		strmout_config_val |=
314b8e80941Smrg			S_028B94_STREAMOUT_1_EN(r600_get_strmout_en(rctx)) |
315b8e80941Smrg			S_028B94_STREAMOUT_2_EN(r600_get_strmout_en(rctx)) |
316b8e80941Smrg			S_028B94_STREAMOUT_3_EN(r600_get_strmout_en(rctx));
317b8e80941Smrg	}
318b8e80941Smrg	radeon_set_context_reg(rctx->gfx.cs, strmout_buffer_reg, strmout_buffer_val);
319b8e80941Smrg	radeon_set_context_reg(rctx->gfx.cs, strmout_config_reg, strmout_config_val);
320b8e80941Smrg}
321b8e80941Smrg
322b8e80941Smrgstatic void r600_set_streamout_enable(struct r600_common_context *rctx, bool enable)
323b8e80941Smrg{
324b8e80941Smrg	bool old_strmout_en = r600_get_strmout_en(rctx);
325b8e80941Smrg	unsigned old_hw_enabled_mask = rctx->streamout.hw_enabled_mask;
326b8e80941Smrg
327b8e80941Smrg	rctx->streamout.streamout_enabled = enable;
328b8e80941Smrg
329b8e80941Smrg	rctx->streamout.hw_enabled_mask = rctx->streamout.enabled_mask |
330b8e80941Smrg					  (rctx->streamout.enabled_mask << 4) |
331b8e80941Smrg					  (rctx->streamout.enabled_mask << 8) |
332b8e80941Smrg					  (rctx->streamout.enabled_mask << 12);
333b8e80941Smrg
334b8e80941Smrg	if ((old_strmout_en != r600_get_strmout_en(rctx)) ||
335b8e80941Smrg            (old_hw_enabled_mask != rctx->streamout.hw_enabled_mask)) {
336b8e80941Smrg		rctx->set_atom_dirty(rctx, &rctx->streamout.enable_atom, true);
337b8e80941Smrg	}
338b8e80941Smrg}
339b8e80941Smrg
340b8e80941Smrgvoid r600_update_prims_generated_query_state(struct r600_common_context *rctx,
341b8e80941Smrg					     unsigned type, int diff)
342b8e80941Smrg{
343b8e80941Smrg	if (type == PIPE_QUERY_PRIMITIVES_GENERATED) {
344b8e80941Smrg		bool old_strmout_en = r600_get_strmout_en(rctx);
345b8e80941Smrg
346b8e80941Smrg		rctx->streamout.num_prims_gen_queries += diff;
347b8e80941Smrg		assert(rctx->streamout.num_prims_gen_queries >= 0);
348b8e80941Smrg
349b8e80941Smrg		rctx->streamout.prims_gen_query_enabled =
350b8e80941Smrg			rctx->streamout.num_prims_gen_queries != 0;
351b8e80941Smrg
352b8e80941Smrg		if (old_strmout_en != r600_get_strmout_en(rctx)) {
353b8e80941Smrg			rctx->set_atom_dirty(rctx, &rctx->streamout.enable_atom, true);
354b8e80941Smrg		}
355b8e80941Smrg	}
356b8e80941Smrg}
357b8e80941Smrg
358b8e80941Smrgvoid r600_streamout_init(struct r600_common_context *rctx)
359b8e80941Smrg{
360b8e80941Smrg	rctx->b.create_stream_output_target = r600_create_so_target;
361b8e80941Smrg	rctx->b.stream_output_target_destroy = r600_so_target_destroy;
362b8e80941Smrg	rctx->streamout.begin_atom.emit = r600_emit_streamout_begin;
363b8e80941Smrg	rctx->streamout.enable_atom.emit = r600_emit_streamout_enable;
364b8e80941Smrg	rctx->streamout.enable_atom.num_dw = 6;
365b8e80941Smrg}
366