1#ifndef GEN8_RENDER_H
2#define GEN8_RENDER_H
3
4#define INTEL_MASK(high, low) (((1 << ((high) - (low) + 1)) - 1) << (low))
5
6#define GEN8_3D(pipeline,op,sub) \
7	((3 << 29) | ((pipeline) << 27) | ((op) << 24) | ((sub) << 16))
8
9#define GEN8_STATE_BASE_ADDRESS			GEN8_3D(0, 1, 1)
10# define BASE_ADDRESS_MODIFY			(1 << 0)
11
12#define GEN8_STATE_SIP				GEN8_3D(0, 1, 2)
13
14#define GEN8_3DSTATE_VF_STATISTICS		GEN8_3D(1, 0, 0xb)
15#define GEN8_PIPELINE_SELECT			GEN8_3D(1, 1, 4)
16# define PIPELINE_SELECT_3D		0
17# define PIPELINE_SELECT_MEDIA		1
18
19#define GEN8_MEDIA_STATE_POINTERS		GEN8_3D(2, 0, 0)
20#define GEN8_MEDIA_OBJECT			GEN8_3D(2, 1, 0)
21
22#define GEN8_3DSTATE_CLEAR_PARAMS               GEN8_3D(3, 0, 0x04)
23#define GEN8_3DSTATE_DEPTH_BUFFER               GEN8_3D(3, 0, 0x05)
24# define DEPTH_BUFFER_TYPE_SHIFT	29
25# define DEPTH_BUFFER_FORMAT_SHIFT	18
26
27#define GEN8_3DSTATE_STENCIL_BUFFER		GEN8_3D(3, 0, 0x06)
28#define GEN8_3DSTATE_HIER_DEPTH_BUFFER		GEN8_3D(3, 0, 0x07)
29#define GEN8_3DSTATE_VERTEX_BUFFERS		GEN8_3D(3, 0, 0x08)
30# define VB_INDEX_SHIFT			26
31# define VB_MODIFY_ENABLE		(1 << 14)
32#define GEN8_3DSTATE_VERTEX_ELEMENTS		GEN8_3D(3, 0, 0x09)
33# define VE_INDEX_SHIFT		26
34# define VE_VALID					(1 << 25)
35# define VE_FORMAT_SHIFT				16
36# define VE_OFFSET_SHIFT				0
37# define VE_COMPONENT_0_SHIFT			28
38# define VE_COMPONENT_1_SHIFT			24
39# define VE_COMPONENT_2_SHIFT			20
40# define VE_COMPONENT_3_SHIFT			16
41#define GEN8_3DSTATE_INDEX_BUFFER		GEN8_3D(3, 0, 0x0a)
42#define GEN8_3DSTATE_VF				GEN8_3D(3, 0, 0x0c)
43
44#define GEN8_3DSTATE_MULTISAMPLE		GEN8_3D(3, 0, 0x0d)
45/* DW1 */
46# define MULTISAMPLE_PIXEL_LOCATION_CENTER		(0 << 4)
47# define MULTISAMPLE_PIXEL_LOCATION_UPPER_LEFT	(1 << 4)
48# define MULTISAMPLE_NUMSAMPLES_1			(0 << 1)
49# define MULTISAMPLE_NUMSAMPLES_4			(2 << 1)
50# define MULTISAMPLE_NUMSAMPLES_8			(3 << 1)
51
52#define GEN8_3DSTATE_CC_STATE_POINTERS		GEN8_3D(3, 0, 0x0e)
53#define GEN8_3DSTATE_SCISSOR_STATE_POINTERS	GEN8_3D(3, 0, 0x0f)
54
55#define GEN8_3DSTATE_VS				GEN8_3D(3, 0, 0x10)
56#define GEN8_3DSTATE_GS				GEN8_3D(3, 0, 0x11)
57#define GEN8_3DSTATE_CLIP			GEN8_3D(3, 0, 0x12)
58#define GEN8_3DSTATE_SF				GEN8_3D(3, 0, 0x13)
59# define SF_TRI_PROVOKE_SHIFT		29
60# define SF_LINE_PROVOKE_SHIFT		27
61# define SF_FAN_PROVOKE_SHIFT		25
62
63#define GEN8_3DSTATE_WM				GEN8_3D(3, 0, 0x14)
64/* DW1 */
65# define WM_STATISTICS_ENABLE                              (1 << 31)
66# define WM_DEPTH_CLEAR                                    (1 << 30)
67# define WM_DEPTH_RESOLVE                                  (1 << 28)
68# define WM_HIERARCHICAL_DEPTH_RESOLVE                     (1 << 27)
69# define WM_KILL_ENABLE                                    (1 << 25)
70# define WM_POSITION_ZW_PIXEL                              (0 << 17)
71# define WM_POSITION_ZW_CENTROID                           (2 << 17)
72# define WM_POSITION_ZW_SAMPLE                             (3 << 17)
73# define WM_NONPERSPECTIVE_SAMPLE_BARYCENTRIC              (1 << 16)
74# define WM_NONPERSPECTIVE_CENTROID_BARYCENTRIC            (1 << 15)
75# define WM_NONPERSPECTIVE_PIXEL_BARYCENTRIC               (1 << 14)
76# define WM_PERSPECTIVE_SAMPLE_BARYCENTRIC                 (1 << 13)
77# define WM_PERSPECTIVE_CENTROID_BARYCENTRIC               (1 << 12)
78# define WM_PERSPECTIVE_PIXEL_BARYCENTRIC                  (1 << 11)
79# define WM_LINE_END_CAP_AA_WIDTH_0_5                      (0 << 8)
80# define WM_LINE_END_CAP_AA_WIDTH_1_0                      (1 << 8)
81# define WM_LINE_END_CAP_AA_WIDTH_2_0                      (2 << 8)
82# define WM_LINE_END_CAP_AA_WIDTH_4_0                      (3 << 8)
83# define WM_LINE_AA_WIDTH_0_5                              (0 << 6)
84# define WM_LINE_AA_WIDTH_1_0                              (1 << 6)
85# define WM_LINE_AA_WIDTH_2_0                              (2 << 6)
86# define WM_LINE_AA_WIDTH_4_0                              (3 << 6)
87# define WM_POLYGON_STIPPLE_ENABLE                         (1 << 4)
88# define WM_LINE_STIPPLE_ENABLE                            (1 << 3)
89# define WM_POINT_RASTRULE_UPPER_RIGHT                     (1 << 2)
90# define WM_MSRAST_OFF_PIXEL                               (0 << 0)
91# define WM_MSRAST_OFF_PATTERN                             (1 << 0)
92# define WM_MSRAST_ON_PIXEL                                (2 << 0)
93# define WM_MSRAST_ON_PATTERN                              (3 << 0)
94
95#define GEN8_3DSTATE_CONSTANT_VS		GEN8_3D(3, 0, 0x15)
96#define GEN8_3DSTATE_CONSTANT_GS		GEN8_3D(3, 0, 0x16)
97#define GEN8_3DSTATE_CONSTANT_PS		GEN8_3D(3, 0, 0x17)
98
99#define GEN8_3DSTATE_SAMPLE_MASK		GEN8_3D(3, 0, 0x18)
100
101#define GEN8_3DSTATE_CONSTANT_HS                GEN8_3D(3, 0, 0x19)
102#define GEN8_3DSTATE_CONSTANT_DS                GEN8_3D(3, 0, 0x1a)
103
104#define GEN8_3DSTATE_HS                         GEN8_3D(3, 0, 0x1b)
105#define GEN8_3DSTATE_TE                         GEN8_3D(3, 0, 0x1c)
106#define GEN8_3DSTATE_DS                         GEN8_3D(3, 0, 0x1d)
107#define GEN8_3DSTATE_STREAMOUT                  GEN8_3D(3, 0, 0x1e)
108
109#define GEN8_3DSTATE_SBE                        GEN8_3D(3, 0, 0x1f)
110/* DW1 */
111# define SBE_FORCE_VERTEX_URB_READ_LENGTH  (1<<29)
112# define SBE_FORCE_VERTEX_URB_READ_OFFSET  (1<<28)
113# define SBE_NUM_OUTPUTS_SHIFT             22
114# define SBE_SWIZZLE_ENABLE                (1 << 21)
115# define SBE_POINT_SPRITE_LOWERLEFT        (1 << 20)
116# define SBE_URB_ENTRY_READ_LENGTH_SHIFT   11
117# define SBE_URB_ENTRY_READ_OFFSET_SHIFT   5
118
119#define GEN8_3DSTATE_PS                                 GEN8_3D(3, 0, 0x20)
120/* DW1:DW2 kernel pointer */
121/* DW3 */
122# define PS_SPF_MODE                               (1 << 31)
123# define PS_VECTOR_MASK_ENABLE                     (1 << 30)
124# define PS_SAMPLER_COUNT_SHIFT                    27
125# define PS_BINDING_TABLE_ENTRY_COUNT_SHIFT        18
126# define PS_FLOATING_POINT_MODE_IEEE_754           (0 << 16)
127# define PS_FLOATING_POINT_MODE_ALT                (1 << 16)
128/* DW4:DW5: scratch space */
129/* DW6 */
130# define PS_MAX_THREADS_SHIFT                      23
131# define PS_MAX_THREADS                            (62 << PS_MAX_THREADS_SHIFT)
132# define PS_PUSH_CONSTANT_ENABLE                   (1 << 11)
133# define PS_RENDER_TARGET_CLEAR			   (1 << 8)
134# define PS_RENDER_TARGET_RESOLVE		   (1 << 6)
135# define PS_POSOFFSET_NONE                         (0 << 3)
136# define PS_POSOFFSET_CENTROID                     (2 << 3)
137# define PS_POSOFFSET_SAMPLE                       (3 << 3)
138# define PS_32_DISPATCH_ENABLE                     (1 << 2)
139# define PS_16_DISPATCH_ENABLE                     (1 << 1)
140# define PS_8_DISPATCH_ENABLE                      (1 << 0)
141/* DW7 */
142# define PS_DISPATCH_START_GRF_SHIFT_0             16
143# define PS_DISPATCH_START_GRF_SHIFT_1             8
144# define PS_DISPATCH_START_GRF_SHIFT_2             0
145/* DW8:D9: kernel 1 pointer */
146/* DW10:D11: kernel 2 pointer */
147
148#define GEN8_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP      GEN8_3D(3, 0, 0x21)
149#define GEN8_3DSTATE_VIEWPORT_STATE_POINTERS_CC         GEN8_3D(3, 0, 0x23)
150
151#define GEN8_3DSTATE_BLEND_STATE_POINTERS               GEN8_3D(3, 0, 0x24)
152
153#define GEN8_3DSTATE_BINDING_TABLE_POINTERS_VS          GEN8_3D(3, 0, 0x26)
154#define GEN8_3DSTATE_BINDING_TABLE_POINTERS_HS          GEN8_3D(3, 0, 0x27)
155#define GEN8_3DSTATE_BINDING_TABLE_POINTERS_DS          GEN8_3D(3, 0, 0x28)
156#define GEN8_3DSTATE_BINDING_TABLE_POINTERS_GS          GEN8_3D(3, 0, 0x29)
157#define GEN8_3DSTATE_BINDING_TABLE_POINTERS_PS          GEN8_3D(3, 0, 0x2a)
158
159#define GEN8_3DSTATE_SAMPLER_STATE_POINTERS_VS          GEN8_3D(3, 0, 0x2b)
160#define GEN8_3DSTATE_SAMPLER_STATE_POINTERS_HS          GEN8_3D(3, 0, 0x2c)
161#define GEN8_3DSTATE_SAMPLER_STATE_POINTERS_DS          GEN8_3D(3, 0, 0x2d)
162#define GEN8_3DSTATE_SAMPLER_STATE_POINTERS_GS          GEN8_3D(3, 0, 0x2e)
163#define GEN8_3DSTATE_SAMPLER_STATE_POINTERS_PS          GEN8_3D(3, 0, 0x2f)
164
165#define GEN8_3DSTATE_URB_VS                             GEN8_3D(3, 0, 0x30)
166#define GEN8_3DSTATE_URB_HS                             GEN8_3D(3, 0, 0x31)
167#define GEN8_3DSTATE_URB_DS                             GEN8_3D(3, 0, 0x32)
168#define GEN8_3DSTATE_URB_GS                             GEN8_3D(3, 0, 0x33)
169/* DW1 */
170# define URB_ENTRY_NUMBER_SHIFT            0
171# define URB_ENTRY_SIZE_SHIFT              16
172# define URB_STARTING_ADDRESS_SHIFT        25
173
174#define GEN8_3DSTATE_GATHER_CONSTANT_VS             GEN8_3D(3, 0, 0x34)
175#define GEN8_3DSTATE_GATHER_CONSTANT_GS             GEN8_3D(3, 0, 0x35)
176#define GEN8_3DSTATE_GATHER_CONSTANT_HS             GEN8_3D(3, 0, 0x36)
177#define GEN8_3DSTATE_GATHER_CONSTANT_DS             GEN8_3D(3, 0, 0x37)
178#define GEN8_3DSTATE_GATHER_CONSTANT_PS             GEN8_3D(3, 0, 0x38)
179
180#define GEN8_3DSTATE_DX9_CONSTANTF_VS             GEN8_3D(3, 0, 0x39)
181#define GEN8_3DSTATE_DX9_CONSTANTF_PS             GEN8_3D(3, 0, 0x3a)
182#define GEN8_3DSTATE_DX9_CONSTANTI_VS             GEN8_3D(3, 0, 0x3b)
183#define GEN8_3DSTATE_DX9_CONSTANTI_PS             GEN8_3D(3, 0, 0x3c)
184#define GEN8_3DSTATE_DX9_CONSTANTB_VS             GEN8_3D(3, 0, 0x3d)
185#define GEN8_3DSTATE_DX9_CONSTANTB_PS             GEN8_3D(3, 0, 0x3e)
186#define GEN8_3DSTATE_DX9_LOCAL_VALID_VS           GEN8_3D(3, 0, 0x3f)
187#define GEN8_3DSTATE_DX9_LOCAL_VALID_PS           GEN8_3D(3, 0, 0x40)
188#define GEN8_3DSTATE_DX9_GENERATE_ACTIVE_VS       GEN8_3D(3, 0, 0x41)
189#define GEN8_3DSTATE_DX9_GENERATE_ACTIVE_PS       GEN8_3D(3, 0, 0x42)
190
191#define GEN8_3DSTATE_BINDING_TABLE_EDIT_VS       GEN8_3D(3, 0, 0x43)
192#define GEN8_3DSTATE_BINDING_TABLE_EDIT_GS       GEN8_3D(3, 0, 0x44)
193#define GEN8_3DSTATE_BINDING_TABLE_EDIT_HS       GEN8_3D(3, 0, 0x45)
194#define GEN8_3DSTATE_BINDING_TABLE_EDIT_DS       GEN8_3D(3, 0, 0x46)
195#define GEN8_3DSTATE_BINDING_TABLE_EDIT_PS       GEN8_3D(3, 0, 0x47)
196
197#define GEN8_3DSTATE_VF_INSTANCING		GEN8_3D(3, 0, 0x49)
198#define GEN8_3DSTATE_VF_SGVS			GEN8_3D(3, 0, 0x4a)
199# define SGVS_ENABLE_INSTANCE_ID			(1 << 31)
200# define SGVS_INSTANCE_ID_COMPONENT_SHIFT		29
201# define SGVS_INSTANCE_ID_ELEMENT_OFFSET_SHIFT	16
202# define SGVS_ENABLE_VERTEX_ID			(1 << 15)
203# define SGVS_VERTEX_ID_COMPONENT_SHIFT            13
204# define SGVS_VERTEX_ID_ELEMENT_OFFSET_SHIFT	0
205#define GEN8_3DSTATE_VF_TOPOLOGY		GEN8_3D(3, 0, 0x4b)
206# define POINTLIST         0x01
207# define LINELIST          0x02
208# define LINESTRIP         0x03
209# define TRILIST           0x04
210# define TRISTRIP          0x05
211# define TRIFAN            0x06
212# define QUADLIST          0x07
213# define QUADSTRIP         0x08
214# define LINELIST_ADJ      0x09
215# define LINESTRIP_ADJ     0x0A
216# define TRILIST_ADJ       0x0B
217# define TRISTRIP_ADJ      0x0C
218# define TRISTRIP_REVERSE  0x0D
219# define POLYGON           0x0E
220# define RECTLIST          0x0F
221# define LINELOOP          0x10
222# define POINTLIST_BF      0x11
223# define LINESTRIP_CONT    0x12
224# define LINESTRIP_BF      0x13
225# define LINESTRIP_CONT_BF 0x14
226# define TRIFAN_NOSTIPPLE  0x15
227
228#define GEN8_3DSTATE_WM_CHROMAKEY		GEN8_3D(3, 0, 0x4c)
229
230#define GEN8_3DSTATE_PS_BLEND				GEN8_3D(3, 0, 0x4d)
231# define PS_BLEND_ALPHA_TO_COVERAGE_ENABLE		(1 << 31)
232# define PS_BLEND_HAS_WRITEABLE_RT			(1 << 30)
233# define PS_BLEND_COLOR_BLEND_ENABLE			(1 << 29)
234# define PS_BLEND_SRC_ALPHA_SHIFT			24
235# define PS_BLEND_DST_ALPHA_SHIFT			19
236# define PS_BLEND_SRC_SHIFT				14
237# define PS_BLEND_DST_SHIFT				9
238# define PS_BLEND_ALPHA_TEST_ENABLE			(1 << 8)
239# define PS_BLEND_INDEPENDENT_ALPHA_BLEND_ENABLE	(1 << 7)
240
241#define GEN8_3DSTATE_WM_DEPTH_STENCIL		GEN8_3D(3, 0, 0x4e)
242/* DW1 */
243# define WM_DS_STENCIL_TEST_MASK_MASK		INTEL_MASK(31, 24)
244# define WM_DS_STENCIL_TEST_MASK_SHIFT		24
245# define WM_DS_STENCIL_WRITE_MASK_MASK		INTEL_MASK(23, 16)
246# define WM_DS_STENCIL_WRITE_MASK_SHIFT		16
247# define WM_DS_BF_STENCIL_TEST_MASK_MASK		INTEL_MASK(15, 8)
248# define WM_DS_BF_STENCIL_TEST_MASK_SHIFT		8
249# define WM_DS_BF_STENCIL_WRITE_MASK_MASK		INTEL_MASK(7, 0)
250# define WM_DS_DEPTH_FUNC_SHIFT			5
251# define WM_DS_DOUBLE_SIDED_STENCIL_ENABLE		(1 << 4)
252# define WM_DS_STENCIL_TEST_ENABLE			(1 << 3)
253# define WM_DS_STENCIL_BUFFER_WRITE_ENABLE		(1 << 2)
254# define WM_DS_DEPTH_TEST_ENABLE			(1 << 1)
255# define WM_DS_DEPTH_BUFFER_WRITE_ENABLE		(1 << 0)
256/* DW2 */
257# define WM_DS_STENCIL_TEST_MASK_MASK		INTEL_MASK(31, 24)
258# define WM_DS_STENCIL_TEST_MASK_SHIFT		24
259# define WM_DS_STENCIL_WRITE_MASK_MASK		INTEL_MASK(23, 16)
260# define WM_DS_STENCIL_WRITE_MASK_SHIFT		16
261# define WM_DS_BF_STENCIL_TEST_MASK_MASK		INTEL_MASK(15, 8)
262# define WM_DS_BF_STENCIL_TEST_MASK_SHIFT		8
263# define WM_DS_BF_STENCIL_WRITE_MASK_MASK		INTEL_MASK(7, 0)
264# define WM_DS_BF_STENCIL_WRITE_MASK_SHIFT		0
265
266#define GEN8_3DSTATE_PS_EXTRA		GEN8_3D(3, 0, 0x4f)
267# define PSX_PIXEL_SHADER_VALID                    (1 << 31)
268# define PSX_PIXEL_SHADER_NO_RT_WRITE              (1 << 30)
269# define PSX_OMASK_TO_RENDER_TARGET                (1 << 29)
270# define PSX_KILL_ENABLE                           (1 << 28)
271# define PSX_PSCDEPTH_OFF                          (0 << 26)
272# define PSX_PSCDEPTH_ON                           (1 << 26)
273# define PSX_PSCDEPTH_ON_GE                        (2 << 26)
274# define PSX_PSCDEPTH_ON_LE                        (3 << 26)
275# define PSX_FORCE_COMPUTED_DEPTH                  (1 << 25)
276# define PSX_USES_SOURCE_DEPTH                     (1 << 24)
277# define PSX_USES_SOURCE_W                         (1 << 23)
278# define PSX_ATTRIBUTE_ENABLE                      (1 << 8)
279# define PSX_SHADER_DISABLES_ALPHA_TO_COVERAGE     (1 << 7)
280# define PSX_SHADER_IS_PER_SAMPLE                  (1 << 6)
281# define PSX_SHADER_HAS_UAV                        (1 << 2)
282# define PSX_SHADER_USES_INPUT_COVERAGE_MASK       (1 << 1)
283
284#define GEN8_3DSTATE_RASTER		GEN8_3D(3, 0, 0x50)
285/* DW1 */
286# define RASTER_FRONT_WINDING_CCW                  (1 << 21)
287# define RASTER_CULL_BOTH                          (0 << 16)
288# define RASTER_CULL_NONE                          (1 << 16)
289# define RASTER_CULL_FRONT                         (2 << 16)
290# define RASTER_CULL_BACK                          (3 << 16)
291# define RASTER_SMOOTH_POINT_ENABLE                (1 << 13)
292# define RASTER_LINE_AA_ENABLE                     (1 << 2)
293# define RASTER_VIEWPORT_Z_CLIP_TEST_ENABLE        (1 << 0)
294
295#define GEN8_3DSTATE_SBE_SWIZ		GEN8_3D(3, 0, 0x51)
296#define GEN8_3DSTATE_WM_HZ_OP		GEN8_3D(3, 0, 0x52)
297
298
299#define GEN8_3DSTATE_DRAWING_RECTANGLE		GEN8_3D(3, 1, 0x00)
300#define GEN8_3DSTATE_SAMPLER_PALETTE_LOAD	GEN8_3D(3, 1, 0x02)
301#define GEN8_3DSTATE_CHROMA_KEY			GEN8_3D(3, 1, 0x04)
302
303#define GEN8_3DSTATE_POLY_STIPPLE_OFFSET	GEN8_3D(3, 1, 0x06)
304#define GEN8_3DSTATE_POLY_STIPPLE_PATTERN	GEN8_3D(3, 1, 0x07)
305#define GEN8_3DSTATE_LINE_STIPPLE		GEN8_3D(3, 1, 0x08)
306#define GEN8_3DSTATE_AA_LINE_PARAMS		GEN8_3D(3, 1, 0x0a)
307#define GEN8_3DSTATE_SAMPLER_PALETTE_LOAD1	GEN8_3D(3, 1, 0x0c)
308#define GEN8_3DSTATE_MONOFILTER_SIZE		GEN8_3D(3, 1, 0x11)
309#define GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_VS	GEN8_3D(3, 1, 0x12)
310#define GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_HS	GEN8_3D(3, 1, 0x13)
311#define GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_DS	GEN8_3D(3, 1, 0x14)
312#define GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_GS	GEN8_3D(3, 1, 0x15)
313#define GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_PS	GEN8_3D(3, 1, 0x16)
314/* DW1 */
315# define PUSH_CONSTANT_BUFFER_OFFSET_SHIFT 16
316# define PUSH_CONSTANT_BUFFER_SIZE_SHIFT 0
317
318#define GEN8_3DSTATE_SO_DECL_LIST		GEN8_3D(3, 1, 0x17)
319#define GEN8_3DSTATE_SO_BUFFER			GEN8_3D(3, 1, 0x18)
320#define GEN8_3DSTATE_BINDING_TABLE_POOL_ALLOC	GEN8_3D(3, 1, 0x19)
321#define GEN8_3DSTATE_GATHER_BUFFER_POOL_ALLOC	GEN8_3D(3, 1, 0x1a)
322#define GEN8_3DSTATE_DX9_CONSTANT_BUFFER_POOL_ALLOC	GEN8_3D(3, 1, 0x1b)
323#define GEN8_3DSTATE_SAMPLE_PATTERN		GEN8_3D(3, 1, 0x1c)
324
325
326/* for GEN8_PIPE_CONTROL */
327#define GEN8_PIPE_CONTROL		GEN8_3D(3, 2, 0)
328#define PIPE_CONTROL_CS_STALL      (1 << 20)
329#define PIPE_CONTROL_NOWRITE       (0 << 14)
330#define PIPE_CONTROL_WRITE_QWORD   (1 << 14)
331#define PIPE_CONTROL_WRITE_DEPTH   (2 << 14)
332#define PIPE_CONTROL_WRITE_TIME    (3 << 14)
333#define PIPE_CONTROL_DEPTH_STALL   (1 << 13)
334#define PIPE_CONTROL_WC_FLUSH      (1 << 12)
335#define PIPE_CONTROL_IS_FLUSH      (1 << 11)
336#define PIPE_CONTROL_TC_FLUSH      (1 << 10)
337#define PIPE_CONTROL_NOTIFY_ENABLE (1 << 8)
338#define PIPE_CONTROL_FLUSH         (1 << 7)
339#define PIPE_CONTROL_GLOBAL_GTT    (1 << 2)
340#define PIPE_CONTROL_LOCAL_PGTT    (0 << 2)
341#define PIPE_CONTROL_STALL_AT_SCOREBOARD   (1 << 1)
342#define PIPE_CONTROL_DEPTH_CACHE_FLUSH	(1 << 0)
343
344
345#define GEN8_3DPRIMITIVE			GEN8_3D(3, 3, 0)
346
347/* 3DPRIMITIVE bits */
348#define VERTEX_SEQUENTIAL (0 << 15)
349#define VERTEX_RANDOM	  (1 << 15)
350
351#define ANISORATIO_2     0
352#define ANISORATIO_4     1
353#define ANISORATIO_6     2
354#define ANISORATIO_8     3
355#define ANISORATIO_10    4
356#define ANISORATIO_12    5
357#define ANISORATIO_14    6
358#define ANISORATIO_16    7
359
360#define BLENDFACTOR_ONE                 0x1
361#define BLENDFACTOR_SRC_COLOR           0x2
362#define BLENDFACTOR_SRC_ALPHA           0x3
363#define BLENDFACTOR_DST_ALPHA           0x4
364#define BLENDFACTOR_DST_COLOR           0x5
365#define BLENDFACTOR_SRC_ALPHA_SATURATE  0x6
366#define BLENDFACTOR_CONST_COLOR         0x7
367#define BLENDFACTOR_CONST_ALPHA         0x8
368#define BLENDFACTOR_SRC1_COLOR          0x9
369#define BLENDFACTOR_SRC1_ALPHA          0x0A
370#define BLENDFACTOR_ZERO                0x11
371#define BLENDFACTOR_INV_SRC_COLOR       0x12
372#define BLENDFACTOR_INV_SRC_ALPHA       0x13
373#define BLENDFACTOR_INV_DST_ALPHA       0x14
374#define BLENDFACTOR_INV_DST_COLOR       0x15
375#define BLENDFACTOR_INV_CONST_COLOR     0x17
376#define BLENDFACTOR_INV_CONST_ALPHA     0x18
377#define BLENDFACTOR_INV_SRC1_COLOR      0x19
378#define BLENDFACTOR_INV_SRC1_ALPHA      0x1A
379
380#define BLENDFUNCTION_ADD               0
381#define BLENDFUNCTION_SUBTRACT          1
382#define BLENDFUNCTION_REVERSE_SUBTRACT  2
383#define GEN8_BLENDFUNCTION_MIN               3
384#define BLENDFUNCTION_MAX               4
385
386#define ALPHATEST_FORMAT_UNORM8         0
387#define ALPHATEST_FORMAT_FLOAT32        1
388
389#define CHROMAKEY_KILL_ON_ANY_MATCH  0
390#define CHROMAKEY_REPLACE_BLACK      1
391
392#define CLIP_API_OGL     0
393#define CLIP_API_DX      1
394
395#define CLIPMODE_NORMAL              0
396#define CLIPMODE_CLIP_ALL            1
397#define CLIPMODE_CLIP_NON_REJECTED   2
398#define CLIPMODE_REJECT_ALL          3
399#define CLIPMODE_ACCEPT_ALL          4
400
401#define CLIP_NDCSPACE     0
402#define CLIP_SCREENSPACE  1
403
404#define COMPAREFUNCTION_ALWAYS       0
405#define COMPAREFUNCTION_NEVER        1
406#define COMPAREFUNCTION_LESS         2
407#define COMPAREFUNCTION_EQUAL        3
408#define COMPAREFUNCTION_LEQUAL       4
409#define COMPAREFUNCTION_GREATER      5
410#define COMPAREFUNCTION_NOTEQUAL     6
411#define COMPAREFUNCTION_GEQUAL       7
412
413#define COVERAGE_PIXELS_HALF     0
414#define COVERAGE_PIXELS_1        1
415#define COVERAGE_PIXELS_2        2
416#define COVERAGE_PIXELS_4        3
417
418#define DEPTHFORMAT_D32_FLOAT_S8X24_UINT     0
419#define DEPTHFORMAT_D32_FLOAT                1
420#define DEPTHFORMAT_D24_UNORM_S8_UINT        2
421#define DEPTHFORMAT_D16_UNORM                5
422
423#define FLOATING_POINT_IEEE_754        0
424#define FLOATING_POINT_NON_IEEE_754    1
425
426#define INDEX_BYTE     0
427#define INDEX_WORD     1
428#define INDEX_DWORD    2
429
430#define LOGICOPFUNCTION_CLEAR            0
431#define LOGICOPFUNCTION_NOR              1
432#define LOGICOPFUNCTION_AND_INVERTED     2
433#define LOGICOPFUNCTION_COPY_INVERTED    3
434#define LOGICOPFUNCTION_AND_REVERSE      4
435#define LOGICOPFUNCTION_INVERT           5
436#define LOGICOPFUNCTION_XOR              6
437#define LOGICOPFUNCTION_NAND             7
438#define LOGICOPFUNCTION_AND              8
439#define LOGICOPFUNCTION_EQUIV            9
440#define LOGICOPFUNCTION_NOOP             10
441#define LOGICOPFUNCTION_OR_INVERTED      11
442#define LOGICOPFUNCTION_COPY             12
443#define LOGICOPFUNCTION_OR_REVERSE       13
444#define LOGICOPFUNCTION_OR               14
445#define LOGICOPFUNCTION_SET              15
446
447#define MAPFILTER_NEAREST	0x0
448#define MAPFILTER_LINEAR	0x1
449#define MAPFILTER_ANISOTROPIC	0x2
450#define MAPFILTER_FLEXIBLE 	0x3
451#define MAPFILTER_MONO 		0x6
452
453#define MIPFILTER_NONE        0
454#define MIPFILTER_NEAREST     1
455#define MIPFILTER_LINEAR      3
456
457#define POLYGON_FRONT_FACING     0
458#define POLYGON_BACK_FACING      1
459
460#define PREFILTER_ALWAYS     0x0
461#define PREFILTER_NEVER      0x1
462#define PREFILTER_LESS       0x2
463#define PREFILTER_EQUAL      0x3
464#define PREFILTER_LEQUAL     0x4
465#define PREFILTER_GREATER    0x5
466#define PREFILTER_NOTEQUAL   0x6
467#define PREFILTER_GEQUAL     0x7
468
469#define RASTRULE_UPPER_LEFT  0
470#define RASTRULE_UPPER_RIGHT 1
471
472#define STENCILOP_KEEP               0
473#define STENCILOP_ZERO               1
474#define STENCILOP_REPLACE            2
475#define STENCILOP_INCRSAT            3
476#define STENCILOP_DECRSAT            4
477#define STENCILOP_INCR               5
478#define STENCILOP_DECR               6
479#define STENCILOP_INVERT             7
480
481#define SURFACE_MIPMAPLAYOUT_BELOW   0
482#define SURFACE_MIPMAPLAYOUT_RIGHT   1
483
484#define SURFACEFORMAT_R32G32B32A32_FLOAT             0x000
485#define SURFACEFORMAT_R32G32B32A32_SINT              0x001
486#define SURFACEFORMAT_R32G32B32A32_UINT              0x002
487#define SURFACEFORMAT_R32G32B32A32_UNORM             0x003
488#define SURFACEFORMAT_R32G32B32A32_SNORM             0x004
489#define SURFACEFORMAT_R64G64_FLOAT                   0x005
490#define SURFACEFORMAT_R32G32B32X32_FLOAT             0x006
491#define SURFACEFORMAT_R32G32B32A32_SSCALED           0x007
492#define SURFACEFORMAT_R32G32B32A32_USCALED           0x008
493#define SURFACEFORMAT_R32G32B32_FLOAT                0x040
494#define SURFACEFORMAT_R32G32B32_SINT                 0x041
495#define SURFACEFORMAT_R32G32B32_UINT                 0x042
496#define SURFACEFORMAT_R32G32B32_UNORM                0x043
497#define SURFACEFORMAT_R32G32B32_SNORM                0x044
498#define SURFACEFORMAT_R32G32B32_SSCALED              0x045
499#define SURFACEFORMAT_R32G32B32_USCALED              0x046
500#define SURFACEFORMAT_R16G16B16A16_UNORM             0x080
501#define SURFACEFORMAT_R16G16B16A16_SNORM             0x081
502#define SURFACEFORMAT_R16G16B16A16_SINT              0x082
503#define SURFACEFORMAT_R16G16B16A16_UINT              0x083
504#define SURFACEFORMAT_R16G16B16A16_FLOAT             0x084
505#define SURFACEFORMAT_R32G32_FLOAT                   0x085
506#define SURFACEFORMAT_R32G32_SINT                    0x086
507#define SURFACEFORMAT_R32G32_UINT                    0x087
508#define SURFACEFORMAT_R32_FLOAT_X8X24_TYPELESS       0x088
509#define SURFACEFORMAT_X32_TYPELESS_G8X24_UINT        0x089
510#define SURFACEFORMAT_L32A32_FLOAT                   0x08A
511#define SURFACEFORMAT_R32G32_UNORM                   0x08B
512#define SURFACEFORMAT_R32G32_SNORM                   0x08C
513#define SURFACEFORMAT_R64_FLOAT                      0x08D
514#define SURFACEFORMAT_R16G16B16X16_UNORM             0x08E
515#define SURFACEFORMAT_R16G16B16X16_FLOAT             0x08F
516#define SURFACEFORMAT_A32X32_FLOAT                   0x090
517#define SURFACEFORMAT_L32X32_FLOAT                   0x091
518#define SURFACEFORMAT_I32X32_FLOAT                   0x092
519#define SURFACEFORMAT_R16G16B16A16_SSCALED           0x093
520#define SURFACEFORMAT_R16G16B16A16_USCALED           0x094
521#define SURFACEFORMAT_R32G32_SSCALED                 0x095
522#define SURFACEFORMAT_R32G32_USCALED                 0x096
523#define SURFACEFORMAT_B8G8R8A8_UNORM                 0x0C0
524#define SURFACEFORMAT_B8G8R8A8_UNORM_SRGB            0x0C1
525#define SURFACEFORMAT_R10G10B10A2_UNORM              0x0C2
526#define SURFACEFORMAT_R10G10B10A2_UNORM_SRGB         0x0C3
527#define SURFACEFORMAT_R10G10B10A2_UINT               0x0C4
528#define SURFACEFORMAT_R10G10B10_SNORM_A2_UNORM       0x0C5
529#define SURFACEFORMAT_R8G8B8A8_UNORM                 0x0C7
530#define SURFACEFORMAT_R8G8B8A8_UNORM_SRGB            0x0C8
531#define SURFACEFORMAT_R8G8B8A8_SNORM                 0x0C9
532#define SURFACEFORMAT_R8G8B8A8_SINT                  0x0CA
533#define SURFACEFORMAT_R8G8B8A8_UINT                  0x0CB
534#define SURFACEFORMAT_R16G16_UNORM                   0x0CC
535#define SURFACEFORMAT_R16G16_SNORM                   0x0CD
536#define SURFACEFORMAT_R16G16_SINT                    0x0CE
537#define SURFACEFORMAT_R16G16_UINT                    0x0CF
538#define SURFACEFORMAT_R16G16_FLOAT                   0x0D0
539#define SURFACEFORMAT_B10G10R10A2_UNORM              0x0D1
540#define SURFACEFORMAT_B10G10R10A2_UNORM_SRGB         0x0D2
541#define SURFACEFORMAT_R11G11B10_FLOAT                0x0D3
542#define SURFACEFORMAT_R32_SINT                       0x0D6
543#define SURFACEFORMAT_R32_UINT                       0x0D7
544#define SURFACEFORMAT_R32_FLOAT                      0x0D8
545#define SURFACEFORMAT_R24_UNORM_X8_TYPELESS          0x0D9
546#define SURFACEFORMAT_X24_TYPELESS_G8_UINT           0x0DA
547#define SURFACEFORMAT_L16A16_UNORM                   0x0DF
548#define SURFACEFORMAT_I24X8_UNORM                    0x0E0
549#define SURFACEFORMAT_L24X8_UNORM                    0x0E1
550#define SURFACEFORMAT_A24X8_UNORM                    0x0E2
551#define SURFACEFORMAT_I32_FLOAT                      0x0E3
552#define SURFACEFORMAT_L32_FLOAT                      0x0E4
553#define SURFACEFORMAT_A32_FLOAT                      0x0E5
554#define SURFACEFORMAT_B8G8R8X8_UNORM                 0x0E9
555#define SURFACEFORMAT_B8G8R8X8_UNORM_SRGB            0x0EA
556#define SURFACEFORMAT_R8G8B8X8_UNORM                 0x0EB
557#define SURFACEFORMAT_R8G8B8X8_UNORM_SRGB            0x0EC
558#define SURFACEFORMAT_R9G9B9E5_SHAREDEXP             0x0ED
559#define SURFACEFORMAT_B10G10R10X2_UNORM              0x0EE
560#define SURFACEFORMAT_L16A16_FLOAT                   0x0F0
561#define SURFACEFORMAT_R32_UNORM                      0x0F1
562#define SURFACEFORMAT_R32_SNORM                      0x0F2
563#define SURFACEFORMAT_R10G10B10X2_USCALED            0x0F3
564#define SURFACEFORMAT_R8G8B8A8_SSCALED               0x0F4
565#define SURFACEFORMAT_R8G8B8A8_USCALED               0x0F5
566#define SURFACEFORMAT_R16G16_SSCALED                 0x0F6
567#define SURFACEFORMAT_R16G16_USCALED                 0x0F7
568#define SURFACEFORMAT_R32_SSCALED                    0x0F8
569#define SURFACEFORMAT_R32_USCALED                    0x0F9
570#define SURFACEFORMAT_B5G6R5_UNORM                   0x100
571#define SURFACEFORMAT_B5G6R5_UNORM_SRGB              0x101
572#define SURFACEFORMAT_B5G5R5A1_UNORM                 0x102
573#define SURFACEFORMAT_B5G5R5A1_UNORM_SRGB            0x103
574#define SURFACEFORMAT_B4G4R4A4_UNORM                 0x104
575#define SURFACEFORMAT_B4G4R4A4_UNORM_SRGB            0x105
576#define SURFACEFORMAT_R8G8_UNORM                     0x106
577#define SURFACEFORMAT_R8G8_SNORM                     0x107
578#define SURFACEFORMAT_R8G8_SINT                      0x108
579#define SURFACEFORMAT_R8G8_UINT                      0x109
580#define SURFACEFORMAT_R16_UNORM                      0x10A
581#define SURFACEFORMAT_R16_SNORM                      0x10B
582#define SURFACEFORMAT_R16_SINT                       0x10C
583#define SURFACEFORMAT_R16_UINT                       0x10D
584#define SURFACEFORMAT_R16_FLOAT                      0x10E
585#define SURFACEFORMAT_I16_UNORM                      0x111
586#define SURFACEFORMAT_L16_UNORM                      0x112
587#define SURFACEFORMAT_A16_UNORM                      0x113
588#define SURFACEFORMAT_L8A8_UNORM                     0x114
589#define SURFACEFORMAT_I16_FLOAT                      0x115
590#define SURFACEFORMAT_L16_FLOAT                      0x116
591#define SURFACEFORMAT_A16_FLOAT                      0x117
592#define SURFACEFORMAT_R5G5_SNORM_B6_UNORM            0x119
593#define SURFACEFORMAT_B5G5R5X1_UNORM                 0x11A
594#define SURFACEFORMAT_B5G5R5X1_UNORM_SRGB            0x11B
595#define SURFACEFORMAT_R8G8_SSCALED                   0x11C
596#define SURFACEFORMAT_R8G8_USCALED                   0x11D
597#define SURFACEFORMAT_R16_SSCALED                    0x11E
598#define SURFACEFORMAT_R16_USCALED                    0x11F
599#define SURFACEFORMAT_R8_UNORM                       0x140
600#define SURFACEFORMAT_R8_SNORM                       0x141
601#define SURFACEFORMAT_R8_SINT                        0x142
602#define SURFACEFORMAT_R8_UINT                        0x143
603#define SURFACEFORMAT_A8_UNORM                       0x144
604#define SURFACEFORMAT_I8_UNORM                       0x145
605#define SURFACEFORMAT_L8_UNORM                       0x146
606#define SURFACEFORMAT_P4A4_UNORM                     0x147
607#define SURFACEFORMAT_A4P4_UNORM                     0x148
608#define SURFACEFORMAT_R8_SSCALED                     0x149
609#define SURFACEFORMAT_R8_USCALED                     0x14A
610#define SURFACEFORMAT_R1_UINT                        0x181
611#define SURFACEFORMAT_YCRCB_NORMAL                   0x182
612#define SURFACEFORMAT_YCRCB_SWAPUVY                  0x183
613#define SURFACEFORMAT_BC1_UNORM                      0x186
614#define SURFACEFORMAT_BC2_UNORM                      0x187
615#define SURFACEFORMAT_BC3_UNORM                      0x188
616#define SURFACEFORMAT_BC4_UNORM                      0x189
617#define SURFACEFORMAT_BC5_UNORM                      0x18A
618#define SURFACEFORMAT_BC1_UNORM_SRGB                 0x18B
619#define SURFACEFORMAT_BC2_UNORM_SRGB                 0x18C
620#define SURFACEFORMAT_BC3_UNORM_SRGB                 0x18D
621#define SURFACEFORMAT_MONO8                          0x18E
622#define SURFACEFORMAT_YCRCB_SWAPUV                   0x18F
623#define SURFACEFORMAT_YCRCB_SWAPY                    0x190
624#define SURFACEFORMAT_DXT1_RGB                       0x191
625#define SURFACEFORMAT_FXT1                           0x192
626#define SURFACEFORMAT_R8G8B8_UNORM                   0x193
627#define SURFACEFORMAT_R8G8B8_SNORM                   0x194
628#define SURFACEFORMAT_R8G8B8_SSCALED                 0x195
629#define SURFACEFORMAT_R8G8B8_USCALED                 0x196
630#define SURFACEFORMAT_R64G64B64A64_FLOAT             0x197
631#define SURFACEFORMAT_R64G64B64_FLOAT                0x198
632#define SURFACEFORMAT_BC4_SNORM                      0x199
633#define SURFACEFORMAT_BC5_SNORM                      0x19A
634#define SURFACEFORMAT_R16G16B16_UNORM                0x19C
635#define SURFACEFORMAT_R16G16B16_SNORM                0x19D
636#define SURFACEFORMAT_R16G16B16_SSCALED              0x19E
637#define SURFACEFORMAT_R16G16B16_USCALED              0x19F
638
639#define SURFACE_1D      0
640#define SURFACE_2D      1
641#define SURFACE_3D      2
642#define SURFACE_CUBE    3
643#define SURFACE_BUFFER  4
644#define SURFACE_NULL    7
645
646#define TEXCOORDMODE_WRAP            0
647#define TEXCOORDMODE_MIRROR          1
648#define TEXCOORDMODE_CLAMP           2
649#define TEXCOORDMODE_CUBE            3
650#define TEXCOORDMODE_CLAMP_BORDER    4
651#define TEXCOORDMODE_MIRROR_ONCE     5
652
653#define THREAD_PRIORITY_NORMAL   0
654#define THREAD_PRIORITY_HIGH     1
655
656#define VERTEX_SUBPIXEL_PRECISION_8BITS  0
657#define VERTEX_SUBPIXEL_PRECISION_4BITS  1
658
659#define COMPONENT_NOSTORE      0
660#define COMPONENT_STORE_SRC    1
661#define COMPONENT_STORE_0      2
662#define COMPONENT_STORE_1_FLT  3
663#define COMPONENT_STORE_1_INT  4
664#define COMPONENT_STORE_VID    5
665#define COMPONENT_STORE_IID    6
666#define COMPONENT_STORE_PID    7
667
668/* Execution Unit (EU) defines
669 */
670
671#define GEN8_ALIGN_1   0
672#define GEN8_ALIGN_16  1
673
674#define GEN8_ADDRESS_DIRECT                        0
675#define GEN8_ADDRESS_REGISTER_INDIRECT_REGISTER    1
676
677#define GEN8_CHANNEL_X     0
678#define GEN8_CHANNEL_Y     1
679#define GEN8_CHANNEL_Z     2
680#define GEN8_CHANNEL_W     3
681
682#define GEN8_COMPRESSION_NONE          0
683#define GEN8_COMPRESSION_2NDHALF       1
684#define GEN8_COMPRESSION_COMPRESSED    2
685
686#define GEN8_CONDITIONAL_NONE  0
687#define GEN8_CONDITIONAL_Z     1
688#define GEN8_CONDITIONAL_NZ    2
689#define GEN8_CONDITIONAL_EQ    1	/* Z */
690#define GEN8_CONDITIONAL_NEQ   2	/* NZ */
691#define GEN8_CONDITIONAL_G     3
692#define GEN8_CONDITIONAL_GE    4
693#define GEN8_CONDITIONAL_L     5
694#define GEN8_CONDITIONAL_LE    6
695#define GEN8_CONDITIONAL_C     7
696#define GEN8_CONDITIONAL_O     8
697
698#define GEN8_DEBUG_NONE        0
699#define GEN8_DEBUG_BREAKPOINT  1
700
701#define GEN8_DEPENDENCY_NORMAL         0
702#define GEN8_DEPENDENCY_NOTCLEARED     1
703#define GEN8_DEPENDENCY_NOTCHECKED     2
704#define GEN8_DEPENDENCY_DISABLE        3
705
706#define GEN8_EXECUTE_1     0
707#define GEN8_EXECUTE_2     1
708#define GEN8_EXECUTE_4     2
709#define GEN8_EXECUTE_8     3
710#define GEN8_EXECUTE_16    4
711#define GEN8_EXECUTE_32    5
712
713#define GEN8_HORIZONTAL_STRIDE_0   0
714#define GEN8_HORIZONTAL_STRIDE_1   1
715#define GEN8_HORIZONTAL_STRIDE_2   2
716#define GEN8_HORIZONTAL_STRIDE_4   3
717
718#define GEN8_INSTRUCTION_NORMAL    0
719#define GEN8_INSTRUCTION_SATURATE  1
720
721#define GEN8_OPCODE_MOV        1
722#define GEN8_OPCODE_SEL        2
723#define GEN8_OPCODE_NOT        4
724#define GEN8_OPCODE_AND        5
725#define GEN8_OPCODE_OR         6
726#define GEN8_OPCODE_XOR        7
727#define GEN8_OPCODE_SHR        8
728#define GEN8_OPCODE_SHL        9
729#define GEN8_OPCODE_RSR        10
730#define GEN8_OPCODE_RSL        11
731#define GEN8_OPCODE_ASR        12
732#define GEN8_OPCODE_CMP        16
733#define GEN8_OPCODE_JMPI       32
734#define GEN8_OPCODE_IF         34
735#define GEN8_OPCODE_IFF        35
736#define GEN8_OPCODE_ELSE       36
737#define GEN8_OPCODE_ENDIF      37
738#define GEN8_OPCODE_DO         38
739#define GEN8_OPCODE_WHILE      39
740#define GEN8_OPCODE_BREAK      40
741#define GEN8_OPCODE_CONTINUE   41
742#define GEN8_OPCODE_HALT       42
743#define GEN8_OPCODE_MSAVE      44
744#define GEN8_OPCODE_MRESTORE   45
745#define GEN8_OPCODE_PUSH       46
746#define GEN8_OPCODE_POP        47
747#define GEN8_OPCODE_WAIT       48
748#define GEN8_OPCODE_SEND       49
749#define GEN8_OPCODE_ADD        64
750#define GEN8_OPCODE_MUL        65
751#define GEN8_OPCODE_AVG        66
752#define GEN8_OPCODE_FRC        67
753#define GEN8_OPCODE_RNDU       68
754#define GEN8_OPCODE_RNDD       69
755#define GEN8_OPCODE_RNDE       70
756#define GEN8_OPCODE_RNDZ       71
757#define GEN8_OPCODE_MAC        72
758#define GEN8_OPCODE_MACH       73
759#define GEN8_OPCODE_LZD        74
760#define GEN8_OPCODE_SAD2       80
761#define GEN8_OPCODE_SADA2      81
762#define GEN8_OPCODE_DP4        84
763#define GEN8_OPCODE_DPH        85
764#define GEN8_OPCODE_DP3        86
765#define GEN8_OPCODE_DP2        87
766#define GEN8_OPCODE_DPA2       88
767#define GEN8_OPCODE_LINE       89
768#define GEN8_OPCODE_NOP        126
769
770#define GEN8_PREDICATE_NONE             0
771#define GEN8_PREDICATE_NORMAL           1
772#define GEN8_PREDICATE_ALIGN1_ANYV             2
773#define GEN8_PREDICATE_ALIGN1_ALLV             3
774#define GEN8_PREDICATE_ALIGN1_ANY2H            4
775#define GEN8_PREDICATE_ALIGN1_ALL2H            5
776#define GEN8_PREDICATE_ALIGN1_ANY4H            6
777#define GEN8_PREDICATE_ALIGN1_ALL4H            7
778#define GEN8_PREDICATE_ALIGN1_ANY8H            8
779#define GEN8_PREDICATE_ALIGN1_ALL8H            9
780#define GEN8_PREDICATE_ALIGN1_ANY16H           10
781#define GEN8_PREDICATE_ALIGN1_ALL16H           11
782#define GEN8_PREDICATE_ALIGN16_REPLICATE_X     2
783#define GEN8_PREDICATE_ALIGN16_REPLICATE_Y     3
784#define GEN8_PREDICATE_ALIGN16_REPLICATE_Z     4
785#define GEN8_PREDICATE_ALIGN16_REPLICATE_W     5
786#define GEN8_PREDICATE_ALIGN16_ANY4H           6
787#define GEN8_PREDICATE_ALIGN16_ALL4H           7
788
789#define GEN8_ARCHITECTURE_REGISTER_FILE    0
790#define GEN8_GENERAL_REGISTER_FILE         1
791#define GEN8_MESSAGE_REGISTER_FILE         2
792#define GEN8_IMMEDIATE_VALUE               3
793
794#define GEN8_REGISTER_TYPE_UD  0
795#define GEN8_REGISTER_TYPE_D   1
796#define GEN8_REGISTER_TYPE_UW  2
797#define GEN8_REGISTER_TYPE_W   3
798#define GEN8_REGISTER_TYPE_UB  4
799#define GEN8_REGISTER_TYPE_B   5
800#define GEN8_REGISTER_TYPE_VF  5	/* packed float vector, immediates only? */
801#define GEN8_REGISTER_TYPE_HF  6
802#define GEN8_REGISTER_TYPE_V   6	/* packed int vector, immediates only, uword dest only */
803#define GEN8_REGISTER_TYPE_F   7
804
805#define GEN8_ARF_NULL                  0x00
806#define GEN8_ARF_ADDRESS               0x10
807#define GEN8_ARF_ACCUMULATOR           0x20
808#define GEN8_ARF_FLAG                  0x30
809#define GEN8_ARF_MASK                  0x40
810#define GEN8_ARF_MASK_STACK            0x50
811#define GEN8_ARF_MASK_STACK_DEPTH      0x60
812#define GEN8_ARF_STATE                 0x70
813#define GEN8_ARF_CONTROL               0x80
814#define GEN8_ARF_NOTIFICATION_COUNT    0x90
815#define GEN8_ARF_IP                    0xA0
816
817#define GEN8_AMASK   0
818#define GEN8_IMASK   1
819#define GEN8_LMASK   2
820#define GEN8_CMASK   3
821
822#define GEN8_THREAD_NORMAL     0
823#define GEN8_THREAD_ATOMIC     1
824#define GEN8_THREAD_SWITCH     2
825
826#define GEN8_VERTICAL_STRIDE_0                 0
827#define GEN8_VERTICAL_STRIDE_1                 1
828#define GEN8_VERTICAL_STRIDE_2                 2
829#define GEN8_VERTICAL_STRIDE_4                 3
830#define GEN8_VERTICAL_STRIDE_8                 4
831#define GEN8_VERTICAL_STRIDE_16                5
832#define GEN8_VERTICAL_STRIDE_32                6
833#define GEN8_VERTICAL_STRIDE_64                7
834#define GEN8_VERTICAL_STRIDE_128               8
835#define GEN8_VERTICAL_STRIDE_256               9
836#define GEN8_VERTICAL_STRIDE_ONE_DIMENSIONAL   0xF
837
838#define GEN8_WIDTH_1       0
839#define GEN8_WIDTH_2       1
840#define GEN8_WIDTH_4       2
841#define GEN8_WIDTH_8       3
842#define GEN8_WIDTH_16      4
843
844#define GEN8_STATELESS_BUFFER_BOUNDARY_1K      0
845#define GEN8_STATELESS_BUFFER_BOUNDARY_2K      1
846#define GEN8_STATELESS_BUFFER_BOUNDARY_4K      2
847#define GEN8_STATELESS_BUFFER_BOUNDARY_8K      3
848#define GEN8_STATELESS_BUFFER_BOUNDARY_16K     4
849#define GEN8_STATELESS_BUFFER_BOUNDARY_32K     5
850#define GEN8_STATELESS_BUFFER_BOUNDARY_64K     6
851#define GEN8_STATELESS_BUFFER_BOUNDARY_128K    7
852#define GEN8_STATELESS_BUFFER_BOUNDARY_256K    8
853#define GEN8_STATELESS_BUFFER_BOUNDARY_512K    9
854#define GEN8_STATELESS_BUFFER_BOUNDARY_1M      10
855#define GEN8_STATELESS_BUFFER_BOUNDARY_2M      11
856
857#define GEN8_POLYGON_FACING_FRONT      0
858#define GEN8_POLYGON_FACING_BACK       1
859
860#define GEN8_MESSAGE_TARGET_NULL               0
861#define GEN8_MESSAGE_TARGET_MATH               1
862#define GEN8_MESSAGE_TARGET_SAMPLER            2
863#define GEN8_MESSAGE_TARGET_GATEWAY            3
864#define GEN8_MESSAGE_TARGET_DATAPORT_READ      4
865#define GEN8_MESSAGE_TARGET_DATAPORT_WRITE     5
866#define GEN8_MESSAGE_TARGET_URB                6
867#define GEN8_MESSAGE_TARGET_THREAD_SPAWNER     7
868
869#define GEN8_SAMPLER_RETURN_FORMAT_FLOAT32     0
870#define GEN8_SAMPLER_RETURN_FORMAT_UINT32      2
871#define GEN8_SAMPLER_RETURN_FORMAT_SINT32      3
872
873#define GEN8_SAMPLER_MESSAGE_SIMD8_SAMPLE              0
874#define GEN8_SAMPLER_MESSAGE_SIMD16_SAMPLE             0
875#define GEN8_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS        0
876#define GEN8_SAMPLER_MESSAGE_SIMD8_KILLPIX             1
877#define GEN8_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_LOD        1
878#define GEN8_SAMPLER_MESSAGE_SIMD16_SAMPLE_LOD         1
879#define GEN8_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_GRADIENTS  2
880#define GEN8_SAMPLER_MESSAGE_SIMD8_SAMPLE_GRADIENTS    2
881#define GEN8_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_COMPARE    0
882#define GEN8_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE     2
883#define GEN8_SAMPLER_MESSAGE_SIMD4X2_RESINFO           2
884#define GEN8_SAMPLER_MESSAGE_SIMD8_RESINFO             2
885#define GEN8_SAMPLER_MESSAGE_SIMD16_RESINFO            2
886#define GEN8_SAMPLER_MESSAGE_SIMD4X2_LD                3
887#define GEN8_SAMPLER_MESSAGE_SIMD8_LD                  3
888#define GEN8_SAMPLER_MESSAGE_SIMD16_LD                 3
889
890#define GEN8_DATAPORT_OWORD_BLOCK_1_OWORDLOW   0
891#define GEN8_DATAPORT_OWORD_BLOCK_1_OWORDHIGH  1
892#define GEN8_DATAPORT_OWORD_BLOCK_2_OWORDS     2
893#define GEN8_DATAPORT_OWORD_BLOCK_4_OWORDS     3
894#define GEN8_DATAPORT_OWORD_BLOCK_8_OWORDS     4
895
896#define GEN8_DATAPORT_OWORD_DUAL_BLOCK_1OWORD     0
897#define GEN8_DATAPORT_OWORD_DUAL_BLOCK_4OWORDS    2
898
899#define GEN8_DATAPORT_DWORD_SCATTERED_BLOCK_8DWORDS   2
900#define GEN8_DATAPORT_DWORD_SCATTERED_BLOCK_16DWORDS  3
901
902#define GEN8_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ          0
903#define GEN8_DATAPORT_READ_MESSAGE_OWORD_DUAL_BLOCK_READ     1
904#define GEN8_DATAPORT_READ_MESSAGE_DWORD_BLOCK_READ          2
905#define GEN8_DATAPORT_READ_MESSAGE_DWORD_SCATTERED_READ      3
906
907#define GEN8_DATAPORT_READ_TARGET_DATA_CACHE      0
908#define GEN8_DATAPORT_READ_TARGET_RENDER_CACHE    1
909#define GEN8_DATAPORT_READ_TARGET_SAMPLER_CACHE   2
910
911#define GEN8_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE                0
912#define GEN8_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE_REPLICATED     1
913#define GEN8_DATAPORT_RENDER_TARGET_WRITE_SIMD8_DUAL_SOURCE_SUBSPAN01         2
914#define GEN8_DATAPORT_RENDER_TARGET_WRITE_SIMD8_DUAL_SOURCE_SUBSPAN23         3
915#define GEN8_DATAPORT_RENDER_TARGET_WRITE_SIMD8_SINGLE_SOURCE_SUBSPAN01       4
916
917#define GEN8_DATAPORT_WRITE_MESSAGE_OWORD_BLOCK_WRITE                0
918#define GEN8_DATAPORT_WRITE_MESSAGE_OWORD_DUAL_BLOCK_WRITE           1
919#define GEN8_DATAPORT_WRITE_MESSAGE_DWORD_BLOCK_WRITE                2
920#define GEN8_DATAPORT_WRITE_MESSAGE_DWORD_SCATTERED_WRITE            3
921#define GEN8_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE              4
922#define GEN8_DATAPORT_WRITE_MESSAGE_STREAMED_VERTEX_BUFFER_WRITE     5
923#define GEN8_DATAPORT_WRITE_MESSAGE_FLUSH_RENDER_CACHE               7
924
925#define GEN8_MATH_FUNCTION_INV                              1
926#define GEN8_MATH_FUNCTION_LOG                              2
927#define GEN8_MATH_FUNCTION_EXP                              3
928#define GEN8_MATH_FUNCTION_SQRT                             4
929#define GEN8_MATH_FUNCTION_RSQ                              5
930#define GEN8_MATH_FUNCTION_SIN                              6 /* was 7 */
931#define GEN8_MATH_FUNCTION_COS                              7 /* was 8 */
932#define GEN8_MATH_FUNCTION_SINCOS                           8 /* was 6 */
933#define GEN8_MATH_FUNCTION_TAN                              9
934#define GEN8_MATH_FUNCTION_POW                              10
935#define GEN8_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER   11
936#define GEN8_MATH_FUNCTION_INT_DIV_QUOTIENT                 12
937#define GEN8_MATH_FUNCTION_INT_DIV_REMAINDER                13
938
939#define GEN8_MATH_INTEGER_UNSIGNED     0
940#define GEN8_MATH_INTEGER_SIGNED       1
941
942#define GEN8_MATH_PRECISION_FULL        0
943#define GEN8_MATH_PRECISION_PARTIAL     1
944
945#define GEN8_MATH_SATURATE_NONE         0
946#define GEN8_MATH_SATURATE_SATURATE     1
947
948#define GEN8_MATH_DATA_VECTOR  0
949#define GEN8_MATH_DATA_SCALAR  1
950
951#define GEN8_URB_OPCODE_WRITE  0
952
953#define GEN8_URB_SWIZZLE_NONE          0
954#define GEN8_URB_SWIZZLE_INTERLEAVE    1
955#define GEN8_URB_SWIZZLE_TRANSPOSE     2
956
957#define GEN8_SCRATCH_SPACE_SIZE_1K     0
958#define GEN8_SCRATCH_SPACE_SIZE_2K     1
959#define GEN8_SCRATCH_SPACE_SIZE_4K     2
960#define GEN8_SCRATCH_SPACE_SIZE_8K     3
961#define GEN8_SCRATCH_SPACE_SIZE_16K    4
962#define GEN8_SCRATCH_SPACE_SIZE_32K    5
963#define GEN8_SCRATCH_SPACE_SIZE_64K    6
964#define GEN8_SCRATCH_SPACE_SIZE_128K   7
965#define GEN8_SCRATCH_SPACE_SIZE_256K   8
966#define GEN8_SCRATCH_SPACE_SIZE_512K   9
967#define GEN8_SCRATCH_SPACE_SIZE_1M     10
968#define GEN8_SCRATCH_SPACE_SIZE_2M     11
969
970struct gen8_blend_state {
971	struct {
972		/* 00 */ uint32_t pad:19;
973		/* 19 */ uint32_t y_dither_offset:2;
974		/* 21 */ uint32_t x_dither_offset:2;
975		/* 23 */ uint32_t color_dither_enable:1;
976		/* 24 */ uint32_t alpha_test_function:3;
977		/* 27 */ uint32_t alpha_test:1;
978		/* 28 */ uint32_t alpha_to_coverage_dither:1;
979		/* 29 */ uint32_t alpha_to_one:1;
980		/* 30 */ uint32_t ia_blend:1;
981		/* 31 */ uint32_t alpha_to_coverage:1;
982	} common;
983
984	struct {
985		/* 00 */ uint32_t write_disable_blue:1;
986		/* 01 */ uint32_t write_disable_green:1;
987		/* 02 */ uint32_t write_disable_red:1;
988		/* 03 */ uint32_t write_disable_alpha:1;
989		/* 04 */ uint32_t pad0:1;
990		/* 05 */ uint32_t alpha_blend_function:3;
991		/* 08 */ uint32_t dest_alpha_blend_factor:5;
992		/* 13 */ uint32_t source_alpha_blend_factor:5;
993		/* 18 */ uint32_t color_blend_function:3;
994		/* 21 */ uint32_t dest_blend_factor:5;
995		/* 26 */ uint32_t source_blend_factor:5;
996		/* 31 */ uint32_t color_blend:1;
997		/* 32 */ uint32_t post_blend_clamp:1;
998		/* 33 */ uint32_t pre_blend_clamp:1;
999		/* 34 */ uint32_t color_clamp_range:2;
1000		/* 36 */ uint32_t pre_blend_source_only_clamp:1;
1001		/* 37 */ uint32_t pad1:22;
1002		/* 59 */ uint32_t logic_op_function:4;
1003		/* 63 */ uint32_t logic_op:1;
1004	} rt;
1005};
1006
1007struct gen8_color_calc_state {
1008	struct {
1009		/* 00 */ uint32_t alpha_test_format:1;
1010		/* 01 */ uint32_t pad0:14;
1011		/* 15 */ uint32_t round_disable:1;
1012		/* 16 */ uint32_t bf_stencil_ref:8;
1013		/* 24 */ uint32_t stencil_ref:8;
1014	} cc0;
1015
1016	union {
1017		float alpha_ref_f;
1018		struct {
1019			uint32_t ui:8;
1020			uint32_t pad0:24;
1021		} alpha_ref_fi;
1022	} cc1;
1023
1024	float constant_r;
1025	float constant_g;
1026	float constant_b;
1027	float constant_a;
1028};
1029
1030struct gen8_sampler_state {
1031	struct {
1032		/* 00 */ unsigned int aniso_algorithm:1;
1033		/* 01 */ unsigned int lod_bias:13;
1034		/* 14 */ unsigned int min_filter:3;
1035		/* 17 */ unsigned int mag_filter:3;
1036		/* 20 */ unsigned int mip_filter:2;
1037		/* 22 */ unsigned int base_level:5;
1038		/* 27 */ unsigned int lod_preclamp:2;
1039		/* 29 */ unsigned int default_color_mode:1;
1040		/* 30 */ unsigned int flexible_filter_clamp:1;
1041		/* 31 */ unsigned int disable:1;
1042	} ss0;
1043
1044	struct {
1045		/* 00 */ unsigned int cube_control_mode:1;
1046		/* 01 */ unsigned int shadow_function:3;
1047		/* 04 */ unsigned int chroma_key_mode:1;
1048		/* 05 */ unsigned int chroma_key_index:2;
1049		/* 07 */ unsigned int chroma_key_enable:1;
1050		/* 08 */ unsigned int max_lod:12;
1051		/* 20 */ unsigned int min_lod:12;
1052	} ss1;
1053
1054	struct {
1055		unsigned int pad:6;
1056		unsigned int default_color_pointer:26;
1057	} ss2;
1058
1059	struct {
1060		/* 00 */ unsigned int r_wrap_mode:3;
1061		/* 03 */ unsigned int t_wrap_mode:3;
1062		/* 06 */ unsigned int s_wrap_mode:3;
1063		/* 09 */ unsigned int pad:1;
1064		/* 10 */ unsigned int non_normalized_coord:1;
1065		/* 11 */ unsigned int trilinear_quality:2;
1066		/* 13 */ unsigned int address_round:6;
1067		/* 19 */ unsigned int max_aniso:3;
1068		/* 22 */ unsigned int pad0:2;
1069		/* 24 */ unsigned int non_separable_filter:8;
1070	} ss3;
1071};
1072
1073/* Surface state DW0 */
1074#define SURFACE_RC_READ_WRITE	(1 << 8)
1075#define SURFACE_TILED		(1 << 13)
1076#define SURFACE_TILED_Y		(1 << 12)
1077#define SURFACE_FORMAT_SHIFT	18
1078#define SURFACE_VALIGN_1	(0 << 16) /* reserved! */
1079#define SURFACE_VALIGN_4	(1 << 16)
1080#define SURFACE_VALIGN_8	(2 << 16)
1081#define SURFACE_VALIGN_16	(3 << 16)
1082#define SURFACE_HALIGN_1	(0 << 14) /* reserved! */
1083#define SURFACE_HALIGN_4	(1 << 14)
1084#define SURFACE_HALIGN_8	(2 << 14)
1085#define SURFACE_HALIGN_16	(3 << 14)
1086#define SURFACE_TYPE_SHIFT		29
1087
1088/* Surface state DW2 */
1089#define SURFACE_HEIGHT_SHIFT        16
1090#define SURFACE_WIDTH_SHIFT         0
1091
1092/* Surface state DW3 */
1093#define SURFACE_DEPTH_SHIFT         21
1094#define SURFACE_PITCH_SHIFT         0
1095
1096#define SWIZZLE_ZERO		0
1097#define SWIZZLE_ONE		1
1098#define SWIZZLE_RED		4
1099#define SWIZZLE_GREEN		5
1100#define SWIZZLE_BLUE		6
1101#define SWIZZLE_ALPHA		7
1102#define __SURFACE_SWIZZLE(r,g,b,a) \
1103	((a) << 16 | (b) << 19 | (g) << 22 | (r) << 25)
1104#define SURFACE_SWIZZLE(r,g,b,a) \
1105	__SURFACE_SWIZZLE(SWIZZLE_##r, SWIZZLE_##g, SWIZZLE_##b, SWIZZLE_##a)
1106
1107typedef enum {
1108	SAMPLER_FILTER_NEAREST = 0,
1109	SAMPLER_FILTER_BILINEAR,
1110	FILTER_COUNT
1111} sampler_filter_t;
1112
1113typedef enum {
1114	SAMPLER_EXTEND_NONE = 0,
1115	SAMPLER_EXTEND_REPEAT,
1116	SAMPLER_EXTEND_PAD,
1117	SAMPLER_EXTEND_REFLECT,
1118	EXTEND_COUNT
1119} sampler_extend_t;
1120
1121#endif
1122