1b8e80941Smrg/*
2b8e80941Smrg * Copyright (C) 2016 Intel Corporation
3b8e80941Smrg *
4b8e80941Smrg * Permission is hereby granted, free of charge, to any person obtaining a
5b8e80941Smrg * copy of this software and associated documentation files (the "Software"),
6b8e80941Smrg * to deal in the Software without restriction, including without limitation
7b8e80941Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8b8e80941Smrg * and/or sell copies of the Software, and to permit persons to whom the
9b8e80941Smrg * Software is furnished to do so, subject to the following conditions:
10b8e80941Smrg *
11b8e80941Smrg * The above copyright notice and this permission notice (including the next
12b8e80941Smrg * paragraph) shall be included in all copies or substantial portions of the
13b8e80941Smrg * Software.
14b8e80941Smrg *
15b8e80941Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16b8e80941Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17b8e80941Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18b8e80941Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19b8e80941Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20b8e80941Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21b8e80941Smrg * IN THE SOFTWARE.
22b8e80941Smrg */
23b8e80941Smrg
24b8e80941Smrg
25b8e80941Smrg/* Instructions, enums and structures for BDW.
26b8e80941Smrg *
27b8e80941Smrg * This file has been generated, do not hand edit.
28b8e80941Smrg */
29b8e80941Smrg
30b8e80941Smrg#ifndef GEN8_PACK_H
31b8e80941Smrg#define GEN8_PACK_H
32b8e80941Smrg
33b8e80941Smrg#include <stdio.h>
34b8e80941Smrg#include <stdint.h>
35b8e80941Smrg#include <stdbool.h>
36b8e80941Smrg#include <assert.h>
37b8e80941Smrg#include <math.h>
38b8e80941Smrg
39b8e80941Smrg#ifndef __gen_validate_value
40b8e80941Smrg#define __gen_validate_value(x)
41b8e80941Smrg#endif
42b8e80941Smrg
43b8e80941Smrg#ifndef __gen_field_functions
44b8e80941Smrg#define __gen_field_functions
45b8e80941Smrg
46b8e80941Smrg#ifdef NDEBUG
47b8e80941Smrg#define NDEBUG_UNUSED __attribute__((unused))
48b8e80941Smrg#else
49b8e80941Smrg#define NDEBUG_UNUSED
50b8e80941Smrg#endif
51b8e80941Smrg
52b8e80941Smrgunion __gen_value {
53b8e80941Smrg   float f;
54b8e80941Smrg   uint32_t dw;
55b8e80941Smrg};
56b8e80941Smrg
57b8e80941Smrgstatic inline uint64_t
58b8e80941Smrg__gen_mbo(uint32_t start, uint32_t end)
59b8e80941Smrg{
60b8e80941Smrg   return (~0ull >> (64 - (end - start + 1))) << start;
61b8e80941Smrg}
62b8e80941Smrg
63b8e80941Smrgstatic inline uint64_t
64b8e80941Smrg__gen_uint(uint64_t v, uint32_t start, NDEBUG_UNUSED uint32_t end)
65b8e80941Smrg{
66b8e80941Smrg   __gen_validate_value(v);
67b8e80941Smrg
68b8e80941Smrg#ifndef NDEBUG
69b8e80941Smrg   const int width = end - start + 1;
70b8e80941Smrg   if (width < 64) {
71b8e80941Smrg      const uint64_t max = (1ull << width) - 1;
72b8e80941Smrg      assert(v <= max);
73b8e80941Smrg   }
74b8e80941Smrg#endif
75b8e80941Smrg
76b8e80941Smrg   return v << start;
77b8e80941Smrg}
78b8e80941Smrg
79b8e80941Smrgstatic inline uint64_t
80b8e80941Smrg__gen_sint(int64_t v, uint32_t start, uint32_t end)
81b8e80941Smrg{
82b8e80941Smrg   const int width = end - start + 1;
83b8e80941Smrg
84b8e80941Smrg   __gen_validate_value(v);
85b8e80941Smrg
86b8e80941Smrg#ifndef NDEBUG
87b8e80941Smrg   if (width < 64) {
88b8e80941Smrg      const int64_t max = (1ll << (width - 1)) - 1;
89b8e80941Smrg      const int64_t min = -(1ll << (width - 1));
90b8e80941Smrg      assert(min <= v && v <= max);
91b8e80941Smrg   }
92b8e80941Smrg#endif
93b8e80941Smrg
94b8e80941Smrg   const uint64_t mask = ~0ull >> (64 - width);
95b8e80941Smrg
96b8e80941Smrg   return (v & mask) << start;
97b8e80941Smrg}
98b8e80941Smrg
99b8e80941Smrgstatic inline uint64_t
100b8e80941Smrg__gen_offset(uint64_t v, NDEBUG_UNUSED uint32_t start, NDEBUG_UNUSED uint32_t end)
101b8e80941Smrg{
102b8e80941Smrg   __gen_validate_value(v);
103b8e80941Smrg#ifndef NDEBUG
104b8e80941Smrg   uint64_t mask = (~0ull >> (64 - (end - start + 1))) << start;
105b8e80941Smrg
106b8e80941Smrg   assert((v & ~mask) == 0);
107b8e80941Smrg#endif
108b8e80941Smrg
109b8e80941Smrg   return v;
110b8e80941Smrg}
111b8e80941Smrg
112b8e80941Smrgstatic inline uint32_t
113b8e80941Smrg__gen_float(float v)
114b8e80941Smrg{
115b8e80941Smrg   __gen_validate_value(v);
116b8e80941Smrg   return ((union __gen_value) { .f = (v) }).dw;
117b8e80941Smrg}
118b8e80941Smrg
119b8e80941Smrgstatic inline uint64_t
120b8e80941Smrg__gen_sfixed(float v, uint32_t start, uint32_t end, uint32_t fract_bits)
121b8e80941Smrg{
122b8e80941Smrg   __gen_validate_value(v);
123b8e80941Smrg
124b8e80941Smrg   const float factor = (1 << fract_bits);
125b8e80941Smrg
126b8e80941Smrg#ifndef NDEBUG
127b8e80941Smrg   const float max = ((1 << (end - start)) - 1) / factor;
128b8e80941Smrg   const float min = -(1 << (end - start)) / factor;
129b8e80941Smrg   assert(min <= v && v <= max);
130b8e80941Smrg#endif
131b8e80941Smrg
132b8e80941Smrg   const int64_t int_val = llroundf(v * factor);
133b8e80941Smrg   const uint64_t mask = ~0ull >> (64 - (end - start + 1));
134b8e80941Smrg
135b8e80941Smrg   return (int_val & mask) << start;
136b8e80941Smrg}
137b8e80941Smrg
138b8e80941Smrgstatic inline uint64_t
139b8e80941Smrg__gen_ufixed(float v, uint32_t start, NDEBUG_UNUSED uint32_t end, uint32_t fract_bits)
140b8e80941Smrg{
141b8e80941Smrg   __gen_validate_value(v);
142b8e80941Smrg
143b8e80941Smrg   const float factor = (1 << fract_bits);
144b8e80941Smrg
145b8e80941Smrg#ifndef NDEBUG
146b8e80941Smrg   const float max = ((1 << (end - start + 1)) - 1) / factor;
147b8e80941Smrg   const float min = 0.0f;
148b8e80941Smrg   assert(min <= v && v <= max);
149b8e80941Smrg#endif
150b8e80941Smrg
151b8e80941Smrg   const uint64_t uint_val = llroundf(v * factor);
152b8e80941Smrg
153b8e80941Smrg   return uint_val << start;
154b8e80941Smrg}
155b8e80941Smrg
156b8e80941Smrg#ifndef __gen_address_type
157b8e80941Smrg#error #define __gen_address_type before including this file
158b8e80941Smrg#endif
159b8e80941Smrg
160b8e80941Smrg#ifndef __gen_user_data
161b8e80941Smrg#error #define __gen_combine_address before including this file
162b8e80941Smrg#endif
163b8e80941Smrg
164b8e80941Smrg#undef NDEBUG_UNUSED
165b8e80941Smrg
166b8e80941Smrg#endif
167b8e80941Smrg
168b8e80941Smrg
169b8e80941Smrgenum GEN8_3D_Color_Buffer_Blend_Factor {
170b8e80941Smrg   BLENDFACTOR_ONE                      =      1,
171b8e80941Smrg   BLENDFACTOR_SRC_COLOR                =      2,
172b8e80941Smrg   BLENDFACTOR_SRC_ALPHA                =      3,
173b8e80941Smrg   BLENDFACTOR_DST_ALPHA                =      4,
174b8e80941Smrg   BLENDFACTOR_DST_COLOR                =      5,
175b8e80941Smrg   BLENDFACTOR_SRC_ALPHA_SATURATE       =      6,
176b8e80941Smrg   BLENDFACTOR_CONST_COLOR              =      7,
177b8e80941Smrg   BLENDFACTOR_CONST_ALPHA              =      8,
178b8e80941Smrg   BLENDFACTOR_SRC1_COLOR               =      9,
179b8e80941Smrg   BLENDFACTOR_SRC1_ALPHA               =     10,
180b8e80941Smrg   BLENDFACTOR_ZERO                     =     17,
181b8e80941Smrg   BLENDFACTOR_INV_SRC_COLOR            =     18,
182b8e80941Smrg   BLENDFACTOR_INV_SRC_ALPHA            =     19,
183b8e80941Smrg   BLENDFACTOR_INV_DST_ALPHA            =     20,
184b8e80941Smrg   BLENDFACTOR_INV_DST_COLOR            =     21,
185b8e80941Smrg   BLENDFACTOR_INV_CONST_COLOR          =     23,
186b8e80941Smrg   BLENDFACTOR_INV_CONST_ALPHA          =     24,
187b8e80941Smrg   BLENDFACTOR_INV_SRC1_COLOR           =     25,
188b8e80941Smrg   BLENDFACTOR_INV_SRC1_ALPHA           =     26,
189b8e80941Smrg};
190b8e80941Smrg
191b8e80941Smrgenum GEN8_3D_Color_Buffer_Blend_Function {
192b8e80941Smrg   BLENDFUNCTION_ADD                    =      0,
193b8e80941Smrg   BLENDFUNCTION_SUBTRACT               =      1,
194b8e80941Smrg   BLENDFUNCTION_REVERSE_SUBTRACT       =      2,
195b8e80941Smrg   BLENDFUNCTION_MIN                    =      3,
196b8e80941Smrg   BLENDFUNCTION_MAX                    =      4,
197b8e80941Smrg};
198b8e80941Smrg
199b8e80941Smrgenum GEN8_3D_Compare_Function {
200b8e80941Smrg   COMPAREFUNCTION_ALWAYS               =      0,
201b8e80941Smrg   COMPAREFUNCTION_NEVER                =      1,
202b8e80941Smrg   COMPAREFUNCTION_LESS                 =      2,
203b8e80941Smrg   COMPAREFUNCTION_EQUAL                =      3,
204b8e80941Smrg   COMPAREFUNCTION_LEQUAL               =      4,
205b8e80941Smrg   COMPAREFUNCTION_GREATER              =      5,
206b8e80941Smrg   COMPAREFUNCTION_NOTEQUAL             =      6,
207b8e80941Smrg   COMPAREFUNCTION_GEQUAL               =      7,
208b8e80941Smrg};
209b8e80941Smrg
210b8e80941Smrgenum GEN8_3D_Logic_Op_Function {
211b8e80941Smrg   LOGICOP_CLEAR                        =      0,
212b8e80941Smrg   LOGICOP_NOR                          =      1,
213b8e80941Smrg   LOGICOP_AND_INVERTED                 =      2,
214b8e80941Smrg   LOGICOP_COPY_INVERTED                =      3,
215b8e80941Smrg   LOGICOP_AND_REVERSE                  =      4,
216b8e80941Smrg   LOGICOP_INVERT                       =      5,
217b8e80941Smrg   LOGICOP_XOR                          =      6,
218b8e80941Smrg   LOGICOP_NAND                         =      7,
219b8e80941Smrg   LOGICOP_AND                          =      8,
220b8e80941Smrg   LOGICOP_EQUIV                        =      9,
221b8e80941Smrg   LOGICOP_NOOP                         =     10,
222b8e80941Smrg   LOGICOP_OR_INVERTED                  =     11,
223b8e80941Smrg   LOGICOP_COPY                         =     12,
224b8e80941Smrg   LOGICOP_OR_REVERSE                   =     13,
225b8e80941Smrg   LOGICOP_OR                           =     14,
226b8e80941Smrg   LOGICOP_SET                          =     15,
227b8e80941Smrg};
228b8e80941Smrg
229b8e80941Smrgenum GEN8_3D_Prim_Topo_Type {
230b8e80941Smrg   _3DPRIM_POINTLIST                    =      1,
231b8e80941Smrg   _3DPRIM_LINELIST                     =      2,
232b8e80941Smrg   _3DPRIM_LINESTRIP                    =      3,
233b8e80941Smrg   _3DPRIM_TRILIST                      =      4,
234b8e80941Smrg   _3DPRIM_TRISTRIP                     =      5,
235b8e80941Smrg   _3DPRIM_TRIFAN                       =      6,
236b8e80941Smrg   _3DPRIM_QUADLIST                     =      7,
237b8e80941Smrg   _3DPRIM_QUADSTRIP                    =      8,
238b8e80941Smrg   _3DPRIM_LINELIST_ADJ                 =      9,
239b8e80941Smrg   _3DPRIM_LINESTRIP_ADJ                =     10,
240b8e80941Smrg   _3DPRIM_TRILIST_ADJ                  =     11,
241b8e80941Smrg   _3DPRIM_TRISTRIP_ADJ                 =     12,
242b8e80941Smrg   _3DPRIM_TRISTRIP_REVERSE             =     13,
243b8e80941Smrg   _3DPRIM_POLYGON                      =     14,
244b8e80941Smrg   _3DPRIM_RECTLIST                     =     15,
245b8e80941Smrg   _3DPRIM_LINELOOP                     =     16,
246b8e80941Smrg   _3DPRIM_POINTLIST_BF                 =     17,
247b8e80941Smrg   _3DPRIM_LINESTRIP_CONT               =     18,
248b8e80941Smrg   _3DPRIM_LINESTRIP_BF                 =     19,
249b8e80941Smrg   _3DPRIM_LINESTRIP_CONT_BF            =     20,
250b8e80941Smrg   _3DPRIM_TRIFAN_NOSTIPPLE             =     22,
251b8e80941Smrg   _3DPRIM_PATCHLIST_1                  =     32,
252b8e80941Smrg   _3DPRIM_PATCHLIST_2                  =     33,
253b8e80941Smrg   _3DPRIM_PATCHLIST_3                  =     34,
254b8e80941Smrg   _3DPRIM_PATCHLIST_4                  =     35,
255b8e80941Smrg   _3DPRIM_PATCHLIST_5                  =     36,
256b8e80941Smrg   _3DPRIM_PATCHLIST_6                  =     37,
257b8e80941Smrg   _3DPRIM_PATCHLIST_7                  =     38,
258b8e80941Smrg   _3DPRIM_PATCHLIST_8                  =     39,
259b8e80941Smrg   _3DPRIM_PATCHLIST_9                  =     40,
260b8e80941Smrg   _3DPRIM_PATCHLIST_10                 =     41,
261b8e80941Smrg   _3DPRIM_PATCHLIST_11                 =     42,
262b8e80941Smrg   _3DPRIM_PATCHLIST_12                 =     43,
263b8e80941Smrg   _3DPRIM_PATCHLIST_13                 =     44,
264b8e80941Smrg   _3DPRIM_PATCHLIST_14                 =     45,
265b8e80941Smrg   _3DPRIM_PATCHLIST_15                 =     46,
266b8e80941Smrg   _3DPRIM_PATCHLIST_16                 =     47,
267b8e80941Smrg   _3DPRIM_PATCHLIST_17                 =     48,
268b8e80941Smrg   _3DPRIM_PATCHLIST_18                 =     49,
269b8e80941Smrg   _3DPRIM_PATCHLIST_19                 =     50,
270b8e80941Smrg   _3DPRIM_PATCHLIST_20                 =     51,
271b8e80941Smrg   _3DPRIM_PATCHLIST_21                 =     52,
272b8e80941Smrg   _3DPRIM_PATCHLIST_22                 =     53,
273b8e80941Smrg   _3DPRIM_PATCHLIST_23                 =     54,
274b8e80941Smrg   _3DPRIM_PATCHLIST_24                 =     55,
275b8e80941Smrg   _3DPRIM_PATCHLIST_25                 =     56,
276b8e80941Smrg   _3DPRIM_PATCHLIST_26                 =     57,
277b8e80941Smrg   _3DPRIM_PATCHLIST_27                 =     58,
278b8e80941Smrg   _3DPRIM_PATCHLIST_28                 =     59,
279b8e80941Smrg   _3DPRIM_PATCHLIST_29                 =     60,
280b8e80941Smrg   _3DPRIM_PATCHLIST_30                 =     61,
281b8e80941Smrg   _3DPRIM_PATCHLIST_31                 =     62,
282b8e80941Smrg   _3DPRIM_PATCHLIST_32                 =     63,
283b8e80941Smrg};
284b8e80941Smrg
285b8e80941Smrgenum GEN8_3D_Stencil_Operation {
286b8e80941Smrg   STENCILOP_KEEP                       =      0,
287b8e80941Smrg   STENCILOP_ZERO                       =      1,
288b8e80941Smrg   STENCILOP_REPLACE                    =      2,
289b8e80941Smrg   STENCILOP_INCRSAT                    =      3,
290b8e80941Smrg   STENCILOP_DECRSAT                    =      4,
291b8e80941Smrg   STENCILOP_INCR                       =      5,
292b8e80941Smrg   STENCILOP_DECR                       =      6,
293b8e80941Smrg   STENCILOP_INVERT                     =      7,
294b8e80941Smrg};
295b8e80941Smrg
296b8e80941Smrgenum GEN8_3D_Vertex_Component_Control {
297b8e80941Smrg   VFCOMP_NOSTORE                       =      0,
298b8e80941Smrg   VFCOMP_STORE_SRC                     =      1,
299b8e80941Smrg   VFCOMP_STORE_0                       =      2,
300b8e80941Smrg   VFCOMP_STORE_1_FP                    =      3,
301b8e80941Smrg   VFCOMP_STORE_1_INT                   =      4,
302b8e80941Smrg   VFCOMP_STORE_PID                     =      7,
303b8e80941Smrg};
304b8e80941Smrg
305b8e80941Smrgenum GEN8_ClearColor {
306b8e80941Smrg   CC_ZERO                              =      0,
307b8e80941Smrg   CC_ONE                               =      1,
308b8e80941Smrg};
309b8e80941Smrg
310b8e80941Smrgenum GEN8_ShaderChannelSelect {
311b8e80941Smrg   SCS_ZERO                             =      0,
312b8e80941Smrg   SCS_ONE                              =      1,
313b8e80941Smrg   SCS_RED                              =      4,
314b8e80941Smrg   SCS_GREEN                            =      5,
315b8e80941Smrg   SCS_BLUE                             =      6,
316b8e80941Smrg   SCS_ALPHA                            =      7,
317b8e80941Smrg};
318b8e80941Smrg
319b8e80941Smrgenum GEN8_TextureCoordinateMode {
320b8e80941Smrg   TCM_WRAP                             =      0,
321b8e80941Smrg   TCM_MIRROR                           =      1,
322b8e80941Smrg   TCM_CLAMP                            =      2,
323b8e80941Smrg   TCM_CUBE                             =      3,
324b8e80941Smrg   TCM_CLAMP_BORDER                     =      4,
325b8e80941Smrg   TCM_MIRROR_ONCE                      =      5,
326b8e80941Smrg   TCM_HALF_BORDER                      =      6,
327b8e80941Smrg};
328b8e80941Smrg
329b8e80941Smrgenum GEN8_WRAP_SHORTEST_ENABLE {
330b8e80941Smrg   WSE_X                                =      1,
331b8e80941Smrg   WSE_Y                                =      2,
332b8e80941Smrg   WSE_XY                               =      3,
333b8e80941Smrg   WSE_Z                                =      4,
334b8e80941Smrg   WSE_XZ                               =      5,
335b8e80941Smrg   WSE_YZ                               =      6,
336b8e80941Smrg   WSE_XYZ                              =      7,
337b8e80941Smrg   WSE_W                                =      8,
338b8e80941Smrg   WSE_XW                               =      9,
339b8e80941Smrg   WSE_YW                               =     10,
340b8e80941Smrg   WSE_XYW                              =     11,
341b8e80941Smrg   WSE_ZW                               =     12,
342b8e80941Smrg   WSE_XZW                              =     13,
343b8e80941Smrg   WSE_YZW                              =     14,
344b8e80941Smrg   WSE_XYZW                             =     15,
345b8e80941Smrg};
346b8e80941Smrg
347b8e80941Smrg#define GEN8_3DSTATE_CONSTANT_BODY_length     10
348b8e80941Smrgstruct GEN8_3DSTATE_CONSTANT_BODY {
349b8e80941Smrg   uint32_t                             ReadLength[4];
350b8e80941Smrg   __gen_address_type                   Buffer[4];
351b8e80941Smrg};
352b8e80941Smrg
353b8e80941Smrgstatic inline void
354b8e80941SmrgGEN8_3DSTATE_CONSTANT_BODY_pack(__attribute__((unused)) __gen_user_data *data,
355b8e80941Smrg                                __attribute__((unused)) void * restrict dst,
356b8e80941Smrg                                __attribute__((unused)) const struct GEN8_3DSTATE_CONSTANT_BODY * restrict values)
357b8e80941Smrg{
358b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
359b8e80941Smrg
360b8e80941Smrg   dw[0] =
361b8e80941Smrg      __gen_uint(values->ReadLength[0], 0, 15) |
362b8e80941Smrg      __gen_uint(values->ReadLength[1], 16, 31);
363b8e80941Smrg
364b8e80941Smrg   dw[1] =
365b8e80941Smrg      __gen_uint(values->ReadLength[2], 0, 15) |
366b8e80941Smrg      __gen_uint(values->ReadLength[3], 16, 31);
367b8e80941Smrg
368b8e80941Smrg   const uint64_t v2_address =
369b8e80941Smrg      __gen_combine_address(data, &dw[2], values->Buffer[0], 0);
370b8e80941Smrg   dw[2] = v2_address;
371b8e80941Smrg   dw[3] = v2_address >> 32;
372b8e80941Smrg
373b8e80941Smrg   const uint64_t v4_address =
374b8e80941Smrg      __gen_combine_address(data, &dw[4], values->Buffer[1], 0);
375b8e80941Smrg   dw[4] = v4_address;
376b8e80941Smrg   dw[5] = v4_address >> 32;
377b8e80941Smrg
378b8e80941Smrg   const uint64_t v6_address =
379b8e80941Smrg      __gen_combine_address(data, &dw[6], values->Buffer[2], 0);
380b8e80941Smrg   dw[6] = v6_address;
381b8e80941Smrg   dw[7] = v6_address >> 32;
382b8e80941Smrg
383b8e80941Smrg   const uint64_t v8_address =
384b8e80941Smrg      __gen_combine_address(data, &dw[8], values->Buffer[3], 0);
385b8e80941Smrg   dw[8] = v8_address;
386b8e80941Smrg   dw[9] = v8_address >> 32;
387b8e80941Smrg}
388b8e80941Smrg
389b8e80941Smrg#define GEN8_BINDING_TABLE_EDIT_ENTRY_length      1
390b8e80941Smrgstruct GEN8_BINDING_TABLE_EDIT_ENTRY {
391b8e80941Smrg   uint64_t                             SurfaceStatePointer;
392b8e80941Smrg   uint32_t                             BindingTableIndex;
393b8e80941Smrg};
394b8e80941Smrg
395b8e80941Smrgstatic inline void
396b8e80941SmrgGEN8_BINDING_TABLE_EDIT_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
397b8e80941Smrg                                   __attribute__((unused)) void * restrict dst,
398b8e80941Smrg                                   __attribute__((unused)) const struct GEN8_BINDING_TABLE_EDIT_ENTRY * restrict values)
399b8e80941Smrg{
400b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
401b8e80941Smrg
402b8e80941Smrg   dw[0] =
403b8e80941Smrg      __gen_offset(values->SurfaceStatePointer, 0, 15) |
404b8e80941Smrg      __gen_uint(values->BindingTableIndex, 16, 23);
405b8e80941Smrg}
406b8e80941Smrg
407b8e80941Smrg#define GEN8_BINDING_TABLE_STATE_length        1
408b8e80941Smrgstruct GEN8_BINDING_TABLE_STATE {
409b8e80941Smrg   uint64_t                             SurfaceStatePointer;
410b8e80941Smrg};
411b8e80941Smrg
412b8e80941Smrgstatic inline void
413b8e80941SmrgGEN8_BINDING_TABLE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
414b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
415b8e80941Smrg                              __attribute__((unused)) const struct GEN8_BINDING_TABLE_STATE * restrict values)
416b8e80941Smrg{
417b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
418b8e80941Smrg
419b8e80941Smrg   dw[0] =
420b8e80941Smrg      __gen_offset(values->SurfaceStatePointer, 6, 31);
421b8e80941Smrg}
422b8e80941Smrg
423b8e80941Smrg#define GEN8_BLEND_STATE_ENTRY_length          2
424b8e80941Smrgstruct GEN8_BLEND_STATE_ENTRY {
425b8e80941Smrg   bool                                 WriteDisableBlue;
426b8e80941Smrg   bool                                 WriteDisableGreen;
427b8e80941Smrg   bool                                 WriteDisableRed;
428b8e80941Smrg   bool                                 WriteDisableAlpha;
429b8e80941Smrg   enum GEN8_3D_Color_Buffer_Blend_Function AlphaBlendFunction;
430b8e80941Smrg   enum GEN8_3D_Color_Buffer_Blend_Factor DestinationAlphaBlendFactor;
431b8e80941Smrg   enum GEN8_3D_Color_Buffer_Blend_Factor SourceAlphaBlendFactor;
432b8e80941Smrg   enum GEN8_3D_Color_Buffer_Blend_Function ColorBlendFunction;
433b8e80941Smrg   enum GEN8_3D_Color_Buffer_Blend_Factor DestinationBlendFactor;
434b8e80941Smrg   enum GEN8_3D_Color_Buffer_Blend_Factor SourceBlendFactor;
435b8e80941Smrg   bool                                 ColorBufferBlendEnable;
436b8e80941Smrg   bool                                 PostBlendColorClampEnable;
437b8e80941Smrg   bool                                 PreBlendColorClampEnable;
438b8e80941Smrg   uint32_t                             ColorClampRange;
439b8e80941Smrg#define COLORCLAMP_UNORM                         0
440b8e80941Smrg#define COLORCLAMP_SNORM                         1
441b8e80941Smrg#define COLORCLAMP_RTFORMAT                      2
442b8e80941Smrg   bool                                 PreBlendSourceOnlyClampEnable;
443b8e80941Smrg   enum GEN8_3D_Logic_Op_Function       LogicOpFunction;
444b8e80941Smrg   bool                                 LogicOpEnable;
445b8e80941Smrg};
446b8e80941Smrg
447b8e80941Smrgstatic inline void
448b8e80941SmrgGEN8_BLEND_STATE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
449b8e80941Smrg                            __attribute__((unused)) void * restrict dst,
450b8e80941Smrg                            __attribute__((unused)) const struct GEN8_BLEND_STATE_ENTRY * restrict values)
451b8e80941Smrg{
452b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
453b8e80941Smrg
454b8e80941Smrg   dw[0] =
455b8e80941Smrg      __gen_uint(values->WriteDisableBlue, 0, 0) |
456b8e80941Smrg      __gen_uint(values->WriteDisableGreen, 1, 1) |
457b8e80941Smrg      __gen_uint(values->WriteDisableRed, 2, 2) |
458b8e80941Smrg      __gen_uint(values->WriteDisableAlpha, 3, 3) |
459b8e80941Smrg      __gen_uint(values->AlphaBlendFunction, 5, 7) |
460b8e80941Smrg      __gen_uint(values->DestinationAlphaBlendFactor, 8, 12) |
461b8e80941Smrg      __gen_uint(values->SourceAlphaBlendFactor, 13, 17) |
462b8e80941Smrg      __gen_uint(values->ColorBlendFunction, 18, 20) |
463b8e80941Smrg      __gen_uint(values->DestinationBlendFactor, 21, 25) |
464b8e80941Smrg      __gen_uint(values->SourceBlendFactor, 26, 30) |
465b8e80941Smrg      __gen_uint(values->ColorBufferBlendEnable, 31, 31);
466b8e80941Smrg
467b8e80941Smrg   dw[1] =
468b8e80941Smrg      __gen_uint(values->PostBlendColorClampEnable, 0, 0) |
469b8e80941Smrg      __gen_uint(values->PreBlendColorClampEnable, 1, 1) |
470b8e80941Smrg      __gen_uint(values->ColorClampRange, 2, 3) |
471b8e80941Smrg      __gen_uint(values->PreBlendSourceOnlyClampEnable, 4, 4) |
472b8e80941Smrg      __gen_uint(values->LogicOpFunction, 27, 30) |
473b8e80941Smrg      __gen_uint(values->LogicOpEnable, 31, 31);
474b8e80941Smrg}
475b8e80941Smrg
476b8e80941Smrg#define GEN8_BLEND_STATE_length                1
477b8e80941Smrgstruct GEN8_BLEND_STATE {
478b8e80941Smrg   uint32_t                             YDitherOffset;
479b8e80941Smrg   uint32_t                             XDitherOffset;
480b8e80941Smrg   bool                                 ColorDitherEnable;
481b8e80941Smrg   enum GEN8_3D_Compare_Function        AlphaTestFunction;
482b8e80941Smrg   bool                                 AlphaTestEnable;
483b8e80941Smrg   bool                                 AlphaToCoverageDitherEnable;
484b8e80941Smrg   bool                                 AlphaToOneEnable;
485b8e80941Smrg   bool                                 IndependentAlphaBlendEnable;
486b8e80941Smrg   bool                                 AlphaToCoverageEnable;
487b8e80941Smrg   /* variable length fields follow */
488b8e80941Smrg};
489b8e80941Smrg
490b8e80941Smrgstatic inline void
491b8e80941SmrgGEN8_BLEND_STATE_pack(__attribute__((unused)) __gen_user_data *data,
492b8e80941Smrg                      __attribute__((unused)) void * restrict dst,
493b8e80941Smrg                      __attribute__((unused)) const struct GEN8_BLEND_STATE * restrict values)
494b8e80941Smrg{
495b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
496b8e80941Smrg
497b8e80941Smrg   dw[0] =
498b8e80941Smrg      __gen_uint(values->YDitherOffset, 19, 20) |
499b8e80941Smrg      __gen_uint(values->XDitherOffset, 21, 22) |
500b8e80941Smrg      __gen_uint(values->ColorDitherEnable, 23, 23) |
501b8e80941Smrg      __gen_uint(values->AlphaTestFunction, 24, 26) |
502b8e80941Smrg      __gen_uint(values->AlphaTestEnable, 27, 27) |
503b8e80941Smrg      __gen_uint(values->AlphaToCoverageDitherEnable, 28, 28) |
504b8e80941Smrg      __gen_uint(values->AlphaToOneEnable, 29, 29) |
505b8e80941Smrg      __gen_uint(values->IndependentAlphaBlendEnable, 30, 30) |
506b8e80941Smrg      __gen_uint(values->AlphaToCoverageEnable, 31, 31);
507b8e80941Smrg}
508b8e80941Smrg
509b8e80941Smrg#define GEN8_CC_VIEWPORT_length                2
510b8e80941Smrgstruct GEN8_CC_VIEWPORT {
511b8e80941Smrg   float                                MinimumDepth;
512b8e80941Smrg   float                                MaximumDepth;
513b8e80941Smrg};
514b8e80941Smrg
515b8e80941Smrgstatic inline void
516b8e80941SmrgGEN8_CC_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
517b8e80941Smrg                      __attribute__((unused)) void * restrict dst,
518b8e80941Smrg                      __attribute__((unused)) const struct GEN8_CC_VIEWPORT * restrict values)
519b8e80941Smrg{
520b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
521b8e80941Smrg
522b8e80941Smrg   dw[0] =
523b8e80941Smrg      __gen_float(values->MinimumDepth);
524b8e80941Smrg
525b8e80941Smrg   dw[1] =
526b8e80941Smrg      __gen_float(values->MaximumDepth);
527b8e80941Smrg}
528b8e80941Smrg
529b8e80941Smrg#define GEN8_COLOR_CALC_STATE_length           6
530b8e80941Smrgstruct GEN8_COLOR_CALC_STATE {
531b8e80941Smrg   uint32_t                             AlphaTestFormat;
532b8e80941Smrg#define ALPHATEST_UNORM8                         0
533b8e80941Smrg#define ALPHATEST_FLOAT32                        1
534b8e80941Smrg   bool                                 RoundDisableFunctionDisable;
535b8e80941Smrg   uint32_t                             BackfaceStencilReferenceValue;
536b8e80941Smrg   uint32_t                             StencilReferenceValue;
537b8e80941Smrg   uint32_t                             AlphaReferenceValueAsUNORM8;
538b8e80941Smrg   float                                AlphaReferenceValueAsFLOAT32;
539b8e80941Smrg   float                                BlendConstantColorRed;
540b8e80941Smrg   float                                BlendConstantColorGreen;
541b8e80941Smrg   float                                BlendConstantColorBlue;
542b8e80941Smrg   float                                BlendConstantColorAlpha;
543b8e80941Smrg};
544b8e80941Smrg
545b8e80941Smrgstatic inline void
546b8e80941SmrgGEN8_COLOR_CALC_STATE_pack(__attribute__((unused)) __gen_user_data *data,
547b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
548b8e80941Smrg                           __attribute__((unused)) const struct GEN8_COLOR_CALC_STATE * restrict values)
549b8e80941Smrg{
550b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
551b8e80941Smrg
552b8e80941Smrg   dw[0] =
553b8e80941Smrg      __gen_uint(values->AlphaTestFormat, 0, 0) |
554b8e80941Smrg      __gen_uint(values->RoundDisableFunctionDisable, 15, 15) |
555b8e80941Smrg      __gen_uint(values->BackfaceStencilReferenceValue, 16, 23) |
556b8e80941Smrg      __gen_uint(values->StencilReferenceValue, 24, 31);
557b8e80941Smrg
558b8e80941Smrg   dw[1] =
559b8e80941Smrg      __gen_uint(values->AlphaReferenceValueAsUNORM8, 0, 31) |
560b8e80941Smrg      __gen_float(values->AlphaReferenceValueAsFLOAT32);
561b8e80941Smrg
562b8e80941Smrg   dw[2] =
563b8e80941Smrg      __gen_float(values->BlendConstantColorRed);
564b8e80941Smrg
565b8e80941Smrg   dw[3] =
566b8e80941Smrg      __gen_float(values->BlendConstantColorGreen);
567b8e80941Smrg
568b8e80941Smrg   dw[4] =
569b8e80941Smrg      __gen_float(values->BlendConstantColorBlue);
570b8e80941Smrg
571b8e80941Smrg   dw[5] =
572b8e80941Smrg      __gen_float(values->BlendConstantColorAlpha);
573b8e80941Smrg}
574b8e80941Smrg
575b8e80941Smrg#define GEN8_FILTER_COEFFICIENT_length         1
576b8e80941Smrgstruct GEN8_FILTER_COEFFICIENT {
577b8e80941Smrg   float                                FilterCoefficient;
578b8e80941Smrg};
579b8e80941Smrg
580b8e80941Smrgstatic inline void
581b8e80941SmrgGEN8_FILTER_COEFFICIENT_pack(__attribute__((unused)) __gen_user_data *data,
582b8e80941Smrg                             __attribute__((unused)) void * restrict dst,
583b8e80941Smrg                             __attribute__((unused)) const struct GEN8_FILTER_COEFFICIENT * restrict values)
584b8e80941Smrg{
585b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
586b8e80941Smrg
587b8e80941Smrg   dw[0] =
588b8e80941Smrg      __gen_sfixed(values->FilterCoefficient, 0, 7, 6);
589b8e80941Smrg}
590b8e80941Smrg
591b8e80941Smrg#define GEN8_GATHER_CONSTANT_ENTRY_length      1
592b8e80941Smrgstruct GEN8_GATHER_CONSTANT_ENTRY {
593b8e80941Smrg   uint32_t                             BindingTableIndexOffset;
594b8e80941Smrg   uint32_t                             ChannelMask;
595b8e80941Smrg   uint64_t                             ConstantBufferOffset;
596b8e80941Smrg};
597b8e80941Smrg
598b8e80941Smrgstatic inline void
599b8e80941SmrgGEN8_GATHER_CONSTANT_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
600b8e80941Smrg                                __attribute__((unused)) void * restrict dst,
601b8e80941Smrg                                __attribute__((unused)) const struct GEN8_GATHER_CONSTANT_ENTRY * restrict values)
602b8e80941Smrg{
603b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
604b8e80941Smrg
605b8e80941Smrg   dw[0] =
606b8e80941Smrg      __gen_uint(values->BindingTableIndexOffset, 0, 3) |
607b8e80941Smrg      __gen_uint(values->ChannelMask, 4, 7) |
608b8e80941Smrg      __gen_offset(values->ConstantBufferOffset, 8, 15);
609b8e80941Smrg}
610b8e80941Smrg
611b8e80941Smrg#define GEN8_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT_length      3
612b8e80941Smrgstruct GEN8_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT {
613b8e80941Smrg   bool                                 MBErrorConcealmentPSliceWeightPredictionDisable;
614b8e80941Smrg   bool                                 MBErrorConcealmentPSliceMotionVectorsOverrideDisable;
615b8e80941Smrg   bool                                 MBErrorConcealmentBSpatialWeightPredictionDisable;
616b8e80941Smrg   bool                                 MBErrorConcealmentBSpatialMotionVectorsOverrideDisable;
617b8e80941Smrg   uint32_t                             MBErrorConcealmentBSpatialPredictionMode;
618b8e80941Smrg   bool                                 MBHeaderErrorHandling;
619b8e80941Smrg   bool                                 EntropyErrorHandling;
620b8e80941Smrg   bool                                 MPRErrorHandling;
621b8e80941Smrg   bool                                 BSDPrematureCompleteErrorHandling;
622b8e80941Smrg   uint32_t                             ConcealmentPictureID;
623b8e80941Smrg   bool                                 MBErrorConcealmentBTemporalWeightPredictionDisable;
624b8e80941Smrg   bool                                 MBErrorConcealmentBTemporalMotionVectorsOverrideEnable;
625b8e80941Smrg   uint32_t                             MBErrorConcealmentBTemporalPredictionMode;
626b8e80941Smrg   bool                                 IntraPredMode4x48x8LumaErrorControl;
627b8e80941Smrg   bool                                 InitCurrentMBNumber;
628b8e80941Smrg   uint32_t                             ConcealmentMethod;
629b8e80941Smrg   uint32_t                             FirstMBBitOffset;
630b8e80941Smrg   bool                                 LastSlice;
631b8e80941Smrg   bool                                 EmulationPreventionBytePresent;
632b8e80941Smrg   bool                                 FixPrevMBSkipped;
633b8e80941Smrg   uint32_t                             FirstMBByteOffsetofSliceDataorSliceHeader;
634b8e80941Smrg   bool                                 IntraPredictionErrorControl;
635b8e80941Smrg   bool                                 Intra8x84x4PredictionErrorConcealmentControl;
636b8e80941Smrg   uint32_t                             BSliceTemporalInterConcealmentMode;
637b8e80941Smrg   uint32_t                             BSliceSpatialInterConcealmentMode;
638b8e80941Smrg   uint32_t                             BSliceInterDirectTypeConcealmentMode;
639b8e80941Smrg   uint32_t                             BSliceConcealmentMode;
640b8e80941Smrg#define IntraConcealment                         1
641b8e80941Smrg#define InterConcealment                         0
642b8e80941Smrg   uint32_t                             PSliceInterConcealmentMode;
643b8e80941Smrg   uint32_t                             PSliceConcealmentMode;
644b8e80941Smrg#define IntraConcealment                         1
645b8e80941Smrg#define InterConcealment                         0
646b8e80941Smrg   uint32_t                             ConcealmentReferencePictureFieldBit;
647b8e80941Smrg   uint32_t                             ISliceConcealmentMode;
648b8e80941Smrg#define IntraConcealment                         1
649b8e80941Smrg#define InterConcealment                         0
650b8e80941Smrg};
651b8e80941Smrg
652b8e80941Smrgstatic inline void
653b8e80941SmrgGEN8_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
654b8e80941Smrg                                                         __attribute__((unused)) void * restrict dst,
655b8e80941Smrg                                                         __attribute__((unused)) const struct GEN8_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT * restrict values)
656b8e80941Smrg{
657b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
658b8e80941Smrg
659b8e80941Smrg   dw[0] =
660b8e80941Smrg      __gen_uint(values->MBErrorConcealmentPSliceWeightPredictionDisable, 0, 0) |
661b8e80941Smrg      __gen_uint(values->MBErrorConcealmentPSliceMotionVectorsOverrideDisable, 1, 1) |
662b8e80941Smrg      __gen_uint(values->MBErrorConcealmentBSpatialWeightPredictionDisable, 3, 3) |
663b8e80941Smrg      __gen_uint(values->MBErrorConcealmentBSpatialMotionVectorsOverrideDisable, 4, 4) |
664b8e80941Smrg      __gen_uint(values->MBErrorConcealmentBSpatialPredictionMode, 6, 7) |
665b8e80941Smrg      __gen_uint(values->MBHeaderErrorHandling, 8, 8) |
666b8e80941Smrg      __gen_uint(values->EntropyErrorHandling, 10, 10) |
667b8e80941Smrg      __gen_uint(values->MPRErrorHandling, 12, 12) |
668b8e80941Smrg      __gen_uint(values->BSDPrematureCompleteErrorHandling, 14, 14) |
669b8e80941Smrg      __gen_uint(values->ConcealmentPictureID, 16, 21) |
670b8e80941Smrg      __gen_uint(values->MBErrorConcealmentBTemporalWeightPredictionDisable, 24, 24) |
671b8e80941Smrg      __gen_uint(values->MBErrorConcealmentBTemporalMotionVectorsOverrideEnable, 25, 25) |
672b8e80941Smrg      __gen_uint(values->MBErrorConcealmentBTemporalPredictionMode, 27, 28) |
673b8e80941Smrg      __gen_uint(values->IntraPredMode4x48x8LumaErrorControl, 29, 29) |
674b8e80941Smrg      __gen_uint(values->InitCurrentMBNumber, 30, 30) |
675b8e80941Smrg      __gen_uint(values->ConcealmentMethod, 31, 31);
676b8e80941Smrg
677b8e80941Smrg   dw[1] =
678b8e80941Smrg      __gen_uint(values->FirstMBBitOffset, 0, 2) |
679b8e80941Smrg      __gen_uint(values->LastSlice, 3, 3) |
680b8e80941Smrg      __gen_uint(values->EmulationPreventionBytePresent, 4, 4) |
681b8e80941Smrg      __gen_uint(values->FixPrevMBSkipped, 7, 7) |
682b8e80941Smrg      __gen_uint(values->FirstMBByteOffsetofSliceDataorSliceHeader, 16, 31);
683b8e80941Smrg
684b8e80941Smrg   dw[2] =
685b8e80941Smrg      __gen_uint(values->IntraPredictionErrorControl, 0, 0) |
686b8e80941Smrg      __gen_uint(values->Intra8x84x4PredictionErrorConcealmentControl, 1, 1) |
687b8e80941Smrg      __gen_uint(values->BSliceTemporalInterConcealmentMode, 4, 6) |
688b8e80941Smrg      __gen_uint(values->BSliceSpatialInterConcealmentMode, 8, 10) |
689b8e80941Smrg      __gen_uint(values->BSliceInterDirectTypeConcealmentMode, 12, 13) |
690b8e80941Smrg      __gen_uint(values->BSliceConcealmentMode, 15, 15) |
691b8e80941Smrg      __gen_uint(values->PSliceInterConcealmentMode, 16, 18) |
692b8e80941Smrg      __gen_uint(values->PSliceConcealmentMode, 23, 23) |
693b8e80941Smrg      __gen_uint(values->ConcealmentReferencePictureFieldBit, 24, 29) |
694b8e80941Smrg      __gen_uint(values->ISliceConcealmentMode, 31, 31);
695b8e80941Smrg}
696b8e80941Smrg
697b8e80941Smrg#define GEN8_INTERFACE_DESCRIPTOR_DATA_length      8
698b8e80941Smrgstruct GEN8_INTERFACE_DESCRIPTOR_DATA {
699b8e80941Smrg   uint64_t                             KernelStartPointer;
700b8e80941Smrg   bool                                 SoftwareExceptionEnable;
701b8e80941Smrg   bool                                 MaskStackExceptionEnable;
702b8e80941Smrg   bool                                 IllegalOpcodeExceptionEnable;
703b8e80941Smrg   uint32_t                             FloatingPointMode;
704b8e80941Smrg#define IEEE754                                  0
705b8e80941Smrg#define Alternate                                1
706b8e80941Smrg   uint32_t                             ThreadPriority;
707b8e80941Smrg#define NormalPriority                           0
708b8e80941Smrg#define HighPriority                             1
709b8e80941Smrg   bool                                 SingleProgramFlow;
710b8e80941Smrg   uint32_t                             DenormMode;
711b8e80941Smrg#define Ftz                                      0
712b8e80941Smrg#define SetByKernel                              1
713b8e80941Smrg   uint32_t                             SamplerCount;
714b8e80941Smrg#define Nosamplersused                           0
715b8e80941Smrg#define Between1and4samplersused                 1
716b8e80941Smrg#define Between5and8samplersused                 2
717b8e80941Smrg#define Between9and12samplersused                3
718b8e80941Smrg#define Between13and16samplersused               4
719b8e80941Smrg   uint64_t                             SamplerStatePointer;
720b8e80941Smrg   uint32_t                             BindingTableEntryCount;
721b8e80941Smrg   uint64_t                             BindingTablePointer;
722b8e80941Smrg   uint32_t                             ConstantURBEntryReadOffset;
723b8e80941Smrg   uint32_t                             ConstantURBEntryReadLength;
724b8e80941Smrg   uint32_t                             NumberofThreadsinGPGPUThreadGroup;
725b8e80941Smrg   uint32_t                             SharedLocalMemorySize;
726b8e80941Smrg#define Encodes0k                                0
727b8e80941Smrg#define Encodes4k                                1
728b8e80941Smrg#define Encodes8k                                2
729b8e80941Smrg#define Encodes16k                               4
730b8e80941Smrg#define Encodes32k                               8
731b8e80941Smrg#define Encodes64k                               16
732b8e80941Smrg   bool                                 BarrierEnable;
733b8e80941Smrg   uint32_t                             RoundingMode;
734b8e80941Smrg#define RTNE                                     0
735b8e80941Smrg#define RU                                       1
736b8e80941Smrg#define RD                                       2
737b8e80941Smrg#define RTZ                                      3
738b8e80941Smrg   uint32_t                             CrossThreadConstantDataReadLength;
739b8e80941Smrg};
740b8e80941Smrg
741b8e80941Smrgstatic inline void
742b8e80941SmrgGEN8_INTERFACE_DESCRIPTOR_DATA_pack(__attribute__((unused)) __gen_user_data *data,
743b8e80941Smrg                                    __attribute__((unused)) void * restrict dst,
744b8e80941Smrg                                    __attribute__((unused)) const struct GEN8_INTERFACE_DESCRIPTOR_DATA * restrict values)
745b8e80941Smrg{
746b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
747b8e80941Smrg
748b8e80941Smrg   const uint64_t v0 =
749b8e80941Smrg      __gen_offset(values->KernelStartPointer, 6, 47);
750b8e80941Smrg   dw[0] = v0;
751b8e80941Smrg   dw[1] = v0 >> 32;
752b8e80941Smrg
753b8e80941Smrg   dw[2] =
754b8e80941Smrg      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
755b8e80941Smrg      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
756b8e80941Smrg      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
757b8e80941Smrg      __gen_uint(values->FloatingPointMode, 16, 16) |
758b8e80941Smrg      __gen_uint(values->ThreadPriority, 17, 17) |
759b8e80941Smrg      __gen_uint(values->SingleProgramFlow, 18, 18) |
760b8e80941Smrg      __gen_uint(values->DenormMode, 19, 19);
761b8e80941Smrg
762b8e80941Smrg   dw[3] =
763b8e80941Smrg      __gen_uint(values->SamplerCount, 2, 4) |
764b8e80941Smrg      __gen_offset(values->SamplerStatePointer, 5, 31);
765b8e80941Smrg
766b8e80941Smrg   dw[4] =
767b8e80941Smrg      __gen_uint(values->BindingTableEntryCount, 0, 4) |
768b8e80941Smrg      __gen_offset(values->BindingTablePointer, 5, 15);
769b8e80941Smrg
770b8e80941Smrg   dw[5] =
771b8e80941Smrg      __gen_uint(values->ConstantURBEntryReadOffset, 0, 15) |
772b8e80941Smrg      __gen_uint(values->ConstantURBEntryReadLength, 16, 31);
773b8e80941Smrg
774b8e80941Smrg   dw[6] =
775b8e80941Smrg      __gen_uint(values->NumberofThreadsinGPGPUThreadGroup, 0, 9) |
776b8e80941Smrg      __gen_uint(values->SharedLocalMemorySize, 16, 20) |
777b8e80941Smrg      __gen_uint(values->BarrierEnable, 21, 21) |
778b8e80941Smrg      __gen_uint(values->RoundingMode, 22, 23);
779b8e80941Smrg
780b8e80941Smrg   dw[7] =
781b8e80941Smrg      __gen_uint(values->CrossThreadConstantDataReadLength, 0, 7);
782b8e80941Smrg}
783b8e80941Smrg
784b8e80941Smrg#define GEN8_MEMORYADDRESSATTRIBUTES_length      1
785b8e80941Smrgstruct GEN8_MEMORYADDRESSATTRIBUTES {
786b8e80941Smrg   uint32_t                             AgeforQUADLRU;
787b8e80941Smrg   uint32_t                             TargetCache;
788b8e80941Smrg#define eLLCOnly                                 0
789b8e80941Smrg#define LLCOnly                                  1
790b8e80941Smrg#define LLCeLLC                                  2
791b8e80941Smrg#define L3LLCeLLC                                3
792b8e80941Smrg   uint32_t                             ArbitrationPriorityControl;
793b8e80941Smrg};
794b8e80941Smrg
795b8e80941Smrgstatic inline void
796b8e80941SmrgGEN8_MEMORYADDRESSATTRIBUTES_pack(__attribute__((unused)) __gen_user_data *data,
797b8e80941Smrg                                  __attribute__((unused)) void * restrict dst,
798b8e80941Smrg                                  __attribute__((unused)) const struct GEN8_MEMORYADDRESSATTRIBUTES * restrict values)
799b8e80941Smrg{
800b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
801b8e80941Smrg
802b8e80941Smrg   dw[0] =
803b8e80941Smrg      __gen_uint(values->AgeforQUADLRU, 0, 1) |
804b8e80941Smrg      __gen_uint(values->TargetCache, 3, 4) |
805b8e80941Smrg      __gen_uint(values->ArbitrationPriorityControl, 7, 8);
806b8e80941Smrg}
807b8e80941Smrg
808b8e80941Smrg#define GEN8_MEMORY_OBJECT_CONTROL_STATE_length      1
809b8e80941Smrgstruct GEN8_MEMORY_OBJECT_CONTROL_STATE {
810b8e80941Smrg   uint32_t                             AgeforQUADLRU;
811b8e80941Smrg   uint32_t                             TargetCache;
812b8e80941Smrg#define eLLCOnlywheneDRAMispresentelsegetsallocatedinLLC 0
813b8e80941Smrg#define LLCOnly                                  1
814b8e80941Smrg#define LLCeLLCAllowed                           2
815b8e80941Smrg#define L3DefertoPATforLLCeLLCselection          3
816b8e80941Smrg   uint32_t                             MemoryTypeLLCeLLCCacheabilityControl;
817b8e80941Smrg#define UCwithFenceifcoherentcycle               0
818b8e80941Smrg#define UCUncacheable                            1
819b8e80941Smrg#define WT                                       2
820b8e80941Smrg#define WB                                       3
821b8e80941Smrg};
822b8e80941Smrg
823b8e80941Smrgstatic inline void
824b8e80941SmrgGEN8_MEMORY_OBJECT_CONTROL_STATE_pack(__attribute__((unused)) __gen_user_data *data,
825b8e80941Smrg                                      __attribute__((unused)) void * restrict dst,
826b8e80941Smrg                                      __attribute__((unused)) const struct GEN8_MEMORY_OBJECT_CONTROL_STATE * restrict values)
827b8e80941Smrg{
828b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
829b8e80941Smrg
830b8e80941Smrg   dw[0] =
831b8e80941Smrg      __gen_uint(values->AgeforQUADLRU, 0, 1) |
832b8e80941Smrg      __gen_uint(values->TargetCache, 3, 4) |
833b8e80941Smrg      __gen_uint(values->MemoryTypeLLCeLLCCacheabilityControl, 5, 6);
834b8e80941Smrg}
835b8e80941Smrg
836b8e80941Smrg#define GEN8_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION_length      2
837b8e80941Smrgstruct GEN8_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION {
838b8e80941Smrg   uint32_t                             FirstMBBitOffset;
839b8e80941Smrg   bool                                 LastMB;
840b8e80941Smrg   bool                                 LastPicSlice;
841b8e80941Smrg   uint32_t                             SliceConcealmentType;
842b8e80941Smrg   uint32_t                             SliceConcealmentOverride;
843b8e80941Smrg   uint32_t                             MBCount;
844b8e80941Smrg   uint32_t                             SliceVerticalPosition;
845b8e80941Smrg   uint32_t                             SliceHorizontalPosition;
846b8e80941Smrg   uint32_t                             NextSliceHorizontalPosition;
847b8e80941Smrg   uint32_t                             NextSliceVerticalPosition;
848b8e80941Smrg   uint32_t                             QuantizerScaleCode;
849b8e80941Smrg};
850b8e80941Smrg
851b8e80941Smrgstatic inline void
852b8e80941SmrgGEN8_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION_pack(__attribute__((unused)) __gen_user_data *data,
853b8e80941Smrg                                                       __attribute__((unused)) void * restrict dst,
854b8e80941Smrg                                                       __attribute__((unused)) const struct GEN8_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION * restrict values)
855b8e80941Smrg{
856b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
857b8e80941Smrg
858b8e80941Smrg   dw[0] =
859b8e80941Smrg      __gen_uint(values->FirstMBBitOffset, 0, 2) |
860b8e80941Smrg      __gen_uint(values->LastMB, 3, 3) |
861b8e80941Smrg      __gen_uint(values->LastPicSlice, 5, 5) |
862b8e80941Smrg      __gen_uint(values->SliceConcealmentType, 6, 6) |
863b8e80941Smrg      __gen_uint(values->SliceConcealmentOverride, 7, 7) |
864b8e80941Smrg      __gen_uint(values->MBCount, 8, 15) |
865b8e80941Smrg      __gen_uint(values->SliceVerticalPosition, 16, 23) |
866b8e80941Smrg      __gen_uint(values->SliceHorizontalPosition, 24, 31);
867b8e80941Smrg
868b8e80941Smrg   dw[1] =
869b8e80941Smrg      __gen_uint(values->NextSliceHorizontalPosition, 0, 7) |
870b8e80941Smrg      __gen_uint(values->NextSliceVerticalPosition, 8, 16) |
871b8e80941Smrg      __gen_uint(values->QuantizerScaleCode, 24, 28);
872b8e80941Smrg}
873b8e80941Smrg
874b8e80941Smrg#define GEN8_MI_MATH_ALU_INSTRUCTION_length      1
875b8e80941Smrgstruct GEN8_MI_MATH_ALU_INSTRUCTION {
876b8e80941Smrg   uint32_t                             Operand2;
877b8e80941Smrg#define MI_ALU_REG0                              0
878b8e80941Smrg#define MI_ALU_REG1                              1
879b8e80941Smrg#define MI_ALU_REG2                              2
880b8e80941Smrg#define MI_ALU_REG3                              3
881b8e80941Smrg#define MI_ALU_REG4                              4
882b8e80941Smrg#define MI_ALU_REG5                              5
883b8e80941Smrg#define MI_ALU_REG6                              6
884b8e80941Smrg#define MI_ALU_REG7                              7
885b8e80941Smrg#define MI_ALU_REG8                              8
886b8e80941Smrg#define MI_ALU_REG9                              9
887b8e80941Smrg#define MI_ALU_REG10                             10
888b8e80941Smrg#define MI_ALU_REG11                             11
889b8e80941Smrg#define MI_ALU_REG12                             12
890b8e80941Smrg#define MI_ALU_REG13                             13
891b8e80941Smrg#define MI_ALU_REG14                             14
892b8e80941Smrg#define MI_ALU_REG15                             15
893b8e80941Smrg#define MI_ALU_SRCA                              32
894b8e80941Smrg#define MI_ALU_SRCB                              33
895b8e80941Smrg#define MI_ALU_ACCU                              49
896b8e80941Smrg#define MI_ALU_ZF                                50
897b8e80941Smrg#define MI_ALU_CF                                51
898b8e80941Smrg   uint32_t                             Operand1;
899b8e80941Smrg#define MI_ALU_REG0                              0
900b8e80941Smrg#define MI_ALU_REG1                              1
901b8e80941Smrg#define MI_ALU_REG2                              2
902b8e80941Smrg#define MI_ALU_REG3                              3
903b8e80941Smrg#define MI_ALU_REG4                              4
904b8e80941Smrg#define MI_ALU_REG5                              5
905b8e80941Smrg#define MI_ALU_REG6                              6
906b8e80941Smrg#define MI_ALU_REG7                              7
907b8e80941Smrg#define MI_ALU_REG8                              8
908b8e80941Smrg#define MI_ALU_REG9                              9
909b8e80941Smrg#define MI_ALU_REG10                             10
910b8e80941Smrg#define MI_ALU_REG11                             11
911b8e80941Smrg#define MI_ALU_REG12                             12
912b8e80941Smrg#define MI_ALU_REG13                             13
913b8e80941Smrg#define MI_ALU_REG14                             14
914b8e80941Smrg#define MI_ALU_REG15                             15
915b8e80941Smrg#define MI_ALU_SRCA                              32
916b8e80941Smrg#define MI_ALU_SRCB                              33
917b8e80941Smrg#define MI_ALU_ACCU                              49
918b8e80941Smrg#define MI_ALU_ZF                                50
919b8e80941Smrg#define MI_ALU_CF                                51
920b8e80941Smrg   uint32_t                             ALUOpcode;
921b8e80941Smrg#define MI_ALU_NOOP                              0
922b8e80941Smrg#define MI_ALU_LOAD                              128
923b8e80941Smrg#define MI_ALU_LOADINV                           1152
924b8e80941Smrg#define MI_ALU_LOAD0                             129
925b8e80941Smrg#define MI_ALU_LOAD1                             1153
926b8e80941Smrg#define MI_ALU_ADD                               256
927b8e80941Smrg#define MI_ALU_SUB                               257
928b8e80941Smrg#define MI_ALU_AND                               258
929b8e80941Smrg#define MI_ALU_OR                                259
930b8e80941Smrg#define MI_ALU_XOR                               260
931b8e80941Smrg#define MI_ALU_STORE                             384
932b8e80941Smrg#define MI_ALU_STOREINV                          1408
933b8e80941Smrg};
934b8e80941Smrg
935b8e80941Smrgstatic inline void
936b8e80941SmrgGEN8_MI_MATH_ALU_INSTRUCTION_pack(__attribute__((unused)) __gen_user_data *data,
937b8e80941Smrg                                  __attribute__((unused)) void * restrict dst,
938b8e80941Smrg                                  __attribute__((unused)) const struct GEN8_MI_MATH_ALU_INSTRUCTION * restrict values)
939b8e80941Smrg{
940b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
941b8e80941Smrg
942b8e80941Smrg   dw[0] =
943b8e80941Smrg      __gen_uint(values->Operand2, 0, 9) |
944b8e80941Smrg      __gen_uint(values->Operand1, 10, 19) |
945b8e80941Smrg      __gen_uint(values->ALUOpcode, 20, 31);
946b8e80941Smrg}
947b8e80941Smrg
948b8e80941Smrg#define GEN8_PALETTE_ENTRY_length              1
949b8e80941Smrgstruct GEN8_PALETTE_ENTRY {
950b8e80941Smrg   uint32_t                             Blue;
951b8e80941Smrg   uint32_t                             Green;
952b8e80941Smrg   uint32_t                             Red;
953b8e80941Smrg   uint32_t                             Alpha;
954b8e80941Smrg};
955b8e80941Smrg
956b8e80941Smrgstatic inline void
957b8e80941SmrgGEN8_PALETTE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
958b8e80941Smrg                        __attribute__((unused)) void * restrict dst,
959b8e80941Smrg                        __attribute__((unused)) const struct GEN8_PALETTE_ENTRY * restrict values)
960b8e80941Smrg{
961b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
962b8e80941Smrg
963b8e80941Smrg   dw[0] =
964b8e80941Smrg      __gen_uint(values->Blue, 0, 7) |
965b8e80941Smrg      __gen_uint(values->Green, 8, 15) |
966b8e80941Smrg      __gen_uint(values->Red, 16, 23) |
967b8e80941Smrg      __gen_uint(values->Alpha, 24, 31);
968b8e80941Smrg}
969b8e80941Smrg
970b8e80941Smrg#define GEN8_RENDER_SURFACE_STATE_length      16
971b8e80941Smrgstruct GEN8_RENDER_SURFACE_STATE {
972b8e80941Smrg   bool                                 CubeFaceEnablePositiveZ;
973b8e80941Smrg   bool                                 CubeFaceEnableNegativeZ;
974b8e80941Smrg   bool                                 CubeFaceEnablePositiveY;
975b8e80941Smrg   bool                                 CubeFaceEnableNegativeY;
976b8e80941Smrg   bool                                 CubeFaceEnablePositiveX;
977b8e80941Smrg   bool                                 CubeFaceEnableNegativeX;
978b8e80941Smrg   uint32_t                             MediaBoundaryPixelMode;
979b8e80941Smrg#define NORMAL_MODE                              0
980b8e80941Smrg#define PROGRESSIVE_FRAME                        2
981b8e80941Smrg#define INTERLACED_FRAME                         3
982b8e80941Smrg   uint32_t                             RenderCacheReadWriteMode;
983b8e80941Smrg#define WriteOnlyCache                           0
984b8e80941Smrg#define ReadWriteCache                           1
985b8e80941Smrg   bool                                 SamplerL2BypassModeDisable;
986b8e80941Smrg   uint32_t                             VerticalLineStrideOffset;
987b8e80941Smrg   uint32_t                             VerticalLineStride;
988b8e80941Smrg   uint32_t                             TileMode;
989b8e80941Smrg#define LINEAR                                   0
990b8e80941Smrg#define WMAJOR                                   1
991b8e80941Smrg#define XMAJOR                                   2
992b8e80941Smrg#define YMAJOR                                   3
993b8e80941Smrg   uint32_t                             SurfaceHorizontalAlignment;
994b8e80941Smrg#define HALIGN4                                  1
995b8e80941Smrg#define HALIGN8                                  2
996b8e80941Smrg#define HALIGN16                                 3
997b8e80941Smrg   uint32_t                             SurfaceVerticalAlignment;
998b8e80941Smrg#define VALIGN4                                  1
999b8e80941Smrg#define VALIGN8                                  2
1000b8e80941Smrg#define VALIGN16                                 3
1001b8e80941Smrg   uint32_t                             SurfaceFormat;
1002b8e80941Smrg   bool                                 SurfaceArray;
1003b8e80941Smrg   uint32_t                             SurfaceType;
1004b8e80941Smrg#define SURFTYPE_1D                              0
1005b8e80941Smrg#define SURFTYPE_2D                              1
1006b8e80941Smrg#define SURFTYPE_3D                              2
1007b8e80941Smrg#define SURFTYPE_CUBE                            3
1008b8e80941Smrg#define SURFTYPE_BUFFER                          4
1009b8e80941Smrg#define SURFTYPE_STRBUF                          5
1010b8e80941Smrg#define SURFTYPE_NULL                            7
1011b8e80941Smrg   uint32_t                             SurfaceQPitch;
1012b8e80941Smrg   float                                BaseMipLevel;
1013b8e80941Smrg   uint32_t                             MOCS;
1014b8e80941Smrg   uint32_t                             Width;
1015b8e80941Smrg   uint32_t                             Height;
1016b8e80941Smrg   uint32_t                             SurfacePitch;
1017b8e80941Smrg   uint32_t                             Depth;
1018b8e80941Smrg   uint32_t                             MultisamplePositionPaletteIndex;
1019b8e80941Smrg   uint32_t                             NumberofMultisamples;
1020b8e80941Smrg#define MULTISAMPLECOUNT_1                       0
1021b8e80941Smrg#define MULTISAMPLECOUNT_2                       1
1022b8e80941Smrg#define MULTISAMPLECOUNT_4                       2
1023b8e80941Smrg#define MULTISAMPLECOUNT_8                       3
1024b8e80941Smrg   uint32_t                             MultisampledSurfaceStorageFormat;
1025b8e80941Smrg#define MSFMT_MSS                                0
1026b8e80941Smrg#define MSFMT_DEPTH_STENCIL                      1
1027b8e80941Smrg   uint32_t                             RenderTargetViewExtent;
1028b8e80941Smrg   uint32_t                             MinimumArrayElement;
1029b8e80941Smrg   uint32_t                             RenderTargetAndSampleUnormRotation;
1030b8e80941Smrg#define _0DEG                                    0
1031b8e80941Smrg#define _90DEG                                   1
1032b8e80941Smrg#define _270DEG                                  3
1033b8e80941Smrg   uint32_t                             MIPCountLOD;
1034b8e80941Smrg   uint32_t                             SurfaceMinLOD;
1035b8e80941Smrg   uint32_t                             CoherencyType;
1036b8e80941Smrg#define GPUcoherent                              0
1037b8e80941Smrg#define IAcoherent                               1
1038b8e80941Smrg   bool                                 EWADisableForCube;
1039b8e80941Smrg   uint32_t                             YOffset;
1040b8e80941Smrg   uint32_t                             XOffset;
1041b8e80941Smrg   uint32_t                             AuxiliarySurfaceMode;
1042b8e80941Smrg#define AUX_NONE                                 0
1043b8e80941Smrg#define AUX_MCS                                  1
1044b8e80941Smrg#define AUX_APPEND                               2
1045b8e80941Smrg#define AUX_HIZ                                  3
1046b8e80941Smrg   uint32_t                             YOffsetforUorUVPlane;
1047b8e80941Smrg   uint32_t                             AuxiliarySurfacePitch;
1048b8e80941Smrg   uint32_t                             AuxiliarySurfaceQPitch;
1049b8e80941Smrg   uint32_t                             XOffsetforUorUVPlane;
1050b8e80941Smrg   bool                                 SeparateUVPlaneEnable;
1051b8e80941Smrg   float                                ResourceMinLOD;
1052b8e80941Smrg   enum GEN8_ShaderChannelSelect        ShaderChannelSelectAlpha;
1053b8e80941Smrg   enum GEN8_ShaderChannelSelect        ShaderChannelSelectBlue;
1054b8e80941Smrg   enum GEN8_ShaderChannelSelect        ShaderChannelSelectGreen;
1055b8e80941Smrg   enum GEN8_ShaderChannelSelect        ShaderChannelSelectRed;
1056b8e80941Smrg   enum GEN8_ClearColor                 AlphaClearColor;
1057b8e80941Smrg   enum GEN8_ClearColor                 BlueClearColor;
1058b8e80941Smrg   enum GEN8_ClearColor                 GreenClearColor;
1059b8e80941Smrg   enum GEN8_ClearColor                 RedClearColor;
1060b8e80941Smrg   __gen_address_type                   SurfaceBaseAddress;
1061b8e80941Smrg   __gen_address_type                   AuxiliarySurfaceBaseAddress;
1062b8e80941Smrg   uint32_t                             AuxiliaryTableIndexforMediaCompressedSurface;
1063b8e80941Smrg   uint32_t                             YOffsetforVPlane;
1064b8e80941Smrg   uint32_t                             XOffsetforVPlane;
1065b8e80941Smrg};
1066b8e80941Smrg
1067b8e80941Smrgstatic inline void
1068b8e80941SmrgGEN8_RENDER_SURFACE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
1069b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
1070b8e80941Smrg                               __attribute__((unused)) const struct GEN8_RENDER_SURFACE_STATE * restrict values)
1071b8e80941Smrg{
1072b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1073b8e80941Smrg
1074b8e80941Smrg   dw[0] =
1075b8e80941Smrg      __gen_uint(values->CubeFaceEnablePositiveZ, 0, 0) |
1076b8e80941Smrg      __gen_uint(values->CubeFaceEnableNegativeZ, 1, 1) |
1077b8e80941Smrg      __gen_uint(values->CubeFaceEnablePositiveY, 2, 2) |
1078b8e80941Smrg      __gen_uint(values->CubeFaceEnableNegativeY, 3, 3) |
1079b8e80941Smrg      __gen_uint(values->CubeFaceEnablePositiveX, 4, 4) |
1080b8e80941Smrg      __gen_uint(values->CubeFaceEnableNegativeX, 5, 5) |
1081b8e80941Smrg      __gen_uint(values->MediaBoundaryPixelMode, 6, 7) |
1082b8e80941Smrg      __gen_uint(values->RenderCacheReadWriteMode, 8, 8) |
1083b8e80941Smrg      __gen_uint(values->SamplerL2BypassModeDisable, 9, 9) |
1084b8e80941Smrg      __gen_uint(values->VerticalLineStrideOffset, 10, 10) |
1085b8e80941Smrg      __gen_uint(values->VerticalLineStride, 11, 11) |
1086b8e80941Smrg      __gen_uint(values->TileMode, 12, 13) |
1087b8e80941Smrg      __gen_uint(values->SurfaceHorizontalAlignment, 14, 15) |
1088b8e80941Smrg      __gen_uint(values->SurfaceVerticalAlignment, 16, 17) |
1089b8e80941Smrg      __gen_uint(values->SurfaceFormat, 18, 26) |
1090b8e80941Smrg      __gen_uint(values->SurfaceArray, 28, 28) |
1091b8e80941Smrg      __gen_uint(values->SurfaceType, 29, 31);
1092b8e80941Smrg
1093b8e80941Smrg   dw[1] =
1094b8e80941Smrg      __gen_uint(values->SurfaceQPitch, 0, 14) |
1095b8e80941Smrg      __gen_ufixed(values->BaseMipLevel, 19, 23, 1) |
1096b8e80941Smrg      __gen_uint(values->MOCS, 24, 30);
1097b8e80941Smrg
1098b8e80941Smrg   dw[2] =
1099b8e80941Smrg      __gen_uint(values->Width, 0, 13) |
1100b8e80941Smrg      __gen_uint(values->Height, 16, 29);
1101b8e80941Smrg
1102b8e80941Smrg   dw[3] =
1103b8e80941Smrg      __gen_uint(values->SurfacePitch, 0, 17) |
1104b8e80941Smrg      __gen_uint(values->Depth, 21, 31);
1105b8e80941Smrg
1106b8e80941Smrg   dw[4] =
1107b8e80941Smrg      __gen_uint(values->MultisamplePositionPaletteIndex, 0, 2) |
1108b8e80941Smrg      __gen_uint(values->NumberofMultisamples, 3, 5) |
1109b8e80941Smrg      __gen_uint(values->MultisampledSurfaceStorageFormat, 6, 6) |
1110b8e80941Smrg      __gen_uint(values->RenderTargetViewExtent, 7, 17) |
1111b8e80941Smrg      __gen_uint(values->MinimumArrayElement, 18, 28) |
1112b8e80941Smrg      __gen_uint(values->RenderTargetAndSampleUnormRotation, 29, 30);
1113b8e80941Smrg
1114b8e80941Smrg   dw[5] =
1115b8e80941Smrg      __gen_uint(values->MIPCountLOD, 0, 3) |
1116b8e80941Smrg      __gen_uint(values->SurfaceMinLOD, 4, 7) |
1117b8e80941Smrg      __gen_uint(values->CoherencyType, 14, 14) |
1118b8e80941Smrg      __gen_uint(values->EWADisableForCube, 20, 20) |
1119b8e80941Smrg      __gen_uint(values->YOffset, 21, 23) |
1120b8e80941Smrg      __gen_uint(values->XOffset, 25, 31);
1121b8e80941Smrg
1122b8e80941Smrg   dw[6] =
1123b8e80941Smrg      __gen_uint(values->AuxiliarySurfaceMode, 0, 2) |
1124b8e80941Smrg      __gen_uint(values->YOffsetforUorUVPlane, 0, 13) |
1125b8e80941Smrg      __gen_uint(values->AuxiliarySurfacePitch, 3, 11) |
1126b8e80941Smrg      __gen_uint(values->AuxiliarySurfaceQPitch, 16, 30) |
1127b8e80941Smrg      __gen_uint(values->XOffsetforUorUVPlane, 16, 29) |
1128b8e80941Smrg      __gen_uint(values->SeparateUVPlaneEnable, 31, 31);
1129b8e80941Smrg
1130b8e80941Smrg   dw[7] =
1131b8e80941Smrg      __gen_ufixed(values->ResourceMinLOD, 0, 11, 8) |
1132b8e80941Smrg      __gen_uint(values->ShaderChannelSelectAlpha, 16, 18) |
1133b8e80941Smrg      __gen_uint(values->ShaderChannelSelectBlue, 19, 21) |
1134b8e80941Smrg      __gen_uint(values->ShaderChannelSelectGreen, 22, 24) |
1135b8e80941Smrg      __gen_uint(values->ShaderChannelSelectRed, 25, 27) |
1136b8e80941Smrg      __gen_uint(values->AlphaClearColor, 28, 28) |
1137b8e80941Smrg      __gen_uint(values->BlueClearColor, 29, 29) |
1138b8e80941Smrg      __gen_uint(values->GreenClearColor, 30, 30) |
1139b8e80941Smrg      __gen_uint(values->RedClearColor, 31, 31);
1140b8e80941Smrg
1141b8e80941Smrg   const uint64_t v8_address =
1142b8e80941Smrg      __gen_combine_address(data, &dw[8], values->SurfaceBaseAddress, 0);
1143b8e80941Smrg   dw[8] = v8_address;
1144b8e80941Smrg   dw[9] = v8_address >> 32;
1145b8e80941Smrg
1146b8e80941Smrg   const uint64_t v10 =
1147b8e80941Smrg      __gen_uint(values->AuxiliaryTableIndexforMediaCompressedSurface, 21, 31) |
1148b8e80941Smrg      __gen_uint(values->YOffsetforVPlane, 32, 45) |
1149b8e80941Smrg      __gen_uint(values->XOffsetforVPlane, 48, 61);
1150b8e80941Smrg   const uint64_t v10_address =
1151b8e80941Smrg      __gen_combine_address(data, &dw[10], values->AuxiliarySurfaceBaseAddress, v10);
1152b8e80941Smrg   dw[10] = v10_address;
1153b8e80941Smrg   dw[11] = (v10_address >> 32) | (v10 >> 32);
1154b8e80941Smrg
1155b8e80941Smrg   dw[12] = 0;
1156b8e80941Smrg
1157b8e80941Smrg   dw[13] = 0;
1158b8e80941Smrg
1159b8e80941Smrg   dw[14] = 0;
1160b8e80941Smrg
1161b8e80941Smrg   dw[15] = 0;
1162b8e80941Smrg}
1163b8e80941Smrg
1164b8e80941Smrg#define GEN8_SAMPLER_BORDER_COLOR_STATE_length      4
1165b8e80941Smrgstruct GEN8_SAMPLER_BORDER_COLOR_STATE {
1166b8e80941Smrg   float                                BorderColorFloatRed;
1167b8e80941Smrg   uint32_t                             BorderColor32bitRed;
1168b8e80941Smrg   float                                BorderColorFloatGreen;
1169b8e80941Smrg   uint32_t                             BorderColor32bitGreen;
1170b8e80941Smrg   float                                BorderColorFloatBlue;
1171b8e80941Smrg   uint32_t                             BorderColor32bitBlue;
1172b8e80941Smrg   float                                BorderColorFloatAlpha;
1173b8e80941Smrg   uint32_t                             BorderColor32bitAlpha;
1174b8e80941Smrg};
1175b8e80941Smrg
1176b8e80941Smrgstatic inline void
1177b8e80941SmrgGEN8_SAMPLER_BORDER_COLOR_STATE_pack(__attribute__((unused)) __gen_user_data *data,
1178b8e80941Smrg                                     __attribute__((unused)) void * restrict dst,
1179b8e80941Smrg                                     __attribute__((unused)) const struct GEN8_SAMPLER_BORDER_COLOR_STATE * restrict values)
1180b8e80941Smrg{
1181b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1182b8e80941Smrg
1183b8e80941Smrg   dw[0] =
1184b8e80941Smrg      __gen_float(values->BorderColorFloatRed) |
1185b8e80941Smrg      __gen_uint(values->BorderColor32bitRed, 0, 31);
1186b8e80941Smrg
1187b8e80941Smrg   dw[1] =
1188b8e80941Smrg      __gen_float(values->BorderColorFloatGreen) |
1189b8e80941Smrg      __gen_uint(values->BorderColor32bitGreen, 0, 31);
1190b8e80941Smrg
1191b8e80941Smrg   dw[2] =
1192b8e80941Smrg      __gen_float(values->BorderColorFloatBlue) |
1193b8e80941Smrg      __gen_uint(values->BorderColor32bitBlue, 0, 31);
1194b8e80941Smrg
1195b8e80941Smrg   dw[3] =
1196b8e80941Smrg      __gen_float(values->BorderColorFloatAlpha) |
1197b8e80941Smrg      __gen_uint(values->BorderColor32bitAlpha, 0, 31);
1198b8e80941Smrg}
1199b8e80941Smrg
1200b8e80941Smrg#define GEN8_SAMPLER_STATE_length              4
1201b8e80941Smrgstruct GEN8_SAMPLER_STATE {
1202b8e80941Smrg   uint32_t                             AnisotropicAlgorithm;
1203b8e80941Smrg#define LEGACY                                   0
1204b8e80941Smrg#define EWAApproximation                         1
1205b8e80941Smrg   float                                TextureLODBias;
1206b8e80941Smrg   uint32_t                             MinModeFilter;
1207b8e80941Smrg#define MAPFILTER_NEAREST                        0
1208b8e80941Smrg#define MAPFILTER_LINEAR                         1
1209b8e80941Smrg#define MAPFILTER_ANISOTROPIC                    2
1210b8e80941Smrg#define MAPFILTER_MONO                           6
1211b8e80941Smrg   uint32_t                             MagModeFilter;
1212b8e80941Smrg#define MAPFILTER_NEAREST                        0
1213b8e80941Smrg#define MAPFILTER_LINEAR                         1
1214b8e80941Smrg#define MAPFILTER_ANISOTROPIC                    2
1215b8e80941Smrg#define MAPFILTER_MONO                           6
1216b8e80941Smrg   uint32_t                             MipModeFilter;
1217b8e80941Smrg#define MIPFILTER_NONE                           0
1218b8e80941Smrg#define MIPFILTER_NEAREST                        1
1219b8e80941Smrg#define MIPFILTER_LINEAR                         3
1220b8e80941Smrg   float                                BaseMipLevel;
1221b8e80941Smrg   uint32_t                             LODPreClampMode;
1222b8e80941Smrg#define CLAMP_MODE_NONE                          0
1223b8e80941Smrg#define CLAMP_MODE_OGL                           2
1224b8e80941Smrg   uint32_t                             TextureBorderColorMode;
1225b8e80941Smrg#define DX10OGL                                  0
1226b8e80941Smrg#define DX9                                      1
1227b8e80941Smrg   bool                                 SamplerDisable;
1228b8e80941Smrg   uint32_t                             CubeSurfaceControlMode;
1229b8e80941Smrg#define PROGRAMMED                               0
1230b8e80941Smrg#define OVERRIDE                                 1
1231b8e80941Smrg   uint32_t                             ShadowFunction;
1232b8e80941Smrg#define PREFILTEROPALWAYS                        0
1233b8e80941Smrg#define PREFILTEROPNEVER                         1
1234b8e80941Smrg#define PREFILTEROPLESS                          2
1235b8e80941Smrg#define PREFILTEROPEQUAL                         3
1236b8e80941Smrg#define PREFILTEROPLEQUAL                        4
1237b8e80941Smrg#define PREFILTEROPGREATER                       5
1238b8e80941Smrg#define PREFILTEROPNOTEQUAL                      6
1239b8e80941Smrg#define PREFILTEROPGEQUAL                        7
1240b8e80941Smrg   uint32_t                             ChromaKeyMode;
1241b8e80941Smrg#define KEYFILTER_KILL_ON_ANY_MATCH              0
1242b8e80941Smrg#define KEYFILTER_REPLACE_BLACK                  1
1243b8e80941Smrg   uint32_t                             ChromaKeyIndex;
1244b8e80941Smrg   bool                                 ChromaKeyEnable;
1245b8e80941Smrg   float                                MaxLOD;
1246b8e80941Smrg   float                                MinLOD;
1247b8e80941Smrg   uint32_t                             LODClampMagnificationMode;
1248b8e80941Smrg#define MIPNONE                                  0
1249b8e80941Smrg#define MIPFILTER                                1
1250b8e80941Smrg   uint64_t                             BorderColorPointer;
1251b8e80941Smrg   enum GEN8_TextureCoordinateMode      TCZAddressControlMode;
1252b8e80941Smrg   enum GEN8_TextureCoordinateMode      TCYAddressControlMode;
1253b8e80941Smrg   enum GEN8_TextureCoordinateMode      TCXAddressControlMode;
1254b8e80941Smrg   bool                                 NonnormalizedCoordinateEnable;
1255b8e80941Smrg   uint32_t                             TrilinearFilterQuality;
1256b8e80941Smrg#define FULL                                     0
1257b8e80941Smrg#define HIGH                                     1
1258b8e80941Smrg#define MED                                      2
1259b8e80941Smrg#define LOW                                      3
1260b8e80941Smrg   bool                                 RAddressMinFilterRoundingEnable;
1261b8e80941Smrg   bool                                 RAddressMagFilterRoundingEnable;
1262b8e80941Smrg   bool                                 VAddressMinFilterRoundingEnable;
1263b8e80941Smrg   bool                                 VAddressMagFilterRoundingEnable;
1264b8e80941Smrg   bool                                 UAddressMinFilterRoundingEnable;
1265b8e80941Smrg   bool                                 UAddressMagFilterRoundingEnable;
1266b8e80941Smrg   uint32_t                             MaximumAnisotropy;
1267b8e80941Smrg#define RATIO21                                  0
1268b8e80941Smrg#define RATIO41                                  1
1269b8e80941Smrg#define RATIO61                                  2
1270b8e80941Smrg#define RATIO81                                  3
1271b8e80941Smrg#define RATIO101                                 4
1272b8e80941Smrg#define RATIO121                                 5
1273b8e80941Smrg#define RATIO141                                 6
1274b8e80941Smrg#define RATIO161                                 7
1275b8e80941Smrg};
1276b8e80941Smrg
1277b8e80941Smrgstatic inline void
1278b8e80941SmrgGEN8_SAMPLER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
1279b8e80941Smrg                        __attribute__((unused)) void * restrict dst,
1280b8e80941Smrg                        __attribute__((unused)) const struct GEN8_SAMPLER_STATE * restrict values)
1281b8e80941Smrg{
1282b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1283b8e80941Smrg
1284b8e80941Smrg   dw[0] =
1285b8e80941Smrg      __gen_uint(values->AnisotropicAlgorithm, 0, 0) |
1286b8e80941Smrg      __gen_sfixed(values->TextureLODBias, 1, 13, 8) |
1287b8e80941Smrg      __gen_uint(values->MinModeFilter, 14, 16) |
1288b8e80941Smrg      __gen_uint(values->MagModeFilter, 17, 19) |
1289b8e80941Smrg      __gen_uint(values->MipModeFilter, 20, 21) |
1290b8e80941Smrg      __gen_ufixed(values->BaseMipLevel, 22, 26, 1) |
1291b8e80941Smrg      __gen_uint(values->LODPreClampMode, 27, 28) |
1292b8e80941Smrg      __gen_uint(values->TextureBorderColorMode, 29, 29) |
1293b8e80941Smrg      __gen_uint(values->SamplerDisable, 31, 31);
1294b8e80941Smrg
1295b8e80941Smrg   dw[1] =
1296b8e80941Smrg      __gen_uint(values->CubeSurfaceControlMode, 0, 0) |
1297b8e80941Smrg      __gen_uint(values->ShadowFunction, 1, 3) |
1298b8e80941Smrg      __gen_uint(values->ChromaKeyMode, 4, 4) |
1299b8e80941Smrg      __gen_uint(values->ChromaKeyIndex, 5, 6) |
1300b8e80941Smrg      __gen_uint(values->ChromaKeyEnable, 7, 7) |
1301b8e80941Smrg      __gen_ufixed(values->MaxLOD, 8, 19, 8) |
1302b8e80941Smrg      __gen_ufixed(values->MinLOD, 20, 31, 8);
1303b8e80941Smrg
1304b8e80941Smrg   dw[2] =
1305b8e80941Smrg      __gen_uint(values->LODClampMagnificationMode, 0, 0) |
1306b8e80941Smrg      __gen_offset(values->BorderColorPointer, 6, 23);
1307b8e80941Smrg
1308b8e80941Smrg   dw[3] =
1309b8e80941Smrg      __gen_uint(values->TCZAddressControlMode, 0, 2) |
1310b8e80941Smrg      __gen_uint(values->TCYAddressControlMode, 3, 5) |
1311b8e80941Smrg      __gen_uint(values->TCXAddressControlMode, 6, 8) |
1312b8e80941Smrg      __gen_uint(values->NonnormalizedCoordinateEnable, 10, 10) |
1313b8e80941Smrg      __gen_uint(values->TrilinearFilterQuality, 11, 12) |
1314b8e80941Smrg      __gen_uint(values->RAddressMinFilterRoundingEnable, 13, 13) |
1315b8e80941Smrg      __gen_uint(values->RAddressMagFilterRoundingEnable, 14, 14) |
1316b8e80941Smrg      __gen_uint(values->VAddressMinFilterRoundingEnable, 15, 15) |
1317b8e80941Smrg      __gen_uint(values->VAddressMagFilterRoundingEnable, 16, 16) |
1318b8e80941Smrg      __gen_uint(values->UAddressMinFilterRoundingEnable, 17, 17) |
1319b8e80941Smrg      __gen_uint(values->UAddressMagFilterRoundingEnable, 18, 18) |
1320b8e80941Smrg      __gen_uint(values->MaximumAnisotropy, 19, 21);
1321b8e80941Smrg}
1322b8e80941Smrg
1323b8e80941Smrg#define GEN8_SAMPLER_STATE_8X8_AVS_COEFFICIENTS_length      8
1324b8e80941Smrgstruct GEN8_SAMPLER_STATE_8X8_AVS_COEFFICIENTS {
1325b8e80941Smrg   float                                Table0XFilterCoefficientn0;
1326b8e80941Smrg   float                                Table0YFilterCoefficientn0;
1327b8e80941Smrg   float                                Table0XFilterCoefficientn1;
1328b8e80941Smrg   float                                Table0YFilterCoefficientn1;
1329b8e80941Smrg   float                                Table0XFilterCoefficientn2;
1330b8e80941Smrg   float                                Table0YFilterCoefficientn2;
1331b8e80941Smrg   float                                Table0XFilterCoefficientn3;
1332b8e80941Smrg   float                                Table0YFilterCoefficientn3;
1333b8e80941Smrg   float                                Table0XFilterCoefficientn4;
1334b8e80941Smrg   float                                Table0YFilterCoefficientn4;
1335b8e80941Smrg   float                                Table0XFilterCoefficientn5;
1336b8e80941Smrg   float                                Table0YFilterCoefficientn5;
1337b8e80941Smrg   float                                Table0XFilterCoefficientn6;
1338b8e80941Smrg   float                                Table0YFilterCoefficientn6;
1339b8e80941Smrg   float                                Table0XFilterCoefficientn7;
1340b8e80941Smrg   float                                Table0YFilterCoefficientn7;
1341b8e80941Smrg   float                                Table1XFilterCoefficientn2;
1342b8e80941Smrg   float                                Table1XFilterCoefficientn3;
1343b8e80941Smrg   float                                Table1XFilterCoefficientn4;
1344b8e80941Smrg   float                                Table1XFilterCoefficientn5;
1345b8e80941Smrg   float                                Table1YFilterCoefficientn2;
1346b8e80941Smrg   float                                Table1YFilterCoefficientn3;
1347b8e80941Smrg   float                                Table1YFilterCoefficientn4;
1348b8e80941Smrg   float                                Table1YFilterCoefficientn5;
1349b8e80941Smrg};
1350b8e80941Smrg
1351b8e80941Smrgstatic inline void
1352b8e80941SmrgGEN8_SAMPLER_STATE_8X8_AVS_COEFFICIENTS_pack(__attribute__((unused)) __gen_user_data *data,
1353b8e80941Smrg                                             __attribute__((unused)) void * restrict dst,
1354b8e80941Smrg                                             __attribute__((unused)) const struct GEN8_SAMPLER_STATE_8X8_AVS_COEFFICIENTS * restrict values)
1355b8e80941Smrg{
1356b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1357b8e80941Smrg
1358b8e80941Smrg   dw[0] =
1359b8e80941Smrg      __gen_sfixed(values->Table0XFilterCoefficientn0, 0, 7, 6) |
1360b8e80941Smrg      __gen_sfixed(values->Table0YFilterCoefficientn0, 8, 15, 6) |
1361b8e80941Smrg      __gen_sfixed(values->Table0XFilterCoefficientn1, 16, 23, 6) |
1362b8e80941Smrg      __gen_sfixed(values->Table0YFilterCoefficientn1, 24, 31, 6);
1363b8e80941Smrg
1364b8e80941Smrg   dw[1] =
1365b8e80941Smrg      __gen_sfixed(values->Table0XFilterCoefficientn2, 0, 7, 6) |
1366b8e80941Smrg      __gen_sfixed(values->Table0YFilterCoefficientn2, 8, 15, 6) |
1367b8e80941Smrg      __gen_sfixed(values->Table0XFilterCoefficientn3, 16, 23, 6) |
1368b8e80941Smrg      __gen_sfixed(values->Table0YFilterCoefficientn3, 24, 31, 6);
1369b8e80941Smrg
1370b8e80941Smrg   dw[2] =
1371b8e80941Smrg      __gen_sfixed(values->Table0XFilterCoefficientn4, 0, 7, 6) |
1372b8e80941Smrg      __gen_sfixed(values->Table0YFilterCoefficientn4, 8, 15, 6) |
1373b8e80941Smrg      __gen_sfixed(values->Table0XFilterCoefficientn5, 16, 23, 6) |
1374b8e80941Smrg      __gen_sfixed(values->Table0YFilterCoefficientn5, 24, 31, 6);
1375b8e80941Smrg
1376b8e80941Smrg   dw[3] =
1377b8e80941Smrg      __gen_sfixed(values->Table0XFilterCoefficientn6, 0, 7, 6) |
1378b8e80941Smrg      __gen_sfixed(values->Table0YFilterCoefficientn6, 8, 15, 6) |
1379b8e80941Smrg      __gen_sfixed(values->Table0XFilterCoefficientn7, 16, 23, 6) |
1380b8e80941Smrg      __gen_sfixed(values->Table0YFilterCoefficientn7, 24, 31, 6);
1381b8e80941Smrg
1382b8e80941Smrg   dw[4] =
1383b8e80941Smrg      __gen_sfixed(values->Table1XFilterCoefficientn2, 16, 23, 6) |
1384b8e80941Smrg      __gen_sfixed(values->Table1XFilterCoefficientn3, 24, 31, 6);
1385b8e80941Smrg
1386b8e80941Smrg   dw[5] =
1387b8e80941Smrg      __gen_sfixed(values->Table1XFilterCoefficientn4, 0, 7, 6) |
1388b8e80941Smrg      __gen_sfixed(values->Table1XFilterCoefficientn5, 8, 15, 6);
1389b8e80941Smrg
1390b8e80941Smrg   dw[6] =
1391b8e80941Smrg      __gen_sfixed(values->Table1YFilterCoefficientn2, 16, 23, 6) |
1392b8e80941Smrg      __gen_sfixed(values->Table1YFilterCoefficientn3, 24, 31, 6);
1393b8e80941Smrg
1394b8e80941Smrg   dw[7] =
1395b8e80941Smrg      __gen_sfixed(values->Table1YFilterCoefficientn4, 0, 7, 6) |
1396b8e80941Smrg      __gen_sfixed(values->Table1YFilterCoefficientn5, 8, 15, 6);
1397b8e80941Smrg}
1398b8e80941Smrg
1399b8e80941Smrg#define GEN8_SCISSOR_RECT_length               2
1400b8e80941Smrgstruct GEN8_SCISSOR_RECT {
1401b8e80941Smrg   uint32_t                             ScissorRectangleXMin;
1402b8e80941Smrg   uint32_t                             ScissorRectangleYMin;
1403b8e80941Smrg   uint32_t                             ScissorRectangleXMax;
1404b8e80941Smrg   uint32_t                             ScissorRectangleYMax;
1405b8e80941Smrg};
1406b8e80941Smrg
1407b8e80941Smrgstatic inline void
1408b8e80941SmrgGEN8_SCISSOR_RECT_pack(__attribute__((unused)) __gen_user_data *data,
1409b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
1410b8e80941Smrg                       __attribute__((unused)) const struct GEN8_SCISSOR_RECT * restrict values)
1411b8e80941Smrg{
1412b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1413b8e80941Smrg
1414b8e80941Smrg   dw[0] =
1415b8e80941Smrg      __gen_uint(values->ScissorRectangleXMin, 0, 15) |
1416b8e80941Smrg      __gen_uint(values->ScissorRectangleYMin, 16, 31);
1417b8e80941Smrg
1418b8e80941Smrg   dw[1] =
1419b8e80941Smrg      __gen_uint(values->ScissorRectangleXMax, 0, 15) |
1420b8e80941Smrg      __gen_uint(values->ScissorRectangleYMax, 16, 31);
1421b8e80941Smrg}
1422b8e80941Smrg
1423b8e80941Smrg#define GEN8_SF_CLIP_VIEWPORT_length          16
1424b8e80941Smrgstruct GEN8_SF_CLIP_VIEWPORT {
1425b8e80941Smrg   float                                ViewportMatrixElementm00;
1426b8e80941Smrg   float                                ViewportMatrixElementm11;
1427b8e80941Smrg   float                                ViewportMatrixElementm22;
1428b8e80941Smrg   float                                ViewportMatrixElementm30;
1429b8e80941Smrg   float                                ViewportMatrixElementm31;
1430b8e80941Smrg   float                                ViewportMatrixElementm32;
1431b8e80941Smrg   float                                XMinClipGuardband;
1432b8e80941Smrg   float                                XMaxClipGuardband;
1433b8e80941Smrg   float                                YMinClipGuardband;
1434b8e80941Smrg   float                                YMaxClipGuardband;
1435b8e80941Smrg   float                                XMinViewPort;
1436b8e80941Smrg   float                                XMaxViewPort;
1437b8e80941Smrg   float                                YMinViewPort;
1438b8e80941Smrg   float                                YMaxViewPort;
1439b8e80941Smrg};
1440b8e80941Smrg
1441b8e80941Smrgstatic inline void
1442b8e80941SmrgGEN8_SF_CLIP_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
1443b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
1444b8e80941Smrg                           __attribute__((unused)) const struct GEN8_SF_CLIP_VIEWPORT * restrict values)
1445b8e80941Smrg{
1446b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1447b8e80941Smrg
1448b8e80941Smrg   dw[0] =
1449b8e80941Smrg      __gen_float(values->ViewportMatrixElementm00);
1450b8e80941Smrg
1451b8e80941Smrg   dw[1] =
1452b8e80941Smrg      __gen_float(values->ViewportMatrixElementm11);
1453b8e80941Smrg
1454b8e80941Smrg   dw[2] =
1455b8e80941Smrg      __gen_float(values->ViewportMatrixElementm22);
1456b8e80941Smrg
1457b8e80941Smrg   dw[3] =
1458b8e80941Smrg      __gen_float(values->ViewportMatrixElementm30);
1459b8e80941Smrg
1460b8e80941Smrg   dw[4] =
1461b8e80941Smrg      __gen_float(values->ViewportMatrixElementm31);
1462b8e80941Smrg
1463b8e80941Smrg   dw[5] =
1464b8e80941Smrg      __gen_float(values->ViewportMatrixElementm32);
1465b8e80941Smrg
1466b8e80941Smrg   dw[6] = 0;
1467b8e80941Smrg
1468b8e80941Smrg   dw[7] = 0;
1469b8e80941Smrg
1470b8e80941Smrg   dw[8] =
1471b8e80941Smrg      __gen_float(values->XMinClipGuardband);
1472b8e80941Smrg
1473b8e80941Smrg   dw[9] =
1474b8e80941Smrg      __gen_float(values->XMaxClipGuardband);
1475b8e80941Smrg
1476b8e80941Smrg   dw[10] =
1477b8e80941Smrg      __gen_float(values->YMinClipGuardband);
1478b8e80941Smrg
1479b8e80941Smrg   dw[11] =
1480b8e80941Smrg      __gen_float(values->YMaxClipGuardband);
1481b8e80941Smrg
1482b8e80941Smrg   dw[12] =
1483b8e80941Smrg      __gen_float(values->XMinViewPort);
1484b8e80941Smrg
1485b8e80941Smrg   dw[13] =
1486b8e80941Smrg      __gen_float(values->XMaxViewPort);
1487b8e80941Smrg
1488b8e80941Smrg   dw[14] =
1489b8e80941Smrg      __gen_float(values->YMinViewPort);
1490b8e80941Smrg
1491b8e80941Smrg   dw[15] =
1492b8e80941Smrg      __gen_float(values->YMaxViewPort);
1493b8e80941Smrg}
1494b8e80941Smrg
1495b8e80941Smrg#define GEN8_SF_OUTPUT_ATTRIBUTE_DETAIL_length      1
1496b8e80941Smrgstruct GEN8_SF_OUTPUT_ATTRIBUTE_DETAIL {
1497b8e80941Smrg   uint32_t                             SourceAttribute;
1498b8e80941Smrg   uint32_t                             SwizzleSelect;
1499b8e80941Smrg#define INPUTATTR                                0
1500b8e80941Smrg#define INPUTATTR_FACING                         1
1501b8e80941Smrg#define INPUTATTR_W                              2
1502b8e80941Smrg#define INPUTATTR_FACING_W                       3
1503b8e80941Smrg   uint32_t                             ConstantSource;
1504b8e80941Smrg#define CONST_0000                               0
1505b8e80941Smrg#define CONST_0001_FLOAT                         1
1506b8e80941Smrg#define CONST_1111_FLOAT                         2
1507b8e80941Smrg#define PRIM_ID                                  3
1508b8e80941Smrg   uint32_t                             SwizzleControlMode;
1509b8e80941Smrg   bool                                 ComponentOverrideX;
1510b8e80941Smrg   bool                                 ComponentOverrideY;
1511b8e80941Smrg   bool                                 ComponentOverrideZ;
1512b8e80941Smrg   bool                                 ComponentOverrideW;
1513b8e80941Smrg};
1514b8e80941Smrg
1515b8e80941Smrgstatic inline void
1516b8e80941SmrgGEN8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(__attribute__((unused)) __gen_user_data *data,
1517b8e80941Smrg                                     __attribute__((unused)) void * restrict dst,
1518b8e80941Smrg                                     __attribute__((unused)) const struct GEN8_SF_OUTPUT_ATTRIBUTE_DETAIL * restrict values)
1519b8e80941Smrg{
1520b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1521b8e80941Smrg
1522b8e80941Smrg   dw[0] =
1523b8e80941Smrg      __gen_uint(values->SourceAttribute, 0, 4) |
1524b8e80941Smrg      __gen_uint(values->SwizzleSelect, 6, 7) |
1525b8e80941Smrg      __gen_uint(values->ConstantSource, 9, 10) |
1526b8e80941Smrg      __gen_uint(values->SwizzleControlMode, 11, 11) |
1527b8e80941Smrg      __gen_uint(values->ComponentOverrideX, 12, 12) |
1528b8e80941Smrg      __gen_uint(values->ComponentOverrideY, 13, 13) |
1529b8e80941Smrg      __gen_uint(values->ComponentOverrideZ, 14, 14) |
1530b8e80941Smrg      __gen_uint(values->ComponentOverrideW, 15, 15);
1531b8e80941Smrg}
1532b8e80941Smrg
1533b8e80941Smrg#define GEN8_SO_DECL_length                    1
1534b8e80941Smrgstruct GEN8_SO_DECL {
1535b8e80941Smrg   uint32_t                             ComponentMask;
1536b8e80941Smrg   uint32_t                             RegisterIndex;
1537b8e80941Smrg   uint32_t                             HoleFlag;
1538b8e80941Smrg   uint32_t                             OutputBufferSlot;
1539b8e80941Smrg};
1540b8e80941Smrg
1541b8e80941Smrgstatic inline void
1542b8e80941SmrgGEN8_SO_DECL_pack(__attribute__((unused)) __gen_user_data *data,
1543b8e80941Smrg                  __attribute__((unused)) void * restrict dst,
1544b8e80941Smrg                  __attribute__((unused)) const struct GEN8_SO_DECL * restrict values)
1545b8e80941Smrg{
1546b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1547b8e80941Smrg
1548b8e80941Smrg   dw[0] =
1549b8e80941Smrg      __gen_uint(values->ComponentMask, 0, 3) |
1550b8e80941Smrg      __gen_uint(values->RegisterIndex, 4, 9) |
1551b8e80941Smrg      __gen_uint(values->HoleFlag, 11, 11) |
1552b8e80941Smrg      __gen_uint(values->OutputBufferSlot, 12, 13);
1553b8e80941Smrg}
1554b8e80941Smrg
1555b8e80941Smrg#define GEN8_SO_DECL_ENTRY_length              2
1556b8e80941Smrgstruct GEN8_SO_DECL_ENTRY {
1557b8e80941Smrg   struct GEN8_SO_DECL                  Stream0Decl;
1558b8e80941Smrg   struct GEN8_SO_DECL                  Stream1Decl;
1559b8e80941Smrg   struct GEN8_SO_DECL                  Stream2Decl;
1560b8e80941Smrg   struct GEN8_SO_DECL                  Stream3Decl;
1561b8e80941Smrg};
1562b8e80941Smrg
1563b8e80941Smrgstatic inline void
1564b8e80941SmrgGEN8_SO_DECL_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
1565b8e80941Smrg                        __attribute__((unused)) void * restrict dst,
1566b8e80941Smrg                        __attribute__((unused)) const struct GEN8_SO_DECL_ENTRY * restrict values)
1567b8e80941Smrg{
1568b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1569b8e80941Smrg
1570b8e80941Smrg   uint32_t v0_0;
1571b8e80941Smrg   GEN8_SO_DECL_pack(data, &v0_0, &values->Stream0Decl);
1572b8e80941Smrg
1573b8e80941Smrg   uint32_t v0_1;
1574b8e80941Smrg   GEN8_SO_DECL_pack(data, &v0_1, &values->Stream1Decl);
1575b8e80941Smrg
1576b8e80941Smrg   dw[0] =
1577b8e80941Smrg      __gen_uint(v0_0, 0, 15) |
1578b8e80941Smrg      __gen_uint(v0_1, 16, 31);
1579b8e80941Smrg
1580b8e80941Smrg   uint32_t v1_0;
1581b8e80941Smrg   GEN8_SO_DECL_pack(data, &v1_0, &values->Stream2Decl);
1582b8e80941Smrg
1583b8e80941Smrg   uint32_t v1_1;
1584b8e80941Smrg   GEN8_SO_DECL_pack(data, &v1_1, &values->Stream3Decl);
1585b8e80941Smrg
1586b8e80941Smrg   dw[1] =
1587b8e80941Smrg      __gen_uint(v1_0, 0, 15) |
1588b8e80941Smrg      __gen_uint(v1_1, 16, 31);
1589b8e80941Smrg}
1590b8e80941Smrg
1591b8e80941Smrg#define GEN8_VERTEX_BUFFER_STATE_length        4
1592b8e80941Smrgstruct GEN8_VERTEX_BUFFER_STATE {
1593b8e80941Smrg   uint32_t                             BufferPitch;
1594b8e80941Smrg   bool                                 NullVertexBuffer;
1595b8e80941Smrg   bool                                 AddressModifyEnable;
1596b8e80941Smrg   uint32_t                             MOCS;
1597b8e80941Smrg   uint32_t                             VertexBufferIndex;
1598b8e80941Smrg   __gen_address_type                   BufferStartingAddress;
1599b8e80941Smrg   uint32_t                             BufferSize;
1600b8e80941Smrg};
1601b8e80941Smrg
1602b8e80941Smrgstatic inline void
1603b8e80941SmrgGEN8_VERTEX_BUFFER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
1604b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
1605b8e80941Smrg                              __attribute__((unused)) const struct GEN8_VERTEX_BUFFER_STATE * restrict values)
1606b8e80941Smrg{
1607b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1608b8e80941Smrg
1609b8e80941Smrg   dw[0] =
1610b8e80941Smrg      __gen_uint(values->BufferPitch, 0, 11) |
1611b8e80941Smrg      __gen_uint(values->NullVertexBuffer, 13, 13) |
1612b8e80941Smrg      __gen_uint(values->AddressModifyEnable, 14, 14) |
1613b8e80941Smrg      __gen_uint(values->MOCS, 16, 22) |
1614b8e80941Smrg      __gen_uint(values->VertexBufferIndex, 26, 31);
1615b8e80941Smrg
1616b8e80941Smrg   const uint64_t v1_address =
1617b8e80941Smrg      __gen_combine_address(data, &dw[1], values->BufferStartingAddress, 0);
1618b8e80941Smrg   dw[1] = v1_address;
1619b8e80941Smrg   dw[2] = v1_address >> 32;
1620b8e80941Smrg
1621b8e80941Smrg   dw[3] =
1622b8e80941Smrg      __gen_uint(values->BufferSize, 0, 31);
1623b8e80941Smrg}
1624b8e80941Smrg
1625b8e80941Smrg#define GEN8_VERTEX_ELEMENT_STATE_length       2
1626b8e80941Smrgstruct GEN8_VERTEX_ELEMENT_STATE {
1627b8e80941Smrg   uint32_t                             SourceElementOffset;
1628b8e80941Smrg   bool                                 EdgeFlagEnable;
1629b8e80941Smrg   uint32_t                             SourceElementFormat;
1630b8e80941Smrg   bool                                 Valid;
1631b8e80941Smrg   uint32_t                             VertexBufferIndex;
1632b8e80941Smrg   enum GEN8_3D_Vertex_Component_Control Component3Control;
1633b8e80941Smrg   enum GEN8_3D_Vertex_Component_Control Component2Control;
1634b8e80941Smrg   enum GEN8_3D_Vertex_Component_Control Component1Control;
1635b8e80941Smrg   enum GEN8_3D_Vertex_Component_Control Component0Control;
1636b8e80941Smrg};
1637b8e80941Smrg
1638b8e80941Smrgstatic inline void
1639b8e80941SmrgGEN8_VERTEX_ELEMENT_STATE_pack(__attribute__((unused)) __gen_user_data *data,
1640b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
1641b8e80941Smrg                               __attribute__((unused)) const struct GEN8_VERTEX_ELEMENT_STATE * restrict values)
1642b8e80941Smrg{
1643b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1644b8e80941Smrg
1645b8e80941Smrg   dw[0] =
1646b8e80941Smrg      __gen_uint(values->SourceElementOffset, 0, 11) |
1647b8e80941Smrg      __gen_uint(values->EdgeFlagEnable, 15, 15) |
1648b8e80941Smrg      __gen_uint(values->SourceElementFormat, 16, 24) |
1649b8e80941Smrg      __gen_uint(values->Valid, 25, 25) |
1650b8e80941Smrg      __gen_uint(values->VertexBufferIndex, 26, 31);
1651b8e80941Smrg
1652b8e80941Smrg   dw[1] =
1653b8e80941Smrg      __gen_uint(values->Component3Control, 16, 18) |
1654b8e80941Smrg      __gen_uint(values->Component2Control, 20, 22) |
1655b8e80941Smrg      __gen_uint(values->Component1Control, 24, 26) |
1656b8e80941Smrg      __gen_uint(values->Component0Control, 28, 30);
1657b8e80941Smrg}
1658b8e80941Smrg
1659b8e80941Smrg#define GEN8_3DPRIMITIVE_length                7
1660b8e80941Smrg#define GEN8_3DPRIMITIVE_length_bias           2
1661b8e80941Smrg#define GEN8_3DPRIMITIVE_header                 \
1662b8e80941Smrg   .DWordLength                         =      5,  \
1663b8e80941Smrg   ._3DCommandSubOpcode                 =      0,  \
1664b8e80941Smrg   ._3DCommandOpcode                    =      3,  \
1665b8e80941Smrg   .CommandSubType                      =      3,  \
1666b8e80941Smrg   .CommandType                         =      3
1667b8e80941Smrg
1668b8e80941Smrgstruct GEN8_3DPRIMITIVE {
1669b8e80941Smrg   uint32_t                             DWordLength;
1670b8e80941Smrg   bool                                 PredicateEnable;
1671b8e80941Smrg   bool                                 UAVCoherencyRequired;
1672b8e80941Smrg   bool                                 IndirectParameterEnable;
1673b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1674b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1675b8e80941Smrg   uint32_t                             CommandSubType;
1676b8e80941Smrg   uint32_t                             CommandType;
1677b8e80941Smrg   enum GEN8_3D_Prim_Topo_Type          PrimitiveTopologyType;
1678b8e80941Smrg   uint32_t                             VertexAccessType;
1679b8e80941Smrg#define SEQUENTIAL                               0
1680b8e80941Smrg#define RANDOM                                   1
1681b8e80941Smrg   bool                                 EndOffsetEnable;
1682b8e80941Smrg   uint32_t                             VertexCountPerInstance;
1683b8e80941Smrg   uint32_t                             StartVertexLocation;
1684b8e80941Smrg   uint32_t                             InstanceCount;
1685b8e80941Smrg   uint32_t                             StartInstanceLocation;
1686b8e80941Smrg   int32_t                              BaseVertexLocation;
1687b8e80941Smrg};
1688b8e80941Smrg
1689b8e80941Smrgstatic inline void
1690b8e80941SmrgGEN8_3DPRIMITIVE_pack(__attribute__((unused)) __gen_user_data *data,
1691b8e80941Smrg                      __attribute__((unused)) void * restrict dst,
1692b8e80941Smrg                      __attribute__((unused)) const struct GEN8_3DPRIMITIVE * restrict values)
1693b8e80941Smrg{
1694b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1695b8e80941Smrg
1696b8e80941Smrg   dw[0] =
1697b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
1698b8e80941Smrg      __gen_uint(values->PredicateEnable, 8, 8) |
1699b8e80941Smrg      __gen_uint(values->UAVCoherencyRequired, 9, 9) |
1700b8e80941Smrg      __gen_uint(values->IndirectParameterEnable, 10, 10) |
1701b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1702b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1703b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1704b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1705b8e80941Smrg
1706b8e80941Smrg   dw[1] =
1707b8e80941Smrg      __gen_uint(values->PrimitiveTopologyType, 0, 5) |
1708b8e80941Smrg      __gen_uint(values->VertexAccessType, 8, 8) |
1709b8e80941Smrg      __gen_uint(values->EndOffsetEnable, 9, 9);
1710b8e80941Smrg
1711b8e80941Smrg   dw[2] =
1712b8e80941Smrg      __gen_uint(values->VertexCountPerInstance, 0, 31);
1713b8e80941Smrg
1714b8e80941Smrg   dw[3] =
1715b8e80941Smrg      __gen_uint(values->StartVertexLocation, 0, 31);
1716b8e80941Smrg
1717b8e80941Smrg   dw[4] =
1718b8e80941Smrg      __gen_uint(values->InstanceCount, 0, 31);
1719b8e80941Smrg
1720b8e80941Smrg   dw[5] =
1721b8e80941Smrg      __gen_uint(values->StartInstanceLocation, 0, 31);
1722b8e80941Smrg
1723b8e80941Smrg   dw[6] =
1724b8e80941Smrg      __gen_sint(values->BaseVertexLocation, 0, 31);
1725b8e80941Smrg}
1726b8e80941Smrg
1727b8e80941Smrg#define GEN8_3DSTATE_AA_LINE_PARAMETERS_length      3
1728b8e80941Smrg#define GEN8_3DSTATE_AA_LINE_PARAMETERS_length_bias      2
1729b8e80941Smrg#define GEN8_3DSTATE_AA_LINE_PARAMETERS_header  \
1730b8e80941Smrg   .DWordLength                         =      1,  \
1731b8e80941Smrg   ._3DCommandSubOpcode                 =     10,  \
1732b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
1733b8e80941Smrg   .CommandSubType                      =      3,  \
1734b8e80941Smrg   .CommandType                         =      3
1735b8e80941Smrg
1736b8e80941Smrgstruct GEN8_3DSTATE_AA_LINE_PARAMETERS {
1737b8e80941Smrg   uint32_t                             DWordLength;
1738b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1739b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1740b8e80941Smrg   uint32_t                             CommandSubType;
1741b8e80941Smrg   uint32_t                             CommandType;
1742b8e80941Smrg   float                                AACoverageSlope;
1743b8e80941Smrg   float                                AAPointCoverageSlope;
1744b8e80941Smrg   float                                AACoverageBias;
1745b8e80941Smrg   float                                AAPointCoverageBias;
1746b8e80941Smrg   float                                AACoverageEndCapSlope;
1747b8e80941Smrg   float                                AAPointCoverageEndCapSlope;
1748b8e80941Smrg   float                                AACoverageEndCapBias;
1749b8e80941Smrg   float                                AAPointCoverageEndCapBias;
1750b8e80941Smrg};
1751b8e80941Smrg
1752b8e80941Smrgstatic inline void
1753b8e80941SmrgGEN8_3DSTATE_AA_LINE_PARAMETERS_pack(__attribute__((unused)) __gen_user_data *data,
1754b8e80941Smrg                                     __attribute__((unused)) void * restrict dst,
1755b8e80941Smrg                                     __attribute__((unused)) const struct GEN8_3DSTATE_AA_LINE_PARAMETERS * restrict values)
1756b8e80941Smrg{
1757b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1758b8e80941Smrg
1759b8e80941Smrg   dw[0] =
1760b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
1761b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1762b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1763b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1764b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1765b8e80941Smrg
1766b8e80941Smrg   dw[1] =
1767b8e80941Smrg      __gen_ufixed(values->AACoverageSlope, 0, 7, 8) |
1768b8e80941Smrg      __gen_ufixed(values->AAPointCoverageSlope, 8, 15, 8) |
1769b8e80941Smrg      __gen_ufixed(values->AACoverageBias, 16, 23, 8) |
1770b8e80941Smrg      __gen_ufixed(values->AAPointCoverageBias, 24, 31, 8);
1771b8e80941Smrg
1772b8e80941Smrg   dw[2] =
1773b8e80941Smrg      __gen_ufixed(values->AACoverageEndCapSlope, 0, 7, 8) |
1774b8e80941Smrg      __gen_ufixed(values->AAPointCoverageEndCapSlope, 8, 15, 8) |
1775b8e80941Smrg      __gen_ufixed(values->AACoverageEndCapBias, 16, 23, 8) |
1776b8e80941Smrg      __gen_ufixed(values->AAPointCoverageEndCapBias, 24, 31, 8);
1777b8e80941Smrg}
1778b8e80941Smrg
1779b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_EDIT_DS_length_bias      2
1780b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_EDIT_DS_header\
1781b8e80941Smrg   .DWordLength                         =      0,  \
1782b8e80941Smrg   ._3DCommandSubOpcode                 =     70,  \
1783b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
1784b8e80941Smrg   .CommandSubType                      =      3,  \
1785b8e80941Smrg   .CommandType                         =      3
1786b8e80941Smrg
1787b8e80941Smrgstruct GEN8_3DSTATE_BINDING_TABLE_EDIT_DS {
1788b8e80941Smrg   uint32_t                             DWordLength;
1789b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1790b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1791b8e80941Smrg   uint32_t                             CommandSubType;
1792b8e80941Smrg   uint32_t                             CommandType;
1793b8e80941Smrg   uint32_t                             BindingTableEditTarget;
1794b8e80941Smrg#define AllCores                                 3
1795b8e80941Smrg#define Core1                                    2
1796b8e80941Smrg#define Core0                                    1
1797b8e80941Smrg   uint32_t                             BindingTableBlockClear;
1798b8e80941Smrg   /* variable length fields follow */
1799b8e80941Smrg};
1800b8e80941Smrg
1801b8e80941Smrgstatic inline void
1802b8e80941SmrgGEN8_3DSTATE_BINDING_TABLE_EDIT_DS_pack(__attribute__((unused)) __gen_user_data *data,
1803b8e80941Smrg                                        __attribute__((unused)) void * restrict dst,
1804b8e80941Smrg                                        __attribute__((unused)) const struct GEN8_3DSTATE_BINDING_TABLE_EDIT_DS * restrict values)
1805b8e80941Smrg{
1806b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1807b8e80941Smrg
1808b8e80941Smrg   dw[0] =
1809b8e80941Smrg      __gen_uint(values->DWordLength, 0, 8) |
1810b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1811b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1812b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1813b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1814b8e80941Smrg
1815b8e80941Smrg   dw[1] =
1816b8e80941Smrg      __gen_uint(values->BindingTableEditTarget, 0, 1) |
1817b8e80941Smrg      __gen_uint(values->BindingTableBlockClear, 16, 31);
1818b8e80941Smrg}
1819b8e80941Smrg
1820b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_EDIT_GS_length_bias      2
1821b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_EDIT_GS_header\
1822b8e80941Smrg   .DWordLength                         =      0,  \
1823b8e80941Smrg   ._3DCommandSubOpcode                 =     68,  \
1824b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
1825b8e80941Smrg   .CommandSubType                      =      3,  \
1826b8e80941Smrg   .CommandType                         =      3
1827b8e80941Smrg
1828b8e80941Smrgstruct GEN8_3DSTATE_BINDING_TABLE_EDIT_GS {
1829b8e80941Smrg   uint32_t                             DWordLength;
1830b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1831b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1832b8e80941Smrg   uint32_t                             CommandSubType;
1833b8e80941Smrg   uint32_t                             CommandType;
1834b8e80941Smrg   uint32_t                             BindingTableEditTarget;
1835b8e80941Smrg#define AllCores                                 3
1836b8e80941Smrg#define Core1                                    2
1837b8e80941Smrg#define Core0                                    1
1838b8e80941Smrg   uint32_t                             BindingTableBlockClear;
1839b8e80941Smrg   /* variable length fields follow */
1840b8e80941Smrg};
1841b8e80941Smrg
1842b8e80941Smrgstatic inline void
1843b8e80941SmrgGEN8_3DSTATE_BINDING_TABLE_EDIT_GS_pack(__attribute__((unused)) __gen_user_data *data,
1844b8e80941Smrg                                        __attribute__((unused)) void * restrict dst,
1845b8e80941Smrg                                        __attribute__((unused)) const struct GEN8_3DSTATE_BINDING_TABLE_EDIT_GS * restrict values)
1846b8e80941Smrg{
1847b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1848b8e80941Smrg
1849b8e80941Smrg   dw[0] =
1850b8e80941Smrg      __gen_uint(values->DWordLength, 0, 8) |
1851b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1852b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1853b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1854b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1855b8e80941Smrg
1856b8e80941Smrg   dw[1] =
1857b8e80941Smrg      __gen_uint(values->BindingTableEditTarget, 0, 1) |
1858b8e80941Smrg      __gen_uint(values->BindingTableBlockClear, 16, 31);
1859b8e80941Smrg}
1860b8e80941Smrg
1861b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_EDIT_HS_length_bias      2
1862b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_EDIT_HS_header\
1863b8e80941Smrg   .DWordLength                         =      0,  \
1864b8e80941Smrg   ._3DCommandSubOpcode                 =     69,  \
1865b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
1866b8e80941Smrg   .CommandSubType                      =      3,  \
1867b8e80941Smrg   .CommandType                         =      3
1868b8e80941Smrg
1869b8e80941Smrgstruct GEN8_3DSTATE_BINDING_TABLE_EDIT_HS {
1870b8e80941Smrg   uint32_t                             DWordLength;
1871b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1872b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1873b8e80941Smrg   uint32_t                             CommandSubType;
1874b8e80941Smrg   uint32_t                             CommandType;
1875b8e80941Smrg   uint32_t                             BindingTableEditTarget;
1876b8e80941Smrg#define AllCores                                 3
1877b8e80941Smrg#define Core1                                    2
1878b8e80941Smrg#define Core0                                    1
1879b8e80941Smrg   uint32_t                             BindingTableBlockClear;
1880b8e80941Smrg   /* variable length fields follow */
1881b8e80941Smrg};
1882b8e80941Smrg
1883b8e80941Smrgstatic inline void
1884b8e80941SmrgGEN8_3DSTATE_BINDING_TABLE_EDIT_HS_pack(__attribute__((unused)) __gen_user_data *data,
1885b8e80941Smrg                                        __attribute__((unused)) void * restrict dst,
1886b8e80941Smrg                                        __attribute__((unused)) const struct GEN8_3DSTATE_BINDING_TABLE_EDIT_HS * restrict values)
1887b8e80941Smrg{
1888b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1889b8e80941Smrg
1890b8e80941Smrg   dw[0] =
1891b8e80941Smrg      __gen_uint(values->DWordLength, 0, 8) |
1892b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1893b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1894b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1895b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1896b8e80941Smrg
1897b8e80941Smrg   dw[1] =
1898b8e80941Smrg      __gen_uint(values->BindingTableEditTarget, 0, 1) |
1899b8e80941Smrg      __gen_uint(values->BindingTableBlockClear, 16, 31);
1900b8e80941Smrg}
1901b8e80941Smrg
1902b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_EDIT_PS_length_bias      2
1903b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_EDIT_PS_header\
1904b8e80941Smrg   .DWordLength                         =      0,  \
1905b8e80941Smrg   ._3DCommandSubOpcode                 =     71,  \
1906b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
1907b8e80941Smrg   .CommandSubType                      =      3,  \
1908b8e80941Smrg   .CommandType                         =      3
1909b8e80941Smrg
1910b8e80941Smrgstruct GEN8_3DSTATE_BINDING_TABLE_EDIT_PS {
1911b8e80941Smrg   uint32_t                             DWordLength;
1912b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1913b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1914b8e80941Smrg   uint32_t                             CommandSubType;
1915b8e80941Smrg   uint32_t                             CommandType;
1916b8e80941Smrg   uint32_t                             BindingTableEditTarget;
1917b8e80941Smrg#define AllCores                                 3
1918b8e80941Smrg#define Core1                                    2
1919b8e80941Smrg#define Core0                                    1
1920b8e80941Smrg   uint32_t                             BindingTableBlockClear;
1921b8e80941Smrg   /* variable length fields follow */
1922b8e80941Smrg};
1923b8e80941Smrg
1924b8e80941Smrgstatic inline void
1925b8e80941SmrgGEN8_3DSTATE_BINDING_TABLE_EDIT_PS_pack(__attribute__((unused)) __gen_user_data *data,
1926b8e80941Smrg                                        __attribute__((unused)) void * restrict dst,
1927b8e80941Smrg                                        __attribute__((unused)) const struct GEN8_3DSTATE_BINDING_TABLE_EDIT_PS * restrict values)
1928b8e80941Smrg{
1929b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1930b8e80941Smrg
1931b8e80941Smrg   dw[0] =
1932b8e80941Smrg      __gen_uint(values->DWordLength, 0, 8) |
1933b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1934b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1935b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1936b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1937b8e80941Smrg
1938b8e80941Smrg   dw[1] =
1939b8e80941Smrg      __gen_uint(values->BindingTableEditTarget, 0, 1) |
1940b8e80941Smrg      __gen_uint(values->BindingTableBlockClear, 16, 31);
1941b8e80941Smrg}
1942b8e80941Smrg
1943b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_EDIT_VS_length_bias      2
1944b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_EDIT_VS_header\
1945b8e80941Smrg   .DWordLength                         =      0,  \
1946b8e80941Smrg   ._3DCommandSubOpcode                 =     67,  \
1947b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
1948b8e80941Smrg   .CommandSubType                      =      3,  \
1949b8e80941Smrg   .CommandType                         =      3
1950b8e80941Smrg
1951b8e80941Smrgstruct GEN8_3DSTATE_BINDING_TABLE_EDIT_VS {
1952b8e80941Smrg   uint32_t                             DWordLength;
1953b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1954b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1955b8e80941Smrg   uint32_t                             CommandSubType;
1956b8e80941Smrg   uint32_t                             CommandType;
1957b8e80941Smrg   uint32_t                             BindingTableEditTarget;
1958b8e80941Smrg#define AllCores                                 3
1959b8e80941Smrg#define Core1                                    2
1960b8e80941Smrg#define Core0                                    1
1961b8e80941Smrg   uint32_t                             BindingTableBlockClear;
1962b8e80941Smrg   /* variable length fields follow */
1963b8e80941Smrg};
1964b8e80941Smrg
1965b8e80941Smrgstatic inline void
1966b8e80941SmrgGEN8_3DSTATE_BINDING_TABLE_EDIT_VS_pack(__attribute__((unused)) __gen_user_data *data,
1967b8e80941Smrg                                        __attribute__((unused)) void * restrict dst,
1968b8e80941Smrg                                        __attribute__((unused)) const struct GEN8_3DSTATE_BINDING_TABLE_EDIT_VS * restrict values)
1969b8e80941Smrg{
1970b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1971b8e80941Smrg
1972b8e80941Smrg   dw[0] =
1973b8e80941Smrg      __gen_uint(values->DWordLength, 0, 8) |
1974b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1975b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1976b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1977b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1978b8e80941Smrg
1979b8e80941Smrg   dw[1] =
1980b8e80941Smrg      __gen_uint(values->BindingTableEditTarget, 0, 1) |
1981b8e80941Smrg      __gen_uint(values->BindingTableBlockClear, 16, 31);
1982b8e80941Smrg}
1983b8e80941Smrg
1984b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_POINTERS_DS_length      2
1985b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_POINTERS_DS_length_bias      2
1986b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_POINTERS_DS_header\
1987b8e80941Smrg   .DWordLength                         =      0,  \
1988b8e80941Smrg   ._3DCommandSubOpcode                 =     40,  \
1989b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
1990b8e80941Smrg   .CommandSubType                      =      3,  \
1991b8e80941Smrg   .CommandType                         =      3
1992b8e80941Smrg
1993b8e80941Smrgstruct GEN8_3DSTATE_BINDING_TABLE_POINTERS_DS {
1994b8e80941Smrg   uint32_t                             DWordLength;
1995b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1996b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1997b8e80941Smrg   uint32_t                             CommandSubType;
1998b8e80941Smrg   uint32_t                             CommandType;
1999b8e80941Smrg   uint64_t                             PointertoDSBindingTable;
2000b8e80941Smrg};
2001b8e80941Smrg
2002b8e80941Smrgstatic inline void
2003b8e80941SmrgGEN8_3DSTATE_BINDING_TABLE_POINTERS_DS_pack(__attribute__((unused)) __gen_user_data *data,
2004b8e80941Smrg                                            __attribute__((unused)) void * restrict dst,
2005b8e80941Smrg                                            __attribute__((unused)) const struct GEN8_3DSTATE_BINDING_TABLE_POINTERS_DS * restrict values)
2006b8e80941Smrg{
2007b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2008b8e80941Smrg
2009b8e80941Smrg   dw[0] =
2010b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2011b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2012b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2013b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2014b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2015b8e80941Smrg
2016b8e80941Smrg   dw[1] =
2017b8e80941Smrg      __gen_offset(values->PointertoDSBindingTable, 5, 15);
2018b8e80941Smrg}
2019b8e80941Smrg
2020b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_POINTERS_GS_length      2
2021b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_POINTERS_GS_length_bias      2
2022b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_POINTERS_GS_header\
2023b8e80941Smrg   .DWordLength                         =      0,  \
2024b8e80941Smrg   ._3DCommandSubOpcode                 =     41,  \
2025b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2026b8e80941Smrg   .CommandSubType                      =      3,  \
2027b8e80941Smrg   .CommandType                         =      3
2028b8e80941Smrg
2029b8e80941Smrgstruct GEN8_3DSTATE_BINDING_TABLE_POINTERS_GS {
2030b8e80941Smrg   uint32_t                             DWordLength;
2031b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2032b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2033b8e80941Smrg   uint32_t                             CommandSubType;
2034b8e80941Smrg   uint32_t                             CommandType;
2035b8e80941Smrg   uint64_t                             PointertoGSBindingTable;
2036b8e80941Smrg};
2037b8e80941Smrg
2038b8e80941Smrgstatic inline void
2039b8e80941SmrgGEN8_3DSTATE_BINDING_TABLE_POINTERS_GS_pack(__attribute__((unused)) __gen_user_data *data,
2040b8e80941Smrg                                            __attribute__((unused)) void * restrict dst,
2041b8e80941Smrg                                            __attribute__((unused)) const struct GEN8_3DSTATE_BINDING_TABLE_POINTERS_GS * restrict values)
2042b8e80941Smrg{
2043b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2044b8e80941Smrg
2045b8e80941Smrg   dw[0] =
2046b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2047b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2048b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2049b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2050b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2051b8e80941Smrg
2052b8e80941Smrg   dw[1] =
2053b8e80941Smrg      __gen_offset(values->PointertoGSBindingTable, 5, 15);
2054b8e80941Smrg}
2055b8e80941Smrg
2056b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_POINTERS_HS_length      2
2057b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_POINTERS_HS_length_bias      2
2058b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_POINTERS_HS_header\
2059b8e80941Smrg   .DWordLength                         =      0,  \
2060b8e80941Smrg   ._3DCommandSubOpcode                 =     39,  \
2061b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2062b8e80941Smrg   .CommandSubType                      =      3,  \
2063b8e80941Smrg   .CommandType                         =      3
2064b8e80941Smrg
2065b8e80941Smrgstruct GEN8_3DSTATE_BINDING_TABLE_POINTERS_HS {
2066b8e80941Smrg   uint32_t                             DWordLength;
2067b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2068b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2069b8e80941Smrg   uint32_t                             CommandSubType;
2070b8e80941Smrg   uint32_t                             CommandType;
2071b8e80941Smrg   uint64_t                             PointertoHSBindingTable;
2072b8e80941Smrg};
2073b8e80941Smrg
2074b8e80941Smrgstatic inline void
2075b8e80941SmrgGEN8_3DSTATE_BINDING_TABLE_POINTERS_HS_pack(__attribute__((unused)) __gen_user_data *data,
2076b8e80941Smrg                                            __attribute__((unused)) void * restrict dst,
2077b8e80941Smrg                                            __attribute__((unused)) const struct GEN8_3DSTATE_BINDING_TABLE_POINTERS_HS * restrict values)
2078b8e80941Smrg{
2079b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2080b8e80941Smrg
2081b8e80941Smrg   dw[0] =
2082b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2083b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2084b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2085b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2086b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2087b8e80941Smrg
2088b8e80941Smrg   dw[1] =
2089b8e80941Smrg      __gen_offset(values->PointertoHSBindingTable, 5, 15);
2090b8e80941Smrg}
2091b8e80941Smrg
2092b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_POINTERS_PS_length      2
2093b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_POINTERS_PS_length_bias      2
2094b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_POINTERS_PS_header\
2095b8e80941Smrg   .DWordLength                         =      0,  \
2096b8e80941Smrg   ._3DCommandSubOpcode                 =     42,  \
2097b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2098b8e80941Smrg   .CommandSubType                      =      3,  \
2099b8e80941Smrg   .CommandType                         =      3
2100b8e80941Smrg
2101b8e80941Smrgstruct GEN8_3DSTATE_BINDING_TABLE_POINTERS_PS {
2102b8e80941Smrg   uint32_t                             DWordLength;
2103b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2104b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2105b8e80941Smrg   uint32_t                             CommandSubType;
2106b8e80941Smrg   uint32_t                             CommandType;
2107b8e80941Smrg   uint64_t                             PointertoPSBindingTable;
2108b8e80941Smrg};
2109b8e80941Smrg
2110b8e80941Smrgstatic inline void
2111b8e80941SmrgGEN8_3DSTATE_BINDING_TABLE_POINTERS_PS_pack(__attribute__((unused)) __gen_user_data *data,
2112b8e80941Smrg                                            __attribute__((unused)) void * restrict dst,
2113b8e80941Smrg                                            __attribute__((unused)) const struct GEN8_3DSTATE_BINDING_TABLE_POINTERS_PS * restrict values)
2114b8e80941Smrg{
2115b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2116b8e80941Smrg
2117b8e80941Smrg   dw[0] =
2118b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2119b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2120b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2121b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2122b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2123b8e80941Smrg
2124b8e80941Smrg   dw[1] =
2125b8e80941Smrg      __gen_offset(values->PointertoPSBindingTable, 5, 15);
2126b8e80941Smrg}
2127b8e80941Smrg
2128b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_POINTERS_VS_length      2
2129b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_POINTERS_VS_length_bias      2
2130b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_POINTERS_VS_header\
2131b8e80941Smrg   .DWordLength                         =      0,  \
2132b8e80941Smrg   ._3DCommandSubOpcode                 =     38,  \
2133b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2134b8e80941Smrg   .CommandSubType                      =      3,  \
2135b8e80941Smrg   .CommandType                         =      3
2136b8e80941Smrg
2137b8e80941Smrgstruct GEN8_3DSTATE_BINDING_TABLE_POINTERS_VS {
2138b8e80941Smrg   uint32_t                             DWordLength;
2139b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2140b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2141b8e80941Smrg   uint32_t                             CommandSubType;
2142b8e80941Smrg   uint32_t                             CommandType;
2143b8e80941Smrg   uint64_t                             PointertoVSBindingTable;
2144b8e80941Smrg};
2145b8e80941Smrg
2146b8e80941Smrgstatic inline void
2147b8e80941SmrgGEN8_3DSTATE_BINDING_TABLE_POINTERS_VS_pack(__attribute__((unused)) __gen_user_data *data,
2148b8e80941Smrg                                            __attribute__((unused)) void * restrict dst,
2149b8e80941Smrg                                            __attribute__((unused)) const struct GEN8_3DSTATE_BINDING_TABLE_POINTERS_VS * restrict values)
2150b8e80941Smrg{
2151b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2152b8e80941Smrg
2153b8e80941Smrg   dw[0] =
2154b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2155b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2156b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2157b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2158b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2159b8e80941Smrg
2160b8e80941Smrg   dw[1] =
2161b8e80941Smrg      __gen_offset(values->PointertoVSBindingTable, 5, 15);
2162b8e80941Smrg}
2163b8e80941Smrg
2164b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_POOL_ALLOC_length      4
2165b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_POOL_ALLOC_length_bias      2
2166b8e80941Smrg#define GEN8_3DSTATE_BINDING_TABLE_POOL_ALLOC_header\
2167b8e80941Smrg   .DWordLength                         =      2,  \
2168b8e80941Smrg   ._3DCommandSubOpcode                 =     25,  \
2169b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
2170b8e80941Smrg   .CommandSubType                      =      3,  \
2171b8e80941Smrg   .CommandType                         =      3
2172b8e80941Smrg
2173b8e80941Smrgstruct GEN8_3DSTATE_BINDING_TABLE_POOL_ALLOC {
2174b8e80941Smrg   uint32_t                             DWordLength;
2175b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2176b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2177b8e80941Smrg   uint32_t                             CommandSubType;
2178b8e80941Smrg   uint32_t                             CommandType;
2179b8e80941Smrg   uint32_t                             MOCS;
2180b8e80941Smrg   uint32_t                             BindingTablePoolEnable;
2181b8e80941Smrg   __gen_address_type                   BindingTablePoolBaseAddress;
2182b8e80941Smrg   uint32_t                             BindingTablePoolBufferSize;
2183b8e80941Smrg#define NoValidData                              0
2184b8e80941Smrg};
2185b8e80941Smrg
2186b8e80941Smrgstatic inline void
2187b8e80941SmrgGEN8_3DSTATE_BINDING_TABLE_POOL_ALLOC_pack(__attribute__((unused)) __gen_user_data *data,
2188b8e80941Smrg                                           __attribute__((unused)) void * restrict dst,
2189b8e80941Smrg                                           __attribute__((unused)) const struct GEN8_3DSTATE_BINDING_TABLE_POOL_ALLOC * restrict values)
2190b8e80941Smrg{
2191b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2192b8e80941Smrg
2193b8e80941Smrg   dw[0] =
2194b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2195b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2196b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2197b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2198b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2199b8e80941Smrg
2200b8e80941Smrg   const uint64_t v1 =
2201b8e80941Smrg      __gen_uint(values->MOCS, 0, 6) |
2202b8e80941Smrg      __gen_uint(values->BindingTablePoolEnable, 11, 11);
2203b8e80941Smrg   const uint64_t v1_address =
2204b8e80941Smrg      __gen_combine_address(data, &dw[1], values->BindingTablePoolBaseAddress, v1);
2205b8e80941Smrg   dw[1] = v1_address;
2206b8e80941Smrg   dw[2] = (v1_address >> 32) | (v1 >> 32);
2207b8e80941Smrg
2208b8e80941Smrg   dw[3] =
2209b8e80941Smrg      __gen_uint(values->BindingTablePoolBufferSize, 12, 31);
2210b8e80941Smrg}
2211b8e80941Smrg
2212b8e80941Smrg#define GEN8_3DSTATE_BLEND_STATE_POINTERS_length      2
2213b8e80941Smrg#define GEN8_3DSTATE_BLEND_STATE_POINTERS_length_bias      2
2214b8e80941Smrg#define GEN8_3DSTATE_BLEND_STATE_POINTERS_header\
2215b8e80941Smrg   .DWordLength                         =      0,  \
2216b8e80941Smrg   ._3DCommandSubOpcode                 =     36,  \
2217b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2218b8e80941Smrg   .CommandSubType                      =      3,  \
2219b8e80941Smrg   .CommandType                         =      3
2220b8e80941Smrg
2221b8e80941Smrgstruct GEN8_3DSTATE_BLEND_STATE_POINTERS {
2222b8e80941Smrg   uint32_t                             DWordLength;
2223b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2224b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2225b8e80941Smrg   uint32_t                             CommandSubType;
2226b8e80941Smrg   uint32_t                             CommandType;
2227b8e80941Smrg   bool                                 BlendStatePointerValid;
2228b8e80941Smrg   uint64_t                             BlendStatePointer;
2229b8e80941Smrg};
2230b8e80941Smrg
2231b8e80941Smrgstatic inline void
2232b8e80941SmrgGEN8_3DSTATE_BLEND_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
2233b8e80941Smrg                                       __attribute__((unused)) void * restrict dst,
2234b8e80941Smrg                                       __attribute__((unused)) const struct GEN8_3DSTATE_BLEND_STATE_POINTERS * restrict values)
2235b8e80941Smrg{
2236b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2237b8e80941Smrg
2238b8e80941Smrg   dw[0] =
2239b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2240b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2241b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2242b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2243b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2244b8e80941Smrg
2245b8e80941Smrg   dw[1] =
2246b8e80941Smrg      __gen_uint(values->BlendStatePointerValid, 0, 0) |
2247b8e80941Smrg      __gen_offset(values->BlendStatePointer, 6, 31);
2248b8e80941Smrg}
2249b8e80941Smrg
2250b8e80941Smrg#define GEN8_3DSTATE_CC_STATE_POINTERS_length      2
2251b8e80941Smrg#define GEN8_3DSTATE_CC_STATE_POINTERS_length_bias      2
2252b8e80941Smrg#define GEN8_3DSTATE_CC_STATE_POINTERS_header   \
2253b8e80941Smrg   .DWordLength                         =      0,  \
2254b8e80941Smrg   ._3DCommandSubOpcode                 =     14,  \
2255b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2256b8e80941Smrg   .CommandSubType                      =      3,  \
2257b8e80941Smrg   .CommandType                         =      3
2258b8e80941Smrg
2259b8e80941Smrgstruct GEN8_3DSTATE_CC_STATE_POINTERS {
2260b8e80941Smrg   uint32_t                             DWordLength;
2261b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2262b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2263b8e80941Smrg   uint32_t                             CommandSubType;
2264b8e80941Smrg   uint32_t                             CommandType;
2265b8e80941Smrg   bool                                 ColorCalcStatePointerValid;
2266b8e80941Smrg   uint64_t                             ColorCalcStatePointer;
2267b8e80941Smrg};
2268b8e80941Smrg
2269b8e80941Smrgstatic inline void
2270b8e80941SmrgGEN8_3DSTATE_CC_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
2271b8e80941Smrg                                    __attribute__((unused)) void * restrict dst,
2272b8e80941Smrg                                    __attribute__((unused)) const struct GEN8_3DSTATE_CC_STATE_POINTERS * restrict values)
2273b8e80941Smrg{
2274b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2275b8e80941Smrg
2276b8e80941Smrg   dw[0] =
2277b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2278b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2279b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2280b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2281b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2282b8e80941Smrg
2283b8e80941Smrg   dw[1] =
2284b8e80941Smrg      __gen_uint(values->ColorCalcStatePointerValid, 0, 0) |
2285b8e80941Smrg      __gen_offset(values->ColorCalcStatePointer, 6, 31);
2286b8e80941Smrg}
2287b8e80941Smrg
2288b8e80941Smrg#define GEN8_3DSTATE_CHROMA_KEY_length         4
2289b8e80941Smrg#define GEN8_3DSTATE_CHROMA_KEY_length_bias      2
2290b8e80941Smrg#define GEN8_3DSTATE_CHROMA_KEY_header          \
2291b8e80941Smrg   .DWordLength                         =      2,  \
2292b8e80941Smrg   ._3DCommandSubOpcode                 =      4,  \
2293b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
2294b8e80941Smrg   .CommandSubType                      =      3,  \
2295b8e80941Smrg   .CommandType                         =      3
2296b8e80941Smrg
2297b8e80941Smrgstruct GEN8_3DSTATE_CHROMA_KEY {
2298b8e80941Smrg   uint32_t                             DWordLength;
2299b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2300b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2301b8e80941Smrg   uint32_t                             CommandSubType;
2302b8e80941Smrg   uint32_t                             CommandType;
2303b8e80941Smrg   uint32_t                             ChromaKeyTableIndex;
2304b8e80941Smrg   uint32_t                             ChromaKeyLowValue;
2305b8e80941Smrg   uint32_t                             ChromaKeyHighValue;
2306b8e80941Smrg};
2307b8e80941Smrg
2308b8e80941Smrgstatic inline void
2309b8e80941SmrgGEN8_3DSTATE_CHROMA_KEY_pack(__attribute__((unused)) __gen_user_data *data,
2310b8e80941Smrg                             __attribute__((unused)) void * restrict dst,
2311b8e80941Smrg                             __attribute__((unused)) const struct GEN8_3DSTATE_CHROMA_KEY * restrict values)
2312b8e80941Smrg{
2313b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2314b8e80941Smrg
2315b8e80941Smrg   dw[0] =
2316b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2317b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2318b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2319b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2320b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2321b8e80941Smrg
2322b8e80941Smrg   dw[1] =
2323b8e80941Smrg      __gen_uint(values->ChromaKeyTableIndex, 30, 31);
2324b8e80941Smrg
2325b8e80941Smrg   dw[2] =
2326b8e80941Smrg      __gen_uint(values->ChromaKeyLowValue, 0, 31);
2327b8e80941Smrg
2328b8e80941Smrg   dw[3] =
2329b8e80941Smrg      __gen_uint(values->ChromaKeyHighValue, 0, 31);
2330b8e80941Smrg}
2331b8e80941Smrg
2332b8e80941Smrg#define GEN8_3DSTATE_CLEAR_PARAMS_length       3
2333b8e80941Smrg#define GEN8_3DSTATE_CLEAR_PARAMS_length_bias      2
2334b8e80941Smrg#define GEN8_3DSTATE_CLEAR_PARAMS_header        \
2335b8e80941Smrg   .DWordLength                         =      1,  \
2336b8e80941Smrg   ._3DCommandSubOpcode                 =      4,  \
2337b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2338b8e80941Smrg   .CommandSubType                      =      3,  \
2339b8e80941Smrg   .CommandType                         =      3
2340b8e80941Smrg
2341b8e80941Smrgstruct GEN8_3DSTATE_CLEAR_PARAMS {
2342b8e80941Smrg   uint32_t                             DWordLength;
2343b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2344b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2345b8e80941Smrg   uint32_t                             CommandSubType;
2346b8e80941Smrg   uint32_t                             CommandType;
2347b8e80941Smrg   float                                DepthClearValue;
2348b8e80941Smrg   bool                                 DepthClearValueValid;
2349b8e80941Smrg};
2350b8e80941Smrg
2351b8e80941Smrgstatic inline void
2352b8e80941SmrgGEN8_3DSTATE_CLEAR_PARAMS_pack(__attribute__((unused)) __gen_user_data *data,
2353b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
2354b8e80941Smrg                               __attribute__((unused)) const struct GEN8_3DSTATE_CLEAR_PARAMS * restrict values)
2355b8e80941Smrg{
2356b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2357b8e80941Smrg
2358b8e80941Smrg   dw[0] =
2359b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2360b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2361b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2362b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2363b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2364b8e80941Smrg
2365b8e80941Smrg   dw[1] =
2366b8e80941Smrg      __gen_float(values->DepthClearValue);
2367b8e80941Smrg
2368b8e80941Smrg   dw[2] =
2369b8e80941Smrg      __gen_uint(values->DepthClearValueValid, 0, 0);
2370b8e80941Smrg}
2371b8e80941Smrg
2372b8e80941Smrg#define GEN8_3DSTATE_CLIP_length               4
2373b8e80941Smrg#define GEN8_3DSTATE_CLIP_length_bias          2
2374b8e80941Smrg#define GEN8_3DSTATE_CLIP_header                \
2375b8e80941Smrg   .DWordLength                         =      2,  \
2376b8e80941Smrg   ._3DCommandSubOpcode                 =     18,  \
2377b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2378b8e80941Smrg   .CommandSubType                      =      3,  \
2379b8e80941Smrg   .CommandType                         =      3
2380b8e80941Smrg
2381b8e80941Smrgstruct GEN8_3DSTATE_CLIP {
2382b8e80941Smrg   uint32_t                             DWordLength;
2383b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2384b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2385b8e80941Smrg   uint32_t                             CommandSubType;
2386b8e80941Smrg   uint32_t                             CommandType;
2387b8e80941Smrg   uint32_t                             UserClipDistanceCullTestEnableBitmask;
2388b8e80941Smrg   bool                                 StatisticsEnable;
2389b8e80941Smrg   bool                                 ForceClipMode;
2390b8e80941Smrg   bool                                 ForceUserClipDistanceClipTestEnableBitmask;
2391b8e80941Smrg   bool                                 EarlyCullEnable;
2392b8e80941Smrg   uint32_t                             VertexSubPixelPrecisionSelect;
2393b8e80941Smrg#define _8Bit                                    0
2394b8e80941Smrg#define _4Bit                                    1
2395b8e80941Smrg   bool                                 ForceUserClipDistanceCullTestEnableBitmask;
2396b8e80941Smrg   uint32_t                             TriangleFanProvokingVertexSelect;
2397b8e80941Smrg   uint32_t                             LineStripListProvokingVertexSelect;
2398b8e80941Smrg   uint32_t                             TriangleStripListProvokingVertexSelect;
2399b8e80941Smrg   bool                                 NonPerspectiveBarycentricEnable;
2400b8e80941Smrg   bool                                 PerspectiveDivideDisable;
2401b8e80941Smrg   uint32_t                             ClipMode;
2402b8e80941Smrg#define CLIPMODE_NORMAL                          0
2403b8e80941Smrg#define CLIPMODE_REJECT_ALL                      3
2404b8e80941Smrg#define CLIPMODE_ACCEPT_ALL                      4
2405b8e80941Smrg   uint32_t                             UserClipDistanceClipTestEnableBitmask;
2406b8e80941Smrg   bool                                 GuardbandClipTestEnable;
2407b8e80941Smrg   bool                                 ViewportXYClipTestEnable;
2408b8e80941Smrg   uint32_t                             APIMode;
2409b8e80941Smrg#define APIMODE_OGL                              0
2410b8e80941Smrg#define APIMODE_D3D                              1
2411b8e80941Smrg   bool                                 ClipEnable;
2412b8e80941Smrg   uint32_t                             MaximumVPIndex;
2413b8e80941Smrg   bool                                 ForceZeroRTAIndexEnable;
2414b8e80941Smrg   float                                MaximumPointWidth;
2415b8e80941Smrg   float                                MinimumPointWidth;
2416b8e80941Smrg};
2417b8e80941Smrg
2418b8e80941Smrgstatic inline void
2419b8e80941SmrgGEN8_3DSTATE_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
2420b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
2421b8e80941Smrg                       __attribute__((unused)) const struct GEN8_3DSTATE_CLIP * restrict values)
2422b8e80941Smrg{
2423b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2424b8e80941Smrg
2425b8e80941Smrg   dw[0] =
2426b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2427b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2428b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2429b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2430b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2431b8e80941Smrg
2432b8e80941Smrg   dw[1] =
2433b8e80941Smrg      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
2434b8e80941Smrg      __gen_uint(values->StatisticsEnable, 10, 10) |
2435b8e80941Smrg      __gen_uint(values->ForceClipMode, 16, 16) |
2436b8e80941Smrg      __gen_uint(values->ForceUserClipDistanceClipTestEnableBitmask, 17, 17) |
2437b8e80941Smrg      __gen_uint(values->EarlyCullEnable, 18, 18) |
2438b8e80941Smrg      __gen_uint(values->VertexSubPixelPrecisionSelect, 19, 19) |
2439b8e80941Smrg      __gen_uint(values->ForceUserClipDistanceCullTestEnableBitmask, 20, 20);
2440b8e80941Smrg
2441b8e80941Smrg   dw[2] =
2442b8e80941Smrg      __gen_uint(values->TriangleFanProvokingVertexSelect, 0, 1) |
2443b8e80941Smrg      __gen_uint(values->LineStripListProvokingVertexSelect, 2, 3) |
2444b8e80941Smrg      __gen_uint(values->TriangleStripListProvokingVertexSelect, 4, 5) |
2445b8e80941Smrg      __gen_uint(values->NonPerspectiveBarycentricEnable, 8, 8) |
2446b8e80941Smrg      __gen_uint(values->PerspectiveDivideDisable, 9, 9) |
2447b8e80941Smrg      __gen_uint(values->ClipMode, 13, 15) |
2448b8e80941Smrg      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 16, 23) |
2449b8e80941Smrg      __gen_uint(values->GuardbandClipTestEnable, 26, 26) |
2450b8e80941Smrg      __gen_uint(values->ViewportXYClipTestEnable, 28, 28) |
2451b8e80941Smrg      __gen_uint(values->APIMode, 30, 30) |
2452b8e80941Smrg      __gen_uint(values->ClipEnable, 31, 31);
2453b8e80941Smrg
2454b8e80941Smrg   dw[3] =
2455b8e80941Smrg      __gen_uint(values->MaximumVPIndex, 0, 3) |
2456b8e80941Smrg      __gen_uint(values->ForceZeroRTAIndexEnable, 5, 5) |
2457b8e80941Smrg      __gen_ufixed(values->MaximumPointWidth, 6, 16, 3) |
2458b8e80941Smrg      __gen_ufixed(values->MinimumPointWidth, 17, 27, 3);
2459b8e80941Smrg}
2460b8e80941Smrg
2461b8e80941Smrg#define GEN8_3DSTATE_CONSTANT_DS_length       11
2462b8e80941Smrg#define GEN8_3DSTATE_CONSTANT_DS_length_bias      2
2463b8e80941Smrg#define GEN8_3DSTATE_CONSTANT_DS_header         \
2464b8e80941Smrg   .DWordLength                         =      9,  \
2465b8e80941Smrg   ._3DCommandSubOpcode                 =     26,  \
2466b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2467b8e80941Smrg   .CommandSubType                      =      3,  \
2468b8e80941Smrg   .CommandType                         =      3
2469b8e80941Smrg
2470b8e80941Smrgstruct GEN8_3DSTATE_CONSTANT_DS {
2471b8e80941Smrg   uint32_t                             DWordLength;
2472b8e80941Smrg   uint32_t                             MOCS;
2473b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2474b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2475b8e80941Smrg   uint32_t                             CommandSubType;
2476b8e80941Smrg   uint32_t                             CommandType;
2477b8e80941Smrg   struct GEN8_3DSTATE_CONSTANT_BODY    ConstantBody;
2478b8e80941Smrg};
2479b8e80941Smrg
2480b8e80941Smrgstatic inline void
2481b8e80941SmrgGEN8_3DSTATE_CONSTANT_DS_pack(__attribute__((unused)) __gen_user_data *data,
2482b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
2483b8e80941Smrg                              __attribute__((unused)) const struct GEN8_3DSTATE_CONSTANT_DS * restrict values)
2484b8e80941Smrg{
2485b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2486b8e80941Smrg
2487b8e80941Smrg   dw[0] =
2488b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2489b8e80941Smrg      __gen_uint(values->MOCS, 8, 14) |
2490b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2491b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2492b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2493b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2494b8e80941Smrg
2495b8e80941Smrg   GEN8_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
2496b8e80941Smrg}
2497b8e80941Smrg
2498b8e80941Smrg#define GEN8_3DSTATE_CONSTANT_GS_length       11
2499b8e80941Smrg#define GEN8_3DSTATE_CONSTANT_GS_length_bias      2
2500b8e80941Smrg#define GEN8_3DSTATE_CONSTANT_GS_header         \
2501b8e80941Smrg   .DWordLength                         =      9,  \
2502b8e80941Smrg   ._3DCommandSubOpcode                 =     22,  \
2503b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2504b8e80941Smrg   .CommandSubType                      =      3,  \
2505b8e80941Smrg   .CommandType                         =      3
2506b8e80941Smrg
2507b8e80941Smrgstruct GEN8_3DSTATE_CONSTANT_GS {
2508b8e80941Smrg   uint32_t                             DWordLength;
2509b8e80941Smrg   uint32_t                             MOCS;
2510b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2511b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2512b8e80941Smrg   uint32_t                             CommandSubType;
2513b8e80941Smrg   uint32_t                             CommandType;
2514b8e80941Smrg   struct GEN8_3DSTATE_CONSTANT_BODY    ConstantBody;
2515b8e80941Smrg};
2516b8e80941Smrg
2517b8e80941Smrgstatic inline void
2518b8e80941SmrgGEN8_3DSTATE_CONSTANT_GS_pack(__attribute__((unused)) __gen_user_data *data,
2519b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
2520b8e80941Smrg                              __attribute__((unused)) const struct GEN8_3DSTATE_CONSTANT_GS * restrict values)
2521b8e80941Smrg{
2522b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2523b8e80941Smrg
2524b8e80941Smrg   dw[0] =
2525b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2526b8e80941Smrg      __gen_uint(values->MOCS, 8, 14) |
2527b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2528b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2529b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2530b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2531b8e80941Smrg
2532b8e80941Smrg   GEN8_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
2533b8e80941Smrg}
2534b8e80941Smrg
2535b8e80941Smrg#define GEN8_3DSTATE_CONSTANT_HS_length       11
2536b8e80941Smrg#define GEN8_3DSTATE_CONSTANT_HS_length_bias      2
2537b8e80941Smrg#define GEN8_3DSTATE_CONSTANT_HS_header         \
2538b8e80941Smrg   .DWordLength                         =      9,  \
2539b8e80941Smrg   ._3DCommandSubOpcode                 =     25,  \
2540b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2541b8e80941Smrg   .CommandSubType                      =      3,  \
2542b8e80941Smrg   .CommandType                         =      3
2543b8e80941Smrg
2544b8e80941Smrgstruct GEN8_3DSTATE_CONSTANT_HS {
2545b8e80941Smrg   uint32_t                             DWordLength;
2546b8e80941Smrg   uint32_t                             MOCS;
2547b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2548b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2549b8e80941Smrg   uint32_t                             CommandSubType;
2550b8e80941Smrg   uint32_t                             CommandType;
2551b8e80941Smrg   struct GEN8_3DSTATE_CONSTANT_BODY    ConstantBody;
2552b8e80941Smrg};
2553b8e80941Smrg
2554b8e80941Smrgstatic inline void
2555b8e80941SmrgGEN8_3DSTATE_CONSTANT_HS_pack(__attribute__((unused)) __gen_user_data *data,
2556b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
2557b8e80941Smrg                              __attribute__((unused)) const struct GEN8_3DSTATE_CONSTANT_HS * restrict values)
2558b8e80941Smrg{
2559b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2560b8e80941Smrg
2561b8e80941Smrg   dw[0] =
2562b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2563b8e80941Smrg      __gen_uint(values->MOCS, 8, 14) |
2564b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2565b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2566b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2567b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2568b8e80941Smrg
2569b8e80941Smrg   GEN8_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
2570b8e80941Smrg}
2571b8e80941Smrg
2572b8e80941Smrg#define GEN8_3DSTATE_CONSTANT_PS_length       11
2573b8e80941Smrg#define GEN8_3DSTATE_CONSTANT_PS_length_bias      2
2574b8e80941Smrg#define GEN8_3DSTATE_CONSTANT_PS_header         \
2575b8e80941Smrg   .DWordLength                         =      9,  \
2576b8e80941Smrg   ._3DCommandSubOpcode                 =     23,  \
2577b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2578b8e80941Smrg   .CommandSubType                      =      3,  \
2579b8e80941Smrg   .CommandType                         =      3
2580b8e80941Smrg
2581b8e80941Smrgstruct GEN8_3DSTATE_CONSTANT_PS {
2582b8e80941Smrg   uint32_t                             DWordLength;
2583b8e80941Smrg   uint32_t                             MOCS;
2584b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2585b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2586b8e80941Smrg   uint32_t                             CommandSubType;
2587b8e80941Smrg   uint32_t                             CommandType;
2588b8e80941Smrg   struct GEN8_3DSTATE_CONSTANT_BODY    ConstantBody;
2589b8e80941Smrg};
2590b8e80941Smrg
2591b8e80941Smrgstatic inline void
2592b8e80941SmrgGEN8_3DSTATE_CONSTANT_PS_pack(__attribute__((unused)) __gen_user_data *data,
2593b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
2594b8e80941Smrg                              __attribute__((unused)) const struct GEN8_3DSTATE_CONSTANT_PS * restrict values)
2595b8e80941Smrg{
2596b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2597b8e80941Smrg
2598b8e80941Smrg   dw[0] =
2599b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2600b8e80941Smrg      __gen_uint(values->MOCS, 8, 14) |
2601b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2602b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2603b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2604b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2605b8e80941Smrg
2606b8e80941Smrg   GEN8_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
2607b8e80941Smrg}
2608b8e80941Smrg
2609b8e80941Smrg#define GEN8_3DSTATE_CONSTANT_VS_length       11
2610b8e80941Smrg#define GEN8_3DSTATE_CONSTANT_VS_length_bias      2
2611b8e80941Smrg#define GEN8_3DSTATE_CONSTANT_VS_header         \
2612b8e80941Smrg   .DWordLength                         =      9,  \
2613b8e80941Smrg   ._3DCommandSubOpcode                 =     21,  \
2614b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2615b8e80941Smrg   .CommandSubType                      =      3,  \
2616b8e80941Smrg   .CommandType                         =      3
2617b8e80941Smrg
2618b8e80941Smrgstruct GEN8_3DSTATE_CONSTANT_VS {
2619b8e80941Smrg   uint32_t                             DWordLength;
2620b8e80941Smrg   uint32_t                             MOCS;
2621b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2622b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2623b8e80941Smrg   uint32_t                             CommandSubType;
2624b8e80941Smrg   uint32_t                             CommandType;
2625b8e80941Smrg   struct GEN8_3DSTATE_CONSTANT_BODY    ConstantBody;
2626b8e80941Smrg};
2627b8e80941Smrg
2628b8e80941Smrgstatic inline void
2629b8e80941SmrgGEN8_3DSTATE_CONSTANT_VS_pack(__attribute__((unused)) __gen_user_data *data,
2630b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
2631b8e80941Smrg                              __attribute__((unused)) const struct GEN8_3DSTATE_CONSTANT_VS * restrict values)
2632b8e80941Smrg{
2633b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2634b8e80941Smrg
2635b8e80941Smrg   dw[0] =
2636b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2637b8e80941Smrg      __gen_uint(values->MOCS, 8, 14) |
2638b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2639b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2640b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2641b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2642b8e80941Smrg
2643b8e80941Smrg   GEN8_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
2644b8e80941Smrg}
2645b8e80941Smrg
2646b8e80941Smrg#define GEN8_3DSTATE_DEPTH_BUFFER_length       8
2647b8e80941Smrg#define GEN8_3DSTATE_DEPTH_BUFFER_length_bias      2
2648b8e80941Smrg#define GEN8_3DSTATE_DEPTH_BUFFER_header        \
2649b8e80941Smrg   .DWordLength                         =      6,  \
2650b8e80941Smrg   ._3DCommandSubOpcode                 =      5,  \
2651b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2652b8e80941Smrg   .CommandSubType                      =      3,  \
2653b8e80941Smrg   .CommandType                         =      3
2654b8e80941Smrg
2655b8e80941Smrgstruct GEN8_3DSTATE_DEPTH_BUFFER {
2656b8e80941Smrg   uint32_t                             DWordLength;
2657b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2658b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2659b8e80941Smrg   uint32_t                             CommandSubType;
2660b8e80941Smrg   uint32_t                             CommandType;
2661b8e80941Smrg   uint32_t                             SurfacePitch;
2662b8e80941Smrg   uint32_t                             SurfaceFormat;
2663b8e80941Smrg#define D32_FLOAT                                1
2664b8e80941Smrg#define D24_UNORM_X8_UINT                        3
2665b8e80941Smrg#define D16_UNORM                                5
2666b8e80941Smrg   bool                                 HierarchicalDepthBufferEnable;
2667b8e80941Smrg   bool                                 StencilWriteEnable;
2668b8e80941Smrg   bool                                 DepthWriteEnable;
2669b8e80941Smrg   uint32_t                             SurfaceType;
2670b8e80941Smrg#define SURFTYPE_1D                              0
2671b8e80941Smrg#define SURFTYPE_2D                              1
2672b8e80941Smrg#define SURFTYPE_3D                              2
2673b8e80941Smrg#define SURFTYPE_CUBE                            3
2674b8e80941Smrg#define SURFTYPE_NULL                            7
2675b8e80941Smrg   __gen_address_type                   SurfaceBaseAddress;
2676b8e80941Smrg   uint32_t                             LOD;
2677b8e80941Smrg   uint32_t                             Width;
2678b8e80941Smrg   uint32_t                             Height;
2679b8e80941Smrg   uint32_t                             MOCS;
2680b8e80941Smrg   uint32_t                             MinimumArrayElement;
2681b8e80941Smrg   uint32_t                             Depth;
2682b8e80941Smrg   uint32_t                             SurfaceQPitch;
2683b8e80941Smrg   uint32_t                             RenderTargetViewExtent;
2684b8e80941Smrg};
2685b8e80941Smrg
2686b8e80941Smrgstatic inline void
2687b8e80941SmrgGEN8_3DSTATE_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
2688b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
2689b8e80941Smrg                               __attribute__((unused)) const struct GEN8_3DSTATE_DEPTH_BUFFER * restrict values)
2690b8e80941Smrg{
2691b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2692b8e80941Smrg
2693b8e80941Smrg   dw[0] =
2694b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2695b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2696b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2697b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2698b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2699b8e80941Smrg
2700b8e80941Smrg   dw[1] =
2701b8e80941Smrg      __gen_uint(values->SurfacePitch, 0, 17) |
2702b8e80941Smrg      __gen_uint(values->SurfaceFormat, 18, 20) |
2703b8e80941Smrg      __gen_uint(values->HierarchicalDepthBufferEnable, 22, 22) |
2704b8e80941Smrg      __gen_uint(values->StencilWriteEnable, 27, 27) |
2705b8e80941Smrg      __gen_uint(values->DepthWriteEnable, 28, 28) |
2706b8e80941Smrg      __gen_uint(values->SurfaceType, 29, 31);
2707b8e80941Smrg
2708b8e80941Smrg   const uint64_t v2_address =
2709b8e80941Smrg      __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
2710b8e80941Smrg   dw[2] = v2_address;
2711b8e80941Smrg   dw[3] = v2_address >> 32;
2712b8e80941Smrg
2713b8e80941Smrg   dw[4] =
2714b8e80941Smrg      __gen_uint(values->LOD, 0, 3) |
2715b8e80941Smrg      __gen_uint(values->Width, 4, 17) |
2716b8e80941Smrg      __gen_uint(values->Height, 18, 31);
2717b8e80941Smrg
2718b8e80941Smrg   dw[5] =
2719b8e80941Smrg      __gen_uint(values->MOCS, 0, 6) |
2720b8e80941Smrg      __gen_uint(values->MinimumArrayElement, 10, 20) |
2721b8e80941Smrg      __gen_uint(values->Depth, 21, 31);
2722b8e80941Smrg
2723b8e80941Smrg   dw[6] = 0;
2724b8e80941Smrg
2725b8e80941Smrg   dw[7] =
2726b8e80941Smrg      __gen_uint(values->SurfaceQPitch, 0, 14) |
2727b8e80941Smrg      __gen_uint(values->RenderTargetViewExtent, 21, 31);
2728b8e80941Smrg}
2729b8e80941Smrg
2730b8e80941Smrg#define GEN8_3DSTATE_DRAWING_RECTANGLE_length      4
2731b8e80941Smrg#define GEN8_3DSTATE_DRAWING_RECTANGLE_length_bias      2
2732b8e80941Smrg#define GEN8_3DSTATE_DRAWING_RECTANGLE_header   \
2733b8e80941Smrg   .DWordLength                         =      2,  \
2734b8e80941Smrg   ._3DCommandSubOpcode                 =      0,  \
2735b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
2736b8e80941Smrg   .CommandSubType                      =      3,  \
2737b8e80941Smrg   .CommandType                         =      3
2738b8e80941Smrg
2739b8e80941Smrgstruct GEN8_3DSTATE_DRAWING_RECTANGLE {
2740b8e80941Smrg   uint32_t                             DWordLength;
2741b8e80941Smrg   uint32_t                             CoreModeSelect;
2742b8e80941Smrg#define Legacy                                   0
2743b8e80941Smrg#define Core0Enabled                             1
2744b8e80941Smrg#define Core1Enabled                             2
2745b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2746b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2747b8e80941Smrg   uint32_t                             CommandSubType;
2748b8e80941Smrg   uint32_t                             CommandType;
2749b8e80941Smrg   uint32_t                             ClippedDrawingRectangleXMin;
2750b8e80941Smrg   uint32_t                             ClippedDrawingRectangleYMin;
2751b8e80941Smrg   uint32_t                             ClippedDrawingRectangleXMax;
2752b8e80941Smrg   uint32_t                             ClippedDrawingRectangleYMax;
2753b8e80941Smrg   int32_t                              DrawingRectangleOriginX;
2754b8e80941Smrg   int32_t                              DrawingRectangleOriginY;
2755b8e80941Smrg};
2756b8e80941Smrg
2757b8e80941Smrgstatic inline void
2758b8e80941SmrgGEN8_3DSTATE_DRAWING_RECTANGLE_pack(__attribute__((unused)) __gen_user_data *data,
2759b8e80941Smrg                                    __attribute__((unused)) void * restrict dst,
2760b8e80941Smrg                                    __attribute__((unused)) const struct GEN8_3DSTATE_DRAWING_RECTANGLE * restrict values)
2761b8e80941Smrg{
2762b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2763b8e80941Smrg
2764b8e80941Smrg   dw[0] =
2765b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2766b8e80941Smrg      __gen_uint(values->CoreModeSelect, 14, 15) |
2767b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2768b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2769b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2770b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2771b8e80941Smrg
2772b8e80941Smrg   dw[1] =
2773b8e80941Smrg      __gen_uint(values->ClippedDrawingRectangleXMin, 0, 15) |
2774b8e80941Smrg      __gen_uint(values->ClippedDrawingRectangleYMin, 16, 31);
2775b8e80941Smrg
2776b8e80941Smrg   dw[2] =
2777b8e80941Smrg      __gen_uint(values->ClippedDrawingRectangleXMax, 0, 15) |
2778b8e80941Smrg      __gen_uint(values->ClippedDrawingRectangleYMax, 16, 31);
2779b8e80941Smrg
2780b8e80941Smrg   dw[3] =
2781b8e80941Smrg      __gen_sint(values->DrawingRectangleOriginX, 0, 15) |
2782b8e80941Smrg      __gen_sint(values->DrawingRectangleOriginY, 16, 31);
2783b8e80941Smrg}
2784b8e80941Smrg
2785b8e80941Smrg#define GEN8_3DSTATE_DS_length                 9
2786b8e80941Smrg#define GEN8_3DSTATE_DS_length_bias            2
2787b8e80941Smrg#define GEN8_3DSTATE_DS_header                  \
2788b8e80941Smrg   .DWordLength                         =      7,  \
2789b8e80941Smrg   ._3DCommandSubOpcode                 =     29,  \
2790b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2791b8e80941Smrg   .CommandSubType                      =      3,  \
2792b8e80941Smrg   .CommandType                         =      3
2793b8e80941Smrg
2794b8e80941Smrgstruct GEN8_3DSTATE_DS {
2795b8e80941Smrg   uint32_t                             DWordLength;
2796b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2797b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2798b8e80941Smrg   uint32_t                             CommandSubType;
2799b8e80941Smrg   uint32_t                             CommandType;
2800b8e80941Smrg   uint64_t                             KernelStartPointer;
2801b8e80941Smrg   bool                                 SoftwareExceptionEnable;
2802b8e80941Smrg   bool                                 IllegalOpcodeExceptionEnable;
2803b8e80941Smrg   bool                                 AccessesUAV;
2804b8e80941Smrg   uint32_t                             FloatingPointMode;
2805b8e80941Smrg#define IEEE754                                  0
2806b8e80941Smrg#define Alternate                                1
2807b8e80941Smrg   uint32_t                             ThreadDispatchPriority;
2808b8e80941Smrg#define High                                     1
2809b8e80941Smrg   uint32_t                             BindingTableEntryCount;
2810b8e80941Smrg   uint32_t                             SamplerCount;
2811b8e80941Smrg#define NoSamplers                               0
2812b8e80941Smrg#define _14Samplers                              1
2813b8e80941Smrg#define _58Samplers                              2
2814b8e80941Smrg#define _912Samplers                             3
2815b8e80941Smrg#define _1316Samplers                            4
2816b8e80941Smrg   bool                                 VectorMaskEnable;
2817b8e80941Smrg   uint32_t                             SingleDomainPointDispatch;
2818b8e80941Smrg   uint32_t                             PerThreadScratchSpace;
2819b8e80941Smrg   __gen_address_type                   ScratchSpaceBasePointer;
2820b8e80941Smrg   uint32_t                             PatchURBEntryReadOffset;
2821b8e80941Smrg   uint32_t                             PatchURBEntryReadLength;
2822b8e80941Smrg   uint32_t                             DispatchGRFStartRegisterForURBData;
2823b8e80941Smrg   bool                                 Enable;
2824b8e80941Smrg   bool                                 CacheDisable;
2825b8e80941Smrg   bool                                 ComputeWCoordinateEnable;
2826b8e80941Smrg   uint32_t                             DispatchMode;
2827b8e80941Smrg#define DISPATCH_MODE_SIMD4X2                    0
2828b8e80941Smrg#define DISPATCH_MODE_SIMD8_SINGLE_PATCH         1
2829b8e80941Smrg   bool                                 StatisticsEnable;
2830b8e80941Smrg   uint32_t                             MaximumNumberofThreads;
2831b8e80941Smrg   uint32_t                             UserClipDistanceCullTestEnableBitmask;
2832b8e80941Smrg   uint32_t                             UserClipDistanceClipTestEnableBitmask;
2833b8e80941Smrg   uint32_t                             VertexURBEntryOutputLength;
2834b8e80941Smrg   uint32_t                             VertexURBEntryOutputReadOffset;
2835b8e80941Smrg};
2836b8e80941Smrg
2837b8e80941Smrgstatic inline void
2838b8e80941SmrgGEN8_3DSTATE_DS_pack(__attribute__((unused)) __gen_user_data *data,
2839b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
2840b8e80941Smrg                     __attribute__((unused)) const struct GEN8_3DSTATE_DS * restrict values)
2841b8e80941Smrg{
2842b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2843b8e80941Smrg
2844b8e80941Smrg   dw[0] =
2845b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2846b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2847b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2848b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2849b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2850b8e80941Smrg
2851b8e80941Smrg   const uint64_t v1 =
2852b8e80941Smrg      __gen_offset(values->KernelStartPointer, 6, 63);
2853b8e80941Smrg   dw[1] = v1;
2854b8e80941Smrg   dw[2] = v1 >> 32;
2855b8e80941Smrg
2856b8e80941Smrg   dw[3] =
2857b8e80941Smrg      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
2858b8e80941Smrg      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
2859b8e80941Smrg      __gen_uint(values->AccessesUAV, 14, 14) |
2860b8e80941Smrg      __gen_uint(values->FloatingPointMode, 16, 16) |
2861b8e80941Smrg      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
2862b8e80941Smrg      __gen_uint(values->BindingTableEntryCount, 18, 25) |
2863b8e80941Smrg      __gen_uint(values->SamplerCount, 27, 29) |
2864b8e80941Smrg      __gen_uint(values->VectorMaskEnable, 30, 30) |
2865b8e80941Smrg      __gen_uint(values->SingleDomainPointDispatch, 31, 31);
2866b8e80941Smrg
2867b8e80941Smrg   const uint64_t v4 =
2868b8e80941Smrg      __gen_uint(values->PerThreadScratchSpace, 0, 3);
2869b8e80941Smrg   const uint64_t v4_address =
2870b8e80941Smrg      __gen_combine_address(data, &dw[4], values->ScratchSpaceBasePointer, v4);
2871b8e80941Smrg   dw[4] = v4_address;
2872b8e80941Smrg   dw[5] = (v4_address >> 32) | (v4 >> 32);
2873b8e80941Smrg
2874b8e80941Smrg   dw[6] =
2875b8e80941Smrg      __gen_uint(values->PatchURBEntryReadOffset, 4, 9) |
2876b8e80941Smrg      __gen_uint(values->PatchURBEntryReadLength, 11, 17) |
2877b8e80941Smrg      __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
2878b8e80941Smrg
2879b8e80941Smrg   dw[7] =
2880b8e80941Smrg      __gen_uint(values->Enable, 0, 0) |
2881b8e80941Smrg      __gen_uint(values->CacheDisable, 1, 1) |
2882b8e80941Smrg      __gen_uint(values->ComputeWCoordinateEnable, 2, 2) |
2883b8e80941Smrg      __gen_uint(values->DispatchMode, 3, 3) |
2884b8e80941Smrg      __gen_uint(values->StatisticsEnable, 10, 10) |
2885b8e80941Smrg      __gen_uint(values->MaximumNumberofThreads, 21, 29);
2886b8e80941Smrg
2887b8e80941Smrg   dw[8] =
2888b8e80941Smrg      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
2889b8e80941Smrg      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 8, 15) |
2890b8e80941Smrg      __gen_uint(values->VertexURBEntryOutputLength, 16, 20) |
2891b8e80941Smrg      __gen_uint(values->VertexURBEntryOutputReadOffset, 21, 26);
2892b8e80941Smrg}
2893b8e80941Smrg
2894b8e80941Smrg#define GEN8_3DSTATE_GATHER_CONSTANT_DS_length_bias      2
2895b8e80941Smrg#define GEN8_3DSTATE_GATHER_CONSTANT_DS_header  \
2896b8e80941Smrg   .DWordLength                         =      1,  \
2897b8e80941Smrg   ._3DCommandSubOpcode                 =     55,  \
2898b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2899b8e80941Smrg   .CommandSubType                      =      3,  \
2900b8e80941Smrg   .CommandType                         =      3
2901b8e80941Smrg
2902b8e80941Smrgstruct GEN8_3DSTATE_GATHER_CONSTANT_DS {
2903b8e80941Smrg   uint32_t                             DWordLength;
2904b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2905b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2906b8e80941Smrg   uint32_t                             CommandSubType;
2907b8e80941Smrg   uint32_t                             CommandType;
2908b8e80941Smrg   uint32_t                             ConstantBufferBindingTableBlock;
2909b8e80941Smrg   uint32_t                             ConstantBufferValid;
2910b8e80941Smrg   bool                                 ConstantBufferDx9GenerateStall;
2911b8e80941Smrg   uint64_t                             GatherBufferOffset;
2912b8e80941Smrg   /* variable length fields follow */
2913b8e80941Smrg};
2914b8e80941Smrg
2915b8e80941Smrgstatic inline void
2916b8e80941SmrgGEN8_3DSTATE_GATHER_CONSTANT_DS_pack(__attribute__((unused)) __gen_user_data *data,
2917b8e80941Smrg                                     __attribute__((unused)) void * restrict dst,
2918b8e80941Smrg                                     __attribute__((unused)) const struct GEN8_3DSTATE_GATHER_CONSTANT_DS * restrict values)
2919b8e80941Smrg{
2920b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2921b8e80941Smrg
2922b8e80941Smrg   dw[0] =
2923b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2924b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2925b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2926b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2927b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2928b8e80941Smrg
2929b8e80941Smrg   dw[1] =
2930b8e80941Smrg      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
2931b8e80941Smrg      __gen_uint(values->ConstantBufferValid, 16, 31);
2932b8e80941Smrg
2933b8e80941Smrg   dw[2] =
2934b8e80941Smrg      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
2935b8e80941Smrg      __gen_offset(values->GatherBufferOffset, 6, 22);
2936b8e80941Smrg}
2937b8e80941Smrg
2938b8e80941Smrg#define GEN8_3DSTATE_GATHER_CONSTANT_GS_length_bias      2
2939b8e80941Smrg#define GEN8_3DSTATE_GATHER_CONSTANT_GS_header  \
2940b8e80941Smrg   .DWordLength                         =      1,  \
2941b8e80941Smrg   ._3DCommandSubOpcode                 =     53,  \
2942b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2943b8e80941Smrg   .CommandSubType                      =      3,  \
2944b8e80941Smrg   .CommandType                         =      3
2945b8e80941Smrg
2946b8e80941Smrgstruct GEN8_3DSTATE_GATHER_CONSTANT_GS {
2947b8e80941Smrg   uint32_t                             DWordLength;
2948b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2949b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2950b8e80941Smrg   uint32_t                             CommandSubType;
2951b8e80941Smrg   uint32_t                             CommandType;
2952b8e80941Smrg   uint32_t                             ConstantBufferBindingTableBlock;
2953b8e80941Smrg   uint32_t                             ConstantBufferValid;
2954b8e80941Smrg   bool                                 ConstantBufferDx9GenerateStall;
2955b8e80941Smrg   uint64_t                             GatherBufferOffset;
2956b8e80941Smrg   /* variable length fields follow */
2957b8e80941Smrg};
2958b8e80941Smrg
2959b8e80941Smrgstatic inline void
2960b8e80941SmrgGEN8_3DSTATE_GATHER_CONSTANT_GS_pack(__attribute__((unused)) __gen_user_data *data,
2961b8e80941Smrg                                     __attribute__((unused)) void * restrict dst,
2962b8e80941Smrg                                     __attribute__((unused)) const struct GEN8_3DSTATE_GATHER_CONSTANT_GS * restrict values)
2963b8e80941Smrg{
2964b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2965b8e80941Smrg
2966b8e80941Smrg   dw[0] =
2967b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2968b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2969b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2970b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2971b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2972b8e80941Smrg
2973b8e80941Smrg   dw[1] =
2974b8e80941Smrg      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
2975b8e80941Smrg      __gen_uint(values->ConstantBufferValid, 16, 31);
2976b8e80941Smrg
2977b8e80941Smrg   dw[2] =
2978b8e80941Smrg      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
2979b8e80941Smrg      __gen_offset(values->GatherBufferOffset, 6, 22);
2980b8e80941Smrg}
2981b8e80941Smrg
2982b8e80941Smrg#define GEN8_3DSTATE_GATHER_CONSTANT_HS_length_bias      2
2983b8e80941Smrg#define GEN8_3DSTATE_GATHER_CONSTANT_HS_header  \
2984b8e80941Smrg   .DWordLength                         =      1,  \
2985b8e80941Smrg   ._3DCommandSubOpcode                 =     54,  \
2986b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2987b8e80941Smrg   .CommandSubType                      =      3,  \
2988b8e80941Smrg   .CommandType                         =      3
2989b8e80941Smrg
2990b8e80941Smrgstruct GEN8_3DSTATE_GATHER_CONSTANT_HS {
2991b8e80941Smrg   uint32_t                             DWordLength;
2992b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2993b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2994b8e80941Smrg   uint32_t                             CommandSubType;
2995b8e80941Smrg   uint32_t                             CommandType;
2996b8e80941Smrg   uint32_t                             ConstantBufferBindingTableBlock;
2997b8e80941Smrg   uint32_t                             ConstantBufferValid;
2998b8e80941Smrg   bool                                 ConstantBufferDx9GenerateStall;
2999b8e80941Smrg   uint64_t                             GatherBufferOffset;
3000b8e80941Smrg   /* variable length fields follow */
3001b8e80941Smrg};
3002b8e80941Smrg
3003b8e80941Smrgstatic inline void
3004b8e80941SmrgGEN8_3DSTATE_GATHER_CONSTANT_HS_pack(__attribute__((unused)) __gen_user_data *data,
3005b8e80941Smrg                                     __attribute__((unused)) void * restrict dst,
3006b8e80941Smrg                                     __attribute__((unused)) const struct GEN8_3DSTATE_GATHER_CONSTANT_HS * restrict values)
3007b8e80941Smrg{
3008b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3009b8e80941Smrg
3010b8e80941Smrg   dw[0] =
3011b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3012b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3013b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3014b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3015b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3016b8e80941Smrg
3017b8e80941Smrg   dw[1] =
3018b8e80941Smrg      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
3019b8e80941Smrg      __gen_uint(values->ConstantBufferValid, 16, 31);
3020b8e80941Smrg
3021b8e80941Smrg   dw[2] =
3022b8e80941Smrg      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
3023b8e80941Smrg      __gen_offset(values->GatherBufferOffset, 6, 22);
3024b8e80941Smrg}
3025b8e80941Smrg
3026b8e80941Smrg#define GEN8_3DSTATE_GATHER_CONSTANT_PS_length_bias      2
3027b8e80941Smrg#define GEN8_3DSTATE_GATHER_CONSTANT_PS_header  \
3028b8e80941Smrg   .DWordLength                         =      1,  \
3029b8e80941Smrg   ._3DCommandSubOpcode                 =     56,  \
3030b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
3031b8e80941Smrg   .CommandSubType                      =      3,  \
3032b8e80941Smrg   .CommandType                         =      3
3033b8e80941Smrg
3034b8e80941Smrgstruct GEN8_3DSTATE_GATHER_CONSTANT_PS {
3035b8e80941Smrg   uint32_t                             DWordLength;
3036b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3037b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3038b8e80941Smrg   uint32_t                             CommandSubType;
3039b8e80941Smrg   uint32_t                             CommandType;
3040b8e80941Smrg   uint32_t                             ConstantBufferBindingTableBlock;
3041b8e80941Smrg   uint32_t                             ConstantBufferValid;
3042b8e80941Smrg   bool                                 ConstantBufferDx9Enable;
3043b8e80941Smrg   bool                                 ConstantBufferDx9GenerateStall;
3044b8e80941Smrg   uint64_t                             GatherBufferOffset;
3045b8e80941Smrg   /* variable length fields follow */
3046b8e80941Smrg};
3047b8e80941Smrg
3048b8e80941Smrgstatic inline void
3049b8e80941SmrgGEN8_3DSTATE_GATHER_CONSTANT_PS_pack(__attribute__((unused)) __gen_user_data *data,
3050b8e80941Smrg                                     __attribute__((unused)) void * restrict dst,
3051b8e80941Smrg                                     __attribute__((unused)) const struct GEN8_3DSTATE_GATHER_CONSTANT_PS * restrict values)
3052b8e80941Smrg{
3053b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3054b8e80941Smrg
3055b8e80941Smrg   dw[0] =
3056b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3057b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3058b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3059b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3060b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3061b8e80941Smrg
3062b8e80941Smrg   dw[1] =
3063b8e80941Smrg      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
3064b8e80941Smrg      __gen_uint(values->ConstantBufferValid, 16, 31);
3065b8e80941Smrg
3066b8e80941Smrg   dw[2] =
3067b8e80941Smrg      __gen_uint(values->ConstantBufferDx9Enable, 4, 4) |
3068b8e80941Smrg      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
3069b8e80941Smrg      __gen_offset(values->GatherBufferOffset, 6, 22);
3070b8e80941Smrg}
3071b8e80941Smrg
3072b8e80941Smrg#define GEN8_3DSTATE_GATHER_CONSTANT_VS_length_bias      2
3073b8e80941Smrg#define GEN8_3DSTATE_GATHER_CONSTANT_VS_header  \
3074b8e80941Smrg   .DWordLength                         =      0,  \
3075b8e80941Smrg   ._3DCommandSubOpcode                 =     52,  \
3076b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
3077b8e80941Smrg   .CommandSubType                      =      3,  \
3078b8e80941Smrg   .CommandType                         =      3
3079b8e80941Smrg
3080b8e80941Smrgstruct GEN8_3DSTATE_GATHER_CONSTANT_VS {
3081b8e80941Smrg   uint32_t                             DWordLength;
3082b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3083b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3084b8e80941Smrg   uint32_t                             CommandSubType;
3085b8e80941Smrg   uint32_t                             CommandType;
3086b8e80941Smrg   uint32_t                             ConstantBufferBindingTableBlock;
3087b8e80941Smrg   uint32_t                             ConstantBufferValid;
3088b8e80941Smrg   bool                                 ConstantBufferDx9Enable;
3089b8e80941Smrg   bool                                 ConstantBufferDx9GenerateStall;
3090b8e80941Smrg   uint64_t                             GatherBufferOffset;
3091b8e80941Smrg   /* variable length fields follow */
3092b8e80941Smrg};
3093b8e80941Smrg
3094b8e80941Smrgstatic inline void
3095b8e80941SmrgGEN8_3DSTATE_GATHER_CONSTANT_VS_pack(__attribute__((unused)) __gen_user_data *data,
3096b8e80941Smrg                                     __attribute__((unused)) void * restrict dst,
3097b8e80941Smrg                                     __attribute__((unused)) const struct GEN8_3DSTATE_GATHER_CONSTANT_VS * restrict values)
3098b8e80941Smrg{
3099b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3100b8e80941Smrg
3101b8e80941Smrg   dw[0] =
3102b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3103b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3104b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3105b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3106b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3107b8e80941Smrg
3108b8e80941Smrg   dw[1] =
3109b8e80941Smrg      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
3110b8e80941Smrg      __gen_uint(values->ConstantBufferValid, 16, 31);
3111b8e80941Smrg
3112b8e80941Smrg   dw[2] =
3113b8e80941Smrg      __gen_uint(values->ConstantBufferDx9Enable, 4, 4) |
3114b8e80941Smrg      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
3115b8e80941Smrg      __gen_offset(values->GatherBufferOffset, 6, 22);
3116b8e80941Smrg}
3117b8e80941Smrg
3118b8e80941Smrg#define GEN8_3DSTATE_GATHER_POOL_ALLOC_length      4
3119b8e80941Smrg#define GEN8_3DSTATE_GATHER_POOL_ALLOC_length_bias      2
3120b8e80941Smrg#define GEN8_3DSTATE_GATHER_POOL_ALLOC_header   \
3121b8e80941Smrg   .DWordLength                         =      2,  \
3122b8e80941Smrg   ._3DCommandSubOpcode                 =     26,  \
3123b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
3124b8e80941Smrg   .CommandSubType                      =      3,  \
3125b8e80941Smrg   .CommandType                         =      3
3126b8e80941Smrg
3127b8e80941Smrgstruct GEN8_3DSTATE_GATHER_POOL_ALLOC {
3128b8e80941Smrg   uint32_t                             DWordLength;
3129b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3130b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3131b8e80941Smrg   uint32_t                             CommandSubType;
3132b8e80941Smrg   uint32_t                             CommandType;
3133b8e80941Smrg   uint32_t                             MOCS;
3134b8e80941Smrg   bool                                 GatherPoolEnable;
3135b8e80941Smrg   __gen_address_type                   GatherPoolBaseAddress;
3136b8e80941Smrg   uint32_t                             GatherPoolBufferSize;
3137b8e80941Smrg};
3138b8e80941Smrg
3139b8e80941Smrgstatic inline void
3140b8e80941SmrgGEN8_3DSTATE_GATHER_POOL_ALLOC_pack(__attribute__((unused)) __gen_user_data *data,
3141b8e80941Smrg                                    __attribute__((unused)) void * restrict dst,
3142b8e80941Smrg                                    __attribute__((unused)) const struct GEN8_3DSTATE_GATHER_POOL_ALLOC * restrict values)
3143b8e80941Smrg{
3144b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3145b8e80941Smrg
3146b8e80941Smrg   dw[0] =
3147b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3148b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3149b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3150b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3151b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3152b8e80941Smrg
3153b8e80941Smrg   const uint64_t v1 =
3154b8e80941Smrg      __gen_uint(values->MOCS, 0, 6) |
3155b8e80941Smrg      __gen_uint(values->GatherPoolEnable, 11, 11);
3156b8e80941Smrg   const uint64_t v1_address =
3157b8e80941Smrg      __gen_combine_address(data, &dw[1], values->GatherPoolBaseAddress, v1);
3158b8e80941Smrg   dw[1] = v1_address;
3159b8e80941Smrg   dw[2] = (v1_address >> 32) | (v1 >> 32);
3160b8e80941Smrg
3161b8e80941Smrg   dw[3] =
3162b8e80941Smrg      __gen_uint(values->GatherPoolBufferSize, 12, 31);
3163b8e80941Smrg}
3164b8e80941Smrg
3165b8e80941Smrg#define GEN8_3DSTATE_GS_length                10
3166b8e80941Smrg#define GEN8_3DSTATE_GS_length_bias            2
3167b8e80941Smrg#define GEN8_3DSTATE_GS_header                  \
3168b8e80941Smrg   .DWordLength                         =      8,  \
3169b8e80941Smrg   ._3DCommandSubOpcode                 =     17,  \
3170b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
3171b8e80941Smrg   .CommandSubType                      =      3,  \
3172b8e80941Smrg   .CommandType                         =      3
3173b8e80941Smrg
3174b8e80941Smrgstruct GEN8_3DSTATE_GS {
3175b8e80941Smrg   uint32_t                             DWordLength;
3176b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3177b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3178b8e80941Smrg   uint32_t                             CommandSubType;
3179b8e80941Smrg   uint32_t                             CommandType;
3180b8e80941Smrg   uint64_t                             KernelStartPointer;
3181b8e80941Smrg   uint32_t                             ExpectedVertexCount;
3182b8e80941Smrg   bool                                 SoftwareExceptionEnable;
3183b8e80941Smrg   bool                                 MaskStackExceptionEnable;
3184b8e80941Smrg   bool                                 AccessesUAV;
3185b8e80941Smrg   bool                                 IllegalOpcodeExceptionEnable;
3186b8e80941Smrg   uint32_t                             FloatingPointMode;
3187b8e80941Smrg#define IEEE754                                  0
3188b8e80941Smrg#define Alternate                                1
3189b8e80941Smrg   uint32_t                             ThreadDispatchPriority;
3190b8e80941Smrg#define High                                     1
3191b8e80941Smrg   uint32_t                             BindingTableEntryCount;
3192b8e80941Smrg   uint32_t                             SamplerCount;
3193b8e80941Smrg#define NoSamplers                               0
3194b8e80941Smrg#define _14Samplers                              1
3195b8e80941Smrg#define _58Samplers                              2
3196b8e80941Smrg#define _912Samplers                             3
3197b8e80941Smrg#define _1316Samplers                            4
3198b8e80941Smrg   bool                                 VectorMaskEnable;
3199b8e80941Smrg   bool                                 SingleProgramFlow;
3200b8e80941Smrg   uint32_t                             PerThreadScratchSpace;
3201b8e80941Smrg   __gen_address_type                   ScratchSpaceBasePointer;
3202b8e80941Smrg   uint32_t                             DispatchGRFStartRegisterForURBData;
3203b8e80941Smrg   uint32_t                             VertexURBEntryReadOffset;
3204b8e80941Smrg   bool                                 IncludeVertexHandles;
3205b8e80941Smrg   uint32_t                             VertexURBEntryReadLength;
3206b8e80941Smrg   enum GEN8_3D_Prim_Topo_Type          OutputTopology;
3207b8e80941Smrg   uint32_t                             OutputVertexSize;
3208b8e80941Smrg   bool                                 Enable;
3209b8e80941Smrg   bool                                 DiscardAdjacency;
3210b8e80941Smrg   uint32_t                             ReorderMode;
3211b8e80941Smrg#define LEADING                                  0
3212b8e80941Smrg#define TRAILING                                 1
3213b8e80941Smrg   uint32_t                             Hint;
3214b8e80941Smrg   bool                                 IncludePrimitiveID;
3215b8e80941Smrg   uint32_t                             InvocationsIncrementValue;
3216b8e80941Smrg   bool                                 StatisticsEnable;
3217b8e80941Smrg   uint32_t                             DispatchMode;
3218b8e80941Smrg#define DISPATCH_MODE_DualInstance               1
3219b8e80941Smrg#define DISPATCH_MODE_DualObject                 2
3220b8e80941Smrg#define DISPATCH_MODE_SIMD8                      3
3221b8e80941Smrg   uint32_t                             DefaultStreamId;
3222b8e80941Smrg   uint32_t                             InstanceControl;
3223b8e80941Smrg   uint32_t                             ControlDataHeaderSize;
3224b8e80941Smrg   uint32_t                             MaximumNumberofThreads;
3225b8e80941Smrg   uint32_t                             StaticOutputVertexCount;
3226b8e80941Smrg   bool                                 StaticOutput;
3227b8e80941Smrg   uint32_t                             ControlDataFormat;
3228b8e80941Smrg#define CUT                                      0
3229b8e80941Smrg#define SID                                      1
3230b8e80941Smrg   uint32_t                             UserClipDistanceCullTestEnableBitmask;
3231b8e80941Smrg   uint32_t                             UserClipDistanceClipTestEnableBitmask;
3232b8e80941Smrg   uint32_t                             VertexURBEntryOutputLength;
3233b8e80941Smrg   uint32_t                             VertexURBEntryOutputReadOffset;
3234b8e80941Smrg};
3235b8e80941Smrg
3236b8e80941Smrgstatic inline void
3237b8e80941SmrgGEN8_3DSTATE_GS_pack(__attribute__((unused)) __gen_user_data *data,
3238b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
3239b8e80941Smrg                     __attribute__((unused)) const struct GEN8_3DSTATE_GS * restrict values)
3240b8e80941Smrg{
3241b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3242b8e80941Smrg
3243b8e80941Smrg   dw[0] =
3244b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3245b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3246b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3247b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3248b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3249b8e80941Smrg
3250b8e80941Smrg   const uint64_t v1 =
3251b8e80941Smrg      __gen_offset(values->KernelStartPointer, 6, 63);
3252b8e80941Smrg   dw[1] = v1;
3253b8e80941Smrg   dw[2] = v1 >> 32;
3254b8e80941Smrg
3255b8e80941Smrg   dw[3] =
3256b8e80941Smrg      __gen_uint(values->ExpectedVertexCount, 0, 5) |
3257b8e80941Smrg      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
3258b8e80941Smrg      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
3259b8e80941Smrg      __gen_uint(values->AccessesUAV, 12, 12) |
3260b8e80941Smrg      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
3261b8e80941Smrg      __gen_uint(values->FloatingPointMode, 16, 16) |
3262b8e80941Smrg      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
3263b8e80941Smrg      __gen_uint(values->BindingTableEntryCount, 18, 25) |
3264b8e80941Smrg      __gen_uint(values->SamplerCount, 27, 29) |
3265b8e80941Smrg      __gen_uint(values->VectorMaskEnable, 30, 30) |
3266b8e80941Smrg      __gen_uint(values->SingleProgramFlow, 31, 31);
3267b8e80941Smrg
3268b8e80941Smrg   const uint64_t v4 =
3269b8e80941Smrg      __gen_uint(values->PerThreadScratchSpace, 0, 3);
3270b8e80941Smrg   const uint64_t v4_address =
3271b8e80941Smrg      __gen_combine_address(data, &dw[4], values->ScratchSpaceBasePointer, v4);
3272b8e80941Smrg   dw[4] = v4_address;
3273b8e80941Smrg   dw[5] = (v4_address >> 32) | (v4 >> 32);
3274b8e80941Smrg
3275b8e80941Smrg   dw[6] =
3276b8e80941Smrg      __gen_uint(values->DispatchGRFStartRegisterForURBData, 0, 3) |
3277b8e80941Smrg      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
3278b8e80941Smrg      __gen_uint(values->IncludeVertexHandles, 10, 10) |
3279b8e80941Smrg      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
3280b8e80941Smrg      __gen_uint(values->OutputTopology, 17, 22) |
3281b8e80941Smrg      __gen_uint(values->OutputVertexSize, 23, 28);
3282b8e80941Smrg
3283b8e80941Smrg   dw[7] =
3284b8e80941Smrg      __gen_uint(values->Enable, 0, 0) |
3285b8e80941Smrg      __gen_uint(values->DiscardAdjacency, 1, 1) |
3286b8e80941Smrg      __gen_uint(values->ReorderMode, 2, 2) |
3287b8e80941Smrg      __gen_uint(values->Hint, 3, 3) |
3288b8e80941Smrg      __gen_uint(values->IncludePrimitiveID, 4, 4) |
3289b8e80941Smrg      __gen_uint(values->InvocationsIncrementValue, 5, 9) |
3290b8e80941Smrg      __gen_uint(values->StatisticsEnable, 10, 10) |
3291b8e80941Smrg      __gen_uint(values->DispatchMode, 11, 12) |
3292b8e80941Smrg      __gen_uint(values->DefaultStreamId, 13, 14) |
3293b8e80941Smrg      __gen_uint(values->InstanceControl, 15, 19) |
3294b8e80941Smrg      __gen_uint(values->ControlDataHeaderSize, 20, 23) |
3295b8e80941Smrg      __gen_uint(values->MaximumNumberofThreads, 24, 31);
3296b8e80941Smrg
3297b8e80941Smrg   dw[8] =
3298b8e80941Smrg      __gen_uint(values->StaticOutputVertexCount, 16, 26) |
3299b8e80941Smrg      __gen_uint(values->StaticOutput, 30, 30) |
3300b8e80941Smrg      __gen_uint(values->ControlDataFormat, 31, 31);
3301b8e80941Smrg
3302b8e80941Smrg   dw[9] =
3303b8e80941Smrg      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
3304b8e80941Smrg      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 8, 15) |
3305b8e80941Smrg      __gen_uint(values->VertexURBEntryOutputLength, 16, 20) |
3306b8e80941Smrg      __gen_uint(values->VertexURBEntryOutputReadOffset, 21, 26);
3307b8e80941Smrg}
3308b8e80941Smrg
3309b8e80941Smrg#define GEN8_3DSTATE_HIER_DEPTH_BUFFER_length      5
3310b8e80941Smrg#define GEN8_3DSTATE_HIER_DEPTH_BUFFER_length_bias      2
3311b8e80941Smrg#define GEN8_3DSTATE_HIER_DEPTH_BUFFER_header   \
3312b8e80941Smrg   .DWordLength                         =      3,  \
3313b8e80941Smrg   ._3DCommandSubOpcode                 =      7,  \
3314b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
3315b8e80941Smrg   .CommandSubType                      =      3,  \
3316b8e80941Smrg   .CommandType                         =      3
3317b8e80941Smrg
3318b8e80941Smrgstruct GEN8_3DSTATE_HIER_DEPTH_BUFFER {
3319b8e80941Smrg   uint32_t                             DWordLength;
3320b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3321b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3322b8e80941Smrg   uint32_t                             CommandSubType;
3323b8e80941Smrg   uint32_t                             CommandType;
3324b8e80941Smrg   uint32_t                             SurfacePitch;
3325b8e80941Smrg   uint32_t                             MOCS;
3326b8e80941Smrg   __gen_address_type                   SurfaceBaseAddress;
3327b8e80941Smrg   uint32_t                             SurfaceQPitch;
3328b8e80941Smrg};
3329b8e80941Smrg
3330b8e80941Smrgstatic inline void
3331b8e80941SmrgGEN8_3DSTATE_HIER_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
3332b8e80941Smrg                                    __attribute__((unused)) void * restrict dst,
3333b8e80941Smrg                                    __attribute__((unused)) const struct GEN8_3DSTATE_HIER_DEPTH_BUFFER * restrict values)
3334b8e80941Smrg{
3335b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3336b8e80941Smrg
3337b8e80941Smrg   dw[0] =
3338b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3339b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3340b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3341b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3342b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3343b8e80941Smrg
3344b8e80941Smrg   dw[1] =
3345b8e80941Smrg      __gen_uint(values->SurfacePitch, 0, 16) |
3346b8e80941Smrg      __gen_uint(values->MOCS, 25, 31);
3347b8e80941Smrg
3348b8e80941Smrg   const uint64_t v2_address =
3349b8e80941Smrg      __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
3350b8e80941Smrg   dw[2] = v2_address;
3351b8e80941Smrg   dw[3] = v2_address >> 32;
3352b8e80941Smrg
3353b8e80941Smrg   dw[4] =
3354b8e80941Smrg      __gen_uint(values->SurfaceQPitch, 0, 14);
3355b8e80941Smrg}
3356b8e80941Smrg
3357b8e80941Smrg#define GEN8_3DSTATE_HS_length                 9
3358b8e80941Smrg#define GEN8_3DSTATE_HS_length_bias            2
3359b8e80941Smrg#define GEN8_3DSTATE_HS_header                  \
3360b8e80941Smrg   .DWordLength                         =      7,  \
3361b8e80941Smrg   ._3DCommandSubOpcode                 =     27,  \
3362b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
3363b8e80941Smrg   .CommandSubType                      =      3,  \
3364b8e80941Smrg   .CommandType                         =      3
3365b8e80941Smrg
3366b8e80941Smrgstruct GEN8_3DSTATE_HS {
3367b8e80941Smrg   uint32_t                             DWordLength;
3368b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3369b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3370b8e80941Smrg   uint32_t                             CommandSubType;
3371b8e80941Smrg   uint32_t                             CommandType;
3372b8e80941Smrg   bool                                 SoftwareExceptionEnable;
3373b8e80941Smrg   bool                                 IllegalOpcodeExceptionEnable;
3374b8e80941Smrg   uint32_t                             FloatingPointMode;
3375b8e80941Smrg#define IEEE754                                  0
3376b8e80941Smrg#define alternate                                1
3377b8e80941Smrg   uint32_t                             ThreadDispatchPriority;
3378b8e80941Smrg#define High                                     1
3379b8e80941Smrg   uint32_t                             BindingTableEntryCount;
3380b8e80941Smrg   uint32_t                             SamplerCount;
3381b8e80941Smrg#define NoSamplers                               0
3382b8e80941Smrg#define _14Samplers                              1
3383b8e80941Smrg#define _58Samplers                              2
3384b8e80941Smrg#define _912Samplers                             3
3385b8e80941Smrg#define _1316Samplers                            4
3386b8e80941Smrg   uint32_t                             InstanceCount;
3387b8e80941Smrg   uint32_t                             MaximumNumberofThreads;
3388b8e80941Smrg   bool                                 StatisticsEnable;
3389b8e80941Smrg   bool                                 Enable;
3390b8e80941Smrg   uint64_t                             KernelStartPointer;
3391b8e80941Smrg   uint32_t                             PerThreadScratchSpace;
3392b8e80941Smrg   __gen_address_type                   ScratchSpaceBasePointer;
3393b8e80941Smrg   uint32_t                             VertexURBEntryReadOffset;
3394b8e80941Smrg   uint32_t                             VertexURBEntryReadLength;
3395b8e80941Smrg   uint32_t                             DispatchGRFStartRegisterForURBData;
3396b8e80941Smrg   bool                                 IncludeVertexHandles;
3397b8e80941Smrg   bool                                 AccessesUAV;
3398b8e80941Smrg   bool                                 VectorMaskEnable;
3399b8e80941Smrg   bool                                 SingleProgramFlow;
3400b8e80941Smrg};
3401b8e80941Smrg
3402b8e80941Smrgstatic inline void
3403b8e80941SmrgGEN8_3DSTATE_HS_pack(__attribute__((unused)) __gen_user_data *data,
3404b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
3405b8e80941Smrg                     __attribute__((unused)) const struct GEN8_3DSTATE_HS * restrict values)
3406b8e80941Smrg{
3407b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3408b8e80941Smrg
3409b8e80941Smrg   dw[0] =
3410b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3411b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3412b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3413b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3414b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3415b8e80941Smrg
3416b8e80941Smrg   dw[1] =
3417b8e80941Smrg      __gen_uint(values->SoftwareExceptionEnable, 12, 12) |
3418b8e80941Smrg      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
3419b8e80941Smrg      __gen_uint(values->FloatingPointMode, 16, 16) |
3420b8e80941Smrg      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
3421b8e80941Smrg      __gen_uint(values->BindingTableEntryCount, 18, 25) |
3422b8e80941Smrg      __gen_uint(values->SamplerCount, 27, 29);
3423b8e80941Smrg
3424b8e80941Smrg   dw[2] =
3425b8e80941Smrg      __gen_uint(values->InstanceCount, 0, 3) |
3426b8e80941Smrg      __gen_uint(values->MaximumNumberofThreads, 8, 16) |
3427b8e80941Smrg      __gen_uint(values->StatisticsEnable, 29, 29) |
3428b8e80941Smrg      __gen_uint(values->Enable, 31, 31);
3429b8e80941Smrg
3430b8e80941Smrg   const uint64_t v3 =
3431b8e80941Smrg      __gen_offset(values->KernelStartPointer, 6, 63);
3432b8e80941Smrg   dw[3] = v3;
3433b8e80941Smrg   dw[4] = v3 >> 32;
3434b8e80941Smrg
3435b8e80941Smrg   const uint64_t v5 =
3436b8e80941Smrg      __gen_uint(values->PerThreadScratchSpace, 0, 3);
3437b8e80941Smrg   const uint64_t v5_address =
3438b8e80941Smrg      __gen_combine_address(data, &dw[5], values->ScratchSpaceBasePointer, v5);
3439b8e80941Smrg   dw[5] = v5_address;
3440b8e80941Smrg   dw[6] = (v5_address >> 32) | (v5 >> 32);
3441b8e80941Smrg
3442b8e80941Smrg   dw[7] =
3443b8e80941Smrg      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
3444b8e80941Smrg      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
3445b8e80941Smrg      __gen_uint(values->DispatchGRFStartRegisterForURBData, 19, 23) |
3446b8e80941Smrg      __gen_uint(values->IncludeVertexHandles, 24, 24) |
3447b8e80941Smrg      __gen_uint(values->AccessesUAV, 25, 25) |
3448b8e80941Smrg      __gen_uint(values->VectorMaskEnable, 26, 26) |
3449b8e80941Smrg      __gen_uint(values->SingleProgramFlow, 27, 27);
3450b8e80941Smrg
3451b8e80941Smrg   dw[8] = 0;
3452b8e80941Smrg}
3453b8e80941Smrg
3454b8e80941Smrg#define GEN8_3DSTATE_INDEX_BUFFER_length       5
3455b8e80941Smrg#define GEN8_3DSTATE_INDEX_BUFFER_length_bias      2
3456b8e80941Smrg#define GEN8_3DSTATE_INDEX_BUFFER_header        \
3457b8e80941Smrg   .DWordLength                         =      3,  \
3458b8e80941Smrg   ._3DCommandSubOpcode                 =     10,  \
3459b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
3460b8e80941Smrg   .CommandSubType                      =      3,  \
3461b8e80941Smrg   .CommandType                         =      3
3462b8e80941Smrg
3463b8e80941Smrgstruct GEN8_3DSTATE_INDEX_BUFFER {
3464b8e80941Smrg   uint32_t                             DWordLength;
3465b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3466b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3467b8e80941Smrg   uint32_t                             CommandSubType;
3468b8e80941Smrg   uint32_t                             CommandType;
3469b8e80941Smrg   uint32_t                             MOCS;
3470b8e80941Smrg   uint32_t                             IndexFormat;
3471b8e80941Smrg#define INDEX_BYTE                               0
3472b8e80941Smrg#define INDEX_WORD                               1
3473b8e80941Smrg#define INDEX_DWORD                              2
3474b8e80941Smrg   __gen_address_type                   BufferStartingAddress;
3475b8e80941Smrg   uint32_t                             BufferSize;
3476b8e80941Smrg};
3477b8e80941Smrg
3478b8e80941Smrgstatic inline void
3479b8e80941SmrgGEN8_3DSTATE_INDEX_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
3480b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
3481b8e80941Smrg                               __attribute__((unused)) const struct GEN8_3DSTATE_INDEX_BUFFER * restrict values)
3482b8e80941Smrg{
3483b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3484b8e80941Smrg
3485b8e80941Smrg   dw[0] =
3486b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3487b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3488b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3489b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3490b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3491b8e80941Smrg
3492b8e80941Smrg   dw[1] =
3493b8e80941Smrg      __gen_uint(values->MOCS, 0, 6) |
3494b8e80941Smrg      __gen_uint(values->IndexFormat, 8, 9);
3495b8e80941Smrg
3496b8e80941Smrg   const uint64_t v2_address =
3497b8e80941Smrg      __gen_combine_address(data, &dw[2], values->BufferStartingAddress, 0);
3498b8e80941Smrg   dw[2] = v2_address;
3499b8e80941Smrg   dw[3] = v2_address >> 32;
3500b8e80941Smrg
3501b8e80941Smrg   dw[4] =
3502b8e80941Smrg      __gen_uint(values->BufferSize, 0, 31);
3503b8e80941Smrg}
3504b8e80941Smrg
3505b8e80941Smrg#define GEN8_3DSTATE_LINE_STIPPLE_length       3
3506b8e80941Smrg#define GEN8_3DSTATE_LINE_STIPPLE_length_bias      2
3507b8e80941Smrg#define GEN8_3DSTATE_LINE_STIPPLE_header        \
3508b8e80941Smrg   .DWordLength                         =      1,  \
3509b8e80941Smrg   ._3DCommandSubOpcode                 =      8,  \
3510b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
3511b8e80941Smrg   .CommandSubType                      =      3,  \
3512b8e80941Smrg   .CommandType                         =      3
3513b8e80941Smrg
3514b8e80941Smrgstruct GEN8_3DSTATE_LINE_STIPPLE {
3515b8e80941Smrg   uint32_t                             DWordLength;
3516b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3517b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3518b8e80941Smrg   uint32_t                             CommandSubType;
3519b8e80941Smrg   uint32_t                             CommandType;
3520b8e80941Smrg   uint32_t                             LineStipplePattern;
3521b8e80941Smrg   uint32_t                             CurrentStippleIndex;
3522b8e80941Smrg   uint32_t                             CurrentRepeatCounter;
3523b8e80941Smrg   bool                                 ModifyEnableCurrentRepeatCounterCurrentStippleIndex;
3524b8e80941Smrg   uint32_t                             LineStippleRepeatCount;
3525b8e80941Smrg   float                                LineStippleInverseRepeatCount;
3526b8e80941Smrg};
3527b8e80941Smrg
3528b8e80941Smrgstatic inline void
3529b8e80941SmrgGEN8_3DSTATE_LINE_STIPPLE_pack(__attribute__((unused)) __gen_user_data *data,
3530b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
3531b8e80941Smrg                               __attribute__((unused)) const struct GEN8_3DSTATE_LINE_STIPPLE * restrict values)
3532b8e80941Smrg{
3533b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3534b8e80941Smrg
3535b8e80941Smrg   dw[0] =
3536b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3537b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3538b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3539b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3540b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3541b8e80941Smrg
3542b8e80941Smrg   dw[1] =
3543b8e80941Smrg      __gen_uint(values->LineStipplePattern, 0, 15) |
3544b8e80941Smrg      __gen_uint(values->CurrentStippleIndex, 16, 19) |
3545b8e80941Smrg      __gen_uint(values->CurrentRepeatCounter, 21, 29) |
3546b8e80941Smrg      __gen_uint(values->ModifyEnableCurrentRepeatCounterCurrentStippleIndex, 31, 31);
3547b8e80941Smrg
3548b8e80941Smrg   dw[2] =
3549b8e80941Smrg      __gen_uint(values->LineStippleRepeatCount, 0, 8) |
3550b8e80941Smrg      __gen_ufixed(values->LineStippleInverseRepeatCount, 15, 31, 16);
3551b8e80941Smrg}
3552b8e80941Smrg
3553b8e80941Smrg#define GEN8_3DSTATE_MONOFILTER_SIZE_length      2
3554b8e80941Smrg#define GEN8_3DSTATE_MONOFILTER_SIZE_length_bias      2
3555b8e80941Smrg#define GEN8_3DSTATE_MONOFILTER_SIZE_header     \
3556b8e80941Smrg   .DWordLength                         =      0,  \
3557b8e80941Smrg   ._3DCommandSubOpcode                 =     17,  \
3558b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
3559b8e80941Smrg   .CommandSubType                      =      3,  \
3560b8e80941Smrg   .CommandType                         =      3
3561b8e80941Smrg
3562b8e80941Smrgstruct GEN8_3DSTATE_MONOFILTER_SIZE {
3563b8e80941Smrg   uint32_t                             DWordLength;
3564b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3565b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3566b8e80941Smrg   uint32_t                             CommandSubType;
3567b8e80941Smrg   uint32_t                             CommandType;
3568b8e80941Smrg   uint32_t                             MonochromeFilterHeight;
3569b8e80941Smrg   uint32_t                             MonochromeFilterWidth;
3570b8e80941Smrg};
3571b8e80941Smrg
3572b8e80941Smrgstatic inline void
3573b8e80941SmrgGEN8_3DSTATE_MONOFILTER_SIZE_pack(__attribute__((unused)) __gen_user_data *data,
3574b8e80941Smrg                                  __attribute__((unused)) void * restrict dst,
3575b8e80941Smrg                                  __attribute__((unused)) const struct GEN8_3DSTATE_MONOFILTER_SIZE * restrict values)
3576b8e80941Smrg{
3577b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3578b8e80941Smrg
3579b8e80941Smrg   dw[0] =
3580b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3581b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3582b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3583b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3584b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3585b8e80941Smrg
3586b8e80941Smrg   dw[1] =
3587b8e80941Smrg      __gen_uint(values->MonochromeFilterHeight, 0, 2) |
3588b8e80941Smrg      __gen_uint(values->MonochromeFilterWidth, 3, 5);
3589b8e80941Smrg}
3590b8e80941Smrg
3591b8e80941Smrg#define GEN8_3DSTATE_MULTISAMPLE_length        2
3592b8e80941Smrg#define GEN8_3DSTATE_MULTISAMPLE_length_bias      2
3593b8e80941Smrg#define GEN8_3DSTATE_MULTISAMPLE_header         \
3594b8e80941Smrg   .DWordLength                         =      0,  \
3595b8e80941Smrg   ._3DCommandSubOpcode                 =     13,  \
3596b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
3597b8e80941Smrg   .CommandSubType                      =      3,  \
3598b8e80941Smrg   .CommandType                         =      3
3599b8e80941Smrg
3600b8e80941Smrgstruct GEN8_3DSTATE_MULTISAMPLE {
3601b8e80941Smrg   uint32_t                             DWordLength;
3602b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3603b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3604b8e80941Smrg   uint32_t                             CommandSubType;
3605b8e80941Smrg   uint32_t                             CommandType;
3606b8e80941Smrg   uint32_t                             NumberofMultisamples;
3607b8e80941Smrg   uint32_t                             PixelLocation;
3608b8e80941Smrg#define CENTER                                   0
3609b8e80941Smrg#define UL_CORNER                                1
3610b8e80941Smrg   bool                                 PixelPositionOffsetEnable;
3611b8e80941Smrg};
3612b8e80941Smrg
3613b8e80941Smrgstatic inline void
3614b8e80941SmrgGEN8_3DSTATE_MULTISAMPLE_pack(__attribute__((unused)) __gen_user_data *data,
3615b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
3616b8e80941Smrg                              __attribute__((unused)) const struct GEN8_3DSTATE_MULTISAMPLE * restrict values)
3617b8e80941Smrg{
3618b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3619b8e80941Smrg
3620b8e80941Smrg   dw[0] =
3621b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3622b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3623b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3624b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3625b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3626b8e80941Smrg
3627b8e80941Smrg   dw[1] =
3628b8e80941Smrg      __gen_uint(values->NumberofMultisamples, 1, 3) |
3629b8e80941Smrg      __gen_uint(values->PixelLocation, 4, 4) |
3630b8e80941Smrg      __gen_uint(values->PixelPositionOffsetEnable, 5, 5);
3631b8e80941Smrg}
3632b8e80941Smrg
3633b8e80941Smrg#define GEN8_3DSTATE_POLY_STIPPLE_OFFSET_length      2
3634b8e80941Smrg#define GEN8_3DSTATE_POLY_STIPPLE_OFFSET_length_bias      2
3635b8e80941Smrg#define GEN8_3DSTATE_POLY_STIPPLE_OFFSET_header \
3636b8e80941Smrg   .DWordLength                         =      0,  \
3637b8e80941Smrg   ._3DCommandSubOpcode                 =      6,  \
3638b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
3639b8e80941Smrg   .CommandSubType                      =      3,  \
3640b8e80941Smrg   .CommandType                         =      3
3641b8e80941Smrg
3642b8e80941Smrgstruct GEN8_3DSTATE_POLY_STIPPLE_OFFSET {
3643b8e80941Smrg   uint32_t                             DWordLength;
3644b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3645b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3646b8e80941Smrg   uint32_t                             CommandSubType;
3647b8e80941Smrg   uint32_t                             CommandType;
3648b8e80941Smrg   uint32_t                             PolygonStippleYOffset;
3649b8e80941Smrg   uint32_t                             PolygonStippleXOffset;
3650b8e80941Smrg};
3651b8e80941Smrg
3652b8e80941Smrgstatic inline void
3653b8e80941SmrgGEN8_3DSTATE_POLY_STIPPLE_OFFSET_pack(__attribute__((unused)) __gen_user_data *data,
3654b8e80941Smrg                                      __attribute__((unused)) void * restrict dst,
3655b8e80941Smrg                                      __attribute__((unused)) const struct GEN8_3DSTATE_POLY_STIPPLE_OFFSET * restrict values)
3656b8e80941Smrg{
3657b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3658b8e80941Smrg
3659b8e80941Smrg   dw[0] =
3660b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3661b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3662b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3663b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3664b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3665b8e80941Smrg
3666b8e80941Smrg   dw[1] =
3667b8e80941Smrg      __gen_uint(values->PolygonStippleYOffset, 0, 4) |
3668b8e80941Smrg      __gen_uint(values->PolygonStippleXOffset, 8, 12);
3669b8e80941Smrg}
3670b8e80941Smrg
3671b8e80941Smrg#define GEN8_3DSTATE_POLY_STIPPLE_PATTERN_length     33
3672b8e80941Smrg#define GEN8_3DSTATE_POLY_STIPPLE_PATTERN_length_bias      2
3673b8e80941Smrg#define GEN8_3DSTATE_POLY_STIPPLE_PATTERN_header\
3674b8e80941Smrg   .DWordLength                         =     31,  \
3675b8e80941Smrg   ._3DCommandSubOpcode                 =      7,  \
3676b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
3677b8e80941Smrg   .CommandSubType                      =      3,  \
3678b8e80941Smrg   .CommandType                         =      3
3679b8e80941Smrg
3680b8e80941Smrgstruct GEN8_3DSTATE_POLY_STIPPLE_PATTERN {
3681b8e80941Smrg   uint32_t                             DWordLength;
3682b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3683b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3684b8e80941Smrg   uint32_t                             CommandSubType;
3685b8e80941Smrg   uint32_t                             CommandType;
3686b8e80941Smrg   uint32_t                             PatternRow[32];
3687b8e80941Smrg};
3688b8e80941Smrg
3689b8e80941Smrgstatic inline void
3690b8e80941SmrgGEN8_3DSTATE_POLY_STIPPLE_PATTERN_pack(__attribute__((unused)) __gen_user_data *data,
3691b8e80941Smrg                                       __attribute__((unused)) void * restrict dst,
3692b8e80941Smrg                                       __attribute__((unused)) const struct GEN8_3DSTATE_POLY_STIPPLE_PATTERN * restrict values)
3693b8e80941Smrg{
3694b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3695b8e80941Smrg
3696b8e80941Smrg   dw[0] =
3697b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3698b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3699b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3700b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3701b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3702b8e80941Smrg
3703b8e80941Smrg   dw[1] =
3704b8e80941Smrg      __gen_uint(values->PatternRow[0], 0, 31);
3705b8e80941Smrg
3706b8e80941Smrg   dw[2] =
3707b8e80941Smrg      __gen_uint(values->PatternRow[1], 0, 31);
3708b8e80941Smrg
3709b8e80941Smrg   dw[3] =
3710b8e80941Smrg      __gen_uint(values->PatternRow[2], 0, 31);
3711b8e80941Smrg
3712b8e80941Smrg   dw[4] =
3713b8e80941Smrg      __gen_uint(values->PatternRow[3], 0, 31);
3714b8e80941Smrg
3715b8e80941Smrg   dw[5] =
3716b8e80941Smrg      __gen_uint(values->PatternRow[4], 0, 31);
3717b8e80941Smrg
3718b8e80941Smrg   dw[6] =
3719b8e80941Smrg      __gen_uint(values->PatternRow[5], 0, 31);
3720b8e80941Smrg
3721b8e80941Smrg   dw[7] =
3722b8e80941Smrg      __gen_uint(values->PatternRow[6], 0, 31);
3723b8e80941Smrg
3724b8e80941Smrg   dw[8] =
3725b8e80941Smrg      __gen_uint(values->PatternRow[7], 0, 31);
3726b8e80941Smrg
3727b8e80941Smrg   dw[9] =
3728b8e80941Smrg      __gen_uint(values->PatternRow[8], 0, 31);
3729b8e80941Smrg
3730b8e80941Smrg   dw[10] =
3731b8e80941Smrg      __gen_uint(values->PatternRow[9], 0, 31);
3732b8e80941Smrg
3733b8e80941Smrg   dw[11] =
3734b8e80941Smrg      __gen_uint(values->PatternRow[10], 0, 31);
3735b8e80941Smrg
3736b8e80941Smrg   dw[12] =
3737b8e80941Smrg      __gen_uint(values->PatternRow[11], 0, 31);
3738b8e80941Smrg
3739b8e80941Smrg   dw[13] =
3740b8e80941Smrg      __gen_uint(values->PatternRow[12], 0, 31);
3741b8e80941Smrg
3742b8e80941Smrg   dw[14] =
3743b8e80941Smrg      __gen_uint(values->PatternRow[13], 0, 31);
3744b8e80941Smrg
3745b8e80941Smrg   dw[15] =
3746b8e80941Smrg      __gen_uint(values->PatternRow[14], 0, 31);
3747b8e80941Smrg
3748b8e80941Smrg   dw[16] =
3749b8e80941Smrg      __gen_uint(values->PatternRow[15], 0, 31);
3750b8e80941Smrg
3751b8e80941Smrg   dw[17] =
3752b8e80941Smrg      __gen_uint(values->PatternRow[16], 0, 31);
3753b8e80941Smrg
3754b8e80941Smrg   dw[18] =
3755b8e80941Smrg      __gen_uint(values->PatternRow[17], 0, 31);
3756b8e80941Smrg
3757b8e80941Smrg   dw[19] =
3758b8e80941Smrg      __gen_uint(values->PatternRow[18], 0, 31);
3759b8e80941Smrg
3760b8e80941Smrg   dw[20] =
3761b8e80941Smrg      __gen_uint(values->PatternRow[19], 0, 31);
3762b8e80941Smrg
3763b8e80941Smrg   dw[21] =
3764b8e80941Smrg      __gen_uint(values->PatternRow[20], 0, 31);
3765b8e80941Smrg
3766b8e80941Smrg   dw[22] =
3767b8e80941Smrg      __gen_uint(values->PatternRow[21], 0, 31);
3768b8e80941Smrg
3769b8e80941Smrg   dw[23] =
3770b8e80941Smrg      __gen_uint(values->PatternRow[22], 0, 31);
3771b8e80941Smrg
3772b8e80941Smrg   dw[24] =
3773b8e80941Smrg      __gen_uint(values->PatternRow[23], 0, 31);
3774b8e80941Smrg
3775b8e80941Smrg   dw[25] =
3776b8e80941Smrg      __gen_uint(values->PatternRow[24], 0, 31);
3777b8e80941Smrg
3778b8e80941Smrg   dw[26] =
3779b8e80941Smrg      __gen_uint(values->PatternRow[25], 0, 31);
3780b8e80941Smrg
3781b8e80941Smrg   dw[27] =
3782b8e80941Smrg      __gen_uint(values->PatternRow[26], 0, 31);
3783b8e80941Smrg
3784b8e80941Smrg   dw[28] =
3785b8e80941Smrg      __gen_uint(values->PatternRow[27], 0, 31);
3786b8e80941Smrg
3787b8e80941Smrg   dw[29] =
3788b8e80941Smrg      __gen_uint(values->PatternRow[28], 0, 31);
3789b8e80941Smrg
3790b8e80941Smrg   dw[30] =
3791b8e80941Smrg      __gen_uint(values->PatternRow[29], 0, 31);
3792b8e80941Smrg
3793b8e80941Smrg   dw[31] =
3794b8e80941Smrg      __gen_uint(values->PatternRow[30], 0, 31);
3795b8e80941Smrg
3796b8e80941Smrg   dw[32] =
3797b8e80941Smrg      __gen_uint(values->PatternRow[31], 0, 31);
3798b8e80941Smrg}
3799b8e80941Smrg
3800b8e80941Smrg#define GEN8_3DSTATE_PS_length                12
3801b8e80941Smrg#define GEN8_3DSTATE_PS_length_bias            2
3802b8e80941Smrg#define GEN8_3DSTATE_PS_header                  \
3803b8e80941Smrg   .DWordLength                         =     10,  \
3804b8e80941Smrg   ._3DCommandSubOpcode                 =     32,  \
3805b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
3806b8e80941Smrg   .CommandSubType                      =      3,  \
3807b8e80941Smrg   .CommandType                         =      3
3808b8e80941Smrg
3809b8e80941Smrgstruct GEN8_3DSTATE_PS {
3810b8e80941Smrg   uint32_t                             DWordLength;
3811b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3812b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3813b8e80941Smrg   uint32_t                             CommandSubType;
3814b8e80941Smrg   uint32_t                             CommandType;
3815b8e80941Smrg   uint64_t                             KernelStartPointer0;
3816b8e80941Smrg   bool                                 SoftwareExceptionEnable;
3817b8e80941Smrg   bool                                 MaskStackExceptionEnable;
3818b8e80941Smrg   bool                                 IllegalOpcodeExceptionEnable;
3819b8e80941Smrg   uint32_t                             RoundingMode;
3820b8e80941Smrg#define RTNE                                     0
3821b8e80941Smrg#define RU                                       1
3822b8e80941Smrg#define RD                                       2
3823b8e80941Smrg#define RTZ                                      3
3824b8e80941Smrg   uint32_t                             FloatingPointMode;
3825b8e80941Smrg#define IEEE754                                  0
3826b8e80941Smrg#define Alternate                                1
3827b8e80941Smrg   uint32_t                             ThreadDispatchPriority;
3828b8e80941Smrg#define High                                     1
3829b8e80941Smrg   uint32_t                             BindingTableEntryCount;
3830b8e80941Smrg   uint32_t                             SinglePrecisionDenormalMode;
3831b8e80941Smrg#define FlushedtoZero                            0
3832b8e80941Smrg#define Retained                                 1
3833b8e80941Smrg   uint32_t                             SamplerCount;
3834b8e80941Smrg#define NoSamplers                               0
3835b8e80941Smrg#define _14Samplers                              1
3836b8e80941Smrg#define _58Samplers                              2
3837b8e80941Smrg#define _912Samplers                             3
3838b8e80941Smrg#define _1316Samplers                            4
3839b8e80941Smrg   bool                                 VectorMaskEnable;
3840b8e80941Smrg   bool                                 SingleProgramFlow;
3841b8e80941Smrg   uint32_t                             PerThreadScratchSpace;
3842b8e80941Smrg   __gen_address_type                   ScratchSpaceBasePointer;
3843b8e80941Smrg   bool                                 _8PixelDispatchEnable;
3844b8e80941Smrg   bool                                 _16PixelDispatchEnable;
3845b8e80941Smrg   bool                                 _32PixelDispatchEnable;
3846b8e80941Smrg   uint32_t                             PositionXYOffsetSelect;
3847b8e80941Smrg#define POSOFFSET_NONE                           0
3848b8e80941Smrg#define POSOFFSET_CENTROID                       2
3849b8e80941Smrg#define POSOFFSET_SAMPLE                         3
3850b8e80941Smrg   bool                                 RenderTargetResolveEnable;
3851b8e80941Smrg   bool                                 RenderTargetFastClearEnable;
3852b8e80941Smrg   bool                                 PushConstantEnable;
3853b8e80941Smrg   uint32_t                             MaximumNumberofThreadsPerPSD;
3854b8e80941Smrg   uint32_t                             DispatchGRFStartRegisterForConstantSetupData2;
3855b8e80941Smrg   uint32_t                             DispatchGRFStartRegisterForConstantSetupData1;
3856b8e80941Smrg   uint32_t                             DispatchGRFStartRegisterForConstantSetupData0;
3857b8e80941Smrg   uint64_t                             KernelStartPointer1;
3858b8e80941Smrg   uint64_t                             KernelStartPointer2;
3859b8e80941Smrg};
3860b8e80941Smrg
3861b8e80941Smrgstatic inline void
3862b8e80941SmrgGEN8_3DSTATE_PS_pack(__attribute__((unused)) __gen_user_data *data,
3863b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
3864b8e80941Smrg                     __attribute__((unused)) const struct GEN8_3DSTATE_PS * restrict values)
3865b8e80941Smrg{
3866b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3867b8e80941Smrg
3868b8e80941Smrg   dw[0] =
3869b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3870b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3871b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3872b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3873b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3874b8e80941Smrg
3875b8e80941Smrg   const uint64_t v1 =
3876b8e80941Smrg      __gen_offset(values->KernelStartPointer0, 6, 63);
3877b8e80941Smrg   dw[1] = v1;
3878b8e80941Smrg   dw[2] = v1 >> 32;
3879b8e80941Smrg
3880b8e80941Smrg   dw[3] =
3881b8e80941Smrg      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
3882b8e80941Smrg      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
3883b8e80941Smrg      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
3884b8e80941Smrg      __gen_uint(values->RoundingMode, 14, 15) |
3885b8e80941Smrg      __gen_uint(values->FloatingPointMode, 16, 16) |
3886b8e80941Smrg      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
3887b8e80941Smrg      __gen_uint(values->BindingTableEntryCount, 18, 25) |
3888b8e80941Smrg      __gen_uint(values->SinglePrecisionDenormalMode, 26, 26) |
3889b8e80941Smrg      __gen_uint(values->SamplerCount, 27, 29) |
3890b8e80941Smrg      __gen_uint(values->VectorMaskEnable, 30, 30) |
3891b8e80941Smrg      __gen_uint(values->SingleProgramFlow, 31, 31);
3892b8e80941Smrg
3893b8e80941Smrg   const uint64_t v4 =
3894b8e80941Smrg      __gen_uint(values->PerThreadScratchSpace, 0, 3);
3895b8e80941Smrg   const uint64_t v4_address =
3896b8e80941Smrg      __gen_combine_address(data, &dw[4], values->ScratchSpaceBasePointer, v4);
3897b8e80941Smrg   dw[4] = v4_address;
3898b8e80941Smrg   dw[5] = (v4_address >> 32) | (v4 >> 32);
3899b8e80941Smrg
3900b8e80941Smrg   dw[6] =
3901b8e80941Smrg      __gen_uint(values->_8PixelDispatchEnable, 0, 0) |
3902b8e80941Smrg      __gen_uint(values->_16PixelDispatchEnable, 1, 1) |
3903b8e80941Smrg      __gen_uint(values->_32PixelDispatchEnable, 2, 2) |
3904b8e80941Smrg      __gen_uint(values->PositionXYOffsetSelect, 3, 4) |
3905b8e80941Smrg      __gen_uint(values->RenderTargetResolveEnable, 6, 6) |
3906b8e80941Smrg      __gen_uint(values->RenderTargetFastClearEnable, 8, 8) |
3907b8e80941Smrg      __gen_uint(values->PushConstantEnable, 11, 11) |
3908b8e80941Smrg      __gen_uint(values->MaximumNumberofThreadsPerPSD, 23, 31);
3909b8e80941Smrg
3910b8e80941Smrg   dw[7] =
3911b8e80941Smrg      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData2, 0, 6) |
3912b8e80941Smrg      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData1, 8, 14) |
3913b8e80941Smrg      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData0, 16, 22);
3914b8e80941Smrg
3915b8e80941Smrg   const uint64_t v8 =
3916b8e80941Smrg      __gen_offset(values->KernelStartPointer1, 6, 63);
3917b8e80941Smrg   dw[8] = v8;
3918b8e80941Smrg   dw[9] = v8 >> 32;
3919b8e80941Smrg
3920b8e80941Smrg   const uint64_t v10 =
3921b8e80941Smrg      __gen_offset(values->KernelStartPointer2, 6, 63);
3922b8e80941Smrg   dw[10] = v10;
3923b8e80941Smrg   dw[11] = v10 >> 32;
3924b8e80941Smrg}
3925b8e80941Smrg
3926b8e80941Smrg#define GEN8_3DSTATE_PS_BLEND_length           2
3927b8e80941Smrg#define GEN8_3DSTATE_PS_BLEND_length_bias      2
3928b8e80941Smrg#define GEN8_3DSTATE_PS_BLEND_header            \
3929b8e80941Smrg   .DWordLength                         =      0,  \
3930b8e80941Smrg   ._3DCommandSubOpcode                 =     77,  \
3931b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
3932b8e80941Smrg   .CommandSubType                      =      3,  \
3933b8e80941Smrg   .CommandType                         =      3
3934b8e80941Smrg
3935b8e80941Smrgstruct GEN8_3DSTATE_PS_BLEND {
3936b8e80941Smrg   uint32_t                             DWordLength;
3937b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3938b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3939b8e80941Smrg   uint32_t                             CommandSubType;
3940b8e80941Smrg   uint32_t                             CommandType;
3941b8e80941Smrg   bool                                 IndependentAlphaBlendEnable;
3942b8e80941Smrg   bool                                 AlphaTestEnable;
3943b8e80941Smrg   uint32_t                             DestinationBlendFactor;
3944b8e80941Smrg   uint32_t                             SourceBlendFactor;
3945b8e80941Smrg   uint32_t                             DestinationAlphaBlendFactor;
3946b8e80941Smrg   uint32_t                             SourceAlphaBlendFactor;
3947b8e80941Smrg   bool                                 ColorBufferBlendEnable;
3948b8e80941Smrg   bool                                 HasWriteableRT;
3949b8e80941Smrg   bool                                 AlphaToCoverageEnable;
3950b8e80941Smrg};
3951b8e80941Smrg
3952b8e80941Smrgstatic inline void
3953b8e80941SmrgGEN8_3DSTATE_PS_BLEND_pack(__attribute__((unused)) __gen_user_data *data,
3954b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
3955b8e80941Smrg                           __attribute__((unused)) const struct GEN8_3DSTATE_PS_BLEND * restrict values)
3956b8e80941Smrg{
3957b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3958b8e80941Smrg
3959b8e80941Smrg   dw[0] =
3960b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3961b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3962b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3963b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3964b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3965b8e80941Smrg
3966b8e80941Smrg   dw[1] =
3967b8e80941Smrg      __gen_uint(values->IndependentAlphaBlendEnable, 7, 7) |
3968b8e80941Smrg      __gen_uint(values->AlphaTestEnable, 8, 8) |
3969b8e80941Smrg      __gen_uint(values->DestinationBlendFactor, 9, 13) |
3970b8e80941Smrg      __gen_uint(values->SourceBlendFactor, 14, 18) |
3971b8e80941Smrg      __gen_uint(values->DestinationAlphaBlendFactor, 19, 23) |
3972b8e80941Smrg      __gen_uint(values->SourceAlphaBlendFactor, 24, 28) |
3973b8e80941Smrg      __gen_uint(values->ColorBufferBlendEnable, 29, 29) |
3974b8e80941Smrg      __gen_uint(values->HasWriteableRT, 30, 30) |
3975b8e80941Smrg      __gen_uint(values->AlphaToCoverageEnable, 31, 31);
3976b8e80941Smrg}
3977b8e80941Smrg
3978b8e80941Smrg#define GEN8_3DSTATE_PS_EXTRA_length           2
3979b8e80941Smrg#define GEN8_3DSTATE_PS_EXTRA_length_bias      2
3980b8e80941Smrg#define GEN8_3DSTATE_PS_EXTRA_header            \
3981b8e80941Smrg   .DWordLength                         =      0,  \
3982b8e80941Smrg   ._3DCommandSubOpcode                 =     79,  \
3983b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
3984b8e80941Smrg   .CommandSubType                      =      3,  \
3985b8e80941Smrg   .CommandType                         =      3
3986b8e80941Smrg
3987b8e80941Smrgstruct GEN8_3DSTATE_PS_EXTRA {
3988b8e80941Smrg   uint32_t                             DWordLength;
3989b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3990b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3991b8e80941Smrg   uint32_t                             CommandSubType;
3992b8e80941Smrg   uint32_t                             CommandType;
3993b8e80941Smrg   bool                                 PixelShaderUsesInputCoverageMask;
3994b8e80941Smrg   bool                                 PixelShaderHasUAV;
3995b8e80941Smrg   bool                                 PixelShaderIsPerSample;
3996b8e80941Smrg   bool                                 PixelShaderDisablesAlphaToCoverage;
3997b8e80941Smrg   bool                                 AttributeEnable;
3998b8e80941Smrg   bool                                 PixelShaderUsesSourceW;
3999b8e80941Smrg   bool                                 PixelShaderUsesSourceDepth;
4000b8e80941Smrg   bool                                 ForceComputedDepth;
4001b8e80941Smrg   uint32_t                             PixelShaderComputedDepthMode;
4002b8e80941Smrg#define PSCDEPTH_OFF                             0
4003b8e80941Smrg#define PSCDEPTH_ON                              1
4004b8e80941Smrg#define PSCDEPTH_ON_GE                           2
4005b8e80941Smrg#define PSCDEPTH_ON_LE                           3
4006b8e80941Smrg   bool                                 PixelShaderKillsPixel;
4007b8e80941Smrg   bool                                 oMaskPresenttoRenderTarget;
4008b8e80941Smrg   bool                                 PixelShaderDoesnotwritetoRT;
4009b8e80941Smrg   bool                                 PixelShaderValid;
4010b8e80941Smrg};
4011b8e80941Smrg
4012b8e80941Smrgstatic inline void
4013b8e80941SmrgGEN8_3DSTATE_PS_EXTRA_pack(__attribute__((unused)) __gen_user_data *data,
4014b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
4015b8e80941Smrg                           __attribute__((unused)) const struct GEN8_3DSTATE_PS_EXTRA * restrict values)
4016b8e80941Smrg{
4017b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4018b8e80941Smrg
4019b8e80941Smrg   dw[0] =
4020b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4021b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4022b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4023b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4024b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4025b8e80941Smrg
4026b8e80941Smrg   dw[1] =
4027b8e80941Smrg      __gen_uint(values->PixelShaderUsesInputCoverageMask, 1, 1) |
4028b8e80941Smrg      __gen_uint(values->PixelShaderHasUAV, 2, 2) |
4029b8e80941Smrg      __gen_uint(values->PixelShaderIsPerSample, 6, 6) |
4030b8e80941Smrg      __gen_uint(values->PixelShaderDisablesAlphaToCoverage, 7, 7) |
4031b8e80941Smrg      __gen_uint(values->AttributeEnable, 8, 8) |
4032b8e80941Smrg      __gen_uint(values->PixelShaderUsesSourceW, 23, 23) |
4033b8e80941Smrg      __gen_uint(values->PixelShaderUsesSourceDepth, 24, 24) |
4034b8e80941Smrg      __gen_uint(values->ForceComputedDepth, 25, 25) |
4035b8e80941Smrg      __gen_uint(values->PixelShaderComputedDepthMode, 26, 27) |
4036b8e80941Smrg      __gen_uint(values->PixelShaderKillsPixel, 28, 28) |
4037b8e80941Smrg      __gen_uint(values->oMaskPresenttoRenderTarget, 29, 29) |
4038b8e80941Smrg      __gen_uint(values->PixelShaderDoesnotwritetoRT, 30, 30) |
4039b8e80941Smrg      __gen_uint(values->PixelShaderValid, 31, 31);
4040b8e80941Smrg}
4041b8e80941Smrg
4042b8e80941Smrg#define GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_DS_length      2
4043b8e80941Smrg#define GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_DS_length_bias      2
4044b8e80941Smrg#define GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_DS_header\
4045b8e80941Smrg   .DWordLength                         =      0,  \
4046b8e80941Smrg   ._3DCommandSubOpcode                 =     20,  \
4047b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
4048b8e80941Smrg   .CommandSubType                      =      3,  \
4049b8e80941Smrg   .CommandType                         =      3
4050b8e80941Smrg
4051b8e80941Smrgstruct GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_DS {
4052b8e80941Smrg   uint32_t                             DWordLength;
4053b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4054b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4055b8e80941Smrg   uint32_t                             CommandSubType;
4056b8e80941Smrg   uint32_t                             CommandType;
4057b8e80941Smrg   uint32_t                             ConstantBufferSize;
4058b8e80941Smrg   uint32_t                             ConstantBufferOffset;
4059b8e80941Smrg};
4060b8e80941Smrg
4061b8e80941Smrgstatic inline void
4062b8e80941SmrgGEN8_3DSTATE_PUSH_CONSTANT_ALLOC_DS_pack(__attribute__((unused)) __gen_user_data *data,
4063b8e80941Smrg                                         __attribute__((unused)) void * restrict dst,
4064b8e80941Smrg                                         __attribute__((unused)) const struct GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_DS * restrict values)
4065b8e80941Smrg{
4066b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4067b8e80941Smrg
4068b8e80941Smrg   dw[0] =
4069b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4070b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4071b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4072b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4073b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4074b8e80941Smrg
4075b8e80941Smrg   dw[1] =
4076b8e80941Smrg      __gen_uint(values->ConstantBufferSize, 0, 5) |
4077b8e80941Smrg      __gen_uint(values->ConstantBufferOffset, 16, 20);
4078b8e80941Smrg}
4079b8e80941Smrg
4080b8e80941Smrg#define GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_GS_length      2
4081b8e80941Smrg#define GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_GS_length_bias      2
4082b8e80941Smrg#define GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_GS_header\
4083b8e80941Smrg   .DWordLength                         =      0,  \
4084b8e80941Smrg   ._3DCommandSubOpcode                 =     21,  \
4085b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
4086b8e80941Smrg   .CommandSubType                      =      3,  \
4087b8e80941Smrg   .CommandType                         =      3
4088b8e80941Smrg
4089b8e80941Smrgstruct GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_GS {
4090b8e80941Smrg   uint32_t                             DWordLength;
4091b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4092b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4093b8e80941Smrg   uint32_t                             CommandSubType;
4094b8e80941Smrg   uint32_t                             CommandType;
4095b8e80941Smrg   uint32_t                             ConstantBufferSize;
4096b8e80941Smrg   uint32_t                             ConstantBufferOffset;
4097b8e80941Smrg};
4098b8e80941Smrg
4099b8e80941Smrgstatic inline void
4100b8e80941SmrgGEN8_3DSTATE_PUSH_CONSTANT_ALLOC_GS_pack(__attribute__((unused)) __gen_user_data *data,
4101b8e80941Smrg                                         __attribute__((unused)) void * restrict dst,
4102b8e80941Smrg                                         __attribute__((unused)) const struct GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_GS * restrict values)
4103b8e80941Smrg{
4104b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4105b8e80941Smrg
4106b8e80941Smrg   dw[0] =
4107b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4108b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4109b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4110b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4111b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4112b8e80941Smrg
4113b8e80941Smrg   dw[1] =
4114b8e80941Smrg      __gen_uint(values->ConstantBufferSize, 0, 5) |
4115b8e80941Smrg      __gen_uint(values->ConstantBufferOffset, 16, 20);
4116b8e80941Smrg}
4117b8e80941Smrg
4118b8e80941Smrg#define GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_HS_length      2
4119b8e80941Smrg#define GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_HS_length_bias      2
4120b8e80941Smrg#define GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_HS_header\
4121b8e80941Smrg   .DWordLength                         =      0,  \
4122b8e80941Smrg   ._3DCommandSubOpcode                 =     19,  \
4123b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
4124b8e80941Smrg   .CommandSubType                      =      3,  \
4125b8e80941Smrg   .CommandType                         =      3
4126b8e80941Smrg
4127b8e80941Smrgstruct GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_HS {
4128b8e80941Smrg   uint32_t                             DWordLength;
4129b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4130b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4131b8e80941Smrg   uint32_t                             CommandSubType;
4132b8e80941Smrg   uint32_t                             CommandType;
4133b8e80941Smrg   uint32_t                             ConstantBufferSize;
4134b8e80941Smrg   uint32_t                             ConstantBufferOffset;
4135b8e80941Smrg};
4136b8e80941Smrg
4137b8e80941Smrgstatic inline void
4138b8e80941SmrgGEN8_3DSTATE_PUSH_CONSTANT_ALLOC_HS_pack(__attribute__((unused)) __gen_user_data *data,
4139b8e80941Smrg                                         __attribute__((unused)) void * restrict dst,
4140b8e80941Smrg                                         __attribute__((unused)) const struct GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_HS * restrict values)
4141b8e80941Smrg{
4142b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4143b8e80941Smrg
4144b8e80941Smrg   dw[0] =
4145b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4146b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4147b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4148b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4149b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4150b8e80941Smrg
4151b8e80941Smrg   dw[1] =
4152b8e80941Smrg      __gen_uint(values->ConstantBufferSize, 0, 5) |
4153b8e80941Smrg      __gen_uint(values->ConstantBufferOffset, 16, 20);
4154b8e80941Smrg}
4155b8e80941Smrg
4156b8e80941Smrg#define GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_PS_length      2
4157b8e80941Smrg#define GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_PS_length_bias      2
4158b8e80941Smrg#define GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_PS_header\
4159b8e80941Smrg   .DWordLength                         =      0,  \
4160b8e80941Smrg   ._3DCommandSubOpcode                 =     22,  \
4161b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
4162b8e80941Smrg   .CommandSubType                      =      3,  \
4163b8e80941Smrg   .CommandType                         =      3
4164b8e80941Smrg
4165b8e80941Smrgstruct GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_PS {
4166b8e80941Smrg   uint32_t                             DWordLength;
4167b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4168b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4169b8e80941Smrg   uint32_t                             CommandSubType;
4170b8e80941Smrg   uint32_t                             CommandType;
4171b8e80941Smrg   uint32_t                             ConstantBufferSize;
4172b8e80941Smrg   uint32_t                             ConstantBufferOffset;
4173b8e80941Smrg};
4174b8e80941Smrg
4175b8e80941Smrgstatic inline void
4176b8e80941SmrgGEN8_3DSTATE_PUSH_CONSTANT_ALLOC_PS_pack(__attribute__((unused)) __gen_user_data *data,
4177b8e80941Smrg                                         __attribute__((unused)) void * restrict dst,
4178b8e80941Smrg                                         __attribute__((unused)) const struct GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_PS * restrict values)
4179b8e80941Smrg{
4180b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4181b8e80941Smrg
4182b8e80941Smrg   dw[0] =
4183b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4184b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4185b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4186b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4187b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4188b8e80941Smrg
4189b8e80941Smrg   dw[1] =
4190b8e80941Smrg      __gen_uint(values->ConstantBufferSize, 0, 5) |
4191b8e80941Smrg      __gen_uint(values->ConstantBufferOffset, 16, 20);
4192b8e80941Smrg}
4193b8e80941Smrg
4194b8e80941Smrg#define GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_VS_length      2
4195b8e80941Smrg#define GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_VS_length_bias      2
4196b8e80941Smrg#define GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_VS_header\
4197b8e80941Smrg   .DWordLength                         =      0,  \
4198b8e80941Smrg   ._3DCommandSubOpcode                 =     18,  \
4199b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
4200b8e80941Smrg   .CommandSubType                      =      3,  \
4201b8e80941Smrg   .CommandType                         =      3
4202b8e80941Smrg
4203b8e80941Smrgstruct GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_VS {
4204b8e80941Smrg   uint32_t                             DWordLength;
4205b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4206b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4207b8e80941Smrg   uint32_t                             CommandSubType;
4208b8e80941Smrg   uint32_t                             CommandType;
4209b8e80941Smrg   uint32_t                             ConstantBufferSize;
4210b8e80941Smrg   uint32_t                             ConstantBufferOffset;
4211b8e80941Smrg};
4212b8e80941Smrg
4213b8e80941Smrgstatic inline void
4214b8e80941SmrgGEN8_3DSTATE_PUSH_CONSTANT_ALLOC_VS_pack(__attribute__((unused)) __gen_user_data *data,
4215b8e80941Smrg                                         __attribute__((unused)) void * restrict dst,
4216b8e80941Smrg                                         __attribute__((unused)) const struct GEN8_3DSTATE_PUSH_CONSTANT_ALLOC_VS * restrict values)
4217b8e80941Smrg{
4218b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4219b8e80941Smrg
4220b8e80941Smrg   dw[0] =
4221b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4222b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4223b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4224b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4225b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4226b8e80941Smrg
4227b8e80941Smrg   dw[1] =
4228b8e80941Smrg      __gen_uint(values->ConstantBufferSize, 0, 5) |
4229b8e80941Smrg      __gen_uint(values->ConstantBufferOffset, 16, 20);
4230b8e80941Smrg}
4231b8e80941Smrg
4232b8e80941Smrg#define GEN8_3DSTATE_RASTER_length             5
4233b8e80941Smrg#define GEN8_3DSTATE_RASTER_length_bias        2
4234b8e80941Smrg#define GEN8_3DSTATE_RASTER_header              \
4235b8e80941Smrg   .DWordLength                         =      3,  \
4236b8e80941Smrg   ._3DCommandSubOpcode                 =     80,  \
4237b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4238b8e80941Smrg   .CommandSubType                      =      3,  \
4239b8e80941Smrg   .CommandType                         =      3
4240b8e80941Smrg
4241b8e80941Smrgstruct GEN8_3DSTATE_RASTER {
4242b8e80941Smrg   uint32_t                             DWordLength;
4243b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4244b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4245b8e80941Smrg   uint32_t                             CommandSubType;
4246b8e80941Smrg   uint32_t                             CommandType;
4247b8e80941Smrg   bool                                 ViewportZClipTestEnable;
4248b8e80941Smrg   bool                                 ScissorRectangleEnable;
4249b8e80941Smrg   bool                                 AntialiasingEnable;
4250b8e80941Smrg   uint32_t                             BackFaceFillMode;
4251b8e80941Smrg#define FILL_MODE_SOLID                          0
4252b8e80941Smrg#define FILL_MODE_WIREFRAME                      1
4253b8e80941Smrg#define FILL_MODE_POINT                          2
4254b8e80941Smrg   uint32_t                             FrontFaceFillMode;
4255b8e80941Smrg#define FILL_MODE_SOLID                          0
4256b8e80941Smrg#define FILL_MODE_WIREFRAME                      1
4257b8e80941Smrg#define FILL_MODE_POINT                          2
4258b8e80941Smrg   bool                                 GlobalDepthOffsetEnablePoint;
4259b8e80941Smrg   bool                                 GlobalDepthOffsetEnableWireframe;
4260b8e80941Smrg   bool                                 GlobalDepthOffsetEnableSolid;
4261b8e80941Smrg   uint32_t                             DXMultisampleRasterizationMode;
4262b8e80941Smrg#define MSRASTMODE_OFF_PIXEL                     0
4263b8e80941Smrg#define MSRASTMODE_OFF_PATTERN                   1
4264b8e80941Smrg#define MSRASTMODE_ON_PIXEL                      2
4265b8e80941Smrg#define MSRASTMODE_ON_PATTERN                    3
4266b8e80941Smrg   bool                                 DXMultisampleRasterizationEnable;
4267b8e80941Smrg   bool                                 SmoothPointEnable;
4268b8e80941Smrg   uint32_t                             ForceMultisampling;
4269b8e80941Smrg   uint32_t                             CullMode;
4270b8e80941Smrg#define CULLMODE_BOTH                            0
4271b8e80941Smrg#define CULLMODE_NONE                            1
4272b8e80941Smrg#define CULLMODE_FRONT                           2
4273b8e80941Smrg#define CULLMODE_BACK                            3
4274b8e80941Smrg   uint32_t                             ForcedSampleCount;
4275b8e80941Smrg#define FSC_NUMRASTSAMPLES_0                     0
4276b8e80941Smrg#define FSC_NUMRASTSAMPLES_1                     1
4277b8e80941Smrg#define FSC_NUMRASTSAMPLES_2                     2
4278b8e80941Smrg#define FSC_NUMRASTSAMPLES_4                     3
4279b8e80941Smrg#define FSC_NUMRASTSAMPLES_8                     4
4280b8e80941Smrg#define FSC_NUMRASTSAMPLES_16                    5
4281b8e80941Smrg   uint32_t                             FrontWinding;
4282b8e80941Smrg#define Clockwise                                0
4283b8e80941Smrg#define CounterClockwise                         1
4284b8e80941Smrg   uint32_t                             APIMode;
4285b8e80941Smrg#define DX9OGL                                   0
4286b8e80941Smrg#define DX100                                    1
4287b8e80941Smrg#define DX101                                    2
4288b8e80941Smrg   float                                GlobalDepthOffsetConstant;
4289b8e80941Smrg   float                                GlobalDepthOffsetScale;
4290b8e80941Smrg   float                                GlobalDepthOffsetClamp;
4291b8e80941Smrg};
4292b8e80941Smrg
4293b8e80941Smrgstatic inline void
4294b8e80941SmrgGEN8_3DSTATE_RASTER_pack(__attribute__((unused)) __gen_user_data *data,
4295b8e80941Smrg                         __attribute__((unused)) void * restrict dst,
4296b8e80941Smrg                         __attribute__((unused)) const struct GEN8_3DSTATE_RASTER * restrict values)
4297b8e80941Smrg{
4298b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4299b8e80941Smrg
4300b8e80941Smrg   dw[0] =
4301b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4302b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4303b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4304b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4305b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4306b8e80941Smrg
4307b8e80941Smrg   dw[1] =
4308b8e80941Smrg      __gen_uint(values->ViewportZClipTestEnable, 0, 0) |
4309b8e80941Smrg      __gen_uint(values->ScissorRectangleEnable, 1, 1) |
4310b8e80941Smrg      __gen_uint(values->AntialiasingEnable, 2, 2) |
4311b8e80941Smrg      __gen_uint(values->BackFaceFillMode, 3, 4) |
4312b8e80941Smrg      __gen_uint(values->FrontFaceFillMode, 5, 6) |
4313b8e80941Smrg      __gen_uint(values->GlobalDepthOffsetEnablePoint, 7, 7) |
4314b8e80941Smrg      __gen_uint(values->GlobalDepthOffsetEnableWireframe, 8, 8) |
4315b8e80941Smrg      __gen_uint(values->GlobalDepthOffsetEnableSolid, 9, 9) |
4316b8e80941Smrg      __gen_uint(values->DXMultisampleRasterizationMode, 10, 11) |
4317b8e80941Smrg      __gen_uint(values->DXMultisampleRasterizationEnable, 12, 12) |
4318b8e80941Smrg      __gen_uint(values->SmoothPointEnable, 13, 13) |
4319b8e80941Smrg      __gen_uint(values->ForceMultisampling, 14, 14) |
4320b8e80941Smrg      __gen_uint(values->CullMode, 16, 17) |
4321b8e80941Smrg      __gen_uint(values->ForcedSampleCount, 18, 20) |
4322b8e80941Smrg      __gen_uint(values->FrontWinding, 21, 21) |
4323b8e80941Smrg      __gen_uint(values->APIMode, 22, 23);
4324b8e80941Smrg
4325b8e80941Smrg   dw[2] =
4326b8e80941Smrg      __gen_float(values->GlobalDepthOffsetConstant);
4327b8e80941Smrg
4328b8e80941Smrg   dw[3] =
4329b8e80941Smrg      __gen_float(values->GlobalDepthOffsetScale);
4330b8e80941Smrg
4331b8e80941Smrg   dw[4] =
4332b8e80941Smrg      __gen_float(values->GlobalDepthOffsetClamp);
4333b8e80941Smrg}
4334b8e80941Smrg
4335b8e80941Smrg#define GEN8_3DSTATE_SAMPLER_PALETTE_LOAD0_length_bias      2
4336b8e80941Smrg#define GEN8_3DSTATE_SAMPLER_PALETTE_LOAD0_header\
4337b8e80941Smrg   ._3DCommandSubOpcode                 =      2,  \
4338b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
4339b8e80941Smrg   .CommandSubType                      =      3,  \
4340b8e80941Smrg   .CommandType                         =      3
4341b8e80941Smrg
4342b8e80941Smrgstruct GEN8_3DSTATE_SAMPLER_PALETTE_LOAD0 {
4343b8e80941Smrg   uint32_t                             DWordLength;
4344b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4345b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4346b8e80941Smrg   uint32_t                             CommandSubType;
4347b8e80941Smrg   uint32_t                             CommandType;
4348b8e80941Smrg   /* variable length fields follow */
4349b8e80941Smrg};
4350b8e80941Smrg
4351b8e80941Smrgstatic inline void
4352b8e80941SmrgGEN8_3DSTATE_SAMPLER_PALETTE_LOAD0_pack(__attribute__((unused)) __gen_user_data *data,
4353b8e80941Smrg                                        __attribute__((unused)) void * restrict dst,
4354b8e80941Smrg                                        __attribute__((unused)) const struct GEN8_3DSTATE_SAMPLER_PALETTE_LOAD0 * restrict values)
4355b8e80941Smrg{
4356b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4357b8e80941Smrg
4358b8e80941Smrg   dw[0] =
4359b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4360b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4361b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4362b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4363b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4364b8e80941Smrg}
4365b8e80941Smrg
4366b8e80941Smrg#define GEN8_3DSTATE_SAMPLER_PALETTE_LOAD1_length_bias      2
4367b8e80941Smrg#define GEN8_3DSTATE_SAMPLER_PALETTE_LOAD1_header\
4368b8e80941Smrg   .DWordLength                         =      0,  \
4369b8e80941Smrg   ._3DCommandSubOpcode                 =     12,  \
4370b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
4371b8e80941Smrg   .CommandSubType                      =      3,  \
4372b8e80941Smrg   .CommandType                         =      3
4373b8e80941Smrg
4374b8e80941Smrgstruct GEN8_3DSTATE_SAMPLER_PALETTE_LOAD1 {
4375b8e80941Smrg   uint32_t                             DWordLength;
4376b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4377b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4378b8e80941Smrg   uint32_t                             CommandSubType;
4379b8e80941Smrg   uint32_t                             CommandType;
4380b8e80941Smrg   /* variable length fields follow */
4381b8e80941Smrg};
4382b8e80941Smrg
4383b8e80941Smrgstatic inline void
4384b8e80941SmrgGEN8_3DSTATE_SAMPLER_PALETTE_LOAD1_pack(__attribute__((unused)) __gen_user_data *data,
4385b8e80941Smrg                                        __attribute__((unused)) void * restrict dst,
4386b8e80941Smrg                                        __attribute__((unused)) const struct GEN8_3DSTATE_SAMPLER_PALETTE_LOAD1 * restrict values)
4387b8e80941Smrg{
4388b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4389b8e80941Smrg
4390b8e80941Smrg   dw[0] =
4391b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4392b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4393b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4394b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4395b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4396b8e80941Smrg}
4397b8e80941Smrg
4398b8e80941Smrg#define GEN8_3DSTATE_SAMPLER_STATE_POINTERS_DS_length      2
4399b8e80941Smrg#define GEN8_3DSTATE_SAMPLER_STATE_POINTERS_DS_length_bias      2
4400b8e80941Smrg#define GEN8_3DSTATE_SAMPLER_STATE_POINTERS_DS_header\
4401b8e80941Smrg   .DWordLength                         =      0,  \
4402b8e80941Smrg   ._3DCommandSubOpcode                 =     45,  \
4403b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4404b8e80941Smrg   .CommandSubType                      =      3,  \
4405b8e80941Smrg   .CommandType                         =      3
4406b8e80941Smrg
4407b8e80941Smrgstruct GEN8_3DSTATE_SAMPLER_STATE_POINTERS_DS {
4408b8e80941Smrg   uint32_t                             DWordLength;
4409b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4410b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4411b8e80941Smrg   uint32_t                             CommandSubType;
4412b8e80941Smrg   uint32_t                             CommandType;
4413b8e80941Smrg   uint64_t                             PointertoDSSamplerState;
4414b8e80941Smrg};
4415b8e80941Smrg
4416b8e80941Smrgstatic inline void
4417b8e80941SmrgGEN8_3DSTATE_SAMPLER_STATE_POINTERS_DS_pack(__attribute__((unused)) __gen_user_data *data,
4418b8e80941Smrg                                            __attribute__((unused)) void * restrict dst,
4419b8e80941Smrg                                            __attribute__((unused)) const struct GEN8_3DSTATE_SAMPLER_STATE_POINTERS_DS * restrict values)
4420b8e80941Smrg{
4421b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4422b8e80941Smrg
4423b8e80941Smrg   dw[0] =
4424b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4425b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4426b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4427b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4428b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4429b8e80941Smrg
4430b8e80941Smrg   dw[1] =
4431b8e80941Smrg      __gen_offset(values->PointertoDSSamplerState, 5, 31);
4432b8e80941Smrg}
4433b8e80941Smrg
4434b8e80941Smrg#define GEN8_3DSTATE_SAMPLER_STATE_POINTERS_GS_length      2
4435b8e80941Smrg#define GEN8_3DSTATE_SAMPLER_STATE_POINTERS_GS_length_bias      2
4436b8e80941Smrg#define GEN8_3DSTATE_SAMPLER_STATE_POINTERS_GS_header\
4437b8e80941Smrg   .DWordLength                         =      0,  \
4438b8e80941Smrg   ._3DCommandSubOpcode                 =     46,  \
4439b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4440b8e80941Smrg   .CommandSubType                      =      3,  \
4441b8e80941Smrg   .CommandType                         =      3
4442b8e80941Smrg
4443b8e80941Smrgstruct GEN8_3DSTATE_SAMPLER_STATE_POINTERS_GS {
4444b8e80941Smrg   uint32_t                             DWordLength;
4445b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4446b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4447b8e80941Smrg   uint32_t                             CommandSubType;
4448b8e80941Smrg   uint32_t                             CommandType;
4449b8e80941Smrg   uint64_t                             PointertoGSSamplerState;
4450b8e80941Smrg};
4451b8e80941Smrg
4452b8e80941Smrgstatic inline void
4453b8e80941SmrgGEN8_3DSTATE_SAMPLER_STATE_POINTERS_GS_pack(__attribute__((unused)) __gen_user_data *data,
4454b8e80941Smrg                                            __attribute__((unused)) void * restrict dst,
4455b8e80941Smrg                                            __attribute__((unused)) const struct GEN8_3DSTATE_SAMPLER_STATE_POINTERS_GS * restrict values)
4456b8e80941Smrg{
4457b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4458b8e80941Smrg
4459b8e80941Smrg   dw[0] =
4460b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4461b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4462b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4463b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4464b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4465b8e80941Smrg
4466b8e80941Smrg   dw[1] =
4467b8e80941Smrg      __gen_offset(values->PointertoGSSamplerState, 5, 31);
4468b8e80941Smrg}
4469b8e80941Smrg
4470b8e80941Smrg#define GEN8_3DSTATE_SAMPLER_STATE_POINTERS_HS_length      2
4471b8e80941Smrg#define GEN8_3DSTATE_SAMPLER_STATE_POINTERS_HS_length_bias      2
4472b8e80941Smrg#define GEN8_3DSTATE_SAMPLER_STATE_POINTERS_HS_header\
4473b8e80941Smrg   .DWordLength                         =      0,  \
4474b8e80941Smrg   ._3DCommandSubOpcode                 =     44,  \
4475b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4476b8e80941Smrg   .CommandSubType                      =      3,  \
4477b8e80941Smrg   .CommandType                         =      3
4478b8e80941Smrg
4479b8e80941Smrgstruct GEN8_3DSTATE_SAMPLER_STATE_POINTERS_HS {
4480b8e80941Smrg   uint32_t                             DWordLength;
4481b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4482b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4483b8e80941Smrg   uint32_t                             CommandSubType;
4484b8e80941Smrg   uint32_t                             CommandType;
4485b8e80941Smrg   uint64_t                             PointertoHSSamplerState;
4486b8e80941Smrg};
4487b8e80941Smrg
4488b8e80941Smrgstatic inline void
4489b8e80941SmrgGEN8_3DSTATE_SAMPLER_STATE_POINTERS_HS_pack(__attribute__((unused)) __gen_user_data *data,
4490b8e80941Smrg                                            __attribute__((unused)) void * restrict dst,
4491b8e80941Smrg                                            __attribute__((unused)) const struct GEN8_3DSTATE_SAMPLER_STATE_POINTERS_HS * restrict values)
4492b8e80941Smrg{
4493b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4494b8e80941Smrg
4495b8e80941Smrg   dw[0] =
4496b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4497b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4498b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4499b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4500b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4501b8e80941Smrg
4502b8e80941Smrg   dw[1] =
4503b8e80941Smrg      __gen_offset(values->PointertoHSSamplerState, 5, 31);
4504b8e80941Smrg}
4505b8e80941Smrg
4506b8e80941Smrg#define GEN8_3DSTATE_SAMPLER_STATE_POINTERS_PS_length      2
4507b8e80941Smrg#define GEN8_3DSTATE_SAMPLER_STATE_POINTERS_PS_length_bias      2
4508b8e80941Smrg#define GEN8_3DSTATE_SAMPLER_STATE_POINTERS_PS_header\
4509b8e80941Smrg   .DWordLength                         =      0,  \
4510b8e80941Smrg   ._3DCommandSubOpcode                 =     47,  \
4511b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4512b8e80941Smrg   .CommandSubType                      =      3,  \
4513b8e80941Smrg   .CommandType                         =      3
4514b8e80941Smrg
4515b8e80941Smrgstruct GEN8_3DSTATE_SAMPLER_STATE_POINTERS_PS {
4516b8e80941Smrg   uint32_t                             DWordLength;
4517b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4518b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4519b8e80941Smrg   uint32_t                             CommandSubType;
4520b8e80941Smrg   uint32_t                             CommandType;
4521b8e80941Smrg   uint64_t                             PointertoPSSamplerState;
4522b8e80941Smrg};
4523b8e80941Smrg
4524b8e80941Smrgstatic inline void
4525b8e80941SmrgGEN8_3DSTATE_SAMPLER_STATE_POINTERS_PS_pack(__attribute__((unused)) __gen_user_data *data,
4526b8e80941Smrg                                            __attribute__((unused)) void * restrict dst,
4527b8e80941Smrg                                            __attribute__((unused)) const struct GEN8_3DSTATE_SAMPLER_STATE_POINTERS_PS * restrict values)
4528b8e80941Smrg{
4529b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4530b8e80941Smrg
4531b8e80941Smrg   dw[0] =
4532b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4533b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4534b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4535b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4536b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4537b8e80941Smrg
4538b8e80941Smrg   dw[1] =
4539b8e80941Smrg      __gen_offset(values->PointertoPSSamplerState, 5, 31);
4540b8e80941Smrg}
4541b8e80941Smrg
4542b8e80941Smrg#define GEN8_3DSTATE_SAMPLER_STATE_POINTERS_VS_length      2
4543b8e80941Smrg#define GEN8_3DSTATE_SAMPLER_STATE_POINTERS_VS_length_bias      2
4544b8e80941Smrg#define GEN8_3DSTATE_SAMPLER_STATE_POINTERS_VS_header\
4545b8e80941Smrg   .DWordLength                         =      0,  \
4546b8e80941Smrg   ._3DCommandSubOpcode                 =     43,  \
4547b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4548b8e80941Smrg   .CommandSubType                      =      3,  \
4549b8e80941Smrg   .CommandType                         =      3
4550b8e80941Smrg
4551b8e80941Smrgstruct GEN8_3DSTATE_SAMPLER_STATE_POINTERS_VS {
4552b8e80941Smrg   uint32_t                             DWordLength;
4553b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4554b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4555b8e80941Smrg   uint32_t                             CommandSubType;
4556b8e80941Smrg   uint32_t                             CommandType;
4557b8e80941Smrg   uint64_t                             PointertoVSSamplerState;
4558b8e80941Smrg};
4559b8e80941Smrg
4560b8e80941Smrgstatic inline void
4561b8e80941SmrgGEN8_3DSTATE_SAMPLER_STATE_POINTERS_VS_pack(__attribute__((unused)) __gen_user_data *data,
4562b8e80941Smrg                                            __attribute__((unused)) void * restrict dst,
4563b8e80941Smrg                                            __attribute__((unused)) const struct GEN8_3DSTATE_SAMPLER_STATE_POINTERS_VS * restrict values)
4564b8e80941Smrg{
4565b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4566b8e80941Smrg
4567b8e80941Smrg   dw[0] =
4568b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4569b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4570b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4571b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4572b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4573b8e80941Smrg
4574b8e80941Smrg   dw[1] =
4575b8e80941Smrg      __gen_offset(values->PointertoVSSamplerState, 5, 31);
4576b8e80941Smrg}
4577b8e80941Smrg
4578b8e80941Smrg#define GEN8_3DSTATE_SAMPLE_MASK_length        2
4579b8e80941Smrg#define GEN8_3DSTATE_SAMPLE_MASK_length_bias      2
4580b8e80941Smrg#define GEN8_3DSTATE_SAMPLE_MASK_header         \
4581b8e80941Smrg   .DWordLength                         =      0,  \
4582b8e80941Smrg   ._3DCommandSubOpcode                 =     24,  \
4583b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4584b8e80941Smrg   .CommandSubType                      =      3,  \
4585b8e80941Smrg   .CommandType                         =      3
4586b8e80941Smrg
4587b8e80941Smrgstruct GEN8_3DSTATE_SAMPLE_MASK {
4588b8e80941Smrg   uint32_t                             DWordLength;
4589b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4590b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4591b8e80941Smrg   uint32_t                             CommandSubType;
4592b8e80941Smrg   uint32_t                             CommandType;
4593b8e80941Smrg   uint32_t                             SampleMask;
4594b8e80941Smrg};
4595b8e80941Smrg
4596b8e80941Smrgstatic inline void
4597b8e80941SmrgGEN8_3DSTATE_SAMPLE_MASK_pack(__attribute__((unused)) __gen_user_data *data,
4598b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
4599b8e80941Smrg                              __attribute__((unused)) const struct GEN8_3DSTATE_SAMPLE_MASK * restrict values)
4600b8e80941Smrg{
4601b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4602b8e80941Smrg
4603b8e80941Smrg   dw[0] =
4604b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4605b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4606b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4607b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4608b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4609b8e80941Smrg
4610b8e80941Smrg   dw[1] =
4611b8e80941Smrg      __gen_uint(values->SampleMask, 0, 15);
4612b8e80941Smrg}
4613b8e80941Smrg
4614b8e80941Smrg#define GEN8_3DSTATE_SAMPLE_PATTERN_length      9
4615b8e80941Smrg#define GEN8_3DSTATE_SAMPLE_PATTERN_length_bias      2
4616b8e80941Smrg#define GEN8_3DSTATE_SAMPLE_PATTERN_header      \
4617b8e80941Smrg   .DWordLength                         =      7,  \
4618b8e80941Smrg   ._3DCommandSubOpcode                 =     28,  \
4619b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
4620b8e80941Smrg   .CommandSubType                      =      3,  \
4621b8e80941Smrg   .CommandType                         =      3
4622b8e80941Smrg
4623b8e80941Smrgstruct GEN8_3DSTATE_SAMPLE_PATTERN {
4624b8e80941Smrg   uint32_t                             DWordLength;
4625b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4626b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4627b8e80941Smrg   uint32_t                             CommandSubType;
4628b8e80941Smrg   uint32_t                             CommandType;
4629b8e80941Smrg   float                                _8xSample4YOffset;
4630b8e80941Smrg   float                                _8xSample4XOffset;
4631b8e80941Smrg   float                                _8xSample5YOffset;
4632b8e80941Smrg   float                                _8xSample5XOffset;
4633b8e80941Smrg   float                                _8xSample6YOffset;
4634b8e80941Smrg   float                                _8xSample6XOffset;
4635b8e80941Smrg   float                                _8xSample7YOffset;
4636b8e80941Smrg   float                                _8xSample7XOffset;
4637b8e80941Smrg   float                                _8xSample0YOffset;
4638b8e80941Smrg   float                                _8xSample0XOffset;
4639b8e80941Smrg   float                                _8xSample1YOffset;
4640b8e80941Smrg   float                                _8xSample1XOffset;
4641b8e80941Smrg   float                                _8xSample2YOffset;
4642b8e80941Smrg   float                                _8xSample2XOffset;
4643b8e80941Smrg   float                                _8xSample3YOffset;
4644b8e80941Smrg   float                                _8xSample3XOffset;
4645b8e80941Smrg   float                                _4xSample0YOffset;
4646b8e80941Smrg   float                                _4xSample0XOffset;
4647b8e80941Smrg   float                                _4xSample1YOffset;
4648b8e80941Smrg   float                                _4xSample1XOffset;
4649b8e80941Smrg   float                                _4xSample2YOffset;
4650b8e80941Smrg   float                                _4xSample2XOffset;
4651b8e80941Smrg   float                                _4xSample3YOffset;
4652b8e80941Smrg   float                                _4xSample3XOffset;
4653b8e80941Smrg   float                                _2xSample0YOffset;
4654b8e80941Smrg   float                                _2xSample0XOffset;
4655b8e80941Smrg   float                                _2xSample1YOffset;
4656b8e80941Smrg   float                                _2xSample1XOffset;
4657b8e80941Smrg   float                                _1xSample0YOffset;
4658b8e80941Smrg   float                                _1xSample0XOffset;
4659b8e80941Smrg};
4660b8e80941Smrg
4661b8e80941Smrgstatic inline void
4662b8e80941SmrgGEN8_3DSTATE_SAMPLE_PATTERN_pack(__attribute__((unused)) __gen_user_data *data,
4663b8e80941Smrg                                 __attribute__((unused)) void * restrict dst,
4664b8e80941Smrg                                 __attribute__((unused)) const struct GEN8_3DSTATE_SAMPLE_PATTERN * restrict values)
4665b8e80941Smrg{
4666b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4667b8e80941Smrg
4668b8e80941Smrg   dw[0] =
4669b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4670b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4671b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4672b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4673b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4674b8e80941Smrg
4675b8e80941Smrg   dw[1] = 0;
4676b8e80941Smrg
4677b8e80941Smrg   dw[2] = 0;
4678b8e80941Smrg
4679b8e80941Smrg   dw[3] = 0;
4680b8e80941Smrg
4681b8e80941Smrg   dw[4] = 0;
4682b8e80941Smrg
4683b8e80941Smrg   dw[5] =
4684b8e80941Smrg      __gen_ufixed(values->_8xSample4YOffset, 0, 3, 4) |
4685b8e80941Smrg      __gen_ufixed(values->_8xSample4XOffset, 4, 7, 4) |
4686b8e80941Smrg      __gen_ufixed(values->_8xSample5YOffset, 8, 11, 4) |
4687b8e80941Smrg      __gen_ufixed(values->_8xSample5XOffset, 12, 15, 4) |
4688b8e80941Smrg      __gen_ufixed(values->_8xSample6YOffset, 16, 19, 4) |
4689b8e80941Smrg      __gen_ufixed(values->_8xSample6XOffset, 20, 23, 4) |
4690b8e80941Smrg      __gen_ufixed(values->_8xSample7YOffset, 24, 27, 4) |
4691b8e80941Smrg      __gen_ufixed(values->_8xSample7XOffset, 28, 31, 4);
4692b8e80941Smrg
4693b8e80941Smrg   dw[6] =
4694b8e80941Smrg      __gen_ufixed(values->_8xSample0YOffset, 0, 3, 4) |
4695b8e80941Smrg      __gen_ufixed(values->_8xSample0XOffset, 4, 7, 4) |
4696b8e80941Smrg      __gen_ufixed(values->_8xSample1YOffset, 8, 11, 4) |
4697b8e80941Smrg      __gen_ufixed(values->_8xSample1XOffset, 12, 15, 4) |
4698b8e80941Smrg      __gen_ufixed(values->_8xSample2YOffset, 16, 19, 4) |
4699b8e80941Smrg      __gen_ufixed(values->_8xSample2XOffset, 20, 23, 4) |
4700b8e80941Smrg      __gen_ufixed(values->_8xSample3YOffset, 24, 27, 4) |
4701b8e80941Smrg      __gen_ufixed(values->_8xSample3XOffset, 28, 31, 4);
4702b8e80941Smrg
4703b8e80941Smrg   dw[7] =
4704b8e80941Smrg      __gen_ufixed(values->_4xSample0YOffset, 0, 3, 4) |
4705b8e80941Smrg      __gen_ufixed(values->_4xSample0XOffset, 4, 7, 4) |
4706b8e80941Smrg      __gen_ufixed(values->_4xSample1YOffset, 8, 11, 4) |
4707b8e80941Smrg      __gen_ufixed(values->_4xSample1XOffset, 12, 15, 4) |
4708b8e80941Smrg      __gen_ufixed(values->_4xSample2YOffset, 16, 19, 4) |
4709b8e80941Smrg      __gen_ufixed(values->_4xSample2XOffset, 20, 23, 4) |
4710b8e80941Smrg      __gen_ufixed(values->_4xSample3YOffset, 24, 27, 4) |
4711b8e80941Smrg      __gen_ufixed(values->_4xSample3XOffset, 28, 31, 4);
4712b8e80941Smrg
4713b8e80941Smrg   dw[8] =
4714b8e80941Smrg      __gen_ufixed(values->_2xSample0YOffset, 0, 3, 4) |
4715b8e80941Smrg      __gen_ufixed(values->_2xSample0XOffset, 4, 7, 4) |
4716b8e80941Smrg      __gen_ufixed(values->_2xSample1YOffset, 8, 11, 4) |
4717b8e80941Smrg      __gen_ufixed(values->_2xSample1XOffset, 12, 15, 4) |
4718b8e80941Smrg      __gen_ufixed(values->_1xSample0YOffset, 16, 19, 4) |
4719b8e80941Smrg      __gen_ufixed(values->_1xSample0XOffset, 20, 23, 4);
4720b8e80941Smrg}
4721b8e80941Smrg
4722b8e80941Smrg#define GEN8_3DSTATE_SBE_length                4
4723b8e80941Smrg#define GEN8_3DSTATE_SBE_length_bias           2
4724b8e80941Smrg#define GEN8_3DSTATE_SBE_header                 \
4725b8e80941Smrg   .DWordLength                         =      2,  \
4726b8e80941Smrg   ._3DCommandSubOpcode                 =     31,  \
4727b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4728b8e80941Smrg   .CommandSubType                      =      3,  \
4729b8e80941Smrg   .CommandType                         =      3
4730b8e80941Smrg
4731b8e80941Smrgstruct GEN8_3DSTATE_SBE {
4732b8e80941Smrg   uint32_t                             DWordLength;
4733b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4734b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4735b8e80941Smrg   uint32_t                             CommandSubType;
4736b8e80941Smrg   uint32_t                             CommandType;
4737b8e80941Smrg   uint32_t                             PrimitiveIDOverrideAttributeSelect;
4738b8e80941Smrg   uint32_t                             VertexURBEntryReadOffset;
4739b8e80941Smrg   uint32_t                             VertexURBEntryReadLength;
4740b8e80941Smrg   bool                                 PrimitiveIDOverrideComponentX;
4741b8e80941Smrg   bool                                 PrimitiveIDOverrideComponentY;
4742b8e80941Smrg   bool                                 PrimitiveIDOverrideComponentZ;
4743b8e80941Smrg   bool                                 PrimitiveIDOverrideComponentW;
4744b8e80941Smrg   uint32_t                             PointSpriteTextureCoordinateOrigin;
4745b8e80941Smrg#define UPPERLEFT                                0
4746b8e80941Smrg#define LOWERLEFT                                1
4747b8e80941Smrg   bool                                 AttributeSwizzleEnable;
4748b8e80941Smrg   uint32_t                             NumberofSFOutputAttributes;
4749b8e80941Smrg   bool                                 ForceVertexURBEntryReadOffset;
4750b8e80941Smrg   bool                                 ForceVertexURBEntryReadLength;
4751b8e80941Smrg   uint32_t                             PointSpriteTextureCoordinateEnable;
4752b8e80941Smrg   uint32_t                             ConstantInterpolationEnable;
4753b8e80941Smrg};
4754b8e80941Smrg
4755b8e80941Smrgstatic inline void
4756b8e80941SmrgGEN8_3DSTATE_SBE_pack(__attribute__((unused)) __gen_user_data *data,
4757b8e80941Smrg                      __attribute__((unused)) void * restrict dst,
4758b8e80941Smrg                      __attribute__((unused)) const struct GEN8_3DSTATE_SBE * restrict values)
4759b8e80941Smrg{
4760b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4761b8e80941Smrg
4762b8e80941Smrg   dw[0] =
4763b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4764b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4765b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4766b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4767b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4768b8e80941Smrg
4769b8e80941Smrg   dw[1] =
4770b8e80941Smrg      __gen_uint(values->PrimitiveIDOverrideAttributeSelect, 0, 4) |
4771b8e80941Smrg      __gen_uint(values->VertexURBEntryReadOffset, 5, 10) |
4772b8e80941Smrg      __gen_uint(values->VertexURBEntryReadLength, 11, 15) |
4773b8e80941Smrg      __gen_uint(values->PrimitiveIDOverrideComponentX, 16, 16) |
4774b8e80941Smrg      __gen_uint(values->PrimitiveIDOverrideComponentY, 17, 17) |
4775b8e80941Smrg      __gen_uint(values->PrimitiveIDOverrideComponentZ, 18, 18) |
4776b8e80941Smrg      __gen_uint(values->PrimitiveIDOverrideComponentW, 19, 19) |
4777b8e80941Smrg      __gen_uint(values->PointSpriteTextureCoordinateOrigin, 20, 20) |
4778b8e80941Smrg      __gen_uint(values->AttributeSwizzleEnable, 21, 21) |
4779b8e80941Smrg      __gen_uint(values->NumberofSFOutputAttributes, 22, 27) |
4780b8e80941Smrg      __gen_uint(values->ForceVertexURBEntryReadOffset, 28, 28) |
4781b8e80941Smrg      __gen_uint(values->ForceVertexURBEntryReadLength, 29, 29);
4782b8e80941Smrg
4783b8e80941Smrg   dw[2] =
4784b8e80941Smrg      __gen_uint(values->PointSpriteTextureCoordinateEnable, 0, 31);
4785b8e80941Smrg
4786b8e80941Smrg   dw[3] =
4787b8e80941Smrg      __gen_uint(values->ConstantInterpolationEnable, 0, 31);
4788b8e80941Smrg}
4789b8e80941Smrg
4790b8e80941Smrg#define GEN8_3DSTATE_SBE_SWIZ_length          11
4791b8e80941Smrg#define GEN8_3DSTATE_SBE_SWIZ_length_bias      2
4792b8e80941Smrg#define GEN8_3DSTATE_SBE_SWIZ_header            \
4793b8e80941Smrg   .DWordLength                         =      9,  \
4794b8e80941Smrg   ._3DCommandSubOpcode                 =     81,  \
4795b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4796b8e80941Smrg   .CommandSubType                      =      3,  \
4797b8e80941Smrg   .CommandType                         =      3
4798b8e80941Smrg
4799b8e80941Smrgstruct GEN8_3DSTATE_SBE_SWIZ {
4800b8e80941Smrg   uint32_t                             DWordLength;
4801b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4802b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4803b8e80941Smrg   uint32_t                             CommandSubType;
4804b8e80941Smrg   uint32_t                             CommandType;
4805b8e80941Smrg   struct GEN8_SF_OUTPUT_ATTRIBUTE_DETAIL Attribute[16];
4806b8e80941Smrg   uint32_t                             AttributeWrapShortestEnables[16];
4807b8e80941Smrg};
4808b8e80941Smrg
4809b8e80941Smrgstatic inline void
4810b8e80941SmrgGEN8_3DSTATE_SBE_SWIZ_pack(__attribute__((unused)) __gen_user_data *data,
4811b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
4812b8e80941Smrg                           __attribute__((unused)) const struct GEN8_3DSTATE_SBE_SWIZ * restrict values)
4813b8e80941Smrg{
4814b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4815b8e80941Smrg
4816b8e80941Smrg   dw[0] =
4817b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4818b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4819b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4820b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4821b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4822b8e80941Smrg
4823b8e80941Smrg   uint32_t v1_0;
4824b8e80941Smrg   GEN8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v1_0, &values->Attribute[0]);
4825b8e80941Smrg
4826b8e80941Smrg   uint32_t v1_1;
4827b8e80941Smrg   GEN8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v1_1, &values->Attribute[1]);
4828b8e80941Smrg
4829b8e80941Smrg   dw[1] =
4830b8e80941Smrg      __gen_uint(v1_0, 0, 15) |
4831b8e80941Smrg      __gen_uint(v1_1, 16, 31);
4832b8e80941Smrg
4833b8e80941Smrg   uint32_t v2_0;
4834b8e80941Smrg   GEN8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v2_0, &values->Attribute[2]);
4835b8e80941Smrg
4836b8e80941Smrg   uint32_t v2_1;
4837b8e80941Smrg   GEN8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v2_1, &values->Attribute[3]);
4838b8e80941Smrg
4839b8e80941Smrg   dw[2] =
4840b8e80941Smrg      __gen_uint(v2_0, 0, 15) |
4841b8e80941Smrg      __gen_uint(v2_1, 16, 31);
4842b8e80941Smrg
4843b8e80941Smrg   uint32_t v3_0;
4844b8e80941Smrg   GEN8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v3_0, &values->Attribute[4]);
4845b8e80941Smrg
4846b8e80941Smrg   uint32_t v3_1;
4847b8e80941Smrg   GEN8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v3_1, &values->Attribute[5]);
4848b8e80941Smrg
4849b8e80941Smrg   dw[3] =
4850b8e80941Smrg      __gen_uint(v3_0, 0, 15) |
4851b8e80941Smrg      __gen_uint(v3_1, 16, 31);
4852b8e80941Smrg
4853b8e80941Smrg   uint32_t v4_0;
4854b8e80941Smrg   GEN8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v4_0, &values->Attribute[6]);
4855b8e80941Smrg
4856b8e80941Smrg   uint32_t v4_1;
4857b8e80941Smrg   GEN8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v4_1, &values->Attribute[7]);
4858b8e80941Smrg
4859b8e80941Smrg   dw[4] =
4860b8e80941Smrg      __gen_uint(v4_0, 0, 15) |
4861b8e80941Smrg      __gen_uint(v4_1, 16, 31);
4862b8e80941Smrg
4863b8e80941Smrg   uint32_t v5_0;
4864b8e80941Smrg   GEN8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v5_0, &values->Attribute[8]);
4865b8e80941Smrg
4866b8e80941Smrg   uint32_t v5_1;
4867b8e80941Smrg   GEN8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v5_1, &values->Attribute[9]);
4868b8e80941Smrg
4869b8e80941Smrg   dw[5] =
4870b8e80941Smrg      __gen_uint(v5_0, 0, 15) |
4871b8e80941Smrg      __gen_uint(v5_1, 16, 31);
4872b8e80941Smrg
4873b8e80941Smrg   uint32_t v6_0;
4874b8e80941Smrg   GEN8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v6_0, &values->Attribute[10]);
4875b8e80941Smrg
4876b8e80941Smrg   uint32_t v6_1;
4877b8e80941Smrg   GEN8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v6_1, &values->Attribute[11]);
4878b8e80941Smrg
4879b8e80941Smrg   dw[6] =
4880b8e80941Smrg      __gen_uint(v6_0, 0, 15) |
4881b8e80941Smrg      __gen_uint(v6_1, 16, 31);
4882b8e80941Smrg
4883b8e80941Smrg   uint32_t v7_0;
4884b8e80941Smrg   GEN8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v7_0, &values->Attribute[12]);
4885b8e80941Smrg
4886b8e80941Smrg   uint32_t v7_1;
4887b8e80941Smrg   GEN8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v7_1, &values->Attribute[13]);
4888b8e80941Smrg
4889b8e80941Smrg   dw[7] =
4890b8e80941Smrg      __gen_uint(v7_0, 0, 15) |
4891b8e80941Smrg      __gen_uint(v7_1, 16, 31);
4892b8e80941Smrg
4893b8e80941Smrg   uint32_t v8_0;
4894b8e80941Smrg   GEN8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_0, &values->Attribute[14]);
4895b8e80941Smrg
4896b8e80941Smrg   uint32_t v8_1;
4897b8e80941Smrg   GEN8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_1, &values->Attribute[15]);
4898b8e80941Smrg
4899b8e80941Smrg   dw[8] =
4900b8e80941Smrg      __gen_uint(v8_0, 0, 15) |
4901b8e80941Smrg      __gen_uint(v8_1, 16, 31);
4902b8e80941Smrg
4903b8e80941Smrg   dw[9] =
4904b8e80941Smrg      __gen_uint(values->AttributeWrapShortestEnables[0], 0, 3) |
4905b8e80941Smrg      __gen_uint(values->AttributeWrapShortestEnables[1], 4, 7) |
4906b8e80941Smrg      __gen_uint(values->AttributeWrapShortestEnables[2], 8, 11) |
4907b8e80941Smrg      __gen_uint(values->AttributeWrapShortestEnables[3], 12, 15) |
4908b8e80941Smrg      __gen_uint(values->AttributeWrapShortestEnables[4], 16, 19) |
4909b8e80941Smrg      __gen_uint(values->AttributeWrapShortestEnables[5], 20, 23) |
4910b8e80941Smrg      __gen_uint(values->AttributeWrapShortestEnables[6], 24, 27) |
4911b8e80941Smrg      __gen_uint(values->AttributeWrapShortestEnables[7], 28, 31);
4912b8e80941Smrg
4913b8e80941Smrg   dw[10] =
4914b8e80941Smrg      __gen_uint(values->AttributeWrapShortestEnables[8], 0, 3) |
4915b8e80941Smrg      __gen_uint(values->AttributeWrapShortestEnables[9], 4, 7) |
4916b8e80941Smrg      __gen_uint(values->AttributeWrapShortestEnables[10], 8, 11) |
4917b8e80941Smrg      __gen_uint(values->AttributeWrapShortestEnables[11], 12, 15) |
4918b8e80941Smrg      __gen_uint(values->AttributeWrapShortestEnables[12], 16, 19) |
4919b8e80941Smrg      __gen_uint(values->AttributeWrapShortestEnables[13], 20, 23) |
4920b8e80941Smrg      __gen_uint(values->AttributeWrapShortestEnables[14], 24, 27) |
4921b8e80941Smrg      __gen_uint(values->AttributeWrapShortestEnables[15], 28, 31);
4922b8e80941Smrg}
4923b8e80941Smrg
4924b8e80941Smrg#define GEN8_3DSTATE_SCISSOR_STATE_POINTERS_length      2
4925b8e80941Smrg#define GEN8_3DSTATE_SCISSOR_STATE_POINTERS_length_bias      2
4926b8e80941Smrg#define GEN8_3DSTATE_SCISSOR_STATE_POINTERS_header\
4927b8e80941Smrg   .DWordLength                         =      0,  \
4928b8e80941Smrg   ._3DCommandSubOpcode                 =     15,  \
4929b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4930b8e80941Smrg   .CommandSubType                      =      3,  \
4931b8e80941Smrg   .CommandType                         =      3
4932b8e80941Smrg
4933b8e80941Smrgstruct GEN8_3DSTATE_SCISSOR_STATE_POINTERS {
4934b8e80941Smrg   uint32_t                             DWordLength;
4935b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4936b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4937b8e80941Smrg   uint32_t                             CommandSubType;
4938b8e80941Smrg   uint32_t                             CommandType;
4939b8e80941Smrg   uint64_t                             ScissorRectPointer;
4940b8e80941Smrg};
4941b8e80941Smrg
4942b8e80941Smrgstatic inline void
4943b8e80941SmrgGEN8_3DSTATE_SCISSOR_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
4944b8e80941Smrg                                         __attribute__((unused)) void * restrict dst,
4945b8e80941Smrg                                         __attribute__((unused)) const struct GEN8_3DSTATE_SCISSOR_STATE_POINTERS * restrict values)
4946b8e80941Smrg{
4947b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4948b8e80941Smrg
4949b8e80941Smrg   dw[0] =
4950b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4951b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4952b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4953b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4954b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4955b8e80941Smrg
4956b8e80941Smrg   dw[1] =
4957b8e80941Smrg      __gen_offset(values->ScissorRectPointer, 5, 31);
4958b8e80941Smrg}
4959b8e80941Smrg
4960b8e80941Smrg#define GEN8_3DSTATE_SF_length                 4
4961b8e80941Smrg#define GEN8_3DSTATE_SF_length_bias            2
4962b8e80941Smrg#define GEN8_3DSTATE_SF_header                  \
4963b8e80941Smrg   .DWordLength                         =      2,  \
4964b8e80941Smrg   ._3DCommandSubOpcode                 =     19,  \
4965b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4966b8e80941Smrg   .CommandSubType                      =      3,  \
4967b8e80941Smrg   .CommandType                         =      3
4968b8e80941Smrg
4969b8e80941Smrgstruct GEN8_3DSTATE_SF {
4970b8e80941Smrg   uint32_t                             DWordLength;
4971b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4972b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4973b8e80941Smrg   uint32_t                             CommandSubType;
4974b8e80941Smrg   uint32_t                             CommandType;
4975b8e80941Smrg   bool                                 ViewportTransformEnable;
4976b8e80941Smrg   bool                                 StatisticsEnable;
4977b8e80941Smrg   bool                                 LegacyGlobalDepthBiasEnable;
4978b8e80941Smrg   float                                CHVLineWidth;
4979b8e80941Smrg   uint32_t                             LineEndCapAntialiasingRegionWidth;
4980b8e80941Smrg#define _05pixels                                0
4981b8e80941Smrg#define _10pixels                                1
4982b8e80941Smrg#define _20pixels                                2
4983b8e80941Smrg#define _40pixels                                3
4984b8e80941Smrg   float                                LineWidth;
4985b8e80941Smrg   float                                PointWidth;
4986b8e80941Smrg   uint32_t                             PointWidthSource;
4987b8e80941Smrg#define Vertex                                   0
4988b8e80941Smrg#define State                                    1
4989b8e80941Smrg   uint32_t                             VertexSubPixelPrecisionSelect;
4990b8e80941Smrg#define _8Bit                                    0
4991b8e80941Smrg#define _4Bit                                    1
4992b8e80941Smrg   bool                                 SmoothPointEnable;
4993b8e80941Smrg   uint32_t                             AALineDistanceMode;
4994b8e80941Smrg#define AALINEDISTANCE_TRUE                      1
4995b8e80941Smrg   uint32_t                             TriangleFanProvokingVertexSelect;
4996b8e80941Smrg   uint32_t                             LineStripListProvokingVertexSelect;
4997b8e80941Smrg   uint32_t                             TriangleStripListProvokingVertexSelect;
4998b8e80941Smrg   bool                                 LastPixelEnable;
4999b8e80941Smrg};
5000b8e80941Smrg
5001b8e80941Smrgstatic inline void
5002b8e80941SmrgGEN8_3DSTATE_SF_pack(__attribute__((unused)) __gen_user_data *data,
5003b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
5004b8e80941Smrg                     __attribute__((unused)) const struct GEN8_3DSTATE_SF * restrict values)
5005b8e80941Smrg{
5006b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5007b8e80941Smrg
5008b8e80941Smrg   dw[0] =
5009b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5010b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5011b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5012b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
5013b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5014b8e80941Smrg
5015b8e80941Smrg   dw[1] =
5016b8e80941Smrg      __gen_uint(values->ViewportTransformEnable, 1, 1) |
5017b8e80941Smrg      __gen_uint(values->StatisticsEnable, 10, 10) |
5018b8e80941Smrg      __gen_uint(values->LegacyGlobalDepthBiasEnable, 11, 11) |
5019b8e80941Smrg      __gen_ufixed(values->CHVLineWidth, 12, 29, 7);
5020b8e80941Smrg
5021b8e80941Smrg   dw[2] =
5022b8e80941Smrg      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 16, 17) |
5023b8e80941Smrg      __gen_ufixed(values->LineWidth, 18, 27, 7);
5024b8e80941Smrg
5025b8e80941Smrg   dw[3] =
5026b8e80941Smrg      __gen_ufixed(values->PointWidth, 0, 10, 3) |
5027b8e80941Smrg      __gen_uint(values->PointWidthSource, 11, 11) |
5028b8e80941Smrg      __gen_uint(values->VertexSubPixelPrecisionSelect, 12, 12) |
5029b8e80941Smrg      __gen_uint(values->SmoothPointEnable, 13, 13) |
5030b8e80941Smrg      __gen_uint(values->AALineDistanceMode, 14, 14) |
5031b8e80941Smrg      __gen_uint(values->TriangleFanProvokingVertexSelect, 25, 26) |
5032b8e80941Smrg      __gen_uint(values->LineStripListProvokingVertexSelect, 27, 28) |
5033b8e80941Smrg      __gen_uint(values->TriangleStripListProvokingVertexSelect, 29, 30) |
5034b8e80941Smrg      __gen_uint(values->LastPixelEnable, 31, 31);
5035b8e80941Smrg}
5036b8e80941Smrg
5037b8e80941Smrg#define GEN8_3DSTATE_SO_BUFFER_length          8
5038b8e80941Smrg#define GEN8_3DSTATE_SO_BUFFER_length_bias      2
5039b8e80941Smrg#define GEN8_3DSTATE_SO_BUFFER_header           \
5040b8e80941Smrg   .DWordLength                         =      6,  \
5041b8e80941Smrg   ._3DCommandSubOpcode                 =     24,  \
5042b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
5043b8e80941Smrg   .CommandSubType                      =      3,  \
5044b8e80941Smrg   .CommandType                         =      3
5045b8e80941Smrg
5046b8e80941Smrgstruct GEN8_3DSTATE_SO_BUFFER {
5047b8e80941Smrg   uint32_t                             DWordLength;
5048b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
5049b8e80941Smrg   uint32_t                             _3DCommandOpcode;
5050b8e80941Smrg   uint32_t                             CommandSubType;
5051b8e80941Smrg   uint32_t                             CommandType;
5052b8e80941Smrg   bool                                 StreamOutputBufferOffsetAddressEnable;
5053b8e80941Smrg   bool                                 StreamOffsetWriteEnable;
5054b8e80941Smrg   uint32_t                             MOCS;
5055b8e80941Smrg   uint32_t                             SOBufferIndex;
5056b8e80941Smrg   bool                                 SOBufferEnable;
5057b8e80941Smrg   __gen_address_type                   SurfaceBaseAddress;
5058b8e80941Smrg   uint32_t                             SurfaceSize;
5059b8e80941Smrg   __gen_address_type                   StreamOutputBufferOffsetAddress;
5060b8e80941Smrg   uint32_t                             StreamOffset;
5061b8e80941Smrg};
5062b8e80941Smrg
5063b8e80941Smrgstatic inline void
5064b8e80941SmrgGEN8_3DSTATE_SO_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
5065b8e80941Smrg                            __attribute__((unused)) void * restrict dst,
5066b8e80941Smrg                            __attribute__((unused)) const struct GEN8_3DSTATE_SO_BUFFER * restrict values)
5067b8e80941Smrg{
5068b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5069b8e80941Smrg
5070b8e80941Smrg   dw[0] =
5071b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5072b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5073b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5074b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
5075b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5076b8e80941Smrg
5077b8e80941Smrg   dw[1] =
5078b8e80941Smrg      __gen_uint(values->StreamOutputBufferOffsetAddressEnable, 20, 20) |
5079b8e80941Smrg      __gen_uint(values->StreamOffsetWriteEnable, 21, 21) |
5080b8e80941Smrg      __gen_uint(values->MOCS, 22, 28) |
5081b8e80941Smrg      __gen_uint(values->SOBufferIndex, 29, 30) |
5082b8e80941Smrg      __gen_uint(values->SOBufferEnable, 31, 31);
5083b8e80941Smrg
5084b8e80941Smrg   const uint64_t v2_address =
5085b8e80941Smrg      __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
5086b8e80941Smrg   dw[2] = v2_address;
5087b8e80941Smrg   dw[3] = v2_address >> 32;
5088b8e80941Smrg
5089b8e80941Smrg   dw[4] =
5090b8e80941Smrg      __gen_uint(values->SurfaceSize, 0, 29);
5091b8e80941Smrg
5092b8e80941Smrg   const uint64_t v5_address =
5093b8e80941Smrg      __gen_combine_address(data, &dw[5], values->StreamOutputBufferOffsetAddress, 0);
5094b8e80941Smrg   dw[5] = v5_address;
5095b8e80941Smrg   dw[6] = v5_address >> 32;
5096b8e80941Smrg
5097b8e80941Smrg   dw[7] =
5098b8e80941Smrg      __gen_uint(values->StreamOffset, 0, 31);
5099b8e80941Smrg}
5100b8e80941Smrg
5101b8e80941Smrg#define GEN8_3DSTATE_SO_DECL_LIST_length_bias      2
5102b8e80941Smrg#define GEN8_3DSTATE_SO_DECL_LIST_header        \
5103b8e80941Smrg   ._3DCommandSubOpcode                 =     23,  \
5104b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
5105b8e80941Smrg   .CommandSubType                      =      3,  \
5106b8e80941Smrg   .CommandType                         =      3
5107b8e80941Smrg
5108b8e80941Smrgstruct GEN8_3DSTATE_SO_DECL_LIST {
5109b8e80941Smrg   uint32_t                             DWordLength;
5110b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
5111b8e80941Smrg   uint32_t                             _3DCommandOpcode;
5112b8e80941Smrg   uint32_t                             CommandSubType;
5113b8e80941Smrg   uint32_t                             CommandType;
5114b8e80941Smrg   uint32_t                             StreamtoBufferSelects0;
5115b8e80941Smrg   uint32_t                             StreamtoBufferSelects1;
5116b8e80941Smrg   uint32_t                             StreamtoBufferSelects2;
5117b8e80941Smrg   uint32_t                             StreamtoBufferSelects3;
5118b8e80941Smrg   uint32_t                             NumEntries0;
5119b8e80941Smrg   uint32_t                             NumEntries1;
5120b8e80941Smrg   uint32_t                             NumEntries2;
5121b8e80941Smrg   uint32_t                             NumEntries3;
5122b8e80941Smrg   /* variable length fields follow */
5123b8e80941Smrg};
5124b8e80941Smrg
5125b8e80941Smrgstatic inline void
5126b8e80941SmrgGEN8_3DSTATE_SO_DECL_LIST_pack(__attribute__((unused)) __gen_user_data *data,
5127b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
5128b8e80941Smrg                               __attribute__((unused)) const struct GEN8_3DSTATE_SO_DECL_LIST * restrict values)
5129b8e80941Smrg{
5130b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5131b8e80941Smrg
5132b8e80941Smrg   dw[0] =
5133b8e80941Smrg      __gen_uint(values->DWordLength, 0, 8) |
5134b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5135b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5136b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
5137b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5138b8e80941Smrg
5139b8e80941Smrg   dw[1] =
5140b8e80941Smrg      __gen_uint(values->StreamtoBufferSelects0, 0, 3) |
5141b8e80941Smrg      __gen_uint(values->StreamtoBufferSelects1, 4, 7) |
5142b8e80941Smrg      __gen_uint(values->StreamtoBufferSelects2, 8, 11) |
5143b8e80941Smrg      __gen_uint(values->StreamtoBufferSelects3, 12, 15);
5144b8e80941Smrg
5145b8e80941Smrg   dw[2] =
5146b8e80941Smrg      __gen_uint(values->NumEntries0, 0, 7) |
5147b8e80941Smrg      __gen_uint(values->NumEntries1, 8, 15) |
5148b8e80941Smrg      __gen_uint(values->NumEntries2, 16, 23) |
5149b8e80941Smrg      __gen_uint(values->NumEntries3, 24, 31);
5150b8e80941Smrg}
5151b8e80941Smrg
5152b8e80941Smrg#define GEN8_3DSTATE_STENCIL_BUFFER_length      5
5153b8e80941Smrg#define GEN8_3DSTATE_STENCIL_BUFFER_length_bias      2
5154b8e80941Smrg#define GEN8_3DSTATE_STENCIL_BUFFER_header      \
5155b8e80941Smrg   .DWordLength                         =      3,  \
5156b8e80941Smrg   ._3DCommandSubOpcode                 =      6,  \
5157b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
5158b8e80941Smrg   .CommandSubType                      =      3,  \
5159b8e80941Smrg   .CommandType                         =      3
5160b8e80941Smrg
5161b8e80941Smrgstruct GEN8_3DSTATE_STENCIL_BUFFER {
5162b8e80941Smrg   uint32_t                             DWordLength;
5163b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
5164b8e80941Smrg   uint32_t                             _3DCommandOpcode;
5165b8e80941Smrg   uint32_t                             CommandSubType;
5166b8e80941Smrg   uint32_t                             CommandType;
5167b8e80941Smrg   uint32_t                             SurfacePitch;
5168b8e80941Smrg   uint32_t                             MOCS;
5169b8e80941Smrg   bool                                 StencilBufferEnable;
5170b8e80941Smrg   __gen_address_type                   SurfaceBaseAddress;
5171b8e80941Smrg   uint32_t                             SurfaceQPitch;
5172b8e80941Smrg};
5173b8e80941Smrg
5174b8e80941Smrgstatic inline void
5175b8e80941SmrgGEN8_3DSTATE_STENCIL_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
5176b8e80941Smrg                                 __attribute__((unused)) void * restrict dst,
5177b8e80941Smrg                                 __attribute__((unused)) const struct GEN8_3DSTATE_STENCIL_BUFFER * restrict values)
5178b8e80941Smrg{
5179b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5180b8e80941Smrg
5181b8e80941Smrg   dw[0] =
5182b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5183b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5184b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5185b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
5186b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5187b8e80941Smrg
5188b8e80941Smrg   dw[1] =
5189b8e80941Smrg      __gen_uint(values->SurfacePitch, 0, 16) |
5190b8e80941Smrg      __gen_uint(values->MOCS, 22, 28) |
5191b8e80941Smrg      __gen_uint(values->StencilBufferEnable, 31, 31);
5192b8e80941Smrg
5193b8e80941Smrg   const uint64_t v2_address =
5194b8e80941Smrg      __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
5195b8e80941Smrg   dw[2] = v2_address;
5196b8e80941Smrg   dw[3] = v2_address >> 32;
5197b8e80941Smrg
5198b8e80941Smrg   dw[4] =
5199b8e80941Smrg      __gen_uint(values->SurfaceQPitch, 0, 14);
5200b8e80941Smrg}
5201b8e80941Smrg
5202b8e80941Smrg#define GEN8_3DSTATE_STREAMOUT_length          5
5203b8e80941Smrg#define GEN8_3DSTATE_STREAMOUT_length_bias      2
5204b8e80941Smrg#define GEN8_3DSTATE_STREAMOUT_header           \
5205b8e80941Smrg   .DWordLength                         =      3,  \
5206b8e80941Smrg   ._3DCommandSubOpcode                 =     30,  \
5207b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
5208b8e80941Smrg   .CommandSubType                      =      3,  \
5209b8e80941Smrg   .CommandType                         =      3
5210b8e80941Smrg
5211b8e80941Smrgstruct GEN8_3DSTATE_STREAMOUT {
5212b8e80941Smrg   uint32_t                             DWordLength;
5213b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
5214b8e80941Smrg   uint32_t                             _3DCommandOpcode;
5215b8e80941Smrg   uint32_t                             CommandSubType;
5216b8e80941Smrg   uint32_t                             CommandType;
5217b8e80941Smrg   uint32_t                             ForceRendering;
5218b8e80941Smrg#define Resreved                                 1
5219b8e80941Smrg#define Force_Off                                2
5220b8e80941Smrg#define Force_on                                 3
5221b8e80941Smrg   bool                                 SOStatisticsEnable;
5222b8e80941Smrg   uint32_t                             ReorderMode;
5223b8e80941Smrg#define LEADING                                  0
5224b8e80941Smrg#define TRAILING                                 1
5225b8e80941Smrg   uint32_t                             RenderStreamSelect;
5226b8e80941Smrg   bool                                 RenderingDisable;
5227b8e80941Smrg   bool                                 SOFunctionEnable;
5228b8e80941Smrg   uint32_t                             Stream0VertexReadLength;
5229b8e80941Smrg   uint32_t                             Stream0VertexReadOffset;
5230b8e80941Smrg   uint32_t                             Stream1VertexReadLength;
5231b8e80941Smrg   uint32_t                             Stream1VertexReadOffset;
5232b8e80941Smrg   uint32_t                             Stream2VertexReadLength;
5233b8e80941Smrg   uint32_t                             Stream2VertexReadOffset;
5234b8e80941Smrg   uint32_t                             Stream3VertexReadLength;
5235b8e80941Smrg   uint32_t                             Stream3VertexReadOffset;
5236b8e80941Smrg   uint32_t                             Buffer0SurfacePitch;
5237b8e80941Smrg   uint32_t                             Buffer1SurfacePitch;
5238b8e80941Smrg   uint32_t                             Buffer2SurfacePitch;
5239b8e80941Smrg   uint32_t                             Buffer3SurfacePitch;
5240b8e80941Smrg};
5241b8e80941Smrg
5242b8e80941Smrgstatic inline void
5243b8e80941SmrgGEN8_3DSTATE_STREAMOUT_pack(__attribute__((unused)) __gen_user_data *data,
5244b8e80941Smrg                            __attribute__((unused)) void * restrict dst,
5245b8e80941Smrg                            __attribute__((unused)) const struct GEN8_3DSTATE_STREAMOUT * restrict values)
5246b8e80941Smrg{
5247b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5248b8e80941Smrg
5249b8e80941Smrg   dw[0] =
5250b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5251b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5252b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5253b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
5254b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5255b8e80941Smrg
5256b8e80941Smrg   dw[1] =
5257b8e80941Smrg      __gen_uint(values->ForceRendering, 23, 24) |
5258b8e80941Smrg      __gen_uint(values->SOStatisticsEnable, 25, 25) |
5259b8e80941Smrg      __gen_uint(values->ReorderMode, 26, 26) |
5260b8e80941Smrg      __gen_uint(values->RenderStreamSelect, 27, 28) |
5261b8e80941Smrg      __gen_uint(values->RenderingDisable, 30, 30) |
5262b8e80941Smrg      __gen_uint(values->SOFunctionEnable, 31, 31);
5263b8e80941Smrg
5264b8e80941Smrg   dw[2] =
5265b8e80941Smrg      __gen_uint(values->Stream0VertexReadLength, 0, 4) |
5266b8e80941Smrg      __gen_uint(values->Stream0VertexReadOffset, 5, 5) |
5267b8e80941Smrg      __gen_uint(values->Stream1VertexReadLength, 8, 12) |
5268b8e80941Smrg      __gen_uint(values->Stream1VertexReadOffset, 13, 13) |
5269b8e80941Smrg      __gen_uint(values->Stream2VertexReadLength, 16, 20) |
5270b8e80941Smrg      __gen_uint(values->Stream2VertexReadOffset, 21, 21) |
5271b8e80941Smrg      __gen_uint(values->Stream3VertexReadLength, 24, 28) |
5272b8e80941Smrg      __gen_uint(values->Stream3VertexReadOffset, 29, 29);
5273b8e80941Smrg
5274b8e80941Smrg   dw[3] =
5275b8e80941Smrg      __gen_uint(values->Buffer0SurfacePitch, 0, 11) |
5276b8e80941Smrg      __gen_uint(values->Buffer1SurfacePitch, 16, 27);
5277b8e80941Smrg
5278b8e80941Smrg   dw[4] =
5279b8e80941Smrg      __gen_uint(values->Buffer2SurfacePitch, 0, 11) |
5280b8e80941Smrg      __gen_uint(values->Buffer3SurfacePitch, 16, 27);
5281b8e80941Smrg}
5282b8e80941Smrg
5283b8e80941Smrg#define GEN8_3DSTATE_TE_length                 4
5284b8e80941Smrg#define GEN8_3DSTATE_TE_length_bias            2
5285b8e80941Smrg#define GEN8_3DSTATE_TE_header                  \
5286b8e80941Smrg   .DWordLength                         =      2,  \
5287b8e80941Smrg   ._3DCommandSubOpcode                 =     28,  \
5288b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
5289b8e80941Smrg   .CommandSubType                      =      3,  \
5290b8e80941Smrg   .CommandType                         =      3
5291b8e80941Smrg
5292b8e80941Smrgstruct GEN8_3DSTATE_TE {
5293b8e80941Smrg   uint32_t                             DWordLength;
5294b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
5295b8e80941Smrg   uint32_t                             _3DCommandOpcode;
5296b8e80941Smrg   uint32_t                             CommandSubType;
5297b8e80941Smrg   uint32_t                             CommandType;
5298b8e80941Smrg   bool                                 TEEnable;
5299b8e80941Smrg   uint32_t                             TEMode;
5300b8e80941Smrg#define HW_TESS                                  0
5301b8e80941Smrg#define SW_TESS                                  1
5302b8e80941Smrg   uint32_t                             TEDomain;
5303b8e80941Smrg#define QUAD                                     0
5304b8e80941Smrg#define TRI                                      1
5305b8e80941Smrg#define ISOLINE                                  2
5306b8e80941Smrg   uint32_t                             OutputTopology;
5307b8e80941Smrg#define OUTPUT_POINT                             0
5308b8e80941Smrg#define OUTPUT_LINE                              1
5309b8e80941Smrg#define OUTPUT_TRI_CW                            2
5310b8e80941Smrg#define OUTPUT_TRI_CCW                           3
5311b8e80941Smrg   uint32_t                             Partitioning;
5312b8e80941Smrg#define INTEGER                                  0
5313b8e80941Smrg#define ODD_FRACTIONAL                           1
5314b8e80941Smrg#define EVEN_FRACTIONAL                          2
5315b8e80941Smrg   float                                MaximumTessellationFactorOdd;
5316b8e80941Smrg   float                                MaximumTessellationFactorNotOdd;
5317b8e80941Smrg};
5318b8e80941Smrg
5319b8e80941Smrgstatic inline void
5320b8e80941SmrgGEN8_3DSTATE_TE_pack(__attribute__((unused)) __gen_user_data *data,
5321b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
5322b8e80941Smrg                     __attribute__((unused)) const struct GEN8_3DSTATE_TE * restrict values)
5323b8e80941Smrg{
5324b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5325b8e80941Smrg
5326b8e80941Smrg   dw[0] =
5327b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5328b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5329b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5330b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
5331b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5332b8e80941Smrg
5333b8e80941Smrg   dw[1] =
5334b8e80941Smrg      __gen_uint(values->TEEnable, 0, 0) |
5335b8e80941Smrg      __gen_uint(values->TEMode, 1, 2) |
5336b8e80941Smrg      __gen_uint(values->TEDomain, 4, 5) |
5337b8e80941Smrg      __gen_uint(values->OutputTopology, 8, 9) |
5338b8e80941Smrg      __gen_uint(values->Partitioning, 12, 13);
5339b8e80941Smrg
5340b8e80941Smrg   dw[2] =
5341b8e80941Smrg      __gen_float(values->MaximumTessellationFactorOdd);
5342b8e80941Smrg
5343b8e80941Smrg   dw[3] =
5344b8e80941Smrg      __gen_float(values->MaximumTessellationFactorNotOdd);
5345b8e80941Smrg}
5346b8e80941Smrg
5347b8e80941Smrg#define GEN8_3DSTATE_URB_DS_length             2
5348b8e80941Smrg#define GEN8_3DSTATE_URB_DS_length_bias        2
5349b8e80941Smrg#define GEN8_3DSTATE_URB_DS_header              \
5350b8e80941Smrg   .DWordLength                         =      0,  \
5351b8e80941Smrg   ._3DCommandSubOpcode                 =     50,  \
5352b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
5353b8e80941Smrg   .CommandSubType                      =      3,  \
5354b8e80941Smrg   .CommandType                         =      3
5355b8e80941Smrg
5356b8e80941Smrgstruct GEN8_3DSTATE_URB_DS {
5357b8e80941Smrg   uint32_t                             DWordLength;
5358b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
5359b8e80941Smrg   uint32_t                             _3DCommandOpcode;
5360b8e80941Smrg   uint32_t                             CommandSubType;
5361b8e80941Smrg   uint32_t                             CommandType;
5362b8e80941Smrg   uint32_t                             DSNumberofURBEntries;
5363b8e80941Smrg   uint32_t                             DSURBEntryAllocationSize;
5364b8e80941Smrg   uint32_t                             DSURBStartingAddress;
5365b8e80941Smrg};
5366b8e80941Smrg
5367b8e80941Smrgstatic inline void
5368b8e80941SmrgGEN8_3DSTATE_URB_DS_pack(__attribute__((unused)) __gen_user_data *data,
5369b8e80941Smrg                         __attribute__((unused)) void * restrict dst,
5370b8e80941Smrg                         __attribute__((unused)) const struct GEN8_3DSTATE_URB_DS * restrict values)
5371b8e80941Smrg{
5372b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5373b8e80941Smrg
5374b8e80941Smrg   dw[0] =
5375b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5376b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5377b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5378b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
5379b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5380b8e80941Smrg
5381b8e80941Smrg   dw[1] =
5382b8e80941Smrg      __gen_uint(values->DSNumberofURBEntries, 0, 15) |
5383b8e80941Smrg      __gen_uint(values->DSURBEntryAllocationSize, 16, 24) |
5384b8e80941Smrg      __gen_uint(values->DSURBStartingAddress, 25, 31);
5385b8e80941Smrg}
5386b8e80941Smrg
5387b8e80941Smrg#define GEN8_3DSTATE_URB_GS_length             2
5388b8e80941Smrg#define GEN8_3DSTATE_URB_GS_length_bias        2
5389b8e80941Smrg#define GEN8_3DSTATE_URB_GS_header              \
5390b8e80941Smrg   .DWordLength                         =      0,  \
5391b8e80941Smrg   ._3DCommandSubOpcode                 =     51,  \
5392b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
5393b8e80941Smrg   .CommandSubType                      =      3,  \
5394b8e80941Smrg   .CommandType                         =      3
5395b8e80941Smrg
5396b8e80941Smrgstruct GEN8_3DSTATE_URB_GS {
5397b8e80941Smrg   uint32_t                             DWordLength;
5398b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
5399b8e80941Smrg   uint32_t                             _3DCommandOpcode;
5400b8e80941Smrg   uint32_t                             CommandSubType;
5401b8e80941Smrg   uint32_t                             CommandType;
5402b8e80941Smrg   uint32_t                             GSNumberofURBEntries;
5403b8e80941Smrg   uint32_t                             GSURBEntryAllocationSize;
5404b8e80941Smrg   uint32_t                             GSURBStartingAddress;
5405b8e80941Smrg};
5406b8e80941Smrg
5407b8e80941Smrgstatic inline void
5408b8e80941SmrgGEN8_3DSTATE_URB_GS_pack(__attribute__((unused)) __gen_user_data *data,
5409b8e80941Smrg                         __attribute__((unused)) void * restrict dst,
5410b8e80941Smrg                         __attribute__((unused)) const struct GEN8_3DSTATE_URB_GS * restrict values)
5411b8e80941Smrg{
5412b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5413b8e80941Smrg
5414b8e80941Smrg   dw[0] =
5415b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5416b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5417b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5418b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
5419b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5420b8e80941Smrg
5421b8e80941Smrg   dw[1] =
5422b8e80941Smrg      __gen_uint(values->GSNumberofURBEntries, 0, 15) |
5423b8e80941Smrg      __gen_uint(values->GSURBEntryAllocationSize, 16, 24) |
5424b8e80941Smrg      __gen_uint(values->GSURBStartingAddress, 25, 31);
5425b8e80941Smrg}
5426b8e80941Smrg
5427b8e80941Smrg#define GEN8_3DSTATE_URB_HS_length             2
5428b8e80941Smrg#define GEN8_3DSTATE_URB_HS_length_bias        2
5429b8e80941Smrg#define GEN8_3DSTATE_URB_HS_header              \
5430b8e80941Smrg   .DWordLength                         =      0,  \
5431b8e80941Smrg   ._3DCommandSubOpcode                 =     49,  \
5432b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
5433b8e80941Smrg   .CommandSubType                      =      3,  \
5434b8e80941Smrg   .CommandType                         =      3
5435b8e80941Smrg
5436b8e80941Smrgstruct GEN8_3DSTATE_URB_HS {
5437b8e80941Smrg   uint32_t                             DWordLength;
5438b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
5439b8e80941Smrg   uint32_t                             _3DCommandOpcode;
5440b8e80941Smrg   uint32_t                             CommandSubType;
5441b8e80941Smrg   uint32_t                             CommandType;
5442b8e80941Smrg   uint32_t                             HSNumberofURBEntries;
5443b8e80941Smrg   uint32_t                             HSURBEntryAllocationSize;
5444b8e80941Smrg   uint32_t                             HSURBStartingAddress;
5445b8e80941Smrg};
5446b8e80941Smrg
5447b8e80941Smrgstatic inline void
5448b8e80941SmrgGEN8_3DSTATE_URB_HS_pack(__attribute__((unused)) __gen_user_data *data,
5449b8e80941Smrg                         __attribute__((unused)) void * restrict dst,
5450b8e80941Smrg                         __attribute__((unused)) const struct GEN8_3DSTATE_URB_HS * restrict values)
5451b8e80941Smrg{
5452b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5453b8e80941Smrg
5454b8e80941Smrg   dw[0] =
5455b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5456b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5457b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5458b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
5459b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5460b8e80941Smrg
5461b8e80941Smrg   dw[1] =
5462b8e80941Smrg      __gen_uint(values->HSNumberofURBEntries, 0, 15) |
5463b8e80941Smrg      __gen_uint(values->HSURBEntryAllocationSize, 16, 24) |
5464b8e80941Smrg      __gen_uint(values->HSURBStartingAddress, 25, 31);
5465b8e80941Smrg}
5466b8e80941Smrg
5467b8e80941Smrg#define GEN8_3DSTATE_URB_VS_length             2
5468b8e80941Smrg#define GEN8_3DSTATE_URB_VS_length_bias        2
5469b8e80941Smrg#define GEN8_3DSTATE_URB_VS_header              \
5470b8e80941Smrg   .DWordLength                         =      0,  \
5471b8e80941Smrg   ._3DCommandSubOpcode                 =     48,  \
5472b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
5473b8e80941Smrg   .CommandSubType                      =      3,  \
5474b8e80941Smrg   .CommandType                         =      3
5475b8e80941Smrg
5476b8e80941Smrgstruct GEN8_3DSTATE_URB_VS {
5477b8e80941Smrg   uint32_t                             DWordLength;
5478b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
5479b8e80941Smrg   uint32_t                             _3DCommandOpcode;
5480b8e80941Smrg   uint32_t                             CommandSubType;
5481b8e80941Smrg   uint32_t                             CommandType;
5482b8e80941Smrg   uint32_t                             VSNumberofURBEntries;
5483b8e80941Smrg   uint32_t                             VSURBEntryAllocationSize;
5484b8e80941Smrg   uint32_t                             VSURBStartingAddress;
5485b8e80941Smrg};
5486b8e80941Smrg
5487b8e80941Smrgstatic inline void
5488b8e80941SmrgGEN8_3DSTATE_URB_VS_pack(__attribute__((unused)) __gen_user_data *data,
5489b8e80941Smrg                         __attribute__((unused)) void * restrict dst,
5490b8e80941Smrg                         __attribute__((unused)) const struct GEN8_3DSTATE_URB_VS * restrict values)
5491b8e80941Smrg{
5492b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5493b8e80941Smrg
5494b8e80941Smrg   dw[0] =
5495b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5496b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5497b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5498b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
5499b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5500b8e80941Smrg
5501b8e80941Smrg   dw[1] =
5502b8e80941Smrg      __gen_uint(values->VSNumberofURBEntries, 0, 15) |
5503b8e80941Smrg      __gen_uint(values->VSURBEntryAllocationSize, 16, 24) |
5504b8e80941Smrg      __gen_uint(values->VSURBStartingAddress, 25, 31);
5505b8e80941Smrg}
5506b8e80941Smrg
5507b8e80941Smrg#define GEN8_3DSTATE_VERTEX_BUFFERS_length_bias      2
5508b8e80941Smrg#define GEN8_3DSTATE_VERTEX_BUFFERS_header      \
5509b8e80941Smrg   .DWordLength                         =      3,  \
5510b8e80941Smrg   ._3DCommandSubOpcode                 =      8,  \
5511b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
5512b8e80941Smrg   .CommandSubType                      =      3,  \
5513b8e80941Smrg   .CommandType                         =      3
5514b8e80941Smrg
5515b8e80941Smrgstruct GEN8_3DSTATE_VERTEX_BUFFERS {
5516b8e80941Smrg   uint32_t                             DWordLength;
5517b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
5518b8e80941Smrg   uint32_t                             _3DCommandOpcode;
5519b8e80941Smrg   uint32_t                             CommandSubType;
5520b8e80941Smrg   uint32_t                             CommandType;
5521b8e80941Smrg   /* variable length fields follow */
5522b8e80941Smrg};
5523b8e80941Smrg
5524b8e80941Smrgstatic inline void
5525b8e80941SmrgGEN8_3DSTATE_VERTEX_BUFFERS_pack(__attribute__((unused)) __gen_user_data *data,
5526b8e80941Smrg                                 __attribute__((unused)) void * restrict dst,
5527b8e80941Smrg                                 __attribute__((unused)) const struct GEN8_3DSTATE_VERTEX_BUFFERS * restrict values)
5528b8e80941Smrg{
5529b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5530b8e80941Smrg
5531b8e80941Smrg   dw[0] =
5532b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5533b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5534b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5535b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
5536b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5537b8e80941Smrg}
5538b8e80941Smrg
5539b8e80941Smrg#define GEN8_3DSTATE_VERTEX_ELEMENTS_length_bias      2
5540b8e80941Smrg#define GEN8_3DSTATE_VERTEX_ELEMENTS_header     \
5541b8e80941Smrg   .DWordLength                         =      1,  \
5542b8e80941Smrg   ._3DCommandSubOpcode                 =      9,  \
5543b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
5544b8e80941Smrg   .CommandSubType                      =      3,  \
5545b8e80941Smrg   .CommandType                         =      3
5546b8e80941Smrg
5547b8e80941Smrgstruct GEN8_3DSTATE_VERTEX_ELEMENTS {
5548b8e80941Smrg   uint32_t                             DWordLength;
5549b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
5550b8e80941Smrg   uint32_t                             _3DCommandOpcode;
5551b8e80941Smrg   uint32_t                             CommandSubType;
5552b8e80941Smrg   uint32_t                             CommandType;
5553b8e80941Smrg   /* variable length fields follow */
5554b8e80941Smrg};
5555b8e80941Smrg
5556b8e80941Smrgstatic inline void
5557b8e80941SmrgGEN8_3DSTATE_VERTEX_ELEMENTS_pack(__attribute__((unused)) __gen_user_data *data,
5558b8e80941Smrg                                  __attribute__((unused)) void * restrict dst,
5559b8e80941Smrg                                  __attribute__((unused)) const struct GEN8_3DSTATE_VERTEX_ELEMENTS * restrict values)
5560b8e80941Smrg{
5561b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5562b8e80941Smrg
5563b8e80941Smrg   dw[0] =
5564b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5565b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5566b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5567b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
5568b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5569b8e80941Smrg}
5570b8e80941Smrg
5571b8e80941Smrg#define GEN8_3DSTATE_VF_length                 2
5572b8e80941Smrg#define GEN8_3DSTATE_VF_length_bias            2
5573b8e80941Smrg#define GEN8_3DSTATE_VF_header                  \
5574b8e80941Smrg   .DWordLength                         =      0,  \
5575b8e80941Smrg   ._3DCommandSubOpcode                 =     12,  \
5576b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
5577b8e80941Smrg   .CommandSubType                      =      3,  \
5578b8e80941Smrg   .CommandType                         =      3
5579b8e80941Smrg
5580b8e80941Smrgstruct GEN8_3DSTATE_VF {
5581b8e80941Smrg   uint32_t                             DWordLength;
5582b8e80941Smrg   bool                                 IndexedDrawCutIndexEnable;
5583b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
5584b8e80941Smrg   uint32_t                             _3DCommandOpcode;
5585b8e80941Smrg   uint32_t                             CommandSubType;
5586b8e80941Smrg   uint32_t                             CommandType;
5587b8e80941Smrg   uint32_t                             CutIndex;
5588b8e80941Smrg};
5589b8e80941Smrg
5590b8e80941Smrgstatic inline void
5591b8e80941SmrgGEN8_3DSTATE_VF_pack(__attribute__((unused)) __gen_user_data *data,
5592b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
5593b8e80941Smrg                     __attribute__((unused)) const struct GEN8_3DSTATE_VF * restrict values)
5594b8e80941Smrg{
5595b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5596b8e80941Smrg
5597b8e80941Smrg   dw[0] =
5598b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5599b8e80941Smrg      __gen_uint(values->IndexedDrawCutIndexEnable, 8, 8) |
5600b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5601b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5602b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
5603b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5604b8e80941Smrg
5605b8e80941Smrg   dw[1] =
5606b8e80941Smrg      __gen_uint(values->CutIndex, 0, 31);
5607b8e80941Smrg}
5608b8e80941Smrg
5609b8e80941Smrg#define GEN8_3DSTATE_VF_INSTANCING_length      3
5610b8e80941Smrg#define GEN8_3DSTATE_VF_INSTANCING_length_bias      2
5611b8e80941Smrg#define GEN8_3DSTATE_VF_INSTANCING_header       \
5612b8e80941Smrg   .DWordLength                         =      1,  \
5613b8e80941Smrg   ._3DCommandSubOpcode                 =     73,  \
5614b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
5615b8e80941Smrg   .CommandSubType                      =      3,  \
5616b8e80941Smrg   .CommandType                         =      3
5617b8e80941Smrg
5618b8e80941Smrgstruct GEN8_3DSTATE_VF_INSTANCING {
5619b8e80941Smrg   uint32_t                             DWordLength;
5620b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
5621b8e80941Smrg   uint32_t                             _3DCommandOpcode;
5622b8e80941Smrg   uint32_t                             CommandSubType;
5623b8e80941Smrg   uint32_t                             CommandType;
5624b8e80941Smrg   uint32_t                             VertexElementIndex;
5625b8e80941Smrg   bool                                 InstancingEnable;
5626b8e80941Smrg   uint32_t                             InstanceDataStepRate;
5627b8e80941Smrg};
5628b8e80941Smrg
5629b8e80941Smrgstatic inline void
5630b8e80941SmrgGEN8_3DSTATE_VF_INSTANCING_pack(__attribute__((unused)) __gen_user_data *data,
5631b8e80941Smrg                                __attribute__((unused)) void * restrict dst,
5632b8e80941Smrg                                __attribute__((unused)) const struct GEN8_3DSTATE_VF_INSTANCING * restrict values)
5633b8e80941Smrg{
5634b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5635b8e80941Smrg
5636b8e80941Smrg   dw[0] =
5637b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5638b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5639b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5640b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
5641b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5642b8e80941Smrg
5643b8e80941Smrg   dw[1] =
5644b8e80941Smrg      __gen_uint(values->VertexElementIndex, 0, 5) |
5645b8e80941Smrg      __gen_uint(values->InstancingEnable, 8, 8);
5646b8e80941Smrg
5647b8e80941Smrg   dw[2] =
5648b8e80941Smrg      __gen_uint(values->InstanceDataStepRate, 0, 31);
5649b8e80941Smrg}
5650b8e80941Smrg
5651b8e80941Smrg#define GEN8_3DSTATE_VF_SGVS_length            2
5652b8e80941Smrg#define GEN8_3DSTATE_VF_SGVS_length_bias       2
5653b8e80941Smrg#define GEN8_3DSTATE_VF_SGVS_header             \
5654b8e80941Smrg   .DWordLength                         =      0,  \
5655b8e80941Smrg   ._3DCommandSubOpcode                 =     74,  \
5656b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
5657b8e80941Smrg   .CommandSubType                      =      3,  \
5658b8e80941Smrg   .CommandType                         =      3
5659b8e80941Smrg
5660b8e80941Smrgstruct GEN8_3DSTATE_VF_SGVS {
5661b8e80941Smrg   uint32_t                             DWordLength;
5662b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
5663b8e80941Smrg   uint32_t                             _3DCommandOpcode;
5664b8e80941Smrg   uint32_t                             CommandSubType;
5665b8e80941Smrg   uint32_t                             CommandType;
5666b8e80941Smrg   uint32_t                             VertexIDElementOffset;
5667b8e80941Smrg   uint32_t                             VertexIDComponentNumber;
5668b8e80941Smrg#define COMP_0                                   0
5669b8e80941Smrg#define COMP_1                                   1
5670b8e80941Smrg#define COMP_2                                   2
5671b8e80941Smrg#define COMP_3                                   3
5672b8e80941Smrg   bool                                 VertexIDEnable;
5673b8e80941Smrg   uint32_t                             InstanceIDElementOffset;
5674b8e80941Smrg   uint32_t                             InstanceIDComponentNumber;
5675b8e80941Smrg#define COMP_0                                   0
5676b8e80941Smrg#define COMP_1                                   1
5677b8e80941Smrg#define COMP_2                                   2
5678b8e80941Smrg#define COMP_3                                   3
5679b8e80941Smrg   bool                                 InstanceIDEnable;
5680b8e80941Smrg};
5681b8e80941Smrg
5682b8e80941Smrgstatic inline void
5683b8e80941SmrgGEN8_3DSTATE_VF_SGVS_pack(__attribute__((unused)) __gen_user_data *data,
5684b8e80941Smrg                          __attribute__((unused)) void * restrict dst,
5685b8e80941Smrg                          __attribute__((unused)) const struct GEN8_3DSTATE_VF_SGVS * restrict values)
5686b8e80941Smrg{
5687b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5688b8e80941Smrg
5689b8e80941Smrg   dw[0] =
5690b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5691b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5692b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5693b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
5694b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5695b8e80941Smrg
5696b8e80941Smrg   dw[1] =
5697b8e80941Smrg      __gen_uint(values->VertexIDElementOffset, 0, 5) |
5698b8e80941Smrg      __gen_uint(values->VertexIDComponentNumber, 13, 14) |
5699b8e80941Smrg      __gen_uint(values->VertexIDEnable, 15, 15) |
5700b8e80941Smrg      __gen_uint(values->InstanceIDElementOffset, 16, 21) |
5701b8e80941Smrg      __gen_uint(values->InstanceIDComponentNumber, 29, 30) |
5702b8e80941Smrg      __gen_uint(values->InstanceIDEnable, 31, 31);
5703b8e80941Smrg}
5704b8e80941Smrg
5705b8e80941Smrg#define GEN8_3DSTATE_VF_STATISTICS_length      1
5706b8e80941Smrg#define GEN8_3DSTATE_VF_STATISTICS_length_bias      1
5707b8e80941Smrg#define GEN8_3DSTATE_VF_STATISTICS_header       \
5708b8e80941Smrg   ._3DCommandSubOpcode                 =     11,  \
5709b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
5710b8e80941Smrg   .CommandSubType                      =      1,  \
5711b8e80941Smrg   .CommandType                         =      3
5712b8e80941Smrg
5713b8e80941Smrgstruct GEN8_3DSTATE_VF_STATISTICS {
5714b8e80941Smrg   bool                                 StatisticsEnable;
5715b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
5716b8e80941Smrg   uint32_t                             _3DCommandOpcode;
5717b8e80941Smrg   uint32_t                             CommandSubType;
5718b8e80941Smrg   uint32_t                             CommandType;
5719b8e80941Smrg};
5720b8e80941Smrg
5721b8e80941Smrgstatic inline void
5722b8e80941SmrgGEN8_3DSTATE_VF_STATISTICS_pack(__attribute__((unused)) __gen_user_data *data,
5723b8e80941Smrg                                __attribute__((unused)) void * restrict dst,
5724b8e80941Smrg                                __attribute__((unused)) const struct GEN8_3DSTATE_VF_STATISTICS * restrict values)
5725b8e80941Smrg{
5726b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5727b8e80941Smrg
5728b8e80941Smrg   dw[0] =
5729b8e80941Smrg      __gen_uint(values->StatisticsEnable, 0, 0) |
5730b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5731b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5732b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
5733b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5734b8e80941Smrg}
5735b8e80941Smrg
5736b8e80941Smrg#define GEN8_3DSTATE_VF_TOPOLOGY_length        2
5737b8e80941Smrg#define GEN8_3DSTATE_VF_TOPOLOGY_length_bias      2
5738b8e80941Smrg#define GEN8_3DSTATE_VF_TOPOLOGY_header         \
5739b8e80941Smrg   .DWordLength                         =      0,  \
5740b8e80941Smrg   ._3DCommandSubOpcode                 =     75,  \
5741b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
5742b8e80941Smrg   .CommandSubType                      =      3,  \
5743b8e80941Smrg   .CommandType                         =      3
5744b8e80941Smrg
5745b8e80941Smrgstruct GEN8_3DSTATE_VF_TOPOLOGY {
5746b8e80941Smrg   uint32_t                             DWordLength;
5747b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
5748b8e80941Smrg   uint32_t                             _3DCommandOpcode;
5749b8e80941Smrg   uint32_t                             CommandSubType;
5750b8e80941Smrg   uint32_t                             CommandType;
5751b8e80941Smrg   enum GEN8_3D_Prim_Topo_Type          PrimitiveTopologyType;
5752b8e80941Smrg};
5753b8e80941Smrg
5754b8e80941Smrgstatic inline void
5755b8e80941SmrgGEN8_3DSTATE_VF_TOPOLOGY_pack(__attribute__((unused)) __gen_user_data *data,
5756b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
5757b8e80941Smrg                              __attribute__((unused)) const struct GEN8_3DSTATE_VF_TOPOLOGY * restrict values)
5758b8e80941Smrg{
5759b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5760b8e80941Smrg
5761b8e80941Smrg   dw[0] =
5762b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5763b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5764b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5765b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
5766b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5767b8e80941Smrg
5768b8e80941Smrg   dw[1] =
5769b8e80941Smrg      __gen_uint(values->PrimitiveTopologyType, 0, 5);
5770b8e80941Smrg}
5771b8e80941Smrg
5772b8e80941Smrg#define GEN8_3DSTATE_VIEWPORT_STATE_POINTERS_CC_length      2
5773b8e80941Smrg#define GEN8_3DSTATE_VIEWPORT_STATE_POINTERS_CC_length_bias      2
5774b8e80941Smrg#define GEN8_3DSTATE_VIEWPORT_STATE_POINTERS_CC_header\
5775b8e80941Smrg   .DWordLength                         =      0,  \
5776b8e80941Smrg   ._3DCommandSubOpcode                 =     35,  \
5777b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
5778b8e80941Smrg   .CommandSubType                      =      3,  \
5779b8e80941Smrg   .CommandType                         =      3
5780b8e80941Smrg
5781b8e80941Smrgstruct GEN8_3DSTATE_VIEWPORT_STATE_POINTERS_CC {
5782b8e80941Smrg   uint32_t                             DWordLength;
5783b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
5784b8e80941Smrg   uint32_t                             _3DCommandOpcode;
5785b8e80941Smrg   uint32_t                             CommandSubType;
5786b8e80941Smrg   uint32_t                             CommandType;
5787b8e80941Smrg   uint64_t                             CCViewportPointer;
5788b8e80941Smrg};
5789b8e80941Smrg
5790b8e80941Smrgstatic inline void
5791b8e80941SmrgGEN8_3DSTATE_VIEWPORT_STATE_POINTERS_CC_pack(__attribute__((unused)) __gen_user_data *data,
5792b8e80941Smrg                                             __attribute__((unused)) void * restrict dst,
5793b8e80941Smrg                                             __attribute__((unused)) const struct GEN8_3DSTATE_VIEWPORT_STATE_POINTERS_CC * restrict values)
5794b8e80941Smrg{
5795b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5796b8e80941Smrg
5797b8e80941Smrg   dw[0] =
5798b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5799b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5800b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5801b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
5802b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5803b8e80941Smrg
5804b8e80941Smrg   dw[1] =
5805b8e80941Smrg      __gen_offset(values->CCViewportPointer, 5, 31);
5806b8e80941Smrg}
5807b8e80941Smrg
5808b8e80941Smrg#define GEN8_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_length      2
5809b8e80941Smrg#define GEN8_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_length_bias      2
5810b8e80941Smrg#define GEN8_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_header\
5811b8e80941Smrg   .DWordLength                         =      0,  \
5812b8e80941Smrg   ._3DCommandSubOpcode                 =     33,  \
5813b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
5814b8e80941Smrg   .CommandSubType                      =      3,  \
5815b8e80941Smrg   .CommandType                         =      3
5816b8e80941Smrg
5817b8e80941Smrgstruct GEN8_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP {
5818b8e80941Smrg   uint32_t                             DWordLength;
5819b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
5820b8e80941Smrg   uint32_t                             _3DCommandOpcode;
5821b8e80941Smrg   uint32_t                             CommandSubType;
5822b8e80941Smrg   uint32_t                             CommandType;
5823b8e80941Smrg   uint64_t                             SFClipViewportPointer;
5824b8e80941Smrg};
5825b8e80941Smrg
5826b8e80941Smrgstatic inline void
5827b8e80941SmrgGEN8_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
5828b8e80941Smrg                                                  __attribute__((unused)) void * restrict dst,
5829b8e80941Smrg                                                  __attribute__((unused)) const struct GEN8_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP * restrict values)
5830b8e80941Smrg{
5831b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5832b8e80941Smrg
5833b8e80941Smrg   dw[0] =
5834b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5835b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5836b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5837b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
5838b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5839b8e80941Smrg
5840b8e80941Smrg   dw[1] =
5841b8e80941Smrg      __gen_offset(values->SFClipViewportPointer, 6, 31);
5842b8e80941Smrg}
5843b8e80941Smrg
5844b8e80941Smrg#define GEN8_3DSTATE_VS_length                 9
5845b8e80941Smrg#define GEN8_3DSTATE_VS_length_bias            2
5846b8e80941Smrg#define GEN8_3DSTATE_VS_header                  \
5847b8e80941Smrg   .DWordLength                         =      7,  \
5848b8e80941Smrg   ._3DCommandSubOpcode                 =     16,  \
5849b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
5850b8e80941Smrg   .CommandSubType                      =      3,  \
5851b8e80941Smrg   .CommandType                         =      3
5852b8e80941Smrg
5853b8e80941Smrgstruct GEN8_3DSTATE_VS {
5854b8e80941Smrg   uint32_t                             DWordLength;
5855b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
5856b8e80941Smrg   uint32_t                             _3DCommandOpcode;
5857b8e80941Smrg   uint32_t                             CommandSubType;
5858b8e80941Smrg   uint32_t                             CommandType;
5859b8e80941Smrg   uint64_t                             KernelStartPointer;
5860b8e80941Smrg   bool                                 SoftwareExceptionEnable;
5861b8e80941Smrg   bool                                 AccessesUAV;
5862b8e80941Smrg   bool                                 IllegalOpcodeExceptionEnable;
5863b8e80941Smrg   uint32_t                             FloatingPointMode;
5864b8e80941Smrg#define IEEE754                                  0
5865b8e80941Smrg#define Alternate                                1
5866b8e80941Smrg   uint32_t                             ThreadDispatchPriority;
5867b8e80941Smrg#define High                                     1
5868b8e80941Smrg   uint32_t                             BindingTableEntryCount;
5869b8e80941Smrg   uint32_t                             SamplerCount;
5870b8e80941Smrg#define NoSamplers                               0
5871b8e80941Smrg#define _14Samplers                              1
5872b8e80941Smrg#define _58Samplers                              2
5873b8e80941Smrg#define _912Samplers                             3
5874b8e80941Smrg#define _1316Samplers                            4
5875b8e80941Smrg   bool                                 VectorMaskEnable;
5876b8e80941Smrg   bool                                 SingleVertexDispatch;
5877b8e80941Smrg   uint32_t                             PerThreadScratchSpace;
5878b8e80941Smrg   __gen_address_type                   ScratchSpaceBasePointer;
5879b8e80941Smrg   uint32_t                             VertexURBEntryReadOffset;
5880b8e80941Smrg   uint32_t                             VertexURBEntryReadLength;
5881b8e80941Smrg   uint32_t                             DispatchGRFStartRegisterForURBData;
5882b8e80941Smrg   bool                                 Enable;
5883b8e80941Smrg   bool                                 VertexCacheDisable;
5884b8e80941Smrg   bool                                 SIMD8DispatchEnable;
5885b8e80941Smrg   bool                                 StatisticsEnable;
5886b8e80941Smrg   uint32_t                             MaximumNumberofThreads;
5887b8e80941Smrg   uint32_t                             UserClipDistanceCullTestEnableBitmask;
5888b8e80941Smrg   uint32_t                             UserClipDistanceClipTestEnableBitmask;
5889b8e80941Smrg   uint32_t                             VertexURBEntryOutputLength;
5890b8e80941Smrg   uint32_t                             VertexURBEntryOutputReadOffset;
5891b8e80941Smrg};
5892b8e80941Smrg
5893b8e80941Smrgstatic inline void
5894b8e80941SmrgGEN8_3DSTATE_VS_pack(__attribute__((unused)) __gen_user_data *data,
5895b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
5896b8e80941Smrg                     __attribute__((unused)) const struct GEN8_3DSTATE_VS * restrict values)
5897b8e80941Smrg{
5898b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5899b8e80941Smrg
5900b8e80941Smrg   dw[0] =
5901b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5902b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5903b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5904b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
5905b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5906b8e80941Smrg
5907b8e80941Smrg   const uint64_t v1 =
5908b8e80941Smrg      __gen_offset(values->KernelStartPointer, 6, 63);
5909b8e80941Smrg   dw[1] = v1;
5910b8e80941Smrg   dw[2] = v1 >> 32;
5911b8e80941Smrg
5912b8e80941Smrg   dw[3] =
5913b8e80941Smrg      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
5914b8e80941Smrg      __gen_uint(values->AccessesUAV, 12, 12) |
5915b8e80941Smrg      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
5916b8e80941Smrg      __gen_uint(values->FloatingPointMode, 16, 16) |
5917b8e80941Smrg      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
5918b8e80941Smrg      __gen_uint(values->BindingTableEntryCount, 18, 25) |
5919b8e80941Smrg      __gen_uint(values->SamplerCount, 27, 29) |
5920b8e80941Smrg      __gen_uint(values->VectorMaskEnable, 30, 30) |
5921b8e80941Smrg      __gen_uint(values->SingleVertexDispatch, 31, 31);
5922b8e80941Smrg
5923b8e80941Smrg   const uint64_t v4 =
5924b8e80941Smrg      __gen_uint(values->PerThreadScratchSpace, 0, 3);
5925b8e80941Smrg   const uint64_t v4_address =
5926b8e80941Smrg      __gen_combine_address(data, &dw[4], values->ScratchSpaceBasePointer, v4);
5927b8e80941Smrg   dw[4] = v4_address;
5928b8e80941Smrg   dw[5] = (v4_address >> 32) | (v4 >> 32);
5929b8e80941Smrg
5930b8e80941Smrg   dw[6] =
5931b8e80941Smrg      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
5932b8e80941Smrg      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
5933b8e80941Smrg      __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
5934b8e80941Smrg
5935b8e80941Smrg   dw[7] =
5936b8e80941Smrg      __gen_uint(values->Enable, 0, 0) |
5937b8e80941Smrg      __gen_uint(values->VertexCacheDisable, 1, 1) |
5938b8e80941Smrg      __gen_uint(values->SIMD8DispatchEnable, 2, 2) |
5939b8e80941Smrg      __gen_uint(values->StatisticsEnable, 10, 10) |
5940b8e80941Smrg      __gen_uint(values->MaximumNumberofThreads, 23, 31);
5941b8e80941Smrg
5942b8e80941Smrg   dw[8] =
5943b8e80941Smrg      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
5944b8e80941Smrg      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 8, 15) |
5945b8e80941Smrg      __gen_uint(values->VertexURBEntryOutputLength, 16, 20) |
5946b8e80941Smrg      __gen_uint(values->VertexURBEntryOutputReadOffset, 21, 26);
5947b8e80941Smrg}
5948b8e80941Smrg
5949b8e80941Smrg#define GEN8_3DSTATE_WM_length                 2
5950b8e80941Smrg#define GEN8_3DSTATE_WM_length_bias            2
5951b8e80941Smrg#define GEN8_3DSTATE_WM_header                  \
5952b8e80941Smrg   .DWordLength                         =      0,  \
5953b8e80941Smrg   ._3DCommandSubOpcode                 =     20,  \
5954b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
5955b8e80941Smrg   .CommandSubType                      =      3,  \
5956b8e80941Smrg   .CommandType                         =      3
5957b8e80941Smrg
5958b8e80941Smrgstruct GEN8_3DSTATE_WM {
5959b8e80941Smrg   uint32_t                             DWordLength;
5960b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
5961b8e80941Smrg   uint32_t                             _3DCommandOpcode;
5962b8e80941Smrg   uint32_t                             CommandSubType;
5963b8e80941Smrg   uint32_t                             CommandType;
5964b8e80941Smrg   uint32_t                             ForceKillPixelEnable;
5965b8e80941Smrg#define ForceOff                                 1
5966b8e80941Smrg#define ForceON                                  2
5967b8e80941Smrg   uint32_t                             PointRasterizationRule;
5968b8e80941Smrg#define RASTRULE_UPPER_LEFT                      0
5969b8e80941Smrg#define RASTRULE_UPPER_RIGHT                     1
5970b8e80941Smrg   bool                                 LineStippleEnable;
5971b8e80941Smrg   bool                                 PolygonStippleEnable;
5972b8e80941Smrg   uint32_t                             LineAntialiasingRegionWidth;
5973b8e80941Smrg#define _05pixels                                0
5974b8e80941Smrg#define _10pixels                                1
5975b8e80941Smrg#define _20pixels                                2
5976b8e80941Smrg#define _40pixels                                3
5977b8e80941Smrg   uint32_t                             LineEndCapAntialiasingRegionWidth;
5978b8e80941Smrg#define _05pixels                                0
5979b8e80941Smrg#define _10pixels                                1
5980b8e80941Smrg#define _20pixels                                2
5981b8e80941Smrg#define _40pixels                                3
5982b8e80941Smrg   uint32_t                             BarycentricInterpolationMode;
5983b8e80941Smrg#define BIM_PERSPECTIVE_PIXEL                    1
5984b8e80941Smrg#define BIM_PERSPECTIVE_CENTROID                 2
5985b8e80941Smrg#define BIM_PERSPECTIVE_SAMPLE                   4
5986b8e80941Smrg#define BIM_LINEAR_PIXEL                         8
5987b8e80941Smrg#define BIM_LINEAR_CENTROID                      16
5988b8e80941Smrg#define BIM_LINEAR_SAMPLE                        32
5989b8e80941Smrg   uint32_t                             PositionZWInterpolationMode;
5990b8e80941Smrg#define INTERP_PIXEL                             0
5991b8e80941Smrg#define INTERP_CENTROID                          2
5992b8e80941Smrg#define INTERP_SAMPLE                            3
5993b8e80941Smrg   uint32_t                             ForceThreadDispatchEnable;
5994b8e80941Smrg#define ForceOff                                 1
5995b8e80941Smrg#define ForceON                                  2
5996b8e80941Smrg   uint32_t                             EarlyDepthStencilControl;
5997b8e80941Smrg#define EDSC_NORMAL                              0
5998b8e80941Smrg#define EDSC_PSEXEC                              1
5999b8e80941Smrg#define EDSC_PREPS                               2
6000b8e80941Smrg   bool                                 LegacyDiamondLineRasterization;
6001b8e80941Smrg   bool                                 LegacyHierarchicalDepthBufferResolveEnable;
6002b8e80941Smrg   bool                                 LegacyDepthBufferResolveEnable;
6003b8e80941Smrg   bool                                 LegacyDepthBufferClearEnable;
6004b8e80941Smrg   bool                                 StatisticsEnable;
6005b8e80941Smrg};
6006b8e80941Smrg
6007b8e80941Smrgstatic inline void
6008b8e80941SmrgGEN8_3DSTATE_WM_pack(__attribute__((unused)) __gen_user_data *data,
6009b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
6010b8e80941Smrg                     __attribute__((unused)) const struct GEN8_3DSTATE_WM * restrict values)
6011b8e80941Smrg{
6012b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6013b8e80941Smrg
6014b8e80941Smrg   dw[0] =
6015b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
6016b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6017b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6018b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
6019b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6020b8e80941Smrg
6021b8e80941Smrg   dw[1] =
6022b8e80941Smrg      __gen_uint(values->ForceKillPixelEnable, 0, 1) |
6023b8e80941Smrg      __gen_uint(values->PointRasterizationRule, 2, 2) |
6024b8e80941Smrg      __gen_uint(values->LineStippleEnable, 3, 3) |
6025b8e80941Smrg      __gen_uint(values->PolygonStippleEnable, 4, 4) |
6026b8e80941Smrg      __gen_uint(values->LineAntialiasingRegionWidth, 6, 7) |
6027b8e80941Smrg      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 8, 9) |
6028b8e80941Smrg      __gen_uint(values->BarycentricInterpolationMode, 11, 16) |
6029b8e80941Smrg      __gen_uint(values->PositionZWInterpolationMode, 17, 18) |
6030b8e80941Smrg      __gen_uint(values->ForceThreadDispatchEnable, 19, 20) |
6031b8e80941Smrg      __gen_uint(values->EarlyDepthStencilControl, 21, 22) |
6032b8e80941Smrg      __gen_uint(values->LegacyDiamondLineRasterization, 26, 26) |
6033b8e80941Smrg      __gen_uint(values->LegacyHierarchicalDepthBufferResolveEnable, 27, 27) |
6034b8e80941Smrg      __gen_uint(values->LegacyDepthBufferResolveEnable, 28, 28) |
6035b8e80941Smrg      __gen_uint(values->LegacyDepthBufferClearEnable, 30, 30) |
6036b8e80941Smrg      __gen_uint(values->StatisticsEnable, 31, 31);
6037b8e80941Smrg}
6038b8e80941Smrg
6039b8e80941Smrg#define GEN8_3DSTATE_WM_CHROMAKEY_length       2
6040b8e80941Smrg#define GEN8_3DSTATE_WM_CHROMAKEY_length_bias      2
6041b8e80941Smrg#define GEN8_3DSTATE_WM_CHROMAKEY_header        \
6042b8e80941Smrg   .DWordLength                         =      0,  \
6043b8e80941Smrg   ._3DCommandSubOpcode                 =     76,  \
6044b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
6045b8e80941Smrg   .CommandSubType                      =      3,  \
6046b8e80941Smrg   .CommandType                         =      3
6047b8e80941Smrg
6048b8e80941Smrgstruct GEN8_3DSTATE_WM_CHROMAKEY {
6049b8e80941Smrg   uint32_t                             DWordLength;
6050b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
6051b8e80941Smrg   uint32_t                             _3DCommandOpcode;
6052b8e80941Smrg   uint32_t                             CommandSubType;
6053b8e80941Smrg   uint32_t                             CommandType;
6054b8e80941Smrg   bool                                 ChromaKeyKillEnable;
6055b8e80941Smrg};
6056b8e80941Smrg
6057b8e80941Smrgstatic inline void
6058b8e80941SmrgGEN8_3DSTATE_WM_CHROMAKEY_pack(__attribute__((unused)) __gen_user_data *data,
6059b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
6060b8e80941Smrg                               __attribute__((unused)) const struct GEN8_3DSTATE_WM_CHROMAKEY * restrict values)
6061b8e80941Smrg{
6062b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6063b8e80941Smrg
6064b8e80941Smrg   dw[0] =
6065b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
6066b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6067b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6068b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
6069b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6070b8e80941Smrg
6071b8e80941Smrg   dw[1] =
6072b8e80941Smrg      __gen_uint(values->ChromaKeyKillEnable, 31, 31);
6073b8e80941Smrg}
6074b8e80941Smrg
6075b8e80941Smrg#define GEN8_3DSTATE_WM_DEPTH_STENCIL_length      3
6076b8e80941Smrg#define GEN8_3DSTATE_WM_DEPTH_STENCIL_length_bias      2
6077b8e80941Smrg#define GEN8_3DSTATE_WM_DEPTH_STENCIL_header    \
6078b8e80941Smrg   .DWordLength                         =      1,  \
6079b8e80941Smrg   ._3DCommandSubOpcode                 =     78,  \
6080b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
6081b8e80941Smrg   .CommandSubType                      =      3,  \
6082b8e80941Smrg   .CommandType                         =      3
6083b8e80941Smrg
6084b8e80941Smrgstruct GEN8_3DSTATE_WM_DEPTH_STENCIL {
6085b8e80941Smrg   uint32_t                             DWordLength;
6086b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
6087b8e80941Smrg   uint32_t                             _3DCommandOpcode;
6088b8e80941Smrg   uint32_t                             CommandSubType;
6089b8e80941Smrg   uint32_t                             CommandType;
6090b8e80941Smrg   bool                                 DepthBufferWriteEnable;
6091b8e80941Smrg   bool                                 DepthTestEnable;
6092b8e80941Smrg   bool                                 StencilBufferWriteEnable;
6093b8e80941Smrg   bool                                 StencilTestEnable;
6094b8e80941Smrg   bool                                 DoubleSidedStencilEnable;
6095b8e80941Smrg   enum GEN8_3D_Compare_Function        DepthTestFunction;
6096b8e80941Smrg   enum GEN8_3D_Compare_Function        StencilTestFunction;
6097b8e80941Smrg   enum GEN8_3D_Stencil_Operation       BackfaceStencilPassDepthPassOp;
6098b8e80941Smrg   enum GEN8_3D_Stencil_Operation       BackfaceStencilPassDepthFailOp;
6099b8e80941Smrg   enum GEN8_3D_Stencil_Operation       BackfaceStencilFailOp;
6100b8e80941Smrg   enum GEN8_3D_Compare_Function        BackfaceStencilTestFunction;
6101b8e80941Smrg   enum GEN8_3D_Stencil_Operation       StencilPassDepthPassOp;
6102b8e80941Smrg   enum GEN8_3D_Stencil_Operation       StencilPassDepthFailOp;
6103b8e80941Smrg   enum GEN8_3D_Stencil_Operation       StencilFailOp;
6104b8e80941Smrg   uint32_t                             BackfaceStencilWriteMask;
6105b8e80941Smrg   uint32_t                             BackfaceStencilTestMask;
6106b8e80941Smrg   uint32_t                             StencilWriteMask;
6107b8e80941Smrg   uint32_t                             StencilTestMask;
6108b8e80941Smrg};
6109b8e80941Smrg
6110b8e80941Smrgstatic inline void
6111b8e80941SmrgGEN8_3DSTATE_WM_DEPTH_STENCIL_pack(__attribute__((unused)) __gen_user_data *data,
6112b8e80941Smrg                                   __attribute__((unused)) void * restrict dst,
6113b8e80941Smrg                                   __attribute__((unused)) const struct GEN8_3DSTATE_WM_DEPTH_STENCIL * restrict values)
6114b8e80941Smrg{
6115b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6116b8e80941Smrg
6117b8e80941Smrg   dw[0] =
6118b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
6119b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6120b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6121b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
6122b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6123b8e80941Smrg
6124b8e80941Smrg   dw[1] =
6125b8e80941Smrg      __gen_uint(values->DepthBufferWriteEnable, 0, 0) |
6126b8e80941Smrg      __gen_uint(values->DepthTestEnable, 1, 1) |
6127b8e80941Smrg      __gen_uint(values->StencilBufferWriteEnable, 2, 2) |
6128b8e80941Smrg      __gen_uint(values->StencilTestEnable, 3, 3) |
6129b8e80941Smrg      __gen_uint(values->DoubleSidedStencilEnable, 4, 4) |
6130b8e80941Smrg      __gen_uint(values->DepthTestFunction, 5, 7) |
6131b8e80941Smrg      __gen_uint(values->StencilTestFunction, 8, 10) |
6132b8e80941Smrg      __gen_uint(values->BackfaceStencilPassDepthPassOp, 11, 13) |
6133b8e80941Smrg      __gen_uint(values->BackfaceStencilPassDepthFailOp, 14, 16) |
6134b8e80941Smrg      __gen_uint(values->BackfaceStencilFailOp, 17, 19) |
6135b8e80941Smrg      __gen_uint(values->BackfaceStencilTestFunction, 20, 22) |
6136b8e80941Smrg      __gen_uint(values->StencilPassDepthPassOp, 23, 25) |
6137b8e80941Smrg      __gen_uint(values->StencilPassDepthFailOp, 26, 28) |
6138b8e80941Smrg      __gen_uint(values->StencilFailOp, 29, 31);
6139b8e80941Smrg
6140b8e80941Smrg   dw[2] =
6141b8e80941Smrg      __gen_uint(values->BackfaceStencilWriteMask, 0, 7) |
6142b8e80941Smrg      __gen_uint(values->BackfaceStencilTestMask, 8, 15) |
6143b8e80941Smrg      __gen_uint(values->StencilWriteMask, 16, 23) |
6144b8e80941Smrg      __gen_uint(values->StencilTestMask, 24, 31);
6145b8e80941Smrg}
6146b8e80941Smrg
6147b8e80941Smrg#define GEN8_3DSTATE_WM_HZ_OP_length           5
6148b8e80941Smrg#define GEN8_3DSTATE_WM_HZ_OP_length_bias      2
6149b8e80941Smrg#define GEN8_3DSTATE_WM_HZ_OP_header            \
6150b8e80941Smrg   .DWordLength                         =      3,  \
6151b8e80941Smrg   ._3DCommandSubOpcode                 =     82,  \
6152b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
6153b8e80941Smrg   .CommandSubType                      =      3,  \
6154b8e80941Smrg   .CommandType                         =      3
6155b8e80941Smrg
6156b8e80941Smrgstruct GEN8_3DSTATE_WM_HZ_OP {
6157b8e80941Smrg   uint32_t                             DWordLength;
6158b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
6159b8e80941Smrg   uint32_t                             _3DCommandOpcode;
6160b8e80941Smrg   uint32_t                             CommandSubType;
6161b8e80941Smrg   uint32_t                             CommandType;
6162b8e80941Smrg   uint32_t                             NumberofMultisamples;
6163b8e80941Smrg   uint32_t                             StencilClearValue;
6164b8e80941Smrg   bool                                 FullSurfaceDepthandStencilClear;
6165b8e80941Smrg   bool                                 PixelPositionOffsetEnable;
6166b8e80941Smrg   bool                                 HierarchicalDepthBufferResolveEnable;
6167b8e80941Smrg   bool                                 DepthBufferResolveEnable;
6168b8e80941Smrg   bool                                 ScissorRectangleEnable;
6169b8e80941Smrg   bool                                 DepthBufferClearEnable;
6170b8e80941Smrg   bool                                 StencilBufferClearEnable;
6171b8e80941Smrg   uint32_t                             ClearRectangleXMin;
6172b8e80941Smrg   uint32_t                             ClearRectangleYMin;
6173b8e80941Smrg   uint32_t                             ClearRectangleXMax;
6174b8e80941Smrg   uint32_t                             ClearRectangleYMax;
6175b8e80941Smrg   uint32_t                             SampleMask;
6176b8e80941Smrg};
6177b8e80941Smrg
6178b8e80941Smrgstatic inline void
6179b8e80941SmrgGEN8_3DSTATE_WM_HZ_OP_pack(__attribute__((unused)) __gen_user_data *data,
6180b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
6181b8e80941Smrg                           __attribute__((unused)) const struct GEN8_3DSTATE_WM_HZ_OP * restrict values)
6182b8e80941Smrg{
6183b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6184b8e80941Smrg
6185b8e80941Smrg   dw[0] =
6186b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
6187b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6188b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6189b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
6190b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6191b8e80941Smrg
6192b8e80941Smrg   dw[1] =
6193b8e80941Smrg      __gen_uint(values->NumberofMultisamples, 13, 15) |
6194b8e80941Smrg      __gen_uint(values->StencilClearValue, 16, 23) |
6195b8e80941Smrg      __gen_uint(values->FullSurfaceDepthandStencilClear, 25, 25) |
6196b8e80941Smrg      __gen_uint(values->PixelPositionOffsetEnable, 26, 26) |
6197b8e80941Smrg      __gen_uint(values->HierarchicalDepthBufferResolveEnable, 27, 27) |
6198b8e80941Smrg      __gen_uint(values->DepthBufferResolveEnable, 28, 28) |
6199b8e80941Smrg      __gen_uint(values->ScissorRectangleEnable, 29, 29) |
6200b8e80941Smrg      __gen_uint(values->DepthBufferClearEnable, 30, 30) |
6201b8e80941Smrg      __gen_uint(values->StencilBufferClearEnable, 31, 31);
6202b8e80941Smrg
6203b8e80941Smrg   dw[2] =
6204b8e80941Smrg      __gen_uint(values->ClearRectangleXMin, 0, 15) |
6205b8e80941Smrg      __gen_uint(values->ClearRectangleYMin, 16, 31);
6206b8e80941Smrg
6207b8e80941Smrg   dw[3] =
6208b8e80941Smrg      __gen_uint(values->ClearRectangleXMax, 0, 15) |
6209b8e80941Smrg      __gen_uint(values->ClearRectangleYMax, 16, 31);
6210b8e80941Smrg
6211b8e80941Smrg   dw[4] =
6212b8e80941Smrg      __gen_uint(values->SampleMask, 0, 15);
6213b8e80941Smrg}
6214b8e80941Smrg
6215b8e80941Smrg#define GEN8_GPGPU_CSR_BASE_ADDRESS_length      3
6216b8e80941Smrg#define GEN8_GPGPU_CSR_BASE_ADDRESS_length_bias      2
6217b8e80941Smrg#define GEN8_GPGPU_CSR_BASE_ADDRESS_header      \
6218b8e80941Smrg   .DWordLength                         =      1,  \
6219b8e80941Smrg   ._3DCommandSubOpcode                 =      4,  \
6220b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
6221b8e80941Smrg   .CommandSubType                      =      0,  \
6222b8e80941Smrg   .CommandType                         =      3
6223b8e80941Smrg
6224b8e80941Smrgstruct GEN8_GPGPU_CSR_BASE_ADDRESS {
6225b8e80941Smrg   uint32_t                             DWordLength;
6226b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
6227b8e80941Smrg   uint32_t                             _3DCommandOpcode;
6228b8e80941Smrg   uint32_t                             CommandSubType;
6229b8e80941Smrg   uint32_t                             CommandType;
6230b8e80941Smrg   __gen_address_type                   GPGPUCSRBaseAddress;
6231b8e80941Smrg};
6232b8e80941Smrg
6233b8e80941Smrgstatic inline void
6234b8e80941SmrgGEN8_GPGPU_CSR_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
6235b8e80941Smrg                                 __attribute__((unused)) void * restrict dst,
6236b8e80941Smrg                                 __attribute__((unused)) const struct GEN8_GPGPU_CSR_BASE_ADDRESS * restrict values)
6237b8e80941Smrg{
6238b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6239b8e80941Smrg
6240b8e80941Smrg   dw[0] =
6241b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
6242b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6243b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6244b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
6245b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6246b8e80941Smrg
6247b8e80941Smrg   const uint64_t v1_address =
6248b8e80941Smrg      __gen_combine_address(data, &dw[1], values->GPGPUCSRBaseAddress, 0);
6249b8e80941Smrg   dw[1] = v1_address;
6250b8e80941Smrg   dw[2] = v1_address >> 32;
6251b8e80941Smrg}
6252b8e80941Smrg
6253b8e80941Smrg#define GEN8_GPGPU_WALKER_length              15
6254b8e80941Smrg#define GEN8_GPGPU_WALKER_length_bias          2
6255b8e80941Smrg#define GEN8_GPGPU_WALKER_header                \
6256b8e80941Smrg   .DWordLength                         =     13,  \
6257b8e80941Smrg   .SubOpcode                           =      5,  \
6258b8e80941Smrg   .MediaCommandOpcode                  =      1,  \
6259b8e80941Smrg   .Pipeline                            =      2,  \
6260b8e80941Smrg   .CommandType                         =      3
6261b8e80941Smrg
6262b8e80941Smrgstruct GEN8_GPGPU_WALKER {
6263b8e80941Smrg   uint32_t                             DWordLength;
6264b8e80941Smrg   bool                                 PredicateEnable;
6265b8e80941Smrg   bool                                 IndirectParameterEnable;
6266b8e80941Smrg   uint32_t                             SubOpcode;
6267b8e80941Smrg   uint32_t                             MediaCommandOpcode;
6268b8e80941Smrg   uint32_t                             Pipeline;
6269b8e80941Smrg   uint32_t                             CommandType;
6270b8e80941Smrg   uint32_t                             InterfaceDescriptorOffset;
6271b8e80941Smrg   uint32_t                             IndirectDataLength;
6272b8e80941Smrg   uint64_t                             IndirectDataStartAddress;
6273b8e80941Smrg   uint32_t                             ThreadWidthCounterMaximum;
6274b8e80941Smrg   uint32_t                             ThreadHeightCounterMaximum;
6275b8e80941Smrg   uint32_t                             ThreadDepthCounterMaximum;
6276b8e80941Smrg   uint32_t                             SIMDSize;
6277b8e80941Smrg#define SIMD8                                    0
6278b8e80941Smrg#define SIMD16                                   1
6279b8e80941Smrg#define SIMD32                                   2
6280b8e80941Smrg   uint32_t                             ThreadGroupIDStartingX;
6281b8e80941Smrg   uint32_t                             ThreadGroupIDXDimension;
6282b8e80941Smrg   uint32_t                             ThreadGroupIDStartingY;
6283b8e80941Smrg   uint32_t                             ThreadGroupIDYDimension;
6284b8e80941Smrg   uint32_t                             ThreadGroupIDStartingResumeZ;
6285b8e80941Smrg   uint32_t                             ThreadGroupIDZDimension;
6286b8e80941Smrg   uint32_t                             RightExecutionMask;
6287b8e80941Smrg   uint32_t                             BottomExecutionMask;
6288b8e80941Smrg};
6289b8e80941Smrg
6290b8e80941Smrgstatic inline void
6291b8e80941SmrgGEN8_GPGPU_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
6292b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
6293b8e80941Smrg                       __attribute__((unused)) const struct GEN8_GPGPU_WALKER * restrict values)
6294b8e80941Smrg{
6295b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6296b8e80941Smrg
6297b8e80941Smrg   dw[0] =
6298b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
6299b8e80941Smrg      __gen_uint(values->PredicateEnable, 8, 8) |
6300b8e80941Smrg      __gen_uint(values->IndirectParameterEnable, 10, 10) |
6301b8e80941Smrg      __gen_uint(values->SubOpcode, 16, 23) |
6302b8e80941Smrg      __gen_uint(values->MediaCommandOpcode, 24, 26) |
6303b8e80941Smrg      __gen_uint(values->Pipeline, 27, 28) |
6304b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6305b8e80941Smrg
6306b8e80941Smrg   dw[1] =
6307b8e80941Smrg      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
6308b8e80941Smrg
6309b8e80941Smrg   dw[2] =
6310b8e80941Smrg      __gen_uint(values->IndirectDataLength, 0, 16);
6311b8e80941Smrg
6312b8e80941Smrg   dw[3] =
6313b8e80941Smrg      __gen_offset(values->IndirectDataStartAddress, 6, 31);
6314b8e80941Smrg
6315b8e80941Smrg   dw[4] =
6316b8e80941Smrg      __gen_uint(values->ThreadWidthCounterMaximum, 0, 5) |
6317b8e80941Smrg      __gen_uint(values->ThreadHeightCounterMaximum, 8, 13) |
6318b8e80941Smrg      __gen_uint(values->ThreadDepthCounterMaximum, 16, 21) |
6319b8e80941Smrg      __gen_uint(values->SIMDSize, 30, 31);
6320b8e80941Smrg
6321b8e80941Smrg   dw[5] =
6322b8e80941Smrg      __gen_uint(values->ThreadGroupIDStartingX, 0, 31);
6323b8e80941Smrg
6324b8e80941Smrg   dw[6] = 0;
6325b8e80941Smrg
6326b8e80941Smrg   dw[7] =
6327b8e80941Smrg      __gen_uint(values->ThreadGroupIDXDimension, 0, 31);
6328b8e80941Smrg
6329b8e80941Smrg   dw[8] =
6330b8e80941Smrg      __gen_uint(values->ThreadGroupIDStartingY, 0, 31);
6331b8e80941Smrg
6332b8e80941Smrg   dw[9] = 0;
6333b8e80941Smrg
6334b8e80941Smrg   dw[10] =
6335b8e80941Smrg      __gen_uint(values->ThreadGroupIDYDimension, 0, 31);
6336b8e80941Smrg
6337b8e80941Smrg   dw[11] =
6338b8e80941Smrg      __gen_uint(values->ThreadGroupIDStartingResumeZ, 0, 31);
6339b8e80941Smrg
6340b8e80941Smrg   dw[12] =
6341b8e80941Smrg      __gen_uint(values->ThreadGroupIDZDimension, 0, 31);
6342b8e80941Smrg
6343b8e80941Smrg   dw[13] =
6344b8e80941Smrg      __gen_uint(values->RightExecutionMask, 0, 31);
6345b8e80941Smrg
6346b8e80941Smrg   dw[14] =
6347b8e80941Smrg      __gen_uint(values->BottomExecutionMask, 0, 31);
6348b8e80941Smrg}
6349b8e80941Smrg
6350b8e80941Smrg#define GEN8_MEDIA_CURBE_LOAD_length           4
6351b8e80941Smrg#define GEN8_MEDIA_CURBE_LOAD_length_bias      2
6352b8e80941Smrg#define GEN8_MEDIA_CURBE_LOAD_header            \
6353b8e80941Smrg   .DWordLength                         =      2,  \
6354b8e80941Smrg   .SubOpcode                           =      1,  \
6355b8e80941Smrg   .MediaCommandOpcode                  =      0,  \
6356b8e80941Smrg   .Pipeline                            =      2,  \
6357b8e80941Smrg   .CommandType                         =      3
6358b8e80941Smrg
6359b8e80941Smrgstruct GEN8_MEDIA_CURBE_LOAD {
6360b8e80941Smrg   uint32_t                             DWordLength;
6361b8e80941Smrg   uint32_t                             SubOpcode;
6362b8e80941Smrg   uint32_t                             MediaCommandOpcode;
6363b8e80941Smrg   uint32_t                             Pipeline;
6364b8e80941Smrg   uint32_t                             CommandType;
6365b8e80941Smrg   uint32_t                             CURBETotalDataLength;
6366b8e80941Smrg   uint32_t                             CURBEDataStartAddress;
6367b8e80941Smrg};
6368b8e80941Smrg
6369b8e80941Smrgstatic inline void
6370b8e80941SmrgGEN8_MEDIA_CURBE_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
6371b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
6372b8e80941Smrg                           __attribute__((unused)) const struct GEN8_MEDIA_CURBE_LOAD * restrict values)
6373b8e80941Smrg{
6374b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6375b8e80941Smrg
6376b8e80941Smrg   dw[0] =
6377b8e80941Smrg      __gen_uint(values->DWordLength, 0, 15) |
6378b8e80941Smrg      __gen_uint(values->SubOpcode, 16, 23) |
6379b8e80941Smrg      __gen_uint(values->MediaCommandOpcode, 24, 26) |
6380b8e80941Smrg      __gen_uint(values->Pipeline, 27, 28) |
6381b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6382b8e80941Smrg
6383b8e80941Smrg   dw[1] = 0;
6384b8e80941Smrg
6385b8e80941Smrg   dw[2] =
6386b8e80941Smrg      __gen_uint(values->CURBETotalDataLength, 0, 16);
6387b8e80941Smrg
6388b8e80941Smrg   dw[3] =
6389b8e80941Smrg      __gen_uint(values->CURBEDataStartAddress, 0, 31);
6390b8e80941Smrg}
6391b8e80941Smrg
6392b8e80941Smrg#define GEN8_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length      4
6393b8e80941Smrg#define GEN8_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length_bias      2
6394b8e80941Smrg#define GEN8_MEDIA_INTERFACE_DESCRIPTOR_LOAD_header\
6395b8e80941Smrg   .DWordLength                         =      2,  \
6396b8e80941Smrg   .SubOpcode                           =      2,  \
6397b8e80941Smrg   .MediaCommandOpcode                  =      0,  \
6398b8e80941Smrg   .Pipeline                            =      2,  \
6399b8e80941Smrg   .CommandType                         =      3
6400b8e80941Smrg
6401b8e80941Smrgstruct GEN8_MEDIA_INTERFACE_DESCRIPTOR_LOAD {
6402b8e80941Smrg   uint32_t                             DWordLength;
6403b8e80941Smrg   uint32_t                             SubOpcode;
6404b8e80941Smrg   uint32_t                             MediaCommandOpcode;
6405b8e80941Smrg   uint32_t                             Pipeline;
6406b8e80941Smrg   uint32_t                             CommandType;
6407b8e80941Smrg   uint32_t                             InterfaceDescriptorTotalLength;
6408b8e80941Smrg   uint64_t                             InterfaceDescriptorDataStartAddress;
6409b8e80941Smrg};
6410b8e80941Smrg
6411b8e80941Smrgstatic inline void
6412b8e80941SmrgGEN8_MEDIA_INTERFACE_DESCRIPTOR_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
6413b8e80941Smrg                                          __attribute__((unused)) void * restrict dst,
6414b8e80941Smrg                                          __attribute__((unused)) const struct GEN8_MEDIA_INTERFACE_DESCRIPTOR_LOAD * restrict values)
6415b8e80941Smrg{
6416b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6417b8e80941Smrg
6418b8e80941Smrg   dw[0] =
6419b8e80941Smrg      __gen_uint(values->DWordLength, 0, 15) |
6420b8e80941Smrg      __gen_uint(values->SubOpcode, 16, 23) |
6421b8e80941Smrg      __gen_uint(values->MediaCommandOpcode, 24, 26) |
6422b8e80941Smrg      __gen_uint(values->Pipeline, 27, 28) |
6423b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6424b8e80941Smrg
6425b8e80941Smrg   dw[1] = 0;
6426b8e80941Smrg
6427b8e80941Smrg   dw[2] =
6428b8e80941Smrg      __gen_uint(values->InterfaceDescriptorTotalLength, 0, 16);
6429b8e80941Smrg
6430b8e80941Smrg   dw[3] =
6431b8e80941Smrg      __gen_offset(values->InterfaceDescriptorDataStartAddress, 0, 31);
6432b8e80941Smrg}
6433b8e80941Smrg
6434b8e80941Smrg#define GEN8_MEDIA_OBJECT_length_bias          2
6435b8e80941Smrg#define GEN8_MEDIA_OBJECT_header                \
6436b8e80941Smrg   .DWordLength                         =      4,  \
6437b8e80941Smrg   .MediaCommandSubOpcode               =      0,  \
6438b8e80941Smrg   .MediaCommandOpcode                  =      1,  \
6439b8e80941Smrg   .MediaCommandPipeline                =      2,  \
6440b8e80941Smrg   .CommandType                         =      3
6441b8e80941Smrg
6442b8e80941Smrgstruct GEN8_MEDIA_OBJECT {
6443b8e80941Smrg   uint32_t                             DWordLength;
6444b8e80941Smrg   uint32_t                             MediaCommandSubOpcode;
6445b8e80941Smrg   uint32_t                             MediaCommandOpcode;
6446b8e80941Smrg   uint32_t                             MediaCommandPipeline;
6447b8e80941Smrg   uint32_t                             CommandType;
6448b8e80941Smrg   uint32_t                             InterfaceDescriptorOffset;
6449b8e80941Smrg   uint32_t                             IndirectDataLength;
6450b8e80941Smrg   uint32_t                             SubSliceDestinationSelect;
6451b8e80941Smrg#define SubSlice2                                2
6452b8e80941Smrg#define SubSlice1                                1
6453b8e80941Smrg#define SubSlice0                                0
6454b8e80941Smrg   uint32_t                             SliceDestinationSelect;
6455b8e80941Smrg#define Slice0                                   0
6456b8e80941Smrg#define Slice1                                   1
6457b8e80941Smrg#define Slice2                                   2
6458b8e80941Smrg   uint32_t                             UseScoreboard;
6459b8e80941Smrg#define Notusingscoreboard                       0
6460b8e80941Smrg#define Usingscoreboard                          1
6461b8e80941Smrg   uint32_t                             ForceDestination;
6462b8e80941Smrg   uint32_t                             ThreadSynchronization;
6463b8e80941Smrg#define Nothreadsynchronization                  0
6464b8e80941Smrg#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
6465b8e80941Smrg   bool                                 ChildrenPresent;
6466b8e80941Smrg   __gen_address_type                   IndirectDataStartAddress;
6467b8e80941Smrg   uint32_t                             ScoreboardX;
6468b8e80941Smrg   uint32_t                             ScoredboardY;
6469b8e80941Smrg   uint32_t                             ScoreboardMask;
6470b8e80941Smrg   uint32_t                             ScoreboardColor;
6471b8e80941Smrg   /* variable length fields follow */
6472b8e80941Smrg};
6473b8e80941Smrg
6474b8e80941Smrgstatic inline void
6475b8e80941SmrgGEN8_MEDIA_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
6476b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
6477b8e80941Smrg                       __attribute__((unused)) const struct GEN8_MEDIA_OBJECT * restrict values)
6478b8e80941Smrg{
6479b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6480b8e80941Smrg
6481b8e80941Smrg   dw[0] =
6482b8e80941Smrg      __gen_uint(values->DWordLength, 0, 15) |
6483b8e80941Smrg      __gen_uint(values->MediaCommandSubOpcode, 16, 23) |
6484b8e80941Smrg      __gen_uint(values->MediaCommandOpcode, 24, 26) |
6485b8e80941Smrg      __gen_uint(values->MediaCommandPipeline, 27, 28) |
6486b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6487b8e80941Smrg
6488b8e80941Smrg   dw[1] =
6489b8e80941Smrg      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
6490b8e80941Smrg
6491b8e80941Smrg   dw[2] =
6492b8e80941Smrg      __gen_uint(values->IndirectDataLength, 0, 16) |
6493b8e80941Smrg      __gen_uint(values->SubSliceDestinationSelect, 17, 18) |
6494b8e80941Smrg      __gen_uint(values->SliceDestinationSelect, 19, 20) |
6495b8e80941Smrg      __gen_uint(values->UseScoreboard, 21, 21) |
6496b8e80941Smrg      __gen_uint(values->ForceDestination, 22, 22) |
6497b8e80941Smrg      __gen_uint(values->ThreadSynchronization, 24, 24) |
6498b8e80941Smrg      __gen_uint(values->ChildrenPresent, 31, 31);
6499b8e80941Smrg
6500b8e80941Smrg   dw[3] = __gen_combine_address(data, &dw[3], values->IndirectDataStartAddress, 0);
6501b8e80941Smrg
6502b8e80941Smrg   dw[4] =
6503b8e80941Smrg      __gen_uint(values->ScoreboardX, 0, 8) |
6504b8e80941Smrg      __gen_uint(values->ScoredboardY, 16, 24);
6505b8e80941Smrg
6506b8e80941Smrg   dw[5] =
6507b8e80941Smrg      __gen_uint(values->ScoreboardMask, 0, 7) |
6508b8e80941Smrg      __gen_uint(values->ScoreboardColor, 16, 19);
6509b8e80941Smrg}
6510b8e80941Smrg
6511b8e80941Smrg#define GEN8_MEDIA_OBJECT_GRPID_length_bias      2
6512b8e80941Smrg#define GEN8_MEDIA_OBJECT_GRPID_header          \
6513b8e80941Smrg   .DWordLength                         =      5,  \
6514b8e80941Smrg   .MediaCommandSubOpcode               =      6,  \
6515b8e80941Smrg   .MediaCommandOpcode                  =      1,  \
6516b8e80941Smrg   .MediaCommandPipeline                =      2,  \
6517b8e80941Smrg   .CommandType                         =      3
6518b8e80941Smrg
6519b8e80941Smrgstruct GEN8_MEDIA_OBJECT_GRPID {
6520b8e80941Smrg   uint32_t                             DWordLength;
6521b8e80941Smrg   uint32_t                             MediaCommandSubOpcode;
6522b8e80941Smrg   uint32_t                             MediaCommandOpcode;
6523b8e80941Smrg   uint32_t                             MediaCommandPipeline;
6524b8e80941Smrg   uint32_t                             CommandType;
6525b8e80941Smrg   uint32_t                             InterfaceDescriptorOffset;
6526b8e80941Smrg   uint32_t                             IndirectDataLength;
6527b8e80941Smrg   uint32_t                             SubSliceDestinationSelect;
6528b8e80941Smrg#define SubSlice2                                2
6529b8e80941Smrg#define SubSlice1                                1
6530b8e80941Smrg#define SubSlice0                                0
6531b8e80941Smrg   uint32_t                             SliceDestinationSelect;
6532b8e80941Smrg#define Slice0                                   0
6533b8e80941Smrg#define Slice1                                   1
6534b8e80941Smrg#define Slice2                                   2
6535b8e80941Smrg   uint32_t                             UseScoreboard;
6536b8e80941Smrg#define Notusingscoreboard                       0
6537b8e80941Smrg#define Usingscoreboard                          1
6538b8e80941Smrg   uint32_t                             ForceDestination;
6539b8e80941Smrg   uint32_t                             EndofThreadGroup;
6540b8e80941Smrg   __gen_address_type                   IndirectDataStartAddress;
6541b8e80941Smrg   uint32_t                             ScoreboardX;
6542b8e80941Smrg   uint32_t                             ScoreboardY;
6543b8e80941Smrg   uint32_t                             ScoreboardMask;
6544b8e80941Smrg   uint32_t                             ScoreboardColor;
6545b8e80941Smrg   uint32_t                             GroupID;
6546b8e80941Smrg   /* variable length fields follow */
6547b8e80941Smrg};
6548b8e80941Smrg
6549b8e80941Smrgstatic inline void
6550b8e80941SmrgGEN8_MEDIA_OBJECT_GRPID_pack(__attribute__((unused)) __gen_user_data *data,
6551b8e80941Smrg                             __attribute__((unused)) void * restrict dst,
6552b8e80941Smrg                             __attribute__((unused)) const struct GEN8_MEDIA_OBJECT_GRPID * restrict values)
6553b8e80941Smrg{
6554b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6555b8e80941Smrg
6556b8e80941Smrg   dw[0] =
6557b8e80941Smrg      __gen_uint(values->DWordLength, 0, 15) |
6558b8e80941Smrg      __gen_uint(values->MediaCommandSubOpcode, 16, 23) |
6559b8e80941Smrg      __gen_uint(values->MediaCommandOpcode, 24, 26) |
6560b8e80941Smrg      __gen_uint(values->MediaCommandPipeline, 27, 28) |
6561b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6562b8e80941Smrg
6563b8e80941Smrg   dw[1] =
6564b8e80941Smrg      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
6565b8e80941Smrg
6566b8e80941Smrg   dw[2] =
6567b8e80941Smrg      __gen_uint(values->IndirectDataLength, 0, 16) |
6568b8e80941Smrg      __gen_uint(values->SubSliceDestinationSelect, 17, 18) |
6569b8e80941Smrg      __gen_uint(values->SliceDestinationSelect, 19, 20) |
6570b8e80941Smrg      __gen_uint(values->UseScoreboard, 21, 21) |
6571b8e80941Smrg      __gen_uint(values->ForceDestination, 22, 22) |
6572b8e80941Smrg      __gen_uint(values->EndofThreadGroup, 23, 23);
6573b8e80941Smrg
6574b8e80941Smrg   dw[3] = __gen_combine_address(data, &dw[3], values->IndirectDataStartAddress, 0);
6575b8e80941Smrg
6576b8e80941Smrg   dw[4] =
6577b8e80941Smrg      __gen_uint(values->ScoreboardX, 0, 8) |
6578b8e80941Smrg      __gen_uint(values->ScoreboardY, 16, 24);
6579b8e80941Smrg
6580b8e80941Smrg   dw[5] =
6581b8e80941Smrg      __gen_uint(values->ScoreboardMask, 0, 7) |
6582b8e80941Smrg      __gen_uint(values->ScoreboardColor, 16, 19);
6583b8e80941Smrg
6584b8e80941Smrg   dw[6] =
6585b8e80941Smrg      __gen_uint(values->GroupID, 0, 31);
6586b8e80941Smrg}
6587b8e80941Smrg
6588b8e80941Smrg#define GEN8_MEDIA_OBJECT_PRT_length          16
6589b8e80941Smrg#define GEN8_MEDIA_OBJECT_PRT_length_bias      2
6590b8e80941Smrg#define GEN8_MEDIA_OBJECT_PRT_header            \
6591b8e80941Smrg   .DWordLength                         =     14,  \
6592b8e80941Smrg   .SubOpcode                           =      2,  \
6593b8e80941Smrg   .MediaCommandOpcode                  =      1,  \
6594b8e80941Smrg   .Pipeline                            =      2,  \
6595b8e80941Smrg   .CommandType                         =      3
6596b8e80941Smrg
6597b8e80941Smrgstruct GEN8_MEDIA_OBJECT_PRT {
6598b8e80941Smrg   uint32_t                             DWordLength;
6599b8e80941Smrg   uint32_t                             SubOpcode;
6600b8e80941Smrg   uint32_t                             MediaCommandOpcode;
6601b8e80941Smrg   uint32_t                             Pipeline;
6602b8e80941Smrg   uint32_t                             CommandType;
6603b8e80941Smrg   uint32_t                             InterfaceDescriptorOffset;
6604b8e80941Smrg   uint32_t                             PRT_FenceType;
6605b8e80941Smrg#define Rootthreadqueue                          0
6606b8e80941Smrg#define VFEstateflush                            1
6607b8e80941Smrg   bool                                 PRT_FenceNeeded;
6608b8e80941Smrg   bool                                 ChildrenPresent;
6609b8e80941Smrg   uint32_t                             InlineData[12];
6610b8e80941Smrg};
6611b8e80941Smrg
6612b8e80941Smrgstatic inline void
6613b8e80941SmrgGEN8_MEDIA_OBJECT_PRT_pack(__attribute__((unused)) __gen_user_data *data,
6614b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
6615b8e80941Smrg                           __attribute__((unused)) const struct GEN8_MEDIA_OBJECT_PRT * restrict values)
6616b8e80941Smrg{
6617b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6618b8e80941Smrg
6619b8e80941Smrg   dw[0] =
6620b8e80941Smrg      __gen_uint(values->DWordLength, 0, 15) |
6621b8e80941Smrg      __gen_uint(values->SubOpcode, 16, 23) |
6622b8e80941Smrg      __gen_uint(values->MediaCommandOpcode, 24, 26) |
6623b8e80941Smrg      __gen_uint(values->Pipeline, 27, 28) |
6624b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6625b8e80941Smrg
6626b8e80941Smrg   dw[1] =
6627b8e80941Smrg      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
6628b8e80941Smrg
6629b8e80941Smrg   dw[2] =
6630b8e80941Smrg      __gen_uint(values->PRT_FenceType, 22, 22) |
6631b8e80941Smrg      __gen_uint(values->PRT_FenceNeeded, 23, 23) |
6632b8e80941Smrg      __gen_uint(values->ChildrenPresent, 31, 31);
6633b8e80941Smrg
6634b8e80941Smrg   dw[3] = 0;
6635b8e80941Smrg
6636b8e80941Smrg   dw[4] =
6637b8e80941Smrg      __gen_uint(values->InlineData[0], 0, 31);
6638b8e80941Smrg
6639b8e80941Smrg   dw[5] =
6640b8e80941Smrg      __gen_uint(values->InlineData[1], 0, 31);
6641b8e80941Smrg
6642b8e80941Smrg   dw[6] =
6643b8e80941Smrg      __gen_uint(values->InlineData[2], 0, 31);
6644b8e80941Smrg
6645b8e80941Smrg   dw[7] =
6646b8e80941Smrg      __gen_uint(values->InlineData[3], 0, 31);
6647b8e80941Smrg
6648b8e80941Smrg   dw[8] =
6649b8e80941Smrg      __gen_uint(values->InlineData[4], 0, 31);
6650b8e80941Smrg
6651b8e80941Smrg   dw[9] =
6652b8e80941Smrg      __gen_uint(values->InlineData[5], 0, 31);
6653b8e80941Smrg
6654b8e80941Smrg   dw[10] =
6655b8e80941Smrg      __gen_uint(values->InlineData[6], 0, 31);
6656b8e80941Smrg
6657b8e80941Smrg   dw[11] =
6658b8e80941Smrg      __gen_uint(values->InlineData[7], 0, 31);
6659b8e80941Smrg
6660b8e80941Smrg   dw[12] =
6661b8e80941Smrg      __gen_uint(values->InlineData[8], 0, 31);
6662b8e80941Smrg
6663b8e80941Smrg   dw[13] =
6664b8e80941Smrg      __gen_uint(values->InlineData[9], 0, 31);
6665b8e80941Smrg
6666b8e80941Smrg   dw[14] =
6667b8e80941Smrg      __gen_uint(values->InlineData[10], 0, 31);
6668b8e80941Smrg
6669b8e80941Smrg   dw[15] =
6670b8e80941Smrg      __gen_uint(values->InlineData[11], 0, 31);
6671b8e80941Smrg}
6672b8e80941Smrg
6673b8e80941Smrg#define GEN8_MEDIA_OBJECT_WALKER_length_bias      2
6674b8e80941Smrg#define GEN8_MEDIA_OBJECT_WALKER_header         \
6675b8e80941Smrg   .DWordLength                         =     15,  \
6676b8e80941Smrg   .SubOpcode                           =      3,  \
6677b8e80941Smrg   .MediaCommandOpcode                  =      1,  \
6678b8e80941Smrg   .Pipeline                            =      2,  \
6679b8e80941Smrg   .CommandType                         =      3
6680b8e80941Smrg
6681b8e80941Smrgstruct GEN8_MEDIA_OBJECT_WALKER {
6682b8e80941Smrg   uint32_t                             DWordLength;
6683b8e80941Smrg   uint32_t                             SubOpcode;
6684b8e80941Smrg   uint32_t                             MediaCommandOpcode;
6685b8e80941Smrg   uint32_t                             Pipeline;
6686b8e80941Smrg   uint32_t                             CommandType;
6687b8e80941Smrg   uint32_t                             InterfaceDescriptorOffset;
6688b8e80941Smrg   uint32_t                             IndirectDataLength;
6689b8e80941Smrg   uint32_t                             UseScoreboard;
6690b8e80941Smrg#define Notusingscoreboard                       0
6691b8e80941Smrg#define Usingscoreboard                          1
6692b8e80941Smrg   uint32_t                             ThreadSynchronization;
6693b8e80941Smrg#define Nothreadsynchronization                  0
6694b8e80941Smrg#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
6695b8e80941Smrg   uint32_t                             ChildrenPresent;
6696b8e80941Smrg   uint64_t                             IndirectDataStartAddress;
6697b8e80941Smrg   uint32_t                             ScoreboardMask;
6698b8e80941Smrg   uint32_t                             GroupIDLoopSelect;
6699b8e80941Smrg   int32_t                              MidLoopUnitX;
6700b8e80941Smrg   int32_t                              LocalMidLoopUnitY;
6701b8e80941Smrg   uint32_t                             MiddleLoopExtraSteps;
6702b8e80941Smrg   uint32_t                             ColorCountMinusOne;
6703b8e80941Smrg   uint32_t                             LocalLoopExecCount;
6704b8e80941Smrg   uint32_t                             GlobalLoopExecCount;
6705b8e80941Smrg   uint32_t                             BlockResolutionX;
6706b8e80941Smrg   uint32_t                             BlockResolutionY;
6707b8e80941Smrg   uint32_t                             LocalStartX;
6708b8e80941Smrg   uint32_t                             LocalStartY;
6709b8e80941Smrg   int32_t                              LocalOuterLoopStrideX;
6710b8e80941Smrg   int32_t                              LocalOuterLoopStrideY;
6711b8e80941Smrg   int32_t                              LocalInnerLoopUnitX;
6712b8e80941Smrg   int32_t                              LocalInnerLoopUnitY;
6713b8e80941Smrg   uint32_t                             GlobalResolutionX;
6714b8e80941Smrg   uint32_t                             GlobalResolutionY;
6715b8e80941Smrg   int32_t                              GlobalStartX;
6716b8e80941Smrg   int32_t                              GlobalStartY;
6717b8e80941Smrg   int32_t                              GlobalOuterLoopStrideX;
6718b8e80941Smrg   int32_t                              GlobalOuterLoopStrideY;
6719b8e80941Smrg   int32_t                              GlobalInnerLoopUnitX;
6720b8e80941Smrg   int32_t                              GlobalInnerLoopUnitY;
6721b8e80941Smrg   /* variable length fields follow */
6722b8e80941Smrg};
6723b8e80941Smrg
6724b8e80941Smrgstatic inline void
6725b8e80941SmrgGEN8_MEDIA_OBJECT_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
6726b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
6727b8e80941Smrg                              __attribute__((unused)) const struct GEN8_MEDIA_OBJECT_WALKER * restrict values)
6728b8e80941Smrg{
6729b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6730b8e80941Smrg
6731b8e80941Smrg   dw[0] =
6732b8e80941Smrg      __gen_uint(values->DWordLength, 0, 15) |
6733b8e80941Smrg      __gen_uint(values->SubOpcode, 16, 23) |
6734b8e80941Smrg      __gen_uint(values->MediaCommandOpcode, 24, 26) |
6735b8e80941Smrg      __gen_uint(values->Pipeline, 27, 28) |
6736b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6737b8e80941Smrg
6738b8e80941Smrg   dw[1] =
6739b8e80941Smrg      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
6740b8e80941Smrg
6741b8e80941Smrg   dw[2] =
6742b8e80941Smrg      __gen_uint(values->IndirectDataLength, 0, 16) |
6743b8e80941Smrg      __gen_uint(values->UseScoreboard, 21, 21) |
6744b8e80941Smrg      __gen_uint(values->ThreadSynchronization, 24, 24) |
6745b8e80941Smrg      __gen_uint(values->ChildrenPresent, 31, 31);
6746b8e80941Smrg
6747b8e80941Smrg   dw[3] =
6748b8e80941Smrg      __gen_offset(values->IndirectDataStartAddress, 0, 31);
6749b8e80941Smrg
6750b8e80941Smrg   dw[4] = 0;
6751b8e80941Smrg
6752b8e80941Smrg   dw[5] =
6753b8e80941Smrg      __gen_uint(values->ScoreboardMask, 0, 7) |
6754b8e80941Smrg      __gen_uint(values->GroupIDLoopSelect, 8, 31);
6755b8e80941Smrg
6756b8e80941Smrg   dw[6] =
6757b8e80941Smrg      __gen_sint(values->MidLoopUnitX, 8, 9) |
6758b8e80941Smrg      __gen_sint(values->LocalMidLoopUnitY, 12, 13) |
6759b8e80941Smrg      __gen_uint(values->MiddleLoopExtraSteps, 16, 20) |
6760b8e80941Smrg      __gen_uint(values->ColorCountMinusOne, 24, 27);
6761b8e80941Smrg
6762b8e80941Smrg   dw[7] =
6763b8e80941Smrg      __gen_uint(values->LocalLoopExecCount, 0, 9) |
6764b8e80941Smrg      __gen_uint(values->GlobalLoopExecCount, 16, 25);
6765b8e80941Smrg
6766b8e80941Smrg   dw[8] =
6767b8e80941Smrg      __gen_uint(values->BlockResolutionX, 0, 8) |
6768b8e80941Smrg      __gen_uint(values->BlockResolutionY, 16, 24);
6769b8e80941Smrg
6770b8e80941Smrg   dw[9] =
6771b8e80941Smrg      __gen_uint(values->LocalStartX, 0, 8) |
6772b8e80941Smrg      __gen_uint(values->LocalStartY, 16, 24);
6773b8e80941Smrg
6774b8e80941Smrg   dw[10] = 0;
6775b8e80941Smrg
6776b8e80941Smrg   dw[11] =
6777b8e80941Smrg      __gen_sint(values->LocalOuterLoopStrideX, 0, 9) |
6778b8e80941Smrg      __gen_sint(values->LocalOuterLoopStrideY, 16, 25);
6779b8e80941Smrg
6780b8e80941Smrg   dw[12] =
6781b8e80941Smrg      __gen_sint(values->LocalInnerLoopUnitX, 0, 9) |
6782b8e80941Smrg      __gen_sint(values->LocalInnerLoopUnitY, 16, 25);
6783b8e80941Smrg
6784b8e80941Smrg   dw[13] =
6785b8e80941Smrg      __gen_uint(values->GlobalResolutionX, 0, 8) |
6786b8e80941Smrg      __gen_uint(values->GlobalResolutionY, 16, 24);
6787b8e80941Smrg
6788b8e80941Smrg   dw[14] =
6789b8e80941Smrg      __gen_sint(values->GlobalStartX, 0, 9) |
6790b8e80941Smrg      __gen_sint(values->GlobalStartY, 16, 25);
6791b8e80941Smrg
6792b8e80941Smrg   dw[15] =
6793b8e80941Smrg      __gen_sint(values->GlobalOuterLoopStrideX, 0, 9) |
6794b8e80941Smrg      __gen_sint(values->GlobalOuterLoopStrideY, 16, 25);
6795b8e80941Smrg
6796b8e80941Smrg   dw[16] =
6797b8e80941Smrg      __gen_sint(values->GlobalInnerLoopUnitX, 0, 9) |
6798b8e80941Smrg      __gen_sint(values->GlobalInnerLoopUnitY, 16, 25);
6799b8e80941Smrg}
6800b8e80941Smrg
6801b8e80941Smrg#define GEN8_MEDIA_STATE_FLUSH_length          2
6802b8e80941Smrg#define GEN8_MEDIA_STATE_FLUSH_length_bias      2
6803b8e80941Smrg#define GEN8_MEDIA_STATE_FLUSH_header           \
6804b8e80941Smrg   .DWordLength                         =      0,  \
6805b8e80941Smrg   .SubOpcode                           =      4,  \
6806b8e80941Smrg   .MediaCommandOpcode                  =      0,  \
6807b8e80941Smrg   .Pipeline                            =      2,  \
6808b8e80941Smrg   .CommandType                         =      3
6809b8e80941Smrg
6810b8e80941Smrgstruct GEN8_MEDIA_STATE_FLUSH {
6811b8e80941Smrg   uint32_t                             DWordLength;
6812b8e80941Smrg   uint32_t                             SubOpcode;
6813b8e80941Smrg   uint32_t                             MediaCommandOpcode;
6814b8e80941Smrg   uint32_t                             Pipeline;
6815b8e80941Smrg   uint32_t                             CommandType;
6816b8e80941Smrg   uint32_t                             InterfaceDescriptorOffset;
6817b8e80941Smrg   uint32_t                             WatermarkRequired;
6818b8e80941Smrg   bool                                 FlushtoGO;
6819b8e80941Smrg};
6820b8e80941Smrg
6821b8e80941Smrgstatic inline void
6822b8e80941SmrgGEN8_MEDIA_STATE_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
6823b8e80941Smrg                            __attribute__((unused)) void * restrict dst,
6824b8e80941Smrg                            __attribute__((unused)) const struct GEN8_MEDIA_STATE_FLUSH * restrict values)
6825b8e80941Smrg{
6826b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6827b8e80941Smrg
6828b8e80941Smrg   dw[0] =
6829b8e80941Smrg      __gen_uint(values->DWordLength, 0, 15) |
6830b8e80941Smrg      __gen_uint(values->SubOpcode, 16, 23) |
6831b8e80941Smrg      __gen_uint(values->MediaCommandOpcode, 24, 26) |
6832b8e80941Smrg      __gen_uint(values->Pipeline, 27, 28) |
6833b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6834b8e80941Smrg
6835b8e80941Smrg   dw[1] =
6836b8e80941Smrg      __gen_uint(values->InterfaceDescriptorOffset, 0, 5) |
6837b8e80941Smrg      __gen_uint(values->WatermarkRequired, 6, 6) |
6838b8e80941Smrg      __gen_uint(values->FlushtoGO, 7, 7);
6839b8e80941Smrg}
6840b8e80941Smrg
6841b8e80941Smrg#define GEN8_MEDIA_VFE_STATE_length            9
6842b8e80941Smrg#define GEN8_MEDIA_VFE_STATE_length_bias       2
6843b8e80941Smrg#define GEN8_MEDIA_VFE_STATE_header             \
6844b8e80941Smrg   .DWordLength                         =      7,  \
6845b8e80941Smrg   .SubOpcode                           =      0,  \
6846b8e80941Smrg   .MediaCommandOpcode                  =      0,  \
6847b8e80941Smrg   .Pipeline                            =      2,  \
6848b8e80941Smrg   .CommandType                         =      3
6849b8e80941Smrg
6850b8e80941Smrgstruct GEN8_MEDIA_VFE_STATE {
6851b8e80941Smrg   uint32_t                             DWordLength;
6852b8e80941Smrg   uint32_t                             SubOpcode;
6853b8e80941Smrg   uint32_t                             MediaCommandOpcode;
6854b8e80941Smrg   uint32_t                             Pipeline;
6855b8e80941Smrg   uint32_t                             CommandType;
6856b8e80941Smrg   uint32_t                             PerThreadScratchSpace;
6857b8e80941Smrg   uint32_t                             StackSize;
6858b8e80941Smrg   __gen_address_type                   ScratchSpaceBasePointer;
6859b8e80941Smrg   uint32_t                             BypassGatewayControl;
6860b8e80941Smrg#define MaintainingOpenGatewayForwardMsgCloseGatewayprotocollegacymode 0
6861b8e80941Smrg#define BypassingOpenGatewayCloseGatewayprotocol 1
6862b8e80941Smrg   uint32_t                             ResetGatewayTimer;
6863b8e80941Smrg#define Maintainingtheexistingtimestampstate     0
6864b8e80941Smrg#define Resettingrelativetimerandlatchingtheglobaltimestamp 1
6865b8e80941Smrg   uint32_t                             NumberofURBEntries;
6866b8e80941Smrg   uint32_t                             MaximumNumberofThreads;
6867b8e80941Smrg   uint32_t                             SliceDisable;
6868b8e80941Smrg#define AllSubslicesEnabled                      0
6869b8e80941Smrg#define OnlySlice0Enabled                        1
6870b8e80941Smrg#define OnlySlice0Subslice0Enabled               3
6871b8e80941Smrg   uint32_t                             CURBEAllocationSize;
6872b8e80941Smrg   uint32_t                             URBEntryAllocationSize;
6873b8e80941Smrg   uint32_t                             ScoreboardMask;
6874b8e80941Smrg   uint32_t                             ScoreboardType;
6875b8e80941Smrg#define StallingScoreboard                       0
6876b8e80941Smrg#define NonStallingScoreboard                    1
6877b8e80941Smrg   bool                                 ScoreboardEnable;
6878b8e80941Smrg   int32_t                              Scoreboard0DeltaX;
6879b8e80941Smrg   int32_t                              Scoreboard0DeltaY;
6880b8e80941Smrg   int32_t                              Scoreboard1DeltaX;
6881b8e80941Smrg   int32_t                              Scoreboard1DeltaY;
6882b8e80941Smrg   int32_t                              Scoreboard2DeltaX;
6883b8e80941Smrg   int32_t                              Scoreboard2DeltaY;
6884b8e80941Smrg   int32_t                              Scoreboard3DeltaX;
6885b8e80941Smrg   int32_t                              Scoreboard3DeltaY;
6886b8e80941Smrg   int32_t                              Scoreboard4DeltaX;
6887b8e80941Smrg   int32_t                              Scoreboard4DeltaY;
6888b8e80941Smrg   int32_t                              Scoreboard5DeltaX;
6889b8e80941Smrg   int32_t                              Scoreboard5DeltaY;
6890b8e80941Smrg   int32_t                              Scoreboard6DeltaX;
6891b8e80941Smrg   int32_t                              Scoreboard6DeltaY;
6892b8e80941Smrg   int32_t                              Scoreboard7DeltaX;
6893b8e80941Smrg   int32_t                              Scoreboard7DeltaY;
6894b8e80941Smrg};
6895b8e80941Smrg
6896b8e80941Smrgstatic inline void
6897b8e80941SmrgGEN8_MEDIA_VFE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
6898b8e80941Smrg                          __attribute__((unused)) void * restrict dst,
6899b8e80941Smrg                          __attribute__((unused)) const struct GEN8_MEDIA_VFE_STATE * restrict values)
6900b8e80941Smrg{
6901b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6902b8e80941Smrg
6903b8e80941Smrg   dw[0] =
6904b8e80941Smrg      __gen_uint(values->DWordLength, 0, 15) |
6905b8e80941Smrg      __gen_uint(values->SubOpcode, 16, 23) |
6906b8e80941Smrg      __gen_uint(values->MediaCommandOpcode, 24, 26) |
6907b8e80941Smrg      __gen_uint(values->Pipeline, 27, 28) |
6908b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6909b8e80941Smrg
6910b8e80941Smrg   const uint64_t v1 =
6911b8e80941Smrg      __gen_uint(values->PerThreadScratchSpace, 0, 3) |
6912b8e80941Smrg      __gen_uint(values->StackSize, 4, 7);
6913b8e80941Smrg   const uint64_t v1_address =
6914b8e80941Smrg      __gen_combine_address(data, &dw[1], values->ScratchSpaceBasePointer, v1);
6915b8e80941Smrg   dw[1] = v1_address;
6916b8e80941Smrg   dw[2] = (v1_address >> 32) | (v1 >> 32);
6917b8e80941Smrg
6918b8e80941Smrg   dw[3] =
6919b8e80941Smrg      __gen_uint(values->BypassGatewayControl, 6, 6) |
6920b8e80941Smrg      __gen_uint(values->ResetGatewayTimer, 7, 7) |
6921b8e80941Smrg      __gen_uint(values->NumberofURBEntries, 8, 15) |
6922b8e80941Smrg      __gen_uint(values->MaximumNumberofThreads, 16, 31);
6923b8e80941Smrg
6924b8e80941Smrg   dw[4] =
6925b8e80941Smrg      __gen_uint(values->SliceDisable, 0, 1);
6926b8e80941Smrg
6927b8e80941Smrg   dw[5] =
6928b8e80941Smrg      __gen_uint(values->CURBEAllocationSize, 0, 15) |
6929b8e80941Smrg      __gen_uint(values->URBEntryAllocationSize, 16, 31);
6930b8e80941Smrg
6931b8e80941Smrg   dw[6] =
6932b8e80941Smrg      __gen_uint(values->ScoreboardMask, 0, 7) |
6933b8e80941Smrg      __gen_uint(values->ScoreboardType, 30, 30) |
6934b8e80941Smrg      __gen_uint(values->ScoreboardEnable, 31, 31);
6935b8e80941Smrg
6936b8e80941Smrg   dw[7] =
6937b8e80941Smrg      __gen_sint(values->Scoreboard0DeltaX, 0, 3) |
6938b8e80941Smrg      __gen_sint(values->Scoreboard0DeltaY, 4, 7) |
6939b8e80941Smrg      __gen_sint(values->Scoreboard1DeltaX, 8, 11) |
6940b8e80941Smrg      __gen_sint(values->Scoreboard1DeltaY, 12, 15) |
6941b8e80941Smrg      __gen_sint(values->Scoreboard2DeltaX, 16, 19) |
6942b8e80941Smrg      __gen_sint(values->Scoreboard2DeltaY, 20, 23) |
6943b8e80941Smrg      __gen_sint(values->Scoreboard3DeltaX, 24, 27) |
6944b8e80941Smrg      __gen_sint(values->Scoreboard3DeltaY, 28, 31);
6945b8e80941Smrg
6946b8e80941Smrg   dw[8] =
6947b8e80941Smrg      __gen_sint(values->Scoreboard4DeltaX, 0, 3) |
6948b8e80941Smrg      __gen_sint(values->Scoreboard4DeltaY, 4, 7) |
6949b8e80941Smrg      __gen_sint(values->Scoreboard5DeltaX, 8, 11) |
6950b8e80941Smrg      __gen_sint(values->Scoreboard5DeltaY, 12, 15) |
6951b8e80941Smrg      __gen_sint(values->Scoreboard6DeltaX, 16, 19) |
6952b8e80941Smrg      __gen_sint(values->Scoreboard6DeltaY, 20, 23) |
6953b8e80941Smrg      __gen_sint(values->Scoreboard7DeltaX, 24, 27) |
6954b8e80941Smrg      __gen_sint(values->Scoreboard7DeltaY, 28, 31);
6955b8e80941Smrg}
6956b8e80941Smrg
6957b8e80941Smrg#define GEN8_MI_ARB_CHECK_length               1
6958b8e80941Smrg#define GEN8_MI_ARB_CHECK_length_bias          1
6959b8e80941Smrg#define GEN8_MI_ARB_CHECK_header                \
6960b8e80941Smrg   .MICommandOpcode                     =      5,  \
6961b8e80941Smrg   .CommandType                         =      0
6962b8e80941Smrg
6963b8e80941Smrgstruct GEN8_MI_ARB_CHECK {
6964b8e80941Smrg   uint32_t                             MICommandOpcode;
6965b8e80941Smrg   uint32_t                             CommandType;
6966b8e80941Smrg};
6967b8e80941Smrg
6968b8e80941Smrgstatic inline void
6969b8e80941SmrgGEN8_MI_ARB_CHECK_pack(__attribute__((unused)) __gen_user_data *data,
6970b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
6971b8e80941Smrg                       __attribute__((unused)) const struct GEN8_MI_ARB_CHECK * restrict values)
6972b8e80941Smrg{
6973b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6974b8e80941Smrg
6975b8e80941Smrg   dw[0] =
6976b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
6977b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6978b8e80941Smrg}
6979b8e80941Smrg
6980b8e80941Smrg#define GEN8_MI_ARB_ON_OFF_length              1
6981b8e80941Smrg#define GEN8_MI_ARB_ON_OFF_length_bias         1
6982b8e80941Smrg#define GEN8_MI_ARB_ON_OFF_header               \
6983b8e80941Smrg   .ArbitrationEnable                   =      1,  \
6984b8e80941Smrg   .MICommandOpcode                     =      8,  \
6985b8e80941Smrg   .CommandType                         =      0
6986b8e80941Smrg
6987b8e80941Smrgstruct GEN8_MI_ARB_ON_OFF {
6988b8e80941Smrg   bool                                 ArbitrationEnable;
6989b8e80941Smrg   uint32_t                             MICommandOpcode;
6990b8e80941Smrg   uint32_t                             CommandType;
6991b8e80941Smrg};
6992b8e80941Smrg
6993b8e80941Smrgstatic inline void
6994b8e80941SmrgGEN8_MI_ARB_ON_OFF_pack(__attribute__((unused)) __gen_user_data *data,
6995b8e80941Smrg                        __attribute__((unused)) void * restrict dst,
6996b8e80941Smrg                        __attribute__((unused)) const struct GEN8_MI_ARB_ON_OFF * restrict values)
6997b8e80941Smrg{
6998b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6999b8e80941Smrg
7000b8e80941Smrg   dw[0] =
7001b8e80941Smrg      __gen_uint(values->ArbitrationEnable, 0, 0) |
7002b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7003b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7004b8e80941Smrg}
7005b8e80941Smrg
7006b8e80941Smrg#define GEN8_MI_ATOMIC_length                  3
7007b8e80941Smrg#define GEN8_MI_ATOMIC_length_bias             2
7008b8e80941Smrg#define GEN8_MI_ATOMIC_header                   \
7009b8e80941Smrg   .DWordLength                         =      1,  \
7010b8e80941Smrg   .MICommandOpcode                     =     47,  \
7011b8e80941Smrg   .CommandType                         =      0
7012b8e80941Smrg
7013b8e80941Smrgstruct GEN8_MI_ATOMIC {
7014b8e80941Smrg   uint32_t                             DWordLength;
7015b8e80941Smrg   uint32_t                             ATOMICOPCODE;
7016b8e80941Smrg   uint32_t                             ReturnDataControl;
7017b8e80941Smrg   uint32_t                             CSSTALL;
7018b8e80941Smrg   uint32_t                             InlineData;
7019b8e80941Smrg   uint32_t                             DataSize;
7020b8e80941Smrg#define DWORD                                    0
7021b8e80941Smrg#define QWORD                                    1
7022b8e80941Smrg#define OCTWORD                                  2
7023b8e80941Smrg#define RESERVED                                 3
7024b8e80941Smrg   bool                                 PostSyncOperation;
7025b8e80941Smrg   uint32_t                             MemoryType;
7026b8e80941Smrg#define PerProcessGraphicsAddress                0
7027b8e80941Smrg#define GlobalGraphicsAddress                    1
7028b8e80941Smrg   uint32_t                             MICommandOpcode;
7029b8e80941Smrg   uint32_t                             CommandType;
7030b8e80941Smrg   __gen_address_type                   MemoryAddress;
7031b8e80941Smrg   uint32_t                             Operand1DataDword0;
7032b8e80941Smrg   uint32_t                             Operand2DataDword0;
7033b8e80941Smrg   uint32_t                             Operand1DataDword1;
7034b8e80941Smrg   uint32_t                             Operand2DataDword1;
7035b8e80941Smrg   uint32_t                             Operand1DataDword2;
7036b8e80941Smrg   uint32_t                             Operand2DataDword2;
7037b8e80941Smrg   uint32_t                             Operand1DataDword3;
7038b8e80941Smrg   uint32_t                             Operand2DataDword3;
7039b8e80941Smrg};
7040b8e80941Smrg
7041b8e80941Smrgstatic inline void
7042b8e80941SmrgGEN8_MI_ATOMIC_pack(__attribute__((unused)) __gen_user_data *data,
7043b8e80941Smrg                    __attribute__((unused)) void * restrict dst,
7044b8e80941Smrg                    __attribute__((unused)) const struct GEN8_MI_ATOMIC * restrict values)
7045b8e80941Smrg{
7046b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7047b8e80941Smrg
7048b8e80941Smrg   dw[0] =
7049b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
7050b8e80941Smrg      __gen_uint(values->ATOMICOPCODE, 8, 15) |
7051b8e80941Smrg      __gen_uint(values->ReturnDataControl, 16, 16) |
7052b8e80941Smrg      __gen_uint(values->CSSTALL, 17, 17) |
7053b8e80941Smrg      __gen_uint(values->InlineData, 18, 18) |
7054b8e80941Smrg      __gen_uint(values->DataSize, 19, 20) |
7055b8e80941Smrg      __gen_uint(values->PostSyncOperation, 21, 21) |
7056b8e80941Smrg      __gen_uint(values->MemoryType, 22, 22) |
7057b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7058b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7059b8e80941Smrg
7060b8e80941Smrg   const uint64_t v1_address =
7061b8e80941Smrg      __gen_combine_address(data, &dw[1], values->MemoryAddress, 0);
7062b8e80941Smrg   dw[1] = v1_address;
7063b8e80941Smrg   dw[2] = v1_address >> 32;
7064b8e80941Smrg}
7065b8e80941Smrg
7066b8e80941Smrg#define GEN8_MI_BATCH_BUFFER_END_length        1
7067b8e80941Smrg#define GEN8_MI_BATCH_BUFFER_END_length_bias      1
7068b8e80941Smrg#define GEN8_MI_BATCH_BUFFER_END_header         \
7069b8e80941Smrg   .MICommandOpcode                     =     10,  \
7070b8e80941Smrg   .CommandType                         =      0
7071b8e80941Smrg
7072b8e80941Smrgstruct GEN8_MI_BATCH_BUFFER_END {
7073b8e80941Smrg   uint32_t                             MICommandOpcode;
7074b8e80941Smrg   uint32_t                             CommandType;
7075b8e80941Smrg};
7076b8e80941Smrg
7077b8e80941Smrgstatic inline void
7078b8e80941SmrgGEN8_MI_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
7079b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
7080b8e80941Smrg                              __attribute__((unused)) const struct GEN8_MI_BATCH_BUFFER_END * restrict values)
7081b8e80941Smrg{
7082b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7083b8e80941Smrg
7084b8e80941Smrg   dw[0] =
7085b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7086b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7087b8e80941Smrg}
7088b8e80941Smrg
7089b8e80941Smrg#define GEN8_MI_BATCH_BUFFER_START_length      3
7090b8e80941Smrg#define GEN8_MI_BATCH_BUFFER_START_length_bias      2
7091b8e80941Smrg#define GEN8_MI_BATCH_BUFFER_START_header       \
7092b8e80941Smrg   .DWordLength                         =      1,  \
7093b8e80941Smrg   .MICommandOpcode                     =     49,  \
7094b8e80941Smrg   .CommandType                         =      0
7095b8e80941Smrg
7096b8e80941Smrgstruct GEN8_MI_BATCH_BUFFER_START {
7097b8e80941Smrg   uint32_t                             DWordLength;
7098b8e80941Smrg   uint32_t                             AddressSpaceIndicator;
7099b8e80941Smrg#define ASI_GGTT                                 0
7100b8e80941Smrg#define ASI_PPGTT                                1
7101b8e80941Smrg   bool                                 ResourceStreamerEnable;
7102b8e80941Smrg   bool                                 PredicationEnable;
7103b8e80941Smrg   bool                                 AddOffsetEnable;
7104b8e80941Smrg   uint32_t                             SecondLevelBatchBuffer;
7105b8e80941Smrg#define Firstlevelbatch                          0
7106b8e80941Smrg#define Secondlevelbatch                         1
7107b8e80941Smrg   uint32_t                             MICommandOpcode;
7108b8e80941Smrg   uint32_t                             CommandType;
7109b8e80941Smrg   __gen_address_type                   BatchBufferStartAddress;
7110b8e80941Smrg};
7111b8e80941Smrg
7112b8e80941Smrgstatic inline void
7113b8e80941SmrgGEN8_MI_BATCH_BUFFER_START_pack(__attribute__((unused)) __gen_user_data *data,
7114b8e80941Smrg                                __attribute__((unused)) void * restrict dst,
7115b8e80941Smrg                                __attribute__((unused)) const struct GEN8_MI_BATCH_BUFFER_START * restrict values)
7116b8e80941Smrg{
7117b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7118b8e80941Smrg
7119b8e80941Smrg   dw[0] =
7120b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
7121b8e80941Smrg      __gen_uint(values->AddressSpaceIndicator, 8, 8) |
7122b8e80941Smrg      __gen_uint(values->ResourceStreamerEnable, 10, 10) |
7123b8e80941Smrg      __gen_uint(values->PredicationEnable, 15, 15) |
7124b8e80941Smrg      __gen_uint(values->AddOffsetEnable, 16, 16) |
7125b8e80941Smrg      __gen_uint(values->SecondLevelBatchBuffer, 22, 22) |
7126b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7127b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7128b8e80941Smrg
7129b8e80941Smrg   const uint64_t v1_address =
7130b8e80941Smrg      __gen_combine_address(data, &dw[1], values->BatchBufferStartAddress, 0);
7131b8e80941Smrg   dw[1] = v1_address;
7132b8e80941Smrg   dw[2] = v1_address >> 32;
7133b8e80941Smrg}
7134b8e80941Smrg
7135b8e80941Smrg#define GEN8_MI_CLFLUSH_length_bias            2
7136b8e80941Smrg#define GEN8_MI_CLFLUSH_header                  \
7137b8e80941Smrg   .DWordLength                         =      1,  \
7138b8e80941Smrg   .MICommandOpcode                     =     39,  \
7139b8e80941Smrg   .CommandType                         =      0
7140b8e80941Smrg
7141b8e80941Smrgstruct GEN8_MI_CLFLUSH {
7142b8e80941Smrg   uint32_t                             DWordLength;
7143b8e80941Smrg   bool                                 UseGlobalGTT;
7144b8e80941Smrg   uint32_t                             MICommandOpcode;
7145b8e80941Smrg   uint32_t                             CommandType;
7146b8e80941Smrg   uint32_t                             StartingCachelineOffset;
7147b8e80941Smrg   __gen_address_type                   PageBaseAddress;
7148b8e80941Smrg   /* variable length fields follow */
7149b8e80941Smrg};
7150b8e80941Smrg
7151b8e80941Smrgstatic inline void
7152b8e80941SmrgGEN8_MI_CLFLUSH_pack(__attribute__((unused)) __gen_user_data *data,
7153b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
7154b8e80941Smrg                     __attribute__((unused)) const struct GEN8_MI_CLFLUSH * restrict values)
7155b8e80941Smrg{
7156b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7157b8e80941Smrg
7158b8e80941Smrg   dw[0] =
7159b8e80941Smrg      __gen_uint(values->DWordLength, 0, 9) |
7160b8e80941Smrg      __gen_uint(values->UseGlobalGTT, 22, 22) |
7161b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7162b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7163b8e80941Smrg
7164b8e80941Smrg   const uint64_t v1 =
7165b8e80941Smrg      __gen_uint(values->StartingCachelineOffset, 6, 11);
7166b8e80941Smrg   const uint64_t v1_address =
7167b8e80941Smrg      __gen_combine_address(data, &dw[1], values->PageBaseAddress, v1);
7168b8e80941Smrg   dw[1] = v1_address;
7169b8e80941Smrg   dw[2] = (v1_address >> 32) | (v1 >> 32);
7170b8e80941Smrg}
7171b8e80941Smrg
7172b8e80941Smrg#define GEN8_MI_CONDITIONAL_BATCH_BUFFER_END_length      3
7173b8e80941Smrg#define GEN8_MI_CONDITIONAL_BATCH_BUFFER_END_length_bias      2
7174b8e80941Smrg#define GEN8_MI_CONDITIONAL_BATCH_BUFFER_END_header\
7175b8e80941Smrg   .DWordLength                         =      1,  \
7176b8e80941Smrg   .CompareSemaphore                    =      0,  \
7177b8e80941Smrg   .MICommandOpcode                     =     54,  \
7178b8e80941Smrg   .CommandType                         =      0
7179b8e80941Smrg
7180b8e80941Smrgstruct GEN8_MI_CONDITIONAL_BATCH_BUFFER_END {
7181b8e80941Smrg   uint32_t                             DWordLength;
7182b8e80941Smrg   uint32_t                             CompareSemaphore;
7183b8e80941Smrg   bool                                 UseGlobalGTT;
7184b8e80941Smrg   uint32_t                             MICommandOpcode;
7185b8e80941Smrg   uint32_t                             CommandType;
7186b8e80941Smrg   uint32_t                             CompareDataDword;
7187b8e80941Smrg   __gen_address_type                   CompareAddress;
7188b8e80941Smrg};
7189b8e80941Smrg
7190b8e80941Smrgstatic inline void
7191b8e80941SmrgGEN8_MI_CONDITIONAL_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
7192b8e80941Smrg                                          __attribute__((unused)) void * restrict dst,
7193b8e80941Smrg                                          __attribute__((unused)) const struct GEN8_MI_CONDITIONAL_BATCH_BUFFER_END * restrict values)
7194b8e80941Smrg{
7195b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7196b8e80941Smrg
7197b8e80941Smrg   dw[0] =
7198b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
7199b8e80941Smrg      __gen_uint(values->CompareSemaphore, 21, 21) |
7200b8e80941Smrg      __gen_uint(values->UseGlobalGTT, 22, 22) |
7201b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7202b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7203b8e80941Smrg
7204b8e80941Smrg   dw[1] =
7205b8e80941Smrg      __gen_uint(values->CompareDataDword, 0, 31);
7206b8e80941Smrg
7207b8e80941Smrg   const uint64_t v2_address =
7208b8e80941Smrg      __gen_combine_address(data, &dw[2], values->CompareAddress, 0);
7209b8e80941Smrg   dw[2] = v2_address;
7210b8e80941Smrg   dw[3] = v2_address >> 32;
7211b8e80941Smrg}
7212b8e80941Smrg
7213b8e80941Smrg#define GEN8_MI_COPY_MEM_MEM_length            5
7214b8e80941Smrg#define GEN8_MI_COPY_MEM_MEM_length_bias       2
7215b8e80941Smrg#define GEN8_MI_COPY_MEM_MEM_header             \
7216b8e80941Smrg   .DWordLength                         =      3,  \
7217b8e80941Smrg   .MICommandOpcode                     =     46,  \
7218b8e80941Smrg   .CommandType                         =      0
7219b8e80941Smrg
7220b8e80941Smrgstruct GEN8_MI_COPY_MEM_MEM {
7221b8e80941Smrg   uint32_t                             DWordLength;
7222b8e80941Smrg   bool                                 UseGlobalGTTDestination;
7223b8e80941Smrg   bool                                 UseGlobalGTTSource;
7224b8e80941Smrg   uint32_t                             MICommandOpcode;
7225b8e80941Smrg   uint32_t                             CommandType;
7226b8e80941Smrg   __gen_address_type                   DestinationMemoryAddress;
7227b8e80941Smrg   __gen_address_type                   SourceMemoryAddress;
7228b8e80941Smrg};
7229b8e80941Smrg
7230b8e80941Smrgstatic inline void
7231b8e80941SmrgGEN8_MI_COPY_MEM_MEM_pack(__attribute__((unused)) __gen_user_data *data,
7232b8e80941Smrg                          __attribute__((unused)) void * restrict dst,
7233b8e80941Smrg                          __attribute__((unused)) const struct GEN8_MI_COPY_MEM_MEM * restrict values)
7234b8e80941Smrg{
7235b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7236b8e80941Smrg
7237b8e80941Smrg   dw[0] =
7238b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
7239b8e80941Smrg      __gen_uint(values->UseGlobalGTTDestination, 21, 21) |
7240b8e80941Smrg      __gen_uint(values->UseGlobalGTTSource, 22, 22) |
7241b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7242b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7243b8e80941Smrg
7244b8e80941Smrg   const uint64_t v1_address =
7245b8e80941Smrg      __gen_combine_address(data, &dw[1], values->DestinationMemoryAddress, 0);
7246b8e80941Smrg   dw[1] = v1_address;
7247b8e80941Smrg   dw[2] = v1_address >> 32;
7248b8e80941Smrg
7249b8e80941Smrg   const uint64_t v3_address =
7250b8e80941Smrg      __gen_combine_address(data, &dw[3], values->SourceMemoryAddress, 0);
7251b8e80941Smrg   dw[3] = v3_address;
7252b8e80941Smrg   dw[4] = v3_address >> 32;
7253b8e80941Smrg}
7254b8e80941Smrg
7255b8e80941Smrg#define GEN8_MI_LOAD_REGISTER_IMM_length       3
7256b8e80941Smrg#define GEN8_MI_LOAD_REGISTER_IMM_length_bias      2
7257b8e80941Smrg#define GEN8_MI_LOAD_REGISTER_IMM_header        \
7258b8e80941Smrg   .DWordLength                         =      1,  \
7259b8e80941Smrg   .MICommandOpcode                     =     34,  \
7260b8e80941Smrg   .CommandType                         =      0
7261b8e80941Smrg
7262b8e80941Smrgstruct GEN8_MI_LOAD_REGISTER_IMM {
7263b8e80941Smrg   uint32_t                             DWordLength;
7264b8e80941Smrg   uint32_t                             ByteWriteDisables;
7265b8e80941Smrg   uint32_t                             MICommandOpcode;
7266b8e80941Smrg   uint32_t                             CommandType;
7267b8e80941Smrg   uint64_t                             RegisterOffset;
7268b8e80941Smrg   uint32_t                             DataDWord;
7269b8e80941Smrg   /* variable length fields follow */
7270b8e80941Smrg};
7271b8e80941Smrg
7272b8e80941Smrgstatic inline void
7273b8e80941SmrgGEN8_MI_LOAD_REGISTER_IMM_pack(__attribute__((unused)) __gen_user_data *data,
7274b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
7275b8e80941Smrg                               __attribute__((unused)) const struct GEN8_MI_LOAD_REGISTER_IMM * restrict values)
7276b8e80941Smrg{
7277b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7278b8e80941Smrg
7279b8e80941Smrg   dw[0] =
7280b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
7281b8e80941Smrg      __gen_uint(values->ByteWriteDisables, 8, 11) |
7282b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7283b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7284b8e80941Smrg
7285b8e80941Smrg   dw[1] =
7286b8e80941Smrg      __gen_offset(values->RegisterOffset, 2, 22);
7287b8e80941Smrg
7288b8e80941Smrg   dw[2] =
7289b8e80941Smrg      __gen_uint(values->DataDWord, 0, 31);
7290b8e80941Smrg}
7291b8e80941Smrg
7292b8e80941Smrg#define GEN8_MI_LOAD_REGISTER_MEM_length       4
7293b8e80941Smrg#define GEN8_MI_LOAD_REGISTER_MEM_length_bias      2
7294b8e80941Smrg#define GEN8_MI_LOAD_REGISTER_MEM_header        \
7295b8e80941Smrg   .DWordLength                         =      2,  \
7296b8e80941Smrg   .MICommandOpcode                     =     41,  \
7297b8e80941Smrg   .CommandType                         =      0
7298b8e80941Smrg
7299b8e80941Smrgstruct GEN8_MI_LOAD_REGISTER_MEM {
7300b8e80941Smrg   uint32_t                             DWordLength;
7301b8e80941Smrg   bool                                 AsyncModeEnable;
7302b8e80941Smrg   bool                                 UseGlobalGTT;
7303b8e80941Smrg   uint32_t                             MICommandOpcode;
7304b8e80941Smrg   uint32_t                             CommandType;
7305b8e80941Smrg   uint64_t                             RegisterAddress;
7306b8e80941Smrg   __gen_address_type                   MemoryAddress;
7307b8e80941Smrg};
7308b8e80941Smrg
7309b8e80941Smrgstatic inline void
7310b8e80941SmrgGEN8_MI_LOAD_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
7311b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
7312b8e80941Smrg                               __attribute__((unused)) const struct GEN8_MI_LOAD_REGISTER_MEM * restrict values)
7313b8e80941Smrg{
7314b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7315b8e80941Smrg
7316b8e80941Smrg   dw[0] =
7317b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
7318b8e80941Smrg      __gen_uint(values->AsyncModeEnable, 21, 21) |
7319b8e80941Smrg      __gen_uint(values->UseGlobalGTT, 22, 22) |
7320b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7321b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7322b8e80941Smrg
7323b8e80941Smrg   dw[1] =
7324b8e80941Smrg      __gen_offset(values->RegisterAddress, 2, 22);
7325b8e80941Smrg
7326b8e80941Smrg   const uint64_t v2_address =
7327b8e80941Smrg      __gen_combine_address(data, &dw[2], values->MemoryAddress, 0);
7328b8e80941Smrg   dw[2] = v2_address;
7329b8e80941Smrg   dw[3] = v2_address >> 32;
7330b8e80941Smrg}
7331b8e80941Smrg
7332b8e80941Smrg#define GEN8_MI_LOAD_REGISTER_REG_length       3
7333b8e80941Smrg#define GEN8_MI_LOAD_REGISTER_REG_length_bias      2
7334b8e80941Smrg#define GEN8_MI_LOAD_REGISTER_REG_header        \
7335b8e80941Smrg   .DWordLength                         =      1,  \
7336b8e80941Smrg   .MICommandOpcode                     =     42,  \
7337b8e80941Smrg   .CommandType                         =      0
7338b8e80941Smrg
7339b8e80941Smrgstruct GEN8_MI_LOAD_REGISTER_REG {
7340b8e80941Smrg   uint32_t                             DWordLength;
7341b8e80941Smrg   uint32_t                             MICommandOpcode;
7342b8e80941Smrg   uint32_t                             CommandType;
7343b8e80941Smrg   uint64_t                             SourceRegisterAddress;
7344b8e80941Smrg   uint64_t                             DestinationRegisterAddress;
7345b8e80941Smrg};
7346b8e80941Smrg
7347b8e80941Smrgstatic inline void
7348b8e80941SmrgGEN8_MI_LOAD_REGISTER_REG_pack(__attribute__((unused)) __gen_user_data *data,
7349b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
7350b8e80941Smrg                               __attribute__((unused)) const struct GEN8_MI_LOAD_REGISTER_REG * restrict values)
7351b8e80941Smrg{
7352b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7353b8e80941Smrg
7354b8e80941Smrg   dw[0] =
7355b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
7356b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7357b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7358b8e80941Smrg
7359b8e80941Smrg   dw[1] =
7360b8e80941Smrg      __gen_offset(values->SourceRegisterAddress, 2, 22);
7361b8e80941Smrg
7362b8e80941Smrg   dw[2] =
7363b8e80941Smrg      __gen_offset(values->DestinationRegisterAddress, 2, 22);
7364b8e80941Smrg}
7365b8e80941Smrg
7366b8e80941Smrg#define GEN8_MI_LOAD_SCAN_LINES_EXCL_length      2
7367b8e80941Smrg#define GEN8_MI_LOAD_SCAN_LINES_EXCL_length_bias      2
7368b8e80941Smrg#define GEN8_MI_LOAD_SCAN_LINES_EXCL_header     \
7369b8e80941Smrg   .DWordLength                         =      0,  \
7370b8e80941Smrg   .MICommandOpcode                     =     19,  \
7371b8e80941Smrg   .CommandType                         =      0
7372b8e80941Smrg
7373b8e80941Smrgstruct GEN8_MI_LOAD_SCAN_LINES_EXCL {
7374b8e80941Smrg   uint32_t                             DWordLength;
7375b8e80941Smrg   uint32_t                             DisplayPlaneSelect;
7376b8e80941Smrg#define DisplayPlaneA                            0
7377b8e80941Smrg#define DisplayPlaneB                            1
7378b8e80941Smrg#define DisplayPlaneC                            4
7379b8e80941Smrg   uint32_t                             MICommandOpcode;
7380b8e80941Smrg   uint32_t                             CommandType;
7381b8e80941Smrg   uint32_t                             EndScanLineNumber;
7382b8e80941Smrg   uint32_t                             StartScanLineNumber;
7383b8e80941Smrg};
7384b8e80941Smrg
7385b8e80941Smrgstatic inline void
7386b8e80941SmrgGEN8_MI_LOAD_SCAN_LINES_EXCL_pack(__attribute__((unused)) __gen_user_data *data,
7387b8e80941Smrg                                  __attribute__((unused)) void * restrict dst,
7388b8e80941Smrg                                  __attribute__((unused)) const struct GEN8_MI_LOAD_SCAN_LINES_EXCL * restrict values)
7389b8e80941Smrg{
7390b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7391b8e80941Smrg
7392b8e80941Smrg   dw[0] =
7393b8e80941Smrg      __gen_uint(values->DWordLength, 0, 5) |
7394b8e80941Smrg      __gen_uint(values->DisplayPlaneSelect, 19, 21) |
7395b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7396b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7397b8e80941Smrg
7398b8e80941Smrg   dw[1] =
7399b8e80941Smrg      __gen_uint(values->EndScanLineNumber, 0, 12) |
7400b8e80941Smrg      __gen_uint(values->StartScanLineNumber, 16, 28);
7401b8e80941Smrg}
7402b8e80941Smrg
7403b8e80941Smrg#define GEN8_MI_LOAD_SCAN_LINES_INCL_length      2
7404b8e80941Smrg#define GEN8_MI_LOAD_SCAN_LINES_INCL_length_bias      2
7405b8e80941Smrg#define GEN8_MI_LOAD_SCAN_LINES_INCL_header     \
7406b8e80941Smrg   .DWordLength                         =      0,  \
7407b8e80941Smrg   .MICommandOpcode                     =     18,  \
7408b8e80941Smrg   .CommandType                         =      0
7409b8e80941Smrg
7410b8e80941Smrgstruct GEN8_MI_LOAD_SCAN_LINES_INCL {
7411b8e80941Smrg   uint32_t                             DWordLength;
7412b8e80941Smrg   uint32_t                             ScanLineEventDoneForward;
7413b8e80941Smrg   uint32_t                             DisplayPlaneSelect;
7414b8e80941Smrg#define DisplayPlaneA                            0
7415b8e80941Smrg#define DisplayPlaneB                            1
7416b8e80941Smrg#define DisplayPlaneC                            4
7417b8e80941Smrg   uint32_t                             MICommandOpcode;
7418b8e80941Smrg   uint32_t                             CommandType;
7419b8e80941Smrg   uint32_t                             EndScanLineNumber;
7420b8e80941Smrg   uint32_t                             StartScanLineNumber;
7421b8e80941Smrg};
7422b8e80941Smrg
7423b8e80941Smrgstatic inline void
7424b8e80941SmrgGEN8_MI_LOAD_SCAN_LINES_INCL_pack(__attribute__((unused)) __gen_user_data *data,
7425b8e80941Smrg                                  __attribute__((unused)) void * restrict dst,
7426b8e80941Smrg                                  __attribute__((unused)) const struct GEN8_MI_LOAD_SCAN_LINES_INCL * restrict values)
7427b8e80941Smrg{
7428b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7429b8e80941Smrg
7430b8e80941Smrg   dw[0] =
7431b8e80941Smrg      __gen_uint(values->DWordLength, 0, 5) |
7432b8e80941Smrg      __gen_uint(values->ScanLineEventDoneForward, 17, 18) |
7433b8e80941Smrg      __gen_uint(values->DisplayPlaneSelect, 19, 21) |
7434b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7435b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7436b8e80941Smrg
7437b8e80941Smrg   dw[1] =
7438b8e80941Smrg      __gen_uint(values->EndScanLineNumber, 0, 12) |
7439b8e80941Smrg      __gen_uint(values->StartScanLineNumber, 16, 28);
7440b8e80941Smrg}
7441b8e80941Smrg
7442b8e80941Smrg#define GEN8_MI_LOAD_URB_MEM_length            4
7443b8e80941Smrg#define GEN8_MI_LOAD_URB_MEM_length_bias       2
7444b8e80941Smrg#define GEN8_MI_LOAD_URB_MEM_header             \
7445b8e80941Smrg   .DWordLength                         =      2,  \
7446b8e80941Smrg   .MICommandOpcode                     =     44,  \
7447b8e80941Smrg   .CommandType                         =      0
7448b8e80941Smrg
7449b8e80941Smrgstruct GEN8_MI_LOAD_URB_MEM {
7450b8e80941Smrg   uint32_t                             DWordLength;
7451b8e80941Smrg   uint32_t                             MICommandOpcode;
7452b8e80941Smrg   uint32_t                             CommandType;
7453b8e80941Smrg   uint32_t                             URBAddress;
7454b8e80941Smrg   __gen_address_type                   MemoryAddress;
7455b8e80941Smrg};
7456b8e80941Smrg
7457b8e80941Smrgstatic inline void
7458b8e80941SmrgGEN8_MI_LOAD_URB_MEM_pack(__attribute__((unused)) __gen_user_data *data,
7459b8e80941Smrg                          __attribute__((unused)) void * restrict dst,
7460b8e80941Smrg                          __attribute__((unused)) const struct GEN8_MI_LOAD_URB_MEM * restrict values)
7461b8e80941Smrg{
7462b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7463b8e80941Smrg
7464b8e80941Smrg   dw[0] =
7465b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
7466b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7467b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7468b8e80941Smrg
7469b8e80941Smrg   dw[1] =
7470b8e80941Smrg      __gen_uint(values->URBAddress, 2, 14);
7471b8e80941Smrg
7472b8e80941Smrg   const uint64_t v2_address =
7473b8e80941Smrg      __gen_combine_address(data, &dw[2], values->MemoryAddress, 0);
7474b8e80941Smrg   dw[2] = v2_address;
7475b8e80941Smrg   dw[3] = v2_address >> 32;
7476b8e80941Smrg}
7477b8e80941Smrg
7478b8e80941Smrg#define GEN8_MI_MATH_length_bias               2
7479b8e80941Smrg#define GEN8_MI_MATH_header                     \
7480b8e80941Smrg   .DWordLength                         =      0,  \
7481b8e80941Smrg   .MICommandOpcode                     =     26,  \
7482b8e80941Smrg   .CommandType                         =      0
7483b8e80941Smrg
7484b8e80941Smrgstruct GEN8_MI_MATH {
7485b8e80941Smrg   uint32_t                             DWordLength;
7486b8e80941Smrg   uint32_t                             MICommandOpcode;
7487b8e80941Smrg   uint32_t                             CommandType;
7488b8e80941Smrg   /* variable length fields follow */
7489b8e80941Smrg};
7490b8e80941Smrg
7491b8e80941Smrgstatic inline void
7492b8e80941SmrgGEN8_MI_MATH_pack(__attribute__((unused)) __gen_user_data *data,
7493b8e80941Smrg                  __attribute__((unused)) void * restrict dst,
7494b8e80941Smrg                  __attribute__((unused)) const struct GEN8_MI_MATH * restrict values)
7495b8e80941Smrg{
7496b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7497b8e80941Smrg
7498b8e80941Smrg   dw[0] =
7499b8e80941Smrg      __gen_uint(values->DWordLength, 0, 5) |
7500b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7501b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7502b8e80941Smrg}
7503b8e80941Smrg
7504b8e80941Smrg#define GEN8_MI_NOOP_length                    1
7505b8e80941Smrg#define GEN8_MI_NOOP_length_bias               1
7506b8e80941Smrg#define GEN8_MI_NOOP_header                     \
7507b8e80941Smrg   .MICommandOpcode                     =      0,  \
7508b8e80941Smrg   .CommandType                         =      0
7509b8e80941Smrg
7510b8e80941Smrgstruct GEN8_MI_NOOP {
7511b8e80941Smrg   uint32_t                             IdentificationNumber;
7512b8e80941Smrg   bool                                 IdentificationNumberRegisterWriteEnable;
7513b8e80941Smrg   uint32_t                             MICommandOpcode;
7514b8e80941Smrg   uint32_t                             CommandType;
7515b8e80941Smrg};
7516b8e80941Smrg
7517b8e80941Smrgstatic inline void
7518b8e80941SmrgGEN8_MI_NOOP_pack(__attribute__((unused)) __gen_user_data *data,
7519b8e80941Smrg                  __attribute__((unused)) void * restrict dst,
7520b8e80941Smrg                  __attribute__((unused)) const struct GEN8_MI_NOOP * restrict values)
7521b8e80941Smrg{
7522b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7523b8e80941Smrg
7524b8e80941Smrg   dw[0] =
7525b8e80941Smrg      __gen_uint(values->IdentificationNumber, 0, 21) |
7526b8e80941Smrg      __gen_uint(values->IdentificationNumberRegisterWriteEnable, 22, 22) |
7527b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7528b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7529b8e80941Smrg}
7530b8e80941Smrg
7531b8e80941Smrg#define GEN8_MI_PREDICATE_length               1
7532b8e80941Smrg#define GEN8_MI_PREDICATE_length_bias          1
7533b8e80941Smrg#define GEN8_MI_PREDICATE_header                \
7534b8e80941Smrg   .MICommandOpcode                     =     12,  \
7535b8e80941Smrg   .CommandType                         =      0
7536b8e80941Smrg
7537b8e80941Smrgstruct GEN8_MI_PREDICATE {
7538b8e80941Smrg   uint32_t                             CompareOperation;
7539b8e80941Smrg#define COMPARE_TRUE                             0
7540b8e80941Smrg#define COMPARE_FALSE                            1
7541b8e80941Smrg#define COMPARE_SRCS_EQUAL                       2
7542b8e80941Smrg#define COMPARE_DELTAS_EQUAL                     3
7543b8e80941Smrg   uint32_t                             CombineOperation;
7544b8e80941Smrg#define COMBINE_SET                              0
7545b8e80941Smrg#define COMBINE_AND                              1
7546b8e80941Smrg#define COMBINE_OR                               2
7547b8e80941Smrg#define COMBINE_XOR                              3
7548b8e80941Smrg   uint32_t                             LoadOperation;
7549b8e80941Smrg#define LOAD_KEEP                                0
7550b8e80941Smrg#define LOAD_LOAD                                2
7551b8e80941Smrg#define LOAD_LOADINV                             3
7552b8e80941Smrg   uint32_t                             MICommandOpcode;
7553b8e80941Smrg   uint32_t                             CommandType;
7554b8e80941Smrg};
7555b8e80941Smrg
7556b8e80941Smrgstatic inline void
7557b8e80941SmrgGEN8_MI_PREDICATE_pack(__attribute__((unused)) __gen_user_data *data,
7558b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
7559b8e80941Smrg                       __attribute__((unused)) const struct GEN8_MI_PREDICATE * restrict values)
7560b8e80941Smrg{
7561b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7562b8e80941Smrg
7563b8e80941Smrg   dw[0] =
7564b8e80941Smrg      __gen_uint(values->CompareOperation, 0, 1) |
7565b8e80941Smrg      __gen_uint(values->CombineOperation, 3, 4) |
7566b8e80941Smrg      __gen_uint(values->LoadOperation, 6, 7) |
7567b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7568b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7569b8e80941Smrg}
7570b8e80941Smrg
7571b8e80941Smrg#define GEN8_MI_REPORT_HEAD_length             1
7572b8e80941Smrg#define GEN8_MI_REPORT_HEAD_length_bias        1
7573b8e80941Smrg#define GEN8_MI_REPORT_HEAD_header              \
7574b8e80941Smrg   .MICommandOpcode                     =      7,  \
7575b8e80941Smrg   .CommandType                         =      0
7576b8e80941Smrg
7577b8e80941Smrgstruct GEN8_MI_REPORT_HEAD {
7578b8e80941Smrg   uint32_t                             MICommandOpcode;
7579b8e80941Smrg   uint32_t                             CommandType;
7580b8e80941Smrg};
7581b8e80941Smrg
7582b8e80941Smrgstatic inline void
7583b8e80941SmrgGEN8_MI_REPORT_HEAD_pack(__attribute__((unused)) __gen_user_data *data,
7584b8e80941Smrg                         __attribute__((unused)) void * restrict dst,
7585b8e80941Smrg                         __attribute__((unused)) const struct GEN8_MI_REPORT_HEAD * restrict values)
7586b8e80941Smrg{
7587b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7588b8e80941Smrg
7589b8e80941Smrg   dw[0] =
7590b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7591b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7592b8e80941Smrg}
7593b8e80941Smrg
7594b8e80941Smrg#define GEN8_MI_REPORT_PERF_COUNT_length       4
7595b8e80941Smrg#define GEN8_MI_REPORT_PERF_COUNT_length_bias      2
7596b8e80941Smrg#define GEN8_MI_REPORT_PERF_COUNT_header        \
7597b8e80941Smrg   .DWordLength                         =      2,  \
7598b8e80941Smrg   .MICommandOpcode                     =     40,  \
7599b8e80941Smrg   .CommandType                         =      0
7600b8e80941Smrg
7601b8e80941Smrgstruct GEN8_MI_REPORT_PERF_COUNT {
7602b8e80941Smrg   uint32_t                             DWordLength;
7603b8e80941Smrg   uint32_t                             MICommandOpcode;
7604b8e80941Smrg   uint32_t                             CommandType;
7605b8e80941Smrg   bool                                 UseGlobalGTT;
7606b8e80941Smrg   uint32_t                             CoreModeEnable;
7607b8e80941Smrg   __gen_address_type                   MemoryAddress;
7608b8e80941Smrg   uint32_t                             ReportID;
7609b8e80941Smrg};
7610b8e80941Smrg
7611b8e80941Smrgstatic inline void
7612b8e80941SmrgGEN8_MI_REPORT_PERF_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
7613b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
7614b8e80941Smrg                               __attribute__((unused)) const struct GEN8_MI_REPORT_PERF_COUNT * restrict values)
7615b8e80941Smrg{
7616b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7617b8e80941Smrg
7618b8e80941Smrg   dw[0] =
7619b8e80941Smrg      __gen_uint(values->DWordLength, 0, 5) |
7620b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7621b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7622b8e80941Smrg
7623b8e80941Smrg   const uint64_t v1 =
7624b8e80941Smrg      __gen_uint(values->UseGlobalGTT, 0, 0) |
7625b8e80941Smrg      __gen_uint(values->CoreModeEnable, 4, 4);
7626b8e80941Smrg   const uint64_t v1_address =
7627b8e80941Smrg      __gen_combine_address(data, &dw[1], values->MemoryAddress, v1);
7628b8e80941Smrg   dw[1] = v1_address;
7629b8e80941Smrg   dw[2] = (v1_address >> 32) | (v1 >> 32);
7630b8e80941Smrg
7631b8e80941Smrg   dw[3] =
7632b8e80941Smrg      __gen_uint(values->ReportID, 0, 31);
7633b8e80941Smrg}
7634b8e80941Smrg
7635b8e80941Smrg#define GEN8_MI_RS_CONTEXT_length              1
7636b8e80941Smrg#define GEN8_MI_RS_CONTEXT_length_bias         1
7637b8e80941Smrg#define GEN8_MI_RS_CONTEXT_header               \
7638b8e80941Smrg   .MICommandOpcode                     =     15,  \
7639b8e80941Smrg   .CommandType                         =      0
7640b8e80941Smrg
7641b8e80941Smrgstruct GEN8_MI_RS_CONTEXT {
7642b8e80941Smrg   uint32_t                             ResourceStreamerSave;
7643b8e80941Smrg#define RS_Restore                               0
7644b8e80941Smrg#define RS_Save                                  1
7645b8e80941Smrg   uint32_t                             MICommandOpcode;
7646b8e80941Smrg   uint32_t                             CommandType;
7647b8e80941Smrg};
7648b8e80941Smrg
7649b8e80941Smrgstatic inline void
7650b8e80941SmrgGEN8_MI_RS_CONTEXT_pack(__attribute__((unused)) __gen_user_data *data,
7651b8e80941Smrg                        __attribute__((unused)) void * restrict dst,
7652b8e80941Smrg                        __attribute__((unused)) const struct GEN8_MI_RS_CONTEXT * restrict values)
7653b8e80941Smrg{
7654b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7655b8e80941Smrg
7656b8e80941Smrg   dw[0] =
7657b8e80941Smrg      __gen_uint(values->ResourceStreamerSave, 0, 0) |
7658b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7659b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7660b8e80941Smrg}
7661b8e80941Smrg
7662b8e80941Smrg#define GEN8_MI_RS_CONTROL_length              1
7663b8e80941Smrg#define GEN8_MI_RS_CONTROL_length_bias         1
7664b8e80941Smrg#define GEN8_MI_RS_CONTROL_header               \
7665b8e80941Smrg   .MICommandOpcode                     =      6,  \
7666b8e80941Smrg   .CommandType                         =      0
7667b8e80941Smrg
7668b8e80941Smrgstruct GEN8_MI_RS_CONTROL {
7669b8e80941Smrg   uint32_t                             ResourceStreamerControl;
7670b8e80941Smrg#define RS_Stop                                  0
7671b8e80941Smrg#define RS_Start                                 1
7672b8e80941Smrg   uint32_t                             MICommandOpcode;
7673b8e80941Smrg   uint32_t                             CommandType;
7674b8e80941Smrg};
7675b8e80941Smrg
7676b8e80941Smrgstatic inline void
7677b8e80941SmrgGEN8_MI_RS_CONTROL_pack(__attribute__((unused)) __gen_user_data *data,
7678b8e80941Smrg                        __attribute__((unused)) void * restrict dst,
7679b8e80941Smrg                        __attribute__((unused)) const struct GEN8_MI_RS_CONTROL * restrict values)
7680b8e80941Smrg{
7681b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7682b8e80941Smrg
7683b8e80941Smrg   dw[0] =
7684b8e80941Smrg      __gen_uint(values->ResourceStreamerControl, 0, 0) |
7685b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7686b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7687b8e80941Smrg}
7688b8e80941Smrg
7689b8e80941Smrg#define GEN8_MI_RS_STORE_DATA_IMM_length       4
7690b8e80941Smrg#define GEN8_MI_RS_STORE_DATA_IMM_length_bias      2
7691b8e80941Smrg#define GEN8_MI_RS_STORE_DATA_IMM_header        \
7692b8e80941Smrg   .DWordLength                         =      2,  \
7693b8e80941Smrg   .MICommandOpcode                     =     43,  \
7694b8e80941Smrg   .CommandType                         =      0
7695b8e80941Smrg
7696b8e80941Smrgstruct GEN8_MI_RS_STORE_DATA_IMM {
7697b8e80941Smrg   uint32_t                             DWordLength;
7698b8e80941Smrg   uint32_t                             MICommandOpcode;
7699b8e80941Smrg   uint32_t                             CommandType;
7700b8e80941Smrg   uint32_t                             CoreModeEnable;
7701b8e80941Smrg   __gen_address_type                   DestinationAddress;
7702b8e80941Smrg   uint32_t                             DataDWord0;
7703b8e80941Smrg};
7704b8e80941Smrg
7705b8e80941Smrgstatic inline void
7706b8e80941SmrgGEN8_MI_RS_STORE_DATA_IMM_pack(__attribute__((unused)) __gen_user_data *data,
7707b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
7708b8e80941Smrg                               __attribute__((unused)) const struct GEN8_MI_RS_STORE_DATA_IMM * restrict values)
7709b8e80941Smrg{
7710b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7711b8e80941Smrg
7712b8e80941Smrg   dw[0] =
7713b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
7714b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7715b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7716b8e80941Smrg
7717b8e80941Smrg   const uint64_t v1 =
7718b8e80941Smrg      __gen_uint(values->CoreModeEnable, 0, 0);
7719b8e80941Smrg   const uint64_t v1_address =
7720b8e80941Smrg      __gen_combine_address(data, &dw[1], values->DestinationAddress, v1);
7721b8e80941Smrg   dw[1] = v1_address;
7722b8e80941Smrg   dw[2] = (v1_address >> 32) | (v1 >> 32);
7723b8e80941Smrg
7724b8e80941Smrg   dw[3] =
7725b8e80941Smrg      __gen_uint(values->DataDWord0, 0, 31);
7726b8e80941Smrg}
7727b8e80941Smrg
7728b8e80941Smrg#define GEN8_MI_SEMAPHORE_SIGNAL_length        2
7729b8e80941Smrg#define GEN8_MI_SEMAPHORE_SIGNAL_length_bias      2
7730b8e80941Smrg#define GEN8_MI_SEMAPHORE_SIGNAL_header         \
7731b8e80941Smrg   .DWordLength                         =      0,  \
7732b8e80941Smrg   .MICommandOpcode                     =     27,  \
7733b8e80941Smrg   .CommandType                         =      0
7734b8e80941Smrg
7735b8e80941Smrgstruct GEN8_MI_SEMAPHORE_SIGNAL {
7736b8e80941Smrg   uint32_t                             DWordLength;
7737b8e80941Smrg   uint32_t                             TargetEngineSelect;
7738b8e80941Smrg#define RCS                                      0
7739b8e80941Smrg#define VCS0                                     1
7740b8e80941Smrg#define BCS                                      2
7741b8e80941Smrg#define VECS                                     3
7742b8e80941Smrg#define VCS1                                     4
7743b8e80941Smrg   bool                                 PostSyncOperation;
7744b8e80941Smrg   uint32_t                             MICommandOpcode;
7745b8e80941Smrg   uint32_t                             CommandType;
7746b8e80941Smrg   uint32_t                             TargetContextID;
7747b8e80941Smrg};
7748b8e80941Smrg
7749b8e80941Smrgstatic inline void
7750b8e80941SmrgGEN8_MI_SEMAPHORE_SIGNAL_pack(__attribute__((unused)) __gen_user_data *data,
7751b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
7752b8e80941Smrg                              __attribute__((unused)) const struct GEN8_MI_SEMAPHORE_SIGNAL * restrict values)
7753b8e80941Smrg{
7754b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7755b8e80941Smrg
7756b8e80941Smrg   dw[0] =
7757b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
7758b8e80941Smrg      __gen_uint(values->TargetEngineSelect, 15, 17) |
7759b8e80941Smrg      __gen_uint(values->PostSyncOperation, 21, 21) |
7760b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7761b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7762b8e80941Smrg
7763b8e80941Smrg   dw[1] =
7764b8e80941Smrg      __gen_uint(values->TargetContextID, 0, 31);
7765b8e80941Smrg}
7766b8e80941Smrg
7767b8e80941Smrg#define GEN8_MI_SEMAPHORE_WAIT_length          4
7768b8e80941Smrg#define GEN8_MI_SEMAPHORE_WAIT_length_bias      2
7769b8e80941Smrg#define GEN8_MI_SEMAPHORE_WAIT_header           \
7770b8e80941Smrg   .DWordLength                         =      2,  \
7771b8e80941Smrg   .MICommandOpcode                     =     28,  \
7772b8e80941Smrg   .CommandType                         =      0
7773b8e80941Smrg
7774b8e80941Smrgstruct GEN8_MI_SEMAPHORE_WAIT {
7775b8e80941Smrg   uint32_t                             DWordLength;
7776b8e80941Smrg   uint32_t                             CompareOperation;
7777b8e80941Smrg#define COMPARE_SAD_GREATER_THAN_SDD             0
7778b8e80941Smrg#define COMPARE_SAD_GREATER_THAN_OR_EQUAL_SDD    1
7779b8e80941Smrg#define COMPARE_SAD_LESS_THAN_SDD                2
7780b8e80941Smrg#define COMPARE_SAD_LESS_THAN_OR_EQUAL_SDD       3
7781b8e80941Smrg#define COMPARE_SAD_EQUAL_SDD                    4
7782b8e80941Smrg#define COMPARE_SAD_NOT_EQUAL_SDD                5
7783b8e80941Smrg   uint32_t                             WaitMode;
7784b8e80941Smrg#define PollingMode                              1
7785b8e80941Smrg#define SignalMode                               0
7786b8e80941Smrg   uint32_t                             MemoryType;
7787b8e80941Smrg#define PerProcessGraphicsAddress                0
7788b8e80941Smrg#define GlobalGraphicsAddress                    1
7789b8e80941Smrg   uint32_t                             MICommandOpcode;
7790b8e80941Smrg   uint32_t                             CommandType;
7791b8e80941Smrg   uint32_t                             SemaphoreDataDword;
7792b8e80941Smrg   __gen_address_type                   SemaphoreAddress;
7793b8e80941Smrg   __gen_address_type                   SemaphoreAddressHigh;
7794b8e80941Smrg};
7795b8e80941Smrg
7796b8e80941Smrgstatic inline void
7797b8e80941SmrgGEN8_MI_SEMAPHORE_WAIT_pack(__attribute__((unused)) __gen_user_data *data,
7798b8e80941Smrg                            __attribute__((unused)) void * restrict dst,
7799b8e80941Smrg                            __attribute__((unused)) const struct GEN8_MI_SEMAPHORE_WAIT * restrict values)
7800b8e80941Smrg{
7801b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7802b8e80941Smrg
7803b8e80941Smrg   dw[0] =
7804b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
7805b8e80941Smrg      __gen_uint(values->CompareOperation, 12, 14) |
7806b8e80941Smrg      __gen_uint(values->WaitMode, 15, 15) |
7807b8e80941Smrg      __gen_uint(values->MemoryType, 22, 22) |
7808b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7809b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7810b8e80941Smrg
7811b8e80941Smrg   dw[1] =
7812b8e80941Smrg      __gen_uint(values->SemaphoreDataDword, 0, 31);
7813b8e80941Smrg
7814b8e80941Smrg   dw[2] = __gen_combine_address(data, &dw[2], values->SemaphoreAddress, 0);
7815b8e80941Smrg
7816b8e80941Smrg   dw[3] = __gen_combine_address(data, &dw[3], values->SemaphoreAddressHigh, 0);
7817b8e80941Smrg}
7818b8e80941Smrg
7819b8e80941Smrg#define GEN8_MI_SET_CONTEXT_length             2
7820b8e80941Smrg#define GEN8_MI_SET_CONTEXT_length_bias        2
7821b8e80941Smrg#define GEN8_MI_SET_CONTEXT_header              \
7822b8e80941Smrg   .DWordLength                         =      0,  \
7823b8e80941Smrg   .MICommandOpcode                     =     24,  \
7824b8e80941Smrg   .CommandType                         =      0
7825b8e80941Smrg
7826b8e80941Smrgstruct GEN8_MI_SET_CONTEXT {
7827b8e80941Smrg   uint32_t                             DWordLength;
7828b8e80941Smrg   uint32_t                             MICommandOpcode;
7829b8e80941Smrg   uint32_t                             CommandType;
7830b8e80941Smrg   uint32_t                             RestoreInhibit;
7831b8e80941Smrg   uint32_t                             ForceRestore;
7832b8e80941Smrg   bool                                 ResourceStreamerStateRestoreEnable;
7833b8e80941Smrg   bool                                 ResourceStreamerStateSaveEnable;
7834b8e80941Smrg   bool                                 CoreModeEnable;
7835b8e80941Smrg   uint32_t                             ReservedMustbe1;
7836b8e80941Smrg   __gen_address_type                   LogicalContextAddress;
7837b8e80941Smrg};
7838b8e80941Smrg
7839b8e80941Smrgstatic inline void
7840b8e80941SmrgGEN8_MI_SET_CONTEXT_pack(__attribute__((unused)) __gen_user_data *data,
7841b8e80941Smrg                         __attribute__((unused)) void * restrict dst,
7842b8e80941Smrg                         __attribute__((unused)) const struct GEN8_MI_SET_CONTEXT * restrict values)
7843b8e80941Smrg{
7844b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7845b8e80941Smrg
7846b8e80941Smrg   dw[0] =
7847b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
7848b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7849b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7850b8e80941Smrg
7851b8e80941Smrg   const uint32_t v1 =
7852b8e80941Smrg      __gen_uint(values->RestoreInhibit, 0, 0) |
7853b8e80941Smrg      __gen_uint(values->ForceRestore, 1, 1) |
7854b8e80941Smrg      __gen_uint(values->ResourceStreamerStateRestoreEnable, 2, 2) |
7855b8e80941Smrg      __gen_uint(values->ResourceStreamerStateSaveEnable, 3, 3) |
7856b8e80941Smrg      __gen_uint(values->CoreModeEnable, 4, 4) |
7857b8e80941Smrg      __gen_uint(values->ReservedMustbe1, 8, 8);
7858b8e80941Smrg   dw[1] = __gen_combine_address(data, &dw[1], values->LogicalContextAddress, v1);
7859b8e80941Smrg}
7860b8e80941Smrg
7861b8e80941Smrg#define GEN8_MI_SET_PREDICATE_length           1
7862b8e80941Smrg#define GEN8_MI_SET_PREDICATE_length_bias      1
7863b8e80941Smrg#define GEN8_MI_SET_PREDICATE_header            \
7864b8e80941Smrg   .MICommandOpcode                     =      1,  \
7865b8e80941Smrg   .CommandType                         =      0
7866b8e80941Smrg
7867b8e80941Smrgstruct GEN8_MI_SET_PREDICATE {
7868b8e80941Smrg   uint32_t                             PREDICATEENABLE;
7869b8e80941Smrg#define NOOPNever                                0
7870b8e80941Smrg#define NOOPonResult2clear                       1
7871b8e80941Smrg#define NOOPonResult2set                         2
7872b8e80941Smrg#define NOOPonResultclear                        3
7873b8e80941Smrg#define NOOPonResultset                          4
7874b8e80941Smrg#define Executewhenonesliceenabled               5
7875b8e80941Smrg#define Executewhentwoslicesareenabled           6
7876b8e80941Smrg#define Executewhenthreeslicesareenabled         7
7877b8e80941Smrg#define NOOPAlways                               15
7878b8e80941Smrg   uint32_t                             MICommandOpcode;
7879b8e80941Smrg   uint32_t                             CommandType;
7880b8e80941Smrg};
7881b8e80941Smrg
7882b8e80941Smrgstatic inline void
7883b8e80941SmrgGEN8_MI_SET_PREDICATE_pack(__attribute__((unused)) __gen_user_data *data,
7884b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
7885b8e80941Smrg                           __attribute__((unused)) const struct GEN8_MI_SET_PREDICATE * restrict values)
7886b8e80941Smrg{
7887b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7888b8e80941Smrg
7889b8e80941Smrg   dw[0] =
7890b8e80941Smrg      __gen_uint(values->PREDICATEENABLE, 0, 3) |
7891b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7892b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7893b8e80941Smrg}
7894b8e80941Smrg
7895b8e80941Smrg#define GEN8_MI_STORE_DATA_IMM_length          4
7896b8e80941Smrg#define GEN8_MI_STORE_DATA_IMM_length_bias      2
7897b8e80941Smrg#define GEN8_MI_STORE_DATA_IMM_header           \
7898b8e80941Smrg   .DWordLength                         =      2,  \
7899b8e80941Smrg   .MICommandOpcode                     =     32,  \
7900b8e80941Smrg   .CommandType                         =      0
7901b8e80941Smrg
7902b8e80941Smrgstruct GEN8_MI_STORE_DATA_IMM {
7903b8e80941Smrg   uint32_t                             DWordLength;
7904b8e80941Smrg   uint32_t                             StoreQword;
7905b8e80941Smrg   bool                                 UseGlobalGTT;
7906b8e80941Smrg   uint32_t                             MICommandOpcode;
7907b8e80941Smrg   uint32_t                             CommandType;
7908b8e80941Smrg   uint32_t                             CoreModeEnable;
7909b8e80941Smrg   __gen_address_type                   Address;
7910b8e80941Smrg   uint64_t                             ImmediateData;
7911b8e80941Smrg};
7912b8e80941Smrg
7913b8e80941Smrgstatic inline void
7914b8e80941SmrgGEN8_MI_STORE_DATA_IMM_pack(__attribute__((unused)) __gen_user_data *data,
7915b8e80941Smrg                            __attribute__((unused)) void * restrict dst,
7916b8e80941Smrg                            __attribute__((unused)) const struct GEN8_MI_STORE_DATA_IMM * restrict values)
7917b8e80941Smrg{
7918b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7919b8e80941Smrg
7920b8e80941Smrg   dw[0] =
7921b8e80941Smrg      __gen_uint(values->DWordLength, 0, 9) |
7922b8e80941Smrg      __gen_uint(values->StoreQword, 21, 21) |
7923b8e80941Smrg      __gen_uint(values->UseGlobalGTT, 22, 22) |
7924b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7925b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7926b8e80941Smrg
7927b8e80941Smrg   const uint64_t v1 =
7928b8e80941Smrg      __gen_uint(values->CoreModeEnable, 0, 0);
7929b8e80941Smrg   const uint64_t v1_address =
7930b8e80941Smrg      __gen_combine_address(data, &dw[1], values->Address, v1);
7931b8e80941Smrg   dw[1] = v1_address;
7932b8e80941Smrg   dw[2] = (v1_address >> 32) | (v1 >> 32);
7933b8e80941Smrg
7934b8e80941Smrg   const uint64_t v3 =
7935b8e80941Smrg      __gen_uint(values->ImmediateData, 0, 63);
7936b8e80941Smrg   dw[3] = v3;
7937b8e80941Smrg   dw[4] = v3 >> 32;
7938b8e80941Smrg}
7939b8e80941Smrg
7940b8e80941Smrg#define GEN8_MI_STORE_DATA_INDEX_length        3
7941b8e80941Smrg#define GEN8_MI_STORE_DATA_INDEX_length_bias      2
7942b8e80941Smrg#define GEN8_MI_STORE_DATA_INDEX_header         \
7943b8e80941Smrg   .DWordLength                         =      1,  \
7944b8e80941Smrg   .MICommandOpcode                     =     33,  \
7945b8e80941Smrg   .CommandType                         =      0
7946b8e80941Smrg
7947b8e80941Smrgstruct GEN8_MI_STORE_DATA_INDEX {
7948b8e80941Smrg   uint32_t                             DWordLength;
7949b8e80941Smrg   uint32_t                             UsePerProcessHardwareStatusPage;
7950b8e80941Smrg   uint32_t                             MICommandOpcode;
7951b8e80941Smrg   uint32_t                             CommandType;
7952b8e80941Smrg   uint32_t                             Offset;
7953b8e80941Smrg   uint32_t                             DataDWord0;
7954b8e80941Smrg   uint32_t                             DataDWord1;
7955b8e80941Smrg};
7956b8e80941Smrg
7957b8e80941Smrgstatic inline void
7958b8e80941SmrgGEN8_MI_STORE_DATA_INDEX_pack(__attribute__((unused)) __gen_user_data *data,
7959b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
7960b8e80941Smrg                              __attribute__((unused)) const struct GEN8_MI_STORE_DATA_INDEX * restrict values)
7961b8e80941Smrg{
7962b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7963b8e80941Smrg
7964b8e80941Smrg   dw[0] =
7965b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
7966b8e80941Smrg      __gen_uint(values->UsePerProcessHardwareStatusPage, 21, 21) |
7967b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
7968b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
7969b8e80941Smrg
7970b8e80941Smrg   dw[1] =
7971b8e80941Smrg      __gen_uint(values->Offset, 2, 11);
7972b8e80941Smrg
7973b8e80941Smrg   dw[2] =
7974b8e80941Smrg      __gen_uint(values->DataDWord0, 0, 31);
7975b8e80941Smrg}
7976b8e80941Smrg
7977b8e80941Smrg#define GEN8_MI_STORE_REGISTER_MEM_length      4
7978b8e80941Smrg#define GEN8_MI_STORE_REGISTER_MEM_length_bias      2
7979b8e80941Smrg#define GEN8_MI_STORE_REGISTER_MEM_header       \
7980b8e80941Smrg   .DWordLength                         =      2,  \
7981b8e80941Smrg   .MICommandOpcode                     =     36,  \
7982b8e80941Smrg   .CommandType                         =      0
7983b8e80941Smrg
7984b8e80941Smrgstruct GEN8_MI_STORE_REGISTER_MEM {
7985b8e80941Smrg   uint32_t                             DWordLength;
7986b8e80941Smrg   bool                                 PredicateEnable;
7987b8e80941Smrg   bool                                 UseGlobalGTT;
7988b8e80941Smrg   uint32_t                             MICommandOpcode;
7989b8e80941Smrg   uint32_t                             CommandType;
7990b8e80941Smrg   uint64_t                             RegisterAddress;
7991b8e80941Smrg   __gen_address_type                   MemoryAddress;
7992b8e80941Smrg};
7993b8e80941Smrg
7994b8e80941Smrgstatic inline void
7995b8e80941SmrgGEN8_MI_STORE_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
7996b8e80941Smrg                                __attribute__((unused)) void * restrict dst,
7997b8e80941Smrg                                __attribute__((unused)) const struct GEN8_MI_STORE_REGISTER_MEM * restrict values)
7998b8e80941Smrg{
7999b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8000b8e80941Smrg
8001b8e80941Smrg   dw[0] =
8002b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
8003b8e80941Smrg      __gen_uint(values->PredicateEnable, 21, 21) |
8004b8e80941Smrg      __gen_uint(values->UseGlobalGTT, 22, 22) |
8005b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
8006b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
8007b8e80941Smrg
8008b8e80941Smrg   dw[1] =
8009b8e80941Smrg      __gen_offset(values->RegisterAddress, 2, 22);
8010b8e80941Smrg
8011b8e80941Smrg   const uint64_t v2_address =
8012b8e80941Smrg      __gen_combine_address(data, &dw[2], values->MemoryAddress, 0);
8013b8e80941Smrg   dw[2] = v2_address;
8014b8e80941Smrg   dw[3] = v2_address >> 32;
8015b8e80941Smrg}
8016b8e80941Smrg
8017b8e80941Smrg#define GEN8_MI_STORE_URB_MEM_length           4
8018b8e80941Smrg#define GEN8_MI_STORE_URB_MEM_length_bias      2
8019b8e80941Smrg#define GEN8_MI_STORE_URB_MEM_header            \
8020b8e80941Smrg   .DWordLength                         =      2,  \
8021b8e80941Smrg   .MICommandOpcode                     =     45,  \
8022b8e80941Smrg   .CommandType                         =      0
8023b8e80941Smrg
8024b8e80941Smrgstruct GEN8_MI_STORE_URB_MEM {
8025b8e80941Smrg   uint32_t                             DWordLength;
8026b8e80941Smrg   uint32_t                             MICommandOpcode;
8027b8e80941Smrg   uint32_t                             CommandType;
8028b8e80941Smrg   uint32_t                             URBAddress;
8029b8e80941Smrg   __gen_address_type                   MemoryAddress;
8030b8e80941Smrg};
8031b8e80941Smrg
8032b8e80941Smrgstatic inline void
8033b8e80941SmrgGEN8_MI_STORE_URB_MEM_pack(__attribute__((unused)) __gen_user_data *data,
8034b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
8035b8e80941Smrg                           __attribute__((unused)) const struct GEN8_MI_STORE_URB_MEM * restrict values)
8036b8e80941Smrg{
8037b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8038b8e80941Smrg
8039b8e80941Smrg   dw[0] =
8040b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
8041b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
8042b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
8043b8e80941Smrg
8044b8e80941Smrg   dw[1] =
8045b8e80941Smrg      __gen_uint(values->URBAddress, 2, 14);
8046b8e80941Smrg
8047b8e80941Smrg   const uint64_t v2_address =
8048b8e80941Smrg      __gen_combine_address(data, &dw[2], values->MemoryAddress, 0);
8049b8e80941Smrg   dw[2] = v2_address;
8050b8e80941Smrg   dw[3] = v2_address >> 32;
8051b8e80941Smrg}
8052b8e80941Smrg
8053b8e80941Smrg#define GEN8_MI_SUSPEND_FLUSH_length           1
8054b8e80941Smrg#define GEN8_MI_SUSPEND_FLUSH_length_bias      1
8055b8e80941Smrg#define GEN8_MI_SUSPEND_FLUSH_header            \
8056b8e80941Smrg   .MICommandOpcode                     =     11,  \
8057b8e80941Smrg   .CommandType                         =      0
8058b8e80941Smrg
8059b8e80941Smrgstruct GEN8_MI_SUSPEND_FLUSH {
8060b8e80941Smrg   bool                                 SuspendFlush;
8061b8e80941Smrg   uint32_t                             MICommandOpcode;
8062b8e80941Smrg   uint32_t                             CommandType;
8063b8e80941Smrg};
8064b8e80941Smrg
8065b8e80941Smrgstatic inline void
8066b8e80941SmrgGEN8_MI_SUSPEND_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
8067b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
8068b8e80941Smrg                           __attribute__((unused)) const struct GEN8_MI_SUSPEND_FLUSH * restrict values)
8069b8e80941Smrg{
8070b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8071b8e80941Smrg
8072b8e80941Smrg   dw[0] =
8073b8e80941Smrg      __gen_uint(values->SuspendFlush, 0, 0) |
8074b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
8075b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
8076b8e80941Smrg}
8077b8e80941Smrg
8078b8e80941Smrg#define GEN8_MI_TOPOLOGY_FILTER_length         1
8079b8e80941Smrg#define GEN8_MI_TOPOLOGY_FILTER_length_bias      1
8080b8e80941Smrg#define GEN8_MI_TOPOLOGY_FILTER_header          \
8081b8e80941Smrg   .MICommandOpcode                     =     13,  \
8082b8e80941Smrg   .CommandType                         =      0
8083b8e80941Smrg
8084b8e80941Smrgstruct GEN8_MI_TOPOLOGY_FILTER {
8085b8e80941Smrg   enum GEN8_3D_Prim_Topo_Type          TopologyFilterValue;
8086b8e80941Smrg   uint32_t                             MICommandOpcode;
8087b8e80941Smrg   uint32_t                             CommandType;
8088b8e80941Smrg};
8089b8e80941Smrg
8090b8e80941Smrgstatic inline void
8091b8e80941SmrgGEN8_MI_TOPOLOGY_FILTER_pack(__attribute__((unused)) __gen_user_data *data,
8092b8e80941Smrg                             __attribute__((unused)) void * restrict dst,
8093b8e80941Smrg                             __attribute__((unused)) const struct GEN8_MI_TOPOLOGY_FILTER * restrict values)
8094b8e80941Smrg{
8095b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8096b8e80941Smrg
8097b8e80941Smrg   dw[0] =
8098b8e80941Smrg      __gen_uint(values->TopologyFilterValue, 0, 5) |
8099b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
8100b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
8101b8e80941Smrg}
8102b8e80941Smrg
8103b8e80941Smrg#define GEN8_MI_URB_ATOMIC_ALLOC_length        1
8104b8e80941Smrg#define GEN8_MI_URB_ATOMIC_ALLOC_length_bias      1
8105b8e80941Smrg#define GEN8_MI_URB_ATOMIC_ALLOC_header         \
8106b8e80941Smrg   .MICommandOpcode                     =      9,  \
8107b8e80941Smrg   .CommandType                         =      0
8108b8e80941Smrg
8109b8e80941Smrgstruct GEN8_MI_URB_ATOMIC_ALLOC {
8110b8e80941Smrg   uint32_t                             URBAtomicStorageSize;
8111b8e80941Smrg   uint32_t                             URBAtomicStorageOffset;
8112b8e80941Smrg   uint32_t                             MICommandOpcode;
8113b8e80941Smrg   uint32_t                             CommandType;
8114b8e80941Smrg};
8115b8e80941Smrg
8116b8e80941Smrgstatic inline void
8117b8e80941SmrgGEN8_MI_URB_ATOMIC_ALLOC_pack(__attribute__((unused)) __gen_user_data *data,
8118b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
8119b8e80941Smrg                              __attribute__((unused)) const struct GEN8_MI_URB_ATOMIC_ALLOC * restrict values)
8120b8e80941Smrg{
8121b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8122b8e80941Smrg
8123b8e80941Smrg   dw[0] =
8124b8e80941Smrg      __gen_uint(values->URBAtomicStorageSize, 0, 8) |
8125b8e80941Smrg      __gen_uint(values->URBAtomicStorageOffset, 12, 19) |
8126b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
8127b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
8128b8e80941Smrg}
8129b8e80941Smrg
8130b8e80941Smrg#define GEN8_MI_URB_CLEAR_length               2
8131b8e80941Smrg#define GEN8_MI_URB_CLEAR_length_bias          2
8132b8e80941Smrg#define GEN8_MI_URB_CLEAR_header                \
8133b8e80941Smrg   .DWordLength                         =      0,  \
8134b8e80941Smrg   .MICommandOpcode                     =     25,  \
8135b8e80941Smrg   .CommandType                         =      0
8136b8e80941Smrg
8137b8e80941Smrgstruct GEN8_MI_URB_CLEAR {
8138b8e80941Smrg   uint32_t                             DWordLength;
8139b8e80941Smrg   uint32_t                             MICommandOpcode;
8140b8e80941Smrg   uint32_t                             CommandType;
8141b8e80941Smrg   uint64_t                             URBAddress;
8142b8e80941Smrg   uint32_t                             URBClearLength;
8143b8e80941Smrg};
8144b8e80941Smrg
8145b8e80941Smrgstatic inline void
8146b8e80941SmrgGEN8_MI_URB_CLEAR_pack(__attribute__((unused)) __gen_user_data *data,
8147b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
8148b8e80941Smrg                       __attribute__((unused)) const struct GEN8_MI_URB_CLEAR * restrict values)
8149b8e80941Smrg{
8150b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8151b8e80941Smrg
8152b8e80941Smrg   dw[0] =
8153b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
8154b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
8155b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
8156b8e80941Smrg
8157b8e80941Smrg   dw[1] =
8158b8e80941Smrg      __gen_offset(values->URBAddress, 0, 14) |
8159b8e80941Smrg      __gen_uint(values->URBClearLength, 16, 29);
8160b8e80941Smrg}
8161b8e80941Smrg
8162b8e80941Smrg#define GEN8_MI_USER_INTERRUPT_length          1
8163b8e80941Smrg#define GEN8_MI_USER_INTERRUPT_length_bias      1
8164b8e80941Smrg#define GEN8_MI_USER_INTERRUPT_header           \
8165b8e80941Smrg   .MICommandOpcode                     =      2,  \
8166b8e80941Smrg   .CommandType                         =      0
8167b8e80941Smrg
8168b8e80941Smrgstruct GEN8_MI_USER_INTERRUPT {
8169b8e80941Smrg   uint32_t                             MICommandOpcode;
8170b8e80941Smrg   uint32_t                             CommandType;
8171b8e80941Smrg};
8172b8e80941Smrg
8173b8e80941Smrgstatic inline void
8174b8e80941SmrgGEN8_MI_USER_INTERRUPT_pack(__attribute__((unused)) __gen_user_data *data,
8175b8e80941Smrg                            __attribute__((unused)) void * restrict dst,
8176b8e80941Smrg                            __attribute__((unused)) const struct GEN8_MI_USER_INTERRUPT * restrict values)
8177b8e80941Smrg{
8178b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8179b8e80941Smrg
8180b8e80941Smrg   dw[0] =
8181b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
8182b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
8183b8e80941Smrg}
8184b8e80941Smrg
8185b8e80941Smrg#define GEN8_MI_WAIT_FOR_EVENT_length          1
8186b8e80941Smrg#define GEN8_MI_WAIT_FOR_EVENT_length_bias      1
8187b8e80941Smrg#define GEN8_MI_WAIT_FOR_EVENT_header           \
8188b8e80941Smrg   .MICommandOpcode                     =      3,  \
8189b8e80941Smrg   .CommandType                         =      0
8190b8e80941Smrg
8191b8e80941Smrgstruct GEN8_MI_WAIT_FOR_EVENT {
8192b8e80941Smrg   bool                                 DisplayPipeAScanLineWaitEnable;
8193b8e80941Smrg   bool                                 DisplayPlaneAFlipPendingWaitEnable;
8194b8e80941Smrg   bool                                 DisplaySpriteAFlipPendingWaitEnable;
8195b8e80941Smrg   bool                                 DisplayPipeAVerticalBlankWaitEnable;
8196b8e80941Smrg   bool                                 DisplayPipeBScanLineWaitEnable;
8197b8e80941Smrg   bool                                 DisplayPlaneBFlipPendingWaitEnable;
8198b8e80941Smrg   bool                                 DisplaySpriteBFlipPendingWaitEnable;
8199b8e80941Smrg   bool                                 DisplayPipeBVerticalBlankWaitEnable;
8200b8e80941Smrg   bool                                 DisplayPipeCScanLineWaitEnable;
8201b8e80941Smrg   bool                                 DisplayPlaneCFlipPendingWaitEnable;
8202b8e80941Smrg   bool                                 DisplaySpriteCFlipPendingWaitEnable;
8203b8e80941Smrg   bool                                 DisplayPipeCVerticalBlankWaitEnable;
8204b8e80941Smrg   uint32_t                             MICommandOpcode;
8205b8e80941Smrg   uint32_t                             CommandType;
8206b8e80941Smrg};
8207b8e80941Smrg
8208b8e80941Smrgstatic inline void
8209b8e80941SmrgGEN8_MI_WAIT_FOR_EVENT_pack(__attribute__((unused)) __gen_user_data *data,
8210b8e80941Smrg                            __attribute__((unused)) void * restrict dst,
8211b8e80941Smrg                            __attribute__((unused)) const struct GEN8_MI_WAIT_FOR_EVENT * restrict values)
8212b8e80941Smrg{
8213b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8214b8e80941Smrg
8215b8e80941Smrg   dw[0] =
8216b8e80941Smrg      __gen_uint(values->DisplayPipeAScanLineWaitEnable, 0, 0) |
8217b8e80941Smrg      __gen_uint(values->DisplayPlaneAFlipPendingWaitEnable, 1, 1) |
8218b8e80941Smrg      __gen_uint(values->DisplaySpriteAFlipPendingWaitEnable, 2, 2) |
8219b8e80941Smrg      __gen_uint(values->DisplayPipeAVerticalBlankWaitEnable, 3, 3) |
8220b8e80941Smrg      __gen_uint(values->DisplayPipeBScanLineWaitEnable, 8, 8) |
8221b8e80941Smrg      __gen_uint(values->DisplayPlaneBFlipPendingWaitEnable, 9, 9) |
8222b8e80941Smrg      __gen_uint(values->DisplaySpriteBFlipPendingWaitEnable, 10, 10) |
8223b8e80941Smrg      __gen_uint(values->DisplayPipeBVerticalBlankWaitEnable, 11, 11) |
8224b8e80941Smrg      __gen_uint(values->DisplayPipeCScanLineWaitEnable, 14, 14) |
8225b8e80941Smrg      __gen_uint(values->DisplayPlaneCFlipPendingWaitEnable, 15, 15) |
8226b8e80941Smrg      __gen_uint(values->DisplaySpriteCFlipPendingWaitEnable, 20, 20) |
8227b8e80941Smrg      __gen_uint(values->DisplayPipeCVerticalBlankWaitEnable, 21, 21) |
8228b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
8229b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
8230b8e80941Smrg}
8231b8e80941Smrg
8232b8e80941Smrg#define GEN8_PIPELINE_SELECT_length            1
8233b8e80941Smrg#define GEN8_PIPELINE_SELECT_length_bias       1
8234b8e80941Smrg#define GEN8_PIPELINE_SELECT_header             \
8235b8e80941Smrg   ._3DCommandSubOpcode                 =      4,  \
8236b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
8237b8e80941Smrg   .CommandSubType                      =      1,  \
8238b8e80941Smrg   .CommandType                         =      3
8239b8e80941Smrg
8240b8e80941Smrgstruct GEN8_PIPELINE_SELECT {
8241b8e80941Smrg   uint32_t                             PipelineSelection;
8242b8e80941Smrg#define _3D                                      0
8243b8e80941Smrg#define Media                                    1
8244b8e80941Smrg#define GPGPU                                    2
8245b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
8246b8e80941Smrg   uint32_t                             _3DCommandOpcode;
8247b8e80941Smrg   uint32_t                             CommandSubType;
8248b8e80941Smrg   uint32_t                             CommandType;
8249b8e80941Smrg};
8250b8e80941Smrg
8251b8e80941Smrgstatic inline void
8252b8e80941SmrgGEN8_PIPELINE_SELECT_pack(__attribute__((unused)) __gen_user_data *data,
8253b8e80941Smrg                          __attribute__((unused)) void * restrict dst,
8254b8e80941Smrg                          __attribute__((unused)) const struct GEN8_PIPELINE_SELECT * restrict values)
8255b8e80941Smrg{
8256b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8257b8e80941Smrg
8258b8e80941Smrg   dw[0] =
8259b8e80941Smrg      __gen_uint(values->PipelineSelection, 0, 1) |
8260b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
8261b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
8262b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
8263b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
8264b8e80941Smrg}
8265b8e80941Smrg
8266b8e80941Smrg#define GEN8_PIPE_CONTROL_length               6
8267b8e80941Smrg#define GEN8_PIPE_CONTROL_length_bias          2
8268b8e80941Smrg#define GEN8_PIPE_CONTROL_header                \
8269b8e80941Smrg   .DWordLength                         =      4,  \
8270b8e80941Smrg   ._3DCommandSubOpcode                 =      0,  \
8271b8e80941Smrg   ._3DCommandOpcode                    =      2,  \
8272b8e80941Smrg   .CommandSubType                      =      3,  \
8273b8e80941Smrg   .CommandType                         =      3
8274b8e80941Smrg
8275b8e80941Smrgstruct GEN8_PIPE_CONTROL {
8276b8e80941Smrg   uint32_t                             DWordLength;
8277b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
8278b8e80941Smrg   uint32_t                             _3DCommandOpcode;
8279b8e80941Smrg   uint32_t                             CommandSubType;
8280b8e80941Smrg   uint32_t                             CommandType;
8281b8e80941Smrg   bool                                 DepthCacheFlushEnable;
8282b8e80941Smrg   bool                                 StallAtPixelScoreboard;
8283b8e80941Smrg   bool                                 StateCacheInvalidationEnable;
8284b8e80941Smrg   bool                                 ConstantCacheInvalidationEnable;
8285b8e80941Smrg   bool                                 VFCacheInvalidationEnable;
8286b8e80941Smrg   bool                                 DCFlushEnable;
8287b8e80941Smrg   bool                                 PipeControlFlushEnable;
8288b8e80941Smrg   bool                                 NotifyEnable;
8289b8e80941Smrg   bool                                 IndirectStatePointersDisable;
8290b8e80941Smrg   bool                                 TextureCacheInvalidationEnable;
8291b8e80941Smrg   bool                                 InstructionCacheInvalidateEnable;
8292b8e80941Smrg   bool                                 RenderTargetCacheFlushEnable;
8293b8e80941Smrg   bool                                 DepthStallEnable;
8294b8e80941Smrg   uint32_t                             PostSyncOperation;
8295b8e80941Smrg#define NoWrite                                  0
8296b8e80941Smrg#define WriteImmediateData                       1
8297b8e80941Smrg#define WritePSDepthCount                        2
8298b8e80941Smrg#define WriteTimestamp                           3
8299b8e80941Smrg   bool                                 GenericMediaStateClear;
8300b8e80941Smrg   bool                                 TLBInvalidate;
8301b8e80941Smrg   bool                                 GlobalSnapshotCountReset;
8302b8e80941Smrg   bool                                 CommandStreamerStallEnable;
8303b8e80941Smrg   uint32_t                             StoreDataIndex;
8304b8e80941Smrg   uint32_t                             LRIPostSyncOperation;
8305b8e80941Smrg#define NoLRIOperation                           0
8306b8e80941Smrg#define MMIOWriteImmediateData                   1
8307b8e80941Smrg   uint32_t                             DestinationAddressType;
8308b8e80941Smrg#define DAT_PPGTT                                0
8309b8e80941Smrg#define DAT_GGTT                                 1
8310b8e80941Smrg   __gen_address_type                   Address;
8311b8e80941Smrg   uint64_t                             ImmediateData;
8312b8e80941Smrg};
8313b8e80941Smrg
8314b8e80941Smrgstatic inline void
8315b8e80941SmrgGEN8_PIPE_CONTROL_pack(__attribute__((unused)) __gen_user_data *data,
8316b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
8317b8e80941Smrg                       __attribute__((unused)) const struct GEN8_PIPE_CONTROL * restrict values)
8318b8e80941Smrg{
8319b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8320b8e80941Smrg
8321b8e80941Smrg   dw[0] =
8322b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
8323b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
8324b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
8325b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
8326b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
8327b8e80941Smrg
8328b8e80941Smrg   dw[1] =
8329b8e80941Smrg      __gen_uint(values->DepthCacheFlushEnable, 0, 0) |
8330b8e80941Smrg      __gen_uint(values->StallAtPixelScoreboard, 1, 1) |
8331b8e80941Smrg      __gen_uint(values->StateCacheInvalidationEnable, 2, 2) |
8332b8e80941Smrg      __gen_uint(values->ConstantCacheInvalidationEnable, 3, 3) |
8333b8e80941Smrg      __gen_uint(values->VFCacheInvalidationEnable, 4, 4) |
8334b8e80941Smrg      __gen_uint(values->DCFlushEnable, 5, 5) |
8335b8e80941Smrg      __gen_uint(values->PipeControlFlushEnable, 7, 7) |
8336b8e80941Smrg      __gen_uint(values->NotifyEnable, 8, 8) |
8337b8e80941Smrg      __gen_uint(values->IndirectStatePointersDisable, 9, 9) |
8338b8e80941Smrg      __gen_uint(values->TextureCacheInvalidationEnable, 10, 10) |
8339b8e80941Smrg      __gen_uint(values->InstructionCacheInvalidateEnable, 11, 11) |
8340b8e80941Smrg      __gen_uint(values->RenderTargetCacheFlushEnable, 12, 12) |
8341b8e80941Smrg      __gen_uint(values->DepthStallEnable, 13, 13) |
8342b8e80941Smrg      __gen_uint(values->PostSyncOperation, 14, 15) |
8343b8e80941Smrg      __gen_uint(values->GenericMediaStateClear, 16, 16) |
8344b8e80941Smrg      __gen_uint(values->TLBInvalidate, 18, 18) |
8345b8e80941Smrg      __gen_uint(values->GlobalSnapshotCountReset, 19, 19) |
8346b8e80941Smrg      __gen_uint(values->CommandStreamerStallEnable, 20, 20) |
8347b8e80941Smrg      __gen_uint(values->StoreDataIndex, 21, 21) |
8348b8e80941Smrg      __gen_uint(values->LRIPostSyncOperation, 23, 23) |
8349b8e80941Smrg      __gen_uint(values->DestinationAddressType, 24, 24);
8350b8e80941Smrg
8351b8e80941Smrg   const uint64_t v2_address =
8352b8e80941Smrg      __gen_combine_address(data, &dw[2], values->Address, 0);
8353b8e80941Smrg   dw[2] = v2_address;
8354b8e80941Smrg   dw[3] = v2_address >> 32;
8355b8e80941Smrg
8356b8e80941Smrg   const uint64_t v4 =
8357b8e80941Smrg      __gen_uint(values->ImmediateData, 0, 63);
8358b8e80941Smrg   dw[4] = v4;
8359b8e80941Smrg   dw[5] = v4 >> 32;
8360b8e80941Smrg}
8361b8e80941Smrg
8362b8e80941Smrg#define GEN8_STATE_BASE_ADDRESS_length        16
8363b8e80941Smrg#define GEN8_STATE_BASE_ADDRESS_length_bias      2
8364b8e80941Smrg#define GEN8_STATE_BASE_ADDRESS_header          \
8365b8e80941Smrg   .DWordLength                         =     14,  \
8366b8e80941Smrg   ._3DCommandSubOpcode                 =      1,  \
8367b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
8368b8e80941Smrg   .CommandSubType                      =      0,  \
8369b8e80941Smrg   .CommandType                         =      3
8370b8e80941Smrg
8371b8e80941Smrgstruct GEN8_STATE_BASE_ADDRESS {
8372b8e80941Smrg   uint32_t                             DWordLength;
8373b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
8374b8e80941Smrg   uint32_t                             _3DCommandOpcode;
8375b8e80941Smrg   uint32_t                             CommandSubType;
8376b8e80941Smrg   uint32_t                             CommandType;
8377b8e80941Smrg   bool                                 GeneralStateBaseAddressModifyEnable;
8378b8e80941Smrg   uint32_t                             GeneralStateMOCS;
8379b8e80941Smrg   __gen_address_type                   GeneralStateBaseAddress;
8380b8e80941Smrg   uint32_t                             StatelessDataPortAccessMOCS;
8381b8e80941Smrg   bool                                 SurfaceStateBaseAddressModifyEnable;
8382b8e80941Smrg   uint32_t                             SurfaceStateMOCS;
8383b8e80941Smrg   __gen_address_type                   SurfaceStateBaseAddress;
8384b8e80941Smrg   bool                                 DynamicStateBaseAddressModifyEnable;
8385b8e80941Smrg   uint32_t                             DynamicStateMOCS;
8386b8e80941Smrg   __gen_address_type                   DynamicStateBaseAddress;
8387b8e80941Smrg   bool                                 IndirectObjectBaseAddressModifyEnable;
8388b8e80941Smrg   uint32_t                             IndirectObjectMOCS;
8389b8e80941Smrg   __gen_address_type                   IndirectObjectBaseAddress;
8390b8e80941Smrg   bool                                 InstructionBaseAddressModifyEnable;
8391b8e80941Smrg   uint32_t                             InstructionMOCS;
8392b8e80941Smrg   __gen_address_type                   InstructionBaseAddress;
8393b8e80941Smrg   bool                                 GeneralStateBufferSizeModifyEnable;
8394b8e80941Smrg   uint32_t                             GeneralStateBufferSize;
8395b8e80941Smrg   bool                                 DynamicStateBufferSizeModifyEnable;
8396b8e80941Smrg   uint32_t                             DynamicStateBufferSize;
8397b8e80941Smrg   bool                                 IndirectObjectBufferSizeModifyEnable;
8398b8e80941Smrg   uint32_t                             IndirectObjectBufferSize;
8399b8e80941Smrg   bool                                 InstructionBuffersizeModifyEnable;
8400b8e80941Smrg   uint32_t                             InstructionBufferSize;
8401b8e80941Smrg};
8402b8e80941Smrg
8403b8e80941Smrgstatic inline void
8404b8e80941SmrgGEN8_STATE_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
8405b8e80941Smrg                             __attribute__((unused)) void * restrict dst,
8406b8e80941Smrg                             __attribute__((unused)) const struct GEN8_STATE_BASE_ADDRESS * restrict values)
8407b8e80941Smrg{
8408b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8409b8e80941Smrg
8410b8e80941Smrg   dw[0] =
8411b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
8412b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
8413b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
8414b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
8415b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
8416b8e80941Smrg
8417b8e80941Smrg   const uint64_t v1 =
8418b8e80941Smrg      __gen_uint(values->GeneralStateBaseAddressModifyEnable, 0, 0) |
8419b8e80941Smrg      __gen_uint(values->GeneralStateMOCS, 4, 10);
8420b8e80941Smrg   const uint64_t v1_address =
8421b8e80941Smrg      __gen_combine_address(data, &dw[1], values->GeneralStateBaseAddress, v1);
8422b8e80941Smrg   dw[1] = v1_address;
8423b8e80941Smrg   dw[2] = (v1_address >> 32) | (v1 >> 32);
8424b8e80941Smrg
8425b8e80941Smrg   dw[3] =
8426b8e80941Smrg      __gen_uint(values->StatelessDataPortAccessMOCS, 16, 22);
8427b8e80941Smrg
8428b8e80941Smrg   const uint64_t v4 =
8429b8e80941Smrg      __gen_uint(values->SurfaceStateBaseAddressModifyEnable, 0, 0) |
8430b8e80941Smrg      __gen_uint(values->SurfaceStateMOCS, 4, 10);
8431b8e80941Smrg   const uint64_t v4_address =
8432b8e80941Smrg      __gen_combine_address(data, &dw[4], values->SurfaceStateBaseAddress, v4);
8433b8e80941Smrg   dw[4] = v4_address;
8434b8e80941Smrg   dw[5] = (v4_address >> 32) | (v4 >> 32);
8435b8e80941Smrg
8436b8e80941Smrg   const uint64_t v6 =
8437b8e80941Smrg      __gen_uint(values->DynamicStateBaseAddressModifyEnable, 0, 0) |
8438b8e80941Smrg      __gen_uint(values->DynamicStateMOCS, 4, 10);
8439b8e80941Smrg   const uint64_t v6_address =
8440b8e80941Smrg      __gen_combine_address(data, &dw[6], values->DynamicStateBaseAddress, v6);
8441b8e80941Smrg   dw[6] = v6_address;
8442b8e80941Smrg   dw[7] = (v6_address >> 32) | (v6 >> 32);
8443b8e80941Smrg
8444b8e80941Smrg   const uint64_t v8 =
8445b8e80941Smrg      __gen_uint(values->IndirectObjectBaseAddressModifyEnable, 0, 0) |
8446b8e80941Smrg      __gen_uint(values->IndirectObjectMOCS, 4, 10);
8447b8e80941Smrg   const uint64_t v8_address =
8448b8e80941Smrg      __gen_combine_address(data, &dw[8], values->IndirectObjectBaseAddress, v8);
8449b8e80941Smrg   dw[8] = v8_address;
8450b8e80941Smrg   dw[9] = (v8_address >> 32) | (v8 >> 32);
8451b8e80941Smrg
8452b8e80941Smrg   const uint64_t v10 =
8453b8e80941Smrg      __gen_uint(values->InstructionBaseAddressModifyEnable, 0, 0) |
8454b8e80941Smrg      __gen_uint(values->InstructionMOCS, 4, 10);
8455b8e80941Smrg   const uint64_t v10_address =
8456b8e80941Smrg      __gen_combine_address(data, &dw[10], values->InstructionBaseAddress, v10);
8457b8e80941Smrg   dw[10] = v10_address;
8458b8e80941Smrg   dw[11] = (v10_address >> 32) | (v10 >> 32);
8459b8e80941Smrg
8460b8e80941Smrg   dw[12] =
8461b8e80941Smrg      __gen_uint(values->GeneralStateBufferSizeModifyEnable, 0, 0) |
8462b8e80941Smrg      __gen_uint(values->GeneralStateBufferSize, 12, 31);
8463b8e80941Smrg
8464b8e80941Smrg   dw[13] =
8465b8e80941Smrg      __gen_uint(values->DynamicStateBufferSizeModifyEnable, 0, 0) |
8466b8e80941Smrg      __gen_uint(values->DynamicStateBufferSize, 12, 31);
8467b8e80941Smrg
8468b8e80941Smrg   dw[14] =
8469b8e80941Smrg      __gen_uint(values->IndirectObjectBufferSizeModifyEnable, 0, 0) |
8470b8e80941Smrg      __gen_uint(values->IndirectObjectBufferSize, 12, 31);
8471b8e80941Smrg
8472b8e80941Smrg   dw[15] =
8473b8e80941Smrg      __gen_uint(values->InstructionBuffersizeModifyEnable, 0, 0) |
8474b8e80941Smrg      __gen_uint(values->InstructionBufferSize, 12, 31);
8475b8e80941Smrg}
8476b8e80941Smrg
8477b8e80941Smrg#define GEN8_STATE_PREFETCH_length             2
8478b8e80941Smrg#define GEN8_STATE_PREFETCH_length_bias        2
8479b8e80941Smrg#define GEN8_STATE_PREFETCH_header              \
8480b8e80941Smrg   .DWordLength                         =      0,  \
8481b8e80941Smrg   ._3DCommandSubOpcode                 =      3,  \
8482b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
8483b8e80941Smrg   .CommandSubType                      =      0,  \
8484b8e80941Smrg   .CommandType                         =      3
8485b8e80941Smrg
8486b8e80941Smrgstruct GEN8_STATE_PREFETCH {
8487b8e80941Smrg   uint32_t                             DWordLength;
8488b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
8489b8e80941Smrg   uint32_t                             _3DCommandOpcode;
8490b8e80941Smrg   uint32_t                             CommandSubType;
8491b8e80941Smrg   uint32_t                             CommandType;
8492b8e80941Smrg   uint32_t                             PrefetchCount;
8493b8e80941Smrg   __gen_address_type                   PrefetchPointer;
8494b8e80941Smrg};
8495b8e80941Smrg
8496b8e80941Smrgstatic inline void
8497b8e80941SmrgGEN8_STATE_PREFETCH_pack(__attribute__((unused)) __gen_user_data *data,
8498b8e80941Smrg                         __attribute__((unused)) void * restrict dst,
8499b8e80941Smrg                         __attribute__((unused)) const struct GEN8_STATE_PREFETCH * restrict values)
8500b8e80941Smrg{
8501b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8502b8e80941Smrg
8503b8e80941Smrg   dw[0] =
8504b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
8505b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
8506b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
8507b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
8508b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
8509b8e80941Smrg
8510b8e80941Smrg   const uint32_t v1 =
8511b8e80941Smrg      __gen_uint(values->PrefetchCount, 0, 2);
8512b8e80941Smrg   dw[1] = __gen_combine_address(data, &dw[1], values->PrefetchPointer, v1);
8513b8e80941Smrg}
8514b8e80941Smrg
8515b8e80941Smrg#define GEN8_STATE_SIP_length                  3
8516b8e80941Smrg#define GEN8_STATE_SIP_length_bias             2
8517b8e80941Smrg#define GEN8_STATE_SIP_header                   \
8518b8e80941Smrg   .DWordLength                         =      1,  \
8519b8e80941Smrg   ._3DCommandSubOpcode                 =      2,  \
8520b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
8521b8e80941Smrg   .CommandSubType                      =      0,  \
8522b8e80941Smrg   .CommandType                         =      3
8523b8e80941Smrg
8524b8e80941Smrgstruct GEN8_STATE_SIP {
8525b8e80941Smrg   uint32_t                             DWordLength;
8526b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
8527b8e80941Smrg   uint32_t                             _3DCommandOpcode;
8528b8e80941Smrg   uint32_t                             CommandSubType;
8529b8e80941Smrg   uint32_t                             CommandType;
8530b8e80941Smrg   uint64_t                             SystemInstructionPointer;
8531b8e80941Smrg};
8532b8e80941Smrg
8533b8e80941Smrgstatic inline void
8534b8e80941SmrgGEN8_STATE_SIP_pack(__attribute__((unused)) __gen_user_data *data,
8535b8e80941Smrg                    __attribute__((unused)) void * restrict dst,
8536b8e80941Smrg                    __attribute__((unused)) const struct GEN8_STATE_SIP * restrict values)
8537b8e80941Smrg{
8538b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8539b8e80941Smrg
8540b8e80941Smrg   dw[0] =
8541b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
8542b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
8543b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
8544b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
8545b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
8546b8e80941Smrg
8547b8e80941Smrg   const uint64_t v1 =
8548b8e80941Smrg      __gen_offset(values->SystemInstructionPointer, 4, 63);
8549b8e80941Smrg   dw[1] = v1;
8550b8e80941Smrg   dw[2] = v1 >> 32;
8551b8e80941Smrg}
8552b8e80941Smrg
8553b8e80941Smrg#define GEN8_SWTESS_BASE_ADDRESS_length        2
8554b8e80941Smrg#define GEN8_SWTESS_BASE_ADDRESS_length_bias      2
8555b8e80941Smrg#define GEN8_SWTESS_BASE_ADDRESS_header         \
8556b8e80941Smrg   .DWordLength                         =      0,  \
8557b8e80941Smrg   ._3DCommandSubOpcode                 =      3,  \
8558b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
8559b8e80941Smrg   .CommandSubType                      =      0,  \
8560b8e80941Smrg   .CommandType                         =      3
8561b8e80941Smrg
8562b8e80941Smrgstruct GEN8_SWTESS_BASE_ADDRESS {
8563b8e80941Smrg   uint32_t                             DWordLength;
8564b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
8565b8e80941Smrg   uint32_t                             _3DCommandOpcode;
8566b8e80941Smrg   uint32_t                             CommandSubType;
8567b8e80941Smrg   uint32_t                             CommandType;
8568b8e80941Smrg   uint32_t                             SWTessellationMOCS;
8569b8e80941Smrg   __gen_address_type                   SWTessellationBaseAddress;
8570b8e80941Smrg};
8571b8e80941Smrg
8572b8e80941Smrgstatic inline void
8573b8e80941SmrgGEN8_SWTESS_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
8574b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
8575b8e80941Smrg                              __attribute__((unused)) const struct GEN8_SWTESS_BASE_ADDRESS * restrict values)
8576b8e80941Smrg{
8577b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8578b8e80941Smrg
8579b8e80941Smrg   dw[0] =
8580b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
8581b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
8582b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
8583b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
8584b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
8585b8e80941Smrg
8586b8e80941Smrg   const uint64_t v1 =
8587b8e80941Smrg      __gen_uint(values->SWTessellationMOCS, 8, 11);
8588b8e80941Smrg   const uint64_t v1_address =
8589b8e80941Smrg      __gen_combine_address(data, &dw[1], values->SWTessellationBaseAddress, v1);
8590b8e80941Smrg   dw[1] = v1_address;
8591b8e80941Smrg   dw[2] = (v1_address >> 32) | (v1 >> 32);
8592b8e80941Smrg}
8593b8e80941Smrg
8594b8e80941Smrg#define GEN8_ACTHD_UDW_num                0x205c
8595b8e80941Smrg#define GEN8_ACTHD_UDW_length                  1
8596b8e80941Smrgstruct GEN8_ACTHD_UDW {
8597b8e80941Smrg   uint32_t                             HeadPointerUpperDWORD;
8598b8e80941Smrg};
8599b8e80941Smrg
8600b8e80941Smrgstatic inline void
8601b8e80941SmrgGEN8_ACTHD_UDW_pack(__attribute__((unused)) __gen_user_data *data,
8602b8e80941Smrg                    __attribute__((unused)) void * restrict dst,
8603b8e80941Smrg                    __attribute__((unused)) const struct GEN8_ACTHD_UDW * restrict values)
8604b8e80941Smrg{
8605b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8606b8e80941Smrg
8607b8e80941Smrg   dw[0] =
8608b8e80941Smrg      __gen_uint(values->HeadPointerUpperDWORD, 0, 15);
8609b8e80941Smrg}
8610b8e80941Smrg
8611b8e80941Smrg#define GEN8_BCS_ACTHD_UDW_num            0x2205c
8612b8e80941Smrg#define GEN8_BCS_ACTHD_UDW_length              1
8613b8e80941Smrgstruct GEN8_BCS_ACTHD_UDW {
8614b8e80941Smrg   uint32_t                             HeadPointerUpperDWORD;
8615b8e80941Smrg};
8616b8e80941Smrg
8617b8e80941Smrgstatic inline void
8618b8e80941SmrgGEN8_BCS_ACTHD_UDW_pack(__attribute__((unused)) __gen_user_data *data,
8619b8e80941Smrg                        __attribute__((unused)) void * restrict dst,
8620b8e80941Smrg                        __attribute__((unused)) const struct GEN8_BCS_ACTHD_UDW * restrict values)
8621b8e80941Smrg{
8622b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8623b8e80941Smrg
8624b8e80941Smrg   dw[0] =
8625b8e80941Smrg      __gen_uint(values->HeadPointerUpperDWORD, 0, 15);
8626b8e80941Smrg}
8627b8e80941Smrg
8628b8e80941Smrg#define GEN8_BCS_INSTDONE_num             0x2206c
8629b8e80941Smrg#define GEN8_BCS_INSTDONE_length               1
8630b8e80941Smrgstruct GEN8_BCS_INSTDONE {
8631b8e80941Smrg   bool                                 RingEnable;
8632b8e80941Smrg   bool                                 BlitterIDLE;
8633b8e80941Smrg   bool                                 GABIDLE;
8634b8e80941Smrg   bool                                 BCSDone;
8635b8e80941Smrg};
8636b8e80941Smrg
8637b8e80941Smrgstatic inline void
8638b8e80941SmrgGEN8_BCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
8639b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
8640b8e80941Smrg                       __attribute__((unused)) const struct GEN8_BCS_INSTDONE * restrict values)
8641b8e80941Smrg{
8642b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8643b8e80941Smrg
8644b8e80941Smrg   dw[0] =
8645b8e80941Smrg      __gen_uint(values->RingEnable, 0, 0) |
8646b8e80941Smrg      __gen_uint(values->BlitterIDLE, 1, 1) |
8647b8e80941Smrg      __gen_uint(values->GABIDLE, 2, 2) |
8648b8e80941Smrg      __gen_uint(values->BCSDone, 3, 3);
8649b8e80941Smrg}
8650b8e80941Smrg
8651b8e80941Smrg#define GEN8_BCS_RING_BUFFER_CTL_num      0x2203c
8652b8e80941Smrg#define GEN8_BCS_RING_BUFFER_CTL_length        1
8653b8e80941Smrgstruct GEN8_BCS_RING_BUFFER_CTL {
8654b8e80941Smrg   bool                                 RingBufferEnable;
8655b8e80941Smrg   uint32_t                             AutomaticReportHeadPointer;
8656b8e80941Smrg#define MI_AUTOREPORT_OFF                        0
8657b8e80941Smrg#define MI_AUTOREPORT_64KB                       1
8658b8e80941Smrg#define MI_AUTOREPORT_4KB                        2
8659b8e80941Smrg#define MI_AUTOREPORT_128KB                      3
8660b8e80941Smrg   bool                                 DisableRegisterAccesses;
8661b8e80941Smrg   bool                                 SemaphoreWait;
8662b8e80941Smrg   bool                                 RBWait;
8663b8e80941Smrg   uint32_t                             BufferLengthinpages1;
8664b8e80941Smrg};
8665b8e80941Smrg
8666b8e80941Smrgstatic inline void
8667b8e80941SmrgGEN8_BCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
8668b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
8669b8e80941Smrg                              __attribute__((unused)) const struct GEN8_BCS_RING_BUFFER_CTL * restrict values)
8670b8e80941Smrg{
8671b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8672b8e80941Smrg
8673b8e80941Smrg   dw[0] =
8674b8e80941Smrg      __gen_uint(values->RingBufferEnable, 0, 0) |
8675b8e80941Smrg      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
8676b8e80941Smrg      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
8677b8e80941Smrg      __gen_uint(values->SemaphoreWait, 10, 10) |
8678b8e80941Smrg      __gen_uint(values->RBWait, 11, 11) |
8679b8e80941Smrg      __gen_uint(values->BufferLengthinpages1, 12, 20);
8680b8e80941Smrg}
8681b8e80941Smrg
8682b8e80941Smrg#define GEN8_CACHE_MODE_1_num             0x7004
8683b8e80941Smrg#define GEN8_CACHE_MODE_1_length               1
8684b8e80941Smrgstruct GEN8_CACHE_MODE_1 {
8685b8e80941Smrg   bool                                 RCZReadafterexpansioncontrolfix2;
8686b8e80941Smrg   bool                                 DepthReadHitWriteOnlyOptimizationDisable;
8687b8e80941Smrg   bool                                 MCSCacheDisable;
8688b8e80941Smrg   bool                                 _4X4RCPFESTCOptimizationDisable;
8689b8e80941Smrg   uint32_t                             SamplerCacheSetXORselection;
8690b8e80941Smrg   uint32_t                             NPPMAFixEnable;
8691b8e80941Smrg   uint32_t                             HIZEvictionPolicy;
8692b8e80941Smrg   uint32_t                             NPEarlyZFailsDisable;
8693b8e80941Smrg   uint32_t                             MSCResolveOptimizationDisable;
8694b8e80941Smrg   bool                                 RCZReadafterexpansioncontrolfix2Mask;
8695b8e80941Smrg   bool                                 DepthReadHitWriteOnlyOptimizationDisableMask;
8696b8e80941Smrg   bool                                 MCSCacheDisableMask;
8697b8e80941Smrg   bool                                 _4X4RCPFESTCOptimizationDisableMask;
8698b8e80941Smrg   uint32_t                             SamplerCacheSetXORselectionMask;
8699b8e80941Smrg   uint32_t                             NPPMAFixEnableMask;
8700b8e80941Smrg   uint32_t                             HIZEvictionPolicyMask;
8701b8e80941Smrg   uint32_t                             NPEarlyZFailsDisableMask;
8702b8e80941Smrg   uint32_t                             MSCResolveOptimizationDisableMask;
8703b8e80941Smrg};
8704b8e80941Smrg
8705b8e80941Smrgstatic inline void
8706b8e80941SmrgGEN8_CACHE_MODE_1_pack(__attribute__((unused)) __gen_user_data *data,
8707b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
8708b8e80941Smrg                       __attribute__((unused)) const struct GEN8_CACHE_MODE_1 * restrict values)
8709b8e80941Smrg{
8710b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8711b8e80941Smrg
8712b8e80941Smrg   dw[0] =
8713b8e80941Smrg      __gen_uint(values->RCZReadafterexpansioncontrolfix2, 2, 2) |
8714b8e80941Smrg      __gen_uint(values->DepthReadHitWriteOnlyOptimizationDisable, 3, 3) |
8715b8e80941Smrg      __gen_uint(values->MCSCacheDisable, 5, 5) |
8716b8e80941Smrg      __gen_uint(values->_4X4RCPFESTCOptimizationDisable, 6, 6) |
8717b8e80941Smrg      __gen_uint(values->SamplerCacheSetXORselection, 7, 8) |
8718b8e80941Smrg      __gen_uint(values->NPPMAFixEnable, 11, 11) |
8719b8e80941Smrg      __gen_uint(values->HIZEvictionPolicy, 12, 12) |
8720b8e80941Smrg      __gen_uint(values->NPEarlyZFailsDisable, 13, 13) |
8721b8e80941Smrg      __gen_uint(values->MSCResolveOptimizationDisable, 14, 14) |
8722b8e80941Smrg      __gen_uint(values->RCZReadafterexpansioncontrolfix2Mask, 18, 18) |
8723b8e80941Smrg      __gen_uint(values->DepthReadHitWriteOnlyOptimizationDisableMask, 19, 19) |
8724b8e80941Smrg      __gen_uint(values->MCSCacheDisableMask, 21, 21) |
8725b8e80941Smrg      __gen_uint(values->_4X4RCPFESTCOptimizationDisableMask, 22, 22) |
8726b8e80941Smrg      __gen_uint(values->SamplerCacheSetXORselectionMask, 23, 24) |
8727b8e80941Smrg      __gen_uint(values->NPPMAFixEnableMask, 27, 27) |
8728b8e80941Smrg      __gen_uint(values->HIZEvictionPolicyMask, 28, 28) |
8729b8e80941Smrg      __gen_uint(values->NPEarlyZFailsDisableMask, 29, 29) |
8730b8e80941Smrg      __gen_uint(values->MSCResolveOptimizationDisableMask, 30, 30);
8731b8e80941Smrg}
8732b8e80941Smrg
8733b8e80941Smrg#define GEN8_CL_INVOCATION_COUNT_num      0x2338
8734b8e80941Smrg#define GEN8_CL_INVOCATION_COUNT_length        2
8735b8e80941Smrgstruct GEN8_CL_INVOCATION_COUNT {
8736b8e80941Smrg   uint64_t                             CLInvocationCountReport;
8737b8e80941Smrg};
8738b8e80941Smrg
8739b8e80941Smrgstatic inline void
8740b8e80941SmrgGEN8_CL_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
8741b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
8742b8e80941Smrg                              __attribute__((unused)) const struct GEN8_CL_INVOCATION_COUNT * restrict values)
8743b8e80941Smrg{
8744b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8745b8e80941Smrg
8746b8e80941Smrg   const uint64_t v0 =
8747b8e80941Smrg      __gen_uint(values->CLInvocationCountReport, 0, 63);
8748b8e80941Smrg   dw[0] = v0;
8749b8e80941Smrg   dw[1] = v0 >> 32;
8750b8e80941Smrg}
8751b8e80941Smrg
8752b8e80941Smrg#define GEN8_CL_PRIMITIVES_COUNT_num      0x2340
8753b8e80941Smrg#define GEN8_CL_PRIMITIVES_COUNT_length        2
8754b8e80941Smrgstruct GEN8_CL_PRIMITIVES_COUNT {
8755b8e80941Smrg   uint64_t                             CLPrimitivesCountReport;
8756b8e80941Smrg};
8757b8e80941Smrg
8758b8e80941Smrgstatic inline void
8759b8e80941SmrgGEN8_CL_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
8760b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
8761b8e80941Smrg                              __attribute__((unused)) const struct GEN8_CL_PRIMITIVES_COUNT * restrict values)
8762b8e80941Smrg{
8763b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8764b8e80941Smrg
8765b8e80941Smrg   const uint64_t v0 =
8766b8e80941Smrg      __gen_uint(values->CLPrimitivesCountReport, 0, 63);
8767b8e80941Smrg   dw[0] = v0;
8768b8e80941Smrg   dw[1] = v0 >> 32;
8769b8e80941Smrg}
8770b8e80941Smrg
8771b8e80941Smrg#define GEN8_CS_INVOCATION_COUNT_num      0x2290
8772b8e80941Smrg#define GEN8_CS_INVOCATION_COUNT_length        2
8773b8e80941Smrgstruct GEN8_CS_INVOCATION_COUNT {
8774b8e80941Smrg   uint64_t                             CSInvocationCountReport;
8775b8e80941Smrg};
8776b8e80941Smrg
8777b8e80941Smrgstatic inline void
8778b8e80941SmrgGEN8_CS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
8779b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
8780b8e80941Smrg                              __attribute__((unused)) const struct GEN8_CS_INVOCATION_COUNT * restrict values)
8781b8e80941Smrg{
8782b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8783b8e80941Smrg
8784b8e80941Smrg   const uint64_t v0 =
8785b8e80941Smrg      __gen_uint(values->CSInvocationCountReport, 0, 63);
8786b8e80941Smrg   dw[0] = v0;
8787b8e80941Smrg   dw[1] = v0 >> 32;
8788b8e80941Smrg}
8789b8e80941Smrg
8790b8e80941Smrg#define GEN8_DS_INVOCATION_COUNT_num      0x2308
8791b8e80941Smrg#define GEN8_DS_INVOCATION_COUNT_length        2
8792b8e80941Smrgstruct GEN8_DS_INVOCATION_COUNT {
8793b8e80941Smrg   uint64_t                             DSInvocationCountReport;
8794b8e80941Smrg};
8795b8e80941Smrg
8796b8e80941Smrgstatic inline void
8797b8e80941SmrgGEN8_DS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
8798b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
8799b8e80941Smrg                              __attribute__((unused)) const struct GEN8_DS_INVOCATION_COUNT * restrict values)
8800b8e80941Smrg{
8801b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8802b8e80941Smrg
8803b8e80941Smrg   const uint64_t v0 =
8804b8e80941Smrg      __gen_uint(values->DSInvocationCountReport, 0, 63);
8805b8e80941Smrg   dw[0] = v0;
8806b8e80941Smrg   dw[1] = v0 >> 32;
8807b8e80941Smrg}
8808b8e80941Smrg
8809b8e80941Smrg#define GEN8_FAULT_REG_num                0x4094
8810b8e80941Smrg#define GEN8_FAULT_REG_length                  1
8811b8e80941Smrgstruct GEN8_FAULT_REG {
8812b8e80941Smrg   bool                                 ValidBit;
8813b8e80941Smrg   uint32_t                             FaultType;
8814b8e80941Smrg#define InvalidPTEFault                          0
8815b8e80941Smrg#define InvalidPDEFault                          1
8816b8e80941Smrg#define InvalidPDPEFault                         2
8817b8e80941Smrg#define InvalidPML4EFault                        3
8818b8e80941Smrg   uint32_t                             SRCIDofFault;
8819b8e80941Smrg   uint32_t                             GTTSEL;
8820b8e80941Smrg#define PPGTT                                    0
8821b8e80941Smrg#define GGTT                                     1
8822b8e80941Smrg   uint32_t                             EngineID;
8823b8e80941Smrg#define GFX                                      0
8824b8e80941Smrg#define MFX0                                     1
8825b8e80941Smrg#define MFX1                                     2
8826b8e80941Smrg#define VEBX                                     3
8827b8e80941Smrg#define BLT                                      4
8828b8e80941Smrg#define GUC                                      5
8829b8e80941Smrg};
8830b8e80941Smrg
8831b8e80941Smrgstatic inline void
8832b8e80941SmrgGEN8_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
8833b8e80941Smrg                    __attribute__((unused)) void * restrict dst,
8834b8e80941Smrg                    __attribute__((unused)) const struct GEN8_FAULT_REG * restrict values)
8835b8e80941Smrg{
8836b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8837b8e80941Smrg
8838b8e80941Smrg   dw[0] =
8839b8e80941Smrg      __gen_uint(values->ValidBit, 0, 0) |
8840b8e80941Smrg      __gen_uint(values->FaultType, 1, 2) |
8841b8e80941Smrg      __gen_uint(values->SRCIDofFault, 3, 10) |
8842b8e80941Smrg      __gen_uint(values->GTTSEL, 11, 11) |
8843b8e80941Smrg      __gen_uint(values->EngineID, 12, 14);
8844b8e80941Smrg}
8845b8e80941Smrg
8846b8e80941Smrg#define GEN8_GFX_ARB_ERROR_RPT_num        0x40a0
8847b8e80941Smrg#define GEN8_GFX_ARB_ERROR_RPT_length          1
8848b8e80941Smrgstruct GEN8_GFX_ARB_ERROR_RPT {
8849b8e80941Smrg   bool                                 TLBPageFaultError;
8850b8e80941Smrg   bool                                 RSTRMPAVPReadInvalid;
8851b8e80941Smrg   bool                                 InvalidPageDirectoryEntryError;
8852b8e80941Smrg   bool                                 ROSTRMPAVPInvalidPhysicalAddress;
8853b8e80941Smrg   bool                                 TLBPageVTDTranslationError;
8854b8e80941Smrg   bool                                 WRDPPAVPInvalid;
8855b8e80941Smrg   bool                                 PageDirectoryEntryVTDTranslationError;
8856b8e80941Smrg   bool                                 UnloadedPDError;
8857b8e80941Smrg   bool                                 GuCVTdtranslationPageFault2ndlevelUndefineddoorbell;
8858b8e80941Smrg   bool                                 NonWBmemorytypeforAdvancedContext;
8859b8e80941Smrg   bool                                 PASIDNotEnabled;
8860b8e80941Smrg   bool                                 PASIDBoundaryViolation;
8861b8e80941Smrg   bool                                 PASIDNotValid;
8862b8e80941Smrg   bool                                 PASIDWasZeroForUntranslatedRequest;
8863b8e80941Smrg   bool                                 ContextWasNotMarkedAsPresentWhenDoingDMA;
8864b8e80941Smrg};
8865b8e80941Smrg
8866b8e80941Smrgstatic inline void
8867b8e80941SmrgGEN8_GFX_ARB_ERROR_RPT_pack(__attribute__((unused)) __gen_user_data *data,
8868b8e80941Smrg                            __attribute__((unused)) void * restrict dst,
8869b8e80941Smrg                            __attribute__((unused)) const struct GEN8_GFX_ARB_ERROR_RPT * restrict values)
8870b8e80941Smrg{
8871b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8872b8e80941Smrg
8873b8e80941Smrg   dw[0] =
8874b8e80941Smrg      __gen_uint(values->TLBPageFaultError, 0, 0) |
8875b8e80941Smrg      __gen_uint(values->RSTRMPAVPReadInvalid, 1, 1) |
8876b8e80941Smrg      __gen_uint(values->InvalidPageDirectoryEntryError, 2, 2) |
8877b8e80941Smrg      __gen_uint(values->ROSTRMPAVPInvalidPhysicalAddress, 3, 3) |
8878b8e80941Smrg      __gen_uint(values->TLBPageVTDTranslationError, 4, 4) |
8879b8e80941Smrg      __gen_uint(values->WRDPPAVPInvalid, 5, 5) |
8880b8e80941Smrg      __gen_uint(values->PageDirectoryEntryVTDTranslationError, 6, 6) |
8881b8e80941Smrg      __gen_uint(values->UnloadedPDError, 8, 8) |
8882b8e80941Smrg      __gen_uint(values->GuCVTdtranslationPageFault2ndlevelUndefineddoorbell, 9, 9) |
8883b8e80941Smrg      __gen_uint(values->NonWBmemorytypeforAdvancedContext, 10, 10) |
8884b8e80941Smrg      __gen_uint(values->PASIDNotEnabled, 11, 11) |
8885b8e80941Smrg      __gen_uint(values->PASIDBoundaryViolation, 12, 12) |
8886b8e80941Smrg      __gen_uint(values->PASIDNotValid, 13, 13) |
8887b8e80941Smrg      __gen_uint(values->PASIDWasZeroForUntranslatedRequest, 14, 14) |
8888b8e80941Smrg      __gen_uint(values->ContextWasNotMarkedAsPresentWhenDoingDMA, 15, 15);
8889b8e80941Smrg}
8890b8e80941Smrg
8891b8e80941Smrg#define GEN8_GS_INVOCATION_COUNT_num      0x2328
8892b8e80941Smrg#define GEN8_GS_INVOCATION_COUNT_length        2
8893b8e80941Smrgstruct GEN8_GS_INVOCATION_COUNT {
8894b8e80941Smrg   uint64_t                             GSInvocationCountReport;
8895b8e80941Smrg};
8896b8e80941Smrg
8897b8e80941Smrgstatic inline void
8898b8e80941SmrgGEN8_GS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
8899b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
8900b8e80941Smrg                              __attribute__((unused)) const struct GEN8_GS_INVOCATION_COUNT * restrict values)
8901b8e80941Smrg{
8902b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8903b8e80941Smrg
8904b8e80941Smrg   const uint64_t v0 =
8905b8e80941Smrg      __gen_uint(values->GSInvocationCountReport, 0, 63);
8906b8e80941Smrg   dw[0] = v0;
8907b8e80941Smrg   dw[1] = v0 >> 32;
8908b8e80941Smrg}
8909b8e80941Smrg
8910b8e80941Smrg#define GEN8_GS_PRIMITIVES_COUNT_num      0x2330
8911b8e80941Smrg#define GEN8_GS_PRIMITIVES_COUNT_length        2
8912b8e80941Smrgstruct GEN8_GS_PRIMITIVES_COUNT {
8913b8e80941Smrg   uint64_t                             GSPrimitivesCountReport;
8914b8e80941Smrg};
8915b8e80941Smrg
8916b8e80941Smrgstatic inline void
8917b8e80941SmrgGEN8_GS_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
8918b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
8919b8e80941Smrg                              __attribute__((unused)) const struct GEN8_GS_PRIMITIVES_COUNT * restrict values)
8920b8e80941Smrg{
8921b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8922b8e80941Smrg
8923b8e80941Smrg   const uint64_t v0 =
8924b8e80941Smrg      __gen_uint(values->GSPrimitivesCountReport, 0, 63);
8925b8e80941Smrg   dw[0] = v0;
8926b8e80941Smrg   dw[1] = v0 >> 32;
8927b8e80941Smrg}
8928b8e80941Smrg
8929b8e80941Smrg#define GEN8_HS_INVOCATION_COUNT_num      0x2300
8930b8e80941Smrg#define GEN8_HS_INVOCATION_COUNT_length        2
8931b8e80941Smrgstruct GEN8_HS_INVOCATION_COUNT {
8932b8e80941Smrg   uint64_t                             HSInvocationCountReport;
8933b8e80941Smrg};
8934b8e80941Smrg
8935b8e80941Smrgstatic inline void
8936b8e80941SmrgGEN8_HS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
8937b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
8938b8e80941Smrg                              __attribute__((unused)) const struct GEN8_HS_INVOCATION_COUNT * restrict values)
8939b8e80941Smrg{
8940b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8941b8e80941Smrg
8942b8e80941Smrg   const uint64_t v0 =
8943b8e80941Smrg      __gen_uint(values->HSInvocationCountReport, 0, 63);
8944b8e80941Smrg   dw[0] = v0;
8945b8e80941Smrg   dw[1] = v0 >> 32;
8946b8e80941Smrg}
8947b8e80941Smrg
8948b8e80941Smrg#define GEN8_IA_PRIMITIVES_COUNT_num      0x2318
8949b8e80941Smrg#define GEN8_IA_PRIMITIVES_COUNT_length        2
8950b8e80941Smrgstruct GEN8_IA_PRIMITIVES_COUNT {
8951b8e80941Smrg   uint64_t                             IAPrimitivesCountReport;
8952b8e80941Smrg};
8953b8e80941Smrg
8954b8e80941Smrgstatic inline void
8955b8e80941SmrgGEN8_IA_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
8956b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
8957b8e80941Smrg                              __attribute__((unused)) const struct GEN8_IA_PRIMITIVES_COUNT * restrict values)
8958b8e80941Smrg{
8959b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8960b8e80941Smrg
8961b8e80941Smrg   const uint64_t v0 =
8962b8e80941Smrg      __gen_uint(values->IAPrimitivesCountReport, 0, 63);
8963b8e80941Smrg   dw[0] = v0;
8964b8e80941Smrg   dw[1] = v0 >> 32;
8965b8e80941Smrg}
8966b8e80941Smrg
8967b8e80941Smrg#define GEN8_IA_VERTICES_COUNT_num        0x2310
8968b8e80941Smrg#define GEN8_IA_VERTICES_COUNT_length          2
8969b8e80941Smrgstruct GEN8_IA_VERTICES_COUNT {
8970b8e80941Smrg   uint64_t                             IAVerticesCountReport;
8971b8e80941Smrg};
8972b8e80941Smrg
8973b8e80941Smrgstatic inline void
8974b8e80941SmrgGEN8_IA_VERTICES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
8975b8e80941Smrg                            __attribute__((unused)) void * restrict dst,
8976b8e80941Smrg                            __attribute__((unused)) const struct GEN8_IA_VERTICES_COUNT * restrict values)
8977b8e80941Smrg{
8978b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
8979b8e80941Smrg
8980b8e80941Smrg   const uint64_t v0 =
8981b8e80941Smrg      __gen_uint(values->IAVerticesCountReport, 0, 63);
8982b8e80941Smrg   dw[0] = v0;
8983b8e80941Smrg   dw[1] = v0 >> 32;
8984b8e80941Smrg}
8985b8e80941Smrg
8986b8e80941Smrg#define GEN8_INSTDONE_1_num               0x206c
8987b8e80941Smrg#define GEN8_INSTDONE_1_length                 1
8988b8e80941Smrgstruct GEN8_INSTDONE_1 {
8989b8e80941Smrg   bool                                 PRB0RingEnable;
8990b8e80941Smrg   bool                                 VFGDone;
8991b8e80941Smrg   bool                                 VSDone;
8992b8e80941Smrg   bool                                 HSDone;
8993b8e80941Smrg   bool                                 TEDone;
8994b8e80941Smrg   bool                                 DSDone;
8995b8e80941Smrg   bool                                 GSDone;
8996b8e80941Smrg   bool                                 SOLDone;
8997b8e80941Smrg   bool                                 CLDone;
8998b8e80941Smrg   bool                                 SFDone;
8999b8e80941Smrg   bool                                 TDGDone;
9000b8e80941Smrg   bool                                 URBMDone;
9001b8e80941Smrg   bool                                 SVGDone;
9002b8e80941Smrg   bool                                 GAFSDone;
9003b8e80941Smrg   bool                                 VFEDone;
9004b8e80941Smrg   bool                                 TSGDone;
9005b8e80941Smrg   bool                                 GAFMDone;
9006b8e80941Smrg   bool                                 GAMDone;
9007b8e80941Smrg   bool                                 RSDone;
9008b8e80941Smrg   bool                                 CSDone;
9009b8e80941Smrg   bool                                 SDEDone;
9010b8e80941Smrg   bool                                 RCCFBCCSDone;
9011b8e80941Smrg};
9012b8e80941Smrg
9013b8e80941Smrgstatic inline void
9014b8e80941SmrgGEN8_INSTDONE_1_pack(__attribute__((unused)) __gen_user_data *data,
9015b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
9016b8e80941Smrg                     __attribute__((unused)) const struct GEN8_INSTDONE_1 * restrict values)
9017b8e80941Smrg{
9018b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9019b8e80941Smrg
9020b8e80941Smrg   dw[0] =
9021b8e80941Smrg      __gen_uint(values->PRB0RingEnable, 0, 0) |
9022b8e80941Smrg      __gen_uint(values->VFGDone, 1, 1) |
9023b8e80941Smrg      __gen_uint(values->VSDone, 2, 2) |
9024b8e80941Smrg      __gen_uint(values->HSDone, 3, 3) |
9025b8e80941Smrg      __gen_uint(values->TEDone, 4, 4) |
9026b8e80941Smrg      __gen_uint(values->DSDone, 5, 5) |
9027b8e80941Smrg      __gen_uint(values->GSDone, 6, 6) |
9028b8e80941Smrg      __gen_uint(values->SOLDone, 7, 7) |
9029b8e80941Smrg      __gen_uint(values->CLDone, 8, 8) |
9030b8e80941Smrg      __gen_uint(values->SFDone, 9, 9) |
9031b8e80941Smrg      __gen_uint(values->TDGDone, 12, 12) |
9032b8e80941Smrg      __gen_uint(values->URBMDone, 13, 13) |
9033b8e80941Smrg      __gen_uint(values->SVGDone, 14, 14) |
9034b8e80941Smrg      __gen_uint(values->GAFSDone, 15, 15) |
9035b8e80941Smrg      __gen_uint(values->VFEDone, 16, 16) |
9036b8e80941Smrg      __gen_uint(values->TSGDone, 17, 17) |
9037b8e80941Smrg      __gen_uint(values->GAFMDone, 18, 18) |
9038b8e80941Smrg      __gen_uint(values->GAMDone, 19, 19) |
9039b8e80941Smrg      __gen_uint(values->RSDone, 20, 20) |
9040b8e80941Smrg      __gen_uint(values->CSDone, 21, 21) |
9041b8e80941Smrg      __gen_uint(values->SDEDone, 22, 22) |
9042b8e80941Smrg      __gen_uint(values->RCCFBCCSDone, 23, 23);
9043b8e80941Smrg}
9044b8e80941Smrg
9045b8e80941Smrg#define GEN8_INSTPM_num                   0x20c0
9046b8e80941Smrg#define GEN8_INSTPM_length                     1
9047b8e80941Smrgstruct GEN8_INSTPM {
9048b8e80941Smrg   bool                                 _3DStateInstructionDisable;
9049b8e80941Smrg   bool                                 _3DRenderingInstructionDisable;
9050b8e80941Smrg   bool                                 MediaInstructionDisable;
9051b8e80941Smrg   bool                                 CONSTANT_BUFFERAddressOffsetDisable;
9052b8e80941Smrg   bool                                 _3DStateInstructionDisableMask;
9053b8e80941Smrg   bool                                 _3DRenderingInstructionDisableMask;
9054b8e80941Smrg   bool                                 MediaInstructionDisableMask;
9055b8e80941Smrg   bool                                 CONSTANT_BUFFERAddressOffsetDisableMask;
9056b8e80941Smrg};
9057b8e80941Smrg
9058b8e80941Smrgstatic inline void
9059b8e80941SmrgGEN8_INSTPM_pack(__attribute__((unused)) __gen_user_data *data,
9060b8e80941Smrg                 __attribute__((unused)) void * restrict dst,
9061b8e80941Smrg                 __attribute__((unused)) const struct GEN8_INSTPM * restrict values)
9062b8e80941Smrg{
9063b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9064b8e80941Smrg
9065b8e80941Smrg   dw[0] =
9066b8e80941Smrg      __gen_uint(values->_3DStateInstructionDisable, 1, 1) |
9067b8e80941Smrg      __gen_uint(values->_3DRenderingInstructionDisable, 2, 2) |
9068b8e80941Smrg      __gen_uint(values->MediaInstructionDisable, 3, 3) |
9069b8e80941Smrg      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisable, 6, 6) |
9070b8e80941Smrg      __gen_uint(values->_3DStateInstructionDisableMask, 17, 17) |
9071b8e80941Smrg      __gen_uint(values->_3DRenderingInstructionDisableMask, 18, 18) |
9072b8e80941Smrg      __gen_uint(values->MediaInstructionDisableMask, 19, 19) |
9073b8e80941Smrg      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisableMask, 22, 22);
9074b8e80941Smrg}
9075b8e80941Smrg
9076b8e80941Smrg#define GEN8_L3CNTLREG_num                0x7034
9077b8e80941Smrg#define GEN8_L3CNTLREG_length                  1
9078b8e80941Smrgstruct GEN8_L3CNTLREG {
9079b8e80941Smrg   bool                                 SLMEnable;
9080b8e80941Smrg   uint32_t                             URBAllocation;
9081b8e80941Smrg   uint32_t                             ROAllocation;
9082b8e80941Smrg   uint32_t                             DCAllocation;
9083b8e80941Smrg   uint32_t                             AllAllocation;
9084b8e80941Smrg};
9085b8e80941Smrg
9086b8e80941Smrgstatic inline void
9087b8e80941SmrgGEN8_L3CNTLREG_pack(__attribute__((unused)) __gen_user_data *data,
9088b8e80941Smrg                    __attribute__((unused)) void * restrict dst,
9089b8e80941Smrg                    __attribute__((unused)) const struct GEN8_L3CNTLREG * restrict values)
9090b8e80941Smrg{
9091b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9092b8e80941Smrg
9093b8e80941Smrg   dw[0] =
9094b8e80941Smrg      __gen_uint(values->SLMEnable, 0, 0) |
9095b8e80941Smrg      __gen_uint(values->URBAllocation, 1, 7) |
9096b8e80941Smrg      __gen_uint(values->ROAllocation, 11, 17) |
9097b8e80941Smrg      __gen_uint(values->DCAllocation, 18, 24) |
9098b8e80941Smrg      __gen_uint(values->AllAllocation, 25, 31);
9099b8e80941Smrg}
9100b8e80941Smrg
9101b8e80941Smrg#define GEN8_PS_INVOCATION_COUNT_num      0x2348
9102b8e80941Smrg#define GEN8_PS_INVOCATION_COUNT_length        2
9103b8e80941Smrgstruct GEN8_PS_INVOCATION_COUNT {
9104b8e80941Smrg   uint64_t                             PSInvocationCountReport;
9105b8e80941Smrg};
9106b8e80941Smrg
9107b8e80941Smrgstatic inline void
9108b8e80941SmrgGEN8_PS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
9109b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
9110b8e80941Smrg                              __attribute__((unused)) const struct GEN8_PS_INVOCATION_COUNT * restrict values)
9111b8e80941Smrg{
9112b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9113b8e80941Smrg
9114b8e80941Smrg   const uint64_t v0 =
9115b8e80941Smrg      __gen_uint(values->PSInvocationCountReport, 0, 63);
9116b8e80941Smrg   dw[0] = v0;
9117b8e80941Smrg   dw[1] = v0 >> 32;
9118b8e80941Smrg}
9119b8e80941Smrg
9120b8e80941Smrg#define GEN8_RCS_RING_BUFFER_CTL_num      0x203c
9121b8e80941Smrg#define GEN8_RCS_RING_BUFFER_CTL_length        1
9122b8e80941Smrgstruct GEN8_RCS_RING_BUFFER_CTL {
9123b8e80941Smrg   bool                                 RingBufferEnable;
9124b8e80941Smrg   uint32_t                             AutomaticReportHeadPointer;
9125b8e80941Smrg#define MI_AUTOREPORT_OFF                        0
9126b8e80941Smrg#define MI_AUTOREPORT_64KB                       1
9127b8e80941Smrg#define MI_AUTOREPORT_4KB                        2
9128b8e80941Smrg#define MI_AUTOREPORT_128KB                      3
9129b8e80941Smrg   bool                                 SemaphoreWait;
9130b8e80941Smrg   bool                                 RBWait;
9131b8e80941Smrg   uint32_t                             BufferLengthinpages1;
9132b8e80941Smrg};
9133b8e80941Smrg
9134b8e80941Smrgstatic inline void
9135b8e80941SmrgGEN8_RCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
9136b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
9137b8e80941Smrg                              __attribute__((unused)) const struct GEN8_RCS_RING_BUFFER_CTL * restrict values)
9138b8e80941Smrg{
9139b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9140b8e80941Smrg
9141b8e80941Smrg   dw[0] =
9142b8e80941Smrg      __gen_uint(values->RingBufferEnable, 0, 0) |
9143b8e80941Smrg      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
9144b8e80941Smrg      __gen_uint(values->SemaphoreWait, 10, 10) |
9145b8e80941Smrg      __gen_uint(values->RBWait, 11, 11) |
9146b8e80941Smrg      __gen_uint(values->BufferLengthinpages1, 12, 20);
9147b8e80941Smrg}
9148b8e80941Smrg
9149b8e80941Smrg#define GEN8_ROW_INSTDONE_num             0xe164
9150b8e80941Smrg#define GEN8_ROW_INSTDONE_length               1
9151b8e80941Smrgstruct GEN8_ROW_INSTDONE {
9152b8e80941Smrg   bool                                 BCDone;
9153b8e80941Smrg   bool                                 PSDDone;
9154b8e80941Smrg   bool                                 DAPRDone;
9155b8e80941Smrg   bool                                 TDLDone;
9156b8e80941Smrg   bool                                 ICDone;
9157b8e80941Smrg   bool                                 MA0Done;
9158b8e80941Smrg   bool                                 EU00DoneSS0;
9159b8e80941Smrg   bool                                 EU01DoneSS0;
9160b8e80941Smrg   bool                                 EU02DoneSS0;
9161b8e80941Smrg   bool                                 EU03DoneSS0;
9162b8e80941Smrg   bool                                 EU10DoneSS0;
9163b8e80941Smrg   bool                                 EU11DoneSS0;
9164b8e80941Smrg   bool                                 EU12DoneSS0;
9165b8e80941Smrg   bool                                 EU13DoneSS0;
9166b8e80941Smrg   bool                                 MA1DoneSS0;
9167b8e80941Smrg};
9168b8e80941Smrg
9169b8e80941Smrgstatic inline void
9170b8e80941SmrgGEN8_ROW_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
9171b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
9172b8e80941Smrg                       __attribute__((unused)) const struct GEN8_ROW_INSTDONE * restrict values)
9173b8e80941Smrg{
9174b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9175b8e80941Smrg
9176b8e80941Smrg   dw[0] =
9177b8e80941Smrg      __gen_uint(values->BCDone, 0, 0) |
9178b8e80941Smrg      __gen_uint(values->PSDDone, 1, 1) |
9179b8e80941Smrg      __gen_uint(values->DAPRDone, 3, 3) |
9180b8e80941Smrg      __gen_uint(values->TDLDone, 6, 6) |
9181b8e80941Smrg      __gen_uint(values->ICDone, 12, 12) |
9182b8e80941Smrg      __gen_uint(values->MA0Done, 15, 15) |
9183b8e80941Smrg      __gen_uint(values->EU00DoneSS0, 16, 16) |
9184b8e80941Smrg      __gen_uint(values->EU01DoneSS0, 17, 17) |
9185b8e80941Smrg      __gen_uint(values->EU02DoneSS0, 18, 18) |
9186b8e80941Smrg      __gen_uint(values->EU03DoneSS0, 19, 19) |
9187b8e80941Smrg      __gen_uint(values->EU10DoneSS0, 21, 21) |
9188b8e80941Smrg      __gen_uint(values->EU11DoneSS0, 22, 22) |
9189b8e80941Smrg      __gen_uint(values->EU12DoneSS0, 23, 23) |
9190b8e80941Smrg      __gen_uint(values->EU13DoneSS0, 24, 24) |
9191b8e80941Smrg      __gen_uint(values->MA1DoneSS0, 26, 26);
9192b8e80941Smrg}
9193b8e80941Smrg
9194b8e80941Smrg#define GEN8_SAMPLER_INSTDONE_num         0xe160
9195b8e80941Smrg#define GEN8_SAMPLER_INSTDONE_length           1
9196b8e80941Smrgstruct GEN8_SAMPLER_INSTDONE {
9197b8e80941Smrg   bool                                 IMEDone;
9198b8e80941Smrg   bool                                 PL0Done;
9199b8e80941Smrg   bool                                 SO0Done;
9200b8e80941Smrg   bool                                 DG0Done;
9201b8e80941Smrg   bool                                 FT0Done;
9202b8e80941Smrg   bool                                 DM0Done;
9203b8e80941Smrg   bool                                 SCDone;
9204b8e80941Smrg   bool                                 FL0Done;
9205b8e80941Smrg   bool                                 QCDone;
9206b8e80941Smrg   bool                                 SVSMDone;
9207b8e80941Smrg   bool                                 SI0Done;
9208b8e80941Smrg   bool                                 MT0Done;
9209b8e80941Smrg   bool                                 AVSDone;
9210b8e80941Smrg   bool                                 IEFDone;
9211b8e80941Smrg   bool                                 CREDone;
9212b8e80941Smrg   bool                                 SVSMARB3;
9213b8e80941Smrg   bool                                 SVSMARB2;
9214b8e80941Smrg   bool                                 SVSMARB1;
9215b8e80941Smrg   bool                                 SVSMAdapter;
9216b8e80941Smrg   bool                                 BDMDone;
9217b8e80941Smrg};
9218b8e80941Smrg
9219b8e80941Smrgstatic inline void
9220b8e80941SmrgGEN8_SAMPLER_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
9221b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
9222b8e80941Smrg                           __attribute__((unused)) const struct GEN8_SAMPLER_INSTDONE * restrict values)
9223b8e80941Smrg{
9224b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9225b8e80941Smrg
9226b8e80941Smrg   dw[0] =
9227b8e80941Smrg      __gen_uint(values->IMEDone, 0, 0) |
9228b8e80941Smrg      __gen_uint(values->PL0Done, 1, 1) |
9229b8e80941Smrg      __gen_uint(values->SO0Done, 2, 2) |
9230b8e80941Smrg      __gen_uint(values->DG0Done, 3, 3) |
9231b8e80941Smrg      __gen_uint(values->FT0Done, 4, 4) |
9232b8e80941Smrg      __gen_uint(values->DM0Done, 5, 5) |
9233b8e80941Smrg      __gen_uint(values->SCDone, 6, 6) |
9234b8e80941Smrg      __gen_uint(values->FL0Done, 7, 7) |
9235b8e80941Smrg      __gen_uint(values->QCDone, 8, 8) |
9236b8e80941Smrg      __gen_uint(values->SVSMDone, 9, 9) |
9237b8e80941Smrg      __gen_uint(values->SI0Done, 10, 10) |
9238b8e80941Smrg      __gen_uint(values->MT0Done, 11, 11) |
9239b8e80941Smrg      __gen_uint(values->AVSDone, 12, 12) |
9240b8e80941Smrg      __gen_uint(values->IEFDone, 13, 13) |
9241b8e80941Smrg      __gen_uint(values->CREDone, 14, 14) |
9242b8e80941Smrg      __gen_uint(values->SVSMARB3, 15, 15) |
9243b8e80941Smrg      __gen_uint(values->SVSMARB2, 16, 16) |
9244b8e80941Smrg      __gen_uint(values->SVSMARB1, 17, 17) |
9245b8e80941Smrg      __gen_uint(values->SVSMAdapter, 18, 18) |
9246b8e80941Smrg      __gen_uint(values->BDMDone, 19, 19);
9247b8e80941Smrg}
9248b8e80941Smrg
9249b8e80941Smrg#define GEN8_SC_INSTDONE_num              0x7100
9250b8e80941Smrg#define GEN8_SC_INSTDONE_length                1
9251b8e80941Smrgstruct GEN8_SC_INSTDONE {
9252b8e80941Smrg   bool                                 SVLDone;
9253b8e80941Smrg   bool                                 WMFEDone;
9254b8e80941Smrg   bool                                 WMBEDone;
9255b8e80941Smrg   bool                                 HIZDone;
9256b8e80941Smrg   bool                                 STCDone;
9257b8e80941Smrg   bool                                 IZDone;
9258b8e80941Smrg   bool                                 SBEDone;
9259b8e80941Smrg   bool                                 RCZDone;
9260b8e80941Smrg   bool                                 RCCDone;
9261b8e80941Smrg   bool                                 RCPBEDone;
9262b8e80941Smrg   bool                                 RCPFEDone;
9263b8e80941Smrg   bool                                 DAPBDone;
9264b8e80941Smrg   bool                                 DAPRBEDone;
9265b8e80941Smrg   bool                                 SARBDone;
9266b8e80941Smrg   bool                                 DC0Done;
9267b8e80941Smrg   bool                                 DC1Done;
9268b8e80941Smrg   bool                                 DC2Done;
9269b8e80941Smrg   bool                                 GW0Done;
9270b8e80941Smrg   bool                                 GW1Done;
9271b8e80941Smrg   bool                                 GW2Done;
9272b8e80941Smrg   bool                                 TDCDone;
9273b8e80941Smrg};
9274b8e80941Smrg
9275b8e80941Smrgstatic inline void
9276b8e80941SmrgGEN8_SC_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
9277b8e80941Smrg                      __attribute__((unused)) void * restrict dst,
9278b8e80941Smrg                      __attribute__((unused)) const struct GEN8_SC_INSTDONE * restrict values)
9279b8e80941Smrg{
9280b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9281b8e80941Smrg
9282b8e80941Smrg   dw[0] =
9283b8e80941Smrg      __gen_uint(values->SVLDone, 0, 0) |
9284b8e80941Smrg      __gen_uint(values->WMFEDone, 1, 1) |
9285b8e80941Smrg      __gen_uint(values->WMBEDone, 2, 2) |
9286b8e80941Smrg      __gen_uint(values->HIZDone, 3, 3) |
9287b8e80941Smrg      __gen_uint(values->STCDone, 4, 4) |
9288b8e80941Smrg      __gen_uint(values->IZDone, 5, 5) |
9289b8e80941Smrg      __gen_uint(values->SBEDone, 6, 6) |
9290b8e80941Smrg      __gen_uint(values->RCZDone, 8, 8) |
9291b8e80941Smrg      __gen_uint(values->RCCDone, 9, 9) |
9292b8e80941Smrg      __gen_uint(values->RCPBEDone, 10, 10) |
9293b8e80941Smrg      __gen_uint(values->RCPFEDone, 11, 11) |
9294b8e80941Smrg      __gen_uint(values->DAPBDone, 12, 12) |
9295b8e80941Smrg      __gen_uint(values->DAPRBEDone, 13, 13) |
9296b8e80941Smrg      __gen_uint(values->SARBDone, 15, 15) |
9297b8e80941Smrg      __gen_uint(values->DC0Done, 16, 16) |
9298b8e80941Smrg      __gen_uint(values->DC1Done, 17, 17) |
9299b8e80941Smrg      __gen_uint(values->DC2Done, 18, 18) |
9300b8e80941Smrg      __gen_uint(values->GW0Done, 20, 20) |
9301b8e80941Smrg      __gen_uint(values->GW1Done, 21, 21) |
9302b8e80941Smrg      __gen_uint(values->GW2Done, 22, 22) |
9303b8e80941Smrg      __gen_uint(values->TDCDone, 24, 24);
9304b8e80941Smrg}
9305b8e80941Smrg
9306b8e80941Smrg#define GEN8_SO_NUM_PRIMS_WRITTEN0_num    0x5200
9307b8e80941Smrg#define GEN8_SO_NUM_PRIMS_WRITTEN0_length      2
9308b8e80941Smrgstruct GEN8_SO_NUM_PRIMS_WRITTEN0 {
9309b8e80941Smrg   uint64_t                             NumPrimsWrittenCount;
9310b8e80941Smrg};
9311b8e80941Smrg
9312b8e80941Smrgstatic inline void
9313b8e80941SmrgGEN8_SO_NUM_PRIMS_WRITTEN0_pack(__attribute__((unused)) __gen_user_data *data,
9314b8e80941Smrg                                __attribute__((unused)) void * restrict dst,
9315b8e80941Smrg                                __attribute__((unused)) const struct GEN8_SO_NUM_PRIMS_WRITTEN0 * restrict values)
9316b8e80941Smrg{
9317b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9318b8e80941Smrg
9319b8e80941Smrg   const uint64_t v0 =
9320b8e80941Smrg      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
9321b8e80941Smrg   dw[0] = v0;
9322b8e80941Smrg   dw[1] = v0 >> 32;
9323b8e80941Smrg}
9324b8e80941Smrg
9325b8e80941Smrg#define GEN8_SO_NUM_PRIMS_WRITTEN1_num    0x5208
9326b8e80941Smrg#define GEN8_SO_NUM_PRIMS_WRITTEN1_length      2
9327b8e80941Smrgstruct GEN8_SO_NUM_PRIMS_WRITTEN1 {
9328b8e80941Smrg   uint64_t                             NumPrimsWrittenCount;
9329b8e80941Smrg};
9330b8e80941Smrg
9331b8e80941Smrgstatic inline void
9332b8e80941SmrgGEN8_SO_NUM_PRIMS_WRITTEN1_pack(__attribute__((unused)) __gen_user_data *data,
9333b8e80941Smrg                                __attribute__((unused)) void * restrict dst,
9334b8e80941Smrg                                __attribute__((unused)) const struct GEN8_SO_NUM_PRIMS_WRITTEN1 * restrict values)
9335b8e80941Smrg{
9336b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9337b8e80941Smrg
9338b8e80941Smrg   const uint64_t v0 =
9339b8e80941Smrg      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
9340b8e80941Smrg   dw[0] = v0;
9341b8e80941Smrg   dw[1] = v0 >> 32;
9342b8e80941Smrg}
9343b8e80941Smrg
9344b8e80941Smrg#define GEN8_SO_NUM_PRIMS_WRITTEN2_num    0x5210
9345b8e80941Smrg#define GEN8_SO_NUM_PRIMS_WRITTEN2_length      2
9346b8e80941Smrgstruct GEN8_SO_NUM_PRIMS_WRITTEN2 {
9347b8e80941Smrg   uint64_t                             NumPrimsWrittenCount;
9348b8e80941Smrg};
9349b8e80941Smrg
9350b8e80941Smrgstatic inline void
9351b8e80941SmrgGEN8_SO_NUM_PRIMS_WRITTEN2_pack(__attribute__((unused)) __gen_user_data *data,
9352b8e80941Smrg                                __attribute__((unused)) void * restrict dst,
9353b8e80941Smrg                                __attribute__((unused)) const struct GEN8_SO_NUM_PRIMS_WRITTEN2 * restrict values)
9354b8e80941Smrg{
9355b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9356b8e80941Smrg
9357b8e80941Smrg   const uint64_t v0 =
9358b8e80941Smrg      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
9359b8e80941Smrg   dw[0] = v0;
9360b8e80941Smrg   dw[1] = v0 >> 32;
9361b8e80941Smrg}
9362b8e80941Smrg
9363b8e80941Smrg#define GEN8_SO_NUM_PRIMS_WRITTEN3_num    0x5218
9364b8e80941Smrg#define GEN8_SO_NUM_PRIMS_WRITTEN3_length      2
9365b8e80941Smrgstruct GEN8_SO_NUM_PRIMS_WRITTEN3 {
9366b8e80941Smrg   uint64_t                             NumPrimsWrittenCount;
9367b8e80941Smrg};
9368b8e80941Smrg
9369b8e80941Smrgstatic inline void
9370b8e80941SmrgGEN8_SO_NUM_PRIMS_WRITTEN3_pack(__attribute__((unused)) __gen_user_data *data,
9371b8e80941Smrg                                __attribute__((unused)) void * restrict dst,
9372b8e80941Smrg                                __attribute__((unused)) const struct GEN8_SO_NUM_PRIMS_WRITTEN3 * restrict values)
9373b8e80941Smrg{
9374b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9375b8e80941Smrg
9376b8e80941Smrg   const uint64_t v0 =
9377b8e80941Smrg      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
9378b8e80941Smrg   dw[0] = v0;
9379b8e80941Smrg   dw[1] = v0 >> 32;
9380b8e80941Smrg}
9381b8e80941Smrg
9382b8e80941Smrg#define GEN8_SO_PRIM_STORAGE_NEEDED0_num  0x5240
9383b8e80941Smrg#define GEN8_SO_PRIM_STORAGE_NEEDED0_length      2
9384b8e80941Smrgstruct GEN8_SO_PRIM_STORAGE_NEEDED0 {
9385b8e80941Smrg   uint64_t                             PrimStorageNeededCount;
9386b8e80941Smrg};
9387b8e80941Smrg
9388b8e80941Smrgstatic inline void
9389b8e80941SmrgGEN8_SO_PRIM_STORAGE_NEEDED0_pack(__attribute__((unused)) __gen_user_data *data,
9390b8e80941Smrg                                  __attribute__((unused)) void * restrict dst,
9391b8e80941Smrg                                  __attribute__((unused)) const struct GEN8_SO_PRIM_STORAGE_NEEDED0 * restrict values)
9392b8e80941Smrg{
9393b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9394b8e80941Smrg
9395b8e80941Smrg   const uint64_t v0 =
9396b8e80941Smrg      __gen_uint(values->PrimStorageNeededCount, 0, 63);
9397b8e80941Smrg   dw[0] = v0;
9398b8e80941Smrg   dw[1] = v0 >> 32;
9399b8e80941Smrg}
9400b8e80941Smrg
9401b8e80941Smrg#define GEN8_SO_PRIM_STORAGE_NEEDED1_num  0x5248
9402b8e80941Smrg#define GEN8_SO_PRIM_STORAGE_NEEDED1_length      2
9403b8e80941Smrgstruct GEN8_SO_PRIM_STORAGE_NEEDED1 {
9404b8e80941Smrg   uint64_t                             PrimStorageNeededCount;
9405b8e80941Smrg};
9406b8e80941Smrg
9407b8e80941Smrgstatic inline void
9408b8e80941SmrgGEN8_SO_PRIM_STORAGE_NEEDED1_pack(__attribute__((unused)) __gen_user_data *data,
9409b8e80941Smrg                                  __attribute__((unused)) void * restrict dst,
9410b8e80941Smrg                                  __attribute__((unused)) const struct GEN8_SO_PRIM_STORAGE_NEEDED1 * restrict values)
9411b8e80941Smrg{
9412b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9413b8e80941Smrg
9414b8e80941Smrg   const uint64_t v0 =
9415b8e80941Smrg      __gen_uint(values->PrimStorageNeededCount, 0, 63);
9416b8e80941Smrg   dw[0] = v0;
9417b8e80941Smrg   dw[1] = v0 >> 32;
9418b8e80941Smrg}
9419b8e80941Smrg
9420b8e80941Smrg#define GEN8_SO_PRIM_STORAGE_NEEDED2_num  0x5250
9421b8e80941Smrg#define GEN8_SO_PRIM_STORAGE_NEEDED2_length      2
9422b8e80941Smrgstruct GEN8_SO_PRIM_STORAGE_NEEDED2 {
9423b8e80941Smrg   uint64_t                             PrimStorageNeededCount;
9424b8e80941Smrg};
9425b8e80941Smrg
9426b8e80941Smrgstatic inline void
9427b8e80941SmrgGEN8_SO_PRIM_STORAGE_NEEDED2_pack(__attribute__((unused)) __gen_user_data *data,
9428b8e80941Smrg                                  __attribute__((unused)) void * restrict dst,
9429b8e80941Smrg                                  __attribute__((unused)) const struct GEN8_SO_PRIM_STORAGE_NEEDED2 * restrict values)
9430b8e80941Smrg{
9431b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9432b8e80941Smrg
9433b8e80941Smrg   const uint64_t v0 =
9434b8e80941Smrg      __gen_uint(values->PrimStorageNeededCount, 0, 63);
9435b8e80941Smrg   dw[0] = v0;
9436b8e80941Smrg   dw[1] = v0 >> 32;
9437b8e80941Smrg}
9438b8e80941Smrg
9439b8e80941Smrg#define GEN8_SO_PRIM_STORAGE_NEEDED3_num  0x5258
9440b8e80941Smrg#define GEN8_SO_PRIM_STORAGE_NEEDED3_length      2
9441b8e80941Smrgstruct GEN8_SO_PRIM_STORAGE_NEEDED3 {
9442b8e80941Smrg   uint64_t                             PrimStorageNeededCount;
9443b8e80941Smrg};
9444b8e80941Smrg
9445b8e80941Smrgstatic inline void
9446b8e80941SmrgGEN8_SO_PRIM_STORAGE_NEEDED3_pack(__attribute__((unused)) __gen_user_data *data,
9447b8e80941Smrg                                  __attribute__((unused)) void * restrict dst,
9448b8e80941Smrg                                  __attribute__((unused)) const struct GEN8_SO_PRIM_STORAGE_NEEDED3 * restrict values)
9449b8e80941Smrg{
9450b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9451b8e80941Smrg
9452b8e80941Smrg   const uint64_t v0 =
9453b8e80941Smrg      __gen_uint(values->PrimStorageNeededCount, 0, 63);
9454b8e80941Smrg   dw[0] = v0;
9455b8e80941Smrg   dw[1] = v0 >> 32;
9456b8e80941Smrg}
9457b8e80941Smrg
9458b8e80941Smrg#define GEN8_SO_WRITE_OFFSET0_num         0x5280
9459b8e80941Smrg#define GEN8_SO_WRITE_OFFSET0_length           1
9460b8e80941Smrgstruct GEN8_SO_WRITE_OFFSET0 {
9461b8e80941Smrg   uint64_t                             WriteOffset;
9462b8e80941Smrg};
9463b8e80941Smrg
9464b8e80941Smrgstatic inline void
9465b8e80941SmrgGEN8_SO_WRITE_OFFSET0_pack(__attribute__((unused)) __gen_user_data *data,
9466b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
9467b8e80941Smrg                           __attribute__((unused)) const struct GEN8_SO_WRITE_OFFSET0 * restrict values)
9468b8e80941Smrg{
9469b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9470b8e80941Smrg
9471b8e80941Smrg   dw[0] =
9472b8e80941Smrg      __gen_offset(values->WriteOffset, 2, 31);
9473b8e80941Smrg}
9474b8e80941Smrg
9475b8e80941Smrg#define GEN8_SO_WRITE_OFFSET1_num         0x5284
9476b8e80941Smrg#define GEN8_SO_WRITE_OFFSET1_length           1
9477b8e80941Smrgstruct GEN8_SO_WRITE_OFFSET1 {
9478b8e80941Smrg   uint64_t                             WriteOffset;
9479b8e80941Smrg};
9480b8e80941Smrg
9481b8e80941Smrgstatic inline void
9482b8e80941SmrgGEN8_SO_WRITE_OFFSET1_pack(__attribute__((unused)) __gen_user_data *data,
9483b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
9484b8e80941Smrg                           __attribute__((unused)) const struct GEN8_SO_WRITE_OFFSET1 * restrict values)
9485b8e80941Smrg{
9486b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9487b8e80941Smrg
9488b8e80941Smrg   dw[0] =
9489b8e80941Smrg      __gen_offset(values->WriteOffset, 2, 31);
9490b8e80941Smrg}
9491b8e80941Smrg
9492b8e80941Smrg#define GEN8_SO_WRITE_OFFSET2_num         0x5288
9493b8e80941Smrg#define GEN8_SO_WRITE_OFFSET2_length           1
9494b8e80941Smrgstruct GEN8_SO_WRITE_OFFSET2 {
9495b8e80941Smrg   uint64_t                             WriteOffset;
9496b8e80941Smrg};
9497b8e80941Smrg
9498b8e80941Smrgstatic inline void
9499b8e80941SmrgGEN8_SO_WRITE_OFFSET2_pack(__attribute__((unused)) __gen_user_data *data,
9500b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
9501b8e80941Smrg                           __attribute__((unused)) const struct GEN8_SO_WRITE_OFFSET2 * restrict values)
9502b8e80941Smrg{
9503b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9504b8e80941Smrg
9505b8e80941Smrg   dw[0] =
9506b8e80941Smrg      __gen_offset(values->WriteOffset, 2, 31);
9507b8e80941Smrg}
9508b8e80941Smrg
9509b8e80941Smrg#define GEN8_SO_WRITE_OFFSET3_num         0x528c
9510b8e80941Smrg#define GEN8_SO_WRITE_OFFSET3_length           1
9511b8e80941Smrgstruct GEN8_SO_WRITE_OFFSET3 {
9512b8e80941Smrg   uint64_t                             WriteOffset;
9513b8e80941Smrg};
9514b8e80941Smrg
9515b8e80941Smrgstatic inline void
9516b8e80941SmrgGEN8_SO_WRITE_OFFSET3_pack(__attribute__((unused)) __gen_user_data *data,
9517b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
9518b8e80941Smrg                           __attribute__((unused)) const struct GEN8_SO_WRITE_OFFSET3 * restrict values)
9519b8e80941Smrg{
9520b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9521b8e80941Smrg
9522b8e80941Smrg   dw[0] =
9523b8e80941Smrg      __gen_offset(values->WriteOffset, 2, 31);
9524b8e80941Smrg}
9525b8e80941Smrg
9526b8e80941Smrg#define GEN8_VCS2_RING_BUFFER_CTL_num     0x1203c
9527b8e80941Smrg#define GEN8_VCS2_RING_BUFFER_CTL_length       1
9528b8e80941Smrgstruct GEN8_VCS2_RING_BUFFER_CTL {
9529b8e80941Smrg   bool                                 RingBufferEnable;
9530b8e80941Smrg   uint32_t                             AutomaticReportHeadPointer;
9531b8e80941Smrg#define MI_AUTOREPORT_OFF                        0
9532b8e80941Smrg#define MI_AUTOREPORT_64KB                       1
9533b8e80941Smrg#define MI_AUTOREPORT_4KB                        2
9534b8e80941Smrg#define MI_AUTOREPORT_128KB                      3
9535b8e80941Smrg   bool                                 DisableRegisterAccesses;
9536b8e80941Smrg   bool                                 SemaphoreWait;
9537b8e80941Smrg   bool                                 RBWait;
9538b8e80941Smrg   uint32_t                             BufferLengthinpages1;
9539b8e80941Smrg};
9540b8e80941Smrg
9541b8e80941Smrgstatic inline void
9542b8e80941SmrgGEN8_VCS2_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
9543b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
9544b8e80941Smrg                               __attribute__((unused)) const struct GEN8_VCS2_RING_BUFFER_CTL * restrict values)
9545b8e80941Smrg{
9546b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9547b8e80941Smrg
9548b8e80941Smrg   dw[0] =
9549b8e80941Smrg      __gen_uint(values->RingBufferEnable, 0, 0) |
9550b8e80941Smrg      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
9551b8e80941Smrg      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
9552b8e80941Smrg      __gen_uint(values->SemaphoreWait, 10, 10) |
9553b8e80941Smrg      __gen_uint(values->RBWait, 11, 11) |
9554b8e80941Smrg      __gen_uint(values->BufferLengthinpages1, 12, 20);
9555b8e80941Smrg}
9556b8e80941Smrg
9557b8e80941Smrg#define GEN8_VCS_ACTHD_UDW_num            0x1205c
9558b8e80941Smrg#define GEN8_VCS_ACTHD_UDW_length              1
9559b8e80941Smrgstruct GEN8_VCS_ACTHD_UDW {
9560b8e80941Smrg   uint32_t                             HeadPointerUpperDWORD;
9561b8e80941Smrg};
9562b8e80941Smrg
9563b8e80941Smrgstatic inline void
9564b8e80941SmrgGEN8_VCS_ACTHD_UDW_pack(__attribute__((unused)) __gen_user_data *data,
9565b8e80941Smrg                        __attribute__((unused)) void * restrict dst,
9566b8e80941Smrg                        __attribute__((unused)) const struct GEN8_VCS_ACTHD_UDW * restrict values)
9567b8e80941Smrg{
9568b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9569b8e80941Smrg
9570b8e80941Smrg   dw[0] =
9571b8e80941Smrg      __gen_uint(values->HeadPointerUpperDWORD, 0, 15);
9572b8e80941Smrg}
9573b8e80941Smrg
9574b8e80941Smrg#define GEN8_VCS_INSTDONE_num             0x1206c
9575b8e80941Smrg#define GEN8_VCS_INSTDONE_length               1
9576b8e80941Smrgstruct GEN8_VCS_INSTDONE {
9577b8e80941Smrg   bool                                 RingEnable;
9578b8e80941Smrg   bool                                 USBDone;
9579b8e80941Smrg   bool                                 QRCDone;
9580b8e80941Smrg   bool                                 SECDone;
9581b8e80941Smrg   bool                                 MPCDone;
9582b8e80941Smrg   bool                                 VFTDone;
9583b8e80941Smrg   bool                                 BSPDone;
9584b8e80941Smrg   bool                                 VLFDone;
9585b8e80941Smrg   bool                                 VOPDone;
9586b8e80941Smrg   bool                                 VMCDone;
9587b8e80941Smrg   bool                                 VIPDone;
9588b8e80941Smrg   bool                                 VITDone;
9589b8e80941Smrg   bool                                 VDSDone;
9590b8e80941Smrg   bool                                 VMXDone;
9591b8e80941Smrg   bool                                 VCPDone;
9592b8e80941Smrg   bool                                 VCDDone;
9593b8e80941Smrg   bool                                 VADDone;
9594b8e80941Smrg   bool                                 VMDDone;
9595b8e80941Smrg   bool                                 VISDone;
9596b8e80941Smrg   bool                                 VACDone;
9597b8e80941Smrg   bool                                 VAMDone;
9598b8e80941Smrg   bool                                 JPGDone;
9599b8e80941Smrg   bool                                 VBPDone;
9600b8e80941Smrg   bool                                 VHRDone;
9601b8e80941Smrg   bool                                 VCIDone;
9602b8e80941Smrg   bool                                 VCRDone;
9603b8e80941Smrg   bool                                 VINDone;
9604b8e80941Smrg   bool                                 VPRDone;
9605b8e80941Smrg   bool                                 VTQDone;
9606b8e80941Smrg   bool                                 Reserved;
9607b8e80941Smrg   bool                                 VCSDone;
9608b8e80941Smrg   bool                                 GACDone;
9609b8e80941Smrg};
9610b8e80941Smrg
9611b8e80941Smrgstatic inline void
9612b8e80941SmrgGEN8_VCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
9613b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
9614b8e80941Smrg                       __attribute__((unused)) const struct GEN8_VCS_INSTDONE * restrict values)
9615b8e80941Smrg{
9616b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9617b8e80941Smrg
9618b8e80941Smrg   dw[0] =
9619b8e80941Smrg      __gen_uint(values->RingEnable, 0, 0) |
9620b8e80941Smrg      __gen_uint(values->USBDone, 1, 1) |
9621b8e80941Smrg      __gen_uint(values->QRCDone, 2, 2) |
9622b8e80941Smrg      __gen_uint(values->SECDone, 3, 3) |
9623b8e80941Smrg      __gen_uint(values->MPCDone, 4, 4) |
9624b8e80941Smrg      __gen_uint(values->VFTDone, 5, 5) |
9625b8e80941Smrg      __gen_uint(values->BSPDone, 6, 6) |
9626b8e80941Smrg      __gen_uint(values->VLFDone, 7, 7) |
9627b8e80941Smrg      __gen_uint(values->VOPDone, 8, 8) |
9628b8e80941Smrg      __gen_uint(values->VMCDone, 9, 9) |
9629b8e80941Smrg      __gen_uint(values->VIPDone, 10, 10) |
9630b8e80941Smrg      __gen_uint(values->VITDone, 11, 11) |
9631b8e80941Smrg      __gen_uint(values->VDSDone, 12, 12) |
9632b8e80941Smrg      __gen_uint(values->VMXDone, 13, 13) |
9633b8e80941Smrg      __gen_uint(values->VCPDone, 14, 14) |
9634b8e80941Smrg      __gen_uint(values->VCDDone, 15, 15) |
9635b8e80941Smrg      __gen_uint(values->VADDone, 16, 16) |
9636b8e80941Smrg      __gen_uint(values->VMDDone, 17, 17) |
9637b8e80941Smrg      __gen_uint(values->VISDone, 18, 18) |
9638b8e80941Smrg      __gen_uint(values->VACDone, 19, 19) |
9639b8e80941Smrg      __gen_uint(values->VAMDone, 20, 20) |
9640b8e80941Smrg      __gen_uint(values->JPGDone, 21, 21) |
9641b8e80941Smrg      __gen_uint(values->VBPDone, 22, 22) |
9642b8e80941Smrg      __gen_uint(values->VHRDone, 23, 23) |
9643b8e80941Smrg      __gen_uint(values->VCIDone, 24, 24) |
9644b8e80941Smrg      __gen_uint(values->VCRDone, 25, 25) |
9645b8e80941Smrg      __gen_uint(values->VINDone, 26, 26) |
9646b8e80941Smrg      __gen_uint(values->VPRDone, 27, 27) |
9647b8e80941Smrg      __gen_uint(values->VTQDone, 28, 28) |
9648b8e80941Smrg      __gen_uint(values->Reserved, 29, 29) |
9649b8e80941Smrg      __gen_uint(values->VCSDone, 30, 30) |
9650b8e80941Smrg      __gen_uint(values->GACDone, 31, 31);
9651b8e80941Smrg}
9652b8e80941Smrg
9653b8e80941Smrg#define GEN8_VCS_RING_BUFFER_CTL_num      0x1203c
9654b8e80941Smrg#define GEN8_VCS_RING_BUFFER_CTL_length        1
9655b8e80941Smrgstruct GEN8_VCS_RING_BUFFER_CTL {
9656b8e80941Smrg   bool                                 RingBufferEnable;
9657b8e80941Smrg   uint32_t                             AutomaticReportHeadPointer;
9658b8e80941Smrg#define MI_AUTOREPORT_OFF                        0
9659b8e80941Smrg#define MI_AUTOREPORT_64KB                       1
9660b8e80941Smrg#define MI_AUTOREPORT_4KB                        2
9661b8e80941Smrg#define MI_AUTOREPORT_128KB                      3
9662b8e80941Smrg   bool                                 DisableRegisterAccesses;
9663b8e80941Smrg   bool                                 SemaphoreWait;
9664b8e80941Smrg   bool                                 RBWait;
9665b8e80941Smrg   uint32_t                             BufferLengthinpages1;
9666b8e80941Smrg};
9667b8e80941Smrg
9668b8e80941Smrgstatic inline void
9669b8e80941SmrgGEN8_VCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
9670b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
9671b8e80941Smrg                              __attribute__((unused)) const struct GEN8_VCS_RING_BUFFER_CTL * restrict values)
9672b8e80941Smrg{
9673b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9674b8e80941Smrg
9675b8e80941Smrg   dw[0] =
9676b8e80941Smrg      __gen_uint(values->RingBufferEnable, 0, 0) |
9677b8e80941Smrg      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
9678b8e80941Smrg      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
9679b8e80941Smrg      __gen_uint(values->SemaphoreWait, 10, 10) |
9680b8e80941Smrg      __gen_uint(values->RBWait, 11, 11) |
9681b8e80941Smrg      __gen_uint(values->BufferLengthinpages1, 12, 20);
9682b8e80941Smrg}
9683b8e80941Smrg
9684b8e80941Smrg#define GEN8_VECS_ACTHD_UDW_num           0x1a05c
9685b8e80941Smrg#define GEN8_VECS_ACTHD_UDW_length             1
9686b8e80941Smrgstruct GEN8_VECS_ACTHD_UDW {
9687b8e80941Smrg   uint32_t                             HeadPointerUpperDWORD;
9688b8e80941Smrg};
9689b8e80941Smrg
9690b8e80941Smrgstatic inline void
9691b8e80941SmrgGEN8_VECS_ACTHD_UDW_pack(__attribute__((unused)) __gen_user_data *data,
9692b8e80941Smrg                         __attribute__((unused)) void * restrict dst,
9693b8e80941Smrg                         __attribute__((unused)) const struct GEN8_VECS_ACTHD_UDW * restrict values)
9694b8e80941Smrg{
9695b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9696b8e80941Smrg
9697b8e80941Smrg   dw[0] =
9698b8e80941Smrg      __gen_uint(values->HeadPointerUpperDWORD, 0, 15);
9699b8e80941Smrg}
9700b8e80941Smrg
9701b8e80941Smrg#define GEN8_VECS_INSTDONE_num            0x1a06c
9702b8e80941Smrg#define GEN8_VECS_INSTDONE_length              1
9703b8e80941Smrgstruct GEN8_VECS_INSTDONE {
9704b8e80941Smrg   bool                                 RingEnable;
9705b8e80941Smrg   bool                                 VECSDone;
9706b8e80941Smrg   bool                                 GAMDone;
9707b8e80941Smrg};
9708b8e80941Smrg
9709b8e80941Smrgstatic inline void
9710b8e80941SmrgGEN8_VECS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
9711b8e80941Smrg                        __attribute__((unused)) void * restrict dst,
9712b8e80941Smrg                        __attribute__((unused)) const struct GEN8_VECS_INSTDONE * restrict values)
9713b8e80941Smrg{
9714b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9715b8e80941Smrg
9716b8e80941Smrg   dw[0] =
9717b8e80941Smrg      __gen_uint(values->RingEnable, 0, 0) |
9718b8e80941Smrg      __gen_uint(values->VECSDone, 30, 30) |
9719b8e80941Smrg      __gen_uint(values->GAMDone, 31, 31);
9720b8e80941Smrg}
9721b8e80941Smrg
9722b8e80941Smrg#define GEN8_VECS_RING_BUFFER_CTL_num     0x1a03c
9723b8e80941Smrg#define GEN8_VECS_RING_BUFFER_CTL_length       1
9724b8e80941Smrgstruct GEN8_VECS_RING_BUFFER_CTL {
9725b8e80941Smrg   bool                                 RingBufferEnable;
9726b8e80941Smrg   uint32_t                             AutomaticReportHeadPointer;
9727b8e80941Smrg#define MI_AUTOREPORT_OFF                        0
9728b8e80941Smrg#define MI_AUTOREPORT_64KB                       1
9729b8e80941Smrg#define MI_AUTOREPORT_4KB                        2
9730b8e80941Smrg#define MI_AUTOREPORT_128KB                      3
9731b8e80941Smrg   bool                                 DisableRegisterAccesses;
9732b8e80941Smrg   bool                                 SemaphoreWait;
9733b8e80941Smrg   bool                                 RBWait;
9734b8e80941Smrg   uint32_t                             BufferLengthinpages1;
9735b8e80941Smrg};
9736b8e80941Smrg
9737b8e80941Smrgstatic inline void
9738b8e80941SmrgGEN8_VECS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
9739b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
9740b8e80941Smrg                               __attribute__((unused)) const struct GEN8_VECS_RING_BUFFER_CTL * restrict values)
9741b8e80941Smrg{
9742b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9743b8e80941Smrg
9744b8e80941Smrg   dw[0] =
9745b8e80941Smrg      __gen_uint(values->RingBufferEnable, 0, 0) |
9746b8e80941Smrg      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
9747b8e80941Smrg      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
9748b8e80941Smrg      __gen_uint(values->SemaphoreWait, 10, 10) |
9749b8e80941Smrg      __gen_uint(values->RBWait, 11, 11) |
9750b8e80941Smrg      __gen_uint(values->BufferLengthinpages1, 12, 20);
9751b8e80941Smrg}
9752b8e80941Smrg
9753b8e80941Smrg#define GEN8_VS_INVOCATION_COUNT_num      0x2320
9754b8e80941Smrg#define GEN8_VS_INVOCATION_COUNT_length        2
9755b8e80941Smrgstruct GEN8_VS_INVOCATION_COUNT {
9756b8e80941Smrg   uint64_t                             VSInvocationCountReport;
9757b8e80941Smrg};
9758b8e80941Smrg
9759b8e80941Smrgstatic inline void
9760b8e80941SmrgGEN8_VS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
9761b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
9762b8e80941Smrg                              __attribute__((unused)) const struct GEN8_VS_INVOCATION_COUNT * restrict values)
9763b8e80941Smrg{
9764b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
9765b8e80941Smrg
9766b8e80941Smrg   const uint64_t v0 =
9767b8e80941Smrg      __gen_uint(values->VSInvocationCountReport, 0, 63);
9768b8e80941Smrg   dw[0] = v0;
9769b8e80941Smrg   dw[1] = v0 >> 32;
9770b8e80941Smrg}
9771b8e80941Smrg
9772b8e80941Smrg#endif /* GEN8_PACK_H */
9773