i965: Add #defines for HiZ and separate stencil buffer commands.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_defines.h
1 /*
2 Copyright (C) Intel Corp. 2006. All Rights Reserved.
3 Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to
4 develop this 3D driver.
5
6 Permission is hereby granted, free of charge, to any person obtaining
7 a copy of this software and associated documentation files (the
8 "Software"), to deal in the Software without restriction, including
9 without limitation the rights to use, copy, modify, merge, publish,
10 distribute, sublicense, and/or sell copies of the Software, and to
11 permit persons to whom the Software is furnished to do so, subject to
12 the following conditions:
13
14 The above copyright notice and this permission notice (including the
15 next paragraph) shall be included in all copies or substantial
16 portions of the Software.
17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
22 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
26 **********************************************************************/
27 /*
28 * Authors:
29 * Keith Whitwell <keith@tungstengraphics.com>
30 */
31
32
33 #ifndef BRW_DEFINES_H
34 #define BRW_DEFINES_H
35
36 /* 3D state:
37 */
38 #define PIPE_CONTROL_NOWRITE 0x00
39 #define PIPE_CONTROL_WRITEIMMEDIATE 0x01
40 #define PIPE_CONTROL_WRITEDEPTH 0x02
41 #define PIPE_CONTROL_WRITETIMESTAMP 0x03
42
43 #define PIPE_CONTROL_GTTWRITE_PROCESS_LOCAL 0x00
44 #define PIPE_CONTROL_GTTWRITE_GLOBAL 0x01
45
46 #define _3DPRIM_POINTLIST 0x01
47 #define _3DPRIM_LINELIST 0x02
48 #define _3DPRIM_LINESTRIP 0x03
49 #define _3DPRIM_TRILIST 0x04
50 #define _3DPRIM_TRISTRIP 0x05
51 #define _3DPRIM_TRIFAN 0x06
52 #define _3DPRIM_QUADLIST 0x07
53 #define _3DPRIM_QUADSTRIP 0x08
54 #define _3DPRIM_LINELIST_ADJ 0x09
55 #define _3DPRIM_LINESTRIP_ADJ 0x0A
56 #define _3DPRIM_TRILIST_ADJ 0x0B
57 #define _3DPRIM_TRISTRIP_ADJ 0x0C
58 #define _3DPRIM_TRISTRIP_REVERSE 0x0D
59 #define _3DPRIM_POLYGON 0x0E
60 #define _3DPRIM_RECTLIST 0x0F
61 #define _3DPRIM_LINELOOP 0x10
62 #define _3DPRIM_POINTLIST_BF 0x11
63 #define _3DPRIM_LINESTRIP_CONT 0x12
64 #define _3DPRIM_LINESTRIP_BF 0x13
65 #define _3DPRIM_LINESTRIP_CONT_BF 0x14
66 #define _3DPRIM_TRIFAN_NOSTIPPLE 0x15
67
68 #define _3DPRIM_VERTEXBUFFER_ACCESS_SEQUENTIAL 0
69 #define _3DPRIM_VERTEXBUFFER_ACCESS_RANDOM 1
70
71 #define BRW_ANISORATIO_2 0
72 #define BRW_ANISORATIO_4 1
73 #define BRW_ANISORATIO_6 2
74 #define BRW_ANISORATIO_8 3
75 #define BRW_ANISORATIO_10 4
76 #define BRW_ANISORATIO_12 5
77 #define BRW_ANISORATIO_14 6
78 #define BRW_ANISORATIO_16 7
79
80 #define BRW_BLENDFACTOR_ONE 0x1
81 #define BRW_BLENDFACTOR_SRC_COLOR 0x2
82 #define BRW_BLENDFACTOR_SRC_ALPHA 0x3
83 #define BRW_BLENDFACTOR_DST_ALPHA 0x4
84 #define BRW_BLENDFACTOR_DST_COLOR 0x5
85 #define BRW_BLENDFACTOR_SRC_ALPHA_SATURATE 0x6
86 #define BRW_BLENDFACTOR_CONST_COLOR 0x7
87 #define BRW_BLENDFACTOR_CONST_ALPHA 0x8
88 #define BRW_BLENDFACTOR_SRC1_COLOR 0x9
89 #define BRW_BLENDFACTOR_SRC1_ALPHA 0x0A
90 #define BRW_BLENDFACTOR_ZERO 0x11
91 #define BRW_BLENDFACTOR_INV_SRC_COLOR 0x12
92 #define BRW_BLENDFACTOR_INV_SRC_ALPHA 0x13
93 #define BRW_BLENDFACTOR_INV_DST_ALPHA 0x14
94 #define BRW_BLENDFACTOR_INV_DST_COLOR 0x15
95 #define BRW_BLENDFACTOR_INV_CONST_COLOR 0x17
96 #define BRW_BLENDFACTOR_INV_CONST_ALPHA 0x18
97 #define BRW_BLENDFACTOR_INV_SRC1_COLOR 0x19
98 #define BRW_BLENDFACTOR_INV_SRC1_ALPHA 0x1A
99
100 #define BRW_BLENDFUNCTION_ADD 0
101 #define BRW_BLENDFUNCTION_SUBTRACT 1
102 #define BRW_BLENDFUNCTION_REVERSE_SUBTRACT 2
103 #define BRW_BLENDFUNCTION_MIN 3
104 #define BRW_BLENDFUNCTION_MAX 4
105
106 #define BRW_ALPHATEST_FORMAT_UNORM8 0
107 #define BRW_ALPHATEST_FORMAT_FLOAT32 1
108
109 #define BRW_CHROMAKEY_KILL_ON_ANY_MATCH 0
110 #define BRW_CHROMAKEY_REPLACE_BLACK 1
111
112 #define BRW_CLIP_API_OGL 0
113 #define BRW_CLIP_API_DX 1
114
115 #define BRW_CLIPMODE_NORMAL 0
116 #define BRW_CLIPMODE_CLIP_ALL 1
117 #define BRW_CLIPMODE_CLIP_NON_REJECTED 2
118 #define BRW_CLIPMODE_REJECT_ALL 3
119 #define BRW_CLIPMODE_ACCEPT_ALL 4
120 #define BRW_CLIPMODE_KERNEL_CLIP 5
121
122 #define BRW_CLIP_NDCSPACE 0
123 #define BRW_CLIP_SCREENSPACE 1
124
125 #define BRW_COMPAREFUNCTION_ALWAYS 0
126 #define BRW_COMPAREFUNCTION_NEVER 1
127 #define BRW_COMPAREFUNCTION_LESS 2
128 #define BRW_COMPAREFUNCTION_EQUAL 3
129 #define BRW_COMPAREFUNCTION_LEQUAL 4
130 #define BRW_COMPAREFUNCTION_GREATER 5
131 #define BRW_COMPAREFUNCTION_NOTEQUAL 6
132 #define BRW_COMPAREFUNCTION_GEQUAL 7
133
134 #define BRW_COVERAGE_PIXELS_HALF 0
135 #define BRW_COVERAGE_PIXELS_1 1
136 #define BRW_COVERAGE_PIXELS_2 2
137 #define BRW_COVERAGE_PIXELS_4 3
138
139 #define BRW_CULLMODE_BOTH 0
140 #define BRW_CULLMODE_NONE 1
141 #define BRW_CULLMODE_FRONT 2
142 #define BRW_CULLMODE_BACK 3
143
144 #define BRW_DEFAULTCOLOR_R8G8B8A8_UNORM 0
145 #define BRW_DEFAULTCOLOR_R32G32B32A32_FLOAT 1
146
147 #define BRW_DEPTHFORMAT_D32_FLOAT_S8X24_UINT 0
148 #define BRW_DEPTHFORMAT_D32_FLOAT 1
149 #define BRW_DEPTHFORMAT_D24_UNORM_S8_UINT 2
150 #define BRW_DEPTHFORMAT_D16_UNORM 5
151
152 #define BRW_FLOATING_POINT_IEEE_754 0
153 #define BRW_FLOATING_POINT_NON_IEEE_754 1
154
155 #define BRW_FRONTWINDING_CW 0
156 #define BRW_FRONTWINDING_CCW 1
157
158 #define BRW_SPRITE_POINT_ENABLE 16
159
160 #define BRW_INDEX_BYTE 0
161 #define BRW_INDEX_WORD 1
162 #define BRW_INDEX_DWORD 2
163
164 #define BRW_LOGICOPFUNCTION_CLEAR 0
165 #define BRW_LOGICOPFUNCTION_NOR 1
166 #define BRW_LOGICOPFUNCTION_AND_INVERTED 2
167 #define BRW_LOGICOPFUNCTION_COPY_INVERTED 3
168 #define BRW_LOGICOPFUNCTION_AND_REVERSE 4
169 #define BRW_LOGICOPFUNCTION_INVERT 5
170 #define BRW_LOGICOPFUNCTION_XOR 6
171 #define BRW_LOGICOPFUNCTION_NAND 7
172 #define BRW_LOGICOPFUNCTION_AND 8
173 #define BRW_LOGICOPFUNCTION_EQUIV 9
174 #define BRW_LOGICOPFUNCTION_NOOP 10
175 #define BRW_LOGICOPFUNCTION_OR_INVERTED 11
176 #define BRW_LOGICOPFUNCTION_COPY 12
177 #define BRW_LOGICOPFUNCTION_OR_REVERSE 13
178 #define BRW_LOGICOPFUNCTION_OR 14
179 #define BRW_LOGICOPFUNCTION_SET 15
180
181 #define BRW_MAPFILTER_NEAREST 0x0
182 #define BRW_MAPFILTER_LINEAR 0x1
183 #define BRW_MAPFILTER_ANISOTROPIC 0x2
184
185 #define BRW_MIPFILTER_NONE 0
186 #define BRW_MIPFILTER_NEAREST 1
187 #define BRW_MIPFILTER_LINEAR 3
188
189 #define BRW_POLYGON_FRONT_FACING 0
190 #define BRW_POLYGON_BACK_FACING 1
191
192 #define BRW_PREFILTER_ALWAYS 0x0
193 #define BRW_PREFILTER_NEVER 0x1
194 #define BRW_PREFILTER_LESS 0x2
195 #define BRW_PREFILTER_EQUAL 0x3
196 #define BRW_PREFILTER_LEQUAL 0x4
197 #define BRW_PREFILTER_GREATER 0x5
198 #define BRW_PREFILTER_NOTEQUAL 0x6
199 #define BRW_PREFILTER_GEQUAL 0x7
200
201 #define BRW_PROVOKING_VERTEX_0 0
202 #define BRW_PROVOKING_VERTEX_1 1
203 #define BRW_PROVOKING_VERTEX_2 2
204
205 #define BRW_RASTRULE_UPPER_LEFT 0
206 #define BRW_RASTRULE_UPPER_RIGHT 1
207 /* These are listed as "Reserved, but not seen as useful"
208 * in Intel documentation (page 212, "Point Rasterization Rule",
209 * section 7.4 "SF Pipeline State Summary", of document
210 * "IntelĀ® 965 Express Chipset Family and IntelĀ® G35 Express
211 * Chipset Graphics Controller Programmer's Reference Manual,
212 * Volume 2: 3D/Media", Revision 1.0b as of January 2008,
213 * available at
214 * http://intellinuxgraphics.org/documentation.html
215 * at the time of this writing).
216 *
217 * These appear to be supported on at least some
218 * i965-family devices, and the BRW_RASTRULE_LOWER_RIGHT
219 * is useful when using OpenGL to render to a FBO
220 * (which has the pixel coordinate Y orientation inverted
221 * with respect to the normal OpenGL pixel coordinate system).
222 */
223 #define BRW_RASTRULE_LOWER_LEFT 2
224 #define BRW_RASTRULE_LOWER_RIGHT 3
225
226 #define BRW_RENDERTARGET_CLAMPRANGE_UNORM 0
227 #define BRW_RENDERTARGET_CLAMPRANGE_SNORM 1
228 #define BRW_RENDERTARGET_CLAMPRANGE_FORMAT 2
229
230 #define BRW_STENCILOP_KEEP 0
231 #define BRW_STENCILOP_ZERO 1
232 #define BRW_STENCILOP_REPLACE 2
233 #define BRW_STENCILOP_INCRSAT 3
234 #define BRW_STENCILOP_DECRSAT 4
235 #define BRW_STENCILOP_INCR 5
236 #define BRW_STENCILOP_DECR 6
237 #define BRW_STENCILOP_INVERT 7
238
239 #define BRW_SURFACE_MIPMAPLAYOUT_BELOW 0
240 #define BRW_SURFACE_MIPMAPLAYOUT_RIGHT 1
241
242 #define BRW_SURFACEFORMAT_R32G32B32A32_FLOAT 0x000
243 #define BRW_SURFACEFORMAT_R32G32B32A32_SINT 0x001
244 #define BRW_SURFACEFORMAT_R32G32B32A32_UINT 0x002
245 #define BRW_SURFACEFORMAT_R32G32B32A32_UNORM 0x003
246 #define BRW_SURFACEFORMAT_R32G32B32A32_SNORM 0x004
247 #define BRW_SURFACEFORMAT_R64G64_FLOAT 0x005
248 #define BRW_SURFACEFORMAT_R32G32B32X32_FLOAT 0x006
249 #define BRW_SURFACEFORMAT_R32G32B32A32_SSCALED 0x007
250 #define BRW_SURFACEFORMAT_R32G32B32A32_USCALED 0x008
251 #define BRW_SURFACEFORMAT_R32G32B32_FLOAT 0x040
252 #define BRW_SURFACEFORMAT_R32G32B32_SINT 0x041
253 #define BRW_SURFACEFORMAT_R32G32B32_UINT 0x042
254 #define BRW_SURFACEFORMAT_R32G32B32_UNORM 0x043
255 #define BRW_SURFACEFORMAT_R32G32B32_SNORM 0x044
256 #define BRW_SURFACEFORMAT_R32G32B32_SSCALED 0x045
257 #define BRW_SURFACEFORMAT_R32G32B32_USCALED 0x046
258 #define BRW_SURFACEFORMAT_R16G16B16A16_UNORM 0x080
259 #define BRW_SURFACEFORMAT_R16G16B16A16_SNORM 0x081
260 #define BRW_SURFACEFORMAT_R16G16B16A16_SINT 0x082
261 #define BRW_SURFACEFORMAT_R16G16B16A16_UINT 0x083
262 #define BRW_SURFACEFORMAT_R16G16B16A16_FLOAT 0x084
263 #define BRW_SURFACEFORMAT_R32G32_FLOAT 0x085
264 #define BRW_SURFACEFORMAT_R32G32_SINT 0x086
265 #define BRW_SURFACEFORMAT_R32G32_UINT 0x087
266 #define BRW_SURFACEFORMAT_R32_FLOAT_X8X24_TYPELESS 0x088
267 #define BRW_SURFACEFORMAT_X32_TYPELESS_G8X24_UINT 0x089
268 #define BRW_SURFACEFORMAT_L32A32_FLOAT 0x08A
269 #define BRW_SURFACEFORMAT_R32G32_UNORM 0x08B
270 #define BRW_SURFACEFORMAT_R32G32_SNORM 0x08C
271 #define BRW_SURFACEFORMAT_R64_FLOAT 0x08D
272 #define BRW_SURFACEFORMAT_R16G16B16X16_UNORM 0x08E
273 #define BRW_SURFACEFORMAT_R16G16B16X16_FLOAT 0x08F
274 #define BRW_SURFACEFORMAT_A32X32_FLOAT 0x090
275 #define BRW_SURFACEFORMAT_L32X32_FLOAT 0x091
276 #define BRW_SURFACEFORMAT_I32X32_FLOAT 0x092
277 #define BRW_SURFACEFORMAT_R16G16B16A16_SSCALED 0x093
278 #define BRW_SURFACEFORMAT_R16G16B16A16_USCALED 0x094
279 #define BRW_SURFACEFORMAT_R32G32_SSCALED 0x095
280 #define BRW_SURFACEFORMAT_R32G32_USCALED 0x096
281 #define BRW_SURFACEFORMAT_B8G8R8A8_UNORM 0x0C0
282 #define BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB 0x0C1
283 #define BRW_SURFACEFORMAT_R10G10B10A2_UNORM 0x0C2
284 #define BRW_SURFACEFORMAT_R10G10B10A2_UNORM_SRGB 0x0C3
285 #define BRW_SURFACEFORMAT_R10G10B10A2_UINT 0x0C4
286 #define BRW_SURFACEFORMAT_R10G10B10_SNORM_A2_UNORM 0x0C5
287 #define BRW_SURFACEFORMAT_R8G8B8A8_UNORM 0x0C7
288 #define BRW_SURFACEFORMAT_R8G8B8A8_UNORM_SRGB 0x0C8
289 #define BRW_SURFACEFORMAT_R8G8B8A8_SNORM 0x0C9
290 #define BRW_SURFACEFORMAT_R8G8B8A8_SINT 0x0CA
291 #define BRW_SURFACEFORMAT_R8G8B8A8_UINT 0x0CB
292 #define BRW_SURFACEFORMAT_R16G16_UNORM 0x0CC
293 #define BRW_SURFACEFORMAT_R16G16_SNORM 0x0CD
294 #define BRW_SURFACEFORMAT_R16G16_SINT 0x0CE
295 #define BRW_SURFACEFORMAT_R16G16_UINT 0x0CF
296 #define BRW_SURFACEFORMAT_R16G16_FLOAT 0x0D0
297 #define BRW_SURFACEFORMAT_B10G10R10A2_UNORM 0x0D1
298 #define BRW_SURFACEFORMAT_B10G10R10A2_UNORM_SRGB 0x0D2
299 #define BRW_SURFACEFORMAT_R11G11B10_FLOAT 0x0D3
300 #define BRW_SURFACEFORMAT_R32_SINT 0x0D6
301 #define BRW_SURFACEFORMAT_R32_UINT 0x0D7
302 #define BRW_SURFACEFORMAT_R32_FLOAT 0x0D8
303 #define BRW_SURFACEFORMAT_R24_UNORM_X8_TYPELESS 0x0D9
304 #define BRW_SURFACEFORMAT_X24_TYPELESS_G8_UINT 0x0DA
305 #define BRW_SURFACEFORMAT_L16A16_UNORM 0x0DF
306 #define BRW_SURFACEFORMAT_I24X8_UNORM 0x0E0
307 #define BRW_SURFACEFORMAT_L24X8_UNORM 0x0E1
308 #define BRW_SURFACEFORMAT_A24X8_UNORM 0x0E2
309 #define BRW_SURFACEFORMAT_I32_FLOAT 0x0E3
310 #define BRW_SURFACEFORMAT_L32_FLOAT 0x0E4
311 #define BRW_SURFACEFORMAT_A32_FLOAT 0x0E5
312 #define BRW_SURFACEFORMAT_B8G8R8X8_UNORM 0x0E9
313 #define BRW_SURFACEFORMAT_B8G8R8X8_UNORM_SRGB 0x0EA
314 #define BRW_SURFACEFORMAT_R8G8B8X8_UNORM 0x0EB
315 #define BRW_SURFACEFORMAT_R8G8B8X8_UNORM_SRGB 0x0EC
316 #define BRW_SURFACEFORMAT_R9G9B9E5_SHAREDEXP 0x0ED
317 #define BRW_SURFACEFORMAT_B10G10R10X2_UNORM 0x0EE
318 #define BRW_SURFACEFORMAT_L16A16_FLOAT 0x0F0
319 #define BRW_SURFACEFORMAT_R32_UNORM 0x0F1
320 #define BRW_SURFACEFORMAT_R32_SNORM 0x0F2
321 #define BRW_SURFACEFORMAT_R10G10B10X2_USCALED 0x0F3
322 #define BRW_SURFACEFORMAT_R8G8B8A8_SSCALED 0x0F4
323 #define BRW_SURFACEFORMAT_R8G8B8A8_USCALED 0x0F5
324 #define BRW_SURFACEFORMAT_R16G16_SSCALED 0x0F6
325 #define BRW_SURFACEFORMAT_R16G16_USCALED 0x0F7
326 #define BRW_SURFACEFORMAT_R32_SSCALED 0x0F8
327 #define BRW_SURFACEFORMAT_R32_USCALED 0x0F9
328 #define BRW_SURFACEFORMAT_B5G6R5_UNORM 0x100
329 #define BRW_SURFACEFORMAT_B5G6R5_UNORM_SRGB 0x101
330 #define BRW_SURFACEFORMAT_B5G5R5A1_UNORM 0x102
331 #define BRW_SURFACEFORMAT_B5G5R5A1_UNORM_SRGB 0x103
332 #define BRW_SURFACEFORMAT_B4G4R4A4_UNORM 0x104
333 #define BRW_SURFACEFORMAT_B4G4R4A4_UNORM_SRGB 0x105
334 #define BRW_SURFACEFORMAT_R8G8_UNORM 0x106
335 #define BRW_SURFACEFORMAT_R8G8_SNORM 0x107
336 #define BRW_SURFACEFORMAT_R8G8_SINT 0x108
337 #define BRW_SURFACEFORMAT_R8G8_UINT 0x109
338 #define BRW_SURFACEFORMAT_R16_UNORM 0x10A
339 #define BRW_SURFACEFORMAT_R16_SNORM 0x10B
340 #define BRW_SURFACEFORMAT_R16_SINT 0x10C
341 #define BRW_SURFACEFORMAT_R16_UINT 0x10D
342 #define BRW_SURFACEFORMAT_R16_FLOAT 0x10E
343 #define BRW_SURFACEFORMAT_I16_UNORM 0x111
344 #define BRW_SURFACEFORMAT_L16_UNORM 0x112
345 #define BRW_SURFACEFORMAT_A16_UNORM 0x113
346 #define BRW_SURFACEFORMAT_L8A8_UNORM 0x114
347 #define BRW_SURFACEFORMAT_I16_FLOAT 0x115
348 #define BRW_SURFACEFORMAT_L16_FLOAT 0x116
349 #define BRW_SURFACEFORMAT_A16_FLOAT 0x117
350 #define BRW_SURFACEFORMAT_L8A8_UNORM_SRGB 0x118
351 #define BRW_SURFACEFORMAT_R5G5_SNORM_B6_UNORM 0x119
352 #define BRW_SURFACEFORMAT_B5G5R5X1_UNORM 0x11A
353 #define BRW_SURFACEFORMAT_B5G5R5X1_UNORM_SRGB 0x11B
354 #define BRW_SURFACEFORMAT_R8G8_SSCALED 0x11C
355 #define BRW_SURFACEFORMAT_R8G8_USCALED 0x11D
356 #define BRW_SURFACEFORMAT_R16_SSCALED 0x11E
357 #define BRW_SURFACEFORMAT_R16_USCALED 0x11F
358 #define BRW_SURFACEFORMAT_R8_UNORM 0x140
359 #define BRW_SURFACEFORMAT_R8_SNORM 0x141
360 #define BRW_SURFACEFORMAT_R8_SINT 0x142
361 #define BRW_SURFACEFORMAT_R8_UINT 0x143
362 #define BRW_SURFACEFORMAT_A8_UNORM 0x144
363 #define BRW_SURFACEFORMAT_I8_UNORM 0x145
364 #define BRW_SURFACEFORMAT_L8_UNORM 0x146
365 #define BRW_SURFACEFORMAT_P4A4_UNORM 0x147
366 #define BRW_SURFACEFORMAT_A4P4_UNORM 0x148
367 #define BRW_SURFACEFORMAT_R8_SSCALED 0x149
368 #define BRW_SURFACEFORMAT_R8_USCALED 0x14A
369 #define BRW_SURFACEFORMAT_L8_UNORM_SRGB 0x14C
370 #define BRW_SURFACEFORMAT_DXT1_RGB_SRGB 0x180
371 #define BRW_SURFACEFORMAT_R1_UINT 0x181
372 #define BRW_SURFACEFORMAT_YCRCB_NORMAL 0x182
373 #define BRW_SURFACEFORMAT_YCRCB_SWAPUVY 0x183
374 #define BRW_SURFACEFORMAT_BC1_UNORM 0x186
375 #define BRW_SURFACEFORMAT_BC2_UNORM 0x187
376 #define BRW_SURFACEFORMAT_BC3_UNORM 0x188
377 #define BRW_SURFACEFORMAT_BC4_UNORM 0x189
378 #define BRW_SURFACEFORMAT_BC5_UNORM 0x18A
379 #define BRW_SURFACEFORMAT_BC1_UNORM_SRGB 0x18B
380 #define BRW_SURFACEFORMAT_BC2_UNORM_SRGB 0x18C
381 #define BRW_SURFACEFORMAT_BC3_UNORM_SRGB 0x18D
382 #define BRW_SURFACEFORMAT_MONO8 0x18E
383 #define BRW_SURFACEFORMAT_YCRCB_SWAPUV 0x18F
384 #define BRW_SURFACEFORMAT_YCRCB_SWAPY 0x190
385 #define BRW_SURFACEFORMAT_DXT1_RGB 0x191
386 #define BRW_SURFACEFORMAT_FXT1 0x192
387 #define BRW_SURFACEFORMAT_R8G8B8_UNORM 0x193
388 #define BRW_SURFACEFORMAT_R8G8B8_SNORM 0x194
389 #define BRW_SURFACEFORMAT_R8G8B8_SSCALED 0x195
390 #define BRW_SURFACEFORMAT_R8G8B8_USCALED 0x196
391 #define BRW_SURFACEFORMAT_R64G64B64A64_FLOAT 0x197
392 #define BRW_SURFACEFORMAT_R64G64B64_FLOAT 0x198
393 #define BRW_SURFACEFORMAT_BC4_SNORM 0x199
394 #define BRW_SURFACEFORMAT_BC5_SNORM 0x19A
395 #define BRW_SURFACEFORMAT_R16G16B16_UNORM 0x19C
396 #define BRW_SURFACEFORMAT_R16G16B16_SNORM 0x19D
397 #define BRW_SURFACEFORMAT_R16G16B16_SSCALED 0x19E
398 #define BRW_SURFACEFORMAT_R16G16B16_USCALED 0x19F
399
400 #define BRW_SURFACERETURNFORMAT_FLOAT32 0
401 #define BRW_SURFACERETURNFORMAT_S1 1
402
403 #define BRW_SURFACE_1D 0
404 #define BRW_SURFACE_2D 1
405 #define BRW_SURFACE_3D 2
406 #define BRW_SURFACE_CUBE 3
407 #define BRW_SURFACE_BUFFER 4
408 #define BRW_SURFACE_NULL 7
409
410 #define BRW_TEXCOORDMODE_WRAP 0
411 #define BRW_TEXCOORDMODE_MIRROR 1
412 #define BRW_TEXCOORDMODE_CLAMP 2
413 #define BRW_TEXCOORDMODE_CUBE 3
414 #define BRW_TEXCOORDMODE_CLAMP_BORDER 4
415 #define BRW_TEXCOORDMODE_MIRROR_ONCE 5
416
417 #define BRW_THREAD_PRIORITY_NORMAL 0
418 #define BRW_THREAD_PRIORITY_HIGH 1
419
420 #define BRW_TILEWALK_XMAJOR 0
421 #define BRW_TILEWALK_YMAJOR 1
422
423 #define BRW_VERTEX_SUBPIXEL_PRECISION_8BITS 0
424 #define BRW_VERTEX_SUBPIXEL_PRECISION_4BITS 1
425
426 /* Execution Unit (EU) defines
427 */
428
429 #define BRW_ALIGN_1 0
430 #define BRW_ALIGN_16 1
431
432 #define BRW_ADDRESS_DIRECT 0
433 #define BRW_ADDRESS_REGISTER_INDIRECT_REGISTER 1
434
435 #define BRW_CHANNEL_X 0
436 #define BRW_CHANNEL_Y 1
437 #define BRW_CHANNEL_Z 2
438 #define BRW_CHANNEL_W 3
439
440 #define BRW_COMPRESSION_NONE 0
441 #define BRW_COMPRESSION_2NDHALF 1
442 #define BRW_COMPRESSION_COMPRESSED 2
443
444 #define GEN6_COMPRESSION_1Q 0
445 #define GEN6_COMPRESSION_2Q 1
446 #define GEN6_COMPRESSION_3Q 2
447 #define GEN6_COMPRESSION_4Q 3
448 #define GEN6_COMPRESSION_1H 0
449 #define GEN6_COMPRESSION_2H 2
450
451 #define BRW_CONDITIONAL_NONE 0
452 #define BRW_CONDITIONAL_Z 1
453 #define BRW_CONDITIONAL_NZ 2
454 #define BRW_CONDITIONAL_EQ 1 /* Z */
455 #define BRW_CONDITIONAL_NEQ 2 /* NZ */
456 #define BRW_CONDITIONAL_G 3
457 #define BRW_CONDITIONAL_GE 4
458 #define BRW_CONDITIONAL_L 5
459 #define BRW_CONDITIONAL_LE 6
460 #define BRW_CONDITIONAL_R 7
461 #define BRW_CONDITIONAL_O 8
462 #define BRW_CONDITIONAL_U 9
463
464 #define BRW_DEBUG_NONE 0
465 #define BRW_DEBUG_BREAKPOINT 1
466
467 #define BRW_DEPENDENCY_NORMAL 0
468 #define BRW_DEPENDENCY_NOTCLEARED 1
469 #define BRW_DEPENDENCY_NOTCHECKED 2
470 #define BRW_DEPENDENCY_DISABLE 3
471
472 #define BRW_EXECUTE_1 0
473 #define BRW_EXECUTE_2 1
474 #define BRW_EXECUTE_4 2
475 #define BRW_EXECUTE_8 3
476 #define BRW_EXECUTE_16 4
477 #define BRW_EXECUTE_32 5
478
479 #define BRW_HORIZONTAL_STRIDE_0 0
480 #define BRW_HORIZONTAL_STRIDE_1 1
481 #define BRW_HORIZONTAL_STRIDE_2 2
482 #define BRW_HORIZONTAL_STRIDE_4 3
483
484 #define BRW_INSTRUCTION_NORMAL 0
485 #define BRW_INSTRUCTION_SATURATE 1
486
487 #define BRW_MASK_ENABLE 0
488 #define BRW_MASK_DISABLE 1
489
490 /** @{
491 *
492 * Gen6 has replaced "mask enable/disable" with WECtrl, which is
493 * effectively the same but much simpler to think about. Now, there
494 * are two contributors ANDed together to whether channels are
495 * executed: The predication on the instruction, and the channel write
496 * enable.
497 */
498 /**
499 * This is the default value. It means that a channel's write enable is set
500 * if the per-channel IP is pointing at this instruction.
501 */
502 #define BRW_WE_NORMAL 0
503 /**
504 * This is used like BRW_MASK_DISABLE, and causes all channels to have
505 * their write enable set. Note that predication still contributes to
506 * whether the channel actually gets written.
507 */
508 #define BRW_WE_ALL 1
509 /** @} */
510
511 #define BRW_OPCODE_MOV 1
512 #define BRW_OPCODE_SEL 2
513 #define BRW_OPCODE_NOT 4
514 #define BRW_OPCODE_AND 5
515 #define BRW_OPCODE_OR 6
516 #define BRW_OPCODE_XOR 7
517 #define BRW_OPCODE_SHR 8
518 #define BRW_OPCODE_SHL 9
519 #define BRW_OPCODE_RSR 10
520 #define BRW_OPCODE_RSL 11
521 #define BRW_OPCODE_ASR 12
522 #define BRW_OPCODE_CMP 16
523 #define BRW_OPCODE_CMPN 17
524 #define BRW_OPCODE_JMPI 32
525 #define BRW_OPCODE_IF 34
526 #define BRW_OPCODE_IFF 35
527 #define BRW_OPCODE_ELSE 36
528 #define BRW_OPCODE_ENDIF 37
529 #define BRW_OPCODE_DO 38
530 #define BRW_OPCODE_WHILE 39
531 #define BRW_OPCODE_BREAK 40
532 #define BRW_OPCODE_CONTINUE 41
533 #define BRW_OPCODE_HALT 42
534 #define BRW_OPCODE_MSAVE 44
535 #define BRW_OPCODE_MRESTORE 45
536 #define BRW_OPCODE_PUSH 46
537 #define BRW_OPCODE_POP 47
538 #define BRW_OPCODE_WAIT 48
539 #define BRW_OPCODE_SEND 49
540 #define BRW_OPCODE_SENDC 50
541 #define BRW_OPCODE_MATH 56
542 #define BRW_OPCODE_ADD 64
543 #define BRW_OPCODE_MUL 65
544 #define BRW_OPCODE_AVG 66
545 #define BRW_OPCODE_FRC 67
546 #define BRW_OPCODE_RNDU 68
547 #define BRW_OPCODE_RNDD 69
548 #define BRW_OPCODE_RNDE 70
549 #define BRW_OPCODE_RNDZ 71
550 #define BRW_OPCODE_MAC 72
551 #define BRW_OPCODE_MACH 73
552 #define BRW_OPCODE_LZD 74
553 #define BRW_OPCODE_SAD2 80
554 #define BRW_OPCODE_SADA2 81
555 #define BRW_OPCODE_DP4 84
556 #define BRW_OPCODE_DPH 85
557 #define BRW_OPCODE_DP3 86
558 #define BRW_OPCODE_DP2 87
559 #define BRW_OPCODE_DPA2 88
560 #define BRW_OPCODE_LINE 89
561 #define BRW_OPCODE_PLN 90
562 #define BRW_OPCODE_NOP 126
563
564 #define BRW_PREDICATE_NONE 0
565 #define BRW_PREDICATE_NORMAL 1
566 #define BRW_PREDICATE_ALIGN1_ANYV 2
567 #define BRW_PREDICATE_ALIGN1_ALLV 3
568 #define BRW_PREDICATE_ALIGN1_ANY2H 4
569 #define BRW_PREDICATE_ALIGN1_ALL2H 5
570 #define BRW_PREDICATE_ALIGN1_ANY4H 6
571 #define BRW_PREDICATE_ALIGN1_ALL4H 7
572 #define BRW_PREDICATE_ALIGN1_ANY8H 8
573 #define BRW_PREDICATE_ALIGN1_ALL8H 9
574 #define BRW_PREDICATE_ALIGN1_ANY16H 10
575 #define BRW_PREDICATE_ALIGN1_ALL16H 11
576 #define BRW_PREDICATE_ALIGN16_REPLICATE_X 2
577 #define BRW_PREDICATE_ALIGN16_REPLICATE_Y 3
578 #define BRW_PREDICATE_ALIGN16_REPLICATE_Z 4
579 #define BRW_PREDICATE_ALIGN16_REPLICATE_W 5
580 #define BRW_PREDICATE_ALIGN16_ANY4H 6
581 #define BRW_PREDICATE_ALIGN16_ALL4H 7
582
583 #define BRW_ARCHITECTURE_REGISTER_FILE 0
584 #define BRW_GENERAL_REGISTER_FILE 1
585 #define BRW_MESSAGE_REGISTER_FILE 2
586 #define BRW_IMMEDIATE_VALUE 3
587
588 #define BRW_REGISTER_TYPE_UD 0
589 #define BRW_REGISTER_TYPE_D 1
590 #define BRW_REGISTER_TYPE_UW 2
591 #define BRW_REGISTER_TYPE_W 3
592 #define BRW_REGISTER_TYPE_UB 4
593 #define BRW_REGISTER_TYPE_B 5
594 #define BRW_REGISTER_TYPE_VF 5 /* packed float vector, immediates only? */
595 #define BRW_REGISTER_TYPE_HF 6
596 #define BRW_REGISTER_TYPE_V 6 /* packed int vector, immediates only, uword dest only */
597 #define BRW_REGISTER_TYPE_F 7
598
599 #define BRW_ARF_NULL 0x00
600 #define BRW_ARF_ADDRESS 0x10
601 #define BRW_ARF_ACCUMULATOR 0x20
602 #define BRW_ARF_FLAG 0x30
603 #define BRW_ARF_MASK 0x40
604 #define BRW_ARF_MASK_STACK 0x50
605 #define BRW_ARF_MASK_STACK_DEPTH 0x60
606 #define BRW_ARF_STATE 0x70
607 #define BRW_ARF_CONTROL 0x80
608 #define BRW_ARF_NOTIFICATION_COUNT 0x90
609 #define BRW_ARF_IP 0xA0
610
611 #define BRW_MRF_COMPR4 (1 << 7)
612
613 #define BRW_AMASK 0
614 #define BRW_IMASK 1
615 #define BRW_LMASK 2
616 #define BRW_CMASK 3
617
618
619
620 #define BRW_THREAD_NORMAL 0
621 #define BRW_THREAD_ATOMIC 1
622 #define BRW_THREAD_SWITCH 2
623
624 #define BRW_VERTICAL_STRIDE_0 0
625 #define BRW_VERTICAL_STRIDE_1 1
626 #define BRW_VERTICAL_STRIDE_2 2
627 #define BRW_VERTICAL_STRIDE_4 3
628 #define BRW_VERTICAL_STRIDE_8 4
629 #define BRW_VERTICAL_STRIDE_16 5
630 #define BRW_VERTICAL_STRIDE_32 6
631 #define BRW_VERTICAL_STRIDE_64 7
632 #define BRW_VERTICAL_STRIDE_128 8
633 #define BRW_VERTICAL_STRIDE_256 9
634 #define BRW_VERTICAL_STRIDE_ONE_DIMENSIONAL 0xF
635
636 #define BRW_WIDTH_1 0
637 #define BRW_WIDTH_2 1
638 #define BRW_WIDTH_4 2
639 #define BRW_WIDTH_8 3
640 #define BRW_WIDTH_16 4
641
642 #define BRW_STATELESS_BUFFER_BOUNDARY_1K 0
643 #define BRW_STATELESS_BUFFER_BOUNDARY_2K 1
644 #define BRW_STATELESS_BUFFER_BOUNDARY_4K 2
645 #define BRW_STATELESS_BUFFER_BOUNDARY_8K 3
646 #define BRW_STATELESS_BUFFER_BOUNDARY_16K 4
647 #define BRW_STATELESS_BUFFER_BOUNDARY_32K 5
648 #define BRW_STATELESS_BUFFER_BOUNDARY_64K 6
649 #define BRW_STATELESS_BUFFER_BOUNDARY_128K 7
650 #define BRW_STATELESS_BUFFER_BOUNDARY_256K 8
651 #define BRW_STATELESS_BUFFER_BOUNDARY_512K 9
652 #define BRW_STATELESS_BUFFER_BOUNDARY_1M 10
653 #define BRW_STATELESS_BUFFER_BOUNDARY_2M 11
654
655 #define BRW_POLYGON_FACING_FRONT 0
656 #define BRW_POLYGON_FACING_BACK 1
657
658 #define BRW_MESSAGE_TARGET_NULL 0
659 #define BRW_MESSAGE_TARGET_MATH 1 /* reserved on GEN6 */
660 #define BRW_MESSAGE_TARGET_SAMPLER 2
661 #define BRW_MESSAGE_TARGET_GATEWAY 3
662 #define BRW_MESSAGE_TARGET_DATAPORT_READ 4 /* sampler cache on GEN6 */
663 #define BRW_MESSAGE_TARGET_DATAPORT_WRITE 5 /* render cache on Gen6 */
664 #define BRW_MESSAGE_TARGET_URB 6
665 #define BRW_MESSAGE_TARGET_THREAD_SPAWNER 7
666 #define BRW_MESSAGE_TARGET_CONST_CACHE 9 /* GEN6 */
667
668 #define BRW_SAMPLER_RETURN_FORMAT_FLOAT32 0
669 #define BRW_SAMPLER_RETURN_FORMAT_UINT32 2
670 #define BRW_SAMPLER_RETURN_FORMAT_SINT32 3
671
672 #define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE 0
673 #define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE 0
674 #define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS 0
675 #define BRW_SAMPLER_MESSAGE_SIMD8_KILLPIX 1
676 #define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_LOD 1
677 #define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_LOD 1
678 #define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_GRADIENTS 2
679 #define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_GRADIENTS 2
680 #define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_COMPARE 0
681 #define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE 2
682 #define BRW_SAMPLER_MESSAGE_SIMD4X2_RESINFO 2
683 #define BRW_SAMPLER_MESSAGE_SIMD8_RESINFO 2
684 #define BRW_SAMPLER_MESSAGE_SIMD16_RESINFO 2
685 #define BRW_SAMPLER_MESSAGE_SIMD4X2_LD 3
686 #define BRW_SAMPLER_MESSAGE_SIMD8_LD 3
687 #define BRW_SAMPLER_MESSAGE_SIMD16_LD 3
688
689 #define BRW_SAMPLER_MESSAGE_SAMPLE_GEN5 0
690 #define BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_GEN5 1
691 #define BRW_SAMPLER_MESSAGE_SAMPLE_LOD_GEN5 2
692 #define BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_GEN5 3
693 #define BRW_SAMPLER_MESSAGE_SAMPLE_DERIVS_GEN5 4
694 #define BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_COMPARE_GEN5 5
695 #define BRW_SAMPLER_MESSAGE_SAMPLE_LOD_COMPARE_GEN5 6
696
697 /* for GEN5 only */
698 #define BRW_SAMPLER_SIMD_MODE_SIMD4X2 0
699 #define BRW_SAMPLER_SIMD_MODE_SIMD8 1
700 #define BRW_SAMPLER_SIMD_MODE_SIMD16 2
701 #define BRW_SAMPLER_SIMD_MODE_SIMD32_64 3
702
703 #define BRW_DATAPORT_OWORD_BLOCK_1_OWORDLOW 0
704 #define BRW_DATAPORT_OWORD_BLOCK_1_OWORDHIGH 1
705 #define BRW_DATAPORT_OWORD_BLOCK_2_OWORDS 2
706 #define BRW_DATAPORT_OWORD_BLOCK_4_OWORDS 3
707 #define BRW_DATAPORT_OWORD_BLOCK_8_OWORDS 4
708
709 #define BRW_DATAPORT_OWORD_DUAL_BLOCK_1OWORD 0
710 #define BRW_DATAPORT_OWORD_DUAL_BLOCK_4OWORDS 2
711
712 #define BRW_DATAPORT_DWORD_SCATTERED_BLOCK_8DWORDS 2
713 #define BRW_DATAPORT_DWORD_SCATTERED_BLOCK_16DWORDS 3
714
715 /* This one stays the same across generations. */
716 #define BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ 0
717 /* GEN4 */
718 #define BRW_DATAPORT_READ_MESSAGE_OWORD_DUAL_BLOCK_READ 1
719 #define BRW_DATAPORT_READ_MESSAGE_MEDIA_BLOCK_READ 2
720 #define BRW_DATAPORT_READ_MESSAGE_DWORD_SCATTERED_READ 3
721 /* G45, GEN5 */
722 #define G45_DATAPORT_READ_MESSAGE_RENDER_UNORM_READ 1
723 #define G45_DATAPORT_READ_MESSAGE_OWORD_DUAL_BLOCK_READ 2
724 #define G45_DATAPORT_READ_MESSAGE_AVC_LOOP_FILTER_READ 3
725 #define G45_DATAPORT_READ_MESSAGE_MEDIA_BLOCK_READ 4
726 #define G45_DATAPORT_READ_MESSAGE_DWORD_SCATTERED_READ 6
727 /* GEN6 */
728 #define GEN6_DATAPORT_READ_MESSAGE_RENDER_UNORM_READ 1
729 #define GEN6_DATAPORT_READ_MESSAGE_OWORD_DUAL_BLOCK_READ 2
730 #define GEN6_DATAPORT_READ_MESSAGE_MEDIA_BLOCK_READ 4
731 #define GEN6_DATAPORT_READ_MESSAGE_OWORD_UNALIGN_BLOCK_READ 5
732 #define GEN6_DATAPORT_READ_MESSAGE_DWORD_SCATTERED_READ 6
733
734 #define BRW_DATAPORT_READ_TARGET_DATA_CACHE 0
735 #define BRW_DATAPORT_READ_TARGET_RENDER_CACHE 1
736 #define BRW_DATAPORT_READ_TARGET_SAMPLER_CACHE 2
737
738 #define BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE 0
739 #define BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE_REPLICATED 1
740 #define BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD8_DUAL_SOURCE_SUBSPAN01 2
741 #define BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD8_DUAL_SOURCE_SUBSPAN23 3
742 #define BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD8_SINGLE_SOURCE_SUBSPAN01 4
743
744 #define BRW_DATAPORT_WRITE_MESSAGE_OWORD_BLOCK_WRITE 0
745 #define BRW_DATAPORT_WRITE_MESSAGE_OWORD_DUAL_BLOCK_WRITE 1
746 #define BRW_DATAPORT_WRITE_MESSAGE_DWORD_BLOCK_WRITE 2
747 #define BRW_DATAPORT_WRITE_MESSAGE_DWORD_SCATTERED_WRITE 3
748 #define BRW_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE 4
749 #define BRW_DATAPORT_WRITE_MESSAGE_STREAMED_VERTEX_BUFFER_WRITE 5
750 #define BRW_DATAPORT_WRITE_MESSAGE_FLUSH_RENDER_CACHE 7
751
752 /* GEN6 */
753 #define BRW_DATAPORT_WRITE_MESSAGE_DWORD_ATOMIC_WRITE_GEN6 7
754 #define BRW_DATAPORT_WRITE_MESSAGE_OWORD_BLOCK_WRITE_GEN6 8
755 #define BRW_DATAPORT_WRITE_MESSAGE_OWORD_DUAL_BLOCK_WRITE_GEN6 9
756 #define BRW_DATAPORT_WRITE_MESSAGE_MEDIA_BLOCK_WRITE_GEN6 10
757 #define BRW_DATAPORT_WRITE_MESSAGE_DWORLD_SCATTERED_WRITE_GEN6 11
758 #define BRW_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE_GEN6 12
759 #define BRW_DATAPORT_WRITE_MESSAGE_STREAMED_VB_WRITE_GEN6 13
760 #define BRW_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_UNORM_WRITE_GEN6 14
761
762 #define BRW_MATH_FUNCTION_INV 1
763 #define BRW_MATH_FUNCTION_LOG 2
764 #define BRW_MATH_FUNCTION_EXP 3
765 #define BRW_MATH_FUNCTION_SQRT 4
766 #define BRW_MATH_FUNCTION_RSQ 5
767 #define BRW_MATH_FUNCTION_SIN 6 /* was 7 */
768 #define BRW_MATH_FUNCTION_COS 7 /* was 8 */
769 #define BRW_MATH_FUNCTION_SINCOS 8 /* was 6 */
770 #define BRW_MATH_FUNCTION_TAN 9 /* gen4 */
771 #define BRW_MATH_FUNCTION_FDIV 9 /* gen6+ */
772 #define BRW_MATH_FUNCTION_POW 10
773 #define BRW_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER 11
774 #define BRW_MATH_FUNCTION_INT_DIV_QUOTIENT 12
775 #define BRW_MATH_FUNCTION_INT_DIV_REMAINDER 13
776
777 #define BRW_MATH_INTEGER_UNSIGNED 0
778 #define BRW_MATH_INTEGER_SIGNED 1
779
780 #define BRW_MATH_PRECISION_FULL 0
781 #define BRW_MATH_PRECISION_PARTIAL 1
782
783 #define BRW_MATH_SATURATE_NONE 0
784 #define BRW_MATH_SATURATE_SATURATE 1
785
786 #define BRW_MATH_DATA_VECTOR 0
787 #define BRW_MATH_DATA_SCALAR 1
788
789 #define BRW_URB_OPCODE_WRITE 0
790
791 #define BRW_URB_SWIZZLE_NONE 0
792 #define BRW_URB_SWIZZLE_INTERLEAVE 1
793 #define BRW_URB_SWIZZLE_TRANSPOSE 2
794
795 #define BRW_SCRATCH_SPACE_SIZE_1K 0
796 #define BRW_SCRATCH_SPACE_SIZE_2K 1
797 #define BRW_SCRATCH_SPACE_SIZE_4K 2
798 #define BRW_SCRATCH_SPACE_SIZE_8K 3
799 #define BRW_SCRATCH_SPACE_SIZE_16K 4
800 #define BRW_SCRATCH_SPACE_SIZE_32K 5
801 #define BRW_SCRATCH_SPACE_SIZE_64K 6
802 #define BRW_SCRATCH_SPACE_SIZE_128K 7
803 #define BRW_SCRATCH_SPACE_SIZE_256K 8
804 #define BRW_SCRATCH_SPACE_SIZE_512K 9
805 #define BRW_SCRATCH_SPACE_SIZE_1M 10
806 #define BRW_SCRATCH_SPACE_SIZE_2M 11
807
808
809
810
811 #define CMD_URB_FENCE 0x6000
812 #define CMD_CS_URB_STATE 0x6001
813 #define CMD_CONST_BUFFER 0x6002
814
815 #define CMD_STATE_BASE_ADDRESS 0x6101
816 #define CMD_STATE_INSN_POINTER 0x6102
817 #define CMD_PIPELINE_SELECT_965 0x6104
818 #define CMD_PIPELINE_SELECT_GM45 0x6904
819
820 #define CMD_PIPELINED_STATE_POINTERS 0x7800
821 #define CMD_BINDING_TABLE_PTRS 0x7801
822 # define GEN6_BINDING_TABLE_MODIFY_VS (1 << 8)
823 # define GEN6_BINDING_TABLE_MODIFY_GS (1 << 9)
824 # define GEN6_BINDING_TABLE_MODIFY_PS (1 << 12)
825
826 #define _3DSTATE_SAMPLER_STATE_POINTERS 0x7802 /* GEN6+ */
827 # define PS_SAMPLER_STATE_CHANGE (1 << 12)
828 # define GS_SAMPLER_STATE_CHANGE (1 << 9)
829 # define VS_SAMPLER_STATE_CHANGE (1 << 8)
830 /* DW1: VS */
831 /* DW2: GS */
832 /* DW3: PS */
833
834 #define CMD_VERTEX_BUFFER 0x7808
835 # define BRW_VB0_INDEX_SHIFT 27
836 # define GEN6_VB0_INDEX_SHIFT 26
837 # define BRW_VB0_ACCESS_VERTEXDATA (0 << 26)
838 # define BRW_VB0_ACCESS_INSTANCEDATA (1 << 26)
839 # define GEN6_VB0_ACCESS_VERTEXDATA (0 << 20)
840 # define GEN6_VB0_ACCESS_INSTANCEDATA (1 << 20)
841 # define BRW_VB0_PITCH_SHIFT 0
842
843 #define CMD_VERTEX_ELEMENT 0x7809
844 # define BRW_VE0_INDEX_SHIFT 27
845 # define GEN6_VE0_INDEX_SHIFT 26
846 # define BRW_VE0_FORMAT_SHIFT 16
847 # define BRW_VE0_VALID (1 << 26)
848 # define GEN6_VE0_VALID (1 << 25)
849 # define BRW_VE0_SRC_OFFSET_SHIFT 0
850 # define BRW_VE1_COMPONENT_NOSTORE 0
851 # define BRW_VE1_COMPONENT_STORE_SRC 1
852 # define BRW_VE1_COMPONENT_STORE_0 2
853 # define BRW_VE1_COMPONENT_STORE_1_FLT 3
854 # define BRW_VE1_COMPONENT_STORE_1_INT 4
855 # define BRW_VE1_COMPONENT_STORE_VID 5
856 # define BRW_VE1_COMPONENT_STORE_IID 6
857 # define BRW_VE1_COMPONENT_STORE_PID 7
858 # define BRW_VE1_COMPONENT_0_SHIFT 28
859 # define BRW_VE1_COMPONENT_1_SHIFT 24
860 # define BRW_VE1_COMPONENT_2_SHIFT 20
861 # define BRW_VE1_COMPONENT_3_SHIFT 16
862 # define BRW_VE1_DST_OFFSET_SHIFT 0
863
864 #define CMD_INDEX_BUFFER 0x780a
865 #define CMD_VF_STATISTICS_965 0x780b
866 #define CMD_VF_STATISTICS_GM45 0x680b
867 #define _3DSTATE_CC_STATE_POINTERS 0x780e /* GEN6+ */
868
869 #define _3DSTATE_URB 0x7805 /* GEN6+ */
870 # define GEN6_URB_VS_SIZE_SHIFT 16
871 # define GEN6_URB_VS_ENTRIES_SHIFT 0
872 # define GEN6_URB_GS_ENTRIES_SHIFT 8
873 # define GEN6_URB_GS_SIZE_SHIFT 0
874
875 #define _3DSTATE_VIEWPORT_STATE_POINTERS 0x780d /* GEN6+ */
876 # define GEN6_CC_VIEWPORT_MODIFY (1 << 12)
877 # define GEN6_SF_VIEWPORT_MODIFY (1 << 11)
878 # define GEN6_CLIP_VIEWPORT_MODIFY (1 << 10)
879
880 #define _3DSTATE_SCISSOR_STATE_POINTERS 0x780f /* GEN6+ */
881
882 #define _3DSTATE_VS 0x7810 /* GEN6+ */
883 /* DW2 */
884 # define GEN6_VS_SPF_MODE (1 << 31)
885 # define GEN6_VS_VECTOR_MASK_ENABLE (1 << 30)
886 # define GEN6_VS_SAMPLER_COUNT_SHIFT 27
887 # define GEN6_VS_BINDING_TABLE_ENTRY_COUNT_SHIFT 18
888 # define GEN6_VS_FLOATING_POINT_MODE_IEEE_754 (0 << 16)
889 # define GEN6_VS_FLOATING_POINT_MODE_ALT (1 << 16)
890 /* DW4 */
891 # define GEN6_VS_DISPATCH_START_GRF_SHIFT 20
892 # define GEN6_VS_URB_READ_LENGTH_SHIFT 11
893 # define GEN6_VS_URB_ENTRY_READ_OFFSET_SHIFT 4
894 /* DW5 */
895 # define GEN6_VS_MAX_THREADS_SHIFT 25
896 # define GEN6_VS_STATISTICS_ENABLE (1 << 10)
897 # define GEN6_VS_CACHE_DISABLE (1 << 1)
898 # define GEN6_VS_ENABLE (1 << 0)
899
900 #define _3DSTATE_GS 0x7811 /* GEN6+ */
901 /* DW2 */
902 # define GEN6_GS_SPF_MODE (1 << 31)
903 # define GEN6_GS_VECTOR_MASK_ENABLE (1 << 30)
904 # define GEN6_GS_SAMPLER_COUNT_SHIFT 27
905 # define GEN6_GS_BINDING_TABLE_ENTRY_COUNT_SHIFT 18
906 /* DW4 */
907 # define GEN6_GS_URB_READ_LENGTH_SHIFT 11
908 # define GEN6_GS_URB_ENTRY_READ_OFFSET_SHIFT 4
909 # define GEN6_GS_DISPATCH_START_GRF_SHIFT 0
910 /* DW5 */
911 # define GEN6_GS_MAX_THREADS_SHIFT 25
912 # define GEN6_GS_STATISTICS_ENABLE (1 << 10)
913 # define GEN6_GS_SO_STATISTICS_ENABLE (1 << 9)
914 # define GEN6_GS_RENDERING_ENABLE (1 << 8)
915 /* DW6 */
916 # define GEN6_GS_ENABLE (1 << 15)
917
918 #define _3DSTATE_CLIP 0x7812 /* GEN6+ */
919 /* DW1 */
920 # define GEN6_CLIP_STATISTICS_ENABLE (1 << 10)
921 /**
922 * Just does cheap culling based on the clip distance. Bits must be
923 * disjoint with USER_CLIP_CLIP_DISTANCE bits.
924 */
925 # define GEN6_USER_CLIP_CULL_DISTANCES_SHIFT 0
926 /* DW2 */
927 # define GEN6_CLIP_ENABLE (1 << 31)
928 # define GEN6_CLIP_API_OGL (0 << 30)
929 # define GEN6_CLIP_API_D3D (1 << 30)
930 # define GEN6_CLIP_XY_TEST (1 << 28)
931 # define GEN6_CLIP_Z_TEST (1 << 27)
932 # define GEN6_CLIP_GB_TEST (1 << 26)
933 /** 8-bit field of which user clip distances to clip aganist. */
934 # define GEN6_USER_CLIP_CLIP_DISTANCES_SHIFT 16
935 # define GEN6_CLIP_MODE_NORMAL (0 << 13)
936 # define GEN6_CLIP_MODE_REJECT_ALL (3 << 13)
937 # define GEN6_CLIP_MODE_ACCEPT_ALL (4 << 13)
938 # define GEN6_CLIP_PERSPECTIVE_DIVIDE_DISABLE (1 << 9)
939 # define GEN6_CLIP_BARYCENTRIC_ENABLE (1 << 8)
940 # define GEN6_CLIP_TRI_PROVOKE_SHIFT 4
941 # define GEN6_CLIP_LINE_PROVOKE_SHIFT 2
942 # define GEN6_CLIP_TRIFAN_PROVOKE_SHIFT 0
943 /* DW3 */
944 # define GEN6_CLIP_MIN_POINT_WIDTH_SHIFT 17
945 # define GEN6_CLIP_MAX_POINT_WIDTH_SHIFT 6
946 # define GEN6_CLIP_FORCE_ZERO_RTAINDEX (1 << 5)
947
948 #define _3DSTATE_SF 0x7813 /* GEN6+ */
949 /* DW1 */
950 # define GEN6_SF_NUM_OUTPUTS_SHIFT 22
951 # define GEN6_SF_SWIZZLE_ENABLE (1 << 21)
952 # define GEN6_SF_POINT_SPRITE_LOWERLEFT (1 << 20)
953 # define GEN6_SF_URB_ENTRY_READ_LENGTH_SHIFT 11
954 # define GEN6_SF_URB_ENTRY_READ_OFFSET_SHIFT 4
955 /* DW2 */
956 # define GEN6_SF_LEGACY_GLOBAL_DEPTH_BIAS (1 << 11)
957 # define GEN6_SF_STATISTICS_ENABLE (1 << 10)
958 # define GEN6_SF_GLOBAL_DEPTH_OFFSET_SOLID (1 << 9)
959 # define GEN6_SF_GLOBAL_DEPTH_OFFSET_WIREFRAME (1 << 8)
960 # define GEN6_SF_GLOBAL_DEPTH_OFFSET_POINT (1 << 7)
961 # define GEN6_SF_FRONT_SOLID (0 << 5)
962 # define GEN6_SF_FRONT_WIREFRAME (1 << 5)
963 # define GEN6_SF_FRONT_POINT (2 << 5)
964 # define GEN6_SF_BACK_SOLID (0 << 3)
965 # define GEN6_SF_BACK_WIREFRAME (1 << 3)
966 # define GEN6_SF_BACK_POINT (2 << 3)
967 # define GEN6_SF_VIEWPORT_TRANSFORM_ENABLE (1 << 1)
968 # define GEN6_SF_WINDING_CCW (1 << 0)
969 /* DW3 */
970 # define GEN6_SF_LINE_AA_ENABLE (1 << 31)
971 # define GEN6_SF_CULL_BOTH (0 << 29)
972 # define GEN6_SF_CULL_NONE (1 << 29)
973 # define GEN6_SF_CULL_FRONT (2 << 29)
974 # define GEN6_SF_CULL_BACK (3 << 29)
975 # define GEN6_SF_LINE_WIDTH_SHIFT 18 /* U3.7 */
976 # define GEN6_SF_LINE_END_CAP_WIDTH_0_5 (0 << 16)
977 # define GEN6_SF_LINE_END_CAP_WIDTH_1_0 (1 << 16)
978 # define GEN6_SF_LINE_END_CAP_WIDTH_2_0 (2 << 16)
979 # define GEN6_SF_LINE_END_CAP_WIDTH_4_0 (3 << 16)
980 # define GEN6_SF_SCISSOR_ENABLE (1 << 11)
981 # define GEN6_SF_MSRAST_OFF_PIXEL (0 << 8)
982 # define GEN6_SF_MSRAST_OFF_PATTERN (1 << 8)
983 # define GEN6_SF_MSRAST_ON_PIXEL (2 << 8)
984 # define GEN6_SF_MSRAST_ON_PATTERN (3 << 8)
985 /* DW4 */
986 # define GEN6_SF_TRI_PROVOKE_SHIFT 29
987 # define GEN6_SF_LINE_PROVOKE_SHIFT 27
988 # define GEN6_SF_TRIFAN_PROVOKE_SHIFT 25
989 # define GEN6_SF_LINE_AA_MODE_MANHATTAN (0 << 14)
990 # define GEN6_SF_LINE_AA_MODE_TRUE (1 << 14)
991 # define GEN6_SF_VERTEX_SUBPIXEL_8BITS (0 << 12)
992 # define GEN6_SF_VERTEX_SUBPIXEL_4BITS (1 << 12)
993 # define GEN6_SF_USE_STATE_POINT_WIDTH (1 << 11)
994 # define GEN6_SF_POINT_WIDTH_SHIFT 0 /* U8.3 */
995 /* DW5: depth offset constant */
996 /* DW6: depth offset scale */
997 /* DW7: depth offset clamp */
998 /* DW8 */
999 # define ATTRIBUTE_1_OVERRIDE_W (1 << 31)
1000 # define ATTRIBUTE_1_OVERRIDE_Z (1 << 30)
1001 # define ATTRIBUTE_1_OVERRIDE_Y (1 << 29)
1002 # define ATTRIBUTE_1_OVERRIDE_X (1 << 28)
1003 # define ATTRIBUTE_1_CONST_SOURCE_SHIFT 25
1004 # define ATTRIBUTE_1_SWIZZLE_SHIFT 22
1005 # define ATTRIBUTE_1_SOURCE_SHIFT 16
1006 # define ATTRIBUTE_0_OVERRIDE_W (1 << 15)
1007 # define ATTRIBUTE_0_OVERRIDE_Z (1 << 14)
1008 # define ATTRIBUTE_0_OVERRIDE_Y (1 << 13)
1009 # define ATTRIBUTE_0_OVERRIDE_X (1 << 12)
1010 # define ATTRIBUTE_0_CONST_SOURCE_SHIFT 9
1011 # define ATTRIBUTE_0_SWIZZLE_SHIFT 6
1012 # define ATTRIBUTE_0_SOURCE_SHIFT 0
1013
1014 # define ATTRIBUTE_SWIZZLE_INPUTATTR 0
1015 # define ATTRIBUTE_SWIZZLE_INPUTATTR_FACING 1
1016 # define ATTRIBUTE_SWIZZLE_INPUTATTR_W 2
1017 # define ATTRIBUTE_SWIZZLE_INPUTATTR_FACING_W 3
1018 # define ATTRIBUTE_SWIZZLE_SHIFT 6
1019
1020 /* DW16: Point sprite texture coordinate enables */
1021 /* DW17: Constant interpolation enables */
1022 /* DW18: attr 0-7 wrap shortest enables */
1023 /* DW19: attr 8-16 wrap shortest enables */
1024
1025 #define _3DSTATE_WM 0x7814 /* GEN6+ */
1026 /* DW1: kernel pointer */
1027 /* DW2 */
1028 # define GEN6_WM_SPF_MODE (1 << 31)
1029 # define GEN6_WM_VECTOR_MASK_ENABLE (1 << 30)
1030 # define GEN6_WM_SAMPLER_COUNT_SHIFT 27
1031 # define GEN6_WM_BINDING_TABLE_ENTRY_COUNT_SHIFT 18
1032 # define GEN6_WM_FLOATING_POINT_MODE_IEEE_754 (0 << 16)
1033 # define GEN6_WM_FLOATING_POINT_MODE_ALT (1 << 16)
1034 /* DW3: scratch space */
1035 /* DW4 */
1036 # define GEN6_WM_STATISTICS_ENABLE (1 << 31)
1037 # define GEN6_WM_DEPTH_CLEAR (1 << 30)
1038 # define GEN6_WM_DEPTH_RESOLVE (1 << 28)
1039 # define GEN6_WM_HIERARCHICAL_DEPTH_RESOLVE (1 << 27)
1040 # define GEN6_WM_DISPATCH_START_GRF_SHIFT_0 16
1041 # define GEN6_WM_DISPATCH_START_GRF_SHIFT_1 8
1042 # define GEN6_WM_DISPATCH_START_GRF_SHIFT_2 0
1043 /* DW5 */
1044 # define GEN6_WM_MAX_THREADS_SHIFT 25
1045 # define GEN6_WM_KILL_ENABLE (1 << 22)
1046 # define GEN6_WM_COMPUTED_DEPTH (1 << 21)
1047 # define GEN6_WM_USES_SOURCE_DEPTH (1 << 20)
1048 # define GEN6_WM_DISPATCH_ENABLE (1 << 19)
1049 # define GEN6_WM_LINE_END_CAP_AA_WIDTH_0_5 (0 << 16)
1050 # define GEN6_WM_LINE_END_CAP_AA_WIDTH_1_0 (1 << 16)
1051 # define GEN6_WM_LINE_END_CAP_AA_WIDTH_2_0 (2 << 16)
1052 # define GEN6_WM_LINE_END_CAP_AA_WIDTH_4_0 (3 << 16)
1053 # define GEN6_WM_LINE_AA_WIDTH_0_5 (0 << 14)
1054 # define GEN6_WM_LINE_AA_WIDTH_1_0 (1 << 14)
1055 # define GEN6_WM_LINE_AA_WIDTH_2_0 (2 << 14)
1056 # define GEN6_WM_LINE_AA_WIDTH_4_0 (3 << 14)
1057 # define GEN6_WM_POLYGON_STIPPLE_ENABLE (1 << 13)
1058 # define GEN6_WM_LINE_STIPPLE_ENABLE (1 << 11)
1059 # define GEN6_WM_OMASK_TO_RENDER_TARGET (1 << 9)
1060 # define GEN6_WM_USES_SOURCE_W (1 << 8)
1061 # define GEN6_WM_DUAL_SOURCE_BLEND_ENABLE (1 << 7)
1062 # define GEN6_WM_32_DISPATCH_ENABLE (1 << 2)
1063 # define GEN6_WM_16_DISPATCH_ENABLE (1 << 1)
1064 # define GEN6_WM_8_DISPATCH_ENABLE (1 << 0)
1065 /* DW6 */
1066 # define GEN6_WM_NUM_SF_OUTPUTS_SHIFT 20
1067 # define GEN6_WM_POSOFFSET_NONE (0 << 18)
1068 # define GEN6_WM_POSOFFSET_CENTROID (2 << 18)
1069 # define GEN6_WM_POSOFFSET_SAMPLE (3 << 18)
1070 # define GEN6_WM_POSITION_ZW_PIXEL (0 << 16)
1071 # define GEN6_WM_POSITION_ZW_CENTROID (2 << 16)
1072 # define GEN6_WM_POSITION_ZW_SAMPLE (3 << 16)
1073 # define GEN6_WM_NONPERSPECTIVE_SAMPLE_BARYCENTRIC (1 << 15)
1074 # define GEN6_WM_NONPERSPECTIVE_CENTROID_BARYCENTRIC (1 << 14)
1075 # define GEN6_WM_NONPERSPECTIVE_PIXEL_BARYCENTRIC (1 << 13)
1076 # define GEN6_WM_PERSPECTIVE_SAMPLE_BARYCENTRIC (1 << 12)
1077 # define GEN6_WM_PERSPECTIVE_CENTROID_BARYCENTRIC (1 << 11)
1078 # define GEN6_WM_PERSPECTIVE_PIXEL_BARYCENTRIC (1 << 10)
1079 # define GEN6_WM_POINT_RASTRULE_UPPER_RIGHT (1 << 9)
1080 # define GEN6_WM_MSRAST_OFF_PIXEL (0 << 1)
1081 # define GEN6_WM_MSRAST_OFF_PATTERN (1 << 1)
1082 # define GEN6_WM_MSRAST_ON_PIXEL (2 << 1)
1083 # define GEN6_WM_MSRAST_ON_PATTERN (3 << 1)
1084 # define GEN6_WM_MSDISPMODE_PERPIXEL (1 << 0)
1085 /* DW7: kernel 1 pointer */
1086 /* DW8: kernel 2 pointer */
1087
1088 #define _3DSTATE_CONSTANT_VS 0x7815 /* GEN6+ */
1089 #define _3DSTATE_CONSTANT_GS 0x7816 /* GEN6+ */
1090 #define _3DSTATE_CONSTANT_PS 0x7817 /* GEN6+ */
1091 # define GEN6_CONSTANT_BUFFER_3_ENABLE (1 << 15)
1092 # define GEN6_CONSTANT_BUFFER_2_ENABLE (1 << 14)
1093 # define GEN6_CONSTANT_BUFFER_1_ENABLE (1 << 13)
1094 # define GEN6_CONSTANT_BUFFER_0_ENABLE (1 << 12)
1095
1096 #define _3DSTATE_SAMPLE_MASK 0x7818 /* GEN6+ */
1097
1098 #define _3DSTATE_DRAWING_RECTANGLE 0x7900
1099 #define _3DSTATE_BLEND_CONSTANT_COLOR 0x7901
1100 #define _3DSTATE_CHROMA_KEY 0x7904
1101 #define _3DSTATE_DEPTH_BUFFER 0x7905
1102 #define _3DSTATE_POLY_STIPPLE_OFFSET 0x7906
1103 #define _3DSTATE_POLY_STIPPLE_PATTERN 0x7907
1104 #define _3DSTATE_LINE_STIPPLE_PATTERN 0x7908
1105 #define _3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP 0x7909
1106 #define _3DSTATE_AA_LINE_PARAMETERS 0x790a /* G45+ */
1107
1108 #define _3DSTATE_GS_SVB_INDEX 0x790b /* CTG+ */
1109 /* DW1 */
1110 # define SVB_INDEX_SHIFT 29
1111 # define SVB_LOAD_INTERNAL_VERTEX_COUNT (1 << 0) /* SNB+ */
1112 /* DW2: SVB index */
1113 /* DW3: SVB maximum index */
1114
1115 #define _3DSTATE_MULTISAMPLE 0x790d /* GEN6+ */
1116 /* DW1 */
1117 # define MS_PIXEL_LOCATION_CENTER (0 << 4)
1118 # define MS_PIXEL_LOCATION_UPPER_LEFT (1 << 4)
1119 # define MS_NUMSAMPLES_1 (0 << 1)
1120 # define MS_NUMSAMPLES_4 (2 << 1)
1121 # define MS_NUMSAMPLES_8 (3 << 1)
1122
1123 #define _3DSTATE_STENCIL_BUFFER 0x790e /* ILK, SNB */
1124 #define _3DSTATE_HIER_DEPTH_BUFFER 0x790f /* ILK, SNB */
1125
1126 #define _3DSTATE_CLEAR_PARAMS 0x7910 /* ILK+ */
1127 # define DEPTH_CLEAR_VALID (1 << 15)
1128 /* DW1: depth clear value */
1129
1130 #define CMD_PIPE_CONTROL 0x7a00
1131
1132 #define CMD_3D_PRIM 0x7b00
1133
1134 #define CMD_MI_FLUSH 0x0200
1135
1136
1137 /* Various values from the R0 vertex header:
1138 */
1139 #define R02_PRIM_END 0x1
1140 #define R02_PRIM_START 0x2
1141
1142 #include "intel_chipset.h"
1143
1144 #endif