1 /* -*- mode: C; c-file-style: "k&r"; tab-width 4; indent-tabs-mode: t; -*- */
4 * Copyright (C) 2014 Rob Clark <robclark@freedesktop.org>
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 * Rob Clark <robclark@freedesktop.org>
29 #include "pipe/p_state.h"
30 #include "util/u_string.h"
31 #include "util/u_memory.h"
32 #include "util/u_helpers.h"
33 #include "util/u_format.h"
35 #include "freedreno_resource.h"
36 #include "freedreno_query_hw.h"
39 #include "fd4_blend.h"
40 #include "fd4_context.h"
41 #include "fd4_program.h"
42 #include "fd4_rasterizer.h"
43 #include "fd4_texture.h"
44 #include "fd4_format.h"
47 static const enum adreno_state_block sb
[] = {
48 [SHADER_VERTEX
] = SB_VERT_SHADER
,
49 [SHADER_FRAGMENT
] = SB_FRAG_SHADER
,
52 /* regid: base const register
53 * prsc or dwords: buffer containing constant values
54 * sizedwords: size of const value buffer
57 fd4_emit_const(struct fd_ringbuffer
*ring
, enum shader_t type
,
58 uint32_t regid
, uint32_t offset
, uint32_t sizedwords
,
59 const uint32_t *dwords
, struct pipe_resource
*prsc
)
62 enum adreno_state_src src
;
64 debug_assert((regid
% 4) == 0);
65 debug_assert((sizedwords
% 4) == 0);
75 OUT_PKT3(ring
, CP_LOAD_STATE
, 2 + sz
);
76 OUT_RING(ring
, CP_LOAD_STATE_0_DST_OFF(regid
/4) |
77 CP_LOAD_STATE_0_STATE_SRC(src
) |
78 CP_LOAD_STATE_0_STATE_BLOCK(sb
[type
]) |
79 CP_LOAD_STATE_0_NUM_UNIT(sizedwords
/4));
81 struct fd_bo
*bo
= fd_resource(prsc
)->bo
;
82 OUT_RELOC(ring
, bo
, offset
,
83 CP_LOAD_STATE_1_STATE_TYPE(ST_CONSTANTS
), 0);
85 OUT_RING(ring
, CP_LOAD_STATE_1_EXT_SRC_ADDR(0) |
86 CP_LOAD_STATE_1_STATE_TYPE(ST_CONSTANTS
));
87 dwords
= (uint32_t *)&((uint8_t *)dwords
)[offset
];
89 for (i
= 0; i
< sz
; i
++) {
90 OUT_RING(ring
, dwords
[i
]);
95 fd4_emit_const_bo(struct fd_ringbuffer
*ring
, enum shader_t type
, boolean write
,
96 uint32_t regid
, uint32_t num
, struct fd_bo
**bos
, uint32_t *offsets
)
100 debug_assert((regid
% 4) == 0);
101 debug_assert((num
% 4) == 0);
103 OUT_PKT3(ring
, CP_LOAD_STATE
, 2 + num
);
104 OUT_RING(ring
, CP_LOAD_STATE_0_DST_OFF(regid
/4) |
105 CP_LOAD_STATE_0_STATE_SRC(SS_DIRECT
) |
106 CP_LOAD_STATE_0_STATE_BLOCK(sb
[type
]) |
107 CP_LOAD_STATE_0_NUM_UNIT(num
/4));
108 OUT_RING(ring
, CP_LOAD_STATE_1_EXT_SRC_ADDR(0) |
109 CP_LOAD_STATE_1_STATE_TYPE(ST_CONSTANTS
));
111 for (i
= 0; i
< num
; i
++) {
114 OUT_RELOCW(ring
, bos
[i
], offsets
[i
], 0, 0);
116 OUT_RELOC(ring
, bos
[i
], offsets
[i
], 0, 0);
119 OUT_RING(ring
, 0xbad00000 | (i
<< 16));
125 emit_textures(struct fd_context
*ctx
, struct fd_ringbuffer
*ring
,
126 enum adreno_state_block sb
, struct fd_texture_stateobj
*tex
,
127 const struct ir3_shader_variant
*v
)
129 static const uint32_t bcolor_reg
[] = {
130 [SB_VERT_TEX
] = REG_A4XX_TPL1_TP_VS_BORDER_COLOR_BASE_ADDR
,
131 [SB_FRAG_TEX
] = REG_A4XX_TPL1_TP_FS_BORDER_COLOR_BASE_ADDR
,
133 struct fd4_context
*fd4_ctx
= fd4_context(ctx
);
137 u_upload_alloc(fd4_ctx
->border_color_uploader
,
138 0, BORDER_COLOR_UPLOAD_SIZE
,
139 BORDER_COLOR_UPLOAD_SIZE
, &off
,
140 &fd4_ctx
->border_color_buf
,
143 fd_setup_border_colors(tex
, ptr
, 0);
145 if (tex
->num_samplers
> 0) {
148 /* not sure if this is an a420.0 workaround, but we seem
149 * to need to emit these in pairs.. emit a final dummy
150 * entry if odd # of samplers:
152 num_samplers
= align(tex
->num_samplers
, 2);
154 /* output sampler state: */
155 OUT_PKT3(ring
, CP_LOAD_STATE
, 2 + (2 * num_samplers
));
156 OUT_RING(ring
, CP_LOAD_STATE_0_DST_OFF(0) |
157 CP_LOAD_STATE_0_STATE_SRC(SS_DIRECT
) |
158 CP_LOAD_STATE_0_STATE_BLOCK(sb
) |
159 CP_LOAD_STATE_0_NUM_UNIT(num_samplers
));
160 OUT_RING(ring
, CP_LOAD_STATE_1_STATE_TYPE(ST_SHADER
) |
161 CP_LOAD_STATE_1_EXT_SRC_ADDR(0));
162 for (i
= 0; i
< tex
->num_samplers
; i
++) {
163 static const struct fd4_sampler_stateobj dummy_sampler
= {};
164 const struct fd4_sampler_stateobj
*sampler
= tex
->samplers
[i
] ?
165 fd4_sampler_stateobj(tex
->samplers
[i
]) :
167 OUT_RING(ring
, sampler
->texsamp0
);
168 OUT_RING(ring
, sampler
->texsamp1
);
171 for (; i
< num_samplers
; i
++) {
172 OUT_RING(ring
, 0x00000000);
173 OUT_RING(ring
, 0x00000000);
177 if (tex
->num_textures
> 0) {
178 unsigned num_textures
= tex
->num_textures
+ v
->astc_srgb
.count
;
180 /* emit texture state: */
181 OUT_PKT3(ring
, CP_LOAD_STATE
, 2 + (8 * num_textures
));
182 OUT_RING(ring
, CP_LOAD_STATE_0_DST_OFF(0) |
183 CP_LOAD_STATE_0_STATE_SRC(SS_DIRECT
) |
184 CP_LOAD_STATE_0_STATE_BLOCK(sb
) |
185 CP_LOAD_STATE_0_NUM_UNIT(num_textures
));
186 OUT_RING(ring
, CP_LOAD_STATE_1_STATE_TYPE(ST_CONSTANTS
) |
187 CP_LOAD_STATE_1_EXT_SRC_ADDR(0));
188 for (i
= 0; i
< tex
->num_textures
; i
++) {
189 static const struct fd4_pipe_sampler_view dummy_view
= {};
190 const struct fd4_pipe_sampler_view
*view
= tex
->textures
[i
] ?
191 fd4_pipe_sampler_view(tex
->textures
[i
]) :
194 OUT_RING(ring
, view
->texconst0
);
195 OUT_RING(ring
, view
->texconst1
);
196 OUT_RING(ring
, view
->texconst2
);
197 OUT_RING(ring
, view
->texconst3
);
198 if (view
->base
.texture
) {
199 struct fd_resource
*rsc
= fd_resource(view
->base
.texture
);
200 OUT_RELOC(ring
, rsc
->bo
, view
->offset
, view
->texconst4
, 0);
202 OUT_RING(ring
, 0x00000000);
204 OUT_RING(ring
, 0x00000000);
205 OUT_RING(ring
, 0x00000000);
206 OUT_RING(ring
, 0x00000000);
209 for (i
= 0; i
< v
->astc_srgb
.count
; i
++) {
210 static const struct fd4_pipe_sampler_view dummy_view
= {};
211 const struct fd4_pipe_sampler_view
*view
;
212 unsigned idx
= v
->astc_srgb
.orig_idx
[i
];
214 view
= tex
->textures
[idx
] ?
215 fd4_pipe_sampler_view(tex
->textures
[idx
]) :
218 debug_assert(view
->texconst0
& A4XX_TEX_CONST_0_SRGB
);
220 OUT_RING(ring
, view
->texconst0
& ~A4XX_TEX_CONST_0_SRGB
);
221 OUT_RING(ring
, view
->texconst1
);
222 OUT_RING(ring
, view
->texconst2
);
223 OUT_RING(ring
, view
->texconst3
);
224 if (view
->base
.texture
) {
225 struct fd_resource
*rsc
= fd_resource(view
->base
.texture
);
226 OUT_RELOC(ring
, rsc
->bo
, view
->offset
, view
->texconst4
, 0);
228 OUT_RING(ring
, 0x00000000);
230 OUT_RING(ring
, 0x00000000);
231 OUT_RING(ring
, 0x00000000);
232 OUT_RING(ring
, 0x00000000);
235 debug_assert(v
->astc_srgb
.count
== 0);
238 OUT_PKT0(ring
, bcolor_reg
[sb
], 1);
239 OUT_RELOC(ring
, fd_resource(fd4_ctx
->border_color_buf
)->bo
, off
, 0, 0);
241 u_upload_unmap(fd4_ctx
->border_color_uploader
);
244 /* emit texture state for mem->gmem restore operation.. eventually it would
245 * be good to get rid of this and use normal CSO/etc state for more of these
249 fd4_emit_gmem_restore_tex(struct fd_ringbuffer
*ring
, unsigned nr_bufs
,
250 struct pipe_surface
**bufs
)
252 unsigned char mrt_comp
[A4XX_MAX_RENDER_TARGETS
];
255 for (i
= 0; i
< A4XX_MAX_RENDER_TARGETS
; i
++) {
256 mrt_comp
[i
] = (i
< nr_bufs
) ? 0xf : 0;
259 /* output sampler state: */
260 OUT_PKT3(ring
, CP_LOAD_STATE
, 2 + (2 * nr_bufs
));
261 OUT_RING(ring
, CP_LOAD_STATE_0_DST_OFF(0) |
262 CP_LOAD_STATE_0_STATE_SRC(SS_DIRECT
) |
263 CP_LOAD_STATE_0_STATE_BLOCK(SB_FRAG_TEX
) |
264 CP_LOAD_STATE_0_NUM_UNIT(nr_bufs
));
265 OUT_RING(ring
, CP_LOAD_STATE_1_STATE_TYPE(ST_SHADER
) |
266 CP_LOAD_STATE_1_EXT_SRC_ADDR(0));
267 for (i
= 0; i
< nr_bufs
; i
++) {
268 OUT_RING(ring
, A4XX_TEX_SAMP_0_XY_MAG(A4XX_TEX_NEAREST
) |
269 A4XX_TEX_SAMP_0_XY_MIN(A4XX_TEX_NEAREST
) |
270 A4XX_TEX_SAMP_0_WRAP_S(A4XX_TEX_CLAMP_TO_EDGE
) |
271 A4XX_TEX_SAMP_0_WRAP_T(A4XX_TEX_CLAMP_TO_EDGE
) |
272 A4XX_TEX_SAMP_0_WRAP_R(A4XX_TEX_REPEAT
));
273 OUT_RING(ring
, 0x00000000);
276 /* emit texture state: */
277 OUT_PKT3(ring
, CP_LOAD_STATE
, 2 + (8 * nr_bufs
));
278 OUT_RING(ring
, CP_LOAD_STATE_0_DST_OFF(0) |
279 CP_LOAD_STATE_0_STATE_SRC(SS_DIRECT
) |
280 CP_LOAD_STATE_0_STATE_BLOCK(SB_FRAG_TEX
) |
281 CP_LOAD_STATE_0_NUM_UNIT(nr_bufs
));
282 OUT_RING(ring
, CP_LOAD_STATE_1_STATE_TYPE(ST_CONSTANTS
) |
283 CP_LOAD_STATE_1_EXT_SRC_ADDR(0));
284 for (i
= 0; i
< nr_bufs
; i
++) {
286 struct fd_resource
*rsc
= fd_resource(bufs
[i
]->texture
);
287 enum pipe_format format
= fd4_gmem_restore_format(bufs
[i
]->format
);
289 /* The restore blit_zs shader expects stencil in sampler 0,
290 * and depth in sampler 1
292 if (rsc
->stencil
&& (i
== 0)) {
294 format
= fd4_gmem_restore_format(rsc
->base
.b
.format
);
297 /* note: PIPE_BUFFER disallowed for surfaces */
298 unsigned lvl
= bufs
[i
]->u
.tex
.level
;
299 struct fd_resource_slice
*slice
= fd_resource_slice(rsc
, lvl
);
300 unsigned offset
= fd_resource_offset(rsc
, lvl
, bufs
[i
]->u
.tex
.first_layer
);
302 /* z32 restore is accomplished using depth write. If there is
303 * no stencil component (ie. PIPE_FORMAT_Z32_FLOAT_S8X24_UINT)
304 * then no render target:
306 * (The same applies for z32_s8x24, since for stencil sampler
307 * state the above 'if' will replace 'format' with s8)
309 if ((format
== PIPE_FORMAT_Z32_FLOAT
) ||
310 (format
== PIPE_FORMAT_Z32_FLOAT_S8X24_UINT
))
313 debug_assert(bufs
[i
]->u
.tex
.first_layer
== bufs
[i
]->u
.tex
.last_layer
);
315 OUT_RING(ring
, A4XX_TEX_CONST_0_FMT(fd4_pipe2tex(format
)) |
316 A4XX_TEX_CONST_0_TYPE(A4XX_TEX_2D
) |
317 fd4_tex_swiz(format
, PIPE_SWIZZLE_X
, PIPE_SWIZZLE_Y
,
318 PIPE_SWIZZLE_Z
, PIPE_SWIZZLE_W
));
319 OUT_RING(ring
, A4XX_TEX_CONST_1_WIDTH(bufs
[i
]->width
) |
320 A4XX_TEX_CONST_1_HEIGHT(bufs
[i
]->height
));
321 OUT_RING(ring
, A4XX_TEX_CONST_2_PITCH(slice
->pitch
* rsc
->cpp
) |
322 A4XX_TEX_CONST_2_FETCHSIZE(fd4_pipe2fetchsize(format
)));
323 OUT_RING(ring
, 0x00000000);
324 OUT_RELOC(ring
, rsc
->bo
, offset
, 0, 0);
325 OUT_RING(ring
, 0x00000000);
326 OUT_RING(ring
, 0x00000000);
327 OUT_RING(ring
, 0x00000000);
329 OUT_RING(ring
, A4XX_TEX_CONST_0_FMT(0) |
330 A4XX_TEX_CONST_0_TYPE(A4XX_TEX_2D
) |
331 A4XX_TEX_CONST_0_SWIZ_X(A4XX_TEX_ONE
) |
332 A4XX_TEX_CONST_0_SWIZ_Y(A4XX_TEX_ONE
) |
333 A4XX_TEX_CONST_0_SWIZ_Z(A4XX_TEX_ONE
) |
334 A4XX_TEX_CONST_0_SWIZ_W(A4XX_TEX_ONE
));
335 OUT_RING(ring
, A4XX_TEX_CONST_1_WIDTH(0) |
336 A4XX_TEX_CONST_1_HEIGHT(0));
337 OUT_RING(ring
, A4XX_TEX_CONST_2_PITCH(0));
338 OUT_RING(ring
, 0x00000000);
339 OUT_RING(ring
, 0x00000000);
340 OUT_RING(ring
, 0x00000000);
341 OUT_RING(ring
, 0x00000000);
342 OUT_RING(ring
, 0x00000000);
346 OUT_PKT0(ring
, REG_A4XX_RB_RENDER_COMPONENTS
, 1);
347 OUT_RING(ring
, A4XX_RB_RENDER_COMPONENTS_RT0(mrt_comp
[0]) |
348 A4XX_RB_RENDER_COMPONENTS_RT1(mrt_comp
[1]) |
349 A4XX_RB_RENDER_COMPONENTS_RT2(mrt_comp
[2]) |
350 A4XX_RB_RENDER_COMPONENTS_RT3(mrt_comp
[3]) |
351 A4XX_RB_RENDER_COMPONENTS_RT4(mrt_comp
[4]) |
352 A4XX_RB_RENDER_COMPONENTS_RT5(mrt_comp
[5]) |
353 A4XX_RB_RENDER_COMPONENTS_RT6(mrt_comp
[6]) |
354 A4XX_RB_RENDER_COMPONENTS_RT7(mrt_comp
[7]));
358 fd4_emit_vertex_bufs(struct fd_ringbuffer
*ring
, struct fd4_emit
*emit
)
360 int32_t i
, j
, last
= -1;
361 uint32_t total_in
= 0;
362 const struct fd_vertex_state
*vtx
= emit
->vtx
;
363 const struct ir3_shader_variant
*vp
= fd4_emit_get_vp(emit
);
364 unsigned vertex_regid
= regid(63, 0);
365 unsigned instance_regid
= regid(63, 0);
366 unsigned vtxcnt_regid
= regid(63, 0);
368 /* Note that sysvals come *after* normal inputs: */
369 for (i
= 0; i
< vp
->inputs_count
; i
++) {
370 if (!vp
->inputs
[i
].compmask
)
372 if (vp
->inputs
[i
].sysval
) {
373 switch(vp
->inputs
[i
].slot
) {
374 case SYSTEM_VALUE_BASE_VERTEX
:
375 /* handled elsewhere */
377 case SYSTEM_VALUE_VERTEX_ID_ZERO_BASE
:
378 vertex_regid
= vp
->inputs
[i
].regid
;
380 case SYSTEM_VALUE_INSTANCE_ID
:
381 instance_regid
= vp
->inputs
[i
].regid
;
383 case SYSTEM_VALUE_VERTEX_CNT
:
384 vtxcnt_regid
= vp
->inputs
[i
].regid
;
387 unreachable("invalid system value");
390 } else if (i
< vtx
->vtx
->num_elements
) {
395 for (i
= 0, j
= 0; i
<= last
; i
++) {
396 assert(!vp
->inputs
[i
].sysval
);
397 if (vp
->inputs
[i
].compmask
) {
398 struct pipe_vertex_element
*elem
= &vtx
->vtx
->pipe
[i
];
399 const struct pipe_vertex_buffer
*vb
=
400 &vtx
->vertexbuf
.vb
[elem
->vertex_buffer_index
];
401 struct fd_resource
*rsc
= fd_resource(vb
->buffer
);
402 enum pipe_format pfmt
= elem
->src_format
;
403 enum a4xx_vtx_fmt fmt
= fd4_pipe2vtx(pfmt
);
404 bool switchnext
= (i
!= last
) ||
405 (vertex_regid
!= regid(63, 0)) ||
406 (instance_regid
!= regid(63, 0)) ||
407 (vtxcnt_regid
!= regid(63, 0));
408 bool isint
= util_format_is_pure_integer(pfmt
);
409 uint32_t fs
= util_format_get_blocksize(pfmt
);
410 uint32_t off
= vb
->buffer_offset
+ elem
->src_offset
;
411 uint32_t size
= fd_bo_size(rsc
->bo
) - off
;
412 debug_assert(fmt
!= ~0);
414 OUT_PKT0(ring
, REG_A4XX_VFD_FETCH(j
), 4);
415 OUT_RING(ring
, A4XX_VFD_FETCH_INSTR_0_FETCHSIZE(fs
- 1) |
416 A4XX_VFD_FETCH_INSTR_0_BUFSTRIDE(vb
->stride
) |
417 COND(elem
->instance_divisor
, A4XX_VFD_FETCH_INSTR_0_INSTANCED
) |
418 COND(switchnext
, A4XX_VFD_FETCH_INSTR_0_SWITCHNEXT
));
419 OUT_RELOC(ring
, rsc
->bo
, off
, 0, 0);
420 OUT_RING(ring
, A4XX_VFD_FETCH_INSTR_2_SIZE(size
));
421 OUT_RING(ring
, A4XX_VFD_FETCH_INSTR_3_STEPRATE(MAX2(1, elem
->instance_divisor
)));
423 OUT_PKT0(ring
, REG_A4XX_VFD_DECODE_INSTR(j
), 1);
424 OUT_RING(ring
, A4XX_VFD_DECODE_INSTR_CONSTFILL
|
425 A4XX_VFD_DECODE_INSTR_WRITEMASK(vp
->inputs
[i
].compmask
) |
426 A4XX_VFD_DECODE_INSTR_FORMAT(fmt
) |
427 A4XX_VFD_DECODE_INSTR_SWAP(fd4_pipe2swap(pfmt
)) |
428 A4XX_VFD_DECODE_INSTR_REGID(vp
->inputs
[i
].regid
) |
429 A4XX_VFD_DECODE_INSTR_SHIFTCNT(fs
) |
430 A4XX_VFD_DECODE_INSTR_LASTCOMPVALID
|
431 COND(isint
, A4XX_VFD_DECODE_INSTR_INT
) |
432 COND(switchnext
, A4XX_VFD_DECODE_INSTR_SWITCHNEXT
));
434 total_in
+= vp
->inputs
[i
].ncomp
;
439 /* hw doesn't like to be configured for zero vbo's, it seems: */
441 /* just recycle the shader bo, we just need to point to *something*
444 struct fd_bo
*dummy_vbo
= vp
->bo
;
445 bool switchnext
= (vertex_regid
!= regid(63, 0)) ||
446 (instance_regid
!= regid(63, 0)) ||
447 (vtxcnt_regid
!= regid(63, 0));
449 OUT_PKT0(ring
, REG_A4XX_VFD_FETCH(0), 4);
450 OUT_RING(ring
, A4XX_VFD_FETCH_INSTR_0_FETCHSIZE(0) |
451 A4XX_VFD_FETCH_INSTR_0_BUFSTRIDE(0) |
452 COND(switchnext
, A4XX_VFD_FETCH_INSTR_0_SWITCHNEXT
));
453 OUT_RELOC(ring
, dummy_vbo
, 0, 0, 0);
454 OUT_RING(ring
, A4XX_VFD_FETCH_INSTR_2_SIZE(1));
455 OUT_RING(ring
, A4XX_VFD_FETCH_INSTR_3_STEPRATE(1));
457 OUT_PKT0(ring
, REG_A4XX_VFD_DECODE_INSTR(0), 1);
458 OUT_RING(ring
, A4XX_VFD_DECODE_INSTR_CONSTFILL
|
459 A4XX_VFD_DECODE_INSTR_WRITEMASK(0x1) |
460 A4XX_VFD_DECODE_INSTR_FORMAT(VFMT4_8_UNORM
) |
461 A4XX_VFD_DECODE_INSTR_SWAP(XYZW
) |
462 A4XX_VFD_DECODE_INSTR_REGID(regid(0,0)) |
463 A4XX_VFD_DECODE_INSTR_SHIFTCNT(1) |
464 A4XX_VFD_DECODE_INSTR_LASTCOMPVALID
|
465 COND(switchnext
, A4XX_VFD_DECODE_INSTR_SWITCHNEXT
));
471 OUT_PKT0(ring
, REG_A4XX_VFD_CONTROL_0
, 5);
472 OUT_RING(ring
, A4XX_VFD_CONTROL_0_TOTALATTRTOVS(total_in
) |
474 A4XX_VFD_CONTROL_0_STRMDECINSTRCNT(j
) |
475 A4XX_VFD_CONTROL_0_STRMFETCHINSTRCNT(j
));
476 OUT_RING(ring
, A4XX_VFD_CONTROL_1_MAXSTORAGE(129) | // XXX
477 A4XX_VFD_CONTROL_1_REGID4VTX(vertex_regid
) |
478 A4XX_VFD_CONTROL_1_REGID4INST(instance_regid
));
479 OUT_RING(ring
, 0x00000000); /* XXX VFD_CONTROL_2 */
480 OUT_RING(ring
, A4XX_VFD_CONTROL_3_REGID_VTXCNT(vtxcnt_regid
));
481 OUT_RING(ring
, 0x00000000); /* XXX VFD_CONTROL_4 */
483 /* cache invalidate, otherwise vertex fetch could see
484 * stale vbo contents:
486 OUT_PKT0(ring
, REG_A4XX_UCHE_INVALIDATE0
, 2);
487 OUT_RING(ring
, 0x00000000);
488 OUT_RING(ring
, 0x00000012);
492 fd4_emit_state(struct fd_context
*ctx
, struct fd_ringbuffer
*ring
,
493 struct fd4_emit
*emit
)
495 const struct ir3_shader_variant
*vp
= fd4_emit_get_vp(emit
);
496 const struct ir3_shader_variant
*fp
= fd4_emit_get_fp(emit
);
497 uint32_t dirty
= emit
->dirty
;
499 emit_marker(ring
, 5);
501 if ((dirty
& FD_DIRTY_FRAMEBUFFER
) && !emit
->key
.binning_pass
) {
502 struct pipe_framebuffer_state
*pfb
= &ctx
->framebuffer
;
503 unsigned char mrt_comp
[A4XX_MAX_RENDER_TARGETS
] = {0};
505 for (unsigned i
= 0; i
< A4XX_MAX_RENDER_TARGETS
; i
++) {
506 mrt_comp
[i
] = ((i
< pfb
->nr_cbufs
) && pfb
->cbufs
[i
]) ? 0xf : 0;
509 OUT_PKT0(ring
, REG_A4XX_RB_RENDER_COMPONENTS
, 1);
510 OUT_RING(ring
, A4XX_RB_RENDER_COMPONENTS_RT0(mrt_comp
[0]) |
511 A4XX_RB_RENDER_COMPONENTS_RT1(mrt_comp
[1]) |
512 A4XX_RB_RENDER_COMPONENTS_RT2(mrt_comp
[2]) |
513 A4XX_RB_RENDER_COMPONENTS_RT3(mrt_comp
[3]) |
514 A4XX_RB_RENDER_COMPONENTS_RT4(mrt_comp
[4]) |
515 A4XX_RB_RENDER_COMPONENTS_RT5(mrt_comp
[5]) |
516 A4XX_RB_RENDER_COMPONENTS_RT6(mrt_comp
[6]) |
517 A4XX_RB_RENDER_COMPONENTS_RT7(mrt_comp
[7]));
520 if (dirty
& (FD_DIRTY_ZSA
| FD_DIRTY_FRAMEBUFFER
)) {
521 struct fd4_zsa_stateobj
*zsa
= fd4_zsa_stateobj(ctx
->zsa
);
522 struct pipe_framebuffer_state
*pfb
= &ctx
->framebuffer
;
523 uint32_t rb_alpha_control
= zsa
->rb_alpha_control
;
525 if (util_format_is_pure_integer(pipe_surface_format(pfb
->cbufs
[0])))
526 rb_alpha_control
&= ~A4XX_RB_ALPHA_CONTROL_ALPHA_TEST
;
528 OUT_PKT0(ring
, REG_A4XX_RB_ALPHA_CONTROL
, 1);
529 OUT_RING(ring
, rb_alpha_control
);
531 OUT_PKT0(ring
, REG_A4XX_RB_STENCIL_CONTROL
, 2);
532 OUT_RING(ring
, zsa
->rb_stencil_control
);
533 OUT_RING(ring
, zsa
->rb_stencil_control2
);
536 if (dirty
& (FD_DIRTY_ZSA
| FD_DIRTY_STENCIL_REF
)) {
537 struct fd4_zsa_stateobj
*zsa
= fd4_zsa_stateobj(ctx
->zsa
);
538 struct pipe_stencil_ref
*sr
= &ctx
->stencil_ref
;
540 OUT_PKT0(ring
, REG_A4XX_RB_STENCILREFMASK
, 2);
541 OUT_RING(ring
, zsa
->rb_stencilrefmask
|
542 A4XX_RB_STENCILREFMASK_STENCILREF(sr
->ref_value
[0]));
543 OUT_RING(ring
, zsa
->rb_stencilrefmask_bf
|
544 A4XX_RB_STENCILREFMASK_BF_STENCILREF(sr
->ref_value
[1]));
547 if (dirty
& (FD_DIRTY_ZSA
| FD_DIRTY_PROG
)) {
548 struct fd4_zsa_stateobj
*zsa
= fd4_zsa_stateobj(ctx
->zsa
);
549 bool fragz
= fp
->has_kill
| fp
->writes_pos
;
551 OUT_PKT0(ring
, REG_A4XX_RB_DEPTH_CONTROL
, 1);
552 OUT_RING(ring
, zsa
->rb_depth_control
|
553 COND(fragz
, A4XX_RB_DEPTH_CONTROL_EARLY_Z_DISABLE
) |
554 COND(fragz
&& fp
->frag_coord
, A4XX_RB_DEPTH_CONTROL_FORCE_FRAGZ_TO_FS
));
556 /* maybe this register/bitfield needs a better name.. this
557 * appears to be just disabling early-z
559 OUT_PKT0(ring
, REG_A4XX_GRAS_ALPHA_CONTROL
, 1);
560 OUT_RING(ring
, zsa
->gras_alpha_control
|
561 COND(fragz
, A4XX_GRAS_ALPHA_CONTROL_ALPHA_TEST_ENABLE
) |
562 COND(fragz
&& fp
->frag_coord
, A4XX_GRAS_ALPHA_CONTROL_FORCE_FRAGZ_TO_FS
));
565 if (dirty
& FD_DIRTY_RASTERIZER
) {
566 struct fd4_rasterizer_stateobj
*rasterizer
=
567 fd4_rasterizer_stateobj(ctx
->rasterizer
);
569 OUT_PKT0(ring
, REG_A4XX_GRAS_SU_MODE_CONTROL
, 1);
570 OUT_RING(ring
, rasterizer
->gras_su_mode_control
|
571 A4XX_GRAS_SU_MODE_CONTROL_RENDERING_PASS
);
573 OUT_PKT0(ring
, REG_A4XX_GRAS_SU_POINT_MINMAX
, 2);
574 OUT_RING(ring
, rasterizer
->gras_su_point_minmax
);
575 OUT_RING(ring
, rasterizer
->gras_su_point_size
);
577 OUT_PKT0(ring
, REG_A4XX_GRAS_SU_POLY_OFFSET_SCALE
, 2);
578 OUT_RING(ring
, rasterizer
->gras_su_poly_offset_scale
);
579 OUT_RING(ring
, rasterizer
->gras_su_poly_offset_offset
);
581 OUT_PKT0(ring
, REG_A4XX_GRAS_CL_CLIP_CNTL
, 1);
582 OUT_RING(ring
, rasterizer
->gras_cl_clip_cntl
);
585 /* NOTE: since primitive_restart is not actually part of any
586 * state object, we need to make sure that we always emit
587 * PRIM_VTX_CNTL.. either that or be more clever and detect
591 const struct pipe_draw_info
*info
= emit
->info
;
592 struct fd4_rasterizer_stateobj
*rast
=
593 fd4_rasterizer_stateobj(ctx
->rasterizer
);
594 uint32_t val
= rast
->pc_prim_vtx_cntl
;
596 if (info
->indexed
&& info
->primitive_restart
)
597 val
|= A4XX_PC_PRIM_VTX_CNTL_PRIMITIVE_RESTART
;
599 val
|= COND(vp
->writes_psize
, A4XX_PC_PRIM_VTX_CNTL_PSIZE
);
601 if (fp
->total_in
> 0) {
602 uint32_t varout
= align(fp
->total_in
, 16) / 16;
604 varout
= align(varout
, 2);
605 val
|= A4XX_PC_PRIM_VTX_CNTL_VAROUT(varout
);
608 OUT_PKT0(ring
, REG_A4XX_PC_PRIM_VTX_CNTL
, 2);
610 OUT_RING(ring
, rast
->pc_prim_vtx_cntl2
);
613 if (dirty
& FD_DIRTY_SCISSOR
) {
614 struct pipe_scissor_state
*scissor
= fd_context_get_scissor(ctx
);
616 OUT_PKT0(ring
, REG_A4XX_GRAS_SC_WINDOW_SCISSOR_BR
, 2);
617 OUT_RING(ring
, A4XX_GRAS_SC_WINDOW_SCISSOR_BR_X(scissor
->maxx
- 1) |
618 A4XX_GRAS_SC_WINDOW_SCISSOR_BR_Y(scissor
->maxy
- 1));
619 OUT_RING(ring
, A4XX_GRAS_SC_WINDOW_SCISSOR_TL_X(scissor
->minx
) |
620 A4XX_GRAS_SC_WINDOW_SCISSOR_TL_Y(scissor
->miny
));
622 ctx
->max_scissor
.minx
= MIN2(ctx
->max_scissor
.minx
, scissor
->minx
);
623 ctx
->max_scissor
.miny
= MIN2(ctx
->max_scissor
.miny
, scissor
->miny
);
624 ctx
->max_scissor
.maxx
= MAX2(ctx
->max_scissor
.maxx
, scissor
->maxx
);
625 ctx
->max_scissor
.maxy
= MAX2(ctx
->max_scissor
.maxy
, scissor
->maxy
);
628 if (dirty
& FD_DIRTY_VIEWPORT
) {
630 OUT_PKT0(ring
, REG_A4XX_GRAS_CL_VPORT_XOFFSET_0
, 6);
631 OUT_RING(ring
, A4XX_GRAS_CL_VPORT_XOFFSET_0(ctx
->viewport
.translate
[0]));
632 OUT_RING(ring
, A4XX_GRAS_CL_VPORT_XSCALE_0(ctx
->viewport
.scale
[0]));
633 OUT_RING(ring
, A4XX_GRAS_CL_VPORT_YOFFSET_0(ctx
->viewport
.translate
[1]));
634 OUT_RING(ring
, A4XX_GRAS_CL_VPORT_YSCALE_0(ctx
->viewport
.scale
[1]));
635 OUT_RING(ring
, A4XX_GRAS_CL_VPORT_ZOFFSET_0(ctx
->viewport
.translate
[2]));
636 OUT_RING(ring
, A4XX_GRAS_CL_VPORT_ZSCALE_0(ctx
->viewport
.scale
[2]));
639 if (dirty
& (FD_DIRTY_PROG
| FD_DIRTY_FRAMEBUFFER
)) {
640 struct pipe_framebuffer_state
*pfb
= &ctx
->framebuffer
;
641 unsigned n
= pfb
->nr_cbufs
;
642 /* if we have depth/stencil, we need at least on MRT: */
645 fd4_program_emit(ring
, emit
, n
, pfb
->cbufs
);
648 if (emit
->prog
== &ctx
->prog
) { /* evil hack to deal sanely with clear path */
649 ir3_emit_consts(vp
, ring
, ctx
, emit
->info
, dirty
);
650 if (!emit
->key
.binning_pass
)
651 ir3_emit_consts(fp
, ring
, ctx
, emit
->info
, dirty
);
652 /* mark clean after emitting consts.. a bit ugly, but since binning
653 * pass is emitted first, we want to do this only for main draw:
655 if (!emit
->key
.binning_pass
)
659 if ((dirty
& FD_DIRTY_BLEND
)) {
660 struct fd4_blend_stateobj
*blend
= fd4_blend_stateobj(ctx
->blend
);
663 for (i
= 0; i
< A4XX_MAX_RENDER_TARGETS
; i
++) {
664 enum pipe_format format
= pipe_surface_format(
665 ctx
->framebuffer
.cbufs
[i
]);
666 bool is_int
= util_format_is_pure_integer(format
);
667 bool has_alpha
= util_format_has_alpha(format
);
668 uint32_t control
= blend
->rb_mrt
[i
].control
;
669 uint32_t blend_control
= blend
->rb_mrt
[i
].blend_control_alpha
;
672 control
&= A4XX_RB_MRT_CONTROL_COMPONENT_ENABLE__MASK
;
673 control
|= A4XX_RB_MRT_CONTROL_ROP_CODE(ROP_COPY
);
677 blend_control
|= blend
->rb_mrt
[i
].blend_control_rgb
;
679 blend_control
|= blend
->rb_mrt
[i
].blend_control_no_alpha_rgb
;
680 control
&= ~A4XX_RB_MRT_CONTROL_BLEND2
;
683 OUT_PKT0(ring
, REG_A4XX_RB_MRT_CONTROL(i
), 1);
684 OUT_RING(ring
, control
);
686 OUT_PKT0(ring
, REG_A4XX_RB_MRT_BLEND_CONTROL(i
), 1);
687 OUT_RING(ring
, blend_control
);
690 OUT_PKT0(ring
, REG_A4XX_RB_FS_OUTPUT
, 1);
691 OUT_RING(ring
, blend
->rb_fs_output
|
692 A4XX_RB_FS_OUTPUT_SAMPLE_MASK(0xffff));
695 if (dirty
& FD_DIRTY_BLEND_COLOR
) {
696 struct pipe_blend_color
*bcolor
= &ctx
->blend_color
;
698 OUT_PKT0(ring
, REG_A4XX_RB_BLEND_RED
, 8);
699 OUT_RING(ring
, A4XX_RB_BLEND_RED_FLOAT(bcolor
->color
[0]) |
700 A4XX_RB_BLEND_RED_UINT(bcolor
->color
[0] * 0xff) |
701 A4XX_RB_BLEND_RED_SINT(bcolor
->color
[0] * 0x7f));
702 OUT_RING(ring
, A4XX_RB_BLEND_RED_F32(bcolor
->color
[0]));
703 OUT_RING(ring
, A4XX_RB_BLEND_GREEN_FLOAT(bcolor
->color
[1]) |
704 A4XX_RB_BLEND_GREEN_UINT(bcolor
->color
[1] * 0xff) |
705 A4XX_RB_BLEND_GREEN_SINT(bcolor
->color
[1] * 0x7f));
706 OUT_RING(ring
, A4XX_RB_BLEND_RED_F32(bcolor
->color
[1]));
707 OUT_RING(ring
, A4XX_RB_BLEND_BLUE_FLOAT(bcolor
->color
[2]) |
708 A4XX_RB_BLEND_BLUE_UINT(bcolor
->color
[2] * 0xff) |
709 A4XX_RB_BLEND_BLUE_SINT(bcolor
->color
[2] * 0x7f));
710 OUT_RING(ring
, A4XX_RB_BLEND_BLUE_F32(bcolor
->color
[2]));
711 OUT_RING(ring
, A4XX_RB_BLEND_ALPHA_FLOAT(bcolor
->color
[3]) |
712 A4XX_RB_BLEND_ALPHA_UINT(bcolor
->color
[3] * 0xff) |
713 A4XX_RB_BLEND_ALPHA_SINT(bcolor
->color
[3] * 0x7f));
714 OUT_RING(ring
, A4XX_RB_BLEND_ALPHA_F32(bcolor
->color
[3]));
717 if (dirty
& FD_DIRTY_VERTTEX
) {
719 emit_textures(ctx
, ring
, SB_VERT_TEX
, &ctx
->verttex
, vp
);
721 dirty
&= ~FD_DIRTY_VERTTEX
;
724 if (dirty
& FD_DIRTY_FRAGTEX
) {
726 emit_textures(ctx
, ring
, SB_FRAG_TEX
, &ctx
->fragtex
, fp
);
728 dirty
&= ~FD_DIRTY_FRAGTEX
;
731 ctx
->dirty
&= ~dirty
;
734 /* emit setup at begin of new cmdstream buffer (don't rely on previous
735 * state, there could have been a context switch between ioctls):
738 fd4_emit_restore(struct fd_context
*ctx
)
740 struct fd4_context
*fd4_ctx
= fd4_context(ctx
);
741 struct fd_ringbuffer
*ring
= ctx
->ring
;
743 OUT_PKT0(ring
, REG_A4XX_RBBM_PERFCTR_CTL
, 1);
744 OUT_RING(ring
, 0x00000001);
746 OUT_PKT0(ring
, REG_A4XX_GRAS_DEBUG_ECO_CONTROL
, 1);
747 OUT_RING(ring
, 0x00000000);
749 OUT_PKT0(ring
, REG_A4XX_SP_MODE_CONTROL
, 1);
750 OUT_RING(ring
, 0x00000006);
752 OUT_PKT0(ring
, REG_A4XX_TPL1_TP_MODE_CONTROL
, 1);
753 OUT_RING(ring
, 0x0000003a);
755 OUT_PKT0(ring
, REG_A4XX_UNKNOWN_0D01
, 1);
756 OUT_RING(ring
, 0x00000001);
758 OUT_PKT0(ring
, REG_A4XX_UNKNOWN_0E42
, 1);
759 OUT_RING(ring
, 0x00000000);
761 OUT_PKT0(ring
, REG_A4XX_UCHE_CACHE_WAYS_VFD
, 1);
762 OUT_RING(ring
, 0x00000007);
764 OUT_PKT0(ring
, REG_A4XX_UCHE_CACHE_MODE_CONTROL
, 1);
765 OUT_RING(ring
, 0x00000000);
767 OUT_PKT0(ring
, REG_A4XX_UCHE_INVALIDATE0
, 2);
768 OUT_RING(ring
, 0x00000000);
769 OUT_RING(ring
, 0x00000012);
771 OUT_PKT0(ring
, REG_A4XX_HLSQ_MODE_CONTROL
, 1);
772 OUT_RING(ring
, 0x00000000);
774 OUT_PKT0(ring
, REG_A4XX_UNKNOWN_0CC5
, 1);
775 OUT_RING(ring
, 0x00000006);
777 OUT_PKT0(ring
, REG_A4XX_UNKNOWN_0CC6
, 1);
778 OUT_RING(ring
, 0x00000000);
780 OUT_PKT0(ring
, REG_A4XX_UNKNOWN_0EC2
, 1);
781 OUT_RING(ring
, 0x00040000);
783 OUT_PKT0(ring
, REG_A4XX_UNKNOWN_2001
, 1);
784 OUT_RING(ring
, 0x00000000);
786 OUT_PKT3(ring
, CP_INVALIDATE_STATE
, 1);
787 OUT_RING(ring
, 0x00001000);
789 OUT_PKT0(ring
, REG_A4XX_UNKNOWN_20EF
, 1);
790 OUT_RING(ring
, 0x00000000);
792 OUT_PKT0(ring
, REG_A4XX_RB_BLEND_RED
, 4);
793 OUT_RING(ring
, A4XX_RB_BLEND_RED_UINT(0) |
794 A4XX_RB_BLEND_RED_FLOAT(0.0));
795 OUT_RING(ring
, A4XX_RB_BLEND_GREEN_UINT(0) |
796 A4XX_RB_BLEND_GREEN_FLOAT(0.0));
797 OUT_RING(ring
, A4XX_RB_BLEND_BLUE_UINT(0) |
798 A4XX_RB_BLEND_BLUE_FLOAT(0.0));
799 OUT_RING(ring
, A4XX_RB_BLEND_ALPHA_UINT(0x7fff) |
800 A4XX_RB_BLEND_ALPHA_FLOAT(1.0));
802 OUT_PKT0(ring
, REG_A4XX_UNKNOWN_2152
, 1);
803 OUT_RING(ring
, 0x00000000);
805 OUT_PKT0(ring
, REG_A4XX_UNKNOWN_2153
, 1);
806 OUT_RING(ring
, 0x00000000);
808 OUT_PKT0(ring
, REG_A4XX_UNKNOWN_2154
, 1);
809 OUT_RING(ring
, 0x00000000);
811 OUT_PKT0(ring
, REG_A4XX_UNKNOWN_2155
, 1);
812 OUT_RING(ring
, 0x00000000);
814 OUT_PKT0(ring
, REG_A4XX_UNKNOWN_2156
, 1);
815 OUT_RING(ring
, 0x00000000);
817 OUT_PKT0(ring
, REG_A4XX_UNKNOWN_2157
, 1);
818 OUT_RING(ring
, 0x00000000);
820 OUT_PKT0(ring
, REG_A4XX_UNKNOWN_21C3
, 1);
821 OUT_RING(ring
, 0x0000001d);
823 OUT_PKT0(ring
, REG_A4XX_PC_GS_PARAM
, 1);
824 OUT_RING(ring
, 0x00000000);
826 OUT_PKT0(ring
, REG_A4XX_UNKNOWN_21E6
, 1);
827 OUT_RING(ring
, 0x00000001);
829 OUT_PKT0(ring
, REG_A4XX_PC_HS_PARAM
, 1);
830 OUT_RING(ring
, 0x00000000);
832 OUT_PKT0(ring
, REG_A4XX_UNKNOWN_22D7
, 1);
833 OUT_RING(ring
, 0x00000000);
835 OUT_PKT0(ring
, REG_A4XX_TPL1_TP_TEX_OFFSET
, 1);
836 OUT_RING(ring
, 0x00000000);
838 OUT_PKT0(ring
, REG_A4XX_TPL1_TP_TEX_COUNT
, 1);
839 OUT_RING(ring
, A4XX_TPL1_TP_TEX_COUNT_VS(16) |
840 A4XX_TPL1_TP_TEX_COUNT_HS(0) |
841 A4XX_TPL1_TP_TEX_COUNT_DS(0) |
842 A4XX_TPL1_TP_TEX_COUNT_GS(0));
844 OUT_PKT0(ring
, REG_A4XX_TPL1_TP_FS_TEX_COUNT
, 1);
847 /* we don't use this yet.. probably best to disable.. */
848 OUT_PKT3(ring
, CP_SET_DRAW_STATE
, 2);
849 OUT_RING(ring
, CP_SET_DRAW_STATE_0_COUNT(0) |
850 CP_SET_DRAW_STATE_0_DISABLE_ALL_GROUPS
|
851 CP_SET_DRAW_STATE_0_GROUP_ID(0));
852 OUT_RING(ring
, CP_SET_DRAW_STATE_1_ADDR(0));
854 OUT_PKT0(ring
, REG_A4XX_SP_VS_PVT_MEM_PARAM
, 2);
855 OUT_RING(ring
, 0x08000001); /* SP_VS_PVT_MEM_PARAM */
856 OUT_RELOC(ring
, fd4_ctx
->vs_pvt_mem
, 0,0,0); /* SP_VS_PVT_MEM_ADDR */
858 OUT_PKT0(ring
, REG_A4XX_SP_FS_PVT_MEM_PARAM
, 2);
859 OUT_RING(ring
, 0x08000001); /* SP_FS_PVT_MEM_PARAM */
860 OUT_RELOC(ring
, fd4_ctx
->fs_pvt_mem
, 0,0,0); /* SP_FS_PVT_MEM_ADDR */
862 OUT_PKT0(ring
, REG_A4XX_GRAS_SC_CONTROL
, 1);
863 OUT_RING(ring
, A4XX_GRAS_SC_CONTROL_RENDER_MODE(RB_RENDERING_PASS
) |
864 A4XX_GRAS_SC_CONTROL_MSAA_DISABLE
|
865 A4XX_GRAS_SC_CONTROL_MSAA_SAMPLES(MSAA_ONE
) |
866 A4XX_GRAS_SC_CONTROL_RASTER_MODE(0));
868 OUT_PKT0(ring
, REG_A4XX_RB_MSAA_CONTROL
, 1);
869 OUT_RING(ring
, A4XX_RB_MSAA_CONTROL_DISABLE
|
870 A4XX_RB_MSAA_CONTROL_SAMPLES(MSAA_ONE
));
872 OUT_PKT0(ring
, REG_A4XX_GRAS_CL_GB_CLIP_ADJ
, 1);
873 OUT_RING(ring
, A4XX_GRAS_CL_GB_CLIP_ADJ_HORZ(0) |
874 A4XX_GRAS_CL_GB_CLIP_ADJ_VERT(0));
876 OUT_PKT0(ring
, REG_A4XX_RB_ALPHA_CONTROL
, 1);
877 OUT_RING(ring
, A4XX_RB_ALPHA_CONTROL_ALPHA_TEST_FUNC(FUNC_ALWAYS
));
879 OUT_PKT0(ring
, REG_A4XX_RB_FS_OUTPUT
, 1);
880 OUT_RING(ring
, A4XX_RB_FS_OUTPUT_SAMPLE_MASK(0xffff));
882 OUT_PKT0(ring
, REG_A4XX_GRAS_CLEAR_CNTL
, 1);
883 OUT_RING(ring
, A4XX_GRAS_CLEAR_CNTL_NOT_FASTCLEAR
);
885 OUT_PKT0(ring
, REG_A4XX_GRAS_ALPHA_CONTROL
, 1);
888 fd_hw_query_enable(ctx
, ring
);
890 ctx
->needs_rb_fbd
= true;
894 fd4_emit_ib(struct fd_ringbuffer
*ring
, struct fd_ringmarker
*start
,
895 struct fd_ringmarker
*end
)
897 __OUT_IB(ring
, true, start
, end
);
901 fd4_emit_init(struct pipe_context
*pctx
)
903 struct fd_context
*ctx
= fd_context(pctx
);
904 ctx
->emit_const
= fd4_emit_const
;
905 ctx
->emit_const_bo
= fd4_emit_const_bo
;
906 ctx
->emit_ib
= fd4_emit_ib
;