2 * Copyright 2008 Corbin Simpson <MostAwesomeDude@gmail.com>
3 * Copyright 2009 Marek Olšák <maraeo@gmail.com>
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * on the rights to use, copy, modify, merge, publish, distribute, sub
9 * license, and/or sell copies of the Software, and to permit persons to whom
10 * the Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22 * USE OR OTHER DEALINGS IN THE SOFTWARE. */
24 /* r300_emit: Functions for emitting state. */
26 #include "util/u_format.h"
27 #include "util/u_math.h"
28 #include "util/u_simple_list.h"
30 #include "r300_context.h"
32 #include "r300_emit.h"
34 #include "r300_screen.h"
35 #include "r300_screen_buffer.h"
38 void r300_emit_blend_state(struct r300_context
* r300
,
39 unsigned size
, void* state
)
41 struct r300_blend_state
* blend
= (struct r300_blend_state
*)state
;
42 struct pipe_framebuffer_state
* fb
=
43 (struct pipe_framebuffer_state
*)r300
->fb_state
.state
;
47 OUT_CS_REG(R300_RB3D_ROPCNTL
, blend
->rop
);
48 OUT_CS_REG_SEQ(R300_RB3D_CBLEND
, 3);
50 OUT_CS(blend
->blend_control
);
51 OUT_CS(blend
->alpha_blend_control
);
52 OUT_CS(blend
->color_channel_mask
);
57 /* XXX also disable fastfill here once it's supported */
59 OUT_CS_REG(R300_RB3D_DITHER_CTL
, blend
->dither
);
63 void r300_emit_blend_color_state(struct r300_context
* r300
,
64 unsigned size
, void* state
)
66 struct r300_blend_color_state
* bc
= (struct r300_blend_color_state
*)state
;
69 if (r300
->screen
->caps
.is_r500
) {
71 OUT_CS_REG_SEQ(R500_RB3D_CONSTANT_COLOR_AR
, 2);
72 OUT_CS(bc
->blend_color_red_alpha
);
73 OUT_CS(bc
->blend_color_green_blue
);
77 OUT_CS_REG(R300_RB3D_BLEND_COLOR
, bc
->blend_color
);
82 void r300_emit_clip_state(struct r300_context
* r300
,
83 unsigned size
, void* state
)
85 struct pipe_clip_state
* clip
= (struct pipe_clip_state
*)state
;
88 if (r300
->screen
->caps
.has_tcl
) {
90 OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG
,
91 (r300
->screen
->caps
.is_r500
?
92 R500_PVS_UCP_START
: R300_PVS_UCP_START
));
93 OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA
, 6 * 4);
94 OUT_CS_TABLE(clip
->ucp
, 6 * 4);
95 OUT_CS_REG(R300_VAP_CLIP_CNTL
, ((1 << clip
->nr
) - 1) |
96 R300_PS_UCP_MODE_CLIP_AS_TRIFAN
);
100 OUT_CS_REG(R300_VAP_CLIP_CNTL
, R300_CLIP_DISABLE
);
105 void r300_emit_dsa_state(struct r300_context
* r300
, unsigned size
, void* state
)
107 struct r300_dsa_state
* dsa
= (struct r300_dsa_state
*)state
;
108 struct pipe_framebuffer_state
* fb
=
109 (struct pipe_framebuffer_state
*)r300
->fb_state
.state
;
110 struct pipe_stencil_ref stencil_ref
= r300
->stencil_ref
;
114 OUT_CS_REG(R300_FG_ALPHA_FUNC
, dsa
->alpha_function
);
115 OUT_CS_REG_SEQ(R300_ZB_CNTL
, 3);
118 OUT_CS(dsa
->z_buffer_control
);
119 OUT_CS(dsa
->z_stencil_control
);
125 OUT_CS(dsa
->stencil_ref_mask
| stencil_ref
.ref_value
[0]);
127 if (r300
->screen
->caps
.is_r500
) {
128 OUT_CS_REG(R500_ZB_STENCILREFMASK_BF
, dsa
->stencil_ref_bf
| stencil_ref
.ref_value
[1]);
133 static const float * get_rc_constant_state(
134 struct r300_context
* r300
,
135 struct rc_constant
* constant
)
137 struct r300_textures_state
* texstate
= r300
->textures_state
.state
;
138 static float vec
[4] = { 0.0, 0.0, 0.0, 1.0 };
139 struct pipe_resource
*tex
;
141 assert(constant
->Type
== RC_CONSTANT_STATE
);
143 switch (constant
->u
.State
[0]) {
144 /* Factor for converting rectangle coords to
145 * normalized coords. Should only show up on non-r500. */
146 case RC_STATE_R300_TEXRECT_FACTOR
:
147 tex
= texstate
->sampler_views
[constant
->u
.State
[1]]->base
.texture
;
148 vec
[0] = 1.0 / tex
->width0
;
149 vec
[1] = 1.0 / tex
->height0
;
152 case RC_STATE_R300_VIEWPORT_SCALE
:
153 vec
[0] = r300
->viewport
.scale
[0];
154 vec
[1] = r300
->viewport
.scale
[1];
155 vec
[2] = r300
->viewport
.scale
[2];
158 case RC_STATE_R300_VIEWPORT_OFFSET
:
159 vec
[0] = r300
->viewport
.translate
[0];
160 vec
[1] = r300
->viewport
.translate
[1];
161 vec
[2] = r300
->viewport
.translate
[2];
165 fprintf(stderr
, "r300: Implementation error: "
166 "Unknown RC_CONSTANT type %d\n", constant
->u
.State
[0]);
169 /* This should either be (0, 0, 0, 1), which should be a relatively safe
170 * RGBA or STRQ value, or it could be one of the RC_CONSTANT_STATE
175 /* Convert a normal single-precision float into the 7.16 format
176 * used by the R300 fragment shader.
178 static uint32_t pack_float24(float f
)
186 uint32_t float24
= 0;
193 mantissa
= frexpf(f
, &exponent
);
197 float24
|= (1 << 23);
198 mantissa
= mantissa
* -1.0;
200 /* Handle exponent, bias of 63 */
202 float24
|= (exponent
<< 16);
203 /* Kill 7 LSB of mantissa */
204 float24
|= (u
.u
& 0x7FFFFF) >> 7;
209 unsigned r300_get_fs_atom_size(struct r300_context
*r300
)
211 struct r300_fragment_shader
*fs
= r300_fs(r300
);
212 unsigned imm_count
= fs
->shader
->immediates_count
;
213 struct r300_fragment_program_code
*code
= &fs
->shader
->code
.code
.r300
;
216 code
->alu
.length
* 4 +
217 (code
->tex
.length
? (1 + code
->tex
.length
) : 0) +
218 (imm_count
? imm_count
* 5 : 0);
221 void r300_emit_fs(struct r300_context
* r300
, unsigned size
, void *state
)
223 struct r300_fragment_shader
*fs
= r300_fs(r300
);
224 struct rX00_fragment_program_code
* generic_code
= &fs
->shader
->code
;
225 struct r300_fragment_program_code
* code
= &generic_code
->code
.r300
;
227 unsigned imm_count
= fs
->shader
->immediates_count
;
228 unsigned imm_first
= fs
->shader
->externals_count
;
229 unsigned imm_end
= generic_code
->constants
.Count
;
230 struct rc_constant
*constants
= generic_code
->constants
.Constants
;
234 OUT_CS_REG(R300_US_CONFIG
, code
->config
);
235 OUT_CS_REG(R300_US_PIXSIZE
, code
->pixsize
);
236 OUT_CS_REG(R300_US_CODE_OFFSET
, code
->code_offset
);
238 OUT_CS_REG_SEQ(R300_US_CODE_ADDR_0
, 4);
239 OUT_CS_TABLE(code
->code_addr
, 4);
241 OUT_CS_REG_SEQ(R300_US_ALU_RGB_INST_0
, code
->alu
.length
);
242 for (i
= 0; i
< code
->alu
.length
; i
++)
243 OUT_CS(code
->alu
.inst
[i
].rgb_inst
);
245 OUT_CS_REG_SEQ(R300_US_ALU_RGB_ADDR_0
, code
->alu
.length
);
246 for (i
= 0; i
< code
->alu
.length
; i
++)
247 OUT_CS(code
->alu
.inst
[i
].rgb_addr
);
249 OUT_CS_REG_SEQ(R300_US_ALU_ALPHA_INST_0
, code
->alu
.length
);
250 for (i
= 0; i
< code
->alu
.length
; i
++)
251 OUT_CS(code
->alu
.inst
[i
].alpha_inst
);
253 OUT_CS_REG_SEQ(R300_US_ALU_ALPHA_ADDR_0
, code
->alu
.length
);
254 for (i
= 0; i
< code
->alu
.length
; i
++)
255 OUT_CS(code
->alu
.inst
[i
].alpha_addr
);
257 if (code
->tex
.length
) {
258 OUT_CS_REG_SEQ(R300_US_TEX_INST_0
, code
->tex
.length
);
259 OUT_CS_TABLE(code
->tex
.inst
, code
->tex
.length
);
262 /* Emit immediates. */
264 for(i
= imm_first
; i
< imm_end
; ++i
) {
265 if (constants
[i
].Type
== RC_CONSTANT_IMMEDIATE
) {
266 const float *data
= constants
[i
].u
.Immediate
;
268 OUT_CS_REG_SEQ(R300_PFS_PARAM_0_X
+ i
* 16, 4);
269 OUT_CS(pack_float24(data
[0]));
270 OUT_CS(pack_float24(data
[1]));
271 OUT_CS(pack_float24(data
[2]));
272 OUT_CS(pack_float24(data
[3]));
277 OUT_CS_REG(R300_FG_DEPTH_SRC
, fs
->shader
->fg_depth_src
);
278 OUT_CS_REG(R300_US_W_FMT
, fs
->shader
->us_out_w
);
282 void r300_emit_fs_constants(struct r300_context
* r300
, unsigned size
, void *state
)
284 struct r300_fragment_shader
*fs
= r300_fs(r300
);
285 struct rc_constant_list
*constants
= &fs
->shader
->code
.constants
;
286 struct r300_constant_buffer
*buf
= (struct r300_constant_buffer
*)state
;
287 unsigned i
, count
= fs
->shader
->externals_count
;
294 OUT_CS_REG_SEQ(R300_PFS_PARAM_0_X
, count
* 4);
295 for(i
= 0; i
< count
; ++i
) {
297 assert(constants
->Constants
[i
].Type
== RC_CONSTANT_EXTERNAL
);
298 data
= buf
->constants
[i
];
299 OUT_CS(pack_float24(data
[0]));
300 OUT_CS(pack_float24(data
[1]));
301 OUT_CS(pack_float24(data
[2]));
302 OUT_CS(pack_float24(data
[3]));
307 void r300_emit_fs_rc_constant_state(struct r300_context
* r300
, unsigned size
, void *state
)
309 struct r300_fragment_shader
*fs
= r300_fs(r300
);
310 struct rc_constant_list
*constants
= &fs
->shader
->code
.constants
;
312 unsigned count
= fs
->shader
->rc_state_count
;
313 unsigned first
= fs
->shader
->externals_count
;
314 unsigned end
= constants
->Count
;
321 for(i
= first
; i
< end
; ++i
) {
322 if (constants
->Constants
[i
].Type
== RC_CONSTANT_STATE
) {
324 get_rc_constant_state(r300
, &constants
->Constants
[i
]);
326 OUT_CS_REG_SEQ(R300_PFS_PARAM_0_X
+ i
* 16, 4);
327 OUT_CS(pack_float24(data
[0]));
328 OUT_CS(pack_float24(data
[1]));
329 OUT_CS(pack_float24(data
[2]));
330 OUT_CS(pack_float24(data
[3]));
336 unsigned r500_get_fs_atom_size(struct r300_context
*r300
)
338 struct r300_fragment_shader
*fs
= r300_fs(r300
);
339 unsigned imm_count
= fs
->shader
->immediates_count
;
340 struct r500_fragment_program_code
*code
= &fs
->shader
->code
.code
.r500
;
343 ((code
->inst_end
+ 1) * 6) +
344 (imm_count
? imm_count
* 7 : 0);
347 void r500_emit_fs(struct r300_context
* r300
, unsigned size
, void *state
)
349 struct r300_fragment_shader
*fs
= r300_fs(r300
);
350 struct rX00_fragment_program_code
* generic_code
= &fs
->shader
->code
;
351 struct r500_fragment_program_code
* code
= &generic_code
->code
.r500
;
353 unsigned imm_count
= fs
->shader
->immediates_count
;
354 unsigned imm_first
= fs
->shader
->externals_count
;
355 unsigned imm_end
= generic_code
->constants
.Count
;
356 struct rc_constant
*constants
= generic_code
->constants
.Constants
;
360 OUT_CS_REG(R500_US_CONFIG
, R500_ZERO_TIMES_ANYTHING_EQUALS_ZERO
);
361 OUT_CS_REG(R500_US_PIXSIZE
, code
->max_temp_idx
);
362 OUT_CS_REG(R500_US_CODE_RANGE
,
363 R500_US_CODE_RANGE_ADDR(0) | R500_US_CODE_RANGE_SIZE(code
->inst_end
));
364 OUT_CS_REG(R500_US_CODE_OFFSET
, 0);
365 OUT_CS_REG(R500_US_CODE_ADDR
,
366 R500_US_CODE_START_ADDR(0) | R500_US_CODE_END_ADDR(code
->inst_end
));
368 OUT_CS_REG(R500_GA_US_VECTOR_INDEX
, R500_GA_US_VECTOR_INDEX_TYPE_INSTR
);
369 OUT_CS_ONE_REG(R500_GA_US_VECTOR_DATA
, (code
->inst_end
+ 1) * 6);
370 for (i
= 0; i
<= code
->inst_end
; i
++) {
371 OUT_CS(code
->inst
[i
].inst0
);
372 OUT_CS(code
->inst
[i
].inst1
);
373 OUT_CS(code
->inst
[i
].inst2
);
374 OUT_CS(code
->inst
[i
].inst3
);
375 OUT_CS(code
->inst
[i
].inst4
);
376 OUT_CS(code
->inst
[i
].inst5
);
379 /* Emit immediates. */
381 for(i
= imm_first
; i
< imm_end
; ++i
) {
382 if (constants
[i
].Type
== RC_CONSTANT_IMMEDIATE
) {
383 const float *data
= constants
[i
].u
.Immediate
;
385 OUT_CS_REG(R500_GA_US_VECTOR_INDEX
,
386 R500_GA_US_VECTOR_INDEX_TYPE_CONST
|
387 (i
& R500_GA_US_VECTOR_INDEX_MASK
));
388 OUT_CS_ONE_REG(R500_GA_US_VECTOR_DATA
, 4);
389 OUT_CS_TABLE(data
, 4);
394 OUT_CS_REG(R300_FG_DEPTH_SRC
, fs
->shader
->fg_depth_src
);
395 OUT_CS_REG(R300_US_W_FMT
, fs
->shader
->us_out_w
);
399 void r500_emit_fs_constants(struct r300_context
* r300
, unsigned size
, void *state
)
401 struct r300_fragment_shader
*fs
= r300_fs(r300
);
402 struct rc_constant_list
*constants
= &fs
->shader
->code
.constants
;
403 struct r300_constant_buffer
*buf
= (struct r300_constant_buffer
*)state
;
404 unsigned i
, count
= fs
->shader
->externals_count
;
411 OUT_CS_REG(R500_GA_US_VECTOR_INDEX
, R500_GA_US_VECTOR_INDEX_TYPE_CONST
);
412 OUT_CS_ONE_REG(R500_GA_US_VECTOR_DATA
, count
* 4);
413 for(i
= 0; i
< count
; ++i
) {
414 assert(constants
->Constants
[i
].Type
== RC_CONSTANT_EXTERNAL
);
416 OUT_CS_TABLE(buf
->constants
, count
* 4);
420 void r500_emit_fs_rc_constant_state(struct r300_context
* r300
, unsigned size
, void *state
)
422 struct r300_fragment_shader
*fs
= r300_fs(r300
);
423 struct rc_constant_list
*constants
= &fs
->shader
->code
.constants
;
425 unsigned count
= fs
->shader
->rc_state_count
;
426 unsigned first
= fs
->shader
->externals_count
;
427 unsigned end
= constants
->Count
;
434 for(i
= first
; i
< end
; ++i
) {
435 if (constants
->Constants
[i
].Type
== RC_CONSTANT_STATE
) {
437 get_rc_constant_state(r300
, &constants
->Constants
[i
]);
439 OUT_CS_REG(R500_GA_US_VECTOR_INDEX
,
440 R500_GA_US_VECTOR_INDEX_TYPE_CONST
|
441 (i
& R500_GA_US_VECTOR_INDEX_MASK
));
442 OUT_CS_ONE_REG(R500_GA_US_VECTOR_DATA
, 4);
443 OUT_CS_TABLE(data
, 4);
449 void r300_emit_fb_state(struct r300_context
* r300
, unsigned size
, void* state
)
451 struct pipe_framebuffer_state
* fb
= (struct pipe_framebuffer_state
*)state
;
452 struct r300_texture
* tex
;
453 struct pipe_surface
* surf
;
459 /* Flush and free renderbuffer caches. */
460 OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT
,
461 R300_RB3D_DSTCACHE_CTLSTAT_DC_FREE_FREE_3D_TAGS
|
462 R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D
);
463 OUT_CS_REG(R300_ZB_ZCACHE_CTLSTAT
,
464 R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE
|
465 R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE
);
467 /* Set the number of colorbuffers. */
468 if (fb
->nr_cbufs
> 1) {
469 if (r300
->screen
->caps
.is_r500
) {
470 OUT_CS_REG(R300_RB3D_CCTL
,
471 R300_RB3D_CCTL_NUM_MULTIWRITES(fb
->nr_cbufs
) |
472 R300_RB3D_CCTL_INDEPENDENT_COLORFORMAT_ENABLE_ENABLE
);
474 OUT_CS_REG(R300_RB3D_CCTL
,
475 R300_RB3D_CCTL_NUM_MULTIWRITES(fb
->nr_cbufs
));
478 OUT_CS_REG(R300_RB3D_CCTL
, 0x0);
481 /* Set up colorbuffers. */
482 for (i
= 0; i
< fb
->nr_cbufs
; i
++) {
484 tex
= r300_texture(surf
->texture
);
485 assert(tex
&& tex
->buffer
&& "cbuf is marked, but NULL!");
487 OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0
+ (4 * i
), 1);
488 OUT_CS_TEX_RELOC(tex
, surf
->offset
, 0, tex
->domain
, 0);
490 OUT_CS_REG_SEQ(R300_RB3D_COLORPITCH0
+ (4 * i
), 1);
491 OUT_CS_TEX_RELOC(tex
, tex
->fb_state
.colorpitch
[surf
->level
],
494 OUT_CS_REG(R300_US_OUT_FMT_0
+ (4 * i
), tex
->fb_state
.us_out_fmt
);
497 OUT_CS_REG(R300_US_OUT_FMT_0
+ (4 * i
), R300_US_OUT_FMT_UNUSED
);
500 /* Set up a zbuffer. */
503 tex
= r300_texture(surf
->texture
);
504 assert(tex
&& tex
->buffer
&& "zsbuf is marked, but NULL!");
506 OUT_CS_REG_SEQ(R300_ZB_DEPTHOFFSET
, 1);
507 OUT_CS_TEX_RELOC(tex
, surf
->offset
, 0, tex
->domain
, 0);
509 OUT_CS_REG(R300_ZB_FORMAT
, tex
->fb_state
.zb_format
);
511 OUT_CS_REG_SEQ(R300_ZB_DEPTHPITCH
, 1);
512 OUT_CS_TEX_RELOC(tex
, tex
->fb_state
.depthpitch
[surf
->level
],
516 OUT_CS_REG_SEQ(R300_SC_SCISSORS_TL
, 2);
517 if (r300
->screen
->caps
.is_r500
) {
519 OUT_CS(((fb
->width
- 1) << R300_SCISSORS_X_SHIFT
) |
520 ((fb
->height
- 1) << R300_SCISSORS_Y_SHIFT
));
522 OUT_CS((1440 << R300_SCISSORS_X_SHIFT
) |
523 (1440 << R300_SCISSORS_Y_SHIFT
));
524 OUT_CS(((fb
->width
+ 1440-1) << R300_SCISSORS_X_SHIFT
) |
525 ((fb
->height
+ 1440-1) << R300_SCISSORS_Y_SHIFT
));
530 void r300_emit_query_start(struct r300_context
*r300
, unsigned size
, void*state
)
532 struct r300_query
*query
= r300
->query_current
;
539 if (r300
->screen
->caps
.family
== CHIP_FAMILY_RV530
) {
540 OUT_CS_REG(RV530_FG_ZBREG_DEST
, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL
);
542 OUT_CS_REG(R300_SU_REG_DEST
, R300_RASTER_PIPE_SELECT_ALL
);
544 OUT_CS_REG(R300_ZB_ZPASS_DATA
, 0);
546 query
->begin_emitted
= TRUE
;
550 static void r300_emit_query_end_frag_pipes(struct r300_context
*r300
,
551 struct r300_query
*query
)
553 struct r300_capabilities
* caps
= &r300
->screen
->caps
;
556 assert(caps
->num_frag_pipes
);
558 BEGIN_CS(6 * caps
->num_frag_pipes
+ 2);
559 /* I'm not so sure I like this switch, but it's hard to be elegant
560 * when there's so many special cases...
562 * So here's the basic idea. For each pipe, enable writes to it only,
563 * then put out the relocation for ZPASS_ADDR, taking into account a
564 * 4-byte offset for each pipe. RV380 and older are special; they have
565 * only two pipes, and the second pipe's enable is on bit 3, not bit 1,
566 * so there's a chipset cap for that. */
567 switch (caps
->num_frag_pipes
) {
570 OUT_CS_REG(R300_SU_REG_DEST
, 1 << 3);
571 OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR
, 1);
572 OUT_CS_BUF_RELOC(r300
->oqbo
, query
->offset
+ (sizeof(uint32_t) * 3),
573 0, r300_buffer(r300
->oqbo
)->domain
, 0);
576 OUT_CS_REG(R300_SU_REG_DEST
, 1 << 2);
577 OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR
, 1);
578 OUT_CS_BUF_RELOC(r300
->oqbo
, query
->offset
+ (sizeof(uint32_t) * 2),
579 0, r300_buffer(r300
->oqbo
)->domain
, 0);
582 /* As mentioned above, accomodate RV380 and older. */
583 OUT_CS_REG(R300_SU_REG_DEST
,
584 1 << (caps
->high_second_pipe
? 3 : 1));
585 OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR
, 1);
586 OUT_CS_BUF_RELOC(r300
->oqbo
, query
->offset
+ (sizeof(uint32_t) * 1),
587 0, r300_buffer(r300
->oqbo
)->domain
, 0);
590 OUT_CS_REG(R300_SU_REG_DEST
, 1 << 0);
591 OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR
, 1);
592 OUT_CS_BUF_RELOC(r300
->oqbo
, query
->offset
+ (sizeof(uint32_t) * 0),
593 0, r300_buffer(r300
->oqbo
)->domain
, 0);
596 fprintf(stderr
, "r300: Implementation error: Chipset reports %d"
597 " pixel pipes!\n", caps
->num_frag_pipes
);
601 /* And, finally, reset it to normal... */
602 OUT_CS_REG(R300_SU_REG_DEST
, 0xF);
606 static void rv530_emit_query_end_single_z(struct r300_context
*r300
,
607 struct r300_query
*query
)
612 OUT_CS_REG(RV530_FG_ZBREG_DEST
, RV530_FG_ZBREG_DEST_PIPE_SELECT_0
);
613 OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR
, 1);
614 OUT_CS_BUF_RELOC(r300
->oqbo
, query
->offset
, 0, r300_buffer(r300
->oqbo
)->domain
, 0);
615 OUT_CS_REG(RV530_FG_ZBREG_DEST
, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL
);
619 static void rv530_emit_query_end_double_z(struct r300_context
*r300
,
620 struct r300_query
*query
)
625 OUT_CS_REG(RV530_FG_ZBREG_DEST
, RV530_FG_ZBREG_DEST_PIPE_SELECT_0
);
626 OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR
, 1);
627 OUT_CS_BUF_RELOC(r300
->oqbo
, query
->offset
, 0, r300_buffer(r300
->oqbo
)->domain
, 0);
628 OUT_CS_REG(RV530_FG_ZBREG_DEST
, RV530_FG_ZBREG_DEST_PIPE_SELECT_1
);
629 OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR
, 1);
630 OUT_CS_BUF_RELOC(r300
->oqbo
, query
->offset
+ sizeof(uint32_t), 0, r300_buffer(r300
->oqbo
)->domain
, 0);
631 OUT_CS_REG(RV530_FG_ZBREG_DEST
, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL
);
635 void r300_emit_query_end(struct r300_context
* r300
)
637 struct r300_capabilities
*caps
= &r300
->screen
->caps
;
638 struct r300_query
*query
= r300
->query_current
;
643 if (query
->begin_emitted
== FALSE
)
646 if (caps
->family
== CHIP_FAMILY_RV530
) {
647 if (caps
->num_z_pipes
== 2)
648 rv530_emit_query_end_double_z(r300
, query
);
650 rv530_emit_query_end_single_z(r300
, query
);
652 r300_emit_query_end_frag_pipes(r300
, query
);
654 query
->begin_emitted
= FALSE
;
657 void r300_emit_rs_state(struct r300_context
* r300
, unsigned size
, void* state
)
659 struct r300_rs_state
* rs
= (struct r300_rs_state
*)state
;
664 OUT_CS_REG(R300_VAP_CNTL_STATUS
, rs
->vap_control_status
);
666 OUT_CS_REG(R300_GB_AA_CONFIG
, rs
->antialiasing_config
);
668 OUT_CS_REG(R300_GA_POINT_SIZE
, rs
->point_size
);
669 OUT_CS_REG_SEQ(R300_GA_POINT_MINMAX
, 2);
670 OUT_CS(rs
->point_minmax
);
671 OUT_CS(rs
->line_control
);
673 if (rs
->polygon_offset_enable
) {
674 scale
= rs
->depth_scale
* 12;
675 offset
= rs
->depth_offset
;
677 switch (r300
->zbuffer_bpp
) {
686 OUT_CS_REG_SEQ(R300_SU_POLY_OFFSET_FRONT_SCALE
, 4);
693 OUT_CS_REG_SEQ(R300_SU_POLY_OFFSET_ENABLE
, 2);
694 OUT_CS(rs
->polygon_offset_enable
);
695 OUT_CS(rs
->cull_mode
);
696 OUT_CS_REG(R300_GA_LINE_STIPPLE_CONFIG
, rs
->line_stipple_config
);
697 OUT_CS_REG(R300_GA_LINE_STIPPLE_VALUE
, rs
->line_stipple_value
);
698 OUT_CS_REG(R300_GA_POLY_MODE
, rs
->polygon_mode
);
699 OUT_CS_REG(R300_SC_CLIP_RULE
, rs
->clip_rule
);
700 OUT_CS_REG(R300_GB_ENABLE
, rs
->stuffing_enable
);
701 OUT_CS_REG_SEQ(R300_GA_POINT_S0
, 4);
702 OUT_CS_32F(rs
->point_texcoord_left
);
703 OUT_CS_32F(rs
->point_texcoord_bottom
);
704 OUT_CS_32F(rs
->point_texcoord_right
);
705 OUT_CS_32F(rs
->point_texcoord_top
);
709 void r300_emit_rs_block_state(struct r300_context
* r300
,
710 unsigned size
, void* state
)
712 struct r300_rs_block
* rs
= (struct r300_rs_block
*)state
;
714 /* It's the same for both INST and IP tables */
715 unsigned count
= (rs
->inst_count
& R300_RS_INST_COUNT_MASK
) + 1;
718 if (SCREEN_DBG_ON(r300
->screen
, DBG_DRAW
)) {
719 r500_dump_rs_block(rs
);
722 DBG(r300
, DBG_DRAW
, "r300: RS emit:\n");
725 OUT_CS_REG_SEQ(R300_VAP_VTX_STATE_CNTL
, 2);
726 OUT_CS(rs
->vap_vtx_state_cntl
);
727 OUT_CS(rs
->vap_vsm_vtx_assm
);
728 OUT_CS_REG_SEQ(R300_VAP_OUTPUT_VTX_FMT_0
, 2);
729 OUT_CS(rs
->vap_out_vtx_fmt
[0]);
730 OUT_CS(rs
->vap_out_vtx_fmt
[1]);
732 if (r300
->screen
->caps
.is_r500
) {
733 OUT_CS_REG_SEQ(R500_RS_IP_0
, count
);
735 OUT_CS_REG_SEQ(R300_RS_IP_0
, count
);
737 OUT_CS_TABLE(rs
->ip
, count
);
738 for (i
= 0; i
< count
; i
++) {
739 DBG(r300
, DBG_DRAW
, " : ip %d: 0x%08x\n", i
, rs
->ip
[i
]);
742 OUT_CS_REG_SEQ(R300_RS_COUNT
, 2);
744 OUT_CS(rs
->inst_count
);
746 if (r300
->screen
->caps
.is_r500
) {
747 OUT_CS_REG_SEQ(R500_RS_INST_0
, count
);
749 OUT_CS_REG_SEQ(R300_RS_INST_0
, count
);
751 OUT_CS_TABLE(rs
->inst
, count
);
752 for (i
= 0; i
< count
; i
++) {
753 DBG(r300
, DBG_DRAW
, " : inst %d: 0x%08x\n", i
, rs
->inst
[i
]);
756 DBG(r300
, DBG_DRAW
, " : count: 0x%08x inst_count: 0x%08x\n",
757 rs
->count
, rs
->inst_count
);
762 void r300_emit_scissor_state(struct r300_context
* r300
,
763 unsigned size
, void* state
)
765 struct pipe_scissor_state
* scissor
= (struct pipe_scissor_state
*)state
;
769 OUT_CS_REG_SEQ(R300_SC_CLIPRECT_TL_0
, 2);
770 if (r300
->screen
->caps
.is_r500
) {
771 OUT_CS((scissor
->minx
<< R300_CLIPRECT_X_SHIFT
) |
772 (scissor
->miny
<< R300_CLIPRECT_Y_SHIFT
));
773 OUT_CS(((scissor
->maxx
- 1) << R300_CLIPRECT_X_SHIFT
) |
774 ((scissor
->maxy
- 1) << R300_CLIPRECT_Y_SHIFT
));
776 OUT_CS(((scissor
->minx
+ 1440) << R300_CLIPRECT_X_SHIFT
) |
777 ((scissor
->miny
+ 1440) << R300_CLIPRECT_Y_SHIFT
));
778 OUT_CS(((scissor
->maxx
+ 1440-1) << R300_CLIPRECT_X_SHIFT
) |
779 ((scissor
->maxy
+ 1440-1) << R300_CLIPRECT_Y_SHIFT
));
784 void r300_emit_textures_state(struct r300_context
*r300
,
785 unsigned size
, void *state
)
787 struct r300_textures_state
*allstate
= (struct r300_textures_state
*)state
;
788 struct r300_texture_sampler_state
*texstate
;
789 struct r300_texture
*tex
;
794 OUT_CS_REG(R300_TX_ENABLE
, allstate
->tx_enable
);
796 for (i
= 0; i
< allstate
->count
; i
++) {
797 if ((1 << i
) & allstate
->tx_enable
) {
798 texstate
= &allstate
->regs
[i
];
799 tex
= r300_texture(allstate
->sampler_views
[i
]->base
.texture
);
801 OUT_CS_REG(R300_TX_FILTER0_0
+ (i
* 4), texstate
->filter0
);
802 OUT_CS_REG(R300_TX_FILTER1_0
+ (i
* 4), texstate
->filter1
);
803 OUT_CS_REG(R300_TX_BORDER_COLOR_0
+ (i
* 4),
804 texstate
->border_color
);
806 OUT_CS_REG(R300_TX_FORMAT0_0
+ (i
* 4), texstate
->format
.format0
);
807 OUT_CS_REG(R300_TX_FORMAT1_0
+ (i
* 4), texstate
->format
.format1
);
808 OUT_CS_REG(R300_TX_FORMAT2_0
+ (i
* 4), texstate
->format
.format2
);
810 OUT_CS_REG_SEQ(R300_TX_OFFSET_0
+ (i
* 4), 1);
811 OUT_CS_TEX_RELOC(tex
, texstate
->format
.tile_config
, tex
->domain
,
818 void r300_emit_aos(struct r300_context
* r300
, unsigned offset
, boolean indexed
)
820 struct pipe_vertex_buffer
*vb1
, *vb2
, *vbuf
= r300
->vertex_buffer
;
821 struct pipe_vertex_element
*velem
= r300
->velems
->velem
;
822 struct r300_buffer
*buf
;
824 unsigned size1
, size2
, aos_count
= r300
->velems
->count
;
825 unsigned packet_size
= (aos_count
* 3 + 1) / 2;
828 for (i
= 0; i
< aos_count
; i
++) {
829 if ((vbuf
[velem
[i
].vertex_buffer_index
].buffer_offset
+ velem
[i
].src_offset
) % 4 != 0) {
830 /* XXX We must align the buffer. */
832 fprintf(stderr
, "r300: Unaligned vertex buffer offsets aren't supported, aborting..\n");
837 BEGIN_CS(2 + packet_size
+ aos_count
* 2);
838 OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR
, packet_size
);
839 OUT_CS(aos_count
| (!indexed
? R300_VC_FORCE_PREFETCH
: 0));
841 for (i
= 0; i
< aos_count
- 1; i
+= 2) {
842 vb1
= &vbuf
[velem
[i
].vertex_buffer_index
];
843 vb2
= &vbuf
[velem
[i
+1].vertex_buffer_index
];
844 size1
= util_format_get_blocksize(velem
[i
].src_format
);
845 size2
= util_format_get_blocksize(velem
[i
+1].src_format
);
847 OUT_CS(R300_VBPNTR_SIZE0(size1
) | R300_VBPNTR_STRIDE0(vb1
->stride
) |
848 R300_VBPNTR_SIZE1(size2
) | R300_VBPNTR_STRIDE1(vb2
->stride
));
849 OUT_CS(vb1
->buffer_offset
+ velem
[i
].src_offset
+ offset
* vb1
->stride
);
850 OUT_CS(vb2
->buffer_offset
+ velem
[i
+1].src_offset
+ offset
* vb2
->stride
);
854 vb1
= &vbuf
[velem
[i
].vertex_buffer_index
];
855 size1
= util_format_get_blocksize(velem
[i
].src_format
);
857 OUT_CS(R300_VBPNTR_SIZE0(size1
) | R300_VBPNTR_STRIDE0(vb1
->stride
));
858 OUT_CS(vb1
->buffer_offset
+ velem
[i
].src_offset
+ offset
* vb1
->stride
);
861 for (i
= 0; i
< aos_count
; i
++) {
862 buf
= r300_buffer(vbuf
[velem
[i
].vertex_buffer_index
].buffer
);
863 OUT_CS_BUF_RELOC_NO_OFFSET(&buf
->b
.b
, buf
->domain
, 0, 0);
868 void r300_emit_aos_swtcl(struct r300_context
*r300
, boolean indexed
)
872 DBG(r300
, DBG_DRAW
, "r300: Preparing vertex buffer %p for render, "
873 "vertex size %d\n", r300
->vbo
,
874 r300
->vertex_info
.size
);
875 /* Set the pointer to our vertex buffer. The emitted values are this:
876 * PACKET3 [3D_LOAD_VBPNTR]
878 * FORMAT [size | stride << 8]
879 * OFFSET [offset into BO]
880 * VBPNTR [relocated BO]
883 OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR
, 3);
884 OUT_CS(1 | (!indexed
? R300_VC_FORCE_PREFETCH
: 0));
885 OUT_CS(r300
->vertex_info
.size
|
886 (r300
->vertex_info
.size
<< 8));
887 OUT_CS(r300
->vbo_offset
);
888 OUT_CS_BUF_RELOC(r300
->vbo
, 0, r300_buffer(r300
->vbo
)->domain
, 0, 0);
892 void r300_emit_vertex_stream_state(struct r300_context
* r300
,
893 unsigned size
, void* state
)
895 struct r300_vertex_stream_state
*streams
=
896 (struct r300_vertex_stream_state
*)state
;
900 DBG(r300
, DBG_DRAW
, "r300: PSC emit:\n");
903 OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_0
, streams
->count
);
904 OUT_CS_TABLE(streams
->vap_prog_stream_cntl
, streams
->count
);
905 for (i
= 0; i
< streams
->count
; i
++) {
906 DBG(r300
, DBG_DRAW
, " : prog_stream_cntl%d: 0x%08x\n", i
,
907 streams
->vap_prog_stream_cntl
[i
]);
909 OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_EXT_0
, streams
->count
);
910 OUT_CS_TABLE(streams
->vap_prog_stream_cntl_ext
, streams
->count
);
911 for (i
= 0; i
< streams
->count
; i
++) {
912 DBG(r300
, DBG_DRAW
, " : prog_stream_cntl_ext%d: 0x%08x\n", i
,
913 streams
->vap_prog_stream_cntl_ext
[i
]);
918 void r300_emit_pvs_flush(struct r300_context
* r300
, unsigned size
, void* state
)
923 OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG
, 0x0);
927 void r300_emit_vs_state(struct r300_context
* r300
, unsigned size
, void* state
)
929 struct r300_vertex_shader
* vs
= (struct r300_vertex_shader
*)state
;
930 struct r300_vertex_program_code
* code
= &vs
->code
;
931 struct r300_screen
* r300screen
= r300
->screen
;
932 unsigned instruction_count
= code
->length
/ 4;
935 unsigned vtx_mem_size
= r300screen
->caps
.is_r500
? 128 : 72;
936 unsigned input_count
= MAX2(util_bitcount(code
->InputsRead
), 1);
937 unsigned output_count
= MAX2(util_bitcount(code
->OutputsWritten
), 1);
938 unsigned temp_count
= MAX2(code
->num_temporaries
, 1);
940 unsigned pvs_num_slots
= MIN3(vtx_mem_size
/ input_count
,
941 vtx_mem_size
/ output_count
, 10);
942 unsigned pvs_num_controllers
= MIN2(vtx_mem_size
/ temp_count
, 6);
944 unsigned imm_first
= vs
->externals_count
;
945 unsigned imm_end
= vs
->code
.constants
.Count
;
946 unsigned imm_count
= vs
->immediates_count
;
951 /* R300_VAP_PVS_CODE_CNTL_0
952 * R300_VAP_PVS_CONST_CNTL
953 * R300_VAP_PVS_CODE_CNTL_1
954 * See the r5xx docs for instructions on how to use these. */
955 OUT_CS_REG_SEQ(R300_VAP_PVS_CODE_CNTL_0
, 3);
956 OUT_CS(R300_PVS_FIRST_INST(0) |
957 R300_PVS_XYZW_VALID_INST(instruction_count
- 1) |
958 R300_PVS_LAST_INST(instruction_count
- 1));
959 OUT_CS(R300_PVS_MAX_CONST_ADDR(code
->constants
.Count
- 1));
960 OUT_CS(instruction_count
- 1);
962 OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG
, 0);
963 OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA
, code
->length
);
964 OUT_CS_TABLE(code
->body
.d
, code
->length
);
966 OUT_CS_REG(R300_VAP_CNTL
, R300_PVS_NUM_SLOTS(pvs_num_slots
) |
967 R300_PVS_NUM_CNTLRS(pvs_num_controllers
) |
968 R300_PVS_NUM_FPUS(r300screen
->caps
.num_vert_fpus
) |
969 R300_PVS_VF_MAX_VTX_NUM(12) |
970 (r300screen
->caps
.is_r500
? R500_TCL_STATE_OPTIMIZATION
: 0));
972 /* Emit immediates. */
974 OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG
,
975 (r300
->screen
->caps
.is_r500
?
976 R500_PVS_CONST_START
: R300_PVS_CONST_START
) +
978 OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA
, imm_count
* 4);
979 for (i
= imm_first
; i
< imm_end
; i
++) {
980 const float *data
= vs
->code
.constants
.Constants
[i
].u
.Immediate
;
981 OUT_CS_TABLE(data
, 4);
987 void r300_emit_vs_constants(struct r300_context
* r300
,
988 unsigned size
, void *state
)
991 ((struct r300_vertex_shader
*)r300
->vs_state
.state
)->externals_count
;
992 struct r300_constant_buffer
*buf
= (struct r300_constant_buffer
*)state
;
999 OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG
,
1000 (r300
->screen
->caps
.is_r500
?
1001 R500_PVS_CONST_START
: R300_PVS_CONST_START
));
1002 OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA
, count
* 4);
1003 OUT_CS_TABLE(buf
->constants
, count
* 4);
1007 void r300_emit_viewport_state(struct r300_context
* r300
,
1008 unsigned size
, void* state
)
1010 struct r300_viewport_state
* viewport
= (struct r300_viewport_state
*)state
;
1014 OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE
, 6);
1015 OUT_CS_32F(viewport
->xscale
);
1016 OUT_CS_32F(viewport
->xoffset
);
1017 OUT_CS_32F(viewport
->yscale
);
1018 OUT_CS_32F(viewport
->yoffset
);
1019 OUT_CS_32F(viewport
->zscale
);
1020 OUT_CS_32F(viewport
->zoffset
);
1021 OUT_CS_REG(R300_VAP_VTE_CNTL
, viewport
->vte_control
);
1025 void r300_emit_ztop_state(struct r300_context
* r300
,
1026 unsigned size
, void* state
)
1028 struct r300_ztop_state
* ztop
= (struct r300_ztop_state
*)state
;
1032 OUT_CS_REG(R300_ZB_ZTOP
, ztop
->z_buffer_top
);
1036 void r300_emit_texture_cache_inval(struct r300_context
* r300
, unsigned size
, void* state
)
1041 OUT_CS_REG(R300_TX_INVALTAGS
, 0);
1045 void r300_emit_buffer_validate(struct r300_context
*r300
,
1046 boolean do_validate_vertex_buffers
,
1047 struct pipe_resource
*index_buffer
)
1049 struct pipe_framebuffer_state
* fb
=
1050 (struct pipe_framebuffer_state
*)r300
->fb_state
.state
;
1051 struct r300_textures_state
*texstate
=
1052 (struct r300_textures_state
*)r300
->textures_state
.state
;
1053 struct r300_texture
* tex
;
1054 struct pipe_vertex_buffer
*vbuf
= r300
->vertex_buffer
;
1055 struct pipe_vertex_element
*velem
= r300
->velems
->velem
;
1056 struct pipe_resource
*pbuf
;
1058 boolean invalid
= FALSE
;
1060 /* upload buffers first */
1061 if (r300
->screen
->caps
.has_tcl
&& r300
->any_user_vbs
) {
1062 r300_upload_user_buffers(r300
);
1063 r300
->any_user_vbs
= false;
1066 /* Clean out BOs. */
1067 r300
->rws
->reset_bos(r300
->rws
);
1070 /* Color buffers... */
1071 for (i
= 0; i
< fb
->nr_cbufs
; i
++) {
1072 tex
= r300_texture(fb
->cbufs
[i
]->texture
);
1073 assert(tex
&& tex
->buffer
&& "cbuf is marked, but NULL!");
1074 if (!r300_add_texture(r300
->rws
, tex
, 0, tex
->domain
)) {
1075 r300
->context
.flush(&r300
->context
, 0, NULL
);
1079 /* ...depth buffer... */
1081 tex
= r300_texture(fb
->zsbuf
->texture
);
1082 assert(tex
&& tex
->buffer
&& "zsbuf is marked, but NULL!");
1083 if (!r300_add_texture(r300
->rws
, tex
,
1085 r300
->context
.flush(&r300
->context
, 0, NULL
);
1089 /* ...textures... */
1090 for (i
= 0; i
< texstate
->count
; i
++) {
1091 if (!(texstate
->tx_enable
& (1 << i
))) {
1095 tex
= r300_texture(texstate
->sampler_views
[i
]->base
.texture
);
1096 if (!r300_add_texture(r300
->rws
, tex
, tex
->domain
, 0)) {
1097 r300
->context
.flush(&r300
->context
, 0, NULL
);
1101 /* ...occlusion query buffer... */
1102 if (r300
->query_start
.dirty
||
1103 (r300
->query_current
&& r300
->query_current
->begin_emitted
)) {
1104 if (!r300_add_buffer(r300
->rws
, r300
->oqbo
,
1105 0, r300_buffer(r300
->oqbo
)->domain
)) {
1106 r300
->context
.flush(&r300
->context
, 0, NULL
);
1110 /* ...vertex buffer for SWTCL path... */
1112 if (!r300_add_buffer(r300
->rws
, r300
->vbo
,
1113 r300_buffer(r300
->vbo
)->domain
, 0)) {
1114 r300
->context
.flush(&r300
->context
, 0, NULL
);
1118 /* ...vertex buffers for HWTCL path... */
1119 if (do_validate_vertex_buffers
) {
1120 for (i
= 0; i
< r300
->velems
->count
; i
++) {
1121 pbuf
= vbuf
[velem
[i
].vertex_buffer_index
].buffer
;
1123 if (!r300_add_buffer(r300
->rws
, pbuf
,
1124 r300_buffer(pbuf
)->domain
, 0)) {
1125 r300
->context
.flush(&r300
->context
, 0, NULL
);
1130 /* ...and index buffer for HWTCL path. */
1132 if (!r300_add_buffer(r300
->rws
, index_buffer
,
1133 r300_buffer(index_buffer
)->domain
, 0)) {
1134 r300
->context
.flush(&r300
->context
, 0, NULL
);
1138 if (!r300
->rws
->validate(r300
->rws
)) {
1139 r300
->context
.flush(&r300
->context
, 0, NULL
);
1142 fprintf(stderr
, "r300: Stuck in validation loop, gonna quit now.\n");
1150 unsigned r300_get_num_dirty_dwords(struct r300_context
*r300
)
1152 struct r300_atom
* atom
;
1153 unsigned dwords
= 0;
1155 foreach(atom
, &r300
->atom_list
) {
1157 dwords
+= atom
->size
;
1161 /* let's reserve some more, just in case */
1167 /* Emit all dirty state. */
1168 void r300_emit_dirty_state(struct r300_context
* r300
)
1170 struct r300_atom
* atom
;
1172 foreach(atom
, &r300
->atom_list
) {
1174 atom
->emit(r300
, atom
->size
, atom
->state
);
1175 if (SCREEN_DBG_ON(r300
->screen
, DBG_STATS
)) {
1178 atom
->dirty
= FALSE
;