2 * Copyright © 2017 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE.
30 #define __gen_validate_value(x) VALGRIND_CHECK_MEM_IS_DEFINED(&(x), sizeof(x))
35 #include "pipe/p_defines.h"
36 #include "pipe/p_state.h"
37 #include "pipe/p_context.h"
38 #include "pipe/p_screen.h"
39 #include "util/u_inlines.h"
40 #include "util/u_transfer.h"
42 #include "intel/compiler/brw_compiler.h"
43 #include "intel/common/gen_sample_positions.h"
44 #include "iris_batch.h"
45 #include "iris_context.h"
46 #include "iris_pipe.h"
47 #include "iris_resource.h"
49 #define __gen_address_type struct iris_address
50 #define __gen_user_data struct iris_batch
53 __gen_combine_address(struct iris_batch
*batch
, void *location
,
54 struct iris_address addr
, uint32_t delta
)
57 return addr
.offset
+ delta
;
59 return iris_batch_reloc(batch
, location
- batch
->cmdbuf
.map
, addr
.bo
,
60 addr
.offset
+ delta
, addr
.reloc_flags
);
63 #define __genxml_cmd_length(cmd) cmd ## _length
64 #define __genxml_cmd_length_bias(cmd) cmd ## _length_bias
65 #define __genxml_cmd_header(cmd) cmd ## _header
66 #define __genxml_cmd_pack(cmd) cmd ## _pack
69 get_command_space(struct iris_batch
*batch
, unsigned bytes
)
71 iris_require_command_space(batch
, bytes
);
72 void *map
= batch
->cmdbuf
.map_next
;
73 batch
->cmdbuf
.map_next
+= bytes
;
77 #define _iris_pack_command(batch, cmd, dst, name) \
78 for (struct cmd name = { __genxml_cmd_header(cmd) }, \
79 *_dst = (void *)(dst); __builtin_expect(_dst != NULL, 1); \
80 ({ __genxml_cmd_pack(cmd)(batch, (void *)_dst, &name); \
84 #define iris_pack_command(cmd, dst, name) \
85 _iris_pack_command(NULL, cmd, dst, name)
87 #define iris_pack_state(cmd, dst, name) \
88 for (struct cmd name = {}, \
89 *_dst = (void *)(dst); __builtin_expect(_dst != NULL, 1); \
90 __genxml_cmd_pack(cmd)(NULL, (void *)_dst, &name), \
93 #define iris_emit_cmd(batch, cmd, name) \
94 _iris_pack_command(batch, cmd, get_command_space(batch, 4 * __genxml_cmd_length(cmd)), name)
96 #define iris_emit_merge(batch, dwords0, dwords1, num_dwords) \
98 uint32_t *dw = get_command_space(batch, 4 * num_dwords); \
99 for (uint32_t i = 0; i < num_dwords; i++) \
100 dw[i] = (dwords0)[i] | (dwords1)[i]; \
101 VG(VALGRIND_CHECK_MEM_IS_DEFINED(dw, num_dwords)); \
104 #define iris_emit_with_addr(batch, dwords, num_dw, addr_field, addr) \
106 STATIC_ASSERT((GENX(addr_field) % 64) == 0); \
107 assert(num_dw <= ARRAY_SIZE(dwords)); \
108 int addr_idx = GENX(addr_field) / 32; \
109 uint32_t *dw = get_command_space(batch, 4 * num_dw); \
110 for (uint32_t i = 0; i < addr_idx; i++) { \
111 dw[i] = (dwords)[i]; \
113 uint64_t *qw = (uint64_t *) &dw[addr_idx]; \
114 qw = iris_batch_reloc(batch, qw - batch->cmdbuf.map, addr.bo, \
115 addr.offset + (dwords)[addr_idx + 1], \
117 for (uint32_t i = addr_idx + 1; i < num_dw; i++) { \
118 dw[i] = (dwords)[i]; \
120 VG(VALGRIND_CHECK_MEM_IS_DEFINED(dw, num_dw * 4)); \
123 #include "genxml/genX_pack.h"
124 #include "genxml/gen_macros.h"
125 #include "genxml/genX_bits.h"
127 #define MOCS_WB (2 << 1)
129 UNUSED
static void pipe_asserts()
131 #define PIPE_ASSERT(x) STATIC_ASSERT((int)x)
133 /* pipe_logicop happens to match the hardware. */
134 PIPE_ASSERT(PIPE_LOGICOP_CLEAR
== LOGICOP_CLEAR
);
135 PIPE_ASSERT(PIPE_LOGICOP_NOR
== LOGICOP_NOR
);
136 PIPE_ASSERT(PIPE_LOGICOP_AND_INVERTED
== LOGICOP_AND_INVERTED
);
137 PIPE_ASSERT(PIPE_LOGICOP_COPY_INVERTED
== LOGICOP_COPY_INVERTED
);
138 PIPE_ASSERT(PIPE_LOGICOP_AND_REVERSE
== LOGICOP_AND_REVERSE
);
139 PIPE_ASSERT(PIPE_LOGICOP_INVERT
== LOGICOP_INVERT
);
140 PIPE_ASSERT(PIPE_LOGICOP_XOR
== LOGICOP_XOR
);
141 PIPE_ASSERT(PIPE_LOGICOP_NAND
== LOGICOP_NAND
);
142 PIPE_ASSERT(PIPE_LOGICOP_AND
== LOGICOP_AND
);
143 PIPE_ASSERT(PIPE_LOGICOP_EQUIV
== LOGICOP_EQUIV
);
144 PIPE_ASSERT(PIPE_LOGICOP_NOOP
== LOGICOP_NOOP
);
145 PIPE_ASSERT(PIPE_LOGICOP_OR_INVERTED
== LOGICOP_OR_INVERTED
);
146 PIPE_ASSERT(PIPE_LOGICOP_COPY
== LOGICOP_COPY
);
147 PIPE_ASSERT(PIPE_LOGICOP_OR_REVERSE
== LOGICOP_OR_REVERSE
);
148 PIPE_ASSERT(PIPE_LOGICOP_OR
== LOGICOP_OR
);
149 PIPE_ASSERT(PIPE_LOGICOP_SET
== LOGICOP_SET
);
151 /* pipe_blend_func happens to match the hardware. */
152 PIPE_ASSERT(PIPE_BLENDFACTOR_ONE
== BLENDFACTOR_ONE
);
153 PIPE_ASSERT(PIPE_BLENDFACTOR_SRC_COLOR
== BLENDFACTOR_SRC_COLOR
);
154 PIPE_ASSERT(PIPE_BLENDFACTOR_SRC_ALPHA
== BLENDFACTOR_SRC_ALPHA
);
155 PIPE_ASSERT(PIPE_BLENDFACTOR_DST_ALPHA
== BLENDFACTOR_DST_ALPHA
);
156 PIPE_ASSERT(PIPE_BLENDFACTOR_DST_COLOR
== BLENDFACTOR_DST_COLOR
);
157 PIPE_ASSERT(PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE
== BLENDFACTOR_SRC_ALPHA_SATURATE
);
158 PIPE_ASSERT(PIPE_BLENDFACTOR_CONST_COLOR
== BLENDFACTOR_CONST_COLOR
);
159 PIPE_ASSERT(PIPE_BLENDFACTOR_CONST_ALPHA
== BLENDFACTOR_CONST_ALPHA
);
160 PIPE_ASSERT(PIPE_BLENDFACTOR_SRC1_COLOR
== BLENDFACTOR_SRC1_COLOR
);
161 PIPE_ASSERT(PIPE_BLENDFACTOR_SRC1_ALPHA
== BLENDFACTOR_SRC1_ALPHA
);
162 PIPE_ASSERT(PIPE_BLENDFACTOR_ZERO
== BLENDFACTOR_ZERO
);
163 PIPE_ASSERT(PIPE_BLENDFACTOR_INV_SRC_COLOR
== BLENDFACTOR_INV_SRC_COLOR
);
164 PIPE_ASSERT(PIPE_BLENDFACTOR_INV_SRC_ALPHA
== BLENDFACTOR_INV_SRC_ALPHA
);
165 PIPE_ASSERT(PIPE_BLENDFACTOR_INV_DST_ALPHA
== BLENDFACTOR_INV_DST_ALPHA
);
166 PIPE_ASSERT(PIPE_BLENDFACTOR_INV_DST_COLOR
== BLENDFACTOR_INV_DST_COLOR
);
167 PIPE_ASSERT(PIPE_BLENDFACTOR_INV_CONST_COLOR
== BLENDFACTOR_INV_CONST_COLOR
);
168 PIPE_ASSERT(PIPE_BLENDFACTOR_INV_CONST_ALPHA
== BLENDFACTOR_INV_CONST_ALPHA
);
169 PIPE_ASSERT(PIPE_BLENDFACTOR_INV_SRC1_COLOR
== BLENDFACTOR_INV_SRC1_COLOR
);
170 PIPE_ASSERT(PIPE_BLENDFACTOR_INV_SRC1_ALPHA
== BLENDFACTOR_INV_SRC1_ALPHA
);
172 /* pipe_blend_func happens to match the hardware. */
173 PIPE_ASSERT(PIPE_BLEND_ADD
== BLENDFUNCTION_ADD
);
174 PIPE_ASSERT(PIPE_BLEND_SUBTRACT
== BLENDFUNCTION_SUBTRACT
);
175 PIPE_ASSERT(PIPE_BLEND_REVERSE_SUBTRACT
== BLENDFUNCTION_REVERSE_SUBTRACT
);
176 PIPE_ASSERT(PIPE_BLEND_MIN
== BLENDFUNCTION_MIN
);
177 PIPE_ASSERT(PIPE_BLEND_MAX
== BLENDFUNCTION_MAX
);
179 /* pipe_stencil_op happens to match the hardware. */
180 PIPE_ASSERT(PIPE_STENCIL_OP_KEEP
== STENCILOP_KEEP
);
181 PIPE_ASSERT(PIPE_STENCIL_OP_ZERO
== STENCILOP_ZERO
);
182 PIPE_ASSERT(PIPE_STENCIL_OP_REPLACE
== STENCILOP_REPLACE
);
183 PIPE_ASSERT(PIPE_STENCIL_OP_INCR
== STENCILOP_INCRSAT
);
184 PIPE_ASSERT(PIPE_STENCIL_OP_DECR
== STENCILOP_DECRSAT
);
185 PIPE_ASSERT(PIPE_STENCIL_OP_INCR_WRAP
== STENCILOP_INCR
);
186 PIPE_ASSERT(PIPE_STENCIL_OP_DECR_WRAP
== STENCILOP_DECR
);
187 PIPE_ASSERT(PIPE_STENCIL_OP_INVERT
== STENCILOP_INVERT
);
192 translate_prim_type(enum pipe_prim_type prim
, uint8_t verts_per_patch
)
194 static const unsigned map
[] = {
195 [PIPE_PRIM_POINTS
] = _3DPRIM_POINTLIST
,
196 [PIPE_PRIM_LINES
] = _3DPRIM_LINELIST
,
197 [PIPE_PRIM_LINE_LOOP
] = _3DPRIM_LINELOOP
,
198 [PIPE_PRIM_LINE_STRIP
] = _3DPRIM_LINESTRIP
,
199 [PIPE_PRIM_TRIANGLES
] = _3DPRIM_TRILIST
,
200 [PIPE_PRIM_TRIANGLE_STRIP
] = _3DPRIM_TRISTRIP
,
201 [PIPE_PRIM_TRIANGLE_FAN
] = _3DPRIM_TRIFAN
,
202 [PIPE_PRIM_QUADS
] = _3DPRIM_QUADLIST
,
203 [PIPE_PRIM_QUAD_STRIP
] = _3DPRIM_QUADSTRIP
,
204 [PIPE_PRIM_POLYGON
] = _3DPRIM_POLYGON
,
205 [PIPE_PRIM_LINES_ADJACENCY
] = _3DPRIM_LINELIST_ADJ
,
206 [PIPE_PRIM_LINE_STRIP_ADJACENCY
] = _3DPRIM_LINESTRIP_ADJ
,
207 [PIPE_PRIM_TRIANGLES_ADJACENCY
] = _3DPRIM_TRILIST_ADJ
,
208 [PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY
] = _3DPRIM_TRISTRIP_ADJ
,
209 [PIPE_PRIM_PATCHES
] = _3DPRIM_PATCHLIST_1
- 1,
212 return map
[prim
] + (prim
== PIPE_PRIM_PATCHES
? verts_per_patch
: 0);
216 translate_compare_func(enum pipe_compare_func pipe_func
)
218 static const unsigned map
[] = {
219 [PIPE_FUNC_NEVER
] = COMPAREFUNCTION_NEVER
,
220 [PIPE_FUNC_LESS
] = COMPAREFUNCTION_LESS
,
221 [PIPE_FUNC_EQUAL
] = COMPAREFUNCTION_EQUAL
,
222 [PIPE_FUNC_LEQUAL
] = COMPAREFUNCTION_LEQUAL
,
223 [PIPE_FUNC_GREATER
] = COMPAREFUNCTION_GREATER
,
224 [PIPE_FUNC_NOTEQUAL
] = COMPAREFUNCTION_NOTEQUAL
,
225 [PIPE_FUNC_GEQUAL
] = COMPAREFUNCTION_GEQUAL
,
226 [PIPE_FUNC_ALWAYS
] = COMPAREFUNCTION_ALWAYS
,
228 return map
[pipe_func
];
232 translate_shadow_func(enum pipe_compare_func pipe_func
)
234 /* Gallium specifies the result of shadow comparisons as:
236 * 1 if ref <op> texel,
241 * 0 if texel <op> ref,
244 * So we need to flip the operator and also negate.
246 static const unsigned map
[] = {
247 [PIPE_FUNC_NEVER
] = PREFILTEROPALWAYS
,
248 [PIPE_FUNC_LESS
] = PREFILTEROPLEQUAL
,
249 [PIPE_FUNC_EQUAL
] = PREFILTEROPNOTEQUAL
,
250 [PIPE_FUNC_LEQUAL
] = PREFILTEROPLESS
,
251 [PIPE_FUNC_GREATER
] = PREFILTEROPGEQUAL
,
252 [PIPE_FUNC_NOTEQUAL
] = PREFILTEROPEQUAL
,
253 [PIPE_FUNC_GEQUAL
] = PREFILTEROPGREATER
,
254 [PIPE_FUNC_ALWAYS
] = PREFILTEROPNEVER
,
256 return map
[pipe_func
];
260 translate_cull_mode(unsigned pipe_face
)
262 static const unsigned map
[4] = {
263 [PIPE_FACE_NONE
] = CULLMODE_NONE
,
264 [PIPE_FACE_FRONT
] = CULLMODE_FRONT
,
265 [PIPE_FACE_BACK
] = CULLMODE_BACK
,
266 [PIPE_FACE_FRONT_AND_BACK
] = CULLMODE_BOTH
,
268 return map
[pipe_face
];
272 translate_fill_mode(unsigned pipe_polymode
)
274 static const unsigned map
[4] = {
275 [PIPE_POLYGON_MODE_FILL
] = FILL_MODE_SOLID
,
276 [PIPE_POLYGON_MODE_LINE
] = FILL_MODE_WIREFRAME
,
277 [PIPE_POLYGON_MODE_POINT
] = FILL_MODE_POINT
,
278 [PIPE_POLYGON_MODE_FILL_RECTANGLE
] = FILL_MODE_SOLID
,
280 return map
[pipe_polymode
];
283 static struct iris_address
284 ro_bo(struct iris_bo
*bo
, uint32_t offset
)
286 return (struct iris_address
) { .bo
= bo
, .offset
= offset
};
290 iris_emit_state_base_address(struct iris_batch
*batch
)
292 /* XXX: PIPE_CONTROLs */
294 iris_emit_cmd(batch
, GENX(STATE_BASE_ADDRESS
), sba
) {
296 // XXX: MOCS is stupid for this.
297 sba
.GeneralStateMemoryObjectControlState
= MOCS_WB
;
298 sba
.StatelessDataPortAccessMemoryObjectControlState
= MOCS_WB
;
299 sba
.SurfaceStateMemoryObjectControlState
= MOCS_WB
;
300 sba
.DynamicStateMemoryObjectControlState
= MOCS_WB
;
301 sba
.IndirectObjectMemoryObjectControlState
= MOCS_WB
;
302 sba
.InstructionMemoryObjectControlState
= MOCS_WB
;
303 sba
.BindlessSurfaceStateMemoryObjectControlState
= MOCS_WB
;
306 sba
.GeneralStateBaseAddressModifyEnable
= true;
307 sba
.SurfaceStateBaseAddressModifyEnable
= true;
308 sba
.DynamicStateBaseAddressModifyEnable
= true;
309 sba
.IndirectObjectBaseAddressModifyEnable
= true;
310 sba
.InstructionBaseAddressModifyEnable
= true;
311 sba
.GeneralStateBufferSizeModifyEnable
= true;
312 sba
.DynamicStateBufferSizeModifyEnable
= true;
313 sba
.BindlessSurfaceStateBaseAddressModifyEnable
= true;
314 sba
.IndirectObjectBufferSizeModifyEnable
= true;
315 sba
.InstructionBuffersizeModifyEnable
= true;
317 sba
.SurfaceStateBaseAddress
= ro_bo(batch
->statebuf
.bo
, 0);
318 sba
.DynamicStateBaseAddress
= ro_bo(batch
->statebuf
.bo
, 0);
320 sba
.GeneralStateBufferSize
= 0xfffff;
321 sba
.IndirectObjectBufferSize
= 0xfffff;
322 sba
.InstructionBufferSize
= 0xfffff;
323 sba
.DynamicStateBufferSize
= ALIGN(MAX_STATE_SIZE
, 4096);
328 iris_init_render_context(struct iris_screen
*screen
,
329 struct iris_batch
*batch
,
330 struct pipe_debug_callback
*dbg
)
332 batch
->emit_state_base_address
= iris_emit_state_base_address
;
333 iris_init_batch(batch
, screen
, dbg
, I915_EXEC_RENDER
);
335 iris_emit_cmd(batch
, GENX(3DSTATE_DRAWING_RECTANGLE
), rect
) {
336 rect
.ClippedDrawingRectangleXMax
= UINT16_MAX
;
337 rect
.ClippedDrawingRectangleYMax
= UINT16_MAX
;
339 iris_emit_cmd(batch
, GENX(3DSTATE_SAMPLE_PATTERN
), pat
) {
340 GEN_SAMPLE_POS_1X(pat
._1xSample
);
341 GEN_SAMPLE_POS_2X(pat
._2xSample
);
342 GEN_SAMPLE_POS_4X(pat
._4xSample
);
343 GEN_SAMPLE_POS_8X(pat
._8xSample
);
344 GEN_SAMPLE_POS_16X(pat
._16xSample
);
346 iris_emit_cmd(batch
, GENX(3DSTATE_AA_LINE_PARAMETERS
), foo
);
347 iris_emit_cmd(batch
, GENX(3DSTATE_WM_CHROMAKEY
), foo
);
348 iris_emit_cmd(batch
, GENX(3DSTATE_WM_HZ_OP
), foo
);
349 /* XXX: may need to set an offset for origin-UL framebuffers */
350 iris_emit_cmd(batch
, GENX(3DSTATE_POLY_STIPPLE_OFFSET
), foo
);
352 /* Just assign a static partitioning. */
353 for (int i
= 0; i
<= MESA_SHADER_FRAGMENT
; i
++) {
354 iris_emit_cmd(batch
, GENX(3DSTATE_PUSH_CONSTANT_ALLOC_VS
), alloc
) {
355 alloc
._3DCommandSubOpcode
= 18 + i
;
356 alloc
.ConstantBufferOffset
= 6 * i
;
357 alloc
.ConstantBufferSize
= i
== MESA_SHADER_FRAGMENT
? 8 : 6;
363 iris_launch_grid(struct pipe_context
*ctx
, const struct pipe_grid_info
*info
)
368 iris_set_blend_color(struct pipe_context
*ctx
,
369 const struct pipe_blend_color
*state
)
371 struct iris_context
*ice
= (struct iris_context
*) ctx
;
373 memcpy(&ice
->state
.blend_color
, state
, sizeof(struct pipe_blend_color
));
374 ice
->state
.dirty
|= IRIS_DIRTY_COLOR_CALC_STATE
;
377 struct iris_blend_state
{
378 uint32_t ps_blend
[GENX(3DSTATE_PS_BLEND_length
)];
379 uint32_t blend_state
[GENX(BLEND_STATE_length
)];
380 uint32_t blend_entries
[BRW_MAX_DRAW_BUFFERS
*
381 GENX(BLEND_STATE_ENTRY_length
)];
385 iris_create_blend_state(struct pipe_context
*ctx
,
386 const struct pipe_blend_state
*state
)
388 struct iris_blend_state
*cso
= malloc(sizeof(struct iris_blend_state
));
390 iris_pack_state(GENX(BLEND_STATE
), cso
->blend_state
, bs
) {
391 bs
.AlphaToCoverageEnable
= state
->alpha_to_coverage
;
392 bs
.IndependentAlphaBlendEnable
= state
->independent_blend_enable
;
393 bs
.AlphaToOneEnable
= state
->alpha_to_one
;
394 bs
.AlphaToCoverageDitherEnable
= state
->alpha_to_coverage
;
395 bs
.ColorDitherEnable
= state
->dither
;
396 //bs.AlphaTestEnable = <comes from alpha state> :(
397 //bs.AlphaTestFunction = <comes from alpha state> :(
400 iris_pack_command(GENX(3DSTATE_PS_BLEND
), cso
->ps_blend
, pb
) {
401 //pb.HasWriteableRT = <comes from somewhere> :(
402 //pb.AlphaTestEnable = <comes from alpha state> :(
403 pb
.AlphaToCoverageEnable
= state
->alpha_to_coverage
;
404 pb
.IndependentAlphaBlendEnable
= state
->independent_blend_enable
;
406 pb
.ColorBufferBlendEnable
= state
->rt
[0].blend_enable
;
408 pb
.SourceBlendFactor
= state
->rt
[0].rgb_src_factor
;
409 pb
.SourceAlphaBlendFactor
= state
->rt
[0].alpha_func
;
410 pb
.DestinationBlendFactor
= state
->rt
[0].rgb_dst_factor
;
411 pb
.DestinationAlphaBlendFactor
= state
->rt
[0].alpha_dst_factor
;
414 for (int i
= 0; i
< BRW_MAX_DRAW_BUFFERS
; i
++) {
415 iris_pack_state(GENX(BLEND_STATE_ENTRY
), &cso
->blend_entries
[i
], be
) {
416 be
.LogicOpEnable
= state
->logicop_enable
;
417 be
.LogicOpFunction
= state
->logicop_func
;
419 be
.PreBlendSourceOnlyClampEnable
= false;
420 be
.ColorClampRange
= COLORCLAMP_RTFORMAT
;
421 be
.PreBlendColorClampEnable
= true;
422 be
.PostBlendColorClampEnable
= true;
424 be
.ColorBufferBlendEnable
= state
->rt
[i
].blend_enable
;
426 be
.ColorBlendFunction
= state
->rt
[i
].rgb_func
;
427 be
.AlphaBlendFunction
= state
->rt
[i
].alpha_func
;
428 be
.SourceBlendFactor
= state
->rt
[i
].rgb_src_factor
;
429 be
.SourceAlphaBlendFactor
= state
->rt
[i
].alpha_func
;
430 be
.DestinationBlendFactor
= state
->rt
[i
].rgb_dst_factor
;
431 be
.DestinationAlphaBlendFactor
= state
->rt
[i
].alpha_dst_factor
;
433 be
.WriteDisableRed
= state
->rt
[i
].colormask
& PIPE_MASK_R
;
434 be
.WriteDisableGreen
= state
->rt
[i
].colormask
& PIPE_MASK_G
;
435 be
.WriteDisableBlue
= state
->rt
[i
].colormask
& PIPE_MASK_B
;
436 be
.WriteDisableAlpha
= state
->rt
[i
].colormask
& PIPE_MASK_A
;
444 iris_bind_blend_state(struct pipe_context
*ctx
, void *state
)
446 struct iris_context
*ice
= (struct iris_context
*) ctx
;
447 ice
->state
.cso_blend
= state
;
448 ice
->state
.dirty
|= IRIS_DIRTY_CC_VIEWPORT
;
449 ice
->state
.dirty
|= IRIS_DIRTY_WM_DEPTH_STENCIL
;
452 struct iris_depth_stencil_alpha_state
{
453 uint32_t wmds
[GENX(3DSTATE_WM_DEPTH_STENCIL_length
)];
454 uint32_t cc_vp
[GENX(CC_VIEWPORT_length
)];
456 struct pipe_alpha_state alpha
; /* to BLEND_STATE, 3DSTATE_PS_BLEND */
460 iris_create_zsa_state(struct pipe_context
*ctx
,
461 const struct pipe_depth_stencil_alpha_state
*state
)
463 struct iris_depth_stencil_alpha_state
*cso
=
464 malloc(sizeof(struct iris_depth_stencil_alpha_state
));
466 cso
->alpha
= state
->alpha
;
468 bool two_sided_stencil
= state
->stencil
[1].enabled
;
470 /* The state tracker needs to optimize away EQUAL writes for us. */
471 assert(!(state
->depth
.func
== PIPE_FUNC_EQUAL
&& state
->depth
.writemask
));
473 iris_pack_command(GENX(3DSTATE_WM_DEPTH_STENCIL
), cso
->wmds
, wmds
) {
474 wmds
.StencilFailOp
= state
->stencil
[0].fail_op
;
475 wmds
.StencilPassDepthFailOp
= state
->stencil
[0].zfail_op
;
476 wmds
.StencilPassDepthPassOp
= state
->stencil
[0].zpass_op
;
477 wmds
.StencilTestFunction
=
478 translate_compare_func(state
->stencil
[0].func
);
479 wmds
.BackfaceStencilFailOp
= state
->stencil
[1].fail_op
;
480 wmds
.BackfaceStencilPassDepthFailOp
= state
->stencil
[1].zfail_op
;
481 wmds
.BackfaceStencilPassDepthPassOp
= state
->stencil
[1].zpass_op
;
482 wmds
.BackfaceStencilTestFunction
=
483 translate_compare_func(state
->stencil
[1].func
);
484 wmds
.DepthTestFunction
= translate_compare_func(state
->depth
.func
);
485 wmds
.DoubleSidedStencilEnable
= two_sided_stencil
;
486 wmds
.StencilTestEnable
= state
->stencil
[0].enabled
;
487 wmds
.StencilBufferWriteEnable
=
488 state
->stencil
[0].writemask
!= 0 ||
489 (two_sided_stencil
&& state
->stencil
[1].writemask
!= 0);
490 wmds
.DepthTestEnable
= state
->depth
.enabled
;
491 wmds
.DepthBufferWriteEnable
= state
->depth
.writemask
;
492 wmds
.StencilTestMask
= state
->stencil
[0].valuemask
;
493 wmds
.StencilWriteMask
= state
->stencil
[0].writemask
;
494 wmds
.BackfaceStencilTestMask
= state
->stencil
[1].valuemask
;
495 wmds
.BackfaceStencilWriteMask
= state
->stencil
[1].writemask
;
496 /* wmds.[Backface]StencilReferenceValue are merged later */
499 iris_pack_state(GENX(CC_VIEWPORT
), cso
->cc_vp
, ccvp
) {
500 ccvp
.MinimumDepth
= state
->depth
.bounds_min
;
501 ccvp
.MaximumDepth
= state
->depth
.bounds_max
;
508 iris_bind_zsa_state(struct pipe_context
*ctx
, void *state
)
510 struct iris_context
*ice
= (struct iris_context
*) ctx
;
511 struct iris_depth_stencil_alpha_state
*old_cso
= ice
->state
.cso_zsa
;
512 struct iris_depth_stencil_alpha_state
*new_cso
= state
;
515 if (!old_cso
|| old_cso
->alpha
.ref_value
!= new_cso
->alpha
.ref_value
) {
516 ice
->state
.dirty
|= IRIS_DIRTY_COLOR_CALC_STATE
;
520 ice
->state
.cso_zsa
= new_cso
;
521 ice
->state
.dirty
|= IRIS_DIRTY_CC_VIEWPORT
;
522 ice
->state
.dirty
|= IRIS_DIRTY_WM_DEPTH_STENCIL
;
525 struct iris_rasterizer_state
{
526 uint32_t sf
[GENX(3DSTATE_SF_length
)];
527 uint32_t clip
[GENX(3DSTATE_CLIP_length
)];
528 uint32_t raster
[GENX(3DSTATE_RASTER_length
)];
529 uint32_t wm
[GENX(3DSTATE_WM_length
)];
530 uint32_t line_stipple
[GENX(3DSTATE_LINE_STIPPLE_length
)];
532 bool flatshade
; /* for shader state */
533 bool light_twoside
; /* for shader state */
534 bool rasterizer_discard
; /* for 3DSTATE_STREAMOUT */
535 bool half_pixel_center
; /* for 3DSTATE_MULTISAMPLE */
536 enum pipe_sprite_coord_mode sprite_coord_mode
; /* PIPE_SPRITE_* */
540 iris_create_rasterizer_state(struct pipe_context
*ctx
,
541 const struct pipe_rasterizer_state
*state
)
543 struct iris_rasterizer_state
*cso
=
544 malloc(sizeof(struct iris_rasterizer_state
));
547 sprite_coord_mode
-> SBE PointSpriteTextureCoordinateOrigin
548 sprite_coord_enable
-> SBE PointSpriteTextureCoordinateEnable
549 point_quad_rasterization
-> SBE
?
554 force_persample_interp
- ?
557 offset_units_unscaled
- cap
not exposed
561 cso
->flatshade
= state
->flatshade
;
562 cso
->light_twoside
= state
->light_twoside
;
563 cso
->rasterizer_discard
= state
->rasterizer_discard
;
564 cso
->half_pixel_center
= state
->half_pixel_center
;
566 iris_pack_command(GENX(3DSTATE_SF
), cso
->sf
, sf
) {
567 sf
.StatisticsEnable
= true;
568 sf
.ViewportTransformEnable
= true;
569 sf
.AALineDistanceMode
= AALINEDISTANCE_TRUE
;
570 sf
.LineEndCapAntialiasingRegionWidth
=
571 state
->line_smooth
? _10pixels
: _05pixels
;
572 sf
.LastPixelEnable
= state
->line_last_pixel
;
573 sf
.LineWidth
= state
->line_width
;
574 sf
.SmoothPointEnable
= state
->point_smooth
;
575 sf
.PointWidthSource
= state
->point_size_per_vertex
? Vertex
: State
;
576 sf
.PointWidth
= state
->point_size
;
578 if (state
->flatshade_first
) {
579 sf
.TriangleStripListProvokingVertexSelect
= 2;
580 sf
.TriangleFanProvokingVertexSelect
= 2;
581 sf
.LineStripListProvokingVertexSelect
= 1;
583 sf
.TriangleFanProvokingVertexSelect
= 1;
588 iris_pack_command(GENX(3DSTATE_RASTER
), cso
->raster
, rr
) {
589 rr
.FrontWinding
= state
->front_ccw
? CounterClockwise
: Clockwise
;
590 rr
.CullMode
= translate_cull_mode(state
->cull_face
);
591 rr
.FrontFaceFillMode
= translate_fill_mode(state
->fill_front
);
592 rr
.BackFaceFillMode
= translate_fill_mode(state
->fill_back
);
593 rr
.DXMultisampleRasterizationEnable
= state
->multisample
;
594 rr
.GlobalDepthOffsetEnableSolid
= state
->offset_tri
;
595 rr
.GlobalDepthOffsetEnableWireframe
= state
->offset_line
;
596 rr
.GlobalDepthOffsetEnablePoint
= state
->offset_point
;
597 rr
.GlobalDepthOffsetConstant
= state
->offset_units
;
598 rr
.GlobalDepthOffsetScale
= state
->offset_scale
;
599 rr
.GlobalDepthOffsetClamp
= state
->offset_clamp
;
600 rr
.SmoothPointEnable
= state
->point_smooth
;
601 rr
.AntialiasingEnable
= state
->line_smooth
;
602 rr
.ScissorRectangleEnable
= state
->scissor
;
603 rr
.ViewportZNearClipTestEnable
= state
->depth_clip_near
;
604 rr
.ViewportZFarClipTestEnable
= state
->depth_clip_far
;
605 //rr.ConservativeRasterizationEnable = not yet supported by Gallium...
608 iris_pack_command(GENX(3DSTATE_CLIP
), cso
->clip
, cl
) {
609 /* cl.NonPerspectiveBarycentricEnable is filled in at draw time from
610 * the FS program; cl.ForceZeroRTAIndexEnable is filled in from the FB.
612 cl
.StatisticsEnable
= true;
613 cl
.EarlyCullEnable
= true;
614 cl
.UserClipDistanceClipTestEnableBitmask
= state
->clip_plane_enable
;
615 cl
.ForceUserClipDistanceClipTestEnableBitmask
= true;
616 cl
.APIMode
= state
->clip_halfz
? APIMODE_D3D
: APIMODE_OGL
;
617 cl
.GuardbandClipTestEnable
= true;
618 cl
.ClipMode
= CLIPMODE_NORMAL
;
619 cl
.ClipEnable
= true;
620 cl
.ViewportXYClipTestEnable
= state
->point_tri_clip
;
621 cl
.MinimumPointWidth
= 0.125;
622 cl
.MaximumPointWidth
= 255.875;
624 if (state
->flatshade_first
) {
625 cl
.TriangleStripListProvokingVertexSelect
= 2;
626 cl
.TriangleFanProvokingVertexSelect
= 2;
627 cl
.LineStripListProvokingVertexSelect
= 1;
629 cl
.TriangleFanProvokingVertexSelect
= 1;
633 iris_pack_command(GENX(3DSTATE_WM
), cso
->wm
, wm
) {
634 /* wm.BarycentricInterpolationMode and wm.EarlyDepthStencilControl are
635 * filled in at draw time from the FS program.
637 wm
.LineAntialiasingRegionWidth
= _10pixels
;
638 wm
.LineEndCapAntialiasingRegionWidth
= _05pixels
;
639 wm
.PointRasterizationRule
= RASTRULE_UPPER_RIGHT
;
640 wm
.StatisticsEnable
= true;
641 wm
.LineStippleEnable
= state
->line_stipple_enable
;
642 wm
.PolygonStippleEnable
= state
->poly_stipple_enable
;
645 /* Remap from 0..255 back to 1..256 */
646 const unsigned line_stipple_factor
= state
->line_stipple_factor
+ 1;
648 iris_pack_command(GENX(3DSTATE_LINE_STIPPLE
), cso
->line_stipple
, line
) {
649 line
.LineStipplePattern
= state
->line_stipple_pattern
;
650 line
.LineStippleInverseRepeatCount
= 1.0f
/ line_stipple_factor
;
651 line
.LineStippleRepeatCount
= line_stipple_factor
;
658 iris_bind_rasterizer_state(struct pipe_context
*ctx
, void *state
)
660 struct iris_context
*ice
= (struct iris_context
*) ctx
;
661 struct iris_rasterizer_state
*old_cso
= ice
->state
.cso_rast
;
662 struct iris_rasterizer_state
*new_cso
= state
;
665 /* Try to avoid re-emitting 3DSTATE_LINE_STIPPLE, it's non-pipelined */
666 if (!old_cso
|| memcmp(old_cso
->line_stipple
, new_cso
->line_stipple
,
667 sizeof(old_cso
->line_stipple
)) != 0) {
668 ice
->state
.dirty
|= IRIS_DIRTY_LINE_STIPPLE
;
672 old_cso
->half_pixel_center
!= new_cso
->half_pixel_center
) {
673 ice
->state
.dirty
|= IRIS_DIRTY_MULTISAMPLE
;
677 ice
->state
.cso_rast
= new_cso
;
678 ice
->state
.dirty
|= IRIS_DIRTY_RASTER
;
682 translate_wrap(unsigned pipe_wrap
)
684 static const unsigned map
[] = {
685 [PIPE_TEX_WRAP_REPEAT
] = TCM_WRAP
,
686 [PIPE_TEX_WRAP_CLAMP
] = TCM_HALF_BORDER
,
687 [PIPE_TEX_WRAP_CLAMP_TO_EDGE
] = TCM_CLAMP
,
688 [PIPE_TEX_WRAP_CLAMP_TO_BORDER
] = TCM_CLAMP_BORDER
,
689 [PIPE_TEX_WRAP_MIRROR_REPEAT
] = TCM_MIRROR
,
690 [PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE
] = TCM_MIRROR_ONCE
,
691 [PIPE_TEX_WRAP_MIRROR_CLAMP
] = -1, // XXX: ???
692 [PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER
] = -1, // XXX: ???
694 return map
[pipe_wrap
];
698 * Return true if the given wrap mode requires the border color to exist.
701 wrap_mode_needs_border_color(unsigned wrap_mode
)
703 return wrap_mode
== TCM_CLAMP_BORDER
|| wrap_mode
== TCM_HALF_BORDER
;
707 translate_mip_filter(enum pipe_tex_mipfilter pipe_mip
)
709 static const unsigned map
[] = {
710 [PIPE_TEX_MIPFILTER_NEAREST
] = MIPFILTER_NEAREST
,
711 [PIPE_TEX_MIPFILTER_LINEAR
] = MIPFILTER_LINEAR
,
712 [PIPE_TEX_MIPFILTER_NONE
] = MIPFILTER_NONE
,
714 return map
[pipe_mip
];
717 struct iris_sampler_state
{
718 struct pipe_sampler_state base
;
720 bool needs_border_color
;
722 uint32_t sampler_state
[GENX(SAMPLER_STATE_length
)];
726 iris_create_sampler_state(struct pipe_context
*pctx
,
727 const struct pipe_sampler_state
*state
)
729 struct iris_sampler_state
*cso
= CALLOC_STRUCT(iris_sampler_state
);
734 STATIC_ASSERT(PIPE_TEX_FILTER_NEAREST
== MAPFILTER_NEAREST
);
735 STATIC_ASSERT(PIPE_TEX_FILTER_LINEAR
== MAPFILTER_LINEAR
);
737 unsigned wrap_s
= translate_wrap(state
->wrap_s
);
738 unsigned wrap_t
= translate_wrap(state
->wrap_t
);
739 unsigned wrap_r
= translate_wrap(state
->wrap_r
);
741 cso
->needs_border_color
= wrap_mode_needs_border_color(wrap_s
) ||
742 wrap_mode_needs_border_color(wrap_t
) ||
743 wrap_mode_needs_border_color(wrap_r
);
745 iris_pack_state(GENX(SAMPLER_STATE
), cso
->sampler_state
, samp
) {
746 samp
.TCXAddressControlMode
= wrap_s
;
747 samp
.TCYAddressControlMode
= wrap_t
;
748 samp
.TCZAddressControlMode
= wrap_r
;
749 samp
.CubeSurfaceControlMode
= state
->seamless_cube_map
;
750 samp
.NonnormalizedCoordinateEnable
= !state
->normalized_coords
;
751 samp
.MinModeFilter
= state
->min_img_filter
;
752 samp
.MagModeFilter
= state
->mag_img_filter
;
753 samp
.MipModeFilter
= translate_mip_filter(state
->min_mip_filter
);
754 samp
.MaximumAnisotropy
= RATIO21
;
756 if (state
->max_anisotropy
>= 2) {
757 if (state
->min_img_filter
== PIPE_TEX_FILTER_LINEAR
) {
758 samp
.MinModeFilter
= MAPFILTER_ANISOTROPIC
;
759 samp
.AnisotropicAlgorithm
= EWAApproximation
;
762 if (state
->mag_img_filter
== PIPE_TEX_FILTER_LINEAR
)
763 samp
.MagModeFilter
= MAPFILTER_ANISOTROPIC
;
765 samp
.MaximumAnisotropy
=
766 MIN2((state
->max_anisotropy
- 2) / 2, RATIO161
);
769 /* Set address rounding bits if not using nearest filtering. */
770 if (state
->min_img_filter
!= PIPE_TEX_FILTER_NEAREST
) {
771 samp
.UAddressMinFilterRoundingEnable
= true;
772 samp
.VAddressMinFilterRoundingEnable
= true;
773 samp
.RAddressMinFilterRoundingEnable
= true;
776 if (state
->mag_img_filter
!= PIPE_TEX_FILTER_NEAREST
) {
777 samp
.UAddressMagFilterRoundingEnable
= true;
778 samp
.VAddressMagFilterRoundingEnable
= true;
779 samp
.RAddressMagFilterRoundingEnable
= true;
782 if (state
->compare_mode
== PIPE_TEX_COMPARE_R_TO_TEXTURE
)
783 samp
.ShadowFunction
= translate_shadow_func(state
->compare_func
);
785 const float hw_max_lod
= GEN_GEN
>= 7 ? 14 : 13;
787 samp
.LODPreClampMode
= CLAMP_MODE_OGL
;
788 samp
.MinLOD
= CLAMP(state
->min_lod
, 0, hw_max_lod
);
789 samp
.MaxLOD
= CLAMP(state
->max_lod
, 0, hw_max_lod
);
790 samp
.TextureLODBias
= CLAMP(state
->lod_bias
, -16, 15);
792 //samp.BorderColorPointer = <<comes from elsewhere>>
799 iris_bind_sampler_states(struct pipe_context
*ctx
,
800 enum pipe_shader_type p_stage
,
801 unsigned start
, unsigned count
,
804 struct iris_context
*ice
= (struct iris_context
*) ctx
;
805 gl_shader_stage stage
= stage_from_pipe(p_stage
);
807 assert(start
+ count
<= IRIS_MAX_TEXTURE_SAMPLERS
);
809 for (int i
= 0; i
< count
; i
++) {
810 ice
->state
.samplers
[stage
][start
+ i
] = states
[i
];
813 ice
->state
.dirty
|= IRIS_DIRTY_SAMPLER_STATES_VS
<< stage
;
816 struct iris_sampler_view
{
817 struct pipe_sampler_view pipe
;
818 struct isl_view view
;
819 uint32_t surface_state
[GENX(RENDER_SURFACE_STATE_length
)];
823 * Convert an swizzle enumeration (i.e. SWIZZLE_X) to one of the Gen7.5+
824 * "Shader Channel Select" enumerations (i.e. HSW_SCS_RED). The mappings are
826 * SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W, SWIZZLE_ZERO, SWIZZLE_ONE
829 * SCS_RED, SCS_GREEN, SCS_BLUE, SCS_ALPHA, SCS_ZERO, SCS_ONE
831 * which is simply adding 4 then modding by 8 (or anding with 7).
833 * We then may need to apply workarounds for textureGather hardware bugs.
835 static enum isl_channel_select
836 pipe_swizzle_to_isl_channel(enum pipe_swizzle swizzle
)
838 return (swizzle
+ 4) & 7;
841 static struct pipe_sampler_view
*
842 iris_create_sampler_view(struct pipe_context
*ctx
,
843 struct pipe_resource
*tex
,
844 const struct pipe_sampler_view
*tmpl
)
846 struct iris_screen
*screen
= (struct iris_screen
*)ctx
->screen
;
847 struct iris_resource
*itex
= (struct iris_resource
*) tex
;
848 struct iris_sampler_view
*isv
= calloc(1, sizeof(struct iris_sampler_view
));
853 /* initialize base object */
855 isv
->pipe
.context
= ctx
;
856 isv
->pipe
.texture
= NULL
;
857 pipe_reference_init(&isv
->pipe
.reference
, 1);
858 pipe_resource_reference(&isv
->pipe
.texture
, tex
);
860 /* XXX: do we need brw_get_texture_swizzle hacks here? */
862 isv
->view
= (struct isl_view
) {
863 .format
= iris_isl_format_for_pipe_format(tmpl
->format
),
864 .base_level
= tmpl
->u
.tex
.first_level
,
865 .levels
= tmpl
->u
.tex
.last_level
- tmpl
->u
.tex
.first_level
+ 1,
866 .base_array_layer
= tmpl
->u
.tex
.first_layer
,
867 .array_len
= tmpl
->u
.tex
.last_layer
- tmpl
->u
.tex
.first_layer
+ 1,
868 .swizzle
= (struct isl_swizzle
) {
869 .r
= pipe_swizzle_to_isl_channel(tmpl
->swizzle_r
),
870 .g
= pipe_swizzle_to_isl_channel(tmpl
->swizzle_g
),
871 .b
= pipe_swizzle_to_isl_channel(tmpl
->swizzle_b
),
872 .a
= pipe_swizzle_to_isl_channel(tmpl
->swizzle_a
),
874 .usage
= ISL_SURF_USAGE_TEXTURE_BIT
,
877 isl_surf_fill_state(&screen
->isl_dev
, isv
->surface_state
,
878 .surf
= &itex
->surf
, .view
= &isv
->view
,
882 // .clear_color = clear_color,
887 struct iris_surface
{
888 struct pipe_surface pipe
;
889 struct isl_view view
;
890 uint32_t surface_state
[GENX(RENDER_SURFACE_STATE_length
)];
893 static struct pipe_surface
*
894 iris_create_surface(struct pipe_context
*ctx
,
895 struct pipe_resource
*tex
,
896 const struct pipe_surface
*tmpl
)
898 struct iris_screen
*screen
= (struct iris_screen
*)ctx
->screen
;
899 struct iris_surface
*surf
= calloc(1, sizeof(struct iris_surface
));
900 struct pipe_surface
*psurf
= &surf
->pipe
;
901 struct iris_resource
*itex
= (struct iris_resource
*) tex
;
906 pipe_reference_init(&psurf
->reference
, 1);
907 pipe_resource_reference(&psurf
->texture
, tex
);
908 psurf
->context
= ctx
;
909 psurf
->format
= tmpl
->format
;
910 psurf
->width
= tex
->width0
;
911 psurf
->height
= tex
->height0
;
912 psurf
->texture
= tex
;
913 psurf
->u
.tex
.first_layer
= tmpl
->u
.tex
.first_layer
;
914 psurf
->u
.tex
.last_layer
= tmpl
->u
.tex
.last_layer
;
915 psurf
->u
.tex
.level
= tmpl
->u
.tex
.level
;
917 surf
->view
= (struct isl_view
) {
918 .format
= iris_isl_format_for_pipe_format(tmpl
->format
),
919 .base_level
= tmpl
->u
.tex
.level
,
921 .base_array_layer
= tmpl
->u
.tex
.first_layer
,
922 .array_len
= tmpl
->u
.tex
.last_layer
- tmpl
->u
.tex
.first_layer
+ 1,
923 .swizzle
= ISL_SWIZZLE_IDENTITY
,
924 // XXX: DEPTH_BIt, STENCIL_BIT...CUBE_BIT? Other bits?!
925 .usage
= ISL_SURF_USAGE_RENDER_TARGET_BIT
,
928 isl_surf_fill_state(&screen
->isl_dev
, surf
->surface_state
,
929 .surf
= &itex
->surf
, .view
= &surf
->view
,
933 // .clear_color = clear_color,
939 iris_set_sampler_views(struct pipe_context
*ctx
,
940 enum pipe_shader_type shader
,
941 unsigned start
, unsigned count
,
942 struct pipe_sampler_view
**views
)
947 iris_set_clip_state(struct pipe_context
*ctx
,
948 const struct pipe_clip_state
*state
)
953 iris_set_polygon_stipple(struct pipe_context
*ctx
,
954 const struct pipe_poly_stipple
*state
)
956 struct iris_context
*ice
= (struct iris_context
*) ctx
;
957 memcpy(&ice
->state
.poly_stipple
, state
, sizeof(*state
));
958 ice
->state
.dirty
|= IRIS_DIRTY_POLYGON_STIPPLE
;
962 iris_set_sample_mask(struct pipe_context
*ctx
, unsigned sample_mask
)
964 struct iris_context
*ice
= (struct iris_context
*) ctx
;
966 ice
->state
.sample_mask
= sample_mask
;
967 ice
->state
.dirty
|= IRIS_DIRTY_SAMPLE_MASK
;
971 iris_set_scissor_states(struct pipe_context
*ctx
,
973 unsigned num_scissors
,
974 const struct pipe_scissor_state
*states
)
976 struct iris_context
*ice
= (struct iris_context
*) ctx
;
978 ice
->state
.num_scissors
= num_scissors
;
980 for (unsigned i
= 0; i
< num_scissors
; i
++) {
981 ice
->state
.scissors
[start_slot
+ i
] = states
[i
];
984 ice
->state
.dirty
|= IRIS_DIRTY_SCISSOR_RECT
;
988 iris_set_stencil_ref(struct pipe_context
*ctx
,
989 const struct pipe_stencil_ref
*state
)
991 struct iris_context
*ice
= (struct iris_context
*) ctx
;
992 memcpy(&ice
->state
.stencil_ref
, state
, sizeof(*state
));
993 ice
->state
.dirty
|= IRIS_DIRTY_WM_DEPTH_STENCIL
;
997 struct iris_viewport_state
{
998 uint32_t sf_cl_vp
[GENX(SF_CLIP_VIEWPORT_length
)];
1002 extent_from_matrix(const struct pipe_viewport_state
*state
, int axis
)
1004 return fabsf(state
->scale
[axis
]) * state
->translate
[axis
];
1009 calculate_guardband_size(uint32_t fb_width
, uint32_t fb_height
,
1010 float m00
, float m11
, float m30
, float m31
,
1011 float *xmin
, float *xmax
,
1012 float *ymin
, float *ymax
)
1014 /* According to the "Vertex X,Y Clamping and Quantization" section of the
1015 * Strips and Fans documentation:
1017 * "The vertex X and Y screen-space coordinates are also /clamped/ to the
1018 * fixed-point "guardband" range supported by the rasterization hardware"
1022 * "In almost all circumstances, if an object’s vertices are actually
1023 * modified by this clamping (i.e., had X or Y coordinates outside of
1024 * the guardband extent the rendered object will not match the intended
1025 * result. Therefore software should take steps to ensure that this does
1026 * not happen - e.g., by clipping objects such that they do not exceed
1027 * these limits after the Drawing Rectangle is applied."
1029 * I believe the fundamental restriction is that the rasterizer (in
1030 * the SF/WM stages) have a limit on the number of pixels that can be
1031 * rasterized. We need to ensure any coordinates beyond the rasterizer
1032 * limit are handled by the clipper. So effectively that limit becomes
1033 * the clipper's guardband size.
1035 * It goes on to say:
1037 * "In addition, in order to be correctly rendered, objects must have a
1038 * screenspace bounding box not exceeding 8K in the X or Y direction.
1039 * This additional restriction must also be comprehended by software,
1040 * i.e., enforced by use of clipping."
1042 * This makes no sense. Gen7+ hardware supports 16K render targets,
1043 * and you definitely need to be able to draw polygons that fill the
1044 * surface. Our assumption is that the rasterizer was limited to 8K
1045 * on Sandybridge, which only supports 8K surfaces, and it was actually
1046 * increased to 16K on Ivybridge and later.
1048 * So, limit the guardband to 16K on Gen7+ and 8K on Sandybridge.
1050 const float gb_size
= GEN_GEN
>= 7 ? 16384.0f
: 8192.0f
;
1052 if (m00
!= 0 && m11
!= 0) {
1053 /* First, we compute the screen-space render area */
1054 const float ss_ra_xmin
= MIN3( 0, m30
+ m00
, m30
- m00
);
1055 const float ss_ra_xmax
= MAX3( fb_width
, m30
+ m00
, m30
- m00
);
1056 const float ss_ra_ymin
= MIN3( 0, m31
+ m11
, m31
- m11
);
1057 const float ss_ra_ymax
= MAX3(fb_height
, m31
+ m11
, m31
- m11
);
1059 /* We want the guardband to be centered on that */
1060 const float ss_gb_xmin
= (ss_ra_xmin
+ ss_ra_xmax
) / 2 - gb_size
;
1061 const float ss_gb_xmax
= (ss_ra_xmin
+ ss_ra_xmax
) / 2 + gb_size
;
1062 const float ss_gb_ymin
= (ss_ra_ymin
+ ss_ra_ymax
) / 2 - gb_size
;
1063 const float ss_gb_ymax
= (ss_ra_ymin
+ ss_ra_ymax
) / 2 + gb_size
;
1065 /* Now we need it in native device coordinates */
1066 const float ndc_gb_xmin
= (ss_gb_xmin
- m30
) / m00
;
1067 const float ndc_gb_xmax
= (ss_gb_xmax
- m30
) / m00
;
1068 const float ndc_gb_ymin
= (ss_gb_ymin
- m31
) / m11
;
1069 const float ndc_gb_ymax
= (ss_gb_ymax
- m31
) / m11
;
1071 /* Thanks to Y-flipping and ORIGIN_UPPER_LEFT, the Y coordinates may be
1072 * flipped upside-down. X should be fine though.
1074 assert(ndc_gb_xmin
<= ndc_gb_xmax
);
1075 *xmin
= ndc_gb_xmin
;
1076 *xmax
= ndc_gb_xmax
;
1077 *ymin
= MIN2(ndc_gb_ymin
, ndc_gb_ymax
);
1078 *ymax
= MAX2(ndc_gb_ymin
, ndc_gb_ymax
);
1080 /* The viewport scales to 0, so nothing will be rendered. */
1090 iris_set_viewport_states(struct pipe_context
*ctx
,
1091 unsigned start_slot
,
1092 unsigned num_viewports
,
1093 const struct pipe_viewport_state
*state
)
1095 struct iris_context
*ice
= (struct iris_context
*) ctx
;
1096 struct iris_viewport_state
*cso
=
1097 malloc(sizeof(struct iris_viewport_state
));
1099 // XXX: sf_cl_vp is only big enough for one slot, we don't iterate right
1100 for (unsigned i
= start_slot
; i
< start_slot
+ num_viewports
; i
++) {
1101 float x_extent
= extent_from_matrix(&state
[i
], 0);
1102 float y_extent
= extent_from_matrix(&state
[i
], 1);
1104 iris_pack_state(GENX(SF_CLIP_VIEWPORT
), cso
->sf_cl_vp
, vp
) {
1105 vp
.ViewportMatrixElementm00
= state
[i
].scale
[0];
1106 vp
.ViewportMatrixElementm11
= state
[i
].scale
[1];
1107 vp
.ViewportMatrixElementm22
= state
[i
].scale
[2];
1108 vp
.ViewportMatrixElementm30
= state
[i
].translate
[0];
1109 vp
.ViewportMatrixElementm31
= state
[i
].translate
[1];
1110 vp
.ViewportMatrixElementm32
= state
[i
].translate
[2];
1111 /* XXX: in i965 this is computed based on the drawbuffer size,
1112 * but we don't have that here...
1114 vp
.XMinClipGuardband
= -1.0;
1115 vp
.XMaxClipGuardband
= 1.0;
1116 vp
.YMinClipGuardband
= -1.0;
1117 vp
.YMaxClipGuardband
= 1.0;
1118 vp
.XMinViewPort
= -x_extent
;
1119 vp
.XMaxViewPort
= x_extent
;
1120 vp
.YMinViewPort
= -y_extent
;
1121 vp
.YMaxViewPort
= y_extent
;
1125 ice
->state
.cso_vp
= cso
;
1127 ice
->state
.num_viewports
= num_viewports
;
1128 ice
->state
.dirty
|= IRIS_DIRTY_SF_CL_VIEWPORT
;
1131 struct iris_depth_state
1133 uint32_t depth_buffer
[GENX(3DSTATE_DEPTH_BUFFER_length
)];
1134 uint32_t hier_depth_buffer
[GENX(3DSTATE_HIER_DEPTH_BUFFER_length
)];
1135 uint32_t stencil_buffer
[GENX(3DSTATE_STENCIL_BUFFER_length
)];
1139 iris_set_framebuffer_state(struct pipe_context
*ctx
,
1140 const struct pipe_framebuffer_state
*state
)
1142 struct iris_context
*ice
= (struct iris_context
*) ctx
;
1143 struct pipe_framebuffer_state
*cso
= &ice
->state
.framebuffer
;
1145 if (cso
->samples
!= state
->samples
) {
1146 ice
->state
.dirty
|= IRIS_DIRTY_MULTISAMPLE
;
1149 cso
->width
= state
->width
;
1150 cso
->height
= state
->height
;
1151 cso
->layers
= state
->layers
;
1152 cso
->samples
= state
->samples
;
1155 for (i
= 0; i
< state
->nr_cbufs
; i
++)
1156 pipe_surface_reference(&cso
->cbufs
[i
], state
->cbufs
[i
]);
1157 for (; i
< cso
->nr_cbufs
; i
++)
1158 pipe_surface_reference(&cso
->cbufs
[i
], NULL
);
1160 cso
->nr_cbufs
= state
->nr_cbufs
;
1162 pipe_surface_reference(&cso
->zsbuf
, state
->zsbuf
);
1164 struct isl_depth_stencil_hiz_emit_info info
= {
1168 // XXX: depth buffers
1172 iris_set_constant_buffer(struct pipe_context
*ctx
,
1173 enum pipe_shader_type shader
, uint index
,
1174 const struct pipe_constant_buffer
*cb
)
1180 iris_sampler_view_destroy(struct pipe_context
*ctx
,
1181 struct pipe_sampler_view
*state
)
1183 pipe_resource_reference(&state
->texture
, NULL
);
1189 iris_surface_destroy(struct pipe_context
*ctx
, struct pipe_surface
*surface
)
1191 pipe_resource_reference(&surface
->texture
, NULL
);
1196 iris_delete_state(struct pipe_context
*ctx
, void *state
)
1201 struct iris_vertex_buffer_state
{
1202 uint32_t vertex_buffers
[1 + 33 * GENX(VERTEX_BUFFER_STATE_length
)];
1203 struct iris_address bos
[33];
1204 unsigned num_buffers
;
1208 iris_free_vertex_buffers(struct iris_vertex_buffer_state
*cso
)
1211 for (unsigned i
= 0; i
< cso
->num_buffers
; i
++)
1212 iris_bo_unreference(cso
->bos
[i
].bo
);
1218 iris_set_vertex_buffers(struct pipe_context
*ctx
,
1219 unsigned start_slot
, unsigned count
,
1220 const struct pipe_vertex_buffer
*buffers
)
1222 struct iris_context
*ice
= (struct iris_context
*) ctx
;
1223 struct iris_vertex_buffer_state
*cso
=
1224 malloc(sizeof(struct iris_vertex_buffer_state
));
1226 /* If there are no buffers, do nothing. We can leave the stale
1227 * 3DSTATE_VERTEX_BUFFERS in place - as long as there are no vertex
1228 * elements that point to them, it should be fine.
1233 iris_free_vertex_buffers(ice
->state
.cso_vertex_buffers
);
1235 cso
->num_buffers
= count
;
1237 iris_pack_command(GENX(3DSTATE_VERTEX_BUFFERS
), cso
->vertex_buffers
, vb
) {
1238 vb
.DWordLength
= 4 * cso
->num_buffers
- 1;
1241 uint32_t *vb_pack_dest
= &cso
->vertex_buffers
[1];
1243 for (unsigned i
= 0; i
< count
; i
++) {
1244 assert(!buffers
[i
].is_user_buffer
);
1246 struct iris_resource
*res
= (void *) buffers
[i
].buffer
.resource
;
1247 iris_bo_reference(res
->bo
);
1248 cso
->bos
[i
] = ro_bo(res
->bo
, buffers
[i
].buffer_offset
);
1250 iris_pack_state(GENX(VERTEX_BUFFER_STATE
), vb_pack_dest
, vb
) {
1251 vb
.VertexBufferIndex
= start_slot
+ i
;
1253 vb
.AddressModifyEnable
= true;
1254 vb
.BufferPitch
= buffers
[i
].stride
;
1255 vb
.BufferSize
= res
->bo
->size
;
1256 /* vb.BufferStartingAddress is filled in at draw time */
1259 vb_pack_dest
+= GENX(VERTEX_BUFFER_STATE_length
);
1262 ice
->state
.cso_vertex_buffers
= cso
;
1263 ice
->state
.dirty
|= IRIS_DIRTY_VERTEX_BUFFERS
;
1266 struct iris_vertex_element_state
{
1267 uint32_t vertex_elements
[1 + 33 * GENX(VERTEX_ELEMENT_STATE_length
)];
1268 uint32_t vf_instancing
[GENX(3DSTATE_VF_INSTANCING_length
)][33];
1273 iris_create_vertex_elements(struct pipe_context
*ctx
,
1275 const struct pipe_vertex_element
*state
)
1277 struct iris_vertex_element_state
*cso
=
1278 malloc(sizeof(struct iris_vertex_element_state
));
1283 * - create edge flag one
1285 * - if those are necessary, use count + 1/2/3... OR in the length
1287 iris_pack_command(GENX(3DSTATE_VERTEX_ELEMENTS
), cso
->vertex_elements
, ve
);
1289 uint32_t *ve_pack_dest
= &cso
->vertex_elements
[1];
1291 for (int i
= 0; i
< count
; i
++) {
1292 iris_pack_state(GENX(VERTEX_ELEMENT_STATE
), ve_pack_dest
, ve
) {
1293 ve
.VertexBufferIndex
= state
[i
].vertex_buffer_index
;
1295 ve
.SourceElementOffset
= state
[i
].src_offset
;
1296 ve
.SourceElementFormat
=
1297 iris_isl_format_for_pipe_format(state
[i
].src_format
);
1300 iris_pack_command(GENX(3DSTATE_VF_INSTANCING
), cso
->vf_instancing
[i
], vi
) {
1301 vi
.VertexElementIndex
= i
;
1302 vi
.InstancingEnable
= state
[i
].instance_divisor
> 0;
1303 vi
.InstanceDataStepRate
= state
[i
].instance_divisor
;
1306 ve_pack_dest
+= GENX(VERTEX_ELEMENT_STATE_length
);
1313 iris_bind_vertex_elements_state(struct pipe_context
*ctx
, void *state
)
1315 struct iris_context
*ice
= (struct iris_context
*) ctx
;
1317 ice
->state
.cso_vertex_elements
= state
;
1318 ice
->state
.dirty
|= IRIS_DIRTY_VERTEX_ELEMENTS
;
1322 iris_create_compute_state(struct pipe_context
*ctx
,
1323 const struct pipe_compute_state
*state
)
1328 static struct pipe_stream_output_target
*
1329 iris_create_stream_output_target(struct pipe_context
*ctx
,
1330 struct pipe_resource
*res
,
1331 unsigned buffer_offset
,
1332 unsigned buffer_size
)
1334 struct pipe_stream_output_target
*t
=
1335 CALLOC_STRUCT(pipe_stream_output_target
);
1339 pipe_reference_init(&t
->reference
, 1);
1340 pipe_resource_reference(&t
->buffer
, res
);
1341 t
->buffer_offset
= buffer_offset
;
1342 t
->buffer_size
= buffer_size
;
1347 iris_stream_output_target_destroy(struct pipe_context
*ctx
,
1348 struct pipe_stream_output_target
*t
)
1350 pipe_resource_reference(&t
->buffer
, NULL
);
1355 iris_set_stream_output_targets(struct pipe_context
*ctx
,
1356 unsigned num_targets
,
1357 struct pipe_stream_output_target
**targets
,
1358 const unsigned *offsets
)
1363 iris_bind_compute_state(struct pipe_context
*ctx
, void *state
)
1368 iris_populate_vs_key(const struct iris_context
*ice
,
1369 struct brw_vs_prog_key
*key
)
1371 memset(key
, 0, sizeof(*key
));
1375 iris_populate_tcs_key(const struct iris_context
*ice
,
1376 struct brw_tcs_prog_key
*key
)
1378 memset(key
, 0, sizeof(*key
));
1382 iris_populate_tes_key(const struct iris_context
*ice
,
1383 struct brw_tes_prog_key
*key
)
1385 memset(key
, 0, sizeof(*key
));
1389 iris_populate_gs_key(const struct iris_context
*ice
,
1390 struct brw_gs_prog_key
*key
)
1392 memset(key
, 0, sizeof(*key
));
1396 iris_populate_fs_key(const struct iris_context
*ice
,
1397 struct brw_wm_prog_key
*key
)
1399 memset(key
, 0, sizeof(*key
));
1401 /* XXX: dirty flags? */
1402 struct pipe_framebuffer_state
*fb
= &ice
->state
.framebuffer
;
1403 //struct iris_depth_stencil_alpha_state *zsa = ice->state.framebuffer;
1404 // XXX: can't access iris structs outside iris_state.c :(
1405 // XXX: maybe just move these to iris_state.c, honestly...they're more
1406 // about state than programs...
1408 key
->nr_color_regions
= fb
->nr_cbufs
;
1410 // key->force_dual_color_blend for unigine
1412 //key->replicate_alpha = fb->nr_cbufs > 1 && alpha test or alpha to coverage
1413 if (cso_rast
->multisample
) {
1414 key
->persample_interp
=
1415 ctx
->Multisample
.SampleShading
&&
1416 (ctx
->Multisample
.MinSampleShadingValue
*
1417 _mesa_geometric_samples(ctx
->DrawBuffer
) > 1);
1419 key
->multisample_fbo
= fb
->samples
> 1;
1423 key
->coherent_fb_fetch
= true;
1426 //pkt.SamplerCount = \
1427 //DIV_ROUND_UP(CLAMP(stage_state->sampler_count, 0, 16), 4); \
1428 //pkt.PerThreadScratchSpace = prog_data->total_scratch == 0 ? 0 : \
1429 //ffs(stage_state->per_thread_scratch) - 11; \
1431 #define INIT_THREAD_DISPATCH_FIELDS(pkt, prefix) \
1432 pkt.KernelStartPointer = shader->prog_offset; \
1433 pkt.BindingTableEntryCount = prog_data->binding_table.size_bytes / 4; \
1434 pkt.FloatingPointMode = prog_data->use_alt_mode; \
1436 pkt.DispatchGRFStartRegisterForURBData = \
1437 prog_data->dispatch_grf_start_reg; \
1438 pkt.prefix##URBEntryReadLength = vue_prog_data->urb_read_length; \
1439 pkt.prefix##URBEntryReadOffset = 0; \
1441 pkt.StatisticsEnable = true; \
1445 iris_set_vs_state(const struct gen_device_info
*devinfo
,
1446 struct iris_compiled_shader
*shader
)
1448 struct brw_stage_prog_data
*prog_data
= shader
->prog_data
;
1449 struct brw_vue_prog_data
*vue_prog_data
= (void *) prog_data
;
1451 iris_pack_command(GENX(3DSTATE_VS
), shader
->derived_data
, vs
) {
1452 INIT_THREAD_DISPATCH_FIELDS(vs
, Vertex
);
1453 vs
.MaximumNumberofThreads
= devinfo
->max_vs_threads
- 1;
1454 vs
.SIMD8DispatchEnable
= true;
1455 vs
.UserClipDistanceCullTestEnableBitmask
=
1456 vue_prog_data
->cull_distance_mask
;
1461 iris_set_tcs_state(const struct gen_device_info
*devinfo
,
1462 struct iris_compiled_shader
*shader
)
1464 struct brw_stage_prog_data
*prog_data
= shader
->prog_data
;
1465 struct brw_vue_prog_data
*vue_prog_data
= (void *) prog_data
;
1466 struct brw_tcs_prog_data
*tcs_prog_data
= (void *) prog_data
;
1468 iris_pack_command(GENX(3DSTATE_HS
), shader
->derived_data
, hs
) {
1469 INIT_THREAD_DISPATCH_FIELDS(hs
, Vertex
);
1471 hs
.InstanceCount
= tcs_prog_data
->instances
- 1;
1472 hs
.MaximumNumberofThreads
= devinfo
->max_tcs_threads
- 1;
1473 hs
.IncludeVertexHandles
= true;
1478 iris_set_tes_state(const struct gen_device_info
*devinfo
,
1479 struct iris_compiled_shader
*shader
)
1481 struct brw_stage_prog_data
*prog_data
= shader
->prog_data
;
1482 struct brw_vue_prog_data
*vue_prog_data
= (void *) prog_data
;
1483 struct brw_tes_prog_data
*tes_prog_data
= (void *) prog_data
;
1485 uint32_t *te_state
= (void *) shader
->derived_data
;
1486 uint32_t *ds_state
= te_state
+ GENX(3DSTATE_TE_length
);
1488 iris_pack_command(GENX(3DSTATE_TE
), te_state
, te
) {
1489 te
.Partitioning
= tes_prog_data
->partitioning
;
1490 te
.OutputTopology
= tes_prog_data
->output_topology
;
1491 te
.TEDomain
= tes_prog_data
->domain
;
1493 te
.MaximumTessellationFactorOdd
= 63.0;
1494 te
.MaximumTessellationFactorNotOdd
= 64.0;
1497 iris_pack_command(GENX(3DSTATE_DS
), ds_state
, ds
) {
1498 INIT_THREAD_DISPATCH_FIELDS(ds
, Patch
);
1500 ds
.DispatchMode
= DISPATCH_MODE_SIMD8_SINGLE_PATCH
;
1501 ds
.MaximumNumberofThreads
= devinfo
->max_tes_threads
- 1;
1502 ds
.ComputeWCoordinateEnable
=
1503 tes_prog_data
->domain
== BRW_TESS_DOMAIN_TRI
;
1505 ds
.UserClipDistanceCullTestEnableBitmask
=
1506 vue_prog_data
->cull_distance_mask
;
1512 iris_set_gs_state(const struct gen_device_info
*devinfo
,
1513 struct iris_compiled_shader
*shader
)
1515 struct brw_stage_prog_data
*prog_data
= shader
->prog_data
;
1516 struct brw_vue_prog_data
*vue_prog_data
= (void *) prog_data
;
1517 struct brw_gs_prog_data
*gs_prog_data
= (void *) prog_data
;
1519 iris_pack_command(GENX(3DSTATE_GS
), shader
->derived_data
, gs
) {
1520 INIT_THREAD_DISPATCH_FIELDS(gs
, Vertex
);
1522 gs
.OutputVertexSize
= gs_prog_data
->output_vertex_size_hwords
* 2 - 1;
1523 gs
.OutputTopology
= gs_prog_data
->output_topology
;
1524 gs
.ControlDataHeaderSize
=
1525 gs_prog_data
->control_data_header_size_hwords
;
1526 gs
.InstanceControl
= gs_prog_data
->invocations
- 1;
1527 gs
.DispatchMode
= SIMD8
;
1528 gs
.IncludePrimitiveID
= gs_prog_data
->include_primitive_id
;
1529 gs
.ControlDataFormat
= gs_prog_data
->control_data_format
;
1530 gs
.ReorderMode
= TRAILING
;
1531 gs
.ExpectedVertexCount
= gs_prog_data
->vertices_in
;
1532 gs
.MaximumNumberofThreads
=
1533 GEN_GEN
== 8 ? (devinfo
->max_gs_threads
/ 2 - 1)
1534 : (devinfo
->max_gs_threads
- 1);
1536 if (gs_prog_data
->static_vertex_count
!= -1) {
1537 gs
.StaticOutput
= true;
1538 gs
.StaticOutputVertexCount
= gs_prog_data
->static_vertex_count
;
1540 gs
.IncludeVertexHandles
= vue_prog_data
->include_vue_handles
;
1542 gs
.UserClipDistanceCullTestEnableBitmask
=
1543 vue_prog_data
->cull_distance_mask
;
1545 const int urb_entry_write_offset
= 1;
1546 const uint32_t urb_entry_output_length
=
1547 DIV_ROUND_UP(vue_prog_data
->vue_map
.num_slots
, 2) -
1548 urb_entry_write_offset
;
1550 gs
.VertexURBEntryOutputReadOffset
= urb_entry_write_offset
;
1551 gs
.VertexURBEntryOutputLength
= MAX2(urb_entry_output_length
, 1);
1556 iris_set_fs_state(const struct gen_device_info
*devinfo
,
1557 struct iris_compiled_shader
*shader
)
1559 struct brw_stage_prog_data
*prog_data
= shader
->prog_data
;
1560 struct brw_wm_prog_data
*wm_prog_data
= (void *) shader
->prog_data
;
1562 uint32_t *ps_state
= (void *) shader
->derived_data
;
1563 uint32_t *psx_state
= ps_state
+ GENX(3DSTATE_PS_length
);
1565 iris_pack_command(GENX(3DSTATE_PS
), ps_state
, ps
) {
1566 ps
.VectorMaskEnable
= true;
1567 //ps.SamplerCount = ...
1568 ps
.BindingTableEntryCount
= prog_data
->binding_table
.size_bytes
/ 4;
1569 ps
.FloatingPointMode
= prog_data
->use_alt_mode
;
1570 ps
.MaximumNumberofThreadsPerPSD
= 64 - (GEN_GEN
== 8 ? 2 : 1);
1572 ps
.PushConstantEnable
= prog_data
->nr_params
> 0 ||
1573 prog_data
->ubo_ranges
[0].length
> 0;
1575 /* From the documentation for this packet:
1576 * "If the PS kernel does not need the Position XY Offsets to
1577 * compute a Position Value, then this field should be programmed
1578 * to POSOFFSET_NONE."
1580 * "SW Recommendation: If the PS kernel needs the Position Offsets
1581 * to compute a Position XY value, this field should match Position
1582 * ZW Interpolation Mode to ensure a consistent position.xyzw
1585 * We only require XY sample offsets. So, this recommendation doesn't
1586 * look useful at the moment. We might need this in future.
1588 ps
.PositionXYOffsetSelect
=
1589 wm_prog_data
->uses_pos_offset
? POSOFFSET_SAMPLE
: POSOFFSET_NONE
;
1590 ps
._8PixelDispatchEnable
= wm_prog_data
->dispatch_8
;
1591 ps
._16PixelDispatchEnable
= wm_prog_data
->dispatch_16
;
1592 ps
._32PixelDispatchEnable
= wm_prog_data
->dispatch_32
;
1594 // XXX: Disable SIMD32 with 16x MSAA
1596 ps
.DispatchGRFStartRegisterForConstantSetupData0
=
1597 brw_wm_prog_data_dispatch_grf_start_reg(wm_prog_data
, ps
, 0);
1598 ps
.DispatchGRFStartRegisterForConstantSetupData1
=
1599 brw_wm_prog_data_dispatch_grf_start_reg(wm_prog_data
, ps
, 1);
1600 ps
.DispatchGRFStartRegisterForConstantSetupData2
=
1601 brw_wm_prog_data_dispatch_grf_start_reg(wm_prog_data
, ps
, 2);
1603 ps
.KernelStartPointer0
=
1604 shader
->prog_offset
+ brw_wm_prog_data_prog_offset(wm_prog_data
, ps
, 0);
1605 ps
.KernelStartPointer1
=
1606 shader
->prog_offset
+ brw_wm_prog_data_prog_offset(wm_prog_data
, ps
, 1);
1607 ps
.KernelStartPointer2
=
1608 shader
->prog_offset
+ brw_wm_prog_data_prog_offset(wm_prog_data
, ps
, 2);
1611 iris_pack_command(GENX(3DSTATE_PS_EXTRA
), psx_state
, psx
) {
1612 psx
.PixelShaderValid
= true;
1613 psx
.PixelShaderComputedDepthMode
= wm_prog_data
->computed_depth_mode
;
1614 psx
.PixelShaderKillsPixel
= wm_prog_data
->uses_kill
;
1615 psx
.AttributeEnable
= wm_prog_data
->num_varying_inputs
!= 0;
1616 psx
.PixelShaderUsesSourceDepth
= wm_prog_data
->uses_src_depth
;
1617 psx
.PixelShaderUsesSourceW
= wm_prog_data
->uses_src_w
;
1618 psx
.PixelShaderIsPerSample
= wm_prog_data
->persample_dispatch
;
1620 if (wm_prog_data
->uses_sample_mask
) {
1621 /* TODO: conservative rasterization */
1622 if (wm_prog_data
->post_depth_coverage
)
1623 psx
.InputCoverageMaskState
= ICMS_DEPTH_COVERAGE
;
1625 psx
.InputCoverageMaskState
= ICMS_NORMAL
;
1628 psx
.oMaskPresenttoRenderTarget
= wm_prog_data
->uses_omask
;
1629 psx
.PixelShaderPullsBary
= wm_prog_data
->pulls_bary
;
1630 psx
.PixelShaderComputesStencil
= wm_prog_data
->computed_stencil
;
1637 iris_derived_program_state_size(enum iris_program_cache_id cache_id
)
1639 assert(cache_id
<= IRIS_CACHE_CS
);
1641 static const unsigned dwords
[] = {
1642 [IRIS_CACHE_VS
] = GENX(3DSTATE_VS_length
),
1643 [IRIS_CACHE_TCS
] = GENX(3DSTATE_HS_length
),
1644 [IRIS_CACHE_TES
] = GENX(3DSTATE_TE_length
) + GENX(3DSTATE_DS_length
),
1645 [IRIS_CACHE_GS
] = GENX(3DSTATE_GS_length
),
1647 GENX(3DSTATE_PS_length
) + GENX(3DSTATE_PS_EXTRA_length
),
1648 [IRIS_CACHE_CS
] = 0,
1649 [IRIS_CACHE_BLORP_BLIT
] = 0,
1652 return sizeof(uint32_t) * dwords
[cache_id
];
1656 iris_set_derived_program_state(const struct gen_device_info
*devinfo
,
1657 enum iris_program_cache_id cache_id
,
1658 struct iris_compiled_shader
*shader
)
1662 iris_set_vs_state(devinfo
, shader
);
1664 case IRIS_CACHE_TCS
:
1665 iris_set_tcs_state(devinfo
, shader
);
1667 case IRIS_CACHE_TES
:
1668 iris_set_tes_state(devinfo
, shader
);
1671 iris_set_gs_state(devinfo
, shader
);
1674 iris_set_fs_state(devinfo
, shader
);
1684 iris_upload_render_state(struct iris_context
*ice
,
1685 struct iris_batch
*batch
,
1686 const struct pipe_draw_info
*draw
)
1688 const uint64_t dirty
= ice
->state
.dirty
;
1690 struct brw_wm_prog_data
*wm_prog_data
= (void *)
1691 ice
->shaders
.prog
[MESA_SHADER_FRAGMENT
]->prog_data
;
1693 if (dirty
& IRIS_DIRTY_CC_VIEWPORT
) {
1694 struct iris_depth_stencil_alpha_state
*cso
= ice
->state
.cso_zsa
;
1695 iris_emit_cmd(batch
, GENX(3DSTATE_VIEWPORT_STATE_POINTERS_CC
), ptr
) {
1696 ptr
.CCViewportPointer
=
1697 iris_emit_state(batch
, cso
->cc_vp
, sizeof(cso
->cc_vp
), 32);
1701 if (dirty
& IRIS_DIRTY_SF_CL_VIEWPORT
) {
1702 struct iris_viewport_state
*cso
= ice
->state
.cso_vp
;
1703 iris_emit_cmd(batch
, GENX(3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP
), ptr
) {
1704 ptr
.SFClipViewportPointer
=
1705 iris_emit_state(batch
, cso
->sf_cl_vp
, sizeof(cso
->sf_cl_vp
), 64);
1711 if (dirty
& IRIS_DIRTY_URB
) {
1715 if (dirty
& IRIS_DIRTY_BLEND_STATE
) {
1716 struct iris_blend_state
*cso
= ice
->state
.cso_blend
;
1717 // XXX: 3DSTATE_BLEND_STATE_POINTERS - BLEND_STATE
1718 // -> from iris_blend_state (most) + iris_depth_stencil_alpha_state
1719 // (alpha test function/enable) + has writeable RT from ???????
1722 if (dirty
& IRIS_DIRTY_COLOR_CALC_STATE
) {
1723 struct iris_depth_stencil_alpha_state
*cso
= ice
->state
.cso_zsa
;
1726 iris_alloc_state(batch
,
1727 sizeof(uint32_t) * GENX(COLOR_CALC_STATE_length
),
1729 iris_pack_state(GENX(COLOR_CALC_STATE
), cc_map
, cc
) {
1730 cc
.AlphaTestFormat
= ALPHATEST_FLOAT32
;
1731 cc
.AlphaReferenceValueAsFLOAT32
= cso
->alpha
.ref_value
;
1732 cc
.BlendConstantColorRed
= ice
->state
.blend_color
.color
[0];
1733 cc
.BlendConstantColorGreen
= ice
->state
.blend_color
.color
[1];
1734 cc
.BlendConstantColorBlue
= ice
->state
.blend_color
.color
[2];
1735 cc
.BlendConstantColorAlpha
= ice
->state
.blend_color
.color
[3];
1737 iris_emit_cmd(batch
, GENX(3DSTATE_CC_STATE_POINTERS
), ptr
) {
1738 ptr
.ColorCalcStatePointer
= cc_offset
;
1739 ptr
.ColorCalcStatePointerValid
= true;
1743 // XXX: 3DSTATE_CONSTANT_XS
1744 // XXX: 3DSTATE_BINDING_TABLE_POINTERS_XS
1746 for (int stage
= 0; stage
<= MESA_SHADER_FRAGMENT
; stage
++) {
1747 if (!(dirty
& (IRIS_DIRTY_SAMPLER_STATES_VS
<< stage
)))
1750 // XXX: get sampler count from shader; don't emit them all...
1751 const int count
= IRIS_MAX_TEXTURE_SAMPLERS
;
1754 uint32_t *map
= iris_alloc_state(batch
,
1755 count
* 4 * GENX(SAMPLER_STATE_length
),
1758 for (int i
= 0; i
< count
; i
++) {
1759 // XXX: when we have a correct count, these better be bound
1760 if (!ice
->state
.samplers
[stage
][i
])
1762 memcpy(map
, ice
->state
.samplers
[stage
][i
]->sampler_state
,
1763 4 * GENX(SAMPLER_STATE_length
));
1764 map
+= GENX(SAMPLER_STATE_length
);
1767 iris_emit_cmd(batch
, GENX(3DSTATE_SAMPLER_STATE_POINTERS_VS
), ptr
) {
1768 ptr
._3DCommandSubOpcode
= 43 + stage
;
1769 ptr
.PointertoVSSamplerState
= offset
;
1773 if (dirty
& IRIS_DIRTY_MULTISAMPLE
) {
1774 iris_emit_cmd(batch
, GENX(3DSTATE_MULTISAMPLE
), ms
) {
1776 ice
->state
.cso_rast
->half_pixel_center
? CENTER
: UL_CORNER
;
1777 if (ice
->state
.framebuffer
.samples
> 0)
1778 ms
.NumberofMultisamples
= ffs(ice
->state
.framebuffer
.samples
) - 1;
1782 if (dirty
& IRIS_DIRTY_SAMPLE_MASK
) {
1783 iris_emit_cmd(batch
, GENX(3DSTATE_SAMPLE_MASK
), ms
) {
1784 ms
.SampleMask
= ice
->state
.sample_mask
;
1788 for (int stage
= 0; stage
<= MESA_SHADER_FRAGMENT
; stage
++) {
1789 if (!(dirty
& (IRIS_DIRTY_VS
<< stage
)))
1792 if (ice
->shaders
.prog
[stage
]) {
1793 iris_batch_emit(batch
, ice
->shaders
.prog
[stage
]->derived_data
,
1794 iris_derived_program_state_size(stage
));
1796 if (stage
== MESA_SHADER_TESS_EVAL
) {
1797 iris_emit_cmd(batch
, GENX(3DSTATE_HS
), hs
);
1798 iris_emit_cmd(batch
, GENX(3DSTATE_TE
), te
);
1799 iris_emit_cmd(batch
, GENX(3DSTATE_DS
), ds
);
1800 } else if (stage
== MESA_SHADER_GEOMETRY
) {
1801 iris_emit_cmd(batch
, GENX(3DSTATE_GS
), gs
);
1806 // XXX: SOL and so on
1808 if (dirty
& IRIS_DIRTY_CLIP
) {
1809 struct iris_rasterizer_state
*cso_rast
= ice
->state
.cso_rast
;
1810 struct pipe_framebuffer_state
*cso_fb
= &ice
->state
.framebuffer
;
1812 uint32_t dynamic_clip
[GENX(3DSTATE_CLIP_length
)];
1813 iris_pack_command(GENX(3DSTATE_CLIP
), &dynamic_clip
, cl
) {
1814 if (wm_prog_data
->barycentric_interp_modes
&
1815 BRW_BARYCENTRIC_NONPERSPECTIVE_BITS
)
1816 cl
.NonPerspectiveBarycentricEnable
= true;
1818 cl
.ForceZeroRTAIndexEnable
= cso_fb
->layers
== 0;
1820 iris_emit_merge(batch
, cso_rast
->clip
, dynamic_clip
,
1821 ARRAY_SIZE(cso_rast
->clip
));
1824 if (dirty
& IRIS_DIRTY_RASTER
) {
1825 struct iris_rasterizer_state
*cso
= ice
->state
.cso_rast
;
1826 iris_batch_emit(batch
, cso
->raster
, sizeof(cso
->raster
));
1827 iris_batch_emit(batch
, cso
->sf
, sizeof(cso
->sf
));
1831 if (dirty
& (IRIS_DIRTY_RASTER
| IRIS_DIRTY_FS
)) {
1832 struct iris_rasterizer_state
*cso
= ice
->state
.cso_rast
;
1833 uint32_t dynamic_wm
[GENX(3DSTATE_WM_length
)];
1835 iris_pack_command(GENX(3DSTATE_WM
), &dynamic_wm
, wm
) {
1836 wm
.BarycentricInterpolationMode
=
1837 wm_prog_data
->barycentric_interp_modes
;
1839 if (wm_prog_data
->early_fragment_tests
)
1840 wm
.EarlyDepthStencilControl
= EDSC_PREPS
;
1841 else if (wm_prog_data
->has_side_effects
)
1842 wm
.EarlyDepthStencilControl
= EDSC_PSEXEC
;
1844 iris_emit_merge(batch
, cso
->wm
, dynamic_wm
, ARRAY_SIZE(cso
->wm
));
1847 // XXX: SBE, SBE_SWIZ
1849 if (dirty
& IRIS_DIRTY_PS_BLEND
) {
1850 struct iris_blend_state
*cso
= ice
->state
.cso_blend
;
1851 iris_batch_emit(batch
, cso
->ps_blend
, sizeof(cso
->ps_blend
));
1854 if (dirty
& IRIS_DIRTY_WM_DEPTH_STENCIL
) {
1855 struct iris_depth_stencil_alpha_state
*cso
= ice
->state
.cso_zsa
;
1856 struct pipe_stencil_ref
*p_stencil_refs
= &ice
->state
.stencil_ref
;
1858 uint32_t stencil_refs
[GENX(3DSTATE_WM_DEPTH_STENCIL_length
)];
1859 iris_pack_command(GENX(3DSTATE_WM_DEPTH_STENCIL
), &stencil_refs
, wmds
) {
1860 wmds
.StencilReferenceValue
= p_stencil_refs
->ref_value
[0];
1861 wmds
.BackfaceStencilReferenceValue
= p_stencil_refs
->ref_value
[1];
1863 iris_emit_merge(batch
, cso
->wmds
, stencil_refs
, ARRAY_SIZE(cso
->wmds
));
1866 if (dirty
& IRIS_DIRTY_SCISSOR
) {
1867 uint32_t scissor_offset
=
1868 iris_emit_state(batch
, ice
->state
.scissors
,
1869 sizeof(struct pipe_scissor_state
) *
1870 ice
->state
.num_scissors
, 32);
1872 iris_emit_cmd(batch
, GENX(3DSTATE_SCISSOR_STATE_POINTERS
), ptr
) {
1873 ptr
.ScissorRectPointer
= scissor_offset
;
1877 // XXX: 3DSTATE_DEPTH_BUFFER and friends
1879 if (dirty
& IRIS_DIRTY_POLYGON_STIPPLE
) {
1880 iris_emit_cmd(batch
, GENX(3DSTATE_POLY_STIPPLE_PATTERN
), poly
) {
1881 for (int i
= 0; i
< 32; i
++) {
1882 poly
.PatternRow
[i
] = ice
->state
.poly_stipple
.stipple
[i
];
1887 if (dirty
& IRIS_DIRTY_LINE_STIPPLE
) {
1888 struct iris_rasterizer_state
*cso
= ice
->state
.cso_rast
;
1889 iris_batch_emit(batch
, cso
->line_stipple
, sizeof(cso
->line_stipple
));
1893 iris_emit_cmd(batch
, GENX(3DSTATE_VF_TOPOLOGY
), topo
) {
1894 topo
.PrimitiveTopologyType
=
1895 translate_prim_type(draw
->mode
, draw
->vertices_per_patch
);
1899 if (draw
->index_size
> 0) {
1900 struct iris_resource
*res
= (struct iris_resource
*)draw
->index
.resource
;
1902 assert(!draw
->has_user_indices
);
1904 iris_emit_cmd(batch
, GENX(3DSTATE_INDEX_BUFFER
), ib
) {
1905 ib
.IndexFormat
= draw
->index_size
;
1907 ib
.BufferSize
= res
->bo
->size
;
1908 ib
.BufferStartingAddress
= ro_bo(res
->bo
, 0);
1912 if (dirty
& IRIS_DIRTY_VERTEX_BUFFERS
) {
1913 struct iris_vertex_buffer_state
*cso
= ice
->state
.cso_vertex_buffers
;
1915 STATIC_ASSERT(GENX(VERTEX_BUFFER_STATE_length
) == 4);
1916 STATIC_ASSERT((GENX(VERTEX_BUFFER_STATE_BufferStartingAddress_bits
) % 32) == 0);
1918 uint64_t *addr
= batch
->cmdbuf
.map_next
+ sizeof(uint32_t) *
1919 (GENX(VERTEX_BUFFER_STATE_BufferStartingAddress_bits
) / 32);
1920 uint32_t *delta
= cso
->vertex_buffers
+
1921 (1 + GENX(VERTEX_BUFFER_STATE_BufferStartingAddress_bits
) / 32);
1923 iris_batch_emit(batch
, cso
->vertex_buffers
,
1924 sizeof(uint32_t) * (1 + 4 * cso
->num_buffers
));
1926 for (unsigned i
= 0; i
< cso
->num_buffers
; i
++) {
1927 *addr
= iris_batch_reloc(batch
, (void *) addr
- batch
->cmdbuf
.map
,
1928 cso
->bos
[i
].bo
, cso
->bos
[i
].offset
+
1929 *delta
, cso
->bos
[i
].reloc_flags
);
1930 addr
= (void *) addr
+ 16;
1931 delta
= (void *) delta
+ 16;
1935 if (dirty
& IRIS_DIRTY_VERTEX_ELEMENTS
) {
1936 struct iris_vertex_element_state
*cso
= ice
->state
.cso_vertex_elements
;
1937 iris_batch_emit(batch
, cso
->vertex_elements
, sizeof(uint32_t) *
1938 (1 + cso
->count
* GENX(VERTEX_ELEMENT_STATE_length
)));
1939 for (int i
= 0; i
< cso
->count
; i
++) {
1940 iris_batch_emit(batch
, cso
->vf_instancing
[i
], sizeof(uint32_t) *
1941 (cso
->count
* GENX(3DSTATE_VF_INSTANCING_length
)));
1943 for (int i
= 0; i
< cso
->count
; i
++) {
1944 /* TODO: vertexid, instanceid support */
1945 iris_emit_cmd(batch
, GENX(3DSTATE_VF_SGVS
), sgvs
);
1950 iris_emit_cmd(batch
, GENX(3DSTATE_VF
), vf
) {
1951 if (draw
->primitive_restart
) {
1952 vf
.IndexedDrawCutIndexEnable
= true;
1953 vf
.CutIndex
= draw
->restart_index
;
1958 // XXX: Gen8 - PMA fix
1960 assert(!draw
->indirect
); // XXX: indirect support
1962 iris_emit_cmd(batch
, GENX(3DPRIMITIVE
), prim
) {
1963 prim
.StartInstanceLocation
= draw
->start_instance
;
1964 prim
.InstanceCount
= draw
->instance_count
;
1965 prim
.VertexCountPerInstance
= draw
->count
;
1966 prim
.VertexAccessType
= draw
->index_size
> 0 ? RANDOM
: SEQUENTIAL
;
1968 // XXX: this is probably bonkers.
1969 prim
.StartVertexLocation
= draw
->start
;
1971 if (draw
->index_size
) {
1972 prim
.BaseVertexLocation
+= draw
->index_bias
;
1974 prim
.StartVertexLocation
+= draw
->index_bias
;
1977 //prim.BaseVertexLocation = ...;
1985 3DSTATE_CONSTANT_
* - push constants
1993 - render targets
- write
and read
1994 3DSTATE_BINDING_TABLE_POINTERS_
*
1999 3DSTATE_SO_DECL_LIST
2002 -> iris_raster_state (point sprite texture coordinate origin
)
2003 -> bunch of shader state
...
2007 3DSTATE_DEPTH_BUFFER
2008 3DSTATE_HIER_DEPTH_BUFFER
2009 3DSTATE_STENCIL_BUFFER
2010 3DSTATE_CLEAR_PARAMS
2011 -> iris_framebuffer_state
?
2018 iris_destroy_state(struct iris_context
*ice
)
2020 // XXX: unreference resources/surfaces.
2021 for (unsigned i
= 0; i
< ice
->state
.framebuffer
.nr_cbufs
; i
++) {
2022 pipe_surface_reference(&ice
->state
.framebuffer
.cbufs
[i
], NULL
);
2024 pipe_surface_reference(&ice
->state
.framebuffer
.zsbuf
, NULL
);
2028 genX(init_state
)(struct iris_context
*ice
)
2030 struct pipe_context
*ctx
= &ice
->ctx
;
2032 ctx
->create_blend_state
= iris_create_blend_state
;
2033 ctx
->create_depth_stencil_alpha_state
= iris_create_zsa_state
;
2034 ctx
->create_rasterizer_state
= iris_create_rasterizer_state
;
2035 ctx
->create_sampler_state
= iris_create_sampler_state
;
2036 ctx
->create_sampler_view
= iris_create_sampler_view
;
2037 ctx
->create_surface
= iris_create_surface
;
2038 ctx
->create_vertex_elements_state
= iris_create_vertex_elements
;
2039 ctx
->create_compute_state
= iris_create_compute_state
;
2040 ctx
->bind_blend_state
= iris_bind_blend_state
;
2041 ctx
->bind_depth_stencil_alpha_state
= iris_bind_zsa_state
;
2042 ctx
->bind_sampler_states
= iris_bind_sampler_states
;
2043 ctx
->bind_rasterizer_state
= iris_bind_rasterizer_state
;
2044 ctx
->bind_vertex_elements_state
= iris_bind_vertex_elements_state
;
2045 ctx
->bind_compute_state
= iris_bind_compute_state
;
2046 ctx
->delete_blend_state
= iris_delete_state
;
2047 ctx
->delete_depth_stencil_alpha_state
= iris_delete_state
;
2048 ctx
->delete_fs_state
= iris_delete_state
;
2049 ctx
->delete_rasterizer_state
= iris_delete_state
;
2050 ctx
->delete_sampler_state
= iris_delete_state
;
2051 ctx
->delete_vertex_elements_state
= iris_delete_state
;
2052 ctx
->delete_compute_state
= iris_delete_state
;
2053 ctx
->delete_tcs_state
= iris_delete_state
;
2054 ctx
->delete_tes_state
= iris_delete_state
;
2055 ctx
->delete_gs_state
= iris_delete_state
;
2056 ctx
->delete_vs_state
= iris_delete_state
;
2057 ctx
->set_blend_color
= iris_set_blend_color
;
2058 ctx
->set_clip_state
= iris_set_clip_state
;
2059 ctx
->set_constant_buffer
= iris_set_constant_buffer
;
2060 ctx
->set_sampler_views
= iris_set_sampler_views
;
2061 ctx
->set_framebuffer_state
= iris_set_framebuffer_state
;
2062 ctx
->set_polygon_stipple
= iris_set_polygon_stipple
;
2063 ctx
->set_sample_mask
= iris_set_sample_mask
;
2064 ctx
->set_scissor_states
= iris_set_scissor_states
;
2065 ctx
->set_stencil_ref
= iris_set_stencil_ref
;
2066 ctx
->set_vertex_buffers
= iris_set_vertex_buffers
;
2067 ctx
->set_viewport_states
= iris_set_viewport_states
;
2068 ctx
->sampler_view_destroy
= iris_sampler_view_destroy
;
2069 ctx
->surface_destroy
= iris_surface_destroy
;
2070 ctx
->draw_vbo
= iris_draw_vbo
;
2071 ctx
->launch_grid
= iris_launch_grid
;
2072 ctx
->create_stream_output_target
= iris_create_stream_output_target
;
2073 ctx
->stream_output_target_destroy
= iris_stream_output_target_destroy
;
2074 ctx
->set_stream_output_targets
= iris_set_stream_output_targets
;
2076 ice
->state
.destroy_state
= iris_destroy_state
;
2077 ice
->state
.init_render_context
= iris_init_render_context
;
2078 ice
->state
.upload_render_state
= iris_upload_render_state
;
2079 ice
->state
.derived_program_state_size
= iris_derived_program_state_size
;
2080 ice
->state
.set_derived_program_state
= iris_set_derived_program_state
;
2081 ice
->state
.populate_vs_key
= iris_populate_vs_key
;
2082 ice
->state
.populate_tcs_key
= iris_populate_tcs_key
;
2083 ice
->state
.populate_tes_key
= iris_populate_tes_key
;
2084 ice
->state
.populate_gs_key
= iris_populate_gs_key
;
2085 ice
->state
.populate_fs_key
= iris_populate_fs_key
;
2088 ice
->state
.dirty
= ~0ull;