Use SIGTERM in replace of SIGQUIT
[platform/upstream/intel-gpu-tools.git] / lib / gen6_render.h
1 #ifndef GEN6_RENDER_H
2 #define GEN6_RENDER_H
3
4 #include <stdint.h>
5
6 #define GEN6_3D(Pipeline,Opcode,Subopcode) ((3 << 29) | \
7                                            ((Pipeline) << 27) | \
8                                            ((Opcode) << 24) | \
9                                            ((Subopcode) << 16))
10
11 #define GEN6_STATE_BASE_ADDRESS                 GEN6_3D(0, 1, 1)
12 #define GEN6_STATE_SIP                          GEN6_3D(0, 1, 2)
13
14 #define GEN6_PIPELINE_SELECT                    GEN6_3D(1, 1, 4)
15
16 #define GEN6_MEDIA_STATE_POINTERS               GEN6_3D(2, 0, 0)
17 #define GEN6_MEDIA_OBJECT                       GEN6_3D(2, 1, 0)
18
19 #define GEN6_3DSTATE_BINDING_TABLE_POINTERS     GEN6_3D(3, 0, 1)
20 # define GEN6_3DSTATE_BINDING_TABLE_MODIFY_PS  (1 << 12)/* for GEN6 */
21 # define GEN6_3DSTATE_BINDING_TABLE_MODIFY_GS  (1 << 9) /* for GEN6 */
22 # define GEN6_3DSTATE_BINDING_TABLE_MODIFY_VS  (1 << 8) /* for GEN6 */
23
24 #define GEN6_3DSTATE_VERTEX_BUFFERS             GEN6_3D(3, 0, 8)
25 #define GEN6_3DSTATE_VERTEX_ELEMENTS            GEN6_3D(3, 0, 9)
26 #define GEN6_3DSTATE_INDEX_BUFFER               GEN6_3D(3, 0, 0xa)
27 #define GEN6_3DSTATE_VF_STATISTICS              GEN6_3D(3, 0, 0xb)
28
29 #define GEN6_3DSTATE_DRAWING_RECTANGLE          GEN6_3D(3, 1, 0)
30 #define GEN6_3DSTATE_CONSTANT_COLOR             GEN6_3D(3, 1, 1)
31 #define GEN6_3DSTATE_SAMPLER_PALETTE_LOAD       GEN6_3D(3, 1, 2)
32 #define GEN6_3DSTATE_CHROMA_KEY                 GEN6_3D(3, 1, 4)
33 #define GEN6_3DSTATE_DEPTH_BUFFER               GEN6_3D(3, 1, 5)
34 # define GEN6_3DSTATE_DEPTH_BUFFER_TYPE_SHIFT   29
35 # define GEN6_3DSTATE_DEPTH_BUFFER_FORMAT_SHIFT 18
36
37 #define GEN6_3DSTATE_POLY_STIPPLE_OFFSET                GEN6_3D(3, 1, 6)
38 #define GEN6_3DSTATE_POLY_STIPPLE_PATTERN       GEN6_3D(3, 1, 7)
39 #define GEN6_3DSTATE_LINE_STIPPLE               GEN6_3D(3, 1, 8)
40 #define GEN6_3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP  GEN6_3D(3, 1, 9)
41 /* These two are BLC and CTG only, not BW or CL */
42 #define GEN6_3DSTATE_AA_LINE_PARAMS             GEN6_3D(3, 1, 0xa)
43 #define GEN6_3DSTATE_GS_SVB_INDEX               GEN6_3D(3, 1, 0xb)
44
45 #define GEN6_3DPRIMITIVE                                GEN6_3D(3, 3, 0)
46
47 #define GEN6_3DSTATE_CLEAR_PARAMS               GEN6_3D(3, 1, 0x10)
48 /* DW1 */
49 # define GEN6_3DSTATE_DEPTH_CLEAR_VALID         (1 << 15)
50
51 #define GEN6_3DSTATE_SAMPLER_STATE_POINTERS     GEN6_3D(3, 0, 0x02)
52 # define GEN6_3DSTATE_SAMPLER_STATE_MODIFY_PS   (1 << 12)
53 # define GEN6_3DSTATE_SAMPLER_STATE_MODIFY_GS   (1 << 9)
54 # define GEN6_3DSTATE_SAMPLER_STATE_MODIFY_VS   (1 << 8)
55
56 #define GEN6_3DSTATE_URB                        GEN6_3D(3, 0, 0x05)
57 /* DW1 */
58 # define GEN6_3DSTATE_URB_VS_SIZE_SHIFT         16
59 # define GEN6_3DSTATE_URB_VS_ENTRIES_SHIFT      0
60 /* DW2 */
61 # define GEN6_3DSTATE_URB_GS_ENTRIES_SHIFT      8
62 # define GEN6_3DSTATE_URB_GS_SIZE_SHIFT         0
63
64 #define GEN6_3DSTATE_VIEWPORT_STATE_POINTERS    GEN6_3D(3, 0, 0x0d)
65 # define GEN6_3DSTATE_VIEWPORT_STATE_MODIFY_CC          (1 << 12)
66 # define GEN6_3DSTATE_VIEWPORT_STATE_MODIFY_SF          (1 << 11)
67 # define GEN6_3DSTATE_VIEWPORT_STATE_MODIFY_CLIP        (1 << 10)
68
69 #define GEN6_3DSTATE_CC_STATE_POINTERS          GEN6_3D(3, 0, 0x0e)
70
71 #define GEN6_3DSTATE_VS                         GEN6_3D(3, 0, 0x10)
72
73 #define GEN6_3DSTATE_GS                         GEN6_3D(3, 0, 0x11)
74 /* DW4 */
75 # define GEN6_3DSTATE_GS_DISPATCH_START_GRF_SHIFT       0
76
77 #define GEN6_3DSTATE_CLIP                       GEN6_3D(3, 0, 0x12)
78
79 #define GEN6_3DSTATE_SF                         GEN6_3D(3, 0, 0x13)
80 /* DW1 */
81 # define GEN6_3DSTATE_SF_NUM_OUTPUTS_SHIFT              22
82 # define GEN6_3DSTATE_SF_URB_ENTRY_READ_LENGTH_SHIFT    11
83 # define GEN6_3DSTATE_SF_URB_ENTRY_READ_OFFSET_SHIFT    4
84 /* DW2 */
85 /* DW3 */
86 # define GEN6_3DSTATE_SF_CULL_BOTH                      (0 << 29)
87 # define GEN6_3DSTATE_SF_CULL_NONE                      (1 << 29)
88 # define GEN6_3DSTATE_SF_CULL_FRONT                     (2 << 29)
89 # define GEN6_3DSTATE_SF_CULL_BACK                      (3 << 29)
90 /* DW4 */
91 # define GEN6_3DSTATE_SF_TRI_PROVOKE_SHIFT              29
92 # define GEN6_3DSTATE_SF_LINE_PROVOKE_SHIFT             27
93 # define GEN6_3DSTATE_SF_TRIFAN_PROVOKE_SHIFT           25
94
95 #define GEN6_3DSTATE_WM                         GEN6_3D(3, 0, 0x14)
96 /* DW2 */
97 # define GEN6_3DSTATE_WM_SAMPLER_COUNT_SHIFT                    27
98 # define GEN6_3DSTATE_WM_BINDING_TABLE_ENTRY_COUNT_SHIFT        18
99 /* DW4 */
100 # define GEN6_3DSTATE_WM_DISPATCH_START_GRF_0_SHIFT             16
101 /* DW5 */
102 # define GEN6_3DSTATE_WM_MAX_THREADS_SHIFT                      25
103 # define GEN6_3DSTATE_WM_DISPATCH_ENABLE                        (1 << 19)
104 # define GEN6_3DSTATE_WM_16_DISPATCH_ENABLE                     (1 << 1)
105 # define GEN6_3DSTATE_WM_8_DISPATCH_ENABLE                      (1 << 0)
106 /* DW6 */
107 # define GEN6_3DSTATE_WM_NUM_SF_OUTPUTS_SHIFT                   20
108 # define GEN6_3DSTATE_WM_NONPERSPECTIVE_SAMPLE_BARYCENTRIC      (1 << 15)
109 # define GEN6_3DSTATE_WM_NONPERSPECTIVE_CENTROID_BARYCENTRIC    (1 << 14)
110 # define GEN6_3DSTATE_WM_NONPERSPECTIVE_PIXEL_BARYCENTRIC       (1 << 13)
111 # define GEN6_3DSTATE_WM_PERSPECTIVE_SAMPLE_BARYCENTRIC         (1 << 12)
112 # define GEN6_3DSTATE_WM_PERSPECTIVE_CENTROID_BARYCENTRIC       (1 << 11)
113 # define GEN6_3DSTATE_WM_PERSPECTIVE_PIXEL_BARYCENTRIC          (1 << 10)
114
115
116 #define GEN6_3DSTATE_CONSTANT_VS                GEN6_3D(3, 0, 0x15)
117 #define GEN6_3DSTATE_CONSTANT_GS                GEN6_3D(3, 0, 0x16)
118 #define GEN6_3DSTATE_CONSTANT_PS                GEN6_3D(3, 0, 0x17)
119
120 #define GEN6_3DSTATE_SAMPLE_MASK                GEN6_3D(3, 0, 0x18)
121
122 #define GEN6_3DSTATE_MULTISAMPLE                GEN6_3D(3, 1, 0x0d)
123 /* DW1 */
124 # define GEN6_3DSTATE_MULTISAMPLE_PIXEL_LOCATION_CENTER         (0 << 4)
125 # define GEN6_3DSTATE_MULTISAMPLE_PIXEL_LOCATION_UPPER_LEFT     (1 << 4)
126 # define GEN6_3DSTATE_MULTISAMPLE_NUMSAMPLES_1                  (0 << 1)
127 # define GEN6_3DSTATE_MULTISAMPLE_NUMSAMPLES_4                  (2 << 1)
128 # define GEN6_3DSTATE_MULTISAMPLE_NUMSAMPLES_8                  (3 << 1)
129
130 #define PIPELINE_SELECT_3D              0
131 #define PIPELINE_SELECT_MEDIA           1
132
133 /* for GEN6_STATE_BASE_ADDRESS */
134 #define BASE_ADDRESS_MODIFY             (1 << 0)
135
136 /* for GEN6_PIPE_CONTROL */
137 #define GEN6_PIPE_CONTROL_NOWRITE       (0 << 14)
138 #define GEN6_PIPE_CONTROL_WRITE_QWORD   (1 << 14)
139 #define GEN6_PIPE_CONTROL_WRITE_DEPTH   (2 << 14)
140 #define GEN6_PIPE_CONTROL_WRITE_TIME    (3 << 14)
141 #define GEN6_PIPE_CONTROL_DEPTH_STALL   (1 << 13)
142 #define GEN6_PIPE_CONTROL_WC_FLUSH      (1 << 12)
143 #define GEN6_PIPE_CONTROL_IS_FLUSH      (1 << 11)
144 #define GEN6_PIPE_CONTROL_TC_FLUSH      (1 << 10)
145 #define GEN6_PIPE_CONTROL_NOTIFY_ENABLE (1 << 8)
146 #define GEN6_PIPE_CONTROL_GLOBAL_GTT    (1 << 2)
147 #define GEN6_PIPE_CONTROL_LOCAL_PGTT    (0 << 2)
148 #define GEN6_PIPE_CONTROL_DEPTH_CACHE_FLUSH     (1 << 0)
149
150 /* VERTEX_BUFFER_STATE Structure */
151 #define VB0_BUFFER_INDEX_SHIFT  26
152 #define VB0_VERTEXDATA                  (0 << 20)
153 #define VB0_INSTANCEDATA                (1 << 20)
154 #define VB0_BUFFER_PITCH_SHIFT          0
155 #define VB0_NULL_VERTEX_BUFFER          (1 << 13)
156
157 /* VERTEX_ELEMENT_STATE Structure */
158 #define VE0_VERTEX_BUFFER_INDEX_SHIFT   26 /* for GEN6 */
159 #define VE0_VALID                       (1 << 25) /* for GEN6 */
160 #define VE0_FORMAT_SHIFT                16
161 #define VE0_OFFSET_SHIFT                0
162 #define VE1_VFCOMPONENT_0_SHIFT         28
163 #define VE1_VFCOMPONENT_1_SHIFT         24
164 #define VE1_VFCOMPONENT_2_SHIFT         20
165 #define VE1_VFCOMPONENT_3_SHIFT         16
166 #define VE1_DESTINATION_ELEMENT_OFFSET_SHIFT    0
167
168 /* 3DPRIMITIVE bits */
169 #define GEN6_3DPRIMITIVE_VERTEX_SEQUENTIAL (0 << 15)
170 #define GEN6_3DPRIMITIVE_VERTEX_RANDOM    (1 << 15)
171 /* Primitive types are in gen6_defines.h */
172 #define GEN6_3DPRIMITIVE_TOPOLOGY_SHIFT   10
173
174 #define GEN6_SVG_CTL                   0x7400
175
176 #define GEN6_SVG_CTL_GS_BA             (0 << 8)
177 #define GEN6_SVG_CTL_SS_BA             (1 << 8)
178 #define GEN6_SVG_CTL_IO_BA             (2 << 8)
179 #define GEN6_SVG_CTL_GS_AUB            (3 << 8)
180 #define GEN6_SVG_CTL_IO_AUB            (4 << 8)
181 #define GEN6_SVG_CTL_SIP                       (5 << 8)
182
183 #define GEN6_SVG_RDATA                 0x7404
184 #define GEN6_SVG_WORK_CTL              0x7408
185
186 #define GEN6_VF_CTL                    0x7500
187
188 #define GEN6_VF_CTL_SNAPSHOT_COMPLETE              (1 << 31)
189 #define GEN6_VF_CTL_SNAPSHOT_MUX_SELECT_THREADID           (0 << 8)
190 #define GEN6_VF_CTL_SNAPSHOT_MUX_SELECT_VF_DEBUG           (1 << 8)
191 #define GEN6_VF_CTL_SNAPSHOT_TYPE_VERTEX_SEQUENCE   (0 << 4)
192 #define GEN6_VF_CTL_SNAPSHOT_TYPE_VERTEX_INDEX     (1 << 4)
193 #define GEN6_VF_CTL_SKIP_INITIAL_PRIMITIVES        (1 << 3)
194 #define GEN6_VF_CTL_MAX_PRIMITIVES_LIMIT_ENABLE    (1 << 2)
195 #define GEN6_VF_CTL_VERTEX_RANGE_LIMIT_ENABLE      (1 << 1)
196 #define GEN6_VF_CTL_SNAPSHOT_ENABLE                (1 << 0)
197
198 #define GEN6_VF_STRG_VAL                       0x7504
199 #define GEN6_VF_STR_VL_OVR             0x7508
200 #define GEN6_VF_VC_OVR                 0x750c
201 #define GEN6_VF_STR_PSKIP              0x7510
202 #define GEN6_VF_MAX_PRIM                       0x7514
203 #define GEN6_VF_RDATA                  0x7518
204
205 #define GEN6_VS_CTL                    0x7600
206 #define GEN6_VS_CTL_SNAPSHOT_COMPLETE              (1 << 31)
207 #define GEN6_VS_CTL_SNAPSHOT_MUX_VERTEX_0          (0 << 8)
208 #define GEN6_VS_CTL_SNAPSHOT_MUX_VERTEX_1          (1 << 8)
209 #define GEN6_VS_CTL_SNAPSHOT_MUX_VALID_COUNT       (2 << 8)
210 #define GEN6_VS_CTL_SNAPSHOT_MUX_VS_KERNEL_POINTER  (3 << 8)
211 #define GEN6_VS_CTL_SNAPSHOT_ALL_THREADS                   (1 << 2)
212 #define GEN6_VS_CTL_THREAD_SNAPSHOT_ENABLE         (1 << 1)
213 #define GEN6_VS_CTL_SNAPSHOT_ENABLE                (1 << 0)
214
215 #define GEN6_VS_STRG_VAL                       0x7604
216 #define GEN6_VS_RDATA                  0x7608
217
218 #define GEN6_SF_CTL                    0x7b00
219 #define GEN6_SF_CTL_SNAPSHOT_COMPLETE              (1 << 31)
220 #define GEN6_SF_CTL_SNAPSHOT_MUX_VERTEX_0_FF_ID    (0 << 8)
221 #define GEN6_SF_CTL_SNAPSHOT_MUX_VERTEX_0_REL_COUNT (1 << 8)
222 #define GEN6_SF_CTL_SNAPSHOT_MUX_VERTEX_1_FF_ID    (2 << 8)
223 #define GEN6_SF_CTL_SNAPSHOT_MUX_VERTEX_1_REL_COUNT (3 << 8)
224 #define GEN6_SF_CTL_SNAPSHOT_MUX_VERTEX_2_FF_ID    (4 << 8)
225 #define GEN6_SF_CTL_SNAPSHOT_MUX_VERTEX_2_REL_COUNT (5 << 8)
226 #define GEN6_SF_CTL_SNAPSHOT_MUX_VERTEX_COUNT      (6 << 8)
227 #define GEN6_SF_CTL_SNAPSHOT_MUX_SF_KERNEL_POINTER  (7 << 8)
228 #define GEN6_SF_CTL_MIN_MAX_PRIMITIVE_RANGE_ENABLE  (1 << 4)
229 #define GEN6_SF_CTL_DEBUG_CLIP_RECTANGLE_ENABLE    (1 << 3)
230 #define GEN6_SF_CTL_SNAPSHOT_ALL_THREADS                   (1 << 2)
231 #define GEN6_SF_CTL_THREAD_SNAPSHOT_ENABLE         (1 << 1)
232 #define GEN6_SF_CTL_SNAPSHOT_ENABLE                (1 << 0)
233
234 #define GEN6_SF_STRG_VAL                       0x7b04
235 #define GEN6_SF_RDATA                  0x7b18
236
237 #define GEN6_WIZ_CTL                   0x7c00
238 #define GEN6_WIZ_CTL_SNAPSHOT_COMPLETE             (1 << 31)
239 #define GEN6_WIZ_CTL_SUBSPAN_INSTANCE_SHIFT        16
240 #define GEN6_WIZ_CTL_SNAPSHOT_MUX_WIZ_KERNEL_POINTER   (0 << 8)
241 #define GEN6_WIZ_CTL_SNAPSHOT_MUX_SUBSPAN_INSTANCE     (1 << 8)
242 #define GEN6_WIZ_CTL_SNAPSHOT_MUX_PRIMITIVE_SEQUENCE   (2 << 8)
243 #define GEN6_WIZ_CTL_SINGLE_SUBSPAN_DISPATCH          (1 << 6)
244 #define GEN6_WIZ_CTL_IGNORE_COLOR_SCOREBOARD_STALLS    (1 << 5)
245 #define GEN6_WIZ_CTL_ENABLE_SUBSPAN_INSTANCE_COMPARE   (1 << 4)
246 #define GEN6_WIZ_CTL_USE_UPSTREAM_SNAPSHOT_FLAG       (1 << 3)
247 #define GEN6_WIZ_CTL_SNAPSHOT_ALL_THREADS             (1 << 2)
248 #define GEN6_WIZ_CTL_THREAD_SNAPSHOT_ENABLE           (1 << 1)
249 #define GEN6_WIZ_CTL_SNAPSHOT_ENABLE                  (1 << 0)
250
251 #define GEN6_WIZ_STRG_VAL                             0x7c04
252 #define GEN6_WIZ_RDATA                                0x7c18
253
254 #define GEN6_TS_CTL                    0x7e00
255 #define GEN6_TS_CTL_SNAPSHOT_COMPLETE              (1 << 31)
256 #define GEN6_TS_CTL_SNAPSHOT_MESSAGE_ERROR         (0 << 8)
257 #define GEN6_TS_CTL_SNAPSHOT_INTERFACE_DESCRIPTOR   (3 << 8)
258 #define GEN6_TS_CTL_SNAPSHOT_ALL_CHILD_THREADS     (1 << 2)
259 #define GEN6_TS_CTL_SNAPSHOT_ALL_ROOT_THREADS      (1 << 1)
260 #define GEN6_TS_CTL_SNAPSHOT_ENABLE                (1 << 0)
261
262 #define GEN6_TS_STRG_VAL                       0x7e04
263 #define GEN6_TS_RDATA                  0x7e08
264
265 #define GEN6_TD_CTL_MUX_SHIFT          8
266 #define GEN6_TD_CTL_EXTERNAL_HALT_R0_DEBUG_MATCH           (1 << 7)
267 #define GEN6_TD_CTL_FORCE_EXTERNAL_HALT            (1 << 6)
268 #define GEN6_TD_CTL_EXCEPTION_MASK_OVERRIDE        (1 << 5)
269 #define GEN6_TD_CTL_FORCE_THREAD_BREAKPOINT_ENABLE  (1 << 4)
270 #define GEN6_TD_CTL_BREAKPOINT_ENABLE              (1 << 2)
271 #define GEN6_TD_CTL2                   0x8004
272 #define GEN6_TD_CTL2_ILLEGAL_OPCODE_EXCEPTION_OVERRIDE (1 << 28)
273 #define GEN6_TD_CTL2_MASKSTACK_EXCEPTION_OVERRIDE      (1 << 26)
274 #define GEN6_TD_CTL2_SOFTWARE_EXCEPTION_OVERRIDE              (1 << 25)
275 #define GEN6_TD_CTL2_ACTIVE_THREAD_LIMIT_SHIFT        16
276 #define GEN6_TD_CTL2_ACTIVE_THREAD_LIMIT_ENABLE       (1 << 8)
277 #define GEN6_TD_CTL2_THREAD_SPAWNER_EXECUTION_MASK_ENABLE (1 << 7)
278 #define GEN6_TD_CTL2_WIZ_EXECUTION_MASK_ENABLE        (1 << 6)
279 #define GEN6_TD_CTL2_SF_EXECUTION_MASK_ENABLE         (1 << 5)
280 #define GEN6_TD_CTL2_CLIPPER_EXECUTION_MASK_ENABLE     (1 << 4)
281 #define GEN6_TD_CTL2_GS_EXECUTION_MASK_ENABLE         (1 << 3)
282 #define GEN6_TD_CTL2_VS_EXECUTION_MASK_ENABLE         (1 << 0)
283 #define GEN6_TD_VF_VS_EMSK             0x8008
284 #define GEN6_TD_GS_EMSK                0x800c
285 #define GEN6_TD_CLIP_EMSK              0x8010
286 #define GEN6_TD_SF_EMSK                0x8014
287 #define GEN6_TD_WIZ_EMSK                       0x8018
288 #define GEN6_TD_0_6_EHTRG_VAL          0x801c
289 #define GEN6_TD_0_7_EHTRG_VAL          0x8020
290 #define GEN6_TD_0_6_EHTRG_MSK           0x8024
291 #define GEN6_TD_0_7_EHTRG_MSK          0x8028
292 #define GEN6_TD_RDATA                  0x802c
293 #define GEN6_TD_TS_EMSK                0x8030
294
295 #define GEN6_EU_CTL                    0x8800
296 #define GEN6_EU_CTL_SELECT_SHIFT               16
297 #define GEN6_EU_CTL_DATA_MUX_SHIFT      8
298 #define GEN6_EU_ATT_0                  0x8810
299 #define GEN6_EU_ATT_1                  0x8814
300 #define GEN6_EU_ATT_DATA_0             0x8820
301 #define GEN6_EU_ATT_DATA_1             0x8824
302 #define GEN6_EU_ATT_CLR_0              0x8830
303 #define GEN6_EU_ATT_CLR_1              0x8834
304 #define GEN6_EU_RDATA                  0x8840
305
306
307 #define GEN6_PIPE_CONTROL                       GEN6_3D(3, 2, 0)
308
309 #define GEN6_3DPRIMITIVE                                GEN6_3D(3, 3, 0)
310
311 #define GEN6_3DSTATE_CLEAR_PARAMS               GEN6_3D(3, 1, 0x10)
312 /* DW1 */
313 # define GEN6_3DSTATE_DEPTH_CLEAR_VALID         (1 << 15)
314
315 /* for GEN6+ */
316 #define GEN6_3DSTATE_SAMPLER_STATE_POINTERS     GEN6_3D(3, 0, 0x02)
317 # define GEN6_3DSTATE_SAMPLER_STATE_MODIFY_PS   (1 << 12)
318 # define GEN6_3DSTATE_SAMPLER_STATE_MODIFY_GS   (1 << 9)
319 # define GEN6_3DSTATE_SAMPLER_STATE_MODIFY_VS   (1 << 8)
320
321 #define GEN6_3DSTATE_URB                        GEN6_3D(3, 0, 0x05)
322 /* DW1 */
323 # define GEN6_3DSTATE_URB_VS_SIZE_SHIFT         16
324 # define GEN6_3DSTATE_URB_VS_ENTRIES_SHIFT      0
325 /* DW2 */
326 # define GEN6_3DSTATE_URB_GS_ENTRIES_SHIFT      8
327 # define GEN6_3DSTATE_URB_GS_SIZE_SHIFT         0
328
329 #define GEN6_3DSTATE_VIEWPORT_STATE_POINTERS    GEN6_3D(3, 0, 0x0d)
330 # define GEN6_3DSTATE_VIEWPORT_STATE_MODIFY_CC          (1 << 12)
331 # define GEN6_3DSTATE_VIEWPORT_STATE_MODIFY_SF          (1 << 11)
332 # define GEN6_3DSTATE_VIEWPORT_STATE_MODIFY_CLIP        (1 << 10)
333
334 #define GEN6_3DSTATE_CC_STATE_POINTERS          GEN6_3D(3, 0, 0x0e)
335
336 #define GEN6_3DSTATE_VS                         GEN6_3D(3, 0, 0x10)
337
338 #define GEN6_3DSTATE_GS                         GEN6_3D(3, 0, 0x11)
339 /* DW4 */
340 # define GEN6_3DSTATE_GS_DISPATCH_START_GRF_SHIFT       0
341
342 #define GEN6_3DSTATE_CLIP                       GEN6_3D(3, 0, 0x12)
343
344 #define GEN6_3DSTATE_SF                         GEN6_3D(3, 0, 0x13)
345 /* DW1 */
346 # define GEN6_3DSTATE_SF_NUM_OUTPUTS_SHIFT              22
347 # define GEN6_3DSTATE_SF_URB_ENTRY_READ_LENGTH_SHIFT    11
348 # define GEN6_3DSTATE_SF_URB_ENTRY_READ_OFFSET_SHIFT    4
349 /* DW2 */
350 /* DW3 */
351 # define GEN6_3DSTATE_SF_CULL_BOTH                      (0 << 29)
352 # define GEN6_3DSTATE_SF_CULL_NONE                      (1 << 29)
353 # define GEN6_3DSTATE_SF_CULL_FRONT                     (2 << 29)
354 # define GEN6_3DSTATE_SF_CULL_BACK                      (3 << 29)
355 /* DW4 */
356 # define GEN6_3DSTATE_SF_TRI_PROVOKE_SHIFT              29
357 # define GEN6_3DSTATE_SF_LINE_PROVOKE_SHIFT             27
358 # define GEN6_3DSTATE_SF_TRIFAN_PROVOKE_SHIFT           25
359
360
361 #define GEN6_3DSTATE_WM                         GEN6_3D(3, 0, 0x14)
362 /* DW2 */
363 # define GEN6_3DSTATE_WM_SAMPLER_COUNT_SHITF                    27
364 # define GEN6_3DSTATE_WM_BINDING_TABLE_ENTRY_COUNT_SHIFT        18
365 /* DW4 */
366 # define GEN6_3DSTATE_WM_DISPATCH_START_GRF_0_SHIFT             16
367 /* DW5 */
368 # define GEN6_3DSTATE_WM_MAX_THREADS_SHIFT                      25
369 # define GEN6_3DSTATE_WM_DISPATCH_ENABLE                        (1 << 19)
370 # define GEN6_3DSTATE_WM_16_DISPATCH_ENABLE                     (1 << 1)
371 # define GEN6_3DSTATE_WM_8_DISPATCH_ENABLE                      (1 << 0)
372 /* DW6 */
373 # define GEN6_3DSTATE_WM_NUM_SF_OUTPUTS_SHIFT                   20
374 # define GEN6_3DSTATE_WM_NONPERSPECTIVE_SAMPLE_BARYCENTRIC      (1 << 15)
375 # define GEN6_3DSTATE_WM_NONPERSPECTIVE_CENTROID_BARYCENTRIC    (1 << 14)
376 # define GEN6_3DSTATE_WM_NONPERSPECTIVE_PIXEL_BARYCENTRIC       (1 << 13)
377 # define GEN6_3DSTATE_WM_PERSPECTIVE_SAMPLE_BARYCENTRIC         (1 << 12)
378 # define GEN6_3DSTATE_WM_PERSPECTIVE_CENTROID_BARYCENTRIC       (1 << 11)
379 # define GEN6_3DSTATE_WM_PERSPECTIVE_PIXEL_BARYCENTRIC          (1 << 10)
380
381
382 #define GEN6_3DSTATE_CONSTANT_VS                GEN6_3D(3, 0, 0x15)
383 #define GEN6_3DSTATE_CONSTANT_GS                GEN6_3D(3, 0, 0x16)
384 #define GEN6_3DSTATE_CONSTANT_PS                GEN6_3D(3, 0, 0x17)
385
386 #define GEN6_3DSTATE_SAMPLE_MASK                GEN6_3D(3, 0, 0x18)
387
388 #define GEN6_3DSTATE_MULTISAMPLE                GEN6_3D(3, 1, 0x0d)
389 /* DW1 */
390 # define GEN6_3DSTATE_MULTISAMPLE_PIXEL_LOCATION_CENTER         (0 << 4)
391 # define GEN6_3DSTATE_MULTISAMPLE_PIXEL_LOCATION_UPPER_LEFT     (1 << 4)
392 # define GEN6_3DSTATE_MULTISAMPLE_NUMSAMPLES_1                  (0 << 1)
393 # define GEN6_3DSTATE_MULTISAMPLE_NUMSAMPLES_4                  (2 << 1)
394 # define GEN6_3DSTATE_MULTISAMPLE_NUMSAMPLES_8                  (3 << 1)
395
396 #define PIPELINE_SELECT_3D              0
397 #define PIPELINE_SELECT_MEDIA           1
398
399 #define UF0_CS_REALLOC                  (1 << 13)
400 #define UF0_VFE_REALLOC                 (1 << 12)
401 #define UF0_SF_REALLOC                  (1 << 11)
402 #define UF0_CLIP_REALLOC                (1 << 10)
403 #define UF0_GS_REALLOC                  (1 << 9)
404 #define UF0_VS_REALLOC                  (1 << 8)
405 #define UF1_CLIP_FENCE_SHIFT            20
406 #define UF1_GS_FENCE_SHIFT              10
407 #define UF1_VS_FENCE_SHIFT              0
408 #define UF2_CS_FENCE_SHIFT              20
409 #define UF2_VFE_FENCE_SHIFT             10
410 #define UF2_SF_FENCE_SHIFT              0
411
412 /* for GEN6_STATE_BASE_ADDRESS */
413 #define BASE_ADDRESS_MODIFY             (1 << 0)
414
415 /* for GEN6_3DSTATE_PIPELINED_POINTERS */
416 #define GEN6_GS_DISABLE                0
417 #define GEN6_GS_ENABLE                 1
418 #define GEN6_CLIP_DISABLE              0
419 #define GEN6_CLIP_ENABLE                       1
420
421 /* for GEN6_PIPE_CONTROL */
422 #define GEN6_PIPE_CONTROL_NOWRITE       (0 << 14)
423 #define GEN6_PIPE_CONTROL_WRITE_QWORD   (1 << 14)
424 #define GEN6_PIPE_CONTROL_WRITE_DEPTH   (2 << 14)
425 #define GEN6_PIPE_CONTROL_WRITE_TIME    (3 << 14)
426 #define GEN6_PIPE_CONTROL_DEPTH_STALL   (1 << 13)
427 #define GEN6_PIPE_CONTROL_WC_FLUSH      (1 << 12)
428 #define GEN6_PIPE_CONTROL_IS_FLUSH      (1 << 11)
429 #define GEN6_PIPE_CONTROL_TC_FLUSH      (1 << 10)
430 #define GEN6_PIPE_CONTROL_NOTIFY_ENABLE (1 << 8)
431 #define GEN6_PIPE_CONTROL_GLOBAL_GTT    (1 << 2)
432 #define GEN6_PIPE_CONTROL_LOCAL_PGTT    (0 << 2)
433 #define GEN6_PIPE_CONTROL_DEPTH_CACHE_FLUSH     (1 << 0)
434
435 /* 3DPRIMITIVE bits */
436 #define GEN6_3DPRIMITIVE_VERTEX_SEQUENTIAL (0 << 15)
437 #define GEN6_3DPRIMITIVE_VERTEX_RANDOM    (1 << 15)
438 /* Primitive types are in gen6_defines.h */
439 #define GEN6_3DPRIMITIVE_TOPOLOGY_SHIFT   10
440
441 #define GEN6_SVG_CTL                   0x7400
442
443 #define GEN6_SVG_CTL_GS_BA             (0 << 8)
444 #define GEN6_SVG_CTL_SS_BA             (1 << 8)
445 #define GEN6_SVG_CTL_IO_BA             (2 << 8)
446 #define GEN6_SVG_CTL_GS_AUB            (3 << 8)
447 #define GEN6_SVG_CTL_IO_AUB            (4 << 8)
448 #define GEN6_SVG_CTL_SIP                       (5 << 8)
449
450 #define GEN6_SVG_RDATA                 0x7404
451 #define GEN6_SVG_WORK_CTL              0x7408
452
453 #define GEN6_VF_CTL                    0x7500
454
455 #define GEN6_VF_CTL_SNAPSHOT_COMPLETE              (1 << 31)
456 #define GEN6_VF_CTL_SNAPSHOT_MUX_SELECT_THREADID           (0 << 8)
457 #define GEN6_VF_CTL_SNAPSHOT_MUX_SELECT_VF_DEBUG           (1 << 8)
458 #define GEN6_VF_CTL_SNAPSHOT_TYPE_VERTEX_SEQUENCE   (0 << 4)
459 #define GEN6_VF_CTL_SNAPSHOT_TYPE_VERTEX_INDEX     (1 << 4)
460 #define GEN6_VF_CTL_SKIP_INITIAL_PRIMITIVES        (1 << 3)
461 #define GEN6_VF_CTL_MAX_PRIMITIVES_LIMIT_ENABLE    (1 << 2)
462 #define GEN6_VF_CTL_VERTEX_RANGE_LIMIT_ENABLE      (1 << 1)
463 #define GEN6_VF_CTL_SNAPSHOT_ENABLE                (1 << 0)
464
465 #define GEN6_VF_STRG_VAL                       0x7504
466 #define GEN6_VF_STR_VL_OVR             0x7508
467 #define GEN6_VF_VC_OVR                 0x750c
468 #define GEN6_VF_STR_PSKIP              0x7510
469 #define GEN6_VF_MAX_PRIM                       0x7514
470 #define GEN6_VF_RDATA                  0x7518
471
472 #define GEN6_VS_CTL                    0x7600
473 #define GEN6_VS_CTL_SNAPSHOT_COMPLETE              (1 << 31)
474 #define GEN6_VS_CTL_SNAPSHOT_MUX_VERTEX_0          (0 << 8)
475 #define GEN6_VS_CTL_SNAPSHOT_MUX_VERTEX_1          (1 << 8)
476 #define GEN6_VS_CTL_SNAPSHOT_MUX_VALID_COUNT       (2 << 8)
477 #define GEN6_VS_CTL_SNAPSHOT_MUX_VS_KERNEL_POINTER  (3 << 8)
478 #define GEN6_VS_CTL_SNAPSHOT_ALL_THREADS                   (1 << 2)
479 #define GEN6_VS_CTL_THREAD_SNAPSHOT_ENABLE         (1 << 1)
480 #define GEN6_VS_CTL_SNAPSHOT_ENABLE                (1 << 0)
481
482 #define GEN6_VS_STRG_VAL                       0x7604
483 #define GEN6_VS_RDATA                  0x7608
484
485 #define GEN6_SF_CTL                    0x7b00
486 #define GEN6_SF_CTL_SNAPSHOT_COMPLETE              (1 << 31)
487 #define GEN6_SF_CTL_SNAPSHOT_MUX_VERTEX_0_FF_ID    (0 << 8)
488 #define GEN6_SF_CTL_SNAPSHOT_MUX_VERTEX_0_REL_COUNT (1 << 8)
489 #define GEN6_SF_CTL_SNAPSHOT_MUX_VERTEX_1_FF_ID    (2 << 8)
490 #define GEN6_SF_CTL_SNAPSHOT_MUX_VERTEX_1_REL_COUNT (3 << 8)
491 #define GEN6_SF_CTL_SNAPSHOT_MUX_VERTEX_2_FF_ID    (4 << 8)
492 #define GEN6_SF_CTL_SNAPSHOT_MUX_VERTEX_2_REL_COUNT (5 << 8)
493 #define GEN6_SF_CTL_SNAPSHOT_MUX_VERTEX_COUNT      (6 << 8)
494 #define GEN6_SF_CTL_SNAPSHOT_MUX_SF_KERNEL_POINTER  (7 << 8)
495 #define GEN6_SF_CTL_MIN_MAX_PRIMITIVE_RANGE_ENABLE  (1 << 4)
496 #define GEN6_SF_CTL_DEBUG_CLIP_RECTANGLE_ENABLE    (1 << 3)
497 #define GEN6_SF_CTL_SNAPSHOT_ALL_THREADS                   (1 << 2)
498 #define GEN6_SF_CTL_THREAD_SNAPSHOT_ENABLE         (1 << 1)
499 #define GEN6_SF_CTL_SNAPSHOT_ENABLE                (1 << 0)
500
501 #define GEN6_SF_STRG_VAL                       0x7b04
502 #define GEN6_SF_RDATA                  0x7b18
503
504 #define GEN6_WIZ_CTL                   0x7c00
505 #define GEN6_WIZ_CTL_SNAPSHOT_COMPLETE             (1 << 31)
506 #define GEN6_WIZ_CTL_SUBSPAN_INSTANCE_SHIFT        16
507 #define GEN6_WIZ_CTL_SNAPSHOT_MUX_WIZ_KERNEL_POINTER   (0 << 8)
508 #define GEN6_WIZ_CTL_SNAPSHOT_MUX_SUBSPAN_INSTANCE     (1 << 8)
509 #define GEN6_WIZ_CTL_SNAPSHOT_MUX_PRIMITIVE_SEQUENCE   (2 << 8)
510 #define GEN6_WIZ_CTL_SINGLE_SUBSPAN_DISPATCH          (1 << 6)
511 #define GEN6_WIZ_CTL_IGNORE_COLOR_SCOREBOARD_STALLS    (1 << 5)
512 #define GEN6_WIZ_CTL_ENABLE_SUBSPAN_INSTANCE_COMPARE   (1 << 4)
513 #define GEN6_WIZ_CTL_USE_UPSTREAM_SNAPSHOT_FLAG       (1 << 3)
514 #define GEN6_WIZ_CTL_SNAPSHOT_ALL_THREADS             (1 << 2)
515 #define GEN6_WIZ_CTL_THREAD_SNAPSHOT_ENABLE           (1 << 1)
516 #define GEN6_WIZ_CTL_SNAPSHOT_ENABLE                  (1 << 0)
517
518 #define GEN6_WIZ_STRG_VAL                             0x7c04
519 #define GEN6_WIZ_RDATA                                0x7c18
520
521 #define GEN6_TS_CTL                    0x7e00
522 #define GEN6_TS_CTL_SNAPSHOT_COMPLETE              (1 << 31)
523 #define GEN6_TS_CTL_SNAPSHOT_MESSAGE_ERROR         (0 << 8)
524 #define GEN6_TS_CTL_SNAPSHOT_INTERFACE_DESCRIPTOR   (3 << 8)
525 #define GEN6_TS_CTL_SNAPSHOT_ALL_CHILD_THREADS     (1 << 2)
526 #define GEN6_TS_CTL_SNAPSHOT_ALL_ROOT_THREADS      (1 << 1)
527 #define GEN6_TS_CTL_SNAPSHOT_ENABLE                (1 << 0)
528
529 #define GEN6_TS_STRG_VAL                       0x7e04
530 #define GEN6_TS_RDATA                  0x7e08
531
532 #define GEN6_TD_CTL_MUX_SHIFT          8
533 #define GEN6_TD_CTL_EXTERNAL_HALT_R0_DEBUG_MATCH           (1 << 7)
534 #define GEN6_TD_CTL_FORCE_EXTERNAL_HALT            (1 << 6)
535 #define GEN6_TD_CTL_EXCEPTION_MASK_OVERRIDE        (1 << 5)
536 #define GEN6_TD_CTL_FORCE_THREAD_BREAKPOINT_ENABLE  (1 << 4)
537 #define GEN6_TD_CTL_BREAKPOINT_ENABLE              (1 << 2)
538 #define GEN6_TD_CTL2                   0x8004
539 #define GEN6_TD_CTL2_ILLEGAL_OPCODE_EXCEPTION_OVERRIDE (1 << 28)
540 #define GEN6_TD_CTL2_MASKSTACK_EXCEPTION_OVERRIDE      (1 << 26)
541 #define GEN6_TD_CTL2_SOFTWARE_EXCEPTION_OVERRIDE              (1 << 25)
542 #define GEN6_TD_CTL2_ACTIVE_THREAD_LIMIT_SHIFT        16
543 #define GEN6_TD_CTL2_ACTIVE_THREAD_LIMIT_ENABLE       (1 << 8)
544 #define GEN6_TD_CTL2_THREAD_SPAWNER_EXECUTION_MASK_ENABLE (1 << 7)
545 #define GEN6_TD_CTL2_WIZ_EXECUTION_MASK_ENABLE        (1 << 6)
546 #define GEN6_TD_CTL2_SF_EXECUTION_MASK_ENABLE         (1 << 5)
547 #define GEN6_TD_CTL2_CLIPPER_EXECUTION_MASK_ENABLE     (1 << 4)
548 #define GEN6_TD_CTL2_GS_EXECUTION_MASK_ENABLE         (1 << 3)
549 #define GEN6_TD_CTL2_VS_EXECUTION_MASK_ENABLE         (1 << 0)
550 #define GEN6_TD_VF_VS_EMSK             0x8008
551 #define GEN6_TD_GS_EMSK                0x800c
552 #define GEN6_TD_CLIP_EMSK              0x8010
553 #define GEN6_TD_SF_EMSK                0x8014
554 #define GEN6_TD_WIZ_EMSK                       0x8018
555 #define GEN6_TD_0_6_EHTRG_VAL          0x801c
556 #define GEN6_TD_0_7_EHTRG_VAL          0x8020
557 #define GEN6_TD_0_6_EHTRG_MSK           0x8024
558 #define GEN6_TD_0_7_EHTRG_MSK          0x8028
559 #define GEN6_TD_RDATA                  0x802c
560 #define GEN6_TD_TS_EMSK                0x8030
561
562 #define GEN6_EU_CTL                    0x8800
563 #define GEN6_EU_CTL_SELECT_SHIFT               16
564 #define GEN6_EU_CTL_DATA_MUX_SHIFT      8
565 #define GEN6_EU_ATT_0                  0x8810
566 #define GEN6_EU_ATT_1                  0x8814
567 #define GEN6_EU_ATT_DATA_0             0x8820
568 #define GEN6_EU_ATT_DATA_1             0x8824
569 #define GEN6_EU_ATT_CLR_0              0x8830
570 #define GEN6_EU_ATT_CLR_1              0x8834
571 #define GEN6_EU_RDATA                  0x8840
572
573 /* 3D state:
574  */
575 #define _3DOP_3DSTATE_PIPELINED       0x0
576 #define _3DOP_3DSTATE_NONPIPELINED    0x1
577 #define _3DOP_3DCONTROL               0x2
578 #define _3DOP_3DPRIMITIVE             0x3
579
580 #define _3DSTATE_PIPELINED_POINTERS       0x00
581 #define _3DSTATE_BINDING_TABLE_POINTERS   0x01
582 #define _3DSTATE_VERTEX_BUFFERS           0x08
583 #define _3DSTATE_VERTEX_ELEMENTS          0x09
584 #define _3DSTATE_INDEX_BUFFER             0x0A
585 #define _3DSTATE_VF_STATISTICS            0x0B
586 #define _3DSTATE_DRAWING_RECTANGLE            0x00
587 #define _3DSTATE_CONSTANT_COLOR               0x01
588 #define _3DSTATE_SAMPLER_PALETTE_LOAD         0x02
589 #define _3DSTATE_CHROMA_KEY                   0x04
590 #define _3DSTATE_DEPTH_BUFFER                 0x05
591 #define _3DSTATE_POLY_STIPPLE_OFFSET          0x06
592 #define _3DSTATE_POLY_STIPPLE_PATTERN         0x07
593 #define _3DSTATE_LINE_STIPPLE                 0x08
594 #define _3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP    0x09
595 #define _3DCONTROL    0x00
596 #define _3DPRIMITIVE  0x00
597
598 #define _3DPRIM_POINTLIST         0x01
599 #define _3DPRIM_LINELIST          0x02
600 #define _3DPRIM_LINESTRIP         0x03
601 #define _3DPRIM_TRILIST           0x04
602 #define _3DPRIM_TRISTRIP          0x05
603 #define _3DPRIM_TRIFAN            0x06
604 #define _3DPRIM_QUADLIST          0x07
605 #define _3DPRIM_QUADSTRIP         0x08
606 #define _3DPRIM_LINELIST_ADJ      0x09
607 #define _3DPRIM_LINESTRIP_ADJ     0x0A
608 #define _3DPRIM_TRILIST_ADJ       0x0B
609 #define _3DPRIM_TRISTRIP_ADJ      0x0C
610 #define _3DPRIM_TRISTRIP_REVERSE  0x0D
611 #define _3DPRIM_POLYGON           0x0E
612 #define _3DPRIM_RECTLIST          0x0F
613 #define _3DPRIM_LINELOOP          0x10
614 #define _3DPRIM_POINTLIST_BF      0x11
615 #define _3DPRIM_LINESTRIP_CONT    0x12
616 #define _3DPRIM_LINESTRIP_BF      0x13
617 #define _3DPRIM_LINESTRIP_CONT_BF 0x14
618 #define _3DPRIM_TRIFAN_NOSTIPPLE  0x15
619
620 #define _3DPRIM_VERTEXBUFFER_ACCESS_SEQUENTIAL 0
621 #define _3DPRIM_VERTEXBUFFER_ACCESS_RANDOM     1
622
623 #define GEN6_ANISORATIO_2     0 
624 #define GEN6_ANISORATIO_4     1 
625 #define GEN6_ANISORATIO_6     2 
626 #define GEN6_ANISORATIO_8     3 
627 #define GEN6_ANISORATIO_10    4 
628 #define GEN6_ANISORATIO_12    5 
629 #define GEN6_ANISORATIO_14    6 
630 #define GEN6_ANISORATIO_16    7
631
632 #define GEN6_BLENDFACTOR_ONE                 0x1
633 #define GEN6_BLENDFACTOR_SRC_COLOR           0x2
634 #define GEN6_BLENDFACTOR_SRC_ALPHA           0x3
635 #define GEN6_BLENDFACTOR_DST_ALPHA           0x4
636 #define GEN6_BLENDFACTOR_DST_COLOR           0x5
637 #define GEN6_BLENDFACTOR_SRC_ALPHA_SATURATE  0x6
638 #define GEN6_BLENDFACTOR_CONST_COLOR         0x7
639 #define GEN6_BLENDFACTOR_CONST_ALPHA         0x8
640 #define GEN6_BLENDFACTOR_SRC1_COLOR          0x9
641 #define GEN6_BLENDFACTOR_SRC1_ALPHA          0x0A
642 #define GEN6_BLENDFACTOR_ZERO                0x11
643 #define GEN6_BLENDFACTOR_INV_SRC_COLOR       0x12
644 #define GEN6_BLENDFACTOR_INV_SRC_ALPHA       0x13
645 #define GEN6_BLENDFACTOR_INV_DST_ALPHA       0x14
646 #define GEN6_BLENDFACTOR_INV_DST_COLOR       0x15
647 #define GEN6_BLENDFACTOR_INV_CONST_COLOR     0x17
648 #define GEN6_BLENDFACTOR_INV_CONST_ALPHA     0x18
649 #define GEN6_BLENDFACTOR_INV_SRC1_COLOR      0x19
650 #define GEN6_BLENDFACTOR_INV_SRC1_ALPHA      0x1A
651
652 #define GEN6_BLENDFUNCTION_ADD               0
653 #define GEN6_BLENDFUNCTION_SUBTRACT          1
654 #define GEN6_BLENDFUNCTION_REVERSE_SUBTRACT  2
655 #define GEN6_BLENDFUNCTION_MIN               3
656 #define GEN6_BLENDFUNCTION_MAX               4
657
658 #define GEN6_ALPHATEST_FORMAT_UNORM8         0
659 #define GEN6_ALPHATEST_FORMAT_FLOAT32        1
660
661 #define GEN6_CHROMAKEY_KILL_ON_ANY_MATCH  0
662 #define GEN6_CHROMAKEY_REPLACE_BLACK      1
663
664 #define GEN6_CLIP_API_OGL     0
665 #define GEN6_CLIP_API_DX      1
666
667 #define GEN6_CLIPMODE_NORMAL              0
668 #define GEN6_CLIPMODE_CLIP_ALL            1
669 #define GEN6_CLIPMODE_CLIP_NON_REJECTED   2
670 #define GEN6_CLIPMODE_REJECT_ALL          3
671 #define GEN6_CLIPMODE_ACCEPT_ALL          4
672
673 #define GEN6_CLIP_NDCSPACE     0
674 #define GEN6_CLIP_SCREENSPACE  1
675
676 #define GEN6_COMPAREFUNCTION_ALWAYS       0
677 #define GEN6_COMPAREFUNCTION_NEVER        1
678 #define GEN6_COMPAREFUNCTION_LESS         2
679 #define GEN6_COMPAREFUNCTION_EQUAL        3
680 #define GEN6_COMPAREFUNCTION_LEQUAL       4
681 #define GEN6_COMPAREFUNCTION_GREATER      5
682 #define GEN6_COMPAREFUNCTION_NOTEQUAL     6
683 #define GEN6_COMPAREFUNCTION_GEQUAL       7
684
685 #define GEN6_COVERAGE_PIXELS_HALF     0
686 #define GEN6_COVERAGE_PIXELS_1        1
687 #define GEN6_COVERAGE_PIXELS_2        2
688 #define GEN6_COVERAGE_PIXELS_4        3
689
690 #define GEN6_CULLMODE_BOTH        0
691 #define GEN6_CULLMODE_NONE        1
692 #define GEN6_CULLMODE_FRONT       2
693 #define GEN6_CULLMODE_BACK        3
694
695 #define GEN6_DEFAULTCOLOR_R8G8B8A8_UNORM      0
696 #define GEN6_DEFAULTCOLOR_R32G32B32A32_FLOAT  1
697
698 #define GEN6_DEPTHFORMAT_D32_FLOAT_S8X24_UINT     0
699 #define GEN6_DEPTHFORMAT_D32_FLOAT                1
700 #define GEN6_DEPTHFORMAT_D24_UNORM_S8_UINT        2
701 #define GEN6_DEPTHFORMAT_D16_UNORM                5
702
703 #define GEN6_FLOATING_POINT_IEEE_754        0
704 #define GEN6_FLOATING_POINT_NON_IEEE_754    1
705
706 #define GEN6_FRONTWINDING_CW      0
707 #define GEN6_FRONTWINDING_CCW     1
708
709 #define GEN6_INDEX_BYTE     0
710 #define GEN6_INDEX_WORD     1
711 #define GEN6_INDEX_DWORD    2
712
713 #define GEN6_LOGICOPFUNCTION_CLEAR            0
714 #define GEN6_LOGICOPFUNCTION_NOR              1
715 #define GEN6_LOGICOPFUNCTION_AND_INVERTED     2
716 #define GEN6_LOGICOPFUNCTION_COPY_INVERTED    3
717 #define GEN6_LOGICOPFUNCTION_AND_REVERSE      4
718 #define GEN6_LOGICOPFUNCTION_INVERT           5
719 #define GEN6_LOGICOPFUNCTION_XOR              6
720 #define GEN6_LOGICOPFUNCTION_NAND             7
721 #define GEN6_LOGICOPFUNCTION_AND              8
722 #define GEN6_LOGICOPFUNCTION_EQUIV            9
723 #define GEN6_LOGICOPFUNCTION_NOOP             10
724 #define GEN6_LOGICOPFUNCTION_OR_INVERTED      11
725 #define GEN6_LOGICOPFUNCTION_COPY             12
726 #define GEN6_LOGICOPFUNCTION_OR_REVERSE       13
727 #define GEN6_LOGICOPFUNCTION_OR               14
728 #define GEN6_LOGICOPFUNCTION_SET              15  
729
730 #define GEN6_MAPFILTER_NEAREST        0x0 
731 #define GEN6_MAPFILTER_LINEAR         0x1 
732 #define GEN6_MAPFILTER_ANISOTROPIC    0x2
733
734 #define GEN6_MIPFILTER_NONE        0   
735 #define GEN6_MIPFILTER_NEAREST     1   
736 #define GEN6_MIPFILTER_LINEAR      3
737
738 #define GEN6_POLYGON_FRONT_FACING     0
739 #define GEN6_POLYGON_BACK_FACING      1
740
741 #define GEN6_PREFILTER_ALWAYS     0x0 
742 #define GEN6_PREFILTER_NEVER      0x1
743 #define GEN6_PREFILTER_LESS       0x2
744 #define GEN6_PREFILTER_EQUAL      0x3
745 #define GEN6_PREFILTER_LEQUAL     0x4
746 #define GEN6_PREFILTER_GREATER    0x5
747 #define GEN6_PREFILTER_NOTEQUAL   0x6
748 #define GEN6_PREFILTER_GEQUAL     0x7
749
750 #define GEN6_PROVOKING_VERTEX_0    0
751 #define GEN6_PROVOKING_VERTEX_1    1 
752 #define GEN6_PROVOKING_VERTEX_2    2
753
754 #define GEN6_RASTRULE_UPPER_LEFT  0    
755 #define GEN6_RASTRULE_UPPER_RIGHT 1
756
757 #define GEN6_RENDERTARGET_CLAMPRANGE_UNORM    0
758 #define GEN6_RENDERTARGET_CLAMPRANGE_SNORM    1
759 #define GEN6_RENDERTARGET_CLAMPRANGE_FORMAT   2
760
761 #define GEN6_STENCILOP_KEEP               0
762 #define GEN6_STENCILOP_ZERO               1
763 #define GEN6_STENCILOP_REPLACE            2
764 #define GEN6_STENCILOP_INCRSAT            3
765 #define GEN6_STENCILOP_DECRSAT            4
766 #define GEN6_STENCILOP_INCR               5
767 #define GEN6_STENCILOP_DECR               6
768 #define GEN6_STENCILOP_INVERT             7
769
770 #define GEN6_SURFACE_MIPMAPLAYOUT_BELOW   0
771 #define GEN6_SURFACE_MIPMAPLAYOUT_RIGHT   1
772
773 #define GEN6_SURFACEFORMAT_R32G32B32A32_FLOAT             0x000
774 #define GEN6_SURFACEFORMAT_R32G32B32A32_SINT              0x001
775 #define GEN6_SURFACEFORMAT_R32G32B32A32_UINT              0x002
776 #define GEN6_SURFACEFORMAT_R32G32B32A32_UNORM             0x003
777 #define GEN6_SURFACEFORMAT_R32G32B32A32_SNORM             0x004
778 #define GEN6_SURFACEFORMAT_R64G64_FLOAT                   0x005
779 #define GEN6_SURFACEFORMAT_R32G32B32X32_FLOAT             0x006
780 #define GEN6_SURFACEFORMAT_R32G32B32A32_SSCALED           0x007
781 #define GEN6_SURFACEFORMAT_R32G32B32A32_USCALED           0x008
782 #define GEN6_SURFACEFORMAT_R32G32B32_FLOAT                0x040
783 #define GEN6_SURFACEFORMAT_R32G32B32_SINT                 0x041
784 #define GEN6_SURFACEFORMAT_R32G32B32_UINT                 0x042
785 #define GEN6_SURFACEFORMAT_R32G32B32_UNORM                0x043
786 #define GEN6_SURFACEFORMAT_R32G32B32_SNORM                0x044
787 #define GEN6_SURFACEFORMAT_R32G32B32_SSCALED              0x045
788 #define GEN6_SURFACEFORMAT_R32G32B32_USCALED              0x046
789 #define GEN6_SURFACEFORMAT_R16G16B16A16_UNORM             0x080
790 #define GEN6_SURFACEFORMAT_R16G16B16A16_SNORM             0x081
791 #define GEN6_SURFACEFORMAT_R16G16B16A16_SINT              0x082
792 #define GEN6_SURFACEFORMAT_R16G16B16A16_UINT              0x083
793 #define GEN6_SURFACEFORMAT_R16G16B16A16_FLOAT             0x084
794 #define GEN6_SURFACEFORMAT_R32G32_FLOAT                   0x085
795 #define GEN6_SURFACEFORMAT_R32G32_SINT                    0x086
796 #define GEN6_SURFACEFORMAT_R32G32_UINT                    0x087
797 #define GEN6_SURFACEFORMAT_R32_FLOAT_X8X24_TYPELESS       0x088
798 #define GEN6_SURFACEFORMAT_X32_TYPELESS_G8X24_UINT        0x089
799 #define GEN6_SURFACEFORMAT_L32A32_FLOAT                   0x08A
800 #define GEN6_SURFACEFORMAT_R32G32_UNORM                   0x08B
801 #define GEN6_SURFACEFORMAT_R32G32_SNORM                   0x08C
802 #define GEN6_SURFACEFORMAT_R64_FLOAT                      0x08D
803 #define GEN6_SURFACEFORMAT_R16G16B16X16_UNORM             0x08E
804 #define GEN6_SURFACEFORMAT_R16G16B16X16_FLOAT             0x08F
805 #define GEN6_SURFACEFORMAT_A32X32_FLOAT                   0x090
806 #define GEN6_SURFACEFORMAT_L32X32_FLOAT                   0x091
807 #define GEN6_SURFACEFORMAT_I32X32_FLOAT                   0x092
808 #define GEN6_SURFACEFORMAT_R16G16B16A16_SSCALED           0x093
809 #define GEN6_SURFACEFORMAT_R16G16B16A16_USCALED           0x094
810 #define GEN6_SURFACEFORMAT_R32G32_SSCALED                 0x095
811 #define GEN6_SURFACEFORMAT_R32G32_USCALED                 0x096
812 #define GEN6_SURFACEFORMAT_B8G8R8A8_UNORM                 0x0C0
813 #define GEN6_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB            0x0C1
814 #define GEN6_SURFACEFORMAT_R10G10B10A2_UNORM              0x0C2
815 #define GEN6_SURFACEFORMAT_R10G10B10A2_UNORM_SRGB         0x0C3
816 #define GEN6_SURFACEFORMAT_R10G10B10A2_UINT               0x0C4
817 #define GEN6_SURFACEFORMAT_R10G10B10_SNORM_A2_UNORM       0x0C5
818 #define GEN6_SURFACEFORMAT_R8G8B8A8_UNORM                 0x0C7
819 #define GEN6_SURFACEFORMAT_R8G8B8A8_UNORM_SRGB            0x0C8
820 #define GEN6_SURFACEFORMAT_R8G8B8A8_SNORM                 0x0C9
821 #define GEN6_SURFACEFORMAT_R8G8B8A8_SINT                  0x0CA
822 #define GEN6_SURFACEFORMAT_R8G8B8A8_UINT                  0x0CB
823 #define GEN6_SURFACEFORMAT_R16G16_UNORM                   0x0CC
824 #define GEN6_SURFACEFORMAT_R16G16_SNORM                   0x0CD
825 #define GEN6_SURFACEFORMAT_R16G16_SINT                    0x0CE
826 #define GEN6_SURFACEFORMAT_R16G16_UINT                    0x0CF
827 #define GEN6_SURFACEFORMAT_R16G16_FLOAT                   0x0D0
828 #define GEN6_SURFACEFORMAT_B10G10R10A2_UNORM              0x0D1
829 #define GEN6_SURFACEFORMAT_B10G10R10A2_UNORM_SRGB         0x0D2
830 #define GEN6_SURFACEFORMAT_R11G11B10_FLOAT                0x0D3
831 #define GEN6_SURFACEFORMAT_R32_SINT                       0x0D6
832 #define GEN6_SURFACEFORMAT_R32_UINT                       0x0D7
833 #define GEN6_SURFACEFORMAT_R32_FLOAT                      0x0D8
834 #define GEN6_SURFACEFORMAT_R24_UNORM_X8_TYPELESS          0x0D9
835 #define GEN6_SURFACEFORMAT_X24_TYPELESS_G8_UINT           0x0DA
836 #define GEN6_SURFACEFORMAT_L16A16_UNORM                   0x0DF
837 #define GEN6_SURFACEFORMAT_I24X8_UNORM                    0x0E0
838 #define GEN6_SURFACEFORMAT_L24X8_UNORM                    0x0E1
839 #define GEN6_SURFACEFORMAT_A24X8_UNORM                    0x0E2
840 #define GEN6_SURFACEFORMAT_I32_FLOAT                      0x0E3
841 #define GEN6_SURFACEFORMAT_L32_FLOAT                      0x0E4
842 #define GEN6_SURFACEFORMAT_A32_FLOAT                      0x0E5
843 #define GEN6_SURFACEFORMAT_B8G8R8X8_UNORM                 0x0E9
844 #define GEN6_SURFACEFORMAT_B8G8R8X8_UNORM_SRGB            0x0EA
845 #define GEN6_SURFACEFORMAT_R8G8B8X8_UNORM                 0x0EB
846 #define GEN6_SURFACEFORMAT_R8G8B8X8_UNORM_SRGB            0x0EC
847 #define GEN6_SURFACEFORMAT_R9G9B9E5_SHAREDEXP             0x0ED
848 #define GEN6_SURFACEFORMAT_B10G10R10X2_UNORM              0x0EE
849 #define GEN6_SURFACEFORMAT_L16A16_FLOAT                   0x0F0
850 #define GEN6_SURFACEFORMAT_R32_UNORM                      0x0F1
851 #define GEN6_SURFACEFORMAT_R32_SNORM                      0x0F2
852 #define GEN6_SURFACEFORMAT_R10G10B10X2_USCALED            0x0F3
853 #define GEN6_SURFACEFORMAT_R8G8B8A8_SSCALED               0x0F4
854 #define GEN6_SURFACEFORMAT_R8G8B8A8_USCALED               0x0F5
855 #define GEN6_SURFACEFORMAT_R16G16_SSCALED                 0x0F6
856 #define GEN6_SURFACEFORMAT_R16G16_USCALED                 0x0F7
857 #define GEN6_SURFACEFORMAT_R32_SSCALED                    0x0F8
858 #define GEN6_SURFACEFORMAT_R32_USCALED                    0x0F9
859 #define GEN6_SURFACEFORMAT_B5G6R5_UNORM                   0x100
860 #define GEN6_SURFACEFORMAT_B5G6R5_UNORM_SRGB              0x101
861 #define GEN6_SURFACEFORMAT_B5G5R5A1_UNORM                 0x102
862 #define GEN6_SURFACEFORMAT_B5G5R5A1_UNORM_SRGB            0x103
863 #define GEN6_SURFACEFORMAT_B4G4R4A4_UNORM                 0x104
864 #define GEN6_SURFACEFORMAT_B4G4R4A4_UNORM_SRGB            0x105
865 #define GEN6_SURFACEFORMAT_R8G8_UNORM                     0x106
866 #define GEN6_SURFACEFORMAT_R8G8_SNORM                     0x107
867 #define GEN6_SURFACEFORMAT_R8G8_SINT                      0x108
868 #define GEN6_SURFACEFORMAT_R8G8_UINT                      0x109
869 #define GEN6_SURFACEFORMAT_R16_UNORM                      0x10A
870 #define GEN6_SURFACEFORMAT_R16_SNORM                      0x10B
871 #define GEN6_SURFACEFORMAT_R16_SINT                       0x10C
872 #define GEN6_SURFACEFORMAT_R16_UINT                       0x10D
873 #define GEN6_SURFACEFORMAT_R16_FLOAT                      0x10E
874 #define GEN6_SURFACEFORMAT_I16_UNORM                      0x111
875 #define GEN6_SURFACEFORMAT_L16_UNORM                      0x112
876 #define GEN6_SURFACEFORMAT_A16_UNORM                      0x113
877 #define GEN6_SURFACEFORMAT_L8A8_UNORM                     0x114
878 #define GEN6_SURFACEFORMAT_I16_FLOAT                      0x115
879 #define GEN6_SURFACEFORMAT_L16_FLOAT                      0x116
880 #define GEN6_SURFACEFORMAT_A16_FLOAT                      0x117
881 #define GEN6_SURFACEFORMAT_R5G5_SNORM_B6_UNORM            0x119
882 #define GEN6_SURFACEFORMAT_B5G5R5X1_UNORM                 0x11A
883 #define GEN6_SURFACEFORMAT_B5G5R5X1_UNORM_SRGB            0x11B
884 #define GEN6_SURFACEFORMAT_R8G8_SSCALED                   0x11C
885 #define GEN6_SURFACEFORMAT_R8G8_USCALED                   0x11D
886 #define GEN6_SURFACEFORMAT_R16_SSCALED                    0x11E
887 #define GEN6_SURFACEFORMAT_R16_USCALED                    0x11F
888 #define GEN6_SURFACEFORMAT_R8_UNORM                       0x140
889 #define GEN6_SURFACEFORMAT_R8_SNORM                       0x141
890 #define GEN6_SURFACEFORMAT_R8_SINT                        0x142
891 #define GEN6_SURFACEFORMAT_R8_UINT                        0x143
892 #define GEN6_SURFACEFORMAT_A8_UNORM                       0x144
893 #define GEN6_SURFACEFORMAT_I8_UNORM                       0x145
894 #define GEN6_SURFACEFORMAT_L8_UNORM                       0x146
895 #define GEN6_SURFACEFORMAT_P4A4_UNORM                     0x147
896 #define GEN6_SURFACEFORMAT_A4P4_UNORM                     0x148
897 #define GEN6_SURFACEFORMAT_R8_SSCALED                     0x149
898 #define GEN6_SURFACEFORMAT_R8_USCALED                     0x14A
899 #define GEN6_SURFACEFORMAT_R1_UINT                        0x181
900 #define GEN6_SURFACEFORMAT_YCRCB_NORMAL                   0x182
901 #define GEN6_SURFACEFORMAT_YCRCB_SWAPUVY                  0x183
902 #define GEN6_SURFACEFORMAT_BC1_UNORM                      0x186
903 #define GEN6_SURFACEFORMAT_BC2_UNORM                      0x187
904 #define GEN6_SURFACEFORMAT_BC3_UNORM                      0x188
905 #define GEN6_SURFACEFORMAT_BC4_UNORM                      0x189
906 #define GEN6_SURFACEFORMAT_BC5_UNORM                      0x18A
907 #define GEN6_SURFACEFORMAT_BC1_UNORM_SRGB                 0x18B
908 #define GEN6_SURFACEFORMAT_BC2_UNORM_SRGB                 0x18C
909 #define GEN6_SURFACEFORMAT_BC3_UNORM_SRGB                 0x18D
910 #define GEN6_SURFACEFORMAT_MONO8                          0x18E
911 #define GEN6_SURFACEFORMAT_YCRCB_SWAPUV                   0x18F
912 #define GEN6_SURFACEFORMAT_YCRCB_SWAPY                    0x190
913 #define GEN6_SURFACEFORMAT_DXT1_RGB                       0x191
914 #define GEN6_SURFACEFORMAT_FXT1                           0x192
915 #define GEN6_SURFACEFORMAT_R8G8B8_UNORM                   0x193
916 #define GEN6_SURFACEFORMAT_R8G8B8_SNORM                   0x194
917 #define GEN6_SURFACEFORMAT_R8G8B8_SSCALED                 0x195
918 #define GEN6_SURFACEFORMAT_R8G8B8_USCALED                 0x196
919 #define GEN6_SURFACEFORMAT_R64G64B64A64_FLOAT             0x197
920 #define GEN6_SURFACEFORMAT_R64G64B64_FLOAT                0x198
921 #define GEN6_SURFACEFORMAT_BC4_SNORM                      0x199
922 #define GEN6_SURFACEFORMAT_BC5_SNORM                      0x19A
923 #define GEN6_SURFACEFORMAT_R16G16B16_UNORM                0x19C
924 #define GEN6_SURFACEFORMAT_R16G16B16_SNORM                0x19D
925 #define GEN6_SURFACEFORMAT_R16G16B16_SSCALED              0x19E
926 #define GEN6_SURFACEFORMAT_R16G16B16_USCALED              0x19F
927
928 #define GEN6_SURFACERETURNFORMAT_FLOAT32  0
929 #define GEN6_SURFACERETURNFORMAT_S1       1
930
931 #define GEN6_SURFACE_1D      0
932 #define GEN6_SURFACE_2D      1
933 #define GEN6_SURFACE_3D      2
934 #define GEN6_SURFACE_CUBE    3
935 #define GEN6_SURFACE_BUFFER  4
936 #define GEN6_SURFACE_NULL    7
937
938 #define GEN6_BORDER_COLOR_MODE_DEFAULT  0
939 #define GEN6_BORDER_COLOR_MODE_LEGACY   1
940
941 #define GEN6_TEXCOORDMODE_WRAP            0
942 #define GEN6_TEXCOORDMODE_MIRROR          1
943 #define GEN6_TEXCOORDMODE_CLAMP           2
944 #define GEN6_TEXCOORDMODE_CUBE            3
945 #define GEN6_TEXCOORDMODE_CLAMP_BORDER    4
946 #define GEN6_TEXCOORDMODE_MIRROR_ONCE     5
947
948 #define GEN6_THREAD_PRIORITY_NORMAL   0
949 #define GEN6_THREAD_PRIORITY_HIGH     1
950
951 #define GEN6_TILEWALK_XMAJOR                 0
952 #define GEN6_TILEWALK_YMAJOR                 1
953
954 #define GEN6_VERTEX_SUBPIXEL_PRECISION_8BITS  0
955 #define GEN6_VERTEX_SUBPIXEL_PRECISION_4BITS  1
956
957 #define GEN6_VERTEXBUFFER_ACCESS_VERTEXDATA     0
958 #define GEN6_VERTEXBUFFER_ACCESS_INSTANCEDATA   1
959
960 #define GEN6_VFCOMPONENT_NOSTORE      0
961 #define GEN6_VFCOMPONENT_STORE_SRC    1
962 #define GEN6_VFCOMPONENT_STORE_0      2
963 #define GEN6_VFCOMPONENT_STORE_1_FLT  3
964 #define GEN6_VFCOMPONENT_STORE_1_INT  4
965 #define GEN6_VFCOMPONENT_STORE_VID    5
966 #define GEN6_VFCOMPONENT_STORE_IID    6
967 #define GEN6_VFCOMPONENT_STORE_PID    7
968
969
970
971 /* Execution Unit (EU) defines
972  */
973
974 #define GEN6_ALIGN_1   0
975 #define GEN6_ALIGN_16  1
976
977 #define GEN6_ADDRESS_DIRECT                        0
978 #define GEN6_ADDRESS_REGISTER_INDIRECT_REGISTER    1
979
980 #define GEN6_CHANNEL_X     0
981 #define GEN6_CHANNEL_Y     1
982 #define GEN6_CHANNEL_Z     2
983 #define GEN6_CHANNEL_W     3
984
985 #define GEN6_COMPRESSION_NONE          0
986 #define GEN6_COMPRESSION_2NDHALF       1
987 #define GEN6_COMPRESSION_COMPRESSED    2
988
989 #define GEN6_CONDITIONAL_NONE  0
990 #define GEN6_CONDITIONAL_Z     1
991 #define GEN6_CONDITIONAL_NZ    2
992 #define GEN6_CONDITIONAL_EQ    1        /* Z */
993 #define GEN6_CONDITIONAL_NEQ   2        /* NZ */
994 #define GEN6_CONDITIONAL_G     3
995 #define GEN6_CONDITIONAL_GE    4
996 #define GEN6_CONDITIONAL_L     5
997 #define GEN6_CONDITIONAL_LE    6
998 #define GEN6_CONDITIONAL_C     7
999 #define GEN6_CONDITIONAL_O     8
1000
1001 #define GEN6_DEBUG_NONE        0
1002 #define GEN6_DEBUG_BREAKPOINT  1
1003
1004 #define GEN6_DEPENDENCY_NORMAL         0
1005 #define GEN6_DEPENDENCY_NOTCLEARED     1
1006 #define GEN6_DEPENDENCY_NOTCHECKED     2
1007 #define GEN6_DEPENDENCY_DISABLE        3
1008
1009 #define GEN6_EXECUTE_1     0
1010 #define GEN6_EXECUTE_2     1
1011 #define GEN6_EXECUTE_4     2
1012 #define GEN6_EXECUTE_8     3
1013 #define GEN6_EXECUTE_16    4
1014 #define GEN6_EXECUTE_32    5
1015
1016 #define GEN6_HORIZONTAL_STRIDE_0   0
1017 #define GEN6_HORIZONTAL_STRIDE_1   1
1018 #define GEN6_HORIZONTAL_STRIDE_2   2
1019 #define GEN6_HORIZONTAL_STRIDE_4   3
1020
1021 #define GEN6_INSTRUCTION_NORMAL    0
1022 #define GEN6_INSTRUCTION_SATURATE  1
1023
1024 #define GEN6_MASK_ENABLE   0
1025 #define GEN6_MASK_DISABLE  1
1026
1027 #define GEN6_OPCODE_MOV        1
1028 #define GEN6_OPCODE_SEL        2
1029 #define GEN6_OPCODE_NOT        4
1030 #define GEN6_OPCODE_AND        5
1031 #define GEN6_OPCODE_OR         6
1032 #define GEN6_OPCODE_XOR        7
1033 #define GEN6_OPCODE_SHR        8
1034 #define GEN6_OPCODE_SHL        9
1035 #define GEN6_OPCODE_RSR        10
1036 #define GEN6_OPCODE_RSL        11
1037 #define GEN6_OPCODE_ASR        12
1038 #define GEN6_OPCODE_CMP        16
1039 #define GEN6_OPCODE_JMPI       32
1040 #define GEN6_OPCODE_IF         34
1041 #define GEN6_OPCODE_IFF        35
1042 #define GEN6_OPCODE_ELSE       36
1043 #define GEN6_OPCODE_ENDIF      37
1044 #define GEN6_OPCODE_DO         38
1045 #define GEN6_OPCODE_WHILE      39
1046 #define GEN6_OPCODE_BREAK      40
1047 #define GEN6_OPCODE_CONTINUE   41
1048 #define GEN6_OPCODE_HALT       42
1049 #define GEN6_OPCODE_MSAVE      44
1050 #define GEN6_OPCODE_MRESTORE   45
1051 #define GEN6_OPCODE_PUSH       46
1052 #define GEN6_OPCODE_POP        47
1053 #define GEN6_OPCODE_WAIT       48
1054 #define GEN6_OPCODE_SEND       49
1055 #define GEN6_OPCODE_ADD        64
1056 #define GEN6_OPCODE_MUL        65
1057 #define GEN6_OPCODE_AVG        66
1058 #define GEN6_OPCODE_FRC        67
1059 #define GEN6_OPCODE_RNDU       68
1060 #define GEN6_OPCODE_RNDD       69
1061 #define GEN6_OPCODE_RNDE       70
1062 #define GEN6_OPCODE_RNDZ       71
1063 #define GEN6_OPCODE_MAC        72
1064 #define GEN6_OPCODE_MACH       73
1065 #define GEN6_OPCODE_LZD        74
1066 #define GEN6_OPCODE_SAD2       80
1067 #define GEN6_OPCODE_SADA2      81
1068 #define GEN6_OPCODE_DP4        84
1069 #define GEN6_OPCODE_DPH        85
1070 #define GEN6_OPCODE_DP3        86
1071 #define GEN6_OPCODE_DP2        87
1072 #define GEN6_OPCODE_DPA2       88
1073 #define GEN6_OPCODE_LINE       89
1074 #define GEN6_OPCODE_NOP        126
1075
1076 #define GEN6_PREDICATE_NONE             0
1077 #define GEN6_PREDICATE_NORMAL           1
1078 #define GEN6_PREDICATE_ALIGN1_ANYV             2
1079 #define GEN6_PREDICATE_ALIGN1_ALLV             3
1080 #define GEN6_PREDICATE_ALIGN1_ANY2H            4
1081 #define GEN6_PREDICATE_ALIGN1_ALL2H            5
1082 #define GEN6_PREDICATE_ALIGN1_ANY4H            6
1083 #define GEN6_PREDICATE_ALIGN1_ALL4H            7
1084 #define GEN6_PREDICATE_ALIGN1_ANY8H            8
1085 #define GEN6_PREDICATE_ALIGN1_ALL8H            9
1086 #define GEN6_PREDICATE_ALIGN1_ANY16H           10
1087 #define GEN6_PREDICATE_ALIGN1_ALL16H           11
1088 #define GEN6_PREDICATE_ALIGN16_REPLICATE_X     2
1089 #define GEN6_PREDICATE_ALIGN16_REPLICATE_Y     3
1090 #define GEN6_PREDICATE_ALIGN16_REPLICATE_Z     4
1091 #define GEN6_PREDICATE_ALIGN16_REPLICATE_W     5
1092 #define GEN6_PREDICATE_ALIGN16_ANY4H           6
1093 #define GEN6_PREDICATE_ALIGN16_ALL4H           7
1094
1095 #define GEN6_ARCHITECTURE_REGISTER_FILE    0
1096 #define GEN6_GENERAL_REGISTER_FILE         1
1097 #define GEN6_MESSAGE_REGISTER_FILE         2
1098 #define GEN6_IMMEDIATE_VALUE               3
1099
1100 #define GEN6_REGISTER_TYPE_UD  0
1101 #define GEN6_REGISTER_TYPE_D   1
1102 #define GEN6_REGISTER_TYPE_UW  2
1103 #define GEN6_REGISTER_TYPE_W   3
1104 #define GEN6_REGISTER_TYPE_UB  4
1105 #define GEN6_REGISTER_TYPE_B   5
1106 #define GEN6_REGISTER_TYPE_VF  5        /* packed float vector, immediates only? */
1107 #define GEN6_REGISTER_TYPE_HF  6
1108 #define GEN6_REGISTER_TYPE_V   6        /* packed int vector, immediates only, uword dest only */
1109 #define GEN6_REGISTER_TYPE_F   7
1110
1111 #define GEN6_ARF_NULL                  0x00
1112 #define GEN6_ARF_ADDRESS               0x10
1113 #define GEN6_ARF_ACCUMULATOR           0x20   
1114 #define GEN6_ARF_FLAG                  0x30
1115 #define GEN6_ARF_MASK                  0x40
1116 #define GEN6_ARF_MASK_STACK            0x50
1117 #define GEN6_ARF_MASK_STACK_DEPTH      0x60
1118 #define GEN6_ARF_STATE                 0x70
1119 #define GEN6_ARF_CONTROL               0x80
1120 #define GEN6_ARF_NOTIFICATION_COUNT    0x90
1121 #define GEN6_ARF_IP                    0xA0
1122
1123 #define GEN6_AMASK   0
1124 #define GEN6_IMASK   1
1125 #define GEN6_LMASK   2
1126 #define GEN6_CMASK   3
1127
1128
1129
1130 #define GEN6_THREAD_NORMAL     0
1131 #define GEN6_THREAD_ATOMIC     1
1132 #define GEN6_THREAD_SWITCH     2
1133
1134 #define GEN6_VERTICAL_STRIDE_0                 0
1135 #define GEN6_VERTICAL_STRIDE_1                 1
1136 #define GEN6_VERTICAL_STRIDE_2                 2
1137 #define GEN6_VERTICAL_STRIDE_4                 3
1138 #define GEN6_VERTICAL_STRIDE_8                 4
1139 #define GEN6_VERTICAL_STRIDE_16                5
1140 #define GEN6_VERTICAL_STRIDE_32                6
1141 #define GEN6_VERTICAL_STRIDE_64                7
1142 #define GEN6_VERTICAL_STRIDE_128               8
1143 #define GEN6_VERTICAL_STRIDE_256               9
1144 #define GEN6_VERTICAL_STRIDE_ONE_DIMENSIONAL   0xF
1145
1146 #define GEN6_WIDTH_1       0
1147 #define GEN6_WIDTH_2       1
1148 #define GEN6_WIDTH_4       2
1149 #define GEN6_WIDTH_8       3
1150 #define GEN6_WIDTH_16      4
1151
1152 #define GEN6_STATELESS_BUFFER_BOUNDARY_1K      0
1153 #define GEN6_STATELESS_BUFFER_BOUNDARY_2K      1
1154 #define GEN6_STATELESS_BUFFER_BOUNDARY_4K      2
1155 #define GEN6_STATELESS_BUFFER_BOUNDARY_8K      3
1156 #define GEN6_STATELESS_BUFFER_BOUNDARY_16K     4
1157 #define GEN6_STATELESS_BUFFER_BOUNDARY_32K     5
1158 #define GEN6_STATELESS_BUFFER_BOUNDARY_64K     6
1159 #define GEN6_STATELESS_BUFFER_BOUNDARY_128K    7
1160 #define GEN6_STATELESS_BUFFER_BOUNDARY_256K    8
1161 #define GEN6_STATELESS_BUFFER_BOUNDARY_512K    9
1162 #define GEN6_STATELESS_BUFFER_BOUNDARY_1M      10
1163 #define GEN6_STATELESS_BUFFER_BOUNDARY_2M      11
1164
1165 #define GEN6_POLYGON_FACING_FRONT      0
1166 #define GEN6_POLYGON_FACING_BACK       1
1167
1168 #define GEN6_MESSAGE_TARGET_NULL               0
1169 #define GEN6_MESSAGE_TARGET_MATH               1
1170 #define GEN6_MESSAGE_TARGET_SAMPLER            2
1171 #define GEN6_MESSAGE_TARGET_GATEWAY            3
1172 #define GEN6_MESSAGE_TARGET_DATAPORT_READ      4
1173 #define GEN6_MESSAGE_TARGET_DATAPORT_WRITE     5
1174 #define GEN6_MESSAGE_TARGET_URB                6
1175 #define GEN6_MESSAGE_TARGET_THREAD_SPAWNER     7
1176
1177 #define GEN6_SAMPLER_RETURN_FORMAT_FLOAT32     0
1178 #define GEN6_SAMPLER_RETURN_FORMAT_UINT32      2
1179 #define GEN6_SAMPLER_RETURN_FORMAT_SINT32      3
1180
1181 #define GEN6_SAMPLER_MESSAGE_SIMD8_SAMPLE              0
1182 #define GEN6_SAMPLER_MESSAGE_SIMD16_SAMPLE             0
1183 #define GEN6_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS        0
1184 #define GEN6_SAMPLER_MESSAGE_SIMD8_KILLPIX             1
1185 #define GEN6_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_LOD        1
1186 #define GEN6_SAMPLER_MESSAGE_SIMD16_SAMPLE_LOD         1
1187 #define GEN6_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_GRADIENTS  2
1188 #define GEN6_SAMPLER_MESSAGE_SIMD8_SAMPLE_GRADIENTS    2
1189 #define GEN6_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_COMPARE    0
1190 #define GEN6_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE     2
1191 #define GEN6_SAMPLER_MESSAGE_SIMD4X2_RESINFO           2
1192 #define GEN6_SAMPLER_MESSAGE_SIMD8_RESINFO             2
1193 #define GEN6_SAMPLER_MESSAGE_SIMD16_RESINFO            2
1194 #define GEN6_SAMPLER_MESSAGE_SIMD4X2_LD                3
1195 #define GEN6_SAMPLER_MESSAGE_SIMD8_LD                  3
1196 #define GEN6_SAMPLER_MESSAGE_SIMD16_LD                 3
1197
1198 #define GEN6_DATAPORT_OWORD_BLOCK_1_OWORDLOW   0
1199 #define GEN6_DATAPORT_OWORD_BLOCK_1_OWORDHIGH  1
1200 #define GEN6_DATAPORT_OWORD_BLOCK_2_OWORDS     2
1201 #define GEN6_DATAPORT_OWORD_BLOCK_4_OWORDS     3
1202 #define GEN6_DATAPORT_OWORD_BLOCK_8_OWORDS     4
1203
1204 #define GEN6_DATAPORT_OWORD_DUAL_BLOCK_1OWORD     0
1205 #define GEN6_DATAPORT_OWORD_DUAL_BLOCK_4OWORDS    2
1206
1207 #define GEN6_DATAPORT_DWORD_SCATTERED_BLOCK_8DWORDS   2
1208 #define GEN6_DATAPORT_DWORD_SCATTERED_BLOCK_16DWORDS  3
1209
1210 #define GEN6_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ          0
1211 #define GEN6_DATAPORT_READ_MESSAGE_OWORD_DUAL_BLOCK_READ     1
1212 #define GEN6_DATAPORT_READ_MESSAGE_DWORD_BLOCK_READ          2
1213 #define GEN6_DATAPORT_READ_MESSAGE_DWORD_SCATTERED_READ      3
1214
1215 #define GEN6_DATAPORT_READ_TARGET_DATA_CACHE      0
1216 #define GEN6_DATAPORT_READ_TARGET_RENDER_CACHE    1
1217 #define GEN6_DATAPORT_READ_TARGET_SAMPLER_CACHE   2
1218
1219 #define GEN6_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE                0
1220 #define GEN6_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE_REPLICATED     1
1221 #define GEN6_DATAPORT_RENDER_TARGET_WRITE_SIMD8_DUAL_SOURCE_SUBSPAN01         2
1222 #define GEN6_DATAPORT_RENDER_TARGET_WRITE_SIMD8_DUAL_SOURCE_SUBSPAN23         3
1223 #define GEN6_DATAPORT_RENDER_TARGET_WRITE_SIMD8_SINGLE_SOURCE_SUBSPAN01       4
1224
1225 #define GEN6_DATAPORT_WRITE_MESSAGE_OWORD_BLOCK_WRITE                0
1226 #define GEN6_DATAPORT_WRITE_MESSAGE_OWORD_DUAL_BLOCK_WRITE           1
1227 #define GEN6_DATAPORT_WRITE_MESSAGE_DWORD_BLOCK_WRITE                2
1228 #define GEN6_DATAPORT_WRITE_MESSAGE_DWORD_SCATTERED_WRITE            3
1229 #define GEN6_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE              4
1230 #define GEN6_DATAPORT_WRITE_MESSAGE_STREAMED_VERTEX_BUFFER_WRITE     5
1231 #define GEN6_DATAPORT_WRITE_MESSAGE_FLUSH_RENDER_CACHE               7
1232
1233 #define GEN6_MATH_FUNCTION_INV                              1
1234 #define GEN6_MATH_FUNCTION_LOG                              2
1235 #define GEN6_MATH_FUNCTION_EXP                              3
1236 #define GEN6_MATH_FUNCTION_SQRT                             4
1237 #define GEN6_MATH_FUNCTION_RSQ                              5
1238 #define GEN6_MATH_FUNCTION_SIN                              6 /* was 7 */
1239 #define GEN6_MATH_FUNCTION_COS                              7 /* was 8 */
1240 #define GEN6_MATH_FUNCTION_SINCOS                           8 /* was 6 */
1241 #define GEN6_MATH_FUNCTION_TAN                              9
1242 #define GEN6_MATH_FUNCTION_POW                              10
1243 #define GEN6_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER   11
1244 #define GEN6_MATH_FUNCTION_INT_DIV_QUOTIENT                 12
1245 #define GEN6_MATH_FUNCTION_INT_DIV_REMAINDER                13
1246
1247 #define GEN6_MATH_INTEGER_UNSIGNED     0
1248 #define GEN6_MATH_INTEGER_SIGNED       1
1249
1250 #define GEN6_MATH_PRECISION_FULL        0
1251 #define GEN6_MATH_PRECISION_PARTIAL     1
1252
1253 #define GEN6_MATH_SATURATE_NONE         0
1254 #define GEN6_MATH_SATURATE_SATURATE     1
1255
1256 #define GEN6_MATH_DATA_VECTOR  0
1257 #define GEN6_MATH_DATA_SCALAR  1
1258
1259 #define GEN6_URB_OPCODE_WRITE  0
1260
1261 #define GEN6_URB_SWIZZLE_NONE          0
1262 #define GEN6_URB_SWIZZLE_INTERLEAVE    1
1263 #define GEN6_URB_SWIZZLE_TRANSPOSE     2
1264
1265 #define GEN6_SCRATCH_SPACE_SIZE_1K     0
1266 #define GEN6_SCRATCH_SPACE_SIZE_2K     1
1267 #define GEN6_SCRATCH_SPACE_SIZE_4K     2
1268 #define GEN6_SCRATCH_SPACE_SIZE_8K     3
1269 #define GEN6_SCRATCH_SPACE_SIZE_16K    4
1270 #define GEN6_SCRATCH_SPACE_SIZE_32K    5
1271 #define GEN6_SCRATCH_SPACE_SIZE_64K    6
1272 #define GEN6_SCRATCH_SPACE_SIZE_128K   7
1273 #define GEN6_SCRATCH_SPACE_SIZE_256K   8
1274 #define GEN6_SCRATCH_SPACE_SIZE_512K   9
1275 #define GEN6_SCRATCH_SPACE_SIZE_1M     10
1276 #define GEN6_SCRATCH_SPACE_SIZE_2M     11
1277
1278 /* The hardware supports two different modes for border color. The
1279  * default (OpenGL) mode uses floating-point color channels, while the
1280  * legacy mode uses 4 bytes.
1281  *
1282  * More significantly, the legacy mode respects the components of the
1283  * border color for channels not present in the source, (whereas the
1284  * default mode will ignore the border color's alpha channel and use
1285  * alpha==1 for an RGB source, for example).
1286  *
1287  * The legacy mode matches the semantics specified by the Render
1288  * extension.
1289  */
1290 struct gen6_sampler_default_border_color {
1291    float color[4];
1292 };
1293
1294 struct gen6_sampler_legacy_border_color {
1295    uint8_t color[4];
1296 };
1297
1298 struct gen6_sampler_state {
1299    struct {
1300       uint32_t shadow_function:3;
1301       uint32_t lod_bias:11;
1302       uint32_t min_filter:3;
1303       uint32_t mag_filter:3;
1304       uint32_t mip_filter:2;
1305       uint32_t base_level:5;
1306       uint32_t pad:1;
1307       uint32_t lod_preclamp:1;
1308       uint32_t border_color_mode:1;
1309       uint32_t pad0:1;
1310       uint32_t disable:1;
1311    } ss0;
1312
1313    struct {
1314       uint32_t r_wrap_mode:3;
1315       uint32_t t_wrap_mode:3;
1316       uint32_t s_wrap_mode:3;
1317       uint32_t pad:3;
1318       uint32_t max_lod:10;
1319       uint32_t min_lod:10;
1320    } ss1;
1321
1322    struct {
1323       uint32_t border_color;
1324    } ss2;
1325
1326    struct {
1327       uint32_t pad:19;
1328       uint32_t max_aniso:3;
1329       uint32_t chroma_key_mode:1;
1330       uint32_t chroma_key_index:2;
1331       uint32_t chroma_key_enable:1;
1332       uint32_t monochrome_filter_width:3;
1333       uint32_t monochrome_filter_height:3;
1334    } ss3;
1335 };
1336
1337 struct gen6_blend_state {
1338         struct {
1339                 uint32_t dest_blend_factor:5;
1340                 uint32_t source_blend_factor:5;
1341                 uint32_t pad3:1;
1342                 uint32_t blend_func:3;
1343                 uint32_t pad2:1;
1344                 uint32_t ia_dest_blend_factor:5;
1345                 uint32_t ia_source_blend_factor:5;
1346                 uint32_t pad1:1;
1347                 uint32_t ia_blend_func:3;
1348                 uint32_t pad0:1;
1349                 uint32_t ia_blend_enable:1;
1350                 uint32_t blend_enable:1;
1351         } blend0;
1352
1353         struct {
1354                 uint32_t post_blend_clamp_enable:1;
1355                 uint32_t pre_blend_clamp_enable:1;
1356                 uint32_t clamp_range:2;
1357                 uint32_t pad0:4;
1358                 uint32_t x_dither_offset:2;
1359                 uint32_t y_dither_offset:2;
1360                 uint32_t dither_enable:1;
1361                 uint32_t alpha_test_func:3;
1362                 uint32_t alpha_test_enable:1;
1363                 uint32_t pad1:1;
1364                 uint32_t logic_op_func:4;
1365                 uint32_t logic_op_enable:1;
1366                 uint32_t pad2:1;
1367                 uint32_t write_disable_b:1;
1368                 uint32_t write_disable_g:1;
1369                 uint32_t write_disable_r:1;
1370                 uint32_t write_disable_a:1;
1371                 uint32_t pad3:1;
1372                 uint32_t alpha_to_coverage_dither:1;
1373                 uint32_t alpha_to_one:1;
1374                 uint32_t alpha_to_coverage:1;
1375         } blend1;
1376 };
1377
1378 struct gen6_color_calc_state {
1379         struct {
1380                 uint32_t alpha_test_format:1;
1381                 uint32_t pad0:14;
1382                 uint32_t round_disable:1;
1383                 uint32_t bf_stencil_ref:8;
1384                 uint32_t stencil_ref:8;
1385         } cc0;
1386
1387         union {
1388                 float alpha_ref_f;
1389                 struct {
1390                         uint32_t ui:8;
1391                         uint32_t pad0:24;
1392                 } alpha_ref_fi;
1393         } cc1;
1394
1395         float constant_r;
1396         float constant_g;
1397         float constant_b;
1398         float constant_a;
1399 };
1400
1401 struct gen6_depth_stencil_state {
1402         struct {
1403                 uint32_t pad0:3;
1404                 uint32_t bf_stencil_pass_depth_pass_op:3;
1405                 uint32_t bf_stencil_pass_depth_fail_op:3;
1406                 uint32_t bf_stencil_fail_op:3;
1407                 uint32_t bf_stencil_func:3;
1408                 uint32_t bf_stencil_enable:1;
1409                 uint32_t pad1:2;
1410                 uint32_t stencil_write_enable:1;
1411                 uint32_t stencil_pass_depth_pass_op:3;
1412                 uint32_t stencil_pass_depth_fail_op:3;
1413                 uint32_t stencil_fail_op:3;
1414                 uint32_t stencil_func:3;
1415                 uint32_t stencil_enable:1;
1416         } ds0;
1417
1418         struct {
1419                 uint32_t bf_stencil_write_mask:8;
1420                 uint32_t bf_stencil_test_mask:8;
1421                 uint32_t stencil_write_mask:8;
1422                 uint32_t stencil_test_mask:8;
1423         } ds1;
1424
1425         struct {
1426                 uint32_t pad0:26;
1427                 uint32_t depth_write_enable:1;
1428                 uint32_t depth_test_func:3;
1429                 uint32_t pad1:1;
1430                 uint32_t depth_test_enable:1;
1431         } ds2;
1432 };
1433
1434 struct gen6_surface_state {
1435         struct {
1436                 uint32_t cube_pos_z:1;
1437                 uint32_t cube_neg_z:1;
1438                 uint32_t cube_pos_y:1;
1439                 uint32_t cube_neg_y:1;
1440                 uint32_t cube_pos_x:1;
1441                 uint32_t cube_neg_x:1;
1442                 uint32_t pad:3;
1443                 uint32_t render_cache_read_mode:1;
1444                 uint32_t mipmap_layout_mode:1;
1445                 uint32_t vert_line_stride_ofs:1;
1446                 uint32_t vert_line_stride:1;
1447                 uint32_t color_blend:1;
1448                 uint32_t writedisable_blue:1;
1449                 uint32_t writedisable_green:1;
1450                 uint32_t writedisable_red:1;
1451                 uint32_t writedisable_alpha:1;
1452                 uint32_t surface_format:9;
1453                 uint32_t data_return_format:1;
1454                 uint32_t pad0:1;
1455                 uint32_t surface_type:3;
1456         } ss0;
1457
1458         struct {
1459                 uint32_t base_addr;
1460         } ss1;
1461
1462         struct {
1463                 uint32_t render_target_rotation:2;
1464                 uint32_t mip_count:4;
1465                 uint32_t width:13;
1466                 uint32_t height:13;
1467         } ss2;
1468
1469         struct {
1470                 uint32_t tile_walk:1;
1471                 uint32_t tiled_surface:1;
1472                 uint32_t pad:1;
1473                 uint32_t pitch:18;
1474                 uint32_t depth:11;
1475         } ss3;
1476
1477         struct {
1478                 uint32_t pad:19;
1479                 uint32_t min_array_elt:9;
1480                 uint32_t min_lod:4;
1481         } ss4;
1482
1483         struct {
1484                 uint32_t pad:20;
1485                 uint32_t y_offset:4;
1486                 uint32_t pad2:1;
1487                 uint32_t x_offset:7;
1488         } ss5;
1489 };
1490
1491 struct gen6_cc_viewport {
1492         float min_depth;
1493         float max_depth;
1494 };
1495
1496 typedef enum {
1497         SAMPLER_FILTER_NEAREST = 0,
1498         SAMPLER_FILTER_BILINEAR,
1499         FILTER_COUNT
1500 } sampler_filter_t;
1501
1502 typedef enum {
1503         SAMPLER_EXTEND_NONE = 0,
1504         SAMPLER_EXTEND_REPEAT,
1505         SAMPLER_EXTEND_PAD,
1506         SAMPLER_EXTEND_REFLECT,
1507         EXTEND_COUNT
1508 } sampler_extend_t;
1509
1510 #endif