1/*
2 * Copyright (C) 2016 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24
25/* Instructions, enums and structures for SKL.
26 *
27 * This file has been generated, do not hand edit.
28 */
29
30#ifndef GEN9_PACK_H
31#define GEN9_PACK_H
32
33#include <stdio.h>
34#include <stdint.h>
35#include <stdbool.h>
36#include <assert.h>
37#include <math.h>
38
39#ifndef __gen_validate_value
40#define __gen_validate_value(x)
41#endif
42
43#ifndef __gen_field_functions
44#define __gen_field_functions
45
46#ifdef NDEBUG
47#define NDEBUG_UNUSED __attribute__((unused))
48#else
49#define NDEBUG_UNUSED
50#endif
51
52union __gen_value {
53   float f;
54   uint32_t dw;
55};
56
57static inline uint64_t
58__gen_mbo(uint32_t start, uint32_t end)
59{
60   return (~0ull >> (64 - (end - start + 1))) << start;
61}
62
63static inline uint64_t
64__gen_uint(uint64_t v, uint32_t start, NDEBUG_UNUSED uint32_t end)
65{
66   __gen_validate_value(v);
67
68#ifndef NDEBUG
69   const int width = end - start + 1;
70   if (width < 64) {
71      const uint64_t max = (1ull << width) - 1;
72      assert(v <= max);
73   }
74#endif
75
76   return v << start;
77}
78
79static inline uint64_t
80__gen_sint(int64_t v, uint32_t start, uint32_t end)
81{
82   const int width = end - start + 1;
83
84   __gen_validate_value(v);
85
86#ifndef NDEBUG
87   if (width < 64) {
88      const int64_t max = (1ll << (width - 1)) - 1;
89      const int64_t min = -(1ll << (width - 1));
90      assert(min <= v && v <= max);
91   }
92#endif
93
94   const uint64_t mask = ~0ull >> (64 - width);
95
96   return (v & mask) << start;
97}
98
99static inline uint64_t
100__gen_offset(uint64_t v, NDEBUG_UNUSED uint32_t start, NDEBUG_UNUSED uint32_t end)
101{
102   __gen_validate_value(v);
103#ifndef NDEBUG
104   uint64_t mask = (~0ull >> (64 - (end - start + 1))) << start;
105
106   assert((v & ~mask) == 0);
107#endif
108
109   return v;
110}
111
112static inline uint32_t
113__gen_float(float v)
114{
115   __gen_validate_value(v);
116   return ((union __gen_value) { .f = (v) }).dw;
117}
118
119static inline uint64_t
120__gen_sfixed(float v, uint32_t start, uint32_t end, uint32_t fract_bits)
121{
122   __gen_validate_value(v);
123
124   const float factor = (1 << fract_bits);
125
126#ifndef NDEBUG
127   const float max = ((1 << (end - start)) - 1) / factor;
128   const float min = -(1 << (end - start)) / factor;
129   assert(min <= v && v <= max);
130#endif
131
132   const int64_t int_val = llroundf(v * factor);
133   const uint64_t mask = ~0ull >> (64 - (end - start + 1));
134
135   return (int_val & mask) << start;
136}
137
138static inline uint64_t
139__gen_ufixed(float v, uint32_t start, NDEBUG_UNUSED uint32_t end, uint32_t fract_bits)
140{
141   __gen_validate_value(v);
142
143   const float factor = (1 << fract_bits);
144
145#ifndef NDEBUG
146   const float max = ((1 << (end - start + 1)) - 1) / factor;
147   const float min = 0.0f;
148   assert(min <= v && v <= max);
149#endif
150
151   const uint64_t uint_val = llroundf(v * factor);
152
153   return uint_val << start;
154}
155
156#ifndef __gen_address_type
157#error #define __gen_address_type before including this file
158#endif
159
160#ifndef __gen_user_data
161#error #define __gen_combine_address before including this file
162#endif
163
164#undef NDEBUG_UNUSED
165
166#endif
167
168
169enum GEN9_3D_Color_Buffer_Blend_Factor {
170   BLENDFACTOR_ONE                      =      1,
171   BLENDFACTOR_SRC_COLOR                =      2,
172   BLENDFACTOR_SRC_ALPHA                =      3,
173   BLENDFACTOR_DST_ALPHA                =      4,
174   BLENDFACTOR_DST_COLOR                =      5,
175   BLENDFACTOR_SRC_ALPHA_SATURATE       =      6,
176   BLENDFACTOR_CONST_COLOR              =      7,
177   BLENDFACTOR_CONST_ALPHA              =      8,
178   BLENDFACTOR_SRC1_COLOR               =      9,
179   BLENDFACTOR_SRC1_ALPHA               =     10,
180   BLENDFACTOR_ZERO                     =     17,
181   BLENDFACTOR_INV_SRC_COLOR            =     18,
182   BLENDFACTOR_INV_SRC_ALPHA            =     19,
183   BLENDFACTOR_INV_DST_ALPHA            =     20,
184   BLENDFACTOR_INV_DST_COLOR            =     21,
185   BLENDFACTOR_INV_CONST_COLOR          =     23,
186   BLENDFACTOR_INV_CONST_ALPHA          =     24,
187   BLENDFACTOR_INV_SRC1_COLOR           =     25,
188   BLENDFACTOR_INV_SRC1_ALPHA           =     26,
189};
190
191enum GEN9_3D_Color_Buffer_Blend_Function {
192   BLENDFUNCTION_ADD                    =      0,
193   BLENDFUNCTION_SUBTRACT               =      1,
194   BLENDFUNCTION_REVERSE_SUBTRACT       =      2,
195   BLENDFUNCTION_MIN                    =      3,
196   BLENDFUNCTION_MAX                    =      4,
197};
198
199enum GEN9_3D_Compare_Function {
200   COMPAREFUNCTION_ALWAYS               =      0,
201   COMPAREFUNCTION_NEVER                =      1,
202   COMPAREFUNCTION_LESS                 =      2,
203   COMPAREFUNCTION_EQUAL                =      3,
204   COMPAREFUNCTION_LEQUAL               =      4,
205   COMPAREFUNCTION_GREATER              =      5,
206   COMPAREFUNCTION_NOTEQUAL             =      6,
207   COMPAREFUNCTION_GEQUAL               =      7,
208};
209
210enum GEN9_3D_Logic_Op_Function {
211   LOGICOP_CLEAR                        =      0,
212   LOGICOP_NOR                          =      1,
213   LOGICOP_AND_INVERTED                 =      2,
214   LOGICOP_COPY_INVERTED                =      3,
215   LOGICOP_AND_REVERSE                  =      4,
216   LOGICOP_INVERT                       =      5,
217   LOGICOP_XOR                          =      6,
218   LOGICOP_NAND                         =      7,
219   LOGICOP_AND                          =      8,
220   LOGICOP_EQUIV                        =      9,
221   LOGICOP_NOOP                         =     10,
222   LOGICOP_OR_INVERTED                  =     11,
223   LOGICOP_COPY                         =     12,
224   LOGICOP_OR_REVERSE                   =     13,
225   LOGICOP_OR                           =     14,
226   LOGICOP_SET                          =     15,
227};
228
229enum GEN9_3D_Prim_Topo_Type {
230   _3DPRIM_POINTLIST                    =      1,
231   _3DPRIM_LINELIST                     =      2,
232   _3DPRIM_LINESTRIP                    =      3,
233   _3DPRIM_TRILIST                      =      4,
234   _3DPRIM_TRISTRIP                     =      5,
235   _3DPRIM_TRIFAN                       =      6,
236   _3DPRIM_QUADLIST                     =      7,
237   _3DPRIM_QUADSTRIP                    =      8,
238   _3DPRIM_LINELIST_ADJ                 =      9,
239   _3DPRIM_LINESTRIP_ADJ                =     10,
240   _3DPRIM_TRILIST_ADJ                  =     11,
241   _3DPRIM_TRISTRIP_ADJ                 =     12,
242   _3DPRIM_TRISTRIP_REVERSE             =     13,
243   _3DPRIM_POLYGON                      =     14,
244   _3DPRIM_RECTLIST                     =     15,
245   _3DPRIM_LINELOOP                     =     16,
246   _3DPRIM_POINTLIST_BF                 =     17,
247   _3DPRIM_LINESTRIP_CONT               =     18,
248   _3DPRIM_LINESTRIP_BF                 =     19,
249   _3DPRIM_LINESTRIP_CONT_BF            =     20,
250   _3DPRIM_TRIFAN_NOSTIPPLE             =     22,
251   _3DPRIM_PATCHLIST_1                  =     32,
252   _3DPRIM_PATCHLIST_2                  =     33,
253   _3DPRIM_PATCHLIST_3                  =     34,
254   _3DPRIM_PATCHLIST_4                  =     35,
255   _3DPRIM_PATCHLIST_5                  =     36,
256   _3DPRIM_PATCHLIST_6                  =     37,
257   _3DPRIM_PATCHLIST_7                  =     38,
258   _3DPRIM_PATCHLIST_8                  =     39,
259   _3DPRIM_PATCHLIST_9                  =     40,
260   _3DPRIM_PATCHLIST_10                 =     41,
261   _3DPRIM_PATCHLIST_11                 =     42,
262   _3DPRIM_PATCHLIST_12                 =     43,
263   _3DPRIM_PATCHLIST_13                 =     44,
264   _3DPRIM_PATCHLIST_14                 =     45,
265   _3DPRIM_PATCHLIST_15                 =     46,
266   _3DPRIM_PATCHLIST_16                 =     47,
267   _3DPRIM_PATCHLIST_17                 =     48,
268   _3DPRIM_PATCHLIST_18                 =     49,
269   _3DPRIM_PATCHLIST_19                 =     50,
270   _3DPRIM_PATCHLIST_20                 =     51,
271   _3DPRIM_PATCHLIST_21                 =     52,
272   _3DPRIM_PATCHLIST_22                 =     53,
273   _3DPRIM_PATCHLIST_23                 =     54,
274   _3DPRIM_PATCHLIST_24                 =     55,
275   _3DPRIM_PATCHLIST_25                 =     56,
276   _3DPRIM_PATCHLIST_26                 =     57,
277   _3DPRIM_PATCHLIST_27                 =     58,
278   _3DPRIM_PATCHLIST_28                 =     59,
279   _3DPRIM_PATCHLIST_29                 =     60,
280   _3DPRIM_PATCHLIST_30                 =     61,
281   _3DPRIM_PATCHLIST_31                 =     62,
282   _3DPRIM_PATCHLIST_32                 =     63,
283};
284
285enum GEN9_3D_Stencil_Operation {
286   STENCILOP_KEEP                       =      0,
287   STENCILOP_ZERO                       =      1,
288   STENCILOP_REPLACE                    =      2,
289   STENCILOP_INCRSAT                    =      3,
290   STENCILOP_DECRSAT                    =      4,
291   STENCILOP_INCR                       =      5,
292   STENCILOP_DECR                       =      6,
293   STENCILOP_INVERT                     =      7,
294};
295
296enum GEN9_3D_Vertex_Component_Control {
297   VFCOMP_NOSTORE                       =      0,
298   VFCOMP_STORE_SRC                     =      1,
299   VFCOMP_STORE_0                       =      2,
300   VFCOMP_STORE_1_FP                    =      3,
301   VFCOMP_STORE_1_INT                   =      4,
302   VFCOMP_STORE_PID                     =      7,
303};
304
305enum GEN9_Atomic_OPCODE {
306   MI_ATOMIC_OP_AND                     =      1,
307   MI_ATOMIC_OP_OR                      =      2,
308   MI_ATOMIC_OP_XOR                     =      3,
309   MI_ATOMIC_OP_MOVE                    =      4,
310   MI_ATOMIC_OP_INC                     =      5,
311   MI_ATOMIC_OP_DEC                     =      6,
312   MI_ATOMIC_OP_ADD                     =      7,
313   MI_ATOMIC_OP_SUB                     =      8,
314   MI_ATOMIC_OP_RSUB                    =      9,
315   MI_ATOMIC_OP_IMAX                    =     10,
316   MI_ATOMIC_OP_IMIN                    =     11,
317   MI_ATOMIC_OP_UMAX                    =     12,
318   MI_ATOMIC_OP_UMIN                    =     13,
319   MI_ATOMIC_OP_CMP_WR                  =     14,
320   MI_ATOMIC_OP_PREDEC                  =     15,
321   MI_ATOMIC_OP_AND8B                   =     33,
322   MI_ATOMIC_OP_OR8B                    =     34,
323   MI_ATOMIC_OP_XOR8B                   =     35,
324   MI_ATOMIC_OP_MOVE8B                  =     36,
325   MI_ATOMIC_OP_INC8B                   =     37,
326   MI_ATOMIC_OP_DEC8B                   =     38,
327   MI_ATOMIC_OP_ADD8B                   =     39,
328   MI_ATOMIC_OP_SUB8B                   =     40,
329   MI_ATOMIC_OP_RSUB8B                  =     41,
330   MI_ATOMIC_OP_IMAX8B                  =     42,
331   MI_ATOMIC_OP_IMIN8B                  =     43,
332   MI_ATOMIC_OP_UMAX8B                  =     44,
333   MI_ATOMIC_OP_UMIN8B                  =     45,
334   MI_ATOMIC_OP_CMP_WR8B                =     46,
335   MI_ATOMIC_OP_PREDEC8B                =     47,
336   MI_ATOMIC_OP_CMP_WR16B               =     78,
337};
338
339enum GEN9_Attribute_Component_Format {
340   ACF_DISABLED                         =      0,
341   ACF_XY                               =      1,
342   ACF_XYZ                              =      2,
343   ACF_XYZW                             =      3,
344};
345
346enum GEN9_COMPONENT_ENABLES {
347   CE_NONE                              =      0,
348   CE_X                                 =      1,
349   CE_Y                                 =      2,
350   CE_XY                                =      3,
351   CE_Z                                 =      4,
352   CE_XZ                                =      5,
353   CE_YZ                                =      6,
354   CE_XYZ                               =      7,
355   CE_W                                 =      8,
356   CE_XW                                =      9,
357   CE_YW                                =     10,
358   CE_XYW                               =     11,
359   CE_ZW                                =     12,
360   CE_XZW                               =     13,
361   CE_YZW                               =     14,
362   CE_XYZW                              =     15,
363};
364
365enum GEN9_ShaderChannelSelect {
366   SCS_ZERO                             =      0,
367   SCS_ONE                              =      1,
368   SCS_RED                              =      4,
369   SCS_GREEN                            =      5,
370   SCS_BLUE                             =      6,
371   SCS_ALPHA                            =      7,
372};
373
374enum GEN9_TextureCoordinateMode {
375   TCM_WRAP                             =      0,
376   TCM_MIRROR                           =      1,
377   TCM_CLAMP                            =      2,
378   TCM_CUBE                             =      3,
379   TCM_CLAMP_BORDER                     =      4,
380   TCM_MIRROR_ONCE                      =      5,
381   TCM_HALF_BORDER                      =      6,
382};
383
384enum GEN9_WRAP_SHORTEST_ENABLE {
385   WSE_X                                =      1,
386   WSE_Y                                =      2,
387   WSE_XY                               =      3,
388   WSE_Z                                =      4,
389   WSE_XZ                               =      5,
390   WSE_YZ                               =      6,
391   WSE_XYZ                              =      7,
392   WSE_W                                =      8,
393   WSE_XW                               =      9,
394   WSE_YW                               =     10,
395   WSE_XYW                              =     11,
396   WSE_ZW                               =     12,
397   WSE_XZW                              =     13,
398   WSE_YZW                              =     14,
399   WSE_XYZW                             =     15,
400};
401
402#define GEN9_3DSTATE_CONSTANT_BODY_length     10
403struct GEN9_3DSTATE_CONSTANT_BODY {
404   uint32_t                             ReadLength[4];
405   __gen_address_type                   Buffer[4];
406};
407
408static inline void
409GEN9_3DSTATE_CONSTANT_BODY_pack(__attribute__((unused)) __gen_user_data *data,
410                                __attribute__((unused)) void * restrict dst,
411                                __attribute__((unused)) const struct GEN9_3DSTATE_CONSTANT_BODY * restrict values)
412{
413   uint32_t * restrict dw = (uint32_t * restrict) dst;
414
415   dw[0] =
416      __gen_uint(values->ReadLength[0], 0, 15) |
417      __gen_uint(values->ReadLength[1], 16, 31);
418
419   dw[1] =
420      __gen_uint(values->ReadLength[2], 0, 15) |
421      __gen_uint(values->ReadLength[3], 16, 31);
422
423   const uint64_t v2_address =
424      __gen_combine_address(data, &dw[2], values->Buffer[0], 0);
425   dw[2] = v2_address;
426   dw[3] = v2_address >> 32;
427
428   const uint64_t v4_address =
429      __gen_combine_address(data, &dw[4], values->Buffer[1], 0);
430   dw[4] = v4_address;
431   dw[5] = v4_address >> 32;
432
433   const uint64_t v6_address =
434      __gen_combine_address(data, &dw[6], values->Buffer[2], 0);
435   dw[6] = v6_address;
436   dw[7] = v6_address >> 32;
437
438   const uint64_t v8_address =
439      __gen_combine_address(data, &dw[8], values->Buffer[3], 0);
440   dw[8] = v8_address;
441   dw[9] = v8_address >> 32;
442}
443
444#define GEN9_BINDING_TABLE_EDIT_ENTRY_length      1
445struct GEN9_BINDING_TABLE_EDIT_ENTRY {
446   uint64_t                             SurfaceStatePointer;
447   uint32_t                             BindingTableIndex;
448};
449
450static inline void
451GEN9_BINDING_TABLE_EDIT_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
452                                   __attribute__((unused)) void * restrict dst,
453                                   __attribute__((unused)) const struct GEN9_BINDING_TABLE_EDIT_ENTRY * restrict values)
454{
455   uint32_t * restrict dw = (uint32_t * restrict) dst;
456
457   dw[0] =
458      __gen_offset(values->SurfaceStatePointer, 0, 15) |
459      __gen_uint(values->BindingTableIndex, 16, 23);
460}
461
462#define GEN9_BINDING_TABLE_STATE_length        1
463struct GEN9_BINDING_TABLE_STATE {
464   uint64_t                             SurfaceStatePointer;
465};
466
467static inline void
468GEN9_BINDING_TABLE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
469                              __attribute__((unused)) void * restrict dst,
470                              __attribute__((unused)) const struct GEN9_BINDING_TABLE_STATE * restrict values)
471{
472   uint32_t * restrict dw = (uint32_t * restrict) dst;
473
474   dw[0] =
475      __gen_offset(values->SurfaceStatePointer, 6, 31);
476}
477
478#define GEN9_BLEND_STATE_ENTRY_length          2
479struct GEN9_BLEND_STATE_ENTRY {
480   bool                                 WriteDisableBlue;
481   bool                                 WriteDisableGreen;
482   bool                                 WriteDisableRed;
483   bool                                 WriteDisableAlpha;
484   enum GEN9_3D_Color_Buffer_Blend_Function AlphaBlendFunction;
485   enum GEN9_3D_Color_Buffer_Blend_Factor DestinationAlphaBlendFactor;
486   enum GEN9_3D_Color_Buffer_Blend_Factor SourceAlphaBlendFactor;
487   enum GEN9_3D_Color_Buffer_Blend_Function ColorBlendFunction;
488   enum GEN9_3D_Color_Buffer_Blend_Factor DestinationBlendFactor;
489   enum GEN9_3D_Color_Buffer_Blend_Factor SourceBlendFactor;
490   bool                                 ColorBufferBlendEnable;
491   bool                                 PostBlendColorClampEnable;
492   bool                                 PreBlendColorClampEnable;
493   uint32_t                             ColorClampRange;
494#define COLORCLAMP_UNORM                         0
495#define COLORCLAMP_SNORM                         1
496#define COLORCLAMP_RTFORMAT                      2
497   bool                                 PreBlendSourceOnlyClampEnable;
498   enum GEN9_3D_Logic_Op_Function       LogicOpFunction;
499   bool                                 LogicOpEnable;
500};
501
502static inline void
503GEN9_BLEND_STATE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
504                            __attribute__((unused)) void * restrict dst,
505                            __attribute__((unused)) const struct GEN9_BLEND_STATE_ENTRY * restrict values)
506{
507   uint32_t * restrict dw = (uint32_t * restrict) dst;
508
509   dw[0] =
510      __gen_uint(values->WriteDisableBlue, 0, 0) |
511      __gen_uint(values->WriteDisableGreen, 1, 1) |
512      __gen_uint(values->WriteDisableRed, 2, 2) |
513      __gen_uint(values->WriteDisableAlpha, 3, 3) |
514      __gen_uint(values->AlphaBlendFunction, 5, 7) |
515      __gen_uint(values->DestinationAlphaBlendFactor, 8, 12) |
516      __gen_uint(values->SourceAlphaBlendFactor, 13, 17) |
517      __gen_uint(values->ColorBlendFunction, 18, 20) |
518      __gen_uint(values->DestinationBlendFactor, 21, 25) |
519      __gen_uint(values->SourceBlendFactor, 26, 30) |
520      __gen_uint(values->ColorBufferBlendEnable, 31, 31);
521
522   dw[1] =
523      __gen_uint(values->PostBlendColorClampEnable, 0, 0) |
524      __gen_uint(values->PreBlendColorClampEnable, 1, 1) |
525      __gen_uint(values->ColorClampRange, 2, 3) |
526      __gen_uint(values->PreBlendSourceOnlyClampEnable, 4, 4) |
527      __gen_uint(values->LogicOpFunction, 27, 30) |
528      __gen_uint(values->LogicOpEnable, 31, 31);
529}
530
531#define GEN9_BLEND_STATE_length                1
532struct GEN9_BLEND_STATE {
533   uint32_t                             YDitherOffset;
534   uint32_t                             XDitherOffset;
535   bool                                 ColorDitherEnable;
536   enum GEN9_3D_Compare_Function        AlphaTestFunction;
537   bool                                 AlphaTestEnable;
538   bool                                 AlphaToCoverageDitherEnable;
539   bool                                 AlphaToOneEnable;
540   bool                                 IndependentAlphaBlendEnable;
541   bool                                 AlphaToCoverageEnable;
542   /* variable length fields follow */
543};
544
545static inline void
546GEN9_BLEND_STATE_pack(__attribute__((unused)) __gen_user_data *data,
547                      __attribute__((unused)) void * restrict dst,
548                      __attribute__((unused)) const struct GEN9_BLEND_STATE * restrict values)
549{
550   uint32_t * restrict dw = (uint32_t * restrict) dst;
551
552   dw[0] =
553      __gen_uint(values->YDitherOffset, 19, 20) |
554      __gen_uint(values->XDitherOffset, 21, 22) |
555      __gen_uint(values->ColorDitherEnable, 23, 23) |
556      __gen_uint(values->AlphaTestFunction, 24, 26) |
557      __gen_uint(values->AlphaTestEnable, 27, 27) |
558      __gen_uint(values->AlphaToCoverageDitherEnable, 28, 28) |
559      __gen_uint(values->AlphaToOneEnable, 29, 29) |
560      __gen_uint(values->IndependentAlphaBlendEnable, 30, 30) |
561      __gen_uint(values->AlphaToCoverageEnable, 31, 31);
562}
563
564#define GEN9_CC_VIEWPORT_length                2
565struct GEN9_CC_VIEWPORT {
566   float                                MinimumDepth;
567   float                                MaximumDepth;
568};
569
570static inline void
571GEN9_CC_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
572                      __attribute__((unused)) void * restrict dst,
573                      __attribute__((unused)) const struct GEN9_CC_VIEWPORT * restrict values)
574{
575   uint32_t * restrict dw = (uint32_t * restrict) dst;
576
577   dw[0] =
578      __gen_float(values->MinimumDepth);
579
580   dw[1] =
581      __gen_float(values->MaximumDepth);
582}
583
584#define GEN9_COLOR_CALC_STATE_length           6
585struct GEN9_COLOR_CALC_STATE {
586   uint32_t                             AlphaTestFormat;
587#define ALPHATEST_UNORM8                         0
588#define ALPHATEST_FLOAT32                        1
589   bool                                 RoundDisableFunctionDisable;
590   uint32_t                             AlphaReferenceValueAsUNORM8;
591   float                                AlphaReferenceValueAsFLOAT32;
592   float                                BlendConstantColorRed;
593   float                                BlendConstantColorGreen;
594   float                                BlendConstantColorBlue;
595   float                                BlendConstantColorAlpha;
596};
597
598static inline void
599GEN9_COLOR_CALC_STATE_pack(__attribute__((unused)) __gen_user_data *data,
600                           __attribute__((unused)) void * restrict dst,
601                           __attribute__((unused)) const struct GEN9_COLOR_CALC_STATE * restrict values)
602{
603   uint32_t * restrict dw = (uint32_t * restrict) dst;
604
605   dw[0] =
606      __gen_uint(values->AlphaTestFormat, 0, 0) |
607      __gen_uint(values->RoundDisableFunctionDisable, 15, 15);
608
609   dw[1] =
610      __gen_uint(values->AlphaReferenceValueAsUNORM8, 0, 31) |
611      __gen_float(values->AlphaReferenceValueAsFLOAT32);
612
613   dw[2] =
614      __gen_float(values->BlendConstantColorRed);
615
616   dw[3] =
617      __gen_float(values->BlendConstantColorGreen);
618
619   dw[4] =
620      __gen_float(values->BlendConstantColorBlue);
621
622   dw[5] =
623      __gen_float(values->BlendConstantColorAlpha);
624}
625
626#define GEN9_EXECUTION_UNIT_EXTENDED_MESSAGE_DESCRIPTOR_length      1
627struct GEN9_EXECUTION_UNIT_EXTENDED_MESSAGE_DESCRIPTOR {
628   uint32_t                             TargetFunctionID;
629   uint32_t                             EndOfThread;
630#define NoTermination                            0
631#define EOT                                      1
632   uint32_t                             ExtendedMessageLength;
633};
634
635static inline void
636GEN9_EXECUTION_UNIT_EXTENDED_MESSAGE_DESCRIPTOR_pack(__attribute__((unused)) __gen_user_data *data,
637                                                     __attribute__((unused)) void * restrict dst,
638                                                     __attribute__((unused)) const struct GEN9_EXECUTION_UNIT_EXTENDED_MESSAGE_DESCRIPTOR * restrict values)
639{
640   uint32_t * restrict dw = (uint32_t * restrict) dst;
641
642   dw[0] =
643      __gen_uint(values->TargetFunctionID, 0, 3) |
644      __gen_uint(values->EndOfThread, 5, 5) |
645      __gen_uint(values->ExtendedMessageLength, 6, 9);
646}
647
648#define GEN9_FILTER_COEFFICIENT_length         1
649struct GEN9_FILTER_COEFFICIENT {
650   float                                FilterCoefficient;
651};
652
653static inline void
654GEN9_FILTER_COEFFICIENT_pack(__attribute__((unused)) __gen_user_data *data,
655                             __attribute__((unused)) void * restrict dst,
656                             __attribute__((unused)) const struct GEN9_FILTER_COEFFICIENT * restrict values)
657{
658   uint32_t * restrict dw = (uint32_t * restrict) dst;
659
660   dw[0] =
661      __gen_sfixed(values->FilterCoefficient, 0, 7, 6);
662}
663
664#define GEN9_FRAMEDELTAQP_length               2
665struct GEN9_FRAMEDELTAQP {
666   int32_t                              FrameDeltaQP[8];
667};
668
669static inline void
670GEN9_FRAMEDELTAQP_pack(__attribute__((unused)) __gen_user_data *data,
671                       __attribute__((unused)) void * restrict dst,
672                       __attribute__((unused)) const struct GEN9_FRAMEDELTAQP * restrict values)
673{
674   uint32_t * restrict dw = (uint32_t * restrict) dst;
675
676   dw[0] =
677      __gen_sint(values->FrameDeltaQP[0], 0, 7) |
678      __gen_sint(values->FrameDeltaQP[1], 8, 15) |
679      __gen_sint(values->FrameDeltaQP[2], 16, 23) |
680      __gen_sint(values->FrameDeltaQP[3], 24, 31);
681
682   dw[1] =
683      __gen_sint(values->FrameDeltaQP[4], 0, 7) |
684      __gen_sint(values->FrameDeltaQP[5], 8, 15) |
685      __gen_sint(values->FrameDeltaQP[6], 16, 23) |
686      __gen_sint(values->FrameDeltaQP[7], 24, 31);
687}
688
689#define GEN9_FRAMEDELTAQPRANGE_length          2
690struct GEN9_FRAMEDELTAQPRANGE {
691   uint32_t                             FrameDeltaQPRange[8];
692};
693
694static inline void
695GEN9_FRAMEDELTAQPRANGE_pack(__attribute__((unused)) __gen_user_data *data,
696                            __attribute__((unused)) void * restrict dst,
697                            __attribute__((unused)) const struct GEN9_FRAMEDELTAQPRANGE * restrict values)
698{
699   uint32_t * restrict dw = (uint32_t * restrict) dst;
700
701   dw[0] =
702      __gen_uint(values->FrameDeltaQPRange[0], 0, 7) |
703      __gen_uint(values->FrameDeltaQPRange[1], 8, 15) |
704      __gen_uint(values->FrameDeltaQPRange[2], 16, 23) |
705      __gen_uint(values->FrameDeltaQPRange[3], 24, 31);
706
707   dw[1] =
708      __gen_uint(values->FrameDeltaQPRange[4], 0, 7) |
709      __gen_uint(values->FrameDeltaQPRange[5], 8, 15) |
710      __gen_uint(values->FrameDeltaQPRange[6], 16, 23) |
711      __gen_uint(values->FrameDeltaQPRange[7], 24, 31);
712}
713
714#define GEN9_GATHER_CONSTANT_ENTRY_length      1
715struct GEN9_GATHER_CONSTANT_ENTRY {
716   uint32_t                             BindingTableIndexOffset;
717   uint32_t                             ChannelMask;
718   uint64_t                             ConstantBufferOffset;
719};
720
721static inline void
722GEN9_GATHER_CONSTANT_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
723                                __attribute__((unused)) void * restrict dst,
724                                __attribute__((unused)) const struct GEN9_GATHER_CONSTANT_ENTRY * restrict values)
725{
726   uint32_t * restrict dw = (uint32_t * restrict) dst;
727
728   dw[0] =
729      __gen_uint(values->BindingTableIndexOffset, 0, 3) |
730      __gen_uint(values->ChannelMask, 4, 7) |
731      __gen_offset(values->ConstantBufferOffset, 8, 15);
732}
733
734#define GEN9_MEMORYADDRESSATTRIBUTES_length      1
735struct GEN9_MEMORYADDRESSATTRIBUTES {
736   uint32_t                             MOCS;
737   uint32_t                             ArbitrationPriorityControl;
738#define Highestpriority                          0
739#define Secondhighestpriority                    1
740#define Thirdhighestpriority                     2
741#define Lowestpriority                           3
742   bool                                 MemoryCompressionEnable;
743   uint32_t                             RowStoreScratchBufferCacheSelect;
744#define LLC                                      0
745#define InternalMediaStorage                     1
746   uint32_t                             TiledResourceMode;
747#define TRMODE_NONE                              0
748#define TRMODE_TILEYF                            1
749#define TRMODE_TILEYS                            2
750};
751
752static inline void
753GEN9_MEMORYADDRESSATTRIBUTES_pack(__attribute__((unused)) __gen_user_data *data,
754                                  __attribute__((unused)) void * restrict dst,
755                                  __attribute__((unused)) const struct GEN9_MEMORYADDRESSATTRIBUTES * restrict values)
756{
757   uint32_t * restrict dw = (uint32_t * restrict) dst;
758
759   dw[0] =
760      __gen_uint(values->MOCS, 1, 6) |
761      __gen_uint(values->ArbitrationPriorityControl, 7, 8) |
762      __gen_uint(values->MemoryCompressionEnable, 9, 9) |
763      __gen_uint(values->RowStoreScratchBufferCacheSelect, 12, 12) |
764      __gen_uint(values->TiledResourceMode, 13, 14);
765}
766
767#define GEN9_HCP_PAK_INSERT_OBJECT_INDIRECT_PAYLOAD_length      4
768struct GEN9_HCP_PAK_INSERT_OBJECT_INDIRECT_PAYLOAD {
769   uint32_t                             IndirectPayloadDataSizeinbits;
770   __gen_address_type                   IndirectPayloadBaseAddress;
771   struct GEN9_MEMORYADDRESSATTRIBUTES  IndirectPayloadBaseAddress2;
772};
773
774static inline void
775GEN9_HCP_PAK_INSERT_OBJECT_INDIRECT_PAYLOAD_pack(__attribute__((unused)) __gen_user_data *data,
776                                                 __attribute__((unused)) void * restrict dst,
777                                                 __attribute__((unused)) const struct GEN9_HCP_PAK_INSERT_OBJECT_INDIRECT_PAYLOAD * restrict values)
778{
779   uint32_t * restrict dw = (uint32_t * restrict) dst;
780
781   dw[0] =
782      __gen_uint(values->IndirectPayloadDataSizeinbits, 0, 31);
783
784   const uint64_t v1_address =
785      __gen_combine_address(data, &dw[1], values->IndirectPayloadBaseAddress, 0);
786   dw[1] = v1_address;
787   dw[2] = v1_address >> 32;
788
789   GEN9_MEMORYADDRESSATTRIBUTES_pack(data, &dw[3], &values->IndirectPayloadBaseAddress2);
790}
791
792#define GEN9_HCP_REF_LIST_ENTRY_length         1
793struct GEN9_HCP_REF_LIST_ENTRY {
794   uint32_t                             ReferencePicturetbValue;
795   uint32_t                             ListEntry;
796   uint32_t                             ChromaWeightedPrediction;
797#define Default                                  0
798#define Explicit                                 1
799   uint32_t                             LumaWeightedPrediction;
800#define Default                                  0
801#define Explicit                                 1
802   bool                                 LongTermReference;
803   bool                                 FieldPic;
804   bool                                 TopField;
805};
806
807static inline void
808GEN9_HCP_REF_LIST_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
809                             __attribute__((unused)) void * restrict dst,
810                             __attribute__((unused)) const struct GEN9_HCP_REF_LIST_ENTRY * restrict values)
811{
812   uint32_t * restrict dw = (uint32_t * restrict) dst;
813
814   dw[0] =
815      __gen_uint(values->ReferencePicturetbValue, 0, 7) |
816      __gen_uint(values->ListEntry, 8, 10) |
817      __gen_uint(values->ChromaWeightedPrediction, 11, 11) |
818      __gen_uint(values->LumaWeightedPrediction, 12, 12) |
819      __gen_uint(values->LongTermReference, 13, 13) |
820      __gen_uint(values->FieldPic, 14, 14) |
821      __gen_uint(values->TopField, 15, 15);
822}
823
824#define GEN9_HCP_TILE_POSITION_IN_CTB_length      1
825struct GEN9_HCP_TILE_POSITION_IN_CTB {
826   uint32_t                             CtbPos0i;
827   uint32_t                             CtbPos1i;
828   uint32_t                             CtbPos2i;
829   uint32_t                             CtbPos3i;
830};
831
832static inline void
833GEN9_HCP_TILE_POSITION_IN_CTB_pack(__attribute__((unused)) __gen_user_data *data,
834                                   __attribute__((unused)) void * restrict dst,
835                                   __attribute__((unused)) const struct GEN9_HCP_TILE_POSITION_IN_CTB * restrict values)
836{
837   uint32_t * restrict dw = (uint32_t * restrict) dst;
838
839   dw[0] =
840      __gen_uint(values->CtbPos0i, 0, 7) |
841      __gen_uint(values->CtbPos1i, 8, 15) |
842      __gen_uint(values->CtbPos2i, 16, 23) |
843      __gen_uint(values->CtbPos3i, 24, 31);
844}
845
846#define GEN9_HCP_WEIGHTOFFSET_CHROMA_ENTRY_length      1
847struct GEN9_HCP_WEIGHTOFFSET_CHROMA_ENTRY {
848   int32_t                              DeltaChromaWeightLX0;
849   uint32_t                             ChromaOffsetLX0;
850   int32_t                              DeltaChromaWeightLX1;
851   uint32_t                             ChromaOffsetLX1;
852};
853
854static inline void
855GEN9_HCP_WEIGHTOFFSET_CHROMA_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
856                                        __attribute__((unused)) void * restrict dst,
857                                        __attribute__((unused)) const struct GEN9_HCP_WEIGHTOFFSET_CHROMA_ENTRY * restrict values)
858{
859   uint32_t * restrict dw = (uint32_t * restrict) dst;
860
861   dw[0] =
862      __gen_sint(values->DeltaChromaWeightLX0, 0, 7) |
863      __gen_uint(values->ChromaOffsetLX0, 8, 15) |
864      __gen_sint(values->DeltaChromaWeightLX1, 16, 23) |
865      __gen_uint(values->ChromaOffsetLX1, 24, 31);
866}
867
868#define GEN9_HCP_WEIGHTOFFSET_LUMA_ENTRY_length      1
869struct GEN9_HCP_WEIGHTOFFSET_LUMA_ENTRY {
870   int32_t                              DeltaLumaWeightLX;
871   uint32_t                             LumaOffsetLX;
872};
873
874static inline void
875GEN9_HCP_WEIGHTOFFSET_LUMA_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
876                                      __attribute__((unused)) void * restrict dst,
877                                      __attribute__((unused)) const struct GEN9_HCP_WEIGHTOFFSET_LUMA_ENTRY * restrict values)
878{
879   uint32_t * restrict dw = (uint32_t * restrict) dst;
880
881   dw[0] =
882      __gen_sint(values->DeltaLumaWeightLX, 0, 7) |
883      __gen_uint(values->LumaOffsetLX, 8, 15);
884}
885
886#define GEN9_HEVC_ARBITRATION_PRIORITY_length      1
887struct GEN9_HEVC_ARBITRATION_PRIORITY {
888   uint32_t                             Priority;
889#define Highestpriority                          0
890#define Secondhighestpriority                    1
891#define Thirdhighestpriority                     2
892#define Lowestpriority                           3
893};
894
895static inline void
896GEN9_HEVC_ARBITRATION_PRIORITY_pack(__attribute__((unused)) __gen_user_data *data,
897                                    __attribute__((unused)) void * restrict dst,
898                                    __attribute__((unused)) const struct GEN9_HEVC_ARBITRATION_PRIORITY * restrict values)
899{
900   uint32_t * restrict dw = (uint32_t * restrict) dst;
901
902   dw[0] =
903      __gen_uint(values->Priority, 0, 1);
904}
905
906#define GEN9_HEVC_VP9_RDOQ_LAMBDA_FIELDS_length      1
907struct GEN9_HEVC_VP9_RDOQ_LAMBDA_FIELDS {
908   uint32_t                             LambdaValue0;
909   uint32_t                             LambdaValue1;
910};
911
912static inline void
913GEN9_HEVC_VP9_RDOQ_LAMBDA_FIELDS_pack(__attribute__((unused)) __gen_user_data *data,
914                                      __attribute__((unused)) void * restrict dst,
915                                      __attribute__((unused)) const struct GEN9_HEVC_VP9_RDOQ_LAMBDA_FIELDS * restrict values)
916{
917   uint32_t * restrict dw = (uint32_t * restrict) dst;
918
919   dw[0] =
920      __gen_uint(values->LambdaValue0, 0, 15) |
921      __gen_uint(values->LambdaValue1, 16, 31);
922}
923
924#define GEN9_HUC_VIRTUAL_ADDR_REGION_length      3
925struct GEN9_HUC_VIRTUAL_ADDR_REGION {
926   __gen_address_type                   Address;
927   struct GEN9_MEMORYADDRESSATTRIBUTES  MemoryAddressAttributes;
928};
929
930static inline void
931GEN9_HUC_VIRTUAL_ADDR_REGION_pack(__attribute__((unused)) __gen_user_data *data,
932                                  __attribute__((unused)) void * restrict dst,
933                                  __attribute__((unused)) const struct GEN9_HUC_VIRTUAL_ADDR_REGION * restrict values)
934{
935   uint32_t * restrict dw = (uint32_t * restrict) dst;
936
937   const uint64_t v0_address =
938      __gen_combine_address(data, &dw[0], values->Address, 0);
939   dw[0] = v0_address;
940   dw[1] = v0_address >> 32;
941
942   GEN9_MEMORYADDRESSATTRIBUTES_pack(data, &dw[2], &values->MemoryAddressAttributes);
943}
944
945#define GEN9_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT_length      3
946struct GEN9_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT {
947   bool                                 MBErrorConcealmentPSliceWeightPredictionDisable;
948   bool                                 MBErrorConcealmentPSliceMotionVectorsOverrideDisable;
949   bool                                 MBErrorConcealmentBSpatialWeightPredictionDisable;
950   bool                                 MBErrorConcealmentBSpatialMotionVectorsOverrideDisable;
951   uint32_t                             MBErrorConcealmentBSpatialPredictionMode;
952   bool                                 MBHeaderErrorHandling;
953   bool                                 EntropyErrorHandling;
954   bool                                 MPRErrorHandling;
955   bool                                 BSDPrematureCompleteErrorHandling;
956   uint32_t                             ConcealmentPictureID;
957   bool                                 MBErrorConcealmentBTemporalWeightPredictionDisable;
958   bool                                 MBErrorConcealmentBTemporalMotionVectorsOverrideEnable;
959   uint32_t                             MBErrorConcealmentBTemporalPredictionMode;
960   uint32_t                             IntraPredMode4x48x8LumaErrorControl;
961   bool                                 InitCurrentMBNumber;
962   uint32_t                             ConcealmentMethod;
963   uint32_t                             FirstMBBitOffset;
964   bool                                 LastSlice;
965   bool                                 EmulationPreventionBytePresent;
966   bool                                 FixPrevMBSkipped;
967   uint32_t                             FirstMBByteOffsetofSliceDataorSliceHeader;
968   bool                                 IntraPredictionErrorControl;
969   bool                                 Intra8x84x4PredictionErrorConcealmentControl;
970   uint32_t                             BSliceTemporalInterConcealmentMode;
971   uint32_t                             BSliceSpatialInterConcealmentMode;
972   uint32_t                             BSliceInterDirectTypeConcealmentMode;
973   uint32_t                             BSliceConcealmentMode;
974#define IntraConcealment                         1
975#define InterConcealment                         0
976   uint32_t                             PSliceInterConcealmentMode;
977   uint32_t                             PSliceConcealmentMode;
978#define IntraConcealment                         1
979#define InterConcealment                         0
980   uint32_t                             ConcealmentReferencePictureFieldBit;
981   uint32_t                             ISliceConcealmentMode;
982#define IntraConcealment                         1
983#define InterConcealment                         0
984};
985
986static inline void
987GEN9_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
988                                                         __attribute__((unused)) void * restrict dst,
989                                                         __attribute__((unused)) const struct GEN9_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT * restrict values)
990{
991   uint32_t * restrict dw = (uint32_t * restrict) dst;
992
993   dw[0] =
994      __gen_uint(values->MBErrorConcealmentPSliceWeightPredictionDisable, 0, 0) |
995      __gen_uint(values->MBErrorConcealmentPSliceMotionVectorsOverrideDisable, 1, 1) |
996      __gen_uint(values->MBErrorConcealmentBSpatialWeightPredictionDisable, 3, 3) |
997      __gen_uint(values->MBErrorConcealmentBSpatialMotionVectorsOverrideDisable, 4, 4) |
998      __gen_uint(values->MBErrorConcealmentBSpatialPredictionMode, 6, 7) |
999      __gen_uint(values->MBHeaderErrorHandling, 8, 8) |
1000      __gen_uint(values->EntropyErrorHandling, 10, 10) |
1001      __gen_uint(values->MPRErrorHandling, 12, 12) |
1002      __gen_uint(values->BSDPrematureCompleteErrorHandling, 14, 14) |
1003      __gen_uint(values->ConcealmentPictureID, 16, 21) |
1004      __gen_uint(values->MBErrorConcealmentBTemporalWeightPredictionDisable, 24, 24) |
1005      __gen_uint(values->MBErrorConcealmentBTemporalMotionVectorsOverrideEnable, 25, 25) |
1006      __gen_uint(values->MBErrorConcealmentBTemporalPredictionMode, 27, 28) |
1007      __gen_uint(values->IntraPredMode4x48x8LumaErrorControl, 29, 29) |
1008      __gen_uint(values->InitCurrentMBNumber, 30, 30) |
1009      __gen_uint(values->ConcealmentMethod, 31, 31);
1010
1011   dw[1] =
1012      __gen_uint(values->FirstMBBitOffset, 0, 2) |
1013      __gen_uint(values->LastSlice, 3, 3) |
1014      __gen_uint(values->EmulationPreventionBytePresent, 4, 4) |
1015      __gen_uint(values->FixPrevMBSkipped, 7, 7) |
1016      __gen_uint(values->FirstMBByteOffsetofSliceDataorSliceHeader, 16, 31);
1017
1018   dw[2] =
1019      __gen_uint(values->IntraPredictionErrorControl, 0, 0) |
1020      __gen_uint(values->Intra8x84x4PredictionErrorConcealmentControl, 1, 1) |
1021      __gen_uint(values->BSliceTemporalInterConcealmentMode, 4, 6) |
1022      __gen_uint(values->BSliceSpatialInterConcealmentMode, 8, 10) |
1023      __gen_uint(values->BSliceInterDirectTypeConcealmentMode, 12, 13) |
1024      __gen_uint(values->BSliceConcealmentMode, 15, 15) |
1025      __gen_uint(values->PSliceInterConcealmentMode, 16, 18) |
1026      __gen_uint(values->PSliceConcealmentMode, 23, 23) |
1027      __gen_uint(values->ConcealmentReferencePictureFieldBit, 24, 29) |
1028      __gen_uint(values->ISliceConcealmentMode, 31, 31);
1029}
1030
1031#define GEN9_INTERFACE_DESCRIPTOR_DATA_length      8
1032struct GEN9_INTERFACE_DESCRIPTOR_DATA {
1033   uint64_t                             KernelStartPointer;
1034   bool                                 SoftwareExceptionEnable;
1035   bool                                 MaskStackExceptionEnable;
1036   bool                                 IllegalOpcodeExceptionEnable;
1037   uint32_t                             FloatingPointMode;
1038#define IEEE754                                  0
1039#define Alternate                                1
1040   uint32_t                             ThreadPriority;
1041#define NormalPriority                           0
1042#define HighPriority                             1
1043   bool                                 SingleProgramFlow;
1044   uint32_t                             DenormMode;
1045#define Ftz                                      0
1046#define SetByKernel                              1
1047   uint32_t                             SamplerCount;
1048#define Nosamplersused                           0
1049#define Between1and4samplersused                 1
1050#define Between5and8samplersused                 2
1051#define Between9and12samplersused                3
1052#define Between13and16samplersused               4
1053   uint64_t                             SamplerStatePointer;
1054   uint32_t                             BindingTableEntryCount;
1055   uint64_t                             BindingTablePointer;
1056   uint32_t                             ConstantURBEntryReadOffset;
1057   uint32_t                             ConstantURBEntryReadLength;
1058   uint32_t                             NumberofThreadsinGPGPUThreadGroup;
1059   bool                                 GlobalBarrierEnable;
1060   uint32_t                             SharedLocalMemorySize;
1061#define Encodes0K                                0
1062#define Encodes1K                                1
1063#define Encodes2K                                2
1064#define Encodes4K                                3
1065#define Encodes8K                                4
1066#define Encodes16K                               5
1067#define Encodes32K                               6
1068#define Encodes64K                               7
1069   bool                                 BarrierEnable;
1070   uint32_t                             RoundingMode;
1071#define RTNE                                     0
1072#define RU                                       1
1073#define RD                                       2
1074#define RTZ                                      3
1075   uint32_t                             CrossThreadConstantDataReadLength;
1076};
1077
1078static inline void
1079GEN9_INTERFACE_DESCRIPTOR_DATA_pack(__attribute__((unused)) __gen_user_data *data,
1080                                    __attribute__((unused)) void * restrict dst,
1081                                    __attribute__((unused)) const struct GEN9_INTERFACE_DESCRIPTOR_DATA * restrict values)
1082{
1083   uint32_t * restrict dw = (uint32_t * restrict) dst;
1084
1085   const uint64_t v0 =
1086      __gen_offset(values->KernelStartPointer, 6, 47);
1087   dw[0] = v0;
1088   dw[1] = v0 >> 32;
1089
1090   dw[2] =
1091      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
1092      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
1093      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
1094      __gen_uint(values->FloatingPointMode, 16, 16) |
1095      __gen_uint(values->ThreadPriority, 17, 17) |
1096      __gen_uint(values->SingleProgramFlow, 18, 18) |
1097      __gen_uint(values->DenormMode, 19, 19);
1098
1099   dw[3] =
1100      __gen_uint(values->SamplerCount, 2, 4) |
1101      __gen_offset(values->SamplerStatePointer, 5, 31);
1102
1103   dw[4] =
1104      __gen_uint(values->BindingTableEntryCount, 0, 4) |
1105      __gen_offset(values->BindingTablePointer, 5, 15);
1106
1107   dw[5] =
1108      __gen_uint(values->ConstantURBEntryReadOffset, 0, 15) |
1109      __gen_uint(values->ConstantURBEntryReadLength, 16, 31);
1110
1111   dw[6] =
1112      __gen_uint(values->NumberofThreadsinGPGPUThreadGroup, 0, 9) |
1113      __gen_uint(values->GlobalBarrierEnable, 15, 15) |
1114      __gen_uint(values->SharedLocalMemorySize, 16, 20) |
1115      __gen_uint(values->BarrierEnable, 21, 21) |
1116      __gen_uint(values->RoundingMode, 22, 23);
1117
1118   dw[7] =
1119      __gen_uint(values->CrossThreadConstantDataReadLength, 0, 7);
1120}
1121
1122#define GEN9_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION_length      2
1123struct GEN9_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION {
1124   uint32_t                             FirstMBBitOffset;
1125   bool                                 LastMB;
1126   bool                                 LastPicSlice;
1127   uint32_t                             SliceConcealmentType;
1128   uint32_t                             SliceConcealmentOverride;
1129   uint32_t                             MBCount;
1130   uint32_t                             SliceVerticalPosition;
1131   uint32_t                             SliceHorizontalPosition;
1132   uint32_t                             NextSliceHorizontalPosition;
1133   uint32_t                             NextSliceVerticalPosition;
1134   uint32_t                             QuantizerScaleCode;
1135};
1136
1137static inline void
1138GEN9_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION_pack(__attribute__((unused)) __gen_user_data *data,
1139                                                       __attribute__((unused)) void * restrict dst,
1140                                                       __attribute__((unused)) const struct GEN9_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION * restrict values)
1141{
1142   uint32_t * restrict dw = (uint32_t * restrict) dst;
1143
1144   dw[0] =
1145      __gen_uint(values->FirstMBBitOffset, 0, 2) |
1146      __gen_uint(values->LastMB, 3, 3) |
1147      __gen_uint(values->LastPicSlice, 5, 5) |
1148      __gen_uint(values->SliceConcealmentType, 6, 6) |
1149      __gen_uint(values->SliceConcealmentOverride, 7, 7) |
1150      __gen_uint(values->MBCount, 8, 15) |
1151      __gen_uint(values->SliceVerticalPosition, 16, 23) |
1152      __gen_uint(values->SliceHorizontalPosition, 24, 31);
1153
1154   dw[1] =
1155      __gen_uint(values->NextSliceHorizontalPosition, 0, 7) |
1156      __gen_uint(values->NextSliceVerticalPosition, 8, 16) |
1157      __gen_uint(values->QuantizerScaleCode, 24, 28);
1158}
1159
1160#define GEN9_MI_MATH_ALU_INSTRUCTION_length      1
1161struct GEN9_MI_MATH_ALU_INSTRUCTION {
1162   uint32_t                             Operand2;
1163#define MI_ALU_REG0                              0
1164#define MI_ALU_REG1                              1
1165#define MI_ALU_REG2                              2
1166#define MI_ALU_REG3                              3
1167#define MI_ALU_REG4                              4
1168#define MI_ALU_REG5                              5
1169#define MI_ALU_REG6                              6
1170#define MI_ALU_REG7                              7
1171#define MI_ALU_REG8                              8
1172#define MI_ALU_REG9                              9
1173#define MI_ALU_REG10                             10
1174#define MI_ALU_REG11                             11
1175#define MI_ALU_REG12                             12
1176#define MI_ALU_REG13                             13
1177#define MI_ALU_REG14                             14
1178#define MI_ALU_REG15                             15
1179#define MI_ALU_SRCA                              32
1180#define MI_ALU_SRCB                              33
1181#define MI_ALU_ACCU                              49
1182#define MI_ALU_ZF                                50
1183#define MI_ALU_CF                                51
1184   uint32_t                             Operand1;
1185#define MI_ALU_REG0                              0
1186#define MI_ALU_REG1                              1
1187#define MI_ALU_REG2                              2
1188#define MI_ALU_REG3                              3
1189#define MI_ALU_REG4                              4
1190#define MI_ALU_REG5                              5
1191#define MI_ALU_REG6                              6
1192#define MI_ALU_REG7                              7
1193#define MI_ALU_REG8                              8
1194#define MI_ALU_REG9                              9
1195#define MI_ALU_REG10                             10
1196#define MI_ALU_REG11                             11
1197#define MI_ALU_REG12                             12
1198#define MI_ALU_REG13                             13
1199#define MI_ALU_REG14                             14
1200#define MI_ALU_REG15                             15
1201#define MI_ALU_SRCA                              32
1202#define MI_ALU_SRCB                              33
1203#define MI_ALU_ACCU                              49
1204#define MI_ALU_ZF                                50
1205#define MI_ALU_CF                                51
1206   uint32_t                             ALUOpcode;
1207#define MI_ALU_NOOP                              0
1208#define MI_ALU_LOAD                              128
1209#define MI_ALU_LOADINV                           1152
1210#define MI_ALU_LOAD0                             129
1211#define MI_ALU_LOAD1                             1153
1212#define MI_ALU_ADD                               256
1213#define MI_ALU_SUB                               257
1214#define MI_ALU_AND                               258
1215#define MI_ALU_OR                                259
1216#define MI_ALU_XOR                               260
1217#define MI_ALU_STORE                             384
1218#define MI_ALU_STOREINV                          1408
1219};
1220
1221static inline void
1222GEN9_MI_MATH_ALU_INSTRUCTION_pack(__attribute__((unused)) __gen_user_data *data,
1223                                  __attribute__((unused)) void * restrict dst,
1224                                  __attribute__((unused)) const struct GEN9_MI_MATH_ALU_INSTRUCTION * restrict values)
1225{
1226   uint32_t * restrict dw = (uint32_t * restrict) dst;
1227
1228   dw[0] =
1229      __gen_uint(values->Operand2, 0, 9) |
1230      __gen_uint(values->Operand1, 10, 19) |
1231      __gen_uint(values->ALUOpcode, 20, 31);
1232}
1233
1234#define GEN9_PALETTE_ENTRY_length              1
1235struct GEN9_PALETTE_ENTRY {
1236   uint32_t                             Blue;
1237   uint32_t                             Green;
1238   uint32_t                             Red;
1239   uint32_t                             Alpha;
1240};
1241
1242static inline void
1243GEN9_PALETTE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
1244                        __attribute__((unused)) void * restrict dst,
1245                        __attribute__((unused)) const struct GEN9_PALETTE_ENTRY * restrict values)
1246{
1247   uint32_t * restrict dw = (uint32_t * restrict) dst;
1248
1249   dw[0] =
1250      __gen_uint(values->Blue, 0, 7) |
1251      __gen_uint(values->Green, 8, 15) |
1252      __gen_uint(values->Red, 16, 23) |
1253      __gen_uint(values->Alpha, 24, 31);
1254}
1255
1256#define GEN9_RENDER_SURFACE_STATE_length      16
1257struct GEN9_RENDER_SURFACE_STATE {
1258   bool                                 CubeFaceEnablePositiveZ;
1259   bool                                 CubeFaceEnableNegativeZ;
1260   bool                                 CubeFaceEnablePositiveY;
1261   bool                                 CubeFaceEnableNegativeY;
1262   bool                                 CubeFaceEnablePositiveX;
1263   bool                                 CubeFaceEnableNegativeX;
1264   uint32_t                             MediaBoundaryPixelMode;
1265#define NORMAL_MODE                              0
1266#define PROGRESSIVE_FRAME                        2
1267#define INTERLACED_FRAME                         3
1268   uint32_t                             RenderCacheReadWriteMode;
1269#define WriteOnlyCache                           0
1270#define ReadWriteCache                           1
1271   bool                                 SamplerL2BypassModeDisable;
1272   uint32_t                             VerticalLineStrideOffset;
1273   uint32_t                             VerticalLineStride;
1274   uint32_t                             TileMode;
1275#define LINEAR                                   0
1276#define WMAJOR                                   1
1277#define XMAJOR                                   2
1278#define YMAJOR                                   3
1279   uint32_t                             SurfaceHorizontalAlignment;
1280#define HALIGN4                                  1
1281#define HALIGN8                                  2
1282#define HALIGN16                                 3
1283   uint32_t                             SurfaceVerticalAlignment;
1284#define VALIGN4                                  1
1285#define VALIGN8                                  2
1286#define VALIGN16                                 3
1287   uint32_t                             SurfaceFormat;
1288   bool                                 SurfaceArray;
1289   uint32_t                             SurfaceType;
1290#define SURFTYPE_1D                              0
1291#define SURFTYPE_2D                              1
1292#define SURFTYPE_3D                              2
1293#define SURFTYPE_CUBE                            3
1294#define SURFTYPE_BUFFER                          4
1295#define SURFTYPE_STRBUF                          5
1296#define SURFTYPE_NULL                            7
1297   uint32_t                             SurfaceQPitch;
1298   float                                BaseMipLevel;
1299   uint32_t                             MOCS;
1300   uint32_t                             Width;
1301   uint32_t                             Height;
1302   uint32_t                             SurfacePitch;
1303   uint32_t                             Depth;
1304   uint32_t                             MultisamplePositionPaletteIndex;
1305   uint32_t                             NumberofMultisamples;
1306#define MULTISAMPLECOUNT_1                       0
1307#define MULTISAMPLECOUNT_2                       1
1308#define MULTISAMPLECOUNT_4                       2
1309#define MULTISAMPLECOUNT_8                       3
1310#define MULTISAMPLECOUNT_16                      4
1311   uint32_t                             MultisampledSurfaceStorageFormat;
1312#define MSFMT_MSS                                0
1313#define MSFMT_DEPTH_STENCIL                      1
1314   uint32_t                             RenderTargetViewExtent;
1315   uint32_t                             MinimumArrayElement;
1316   uint32_t                             RenderTargetAndSampleUnormRotation;
1317#define _0DEG                                    0
1318#define _90DEG                                   1
1319#define _180DEG                                  2
1320#define _270DEG                                  3
1321   uint32_t                             MIPCountLOD;
1322   uint32_t                             SurfaceMinLOD;
1323   uint32_t                             MipTailStartLOD;
1324   uint32_t                             CoherencyType;
1325#define GPUcoherent                              0
1326#define IAcoherent                               1
1327   uint32_t                             TiledResourceMode;
1328#define NONE                                     0
1329#define _4KB                                     1
1330#define _64KB                                    2
1331#define TILEYF                                   1
1332#define TILEYS                                   2
1333   bool                                 EWADisableForCube;
1334   uint32_t                             YOffset;
1335   uint32_t                             XOffset;
1336   uint32_t                             AuxiliarySurfaceMode;
1337#define AUX_NONE                                 0
1338#define AUX_CCS_D                                1
1339#define AUX_APPEND                               2
1340#define AUX_HIZ                                  3
1341#define AUX_CCS_E                                5
1342   uint32_t                             YOffsetforUorUVPlane;
1343   uint32_t                             AuxiliarySurfacePitch;
1344   uint32_t                             AuxiliarySurfaceQPitch;
1345   uint32_t                             XOffsetforUorUVPlane;
1346   bool                                 SeparateUVPlaneEnable;
1347   float                                ResourceMinLOD;
1348   enum GEN9_ShaderChannelSelect        ShaderChannelSelectAlpha;
1349   enum GEN9_ShaderChannelSelect        ShaderChannelSelectBlue;
1350   enum GEN9_ShaderChannelSelect        ShaderChannelSelectGreen;
1351   enum GEN9_ShaderChannelSelect        ShaderChannelSelectRed;
1352   bool                                 MemoryCompressionEnable;
1353   uint32_t                             MemoryCompressionMode;
1354#define Horizontal                               0
1355#define Vertical                                 1
1356   __gen_address_type                   SurfaceBaseAddress;
1357   uint32_t                             QuiltWidth;
1358   uint32_t                             QuiltHeight;
1359   __gen_address_type                   AuxiliarySurfaceBaseAddress;
1360   uint32_t                             AuxiliaryTableIndexforMediaCompressedSurface;
1361   uint32_t                             YOffsetforVPlane;
1362   uint32_t                             XOffsetforVPlane;
1363   float                                HierarchicalDepthClearValue;
1364   int32_t                              RedClearColor;
1365   int32_t                              GreenClearColor;
1366   int32_t                              BlueClearColor;
1367   int32_t                              AlphaClearColor;
1368};
1369
1370static inline void
1371GEN9_RENDER_SURFACE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
1372                               __attribute__((unused)) void * restrict dst,
1373                               __attribute__((unused)) const struct GEN9_RENDER_SURFACE_STATE * restrict values)
1374{
1375   uint32_t * restrict dw = (uint32_t * restrict) dst;
1376
1377   dw[0] =
1378      __gen_uint(values->CubeFaceEnablePositiveZ, 0, 0) |
1379      __gen_uint(values->CubeFaceEnableNegativeZ, 1, 1) |
1380      __gen_uint(values->CubeFaceEnablePositiveY, 2, 2) |
1381      __gen_uint(values->CubeFaceEnableNegativeY, 3, 3) |
1382      __gen_uint(values->CubeFaceEnablePositiveX, 4, 4) |
1383      __gen_uint(values->CubeFaceEnableNegativeX, 5, 5) |
1384      __gen_uint(values->MediaBoundaryPixelMode, 6, 7) |
1385      __gen_uint(values->RenderCacheReadWriteMode, 8, 8) |
1386      __gen_uint(values->SamplerL2BypassModeDisable, 9, 9) |
1387      __gen_uint(values->VerticalLineStrideOffset, 10, 10) |
1388      __gen_uint(values->VerticalLineStride, 11, 11) |
1389      __gen_uint(values->TileMode, 12, 13) |
1390      __gen_uint(values->SurfaceHorizontalAlignment, 14, 15) |
1391      __gen_uint(values->SurfaceVerticalAlignment, 16, 17) |
1392      __gen_uint(values->SurfaceFormat, 18, 27) |
1393      __gen_uint(values->SurfaceArray, 28, 28) |
1394      __gen_uint(values->SurfaceType, 29, 31);
1395
1396   dw[1] =
1397      __gen_uint(values->SurfaceQPitch, 0, 14) |
1398      __gen_ufixed(values->BaseMipLevel, 19, 23, 1) |
1399      __gen_uint(values->MOCS, 24, 30);
1400
1401   dw[2] =
1402      __gen_uint(values->Width, 0, 13) |
1403      __gen_uint(values->Height, 16, 29);
1404
1405   dw[3] =
1406      __gen_uint(values->SurfacePitch, 0, 17) |
1407      __gen_uint(values->Depth, 21, 31);
1408
1409   dw[4] =
1410      __gen_uint(values->MultisamplePositionPaletteIndex, 0, 2) |
1411      __gen_uint(values->NumberofMultisamples, 3, 5) |
1412      __gen_uint(values->MultisampledSurfaceStorageFormat, 6, 6) |
1413      __gen_uint(values->RenderTargetViewExtent, 7, 17) |
1414      __gen_uint(values->MinimumArrayElement, 18, 28) |
1415      __gen_uint(values->RenderTargetAndSampleUnormRotation, 29, 30);
1416
1417   dw[5] =
1418      __gen_uint(values->MIPCountLOD, 0, 3) |
1419      __gen_uint(values->SurfaceMinLOD, 4, 7) |
1420      __gen_uint(values->MipTailStartLOD, 8, 11) |
1421      __gen_uint(values->CoherencyType, 14, 14) |
1422      __gen_uint(values->TiledResourceMode, 18, 19) |
1423      __gen_uint(values->EWADisableForCube, 20, 20) |
1424      __gen_uint(values->YOffset, 21, 23) |
1425      __gen_uint(values->XOffset, 25, 31);
1426
1427   dw[6] =
1428      __gen_uint(values->AuxiliarySurfaceMode, 0, 2) |
1429      __gen_uint(values->YOffsetforUorUVPlane, 0, 13) |
1430      __gen_uint(values->AuxiliarySurfacePitch, 3, 11) |
1431      __gen_uint(values->AuxiliarySurfaceQPitch, 16, 30) |
1432      __gen_uint(values->XOffsetforUorUVPlane, 16, 29) |
1433      __gen_uint(values->SeparateUVPlaneEnable, 31, 31);
1434
1435   dw[7] =
1436      __gen_ufixed(values->ResourceMinLOD, 0, 11, 8) |
1437      __gen_uint(values->ShaderChannelSelectAlpha, 16, 18) |
1438      __gen_uint(values->ShaderChannelSelectBlue, 19, 21) |
1439      __gen_uint(values->ShaderChannelSelectGreen, 22, 24) |
1440      __gen_uint(values->ShaderChannelSelectRed, 25, 27) |
1441      __gen_uint(values->MemoryCompressionEnable, 30, 30) |
1442      __gen_uint(values->MemoryCompressionMode, 31, 31);
1443
1444   const uint64_t v8_address =
1445      __gen_combine_address(data, &dw[8], values->SurfaceBaseAddress, 0);
1446   dw[8] = v8_address;
1447   dw[9] = v8_address >> 32;
1448
1449   const uint64_t v10 =
1450      __gen_uint(values->QuiltWidth, 0, 4) |
1451      __gen_uint(values->QuiltHeight, 5, 9) |
1452      __gen_uint(values->AuxiliaryTableIndexforMediaCompressedSurface, 21, 31) |
1453      __gen_uint(values->YOffsetforVPlane, 32, 45) |
1454      __gen_uint(values->XOffsetforVPlane, 48, 61);
1455   const uint64_t v10_address =
1456      __gen_combine_address(data, &dw[10], values->AuxiliarySurfaceBaseAddress, v10);
1457   dw[10] = v10_address;
1458   dw[11] = (v10_address >> 32) | (v10 >> 32);
1459
1460   dw[12] =
1461      __gen_float(values->HierarchicalDepthClearValue) |
1462      __gen_sint(values->RedClearColor, 0, 31);
1463
1464   dw[13] =
1465      __gen_sint(values->GreenClearColor, 0, 31);
1466
1467   dw[14] =
1468      __gen_sint(values->BlueClearColor, 0, 31);
1469
1470   dw[15] =
1471      __gen_sint(values->AlphaClearColor, 0, 31);
1472}
1473
1474#define GEN9_ROUNDINGPRECISIONTABLE_3_BITS_length      1
1475struct GEN9_ROUNDINGPRECISIONTABLE_3_BITS {
1476   uint32_t                             RoundingPrecision;
1477#define _116                                     0
1478#define _216                                     1
1479#define _316                                     2
1480#define _416                                     3
1481#define _516                                     4
1482#define _616                                     5
1483#define _716                                     6
1484#define _816                                     7
1485};
1486
1487static inline void
1488GEN9_ROUNDINGPRECISIONTABLE_3_BITS_pack(__attribute__((unused)) __gen_user_data *data,
1489                                        __attribute__((unused)) void * restrict dst,
1490                                        __attribute__((unused)) const struct GEN9_ROUNDINGPRECISIONTABLE_3_BITS * restrict values)
1491{
1492   uint32_t * restrict dw = (uint32_t * restrict) dst;
1493
1494   dw[0] =
1495      __gen_uint(values->RoundingPrecision, 0, 2);
1496}
1497
1498#define GEN9_SAMPLER_BORDER_COLOR_STATE_length      4
1499struct GEN9_SAMPLER_BORDER_COLOR_STATE {
1500   float                                BorderColorFloatRed;
1501   uint32_t                             BorderColor32bitRed;
1502   float                                BorderColorFloatGreen;
1503   uint32_t                             BorderColor32bitGreen;
1504   float                                BorderColorFloatBlue;
1505   uint32_t                             BorderColor32bitBlue;
1506   float                                BorderColorFloatAlpha;
1507   uint32_t                             BorderColor32bitAlpha;
1508};
1509
1510static inline void
1511GEN9_SAMPLER_BORDER_COLOR_STATE_pack(__attribute__((unused)) __gen_user_data *data,
1512                                     __attribute__((unused)) void * restrict dst,
1513                                     __attribute__((unused)) const struct GEN9_SAMPLER_BORDER_COLOR_STATE * restrict values)
1514{
1515   uint32_t * restrict dw = (uint32_t * restrict) dst;
1516
1517   dw[0] =
1518      __gen_float(values->BorderColorFloatRed) |
1519      __gen_uint(values->BorderColor32bitRed, 0, 31);
1520
1521   dw[1] =
1522      __gen_float(values->BorderColorFloatGreen) |
1523      __gen_uint(values->BorderColor32bitGreen, 0, 31);
1524
1525   dw[2] =
1526      __gen_float(values->BorderColorFloatBlue) |
1527      __gen_uint(values->BorderColor32bitBlue, 0, 31);
1528
1529   dw[3] =
1530      __gen_float(values->BorderColorFloatAlpha) |
1531      __gen_uint(values->BorderColor32bitAlpha, 0, 31);
1532}
1533
1534#define GEN9_SAMPLER_STATE_length              4
1535struct GEN9_SAMPLER_STATE {
1536   uint32_t                             AnisotropicAlgorithm;
1537#define LEGACY                                   0
1538#define EWAApproximation                         1
1539   float                                TextureLODBias;
1540   uint32_t                             MinModeFilter;
1541#define MAPFILTER_NEAREST                        0
1542#define MAPFILTER_LINEAR                         1
1543#define MAPFILTER_ANISOTROPIC                    2
1544#define MAPFILTER_MONO                           6
1545   uint32_t                             MagModeFilter;
1546#define MAPFILTER_NEAREST                        0
1547#define MAPFILTER_LINEAR                         1
1548#define MAPFILTER_ANISOTROPIC                    2
1549#define MAPFILTER_MONO                           6
1550   uint32_t                             MipModeFilter;
1551#define MIPFILTER_NONE                           0
1552#define MIPFILTER_NEAREST                        1
1553#define MIPFILTER_LINEAR                         3
1554   uint32_t                             CoarseLODQualityMode;
1555   uint32_t                             LODPreClampMode;
1556#define CLAMP_MODE_NONE                          0
1557#define CLAMP_MODE_OGL                           2
1558   uint32_t                             TextureBorderColorMode;
1559#define DX10OGL                                  0
1560#define DX9                                      1
1561   bool                                 SamplerDisable;
1562   uint32_t                             CubeSurfaceControlMode;
1563#define PROGRAMMED                               0
1564#define OVERRIDE                                 1
1565   uint32_t                             ShadowFunction;
1566#define PREFILTEROPALWAYS                        0
1567#define PREFILTEROPNEVER                         1
1568#define PREFILTEROPLESS                          2
1569#define PREFILTEROPEQUAL                         3
1570#define PREFILTEROPLEQUAL                        4
1571#define PREFILTEROPGREATER                       5
1572#define PREFILTEROPNOTEQUAL                      6
1573#define PREFILTEROPGEQUAL                        7
1574   uint32_t                             ChromaKeyMode;
1575#define KEYFILTER_KILL_ON_ANY_MATCH              0
1576#define KEYFILTER_REPLACE_BLACK                  1
1577   uint32_t                             ChromaKeyIndex;
1578   bool                                 ChromaKeyEnable;
1579   float                                MaxLOD;
1580   float                                MinLOD;
1581   uint32_t                             LODClampMagnificationMode;
1582#define MIPNONE                                  0
1583#define MIPFILTER                                1
1584   uint64_t                             BorderColorPointer;
1585   enum GEN9_TextureCoordinateMode      TCZAddressControlMode;
1586   enum GEN9_TextureCoordinateMode      TCYAddressControlMode;
1587   enum GEN9_TextureCoordinateMode      TCXAddressControlMode;
1588   bool                                 ReductionTypeEnable;
1589   bool                                 NonnormalizedCoordinateEnable;
1590   uint32_t                             TrilinearFilterQuality;
1591#define FULL                                     0
1592#define HIGH                                     1
1593#define MED                                      2
1594#define LOW                                      3
1595   bool                                 RAddressMinFilterRoundingEnable;
1596   bool                                 RAddressMagFilterRoundingEnable;
1597   bool                                 VAddressMinFilterRoundingEnable;
1598   bool                                 VAddressMagFilterRoundingEnable;
1599   bool                                 UAddressMinFilterRoundingEnable;
1600   bool                                 UAddressMagFilterRoundingEnable;
1601   uint32_t                             MaximumAnisotropy;
1602#define RATIO21                                  0
1603#define RATIO41                                  1
1604#define RATIO61                                  2
1605#define RATIO81                                  3
1606#define RATIO101                                 4
1607#define RATIO121                                 5
1608#define RATIO141                                 6
1609#define RATIO161                                 7
1610   uint32_t                             ReductionType;
1611#define STD_FILTER                               0
1612#define COMPARISON                               1
1613#define MINIMUM                                  2
1614#define MAXIMUM                                  3
1615};
1616
1617static inline void
1618GEN9_SAMPLER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
1619                        __attribute__((unused)) void * restrict dst,
1620                        __attribute__((unused)) const struct GEN9_SAMPLER_STATE * restrict values)
1621{
1622   uint32_t * restrict dw = (uint32_t * restrict) dst;
1623
1624   dw[0] =
1625      __gen_uint(values->AnisotropicAlgorithm, 0, 0) |
1626      __gen_sfixed(values->TextureLODBias, 1, 13, 8) |
1627      __gen_uint(values->MinModeFilter, 14, 16) |
1628      __gen_uint(values->MagModeFilter, 17, 19) |
1629      __gen_uint(values->MipModeFilter, 20, 21) |
1630      __gen_uint(values->CoarseLODQualityMode, 22, 26) |
1631      __gen_uint(values->LODPreClampMode, 27, 28) |
1632      __gen_uint(values->TextureBorderColorMode, 29, 29) |
1633      __gen_uint(values->SamplerDisable, 31, 31);
1634
1635   dw[1] =
1636      __gen_uint(values->CubeSurfaceControlMode, 0, 0) |
1637      __gen_uint(values->ShadowFunction, 1, 3) |
1638      __gen_uint(values->ChromaKeyMode, 4, 4) |
1639      __gen_uint(values->ChromaKeyIndex, 5, 6) |
1640      __gen_uint(values->ChromaKeyEnable, 7, 7) |
1641      __gen_ufixed(values->MaxLOD, 8, 19, 8) |
1642      __gen_ufixed(values->MinLOD, 20, 31, 8);
1643
1644   dw[2] =
1645      __gen_uint(values->LODClampMagnificationMode, 0, 0) |
1646      __gen_offset(values->BorderColorPointer, 6, 23);
1647
1648   dw[3] =
1649      __gen_uint(values->TCZAddressControlMode, 0, 2) |
1650      __gen_uint(values->TCYAddressControlMode, 3, 5) |
1651      __gen_uint(values->TCXAddressControlMode, 6, 8) |
1652      __gen_uint(values->ReductionTypeEnable, 9, 9) |
1653      __gen_uint(values->NonnormalizedCoordinateEnable, 10, 10) |
1654      __gen_uint(values->TrilinearFilterQuality, 11, 12) |
1655      __gen_uint(values->RAddressMinFilterRoundingEnable, 13, 13) |
1656      __gen_uint(values->RAddressMagFilterRoundingEnable, 14, 14) |
1657      __gen_uint(values->VAddressMinFilterRoundingEnable, 15, 15) |
1658      __gen_uint(values->VAddressMagFilterRoundingEnable, 16, 16) |
1659      __gen_uint(values->UAddressMinFilterRoundingEnable, 17, 17) |
1660      __gen_uint(values->UAddressMagFilterRoundingEnable, 18, 18) |
1661      __gen_uint(values->MaximumAnisotropy, 19, 21) |
1662      __gen_uint(values->ReductionType, 22, 23);
1663}
1664
1665#define GEN9_SAMPLER_STATE_8X8_AVS_COEFFICIENTS_length      8
1666struct GEN9_SAMPLER_STATE_8X8_AVS_COEFFICIENTS {
1667   float                                Table0FilterCoefficient[4];
1668   float                                Table1FilterCoefficient0[4];
1669   float                                Table1FilterCoefficient1[4];
1670};
1671
1672static inline void
1673GEN9_SAMPLER_STATE_8X8_AVS_COEFFICIENTS_pack(__attribute__((unused)) __gen_user_data *data,
1674                                             __attribute__((unused)) void * restrict dst,
1675                                             __attribute__((unused)) const struct GEN9_SAMPLER_STATE_8X8_AVS_COEFFICIENTS * restrict values)
1676{
1677   uint32_t * restrict dw = (uint32_t * restrict) dst;
1678
1679   dw[0] =
1680      __gen_sfixed(values->Table0FilterCoefficient[0], 0, 7, 6) |
1681      __gen_sfixed(values->Table0FilterCoefficient[1], 8, 15, 6) |
1682      __gen_sfixed(values->Table0FilterCoefficient[2], 16, 23, 6) |
1683      __gen_sfixed(values->Table0FilterCoefficient[3], 24, 31, 6) |
1684      __gen_sfixed(values->Table1FilterCoefficient0[0], 0, 7, 6) |
1685      __gen_sfixed(values->Table1FilterCoefficient1[0], 8, 15, 6);
1686
1687   dw[1] =
1688      __gen_sfixed(values->Table1FilterCoefficient0[1], 0, 7, 6) |
1689      __gen_sfixed(values->Table1FilterCoefficient1[1], 8, 15, 6);
1690
1691   dw[2] =
1692      __gen_sfixed(values->Table1FilterCoefficient0[2], 0, 7, 6) |
1693      __gen_sfixed(values->Table1FilterCoefficient1[2], 8, 15, 6);
1694
1695   dw[3] =
1696      __gen_sfixed(values->Table1FilterCoefficient0[3], 0, 7, 6) |
1697      __gen_sfixed(values->Table1FilterCoefficient1[3], 8, 15, 6);
1698
1699   dw[4] = 0;
1700
1701   dw[5] = 0;
1702
1703   dw[6] = 0;
1704
1705   dw[7] = 0;
1706}
1707
1708#define GEN9_SCISSOR_RECT_length               2
1709struct GEN9_SCISSOR_RECT {
1710   uint32_t                             ScissorRectangleXMin;
1711   uint32_t                             ScissorRectangleYMin;
1712   uint32_t                             ScissorRectangleXMax;
1713   uint32_t                             ScissorRectangleYMax;
1714};
1715
1716static inline void
1717GEN9_SCISSOR_RECT_pack(__attribute__((unused)) __gen_user_data *data,
1718                       __attribute__((unused)) void * restrict dst,
1719                       __attribute__((unused)) const struct GEN9_SCISSOR_RECT * restrict values)
1720{
1721   uint32_t * restrict dw = (uint32_t * restrict) dst;
1722
1723   dw[0] =
1724      __gen_uint(values->ScissorRectangleXMin, 0, 15) |
1725      __gen_uint(values->ScissorRectangleYMin, 16, 31);
1726
1727   dw[1] =
1728      __gen_uint(values->ScissorRectangleXMax, 0, 15) |
1729      __gen_uint(values->ScissorRectangleYMax, 16, 31);
1730}
1731
1732#define GEN9_SFC_AVS_CHROMA_COEFF_TABLE_BODY_length     64
1733struct GEN9_SFC_AVS_CHROMA_COEFF_TABLE_BODY {
1734   float                                Table1XFilterCoefficientn2;
1735   float                                Table1YFilterCoefficientn2;
1736   float                                Table1XFilterCoefficientn3;
1737   float                                Table1YFilterCoefficientn3;
1738   float                                Table1XFilterCoefficientn4;
1739   float                                Table1YFilterCoefficientn4;
1740   float                                Table1XFilterCoefficientn5;
1741   float                                Table1YFilterCoefficientn5;
1742   uint64_t                             FilterCoefficients[31];
1743};
1744
1745static inline void
1746GEN9_SFC_AVS_CHROMA_COEFF_TABLE_BODY_pack(__attribute__((unused)) __gen_user_data *data,
1747                                          __attribute__((unused)) void * restrict dst,
1748                                          __attribute__((unused)) const struct GEN9_SFC_AVS_CHROMA_COEFF_TABLE_BODY * restrict values)
1749{
1750   uint32_t * restrict dw = (uint32_t * restrict) dst;
1751
1752   dw[0] =
1753      __gen_sfixed(values->Table1XFilterCoefficientn2, 0, 7, 6) |
1754      __gen_sfixed(values->Table1YFilterCoefficientn2, 8, 15, 6) |
1755      __gen_sfixed(values->Table1XFilterCoefficientn3, 16, 23, 6) |
1756      __gen_sfixed(values->Table1YFilterCoefficientn3, 24, 31, 6);
1757
1758   dw[1] =
1759      __gen_sfixed(values->Table1XFilterCoefficientn4, 0, 7, 6) |
1760      __gen_sfixed(values->Table1YFilterCoefficientn4, 8, 15, 6) |
1761      __gen_sfixed(values->Table1XFilterCoefficientn5, 16, 23, 6) |
1762      __gen_sfixed(values->Table1YFilterCoefficientn5, 24, 31, 6);
1763
1764   const uint64_t v2 =
1765      __gen_uint(values->FilterCoefficients[0], 0, 63);
1766   dw[2] = v2;
1767   dw[3] = v2 >> 32;
1768
1769   const uint64_t v4 =
1770      __gen_uint(values->FilterCoefficients[1], 0, 63);
1771   dw[4] = v4;
1772   dw[5] = v4 >> 32;
1773
1774   const uint64_t v6 =
1775      __gen_uint(values->FilterCoefficients[2], 0, 63);
1776   dw[6] = v6;
1777   dw[7] = v6 >> 32;
1778
1779   const uint64_t v8 =
1780      __gen_uint(values->FilterCoefficients[3], 0, 63);
1781   dw[8] = v8;
1782   dw[9] = v8 >> 32;
1783
1784   const uint64_t v10 =
1785      __gen_uint(values->FilterCoefficients[4], 0, 63);
1786   dw[10] = v10;
1787   dw[11] = v10 >> 32;
1788
1789   const uint64_t v12 =
1790      __gen_uint(values->FilterCoefficients[5], 0, 63);
1791   dw[12] = v12;
1792   dw[13] = v12 >> 32;
1793
1794   const uint64_t v14 =
1795      __gen_uint(values->FilterCoefficients[6], 0, 63);
1796   dw[14] = v14;
1797   dw[15] = v14 >> 32;
1798
1799   const uint64_t v16 =
1800      __gen_uint(values->FilterCoefficients[7], 0, 63);
1801   dw[16] = v16;
1802   dw[17] = v16 >> 32;
1803
1804   const uint64_t v18 =
1805      __gen_uint(values->FilterCoefficients[8], 0, 63);
1806   dw[18] = v18;
1807   dw[19] = v18 >> 32;
1808
1809   const uint64_t v20 =
1810      __gen_uint(values->FilterCoefficients[9], 0, 63);
1811   dw[20] = v20;
1812   dw[21] = v20 >> 32;
1813
1814   const uint64_t v22 =
1815      __gen_uint(values->FilterCoefficients[10], 0, 63);
1816   dw[22] = v22;
1817   dw[23] = v22 >> 32;
1818
1819   const uint64_t v24 =
1820      __gen_uint(values->FilterCoefficients[11], 0, 63);
1821   dw[24] = v24;
1822   dw[25] = v24 >> 32;
1823
1824   const uint64_t v26 =
1825      __gen_uint(values->FilterCoefficients[12], 0, 63);
1826   dw[26] = v26;
1827   dw[27] = v26 >> 32;
1828
1829   const uint64_t v28 =
1830      __gen_uint(values->FilterCoefficients[13], 0, 63);
1831   dw[28] = v28;
1832   dw[29] = v28 >> 32;
1833
1834   const uint64_t v30 =
1835      __gen_uint(values->FilterCoefficients[14], 0, 63);
1836   dw[30] = v30;
1837   dw[31] = v30 >> 32;
1838
1839   const uint64_t v32 =
1840      __gen_uint(values->FilterCoefficients[15], 0, 63);
1841   dw[32] = v32;
1842   dw[33] = v32 >> 32;
1843
1844   const uint64_t v34 =
1845      __gen_uint(values->FilterCoefficients[16], 0, 63);
1846   dw[34] = v34;
1847   dw[35] = v34 >> 32;
1848
1849   const uint64_t v36 =
1850      __gen_uint(values->FilterCoefficients[17], 0, 63);
1851   dw[36] = v36;
1852   dw[37] = v36 >> 32;
1853
1854   const uint64_t v38 =
1855      __gen_uint(values->FilterCoefficients[18], 0, 63);
1856   dw[38] = v38;
1857   dw[39] = v38 >> 32;
1858
1859   const uint64_t v40 =
1860      __gen_uint(values->FilterCoefficients[19], 0, 63);
1861   dw[40] = v40;
1862   dw[41] = v40 >> 32;
1863
1864   const uint64_t v42 =
1865      __gen_uint(values->FilterCoefficients[20], 0, 63);
1866   dw[42] = v42;
1867   dw[43] = v42 >> 32;
1868
1869   const uint64_t v44 =
1870      __gen_uint(values->FilterCoefficients[21], 0, 63);
1871   dw[44] = v44;
1872   dw[45] = v44 >> 32;
1873
1874   const uint64_t v46 =
1875      __gen_uint(values->FilterCoefficients[22], 0, 63);
1876   dw[46] = v46;
1877   dw[47] = v46 >> 32;
1878
1879   const uint64_t v48 =
1880      __gen_uint(values->FilterCoefficients[23], 0, 63);
1881   dw[48] = v48;
1882   dw[49] = v48 >> 32;
1883
1884   const uint64_t v50 =
1885      __gen_uint(values->FilterCoefficients[24], 0, 63);
1886   dw[50] = v50;
1887   dw[51] = v50 >> 32;
1888
1889   const uint64_t v52 =
1890      __gen_uint(values->FilterCoefficients[25], 0, 63);
1891   dw[52] = v52;
1892   dw[53] = v52 >> 32;
1893
1894   const uint64_t v54 =
1895      __gen_uint(values->FilterCoefficients[26], 0, 63);
1896   dw[54] = v54;
1897   dw[55] = v54 >> 32;
1898
1899   const uint64_t v56 =
1900      __gen_uint(values->FilterCoefficients[27], 0, 63);
1901   dw[56] = v56;
1902   dw[57] = v56 >> 32;
1903
1904   const uint64_t v58 =
1905      __gen_uint(values->FilterCoefficients[28], 0, 63);
1906   dw[58] = v58;
1907   dw[59] = v58 >> 32;
1908
1909   const uint64_t v60 =
1910      __gen_uint(values->FilterCoefficients[29], 0, 63);
1911   dw[60] = v60;
1912   dw[61] = v60 >> 32;
1913
1914   const uint64_t v62 =
1915      __gen_uint(values->FilterCoefficients[30], 0, 63);
1916   dw[62] = v62;
1917   dw[63] = v62 >> 32;
1918}
1919
1920#define GEN9_SFC_AVS_LUMA_COEFF_TABLE_BODY_length    128
1921struct GEN9_SFC_AVS_LUMA_COEFF_TABLE_BODY {
1922   float                                Table0XFilterCoefficientn0;
1923   float                                Table0YFilterCoefficientn0;
1924   float                                Table0XFilterCoefficientn1;
1925   float                                Table0YFilterCoefficientn1;
1926   float                                Table0XFilterCoefficientn2;
1927   float                                Table0YFilterCoefficientn2;
1928   float                                Table0XFilterCoefficientn3;
1929   float                                Table0YFilterCoefficientn3;
1930   float                                Table0XFilterCoefficientn4;
1931   float                                Table0YFilterCoefficientn4;
1932   float                                Table0XFilterCoefficientn5;
1933   float                                Table0YFilterCoefficientn5;
1934   float                                Table0XFilterCoefficientn6;
1935   float                                Table0YFilterCoefficientn6;
1936   float                                Table0XFilterCoefficientn7;
1937   float                                Table0YFilterCoefficientn7;
1938   uint64_t                             FilterCoefficients[31];
1939};
1940
1941static inline void
1942GEN9_SFC_AVS_LUMA_COEFF_TABLE_BODY_pack(__attribute__((unused)) __gen_user_data *data,
1943                                        __attribute__((unused)) void * restrict dst,
1944                                        __attribute__((unused)) const struct GEN9_SFC_AVS_LUMA_COEFF_TABLE_BODY * restrict values)
1945{
1946   uint32_t * restrict dw = (uint32_t * restrict) dst;
1947
1948   dw[0] =
1949      __gen_sfixed(values->Table0XFilterCoefficientn0, 0, 7, 6) |
1950      __gen_sfixed(values->Table0YFilterCoefficientn0, 8, 15, 6) |
1951      __gen_sfixed(values->Table0XFilterCoefficientn1, 16, 23, 6) |
1952      __gen_sfixed(values->Table0YFilterCoefficientn1, 24, 31, 6);
1953
1954   dw[1] =
1955      __gen_sfixed(values->Table0XFilterCoefficientn2, 0, 7, 6) |
1956      __gen_sfixed(values->Table0YFilterCoefficientn2, 8, 15, 6) |
1957      __gen_sfixed(values->Table0XFilterCoefficientn3, 16, 23, 6) |
1958      __gen_sfixed(values->Table0YFilterCoefficientn3, 24, 31, 6);
1959
1960   dw[2] =
1961      __gen_sfixed(values->Table0XFilterCoefficientn4, 0, 7, 6) |
1962      __gen_sfixed(values->Table0YFilterCoefficientn4, 8, 15, 6) |
1963      __gen_sfixed(values->Table0XFilterCoefficientn5, 16, 23, 6) |
1964      __gen_sfixed(values->Table0YFilterCoefficientn5, 24, 31, 6);
1965
1966   dw[3] =
1967      __gen_sfixed(values->Table0XFilterCoefficientn6, 0, 7, 6) |
1968      __gen_sfixed(values->Table0YFilterCoefficientn6, 8, 15, 6) |
1969      __gen_sfixed(values->Table0XFilterCoefficientn7, 16, 23, 6) |
1970      __gen_sfixed(values->Table0YFilterCoefficientn7, 24, 31, 6);
1971
1972   const uint64_t v4 =
1973      __gen_uint(values->FilterCoefficients[0], 0, 127);
1974   dw[4] = v4;
1975   dw[5] = v4 >> 32;
1976
1977   const uint64_t v8 =
1978      __gen_uint(values->FilterCoefficients[1], 0, 127);
1979   dw[8] = v8;
1980   dw[9] = v8 >> 32;
1981
1982   const uint64_t v12 =
1983      __gen_uint(values->FilterCoefficients[2], 0, 127);
1984   dw[12] = v12;
1985   dw[13] = v12 >> 32;
1986
1987   const uint64_t v16 =
1988      __gen_uint(values->FilterCoefficients[3], 0, 127);
1989   dw[16] = v16;
1990   dw[17] = v16 >> 32;
1991
1992   const uint64_t v20 =
1993      __gen_uint(values->FilterCoefficients[4], 0, 127);
1994   dw[20] = v20;
1995   dw[21] = v20 >> 32;
1996
1997   const uint64_t v24 =
1998      __gen_uint(values->FilterCoefficients[5], 0, 127);
1999   dw[24] = v24;
2000   dw[25] = v24 >> 32;
2001
2002   const uint64_t v28 =
2003      __gen_uint(values->FilterCoefficients[6], 0, 127);
2004   dw[28] = v28;
2005   dw[29] = v28 >> 32;
2006
2007   const uint64_t v32 =
2008      __gen_uint(values->FilterCoefficients[7], 0, 127);
2009   dw[32] = v32;
2010   dw[33] = v32 >> 32;
2011
2012   const uint64_t v36 =
2013      __gen_uint(values->FilterCoefficients[8], 0, 127);
2014   dw[36] = v36;
2015   dw[37] = v36 >> 32;
2016
2017   const uint64_t v40 =
2018      __gen_uint(values->FilterCoefficients[9], 0, 127);
2019   dw[40] = v40;
2020   dw[41] = v40 >> 32;
2021
2022   const uint64_t v44 =
2023      __gen_uint(values->FilterCoefficients[10], 0, 127);
2024   dw[44] = v44;
2025   dw[45] = v44 >> 32;
2026
2027   const uint64_t v48 =
2028      __gen_uint(values->FilterCoefficients[11], 0, 127);
2029   dw[48] = v48;
2030   dw[49] = v48 >> 32;
2031
2032   const uint64_t v52 =
2033      __gen_uint(values->FilterCoefficients[12], 0, 127);
2034   dw[52] = v52;
2035   dw[53] = v52 >> 32;
2036
2037   const uint64_t v56 =
2038      __gen_uint(values->FilterCoefficients[13], 0, 127);
2039   dw[56] = v56;
2040   dw[57] = v56 >> 32;
2041
2042   const uint64_t v60 =
2043      __gen_uint(values->FilterCoefficients[14], 0, 127);
2044   dw[60] = v60;
2045   dw[61] = v60 >> 32;
2046
2047   const uint64_t v64 =
2048      __gen_uint(values->FilterCoefficients[15], 0, 127);
2049   dw[64] = v64;
2050   dw[65] = v64 >> 32;
2051
2052   const uint64_t v68 =
2053      __gen_uint(values->FilterCoefficients[16], 0, 127);
2054   dw[68] = v68;
2055   dw[69] = v68 >> 32;
2056
2057   const uint64_t v72 =
2058      __gen_uint(values->FilterCoefficients[17], 0, 127);
2059   dw[72] = v72;
2060   dw[73] = v72 >> 32;
2061
2062   const uint64_t v76 =
2063      __gen_uint(values->FilterCoefficients[18], 0, 127);
2064   dw[76] = v76;
2065   dw[77] = v76 >> 32;
2066
2067   const uint64_t v80 =
2068      __gen_uint(values->FilterCoefficients[19], 0, 127);
2069   dw[80] = v80;
2070   dw[81] = v80 >> 32;
2071
2072   const uint64_t v84 =
2073      __gen_uint(values->FilterCoefficients[20], 0, 127);
2074   dw[84] = v84;
2075   dw[85] = v84 >> 32;
2076
2077   const uint64_t v88 =
2078      __gen_uint(values->FilterCoefficients[21], 0, 127);
2079   dw[88] = v88;
2080   dw[89] = v88 >> 32;
2081
2082   const uint64_t v92 =
2083      __gen_uint(values->FilterCoefficients[22], 0, 127);
2084   dw[92] = v92;
2085   dw[93] = v92 >> 32;
2086
2087   const uint64_t v96 =
2088      __gen_uint(values->FilterCoefficients[23], 0, 127);
2089   dw[96] = v96;
2090   dw[97] = v96 >> 32;
2091
2092   const uint64_t v100 =
2093      __gen_uint(values->FilterCoefficients[24], 0, 127);
2094   dw[100] = v100;
2095   dw[101] = v100 >> 32;
2096
2097   const uint64_t v104 =
2098      __gen_uint(values->FilterCoefficients[25], 0, 127);
2099   dw[104] = v104;
2100   dw[105] = v104 >> 32;
2101
2102   const uint64_t v108 =
2103      __gen_uint(values->FilterCoefficients[26], 0, 127);
2104   dw[108] = v108;
2105   dw[109] = v108 >> 32;
2106
2107   const uint64_t v112 =
2108      __gen_uint(values->FilterCoefficients[27], 0, 127);
2109   dw[112] = v112;
2110   dw[113] = v112 >> 32;
2111
2112   const uint64_t v116 =
2113      __gen_uint(values->FilterCoefficients[28], 0, 127);
2114   dw[116] = v116;
2115   dw[117] = v116 >> 32;
2116
2117   const uint64_t v120 =
2118      __gen_uint(values->FilterCoefficients[29], 0, 127);
2119   dw[120] = v120;
2120   dw[121] = v120 >> 32;
2121
2122   const uint64_t v124 =
2123      __gen_uint(values->FilterCoefficients[30], 0, 127);
2124   dw[124] = v124;
2125   dw[125] = v124 >> 32;
2126}
2127
2128#define GEN9_SFC_AVS_STATE_BODY_length         2
2129struct GEN9_SFC_AVS_STATE_BODY {
2130   uint32_t                             TransitionAreawith8Pixels;
2131   uint32_t                             TransitionAreawith4Pixels;
2132   uint32_t                             SharpnessLevel;
2133   uint32_t                             MaxDerivative8Pixels;
2134   uint32_t                             MaxDerivative4Pixels;
2135};
2136
2137static inline void
2138GEN9_SFC_AVS_STATE_BODY_pack(__attribute__((unused)) __gen_user_data *data,
2139                             __attribute__((unused)) void * restrict dst,
2140                             __attribute__((unused)) const struct GEN9_SFC_AVS_STATE_BODY * restrict values)
2141{
2142   uint32_t * restrict dw = (uint32_t * restrict) dst;
2143
2144   dw[0] =
2145      __gen_uint(values->TransitionAreawith8Pixels, 0, 2) |
2146      __gen_uint(values->TransitionAreawith4Pixels, 4, 6) |
2147      __gen_uint(values->SharpnessLevel, 24, 31);
2148
2149   dw[1] =
2150      __gen_uint(values->MaxDerivative8Pixels, 0, 7) |
2151      __gen_uint(values->MaxDerivative4Pixels, 16, 23);
2152}
2153
2154#define GEN9_SFC_IEF_STATE_BODY_length        23
2155struct GEN9_SFC_IEF_STATE_BODY {
2156   uint32_t                             GainFactor;
2157   uint32_t                             WeakEdgeThreshold;
2158   uint32_t                             StrongEdgeThreshold;
2159   float                                R3xCoefficient;
2160   float                                R3cCoefficient;
2161   uint32_t                             GlobalNoiseEstimation;
2162   uint32_t                             NonEdgeWeight;
2163   uint32_t                             RegularWeight;
2164   uint32_t                             StrongEdgeWeight;
2165   float                                R5xCoefficient;
2166   float                                R5cxCoefficient;
2167   float                                R5cCoefficient;
2168   float                                STDSinalpha;
2169   float                                STDCosalpha;
2170   uint32_t                             Sat_Max;
2171   uint32_t                             Hue_Max;
2172   float                                S3U;
2173   uint32_t                             DiamondMargin;
2174   bool                                 VY_STD_Enable;
2175   uint32_t                             U_Mid;
2176   uint32_t                             V_Mid;
2177   int32_t                              Diamond_dv;
2178   uint32_t                             Diamond_Th;
2179   float                                Diamond_alpha;
2180   uint32_t                             HS_margin;
2181   int32_t                              Diamond_du;
2182   uint32_t                             SkinDetailFactor;
2183#define DetailRevealed                           0
2184#define NotDetailRevealed                        1
2185   uint32_t                             Y_point_1;
2186   uint32_t                             Y_point_2;
2187   uint32_t                             Y_point_3;
2188   uint32_t                             Y_point_4;
2189   float                                INV_Margin_VYL;
2190   float                                INV_Margin_VYU;
2191   uint32_t                             P0L;
2192   uint32_t                             P1L;
2193   uint32_t                             P2L;
2194   uint32_t                             P3L;
2195   uint32_t                             B0L;
2196   uint32_t                             B1L;
2197   uint32_t                             B2L;
2198   uint32_t                             B3L;
2199   float                                S0L;
2200   float                                Y_Slope_2;
2201   float                                S1L;
2202   float                                S2L;
2203   float                                S3L;
2204   uint32_t                             P0U;
2205   uint32_t                             P1U;
2206   float                                Y_Slope1;
2207   uint32_t                             P2U;
2208   uint32_t                             P3U;
2209   uint32_t                             B0U;
2210   uint32_t                             B1U;
2211   uint32_t                             B2U;
2212   uint32_t                             B3U;
2213   float                                S0U;
2214   float                                S1U;
2215   float                                S2U;
2216   bool                                 TransformEnable;
2217   bool                                 YUVChannelSwap;
2218   float                                C0;
2219   float                                C1;
2220   float                                C2;
2221   float                                C3;
2222   float                                C4;
2223   float                                C5;
2224   float                                C6;
2225   float                                C7;
2226   float                                C8;
2227   float                                OffsetIn1;
2228   float                                OffsetOut1;
2229   float                                OffsetIn2;
2230   float                                OffsetOut2;
2231   float                                OffsetIn3;
2232   float                                OffsetOut3;
2233};
2234
2235static inline void
2236GEN9_SFC_IEF_STATE_BODY_pack(__attribute__((unused)) __gen_user_data *data,
2237                             __attribute__((unused)) void * restrict dst,
2238                             __attribute__((unused)) const struct GEN9_SFC_IEF_STATE_BODY * restrict values)
2239{
2240   uint32_t * restrict dw = (uint32_t * restrict) dst;
2241
2242   dw[0] =
2243      __gen_uint(values->GainFactor, 0, 5) |
2244      __gen_uint(values->WeakEdgeThreshold, 6, 11) |
2245      __gen_uint(values->StrongEdgeThreshold, 12, 17) |
2246      __gen_ufixed(values->R3xCoefficient, 18, 22, 5) |
2247      __gen_ufixed(values->R3cCoefficient, 23, 27, 5);
2248
2249   dw[1] =
2250      __gen_uint(values->GlobalNoiseEstimation, 0, 7) |
2251      __gen_uint(values->NonEdgeWeight, 8, 10) |
2252      __gen_uint(values->RegularWeight, 11, 13) |
2253      __gen_uint(values->StrongEdgeWeight, 14, 16) |
2254      __gen_ufixed(values->R5xCoefficient, 17, 21, 5) |
2255      __gen_ufixed(values->R5cxCoefficient, 22, 26, 5) |
2256      __gen_ufixed(values->R5cCoefficient, 27, 31, 5);
2257
2258   dw[2] =
2259      __gen_sfixed(values->STDSinalpha, 0, 7, 7) |
2260      __gen_sfixed(values->STDCosalpha, 8, 15, 7) |
2261      __gen_uint(values->Sat_Max, 16, 21) |
2262      __gen_uint(values->Hue_Max, 22, 27);
2263
2264   dw[3] =
2265      __gen_sfixed(values->S3U, 0, 10, 8) |
2266      __gen_uint(values->DiamondMargin, 12, 14) |
2267      __gen_uint(values->VY_STD_Enable, 15, 15) |
2268      __gen_uint(values->U_Mid, 16, 23) |
2269      __gen_uint(values->V_Mid, 24, 31);
2270
2271   dw[4] =
2272      __gen_sint(values->Diamond_dv, 0, 6) |
2273      __gen_uint(values->Diamond_Th, 7, 12) |
2274      __gen_ufixed(values->Diamond_alpha, 13, 20, 6) |
2275      __gen_uint(values->HS_margin, 21, 23) |
2276      __gen_sint(values->Diamond_du, 24, 30) |
2277      __gen_uint(values->SkinDetailFactor, 31, 31);
2278
2279   dw[5] =
2280      __gen_uint(values->Y_point_1, 0, 7) |
2281      __gen_uint(values->Y_point_2, 8, 15) |
2282      __gen_uint(values->Y_point_3, 16, 23) |
2283      __gen_uint(values->Y_point_4, 24, 31);
2284
2285   dw[6] =
2286      __gen_ufixed(values->INV_Margin_VYL, 0, 15, 16);
2287
2288   dw[7] =
2289      __gen_ufixed(values->INV_Margin_VYU, 0, 15, 16) |
2290      __gen_uint(values->P0L, 16, 23) |
2291      __gen_uint(values->P1L, 24, 31);
2292
2293   dw[8] =
2294      __gen_uint(values->P2L, 0, 7) |
2295      __gen_uint(values->P3L, 8, 15) |
2296      __gen_uint(values->B0L, 16, 23) |
2297      __gen_uint(values->B1L, 24, 31);
2298
2299   dw[9] =
2300      __gen_uint(values->B2L, 0, 7) |
2301      __gen_uint(values->B3L, 8, 15) |
2302      __gen_sfixed(values->S0L, 16, 26, 8) |
2303      __gen_ufixed(values->Y_Slope_2, 27, 31, 3);
2304
2305   dw[10] =
2306      __gen_sfixed(values->S1L, 0, 10, 8) |
2307      __gen_sfixed(values->S2L, 11, 21, 8);
2308
2309   dw[11] =
2310      __gen_sfixed(values->S3L, 0, 10, 8) |
2311      __gen_uint(values->P0U, 11, 18) |
2312      __gen_uint(values->P1U, 19, 26) |
2313      __gen_ufixed(values->Y_Slope1, 27, 31, 3);
2314
2315   dw[12] =
2316      __gen_uint(values->P2U, 0, 7) |
2317      __gen_uint(values->P3U, 8, 15) |
2318      __gen_uint(values->B0U, 16, 23) |
2319      __gen_uint(values->B1U, 24, 31);
2320
2321   dw[13] =
2322      __gen_uint(values->B2U, 0, 7) |
2323      __gen_uint(values->B3U, 8, 15) |
2324      __gen_sfixed(values->S0U, 16, 26, 8);
2325
2326   dw[14] =
2327      __gen_sfixed(values->S1U, 0, 10, 8) |
2328      __gen_sfixed(values->S2U, 11, 21, 8);
2329
2330   dw[15] =
2331      __gen_uint(values->TransformEnable, 0, 0) |
2332      __gen_uint(values->YUVChannelSwap, 1, 1) |
2333      __gen_sfixed(values->C0, 3, 15, 10) |
2334      __gen_sfixed(values->C1, 16, 28, 10);
2335
2336   dw[16] =
2337      __gen_sfixed(values->C2, 0, 12, 10) |
2338      __gen_sfixed(values->C3, 13, 25, 10);
2339
2340   dw[17] =
2341      __gen_sfixed(values->C4, 0, 12, 10) |
2342      __gen_sfixed(values->C5, 13, 25, 10);
2343
2344   dw[18] =
2345      __gen_sfixed(values->C6, 0, 12, 10) |
2346      __gen_sfixed(values->C7, 13, 25, 10);
2347
2348   dw[19] =
2349      __gen_sfixed(values->C8, 0, 12, 10);
2350
2351   dw[20] =
2352      __gen_sfixed(values->OffsetIn1, 0, 10, 8) |
2353      __gen_sfixed(values->OffsetOut1, 11, 21, 8);
2354
2355   dw[21] =
2356      __gen_sfixed(values->OffsetIn2, 0, 10, 8) |
2357      __gen_sfixed(values->OffsetOut2, 11, 21, 8);
2358
2359   dw[22] =
2360      __gen_sfixed(values->OffsetIn3, 0, 10, 8) |
2361      __gen_sfixed(values->OffsetOut3, 11, 21, 8);
2362}
2363
2364#define GEN9_SFC_LOCK_BODY_length              1
2365struct GEN9_SFC_LOCK_BODY {
2366   uint32_t                             VESFCPipeSelect;
2367   bool                                 PreScaledOutputSurfaceOutputEnable;
2368};
2369
2370static inline void
2371GEN9_SFC_LOCK_BODY_pack(__attribute__((unused)) __gen_user_data *data,
2372                        __attribute__((unused)) void * restrict dst,
2373                        __attribute__((unused)) const struct GEN9_SFC_LOCK_BODY * restrict values)
2374{
2375   uint32_t * restrict dw = (uint32_t * restrict) dst;
2376
2377   dw[0] =
2378      __gen_uint(values->VESFCPipeSelect, 0, 0) |
2379      __gen_uint(values->PreScaledOutputSurfaceOutputEnable, 1, 1);
2380}
2381
2382#define GEN9_SF_CLIP_VIEWPORT_length          16
2383struct GEN9_SF_CLIP_VIEWPORT {
2384   float                                ViewportMatrixElementm00;
2385   float                                ViewportMatrixElementm11;
2386   float                                ViewportMatrixElementm22;
2387   float                                ViewportMatrixElementm30;
2388   float                                ViewportMatrixElementm31;
2389   float                                ViewportMatrixElementm32;
2390   float                                XMinClipGuardband;
2391   float                                XMaxClipGuardband;
2392   float                                YMinClipGuardband;
2393   float                                YMaxClipGuardband;
2394   float                                XMinViewPort;
2395   float                                XMaxViewPort;
2396   float                                YMinViewPort;
2397   float                                YMaxViewPort;
2398};
2399
2400static inline void
2401GEN9_SF_CLIP_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
2402                           __attribute__((unused)) void * restrict dst,
2403                           __attribute__((unused)) const struct GEN9_SF_CLIP_VIEWPORT * restrict values)
2404{
2405   uint32_t * restrict dw = (uint32_t * restrict) dst;
2406
2407   dw[0] =
2408      __gen_float(values->ViewportMatrixElementm00);
2409
2410   dw[1] =
2411      __gen_float(values->ViewportMatrixElementm11);
2412
2413   dw[2] =
2414      __gen_float(values->ViewportMatrixElementm22);
2415
2416   dw[3] =
2417      __gen_float(values->ViewportMatrixElementm30);
2418
2419   dw[4] =
2420      __gen_float(values->ViewportMatrixElementm31);
2421
2422   dw[5] =
2423      __gen_float(values->ViewportMatrixElementm32);
2424
2425   dw[6] = 0;
2426
2427   dw[7] = 0;
2428
2429   dw[8] =
2430      __gen_float(values->XMinClipGuardband);
2431
2432   dw[9] =
2433      __gen_float(values->XMaxClipGuardband);
2434
2435   dw[10] =
2436      __gen_float(values->YMinClipGuardband);
2437
2438   dw[11] =
2439      __gen_float(values->YMaxClipGuardband);
2440
2441   dw[12] =
2442      __gen_float(values->XMinViewPort);
2443
2444   dw[13] =
2445      __gen_float(values->XMaxViewPort);
2446
2447   dw[14] =
2448      __gen_float(values->YMinViewPort);
2449
2450   dw[15] =
2451      __gen_float(values->YMaxViewPort);
2452}
2453
2454#define GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL_length      1
2455struct GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL {
2456   uint32_t                             SourceAttribute;
2457   uint32_t                             SwizzleSelect;
2458#define INPUTATTR                                0
2459#define INPUTATTR_FACING                         1
2460#define INPUTATTR_W                              2
2461#define INPUTATTR_FACING_W                       3
2462   uint32_t                             ConstantSource;
2463#define CONST_0000                               0
2464#define CONST_0001_FLOAT                         1
2465#define CONST_1111_FLOAT                         2
2466#define PRIM_ID                                  3
2467   uint32_t                             SwizzleControlMode;
2468   bool                                 ComponentOverrideX;
2469   bool                                 ComponentOverrideY;
2470   bool                                 ComponentOverrideZ;
2471   bool                                 ComponentOverrideW;
2472};
2473
2474static inline void
2475GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(__attribute__((unused)) __gen_user_data *data,
2476                                     __attribute__((unused)) void * restrict dst,
2477                                     __attribute__((unused)) const struct GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL * restrict values)
2478{
2479   uint32_t * restrict dw = (uint32_t * restrict) dst;
2480
2481   dw[0] =
2482      __gen_uint(values->SourceAttribute, 0, 4) |
2483      __gen_uint(values->SwizzleSelect, 6, 7) |
2484      __gen_uint(values->ConstantSource, 9, 10) |
2485      __gen_uint(values->SwizzleControlMode, 11, 11) |
2486      __gen_uint(values->ComponentOverrideX, 12, 12) |
2487      __gen_uint(values->ComponentOverrideY, 13, 13) |
2488      __gen_uint(values->ComponentOverrideZ, 14, 14) |
2489      __gen_uint(values->ComponentOverrideW, 15, 15);
2490}
2491
2492#define GEN9_SO_DECL_length                    1
2493struct GEN9_SO_DECL {
2494   uint32_t                             ComponentMask;
2495   uint32_t                             RegisterIndex;
2496   uint32_t                             HoleFlag;
2497   uint32_t                             OutputBufferSlot;
2498};
2499
2500static inline void
2501GEN9_SO_DECL_pack(__attribute__((unused)) __gen_user_data *data,
2502                  __attribute__((unused)) void * restrict dst,
2503                  __attribute__((unused)) const struct GEN9_SO_DECL * restrict values)
2504{
2505   uint32_t * restrict dw = (uint32_t * restrict) dst;
2506
2507   dw[0] =
2508      __gen_uint(values->ComponentMask, 0, 3) |
2509      __gen_uint(values->RegisterIndex, 4, 9) |
2510      __gen_uint(values->HoleFlag, 11, 11) |
2511      __gen_uint(values->OutputBufferSlot, 12, 13);
2512}
2513
2514#define GEN9_SO_DECL_ENTRY_length              2
2515struct GEN9_SO_DECL_ENTRY {
2516   struct GEN9_SO_DECL                  Stream0Decl;
2517   struct GEN9_SO_DECL                  Stream1Decl;
2518   struct GEN9_SO_DECL                  Stream2Decl;
2519   struct GEN9_SO_DECL                  Stream3Decl;
2520};
2521
2522static inline void
2523GEN9_SO_DECL_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
2524                        __attribute__((unused)) void * restrict dst,
2525                        __attribute__((unused)) const struct GEN9_SO_DECL_ENTRY * restrict values)
2526{
2527   uint32_t * restrict dw = (uint32_t * restrict) dst;
2528
2529   uint32_t v0_0;
2530   GEN9_SO_DECL_pack(data, &v0_0, &values->Stream0Decl);
2531
2532   uint32_t v0_1;
2533   GEN9_SO_DECL_pack(data, &v0_1, &values->Stream1Decl);
2534
2535   dw[0] =
2536      __gen_uint(v0_0, 0, 15) |
2537      __gen_uint(v0_1, 16, 31);
2538
2539   uint32_t v1_0;
2540   GEN9_SO_DECL_pack(data, &v1_0, &values->Stream2Decl);
2541
2542   uint32_t v1_1;
2543   GEN9_SO_DECL_pack(data, &v1_1, &values->Stream3Decl);
2544
2545   dw[1] =
2546      __gen_uint(v1_0, 0, 15) |
2547      __gen_uint(v1_1, 16, 31);
2548}
2549
2550#define GEN9_VDENC_SURFACE_CONTROL_BITS_length      1
2551struct GEN9_VDENC_SURFACE_CONTROL_BITS {
2552   uint32_t                             MOCS;
2553   uint32_t                             ArbitrationPriorityControl;
2554#define Highestpriority                          0
2555#define Secondhighestpriority                    1
2556#define Thirdhighestpriority                     2
2557#define Lowestpriority                           3
2558   bool                                 MemoryCompressionEnable;
2559   uint32_t                             MemoryCompressionMode;
2560   uint32_t                             CacheSelect;
2561   uint32_t                             TiledResourceMode;
2562#define TRMODE_NONE                              0
2563#define TRMODE_TILEYF                            1
2564#define TRMODE_TILEYS                            2
2565};
2566
2567static inline void
2568GEN9_VDENC_SURFACE_CONTROL_BITS_pack(__attribute__((unused)) __gen_user_data *data,
2569                                     __attribute__((unused)) void * restrict dst,
2570                                     __attribute__((unused)) const struct GEN9_VDENC_SURFACE_CONTROL_BITS * restrict values)
2571{
2572   uint32_t * restrict dw = (uint32_t * restrict) dst;
2573
2574   dw[0] =
2575      __gen_uint(values->MOCS, 1, 6) |
2576      __gen_uint(values->ArbitrationPriorityControl, 7, 8) |
2577      __gen_uint(values->MemoryCompressionEnable, 9, 9) |
2578      __gen_uint(values->MemoryCompressionMode, 10, 10) |
2579      __gen_uint(values->CacheSelect, 12, 12) |
2580      __gen_uint(values->TiledResourceMode, 13, 14);
2581}
2582
2583#define GEN9_VDENC_PICTURE_length              3
2584struct GEN9_VDENC_PICTURE {
2585   __gen_address_type                   Address;
2586   struct GEN9_VDENC_SURFACE_CONTROL_BITS PictureFields;
2587};
2588
2589static inline void
2590GEN9_VDENC_PICTURE_pack(__attribute__((unused)) __gen_user_data *data,
2591                        __attribute__((unused)) void * restrict dst,
2592                        __attribute__((unused)) const struct GEN9_VDENC_PICTURE * restrict values)
2593{
2594   uint32_t * restrict dw = (uint32_t * restrict) dst;
2595
2596   const uint64_t v0_address =
2597      __gen_combine_address(data, &dw[0], values->Address, 0);
2598   dw[0] = v0_address;
2599   dw[1] = v0_address >> 32;
2600
2601   GEN9_VDENC_SURFACE_CONTROL_BITS_pack(data, &dw[2], &values->PictureFields);
2602}
2603
2604#define GEN9_VDENC_SURFACE_STATE_FIELDS_length      4
2605struct GEN9_VDENC_SURFACE_STATE_FIELDS {
2606   float                                CrVCbUPixelOffsetVDirection;
2607   bool                                 SurfaceFormatByteSwizzle;
2608   uint32_t                             Colorspaceselection;
2609   uint32_t                             Width;
2610   uint32_t                             Height;
2611   uint32_t                             TileWalk;
2612#define TW_XMAJOR                                0
2613#define TW_YMAJOR                                1
2614   uint32_t                             TiledSurface;
2615   bool                                 HalfPitchforChroma;
2616   uint32_t                             SurfacePitch;
2617   uint32_t                             Format;
2618   uint32_t                             SurfaceFormat;
2619#define VDENC_YUV422                             0
2620#define VDENC_RGBA4444                           1
2621#define VDENC_YUV444                             2
2622#define VDENC_Y8_UNORM                           3
2623#define VDENC_PLANAR_420_8                       4
2624   uint32_t                             YOffsetforUCb;
2625   uint32_t                             XOffsetforUCb;
2626   uint32_t                             YOffsetforVCr;
2627   uint32_t                             XOffsetforVCr;
2628};
2629
2630static inline void
2631GEN9_VDENC_SURFACE_STATE_FIELDS_pack(__attribute__((unused)) __gen_user_data *data,
2632                                     __attribute__((unused)) void * restrict dst,
2633                                     __attribute__((unused)) const struct GEN9_VDENC_SURFACE_STATE_FIELDS * restrict values)
2634{
2635   uint32_t * restrict dw = (uint32_t * restrict) dst;
2636
2637   dw[0] =
2638      __gen_ufixed(values->CrVCbUPixelOffsetVDirection, 0, 1, 2) |
2639      __gen_uint(values->SurfaceFormatByteSwizzle, 2, 2) |
2640      __gen_uint(values->Colorspaceselection, 3, 3) |
2641      __gen_uint(values->Width, 4, 17) |
2642      __gen_uint(values->Height, 18, 31);
2643
2644   dw[1] =
2645      __gen_uint(values->TileWalk, 0, 0) |
2646      __gen_uint(values->TiledSurface, 1, 1) |
2647      __gen_uint(values->HalfPitchforChroma, 2, 2) |
2648      __gen_uint(values->SurfacePitch, 3, 19) |
2649      __gen_uint(values->Format, 27, 31) |
2650      __gen_uint(values->SurfaceFormat, 28, 31);
2651
2652   dw[2] =
2653      __gen_uint(values->YOffsetforUCb, 0, 14) |
2654      __gen_uint(values->XOffsetforUCb, 16, 30);
2655
2656   dw[3] =
2657      __gen_uint(values->YOffsetforVCr, 0, 15) |
2658      __gen_uint(values->XOffsetforVCr, 16, 28);
2659}
2660
2661#define GEN9_VERTEX_BUFFER_STATE_length        4
2662struct GEN9_VERTEX_BUFFER_STATE {
2663   uint32_t                             BufferPitch;
2664   bool                                 NullVertexBuffer;
2665   bool                                 AddressModifyEnable;
2666   uint32_t                             MOCS;
2667   uint32_t                             VertexBufferIndex;
2668   __gen_address_type                   BufferStartingAddress;
2669   uint32_t                             BufferSize;
2670};
2671
2672static inline void
2673GEN9_VERTEX_BUFFER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
2674                              __attribute__((unused)) void * restrict dst,
2675                              __attribute__((unused)) const struct GEN9_VERTEX_BUFFER_STATE * restrict values)
2676{
2677   uint32_t * restrict dw = (uint32_t * restrict) dst;
2678
2679   dw[0] =
2680      __gen_uint(values->BufferPitch, 0, 11) |
2681      __gen_uint(values->NullVertexBuffer, 13, 13) |
2682      __gen_uint(values->AddressModifyEnable, 14, 14) |
2683      __gen_uint(values->MOCS, 16, 22) |
2684      __gen_uint(values->VertexBufferIndex, 26, 31);
2685
2686   const uint64_t v1_address =
2687      __gen_combine_address(data, &dw[1], values->BufferStartingAddress, 0);
2688   dw[1] = v1_address;
2689   dw[2] = v1_address >> 32;
2690
2691   dw[3] =
2692      __gen_uint(values->BufferSize, 0, 31);
2693}
2694
2695#define GEN9_VERTEX_ELEMENT_STATE_length       2
2696struct GEN9_VERTEX_ELEMENT_STATE {
2697   uint32_t                             SourceElementOffset;
2698   bool                                 EdgeFlagEnable;
2699   uint32_t                             SourceElementFormat;
2700   bool                                 Valid;
2701   uint32_t                             VertexBufferIndex;
2702   enum GEN9_3D_Vertex_Component_Control Component3Control;
2703   enum GEN9_3D_Vertex_Component_Control Component2Control;
2704   enum GEN9_3D_Vertex_Component_Control Component1Control;
2705   enum GEN9_3D_Vertex_Component_Control Component0Control;
2706};
2707
2708static inline void
2709GEN9_VERTEX_ELEMENT_STATE_pack(__attribute__((unused)) __gen_user_data *data,
2710                               __attribute__((unused)) void * restrict dst,
2711                               __attribute__((unused)) const struct GEN9_VERTEX_ELEMENT_STATE * restrict values)
2712{
2713   uint32_t * restrict dw = (uint32_t * restrict) dst;
2714
2715   dw[0] =
2716      __gen_uint(values->SourceElementOffset, 0, 11) |
2717      __gen_uint(values->EdgeFlagEnable, 15, 15) |
2718      __gen_uint(values->SourceElementFormat, 16, 24) |
2719      __gen_uint(values->Valid, 25, 25) |
2720      __gen_uint(values->VertexBufferIndex, 26, 31);
2721
2722   dw[1] =
2723      __gen_uint(values->Component3Control, 16, 18) |
2724      __gen_uint(values->Component2Control, 20, 22) |
2725      __gen_uint(values->Component1Control, 24, 26) |
2726      __gen_uint(values->Component0Control, 28, 30);
2727}
2728
2729#define GEN9_3DPRIMITIVE_length                7
2730#define GEN9_3DPRIMITIVE_length_bias           2
2731#define GEN9_3DPRIMITIVE_header                 \
2732   .DWordLength                         =      5,  \
2733   ._3DCommandSubOpcode                 =      0,  \
2734   ._3DCommandOpcode                    =      3,  \
2735   .CommandSubType                      =      3,  \
2736   .CommandType                         =      3
2737
2738struct GEN9_3DPRIMITIVE {
2739   uint32_t                             DWordLength;
2740   bool                                 PredicateEnable;
2741   bool                                 UAVCoherencyRequired;
2742   bool                                 IndirectParameterEnable;
2743   uint32_t                             _3DCommandSubOpcode;
2744   uint32_t                             _3DCommandOpcode;
2745   uint32_t                             CommandSubType;
2746   uint32_t                             CommandType;
2747   enum GEN9_3D_Prim_Topo_Type          PrimitiveTopologyType;
2748   uint32_t                             VertexAccessType;
2749#define SEQUENTIAL                               0
2750#define RANDOM                                   1
2751   bool                                 EndOffsetEnable;
2752   uint32_t                             VertexCountPerInstance;
2753   uint32_t                             StartVertexLocation;
2754   uint32_t                             InstanceCount;
2755   uint32_t                             StartInstanceLocation;
2756   int32_t                              BaseVertexLocation;
2757};
2758
2759static inline void
2760GEN9_3DPRIMITIVE_pack(__attribute__((unused)) __gen_user_data *data,
2761                      __attribute__((unused)) void * restrict dst,
2762                      __attribute__((unused)) const struct GEN9_3DPRIMITIVE * restrict values)
2763{
2764   uint32_t * restrict dw = (uint32_t * restrict) dst;
2765
2766   dw[0] =
2767      __gen_uint(values->DWordLength, 0, 7) |
2768      __gen_uint(values->PredicateEnable, 8, 8) |
2769      __gen_uint(values->UAVCoherencyRequired, 9, 9) |
2770      __gen_uint(values->IndirectParameterEnable, 10, 10) |
2771      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2772      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2773      __gen_uint(values->CommandSubType, 27, 28) |
2774      __gen_uint(values->CommandType, 29, 31);
2775
2776   dw[1] =
2777      __gen_uint(values->PrimitiveTopologyType, 0, 5) |
2778      __gen_uint(values->VertexAccessType, 8, 8) |
2779      __gen_uint(values->EndOffsetEnable, 9, 9);
2780
2781   dw[2] =
2782      __gen_uint(values->VertexCountPerInstance, 0, 31);
2783
2784   dw[3] =
2785      __gen_uint(values->StartVertexLocation, 0, 31);
2786
2787   dw[4] =
2788      __gen_uint(values->InstanceCount, 0, 31);
2789
2790   dw[5] =
2791      __gen_uint(values->StartInstanceLocation, 0, 31);
2792
2793   dw[6] =
2794      __gen_sint(values->BaseVertexLocation, 0, 31);
2795}
2796
2797#define GEN9_3DSTATE_AA_LINE_PARAMETERS_length      3
2798#define GEN9_3DSTATE_AA_LINE_PARAMETERS_length_bias      2
2799#define GEN9_3DSTATE_AA_LINE_PARAMETERS_header  \
2800   .DWordLength                         =      1,  \
2801   ._3DCommandSubOpcode                 =     10,  \
2802   ._3DCommandOpcode                    =      1,  \
2803   .CommandSubType                      =      3,  \
2804   .CommandType                         =      3
2805
2806struct GEN9_3DSTATE_AA_LINE_PARAMETERS {
2807   uint32_t                             DWordLength;
2808   uint32_t                             _3DCommandSubOpcode;
2809   uint32_t                             _3DCommandOpcode;
2810   uint32_t                             CommandSubType;
2811   uint32_t                             CommandType;
2812   float                                AACoverageSlope;
2813   float                                AAPointCoverageSlope;
2814   float                                AACoverageBias;
2815   float                                AAPointCoverageBias;
2816   float                                AACoverageEndCapSlope;
2817   float                                AAPointCoverageEndCapSlope;
2818   float                                AACoverageEndCapBias;
2819   float                                AAPointCoverageEndCapBias;
2820};
2821
2822static inline void
2823GEN9_3DSTATE_AA_LINE_PARAMETERS_pack(__attribute__((unused)) __gen_user_data *data,
2824                                     __attribute__((unused)) void * restrict dst,
2825                                     __attribute__((unused)) const struct GEN9_3DSTATE_AA_LINE_PARAMETERS * restrict values)
2826{
2827   uint32_t * restrict dw = (uint32_t * restrict) dst;
2828
2829   dw[0] =
2830      __gen_uint(values->DWordLength, 0, 7) |
2831      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2832      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2833      __gen_uint(values->CommandSubType, 27, 28) |
2834      __gen_uint(values->CommandType, 29, 31);
2835
2836   dw[1] =
2837      __gen_ufixed(values->AACoverageSlope, 0, 7, 8) |
2838      __gen_ufixed(values->AAPointCoverageSlope, 8, 15, 8) |
2839      __gen_ufixed(values->AACoverageBias, 16, 23, 8) |
2840      __gen_ufixed(values->AAPointCoverageBias, 24, 31, 8);
2841
2842   dw[2] =
2843      __gen_ufixed(values->AACoverageEndCapSlope, 0, 7, 8) |
2844      __gen_ufixed(values->AAPointCoverageEndCapSlope, 8, 15, 8) |
2845      __gen_ufixed(values->AACoverageEndCapBias, 16, 23, 8) |
2846      __gen_ufixed(values->AAPointCoverageEndCapBias, 24, 31, 8);
2847}
2848
2849#define GEN9_3DSTATE_BINDING_TABLE_EDIT_DS_length_bias      2
2850#define GEN9_3DSTATE_BINDING_TABLE_EDIT_DS_header\
2851   .DWordLength                         =      0,  \
2852   ._3DCommandSubOpcode                 =     70,  \
2853   ._3DCommandOpcode                    =      0,  \
2854   .CommandSubType                      =      3,  \
2855   .CommandType                         =      3
2856
2857struct GEN9_3DSTATE_BINDING_TABLE_EDIT_DS {
2858   uint32_t                             DWordLength;
2859   uint32_t                             _3DCommandSubOpcode;
2860   uint32_t                             _3DCommandOpcode;
2861   uint32_t                             CommandSubType;
2862   uint32_t                             CommandType;
2863   uint32_t                             BindingTableEditTarget;
2864#define AllCores                                 3
2865#define Core1                                    2
2866#define Core0                                    1
2867   uint32_t                             BindingTableBlockClear;
2868   /* variable length fields follow */
2869};
2870
2871static inline void
2872GEN9_3DSTATE_BINDING_TABLE_EDIT_DS_pack(__attribute__((unused)) __gen_user_data *data,
2873                                        __attribute__((unused)) void * restrict dst,
2874                                        __attribute__((unused)) const struct GEN9_3DSTATE_BINDING_TABLE_EDIT_DS * restrict values)
2875{
2876   uint32_t * restrict dw = (uint32_t * restrict) dst;
2877
2878   dw[0] =
2879      __gen_uint(values->DWordLength, 0, 8) |
2880      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2881      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2882      __gen_uint(values->CommandSubType, 27, 28) |
2883      __gen_uint(values->CommandType, 29, 31);
2884
2885   dw[1] =
2886      __gen_uint(values->BindingTableEditTarget, 0, 1) |
2887      __gen_uint(values->BindingTableBlockClear, 16, 31);
2888}
2889
2890#define GEN9_3DSTATE_BINDING_TABLE_EDIT_GS_length_bias      2
2891#define GEN9_3DSTATE_BINDING_TABLE_EDIT_GS_header\
2892   .DWordLength                         =      0,  \
2893   ._3DCommandSubOpcode                 =     68,  \
2894   ._3DCommandOpcode                    =      0,  \
2895   .CommandSubType                      =      3,  \
2896   .CommandType                         =      3
2897
2898struct GEN9_3DSTATE_BINDING_TABLE_EDIT_GS {
2899   uint32_t                             DWordLength;
2900   uint32_t                             _3DCommandSubOpcode;
2901   uint32_t                             _3DCommandOpcode;
2902   uint32_t                             CommandSubType;
2903   uint32_t                             CommandType;
2904   uint32_t                             BindingTableEditTarget;
2905#define AllCores                                 3
2906#define Core1                                    2
2907#define Core0                                    1
2908   uint32_t                             BindingTableBlockClear;
2909   /* variable length fields follow */
2910};
2911
2912static inline void
2913GEN9_3DSTATE_BINDING_TABLE_EDIT_GS_pack(__attribute__((unused)) __gen_user_data *data,
2914                                        __attribute__((unused)) void * restrict dst,
2915                                        __attribute__((unused)) const struct GEN9_3DSTATE_BINDING_TABLE_EDIT_GS * restrict values)
2916{
2917   uint32_t * restrict dw = (uint32_t * restrict) dst;
2918
2919   dw[0] =
2920      __gen_uint(values->DWordLength, 0, 8) |
2921      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2922      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2923      __gen_uint(values->CommandSubType, 27, 28) |
2924      __gen_uint(values->CommandType, 29, 31);
2925
2926   dw[1] =
2927      __gen_uint(values->BindingTableEditTarget, 0, 1) |
2928      __gen_uint(values->BindingTableBlockClear, 16, 31);
2929}
2930
2931#define GEN9_3DSTATE_BINDING_TABLE_EDIT_HS_length_bias      2
2932#define GEN9_3DSTATE_BINDING_TABLE_EDIT_HS_header\
2933   .DWordLength                         =      0,  \
2934   ._3DCommandSubOpcode                 =     69,  \
2935   ._3DCommandOpcode                    =      0,  \
2936   .CommandSubType                      =      3,  \
2937   .CommandType                         =      3
2938
2939struct GEN9_3DSTATE_BINDING_TABLE_EDIT_HS {
2940   uint32_t                             DWordLength;
2941   uint32_t                             _3DCommandSubOpcode;
2942   uint32_t                             _3DCommandOpcode;
2943   uint32_t                             CommandSubType;
2944   uint32_t                             CommandType;
2945   uint32_t                             BindingTableEditTarget;
2946#define AllCores                                 3
2947#define Core1                                    2
2948#define Core0                                    1
2949   uint32_t                             BindingTableBlockClear;
2950   /* variable length fields follow */
2951};
2952
2953static inline void
2954GEN9_3DSTATE_BINDING_TABLE_EDIT_HS_pack(__attribute__((unused)) __gen_user_data *data,
2955                                        __attribute__((unused)) void * restrict dst,
2956                                        __attribute__((unused)) const struct GEN9_3DSTATE_BINDING_TABLE_EDIT_HS * restrict values)
2957{
2958   uint32_t * restrict dw = (uint32_t * restrict) dst;
2959
2960   dw[0] =
2961      __gen_uint(values->DWordLength, 0, 8) |
2962      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2963      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2964      __gen_uint(values->CommandSubType, 27, 28) |
2965      __gen_uint(values->CommandType, 29, 31);
2966
2967   dw[1] =
2968      __gen_uint(values->BindingTableEditTarget, 0, 1) |
2969      __gen_uint(values->BindingTableBlockClear, 16, 31);
2970}
2971
2972#define GEN9_3DSTATE_BINDING_TABLE_EDIT_PS_length_bias      2
2973#define GEN9_3DSTATE_BINDING_TABLE_EDIT_PS_header\
2974   .DWordLength                         =      0,  \
2975   ._3DCommandSubOpcode                 =     71,  \
2976   ._3DCommandOpcode                    =      0,  \
2977   .CommandSubType                      =      3,  \
2978   .CommandType                         =      3
2979
2980struct GEN9_3DSTATE_BINDING_TABLE_EDIT_PS {
2981   uint32_t                             DWordLength;
2982   uint32_t                             _3DCommandSubOpcode;
2983   uint32_t                             _3DCommandOpcode;
2984   uint32_t                             CommandSubType;
2985   uint32_t                             CommandType;
2986   uint32_t                             BindingTableEditTarget;
2987#define AllCores                                 3
2988#define Core1                                    2
2989#define Core0                                    1
2990   uint32_t                             BindingTableBlockClear;
2991   /* variable length fields follow */
2992};
2993
2994static inline void
2995GEN9_3DSTATE_BINDING_TABLE_EDIT_PS_pack(__attribute__((unused)) __gen_user_data *data,
2996                                        __attribute__((unused)) void * restrict dst,
2997                                        __attribute__((unused)) const struct GEN9_3DSTATE_BINDING_TABLE_EDIT_PS * restrict values)
2998{
2999   uint32_t * restrict dw = (uint32_t * restrict) dst;
3000
3001   dw[0] =
3002      __gen_uint(values->DWordLength, 0, 8) |
3003      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3004      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3005      __gen_uint(values->CommandSubType, 27, 28) |
3006      __gen_uint(values->CommandType, 29, 31);
3007
3008   dw[1] =
3009      __gen_uint(values->BindingTableEditTarget, 0, 1) |
3010      __gen_uint(values->BindingTableBlockClear, 16, 31);
3011}
3012
3013#define GEN9_3DSTATE_BINDING_TABLE_EDIT_VS_length_bias      2
3014#define GEN9_3DSTATE_BINDING_TABLE_EDIT_VS_header\
3015   .DWordLength                         =      0,  \
3016   ._3DCommandSubOpcode                 =     67,  \
3017   ._3DCommandOpcode                    =      0,  \
3018   .CommandSubType                      =      3,  \
3019   .CommandType                         =      3
3020
3021struct GEN9_3DSTATE_BINDING_TABLE_EDIT_VS {
3022   uint32_t                             DWordLength;
3023   uint32_t                             _3DCommandSubOpcode;
3024   uint32_t                             _3DCommandOpcode;
3025   uint32_t                             CommandSubType;
3026   uint32_t                             CommandType;
3027   uint32_t                             BindingTableEditTarget;
3028#define AllCores                                 3
3029#define Core1                                    2
3030#define Core0                                    1
3031   uint32_t                             BindingTableBlockClear;
3032   /* variable length fields follow */
3033};
3034
3035static inline void
3036GEN9_3DSTATE_BINDING_TABLE_EDIT_VS_pack(__attribute__((unused)) __gen_user_data *data,
3037                                        __attribute__((unused)) void * restrict dst,
3038                                        __attribute__((unused)) const struct GEN9_3DSTATE_BINDING_TABLE_EDIT_VS * restrict values)
3039{
3040   uint32_t * restrict dw = (uint32_t * restrict) dst;
3041
3042   dw[0] =
3043      __gen_uint(values->DWordLength, 0, 8) |
3044      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3045      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3046      __gen_uint(values->CommandSubType, 27, 28) |
3047      __gen_uint(values->CommandType, 29, 31);
3048
3049   dw[1] =
3050      __gen_uint(values->BindingTableEditTarget, 0, 1) |
3051      __gen_uint(values->BindingTableBlockClear, 16, 31);
3052}
3053
3054#define GEN9_3DSTATE_BINDING_TABLE_POINTERS_DS_length      2
3055#define GEN9_3DSTATE_BINDING_TABLE_POINTERS_DS_length_bias      2
3056#define GEN9_3DSTATE_BINDING_TABLE_POINTERS_DS_header\
3057   .DWordLength                         =      0,  \
3058   ._3DCommandSubOpcode                 =     40,  \
3059   ._3DCommandOpcode                    =      0,  \
3060   .CommandSubType                      =      3,  \
3061   .CommandType                         =      3
3062
3063struct GEN9_3DSTATE_BINDING_TABLE_POINTERS_DS {
3064   uint32_t                             DWordLength;
3065   uint32_t                             _3DCommandSubOpcode;
3066   uint32_t                             _3DCommandOpcode;
3067   uint32_t                             CommandSubType;
3068   uint32_t                             CommandType;
3069   uint64_t                             PointertoDSBindingTable;
3070};
3071
3072static inline void
3073GEN9_3DSTATE_BINDING_TABLE_POINTERS_DS_pack(__attribute__((unused)) __gen_user_data *data,
3074                                            __attribute__((unused)) void * restrict dst,
3075                                            __attribute__((unused)) const struct GEN9_3DSTATE_BINDING_TABLE_POINTERS_DS * restrict values)
3076{
3077   uint32_t * restrict dw = (uint32_t * restrict) dst;
3078
3079   dw[0] =
3080      __gen_uint(values->DWordLength, 0, 7) |
3081      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3082      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3083      __gen_uint(values->CommandSubType, 27, 28) |
3084      __gen_uint(values->CommandType, 29, 31);
3085
3086   dw[1] =
3087      __gen_offset(values->PointertoDSBindingTable, 5, 15);
3088}
3089
3090#define GEN9_3DSTATE_BINDING_TABLE_POINTERS_GS_length      2
3091#define GEN9_3DSTATE_BINDING_TABLE_POINTERS_GS_length_bias      2
3092#define GEN9_3DSTATE_BINDING_TABLE_POINTERS_GS_header\
3093   .DWordLength                         =      0,  \
3094   ._3DCommandSubOpcode                 =     41,  \
3095   ._3DCommandOpcode                    =      0,  \
3096   .CommandSubType                      =      3,  \
3097   .CommandType                         =      3
3098
3099struct GEN9_3DSTATE_BINDING_TABLE_POINTERS_GS {
3100   uint32_t                             DWordLength;
3101   uint32_t                             _3DCommandSubOpcode;
3102   uint32_t                             _3DCommandOpcode;
3103   uint32_t                             CommandSubType;
3104   uint32_t                             CommandType;
3105   uint64_t                             PointertoGSBindingTable;
3106};
3107
3108static inline void
3109GEN9_3DSTATE_BINDING_TABLE_POINTERS_GS_pack(__attribute__((unused)) __gen_user_data *data,
3110                                            __attribute__((unused)) void * restrict dst,
3111                                            __attribute__((unused)) const struct GEN9_3DSTATE_BINDING_TABLE_POINTERS_GS * restrict values)
3112{
3113   uint32_t * restrict dw = (uint32_t * restrict) dst;
3114
3115   dw[0] =
3116      __gen_uint(values->DWordLength, 0, 7) |
3117      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3118      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3119      __gen_uint(values->CommandSubType, 27, 28) |
3120      __gen_uint(values->CommandType, 29, 31);
3121
3122   dw[1] =
3123      __gen_offset(values->PointertoGSBindingTable, 5, 15);
3124}
3125
3126#define GEN9_3DSTATE_BINDING_TABLE_POINTERS_HS_length      2
3127#define GEN9_3DSTATE_BINDING_TABLE_POINTERS_HS_length_bias      2
3128#define GEN9_3DSTATE_BINDING_TABLE_POINTERS_HS_header\
3129   .DWordLength                         =      0,  \
3130   ._3DCommandSubOpcode                 =     39,  \
3131   ._3DCommandOpcode                    =      0,  \
3132   .CommandSubType                      =      3,  \
3133   .CommandType                         =      3
3134
3135struct GEN9_3DSTATE_BINDING_TABLE_POINTERS_HS {
3136   uint32_t                             DWordLength;
3137   uint32_t                             _3DCommandSubOpcode;
3138   uint32_t                             _3DCommandOpcode;
3139   uint32_t                             CommandSubType;
3140   uint32_t                             CommandType;
3141   uint64_t                             PointertoHSBindingTable;
3142};
3143
3144static inline void
3145GEN9_3DSTATE_BINDING_TABLE_POINTERS_HS_pack(__attribute__((unused)) __gen_user_data *data,
3146                                            __attribute__((unused)) void * restrict dst,
3147                                            __attribute__((unused)) const struct GEN9_3DSTATE_BINDING_TABLE_POINTERS_HS * restrict values)
3148{
3149   uint32_t * restrict dw = (uint32_t * restrict) dst;
3150
3151   dw[0] =
3152      __gen_uint(values->DWordLength, 0, 7) |
3153      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3154      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3155      __gen_uint(values->CommandSubType, 27, 28) |
3156      __gen_uint(values->CommandType, 29, 31);
3157
3158   dw[1] =
3159      __gen_offset(values->PointertoHSBindingTable, 5, 15);
3160}
3161
3162#define GEN9_3DSTATE_BINDING_TABLE_POINTERS_PS_length      2
3163#define GEN9_3DSTATE_BINDING_TABLE_POINTERS_PS_length_bias      2
3164#define GEN9_3DSTATE_BINDING_TABLE_POINTERS_PS_header\
3165   .DWordLength                         =      0,  \
3166   ._3DCommandSubOpcode                 =     42,  \
3167   ._3DCommandOpcode                    =      0,  \
3168   .CommandSubType                      =      3,  \
3169   .CommandType                         =      3
3170
3171struct GEN9_3DSTATE_BINDING_TABLE_POINTERS_PS {
3172   uint32_t                             DWordLength;
3173   uint32_t                             _3DCommandSubOpcode;
3174   uint32_t                             _3DCommandOpcode;
3175   uint32_t                             CommandSubType;
3176   uint32_t                             CommandType;
3177   uint64_t                             PointertoPSBindingTable;
3178};
3179
3180static inline void
3181GEN9_3DSTATE_BINDING_TABLE_POINTERS_PS_pack(__attribute__((unused)) __gen_user_data *data,
3182                                            __attribute__((unused)) void * restrict dst,
3183                                            __attribute__((unused)) const struct GEN9_3DSTATE_BINDING_TABLE_POINTERS_PS * restrict values)
3184{
3185   uint32_t * restrict dw = (uint32_t * restrict) dst;
3186
3187   dw[0] =
3188      __gen_uint(values->DWordLength, 0, 7) |
3189      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3190      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3191      __gen_uint(values->CommandSubType, 27, 28) |
3192      __gen_uint(values->CommandType, 29, 31);
3193
3194   dw[1] =
3195      __gen_offset(values->PointertoPSBindingTable, 5, 15);
3196}
3197
3198#define GEN9_3DSTATE_BINDING_TABLE_POINTERS_VS_length      2
3199#define GEN9_3DSTATE_BINDING_TABLE_POINTERS_VS_length_bias      2
3200#define GEN9_3DSTATE_BINDING_TABLE_POINTERS_VS_header\
3201   .DWordLength                         =      0,  \
3202   ._3DCommandSubOpcode                 =     38,  \
3203   ._3DCommandOpcode                    =      0,  \
3204   .CommandSubType                      =      3,  \
3205   .CommandType                         =      3
3206
3207struct GEN9_3DSTATE_BINDING_TABLE_POINTERS_VS {
3208   uint32_t                             DWordLength;
3209   uint32_t                             _3DCommandSubOpcode;
3210   uint32_t                             _3DCommandOpcode;
3211   uint32_t                             CommandSubType;
3212   uint32_t                             CommandType;
3213   uint64_t                             PointertoVSBindingTable;
3214};
3215
3216static inline void
3217GEN9_3DSTATE_BINDING_TABLE_POINTERS_VS_pack(__attribute__((unused)) __gen_user_data *data,
3218                                            __attribute__((unused)) void * restrict dst,
3219                                            __attribute__((unused)) const struct GEN9_3DSTATE_BINDING_TABLE_POINTERS_VS * restrict values)
3220{
3221   uint32_t * restrict dw = (uint32_t * restrict) dst;
3222
3223   dw[0] =
3224      __gen_uint(values->DWordLength, 0, 7) |
3225      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3226      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3227      __gen_uint(values->CommandSubType, 27, 28) |
3228      __gen_uint(values->CommandType, 29, 31);
3229
3230   dw[1] =
3231      __gen_offset(values->PointertoVSBindingTable, 5, 15);
3232}
3233
3234#define GEN9_3DSTATE_BINDING_TABLE_POOL_ALLOC_length      4
3235#define GEN9_3DSTATE_BINDING_TABLE_POOL_ALLOC_length_bias      2
3236#define GEN9_3DSTATE_BINDING_TABLE_POOL_ALLOC_header\
3237   .DWordLength                         =      2,  \
3238   ._3DCommandSubOpcode                 =     25,  \
3239   ._3DCommandOpcode                    =      1,  \
3240   .CommandSubType                      =      3,  \
3241   .CommandType                         =      3
3242
3243struct GEN9_3DSTATE_BINDING_TABLE_POOL_ALLOC {
3244   uint32_t                             DWordLength;
3245   uint32_t                             _3DCommandSubOpcode;
3246   uint32_t                             _3DCommandOpcode;
3247   uint32_t                             CommandSubType;
3248   uint32_t                             CommandType;
3249   uint32_t                             MOCS;
3250   uint32_t                             BindingTablePoolEnable;
3251   __gen_address_type                   BindingTablePoolBaseAddress;
3252   uint32_t                             BindingTablePoolBufferSize;
3253#define NoValidData                              0
3254};
3255
3256static inline void
3257GEN9_3DSTATE_BINDING_TABLE_POOL_ALLOC_pack(__attribute__((unused)) __gen_user_data *data,
3258                                           __attribute__((unused)) void * restrict dst,
3259                                           __attribute__((unused)) const struct GEN9_3DSTATE_BINDING_TABLE_POOL_ALLOC * restrict values)
3260{
3261   uint32_t * restrict dw = (uint32_t * restrict) dst;
3262
3263   dw[0] =
3264      __gen_uint(values->DWordLength, 0, 7) |
3265      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3266      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3267      __gen_uint(values->CommandSubType, 27, 28) |
3268      __gen_uint(values->CommandType, 29, 31);
3269
3270   const uint64_t v1 =
3271      __gen_uint(values->MOCS, 0, 6) |
3272      __gen_uint(values->BindingTablePoolEnable, 11, 11);
3273   const uint64_t v1_address =
3274      __gen_combine_address(data, &dw[1], values->BindingTablePoolBaseAddress, v1);
3275   dw[1] = v1_address;
3276   dw[2] = (v1_address >> 32) | (v1 >> 32);
3277
3278   dw[3] =
3279      __gen_uint(values->BindingTablePoolBufferSize, 12, 31);
3280}
3281
3282#define GEN9_3DSTATE_BLEND_STATE_POINTERS_length      2
3283#define GEN9_3DSTATE_BLEND_STATE_POINTERS_length_bias      2
3284#define GEN9_3DSTATE_BLEND_STATE_POINTERS_header\
3285   .DWordLength                         =      0,  \
3286   ._3DCommandSubOpcode                 =     36,  \
3287   ._3DCommandOpcode                    =      0,  \
3288   .CommandSubType                      =      3,  \
3289   .CommandType                         =      3
3290
3291struct GEN9_3DSTATE_BLEND_STATE_POINTERS {
3292   uint32_t                             DWordLength;
3293   uint32_t                             _3DCommandSubOpcode;
3294   uint32_t                             _3DCommandOpcode;
3295   uint32_t                             CommandSubType;
3296   uint32_t                             CommandType;
3297   bool                                 BlendStatePointerValid;
3298   uint64_t                             BlendStatePointer;
3299};
3300
3301static inline void
3302GEN9_3DSTATE_BLEND_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
3303                                       __attribute__((unused)) void * restrict dst,
3304                                       __attribute__((unused)) const struct GEN9_3DSTATE_BLEND_STATE_POINTERS * restrict values)
3305{
3306   uint32_t * restrict dw = (uint32_t * restrict) dst;
3307
3308   dw[0] =
3309      __gen_uint(values->DWordLength, 0, 7) |
3310      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3311      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3312      __gen_uint(values->CommandSubType, 27, 28) |
3313      __gen_uint(values->CommandType, 29, 31);
3314
3315   dw[1] =
3316      __gen_uint(values->BlendStatePointerValid, 0, 0) |
3317      __gen_offset(values->BlendStatePointer, 6, 31);
3318}
3319
3320#define GEN9_3DSTATE_CC_STATE_POINTERS_length      2
3321#define GEN9_3DSTATE_CC_STATE_POINTERS_length_bias      2
3322#define GEN9_3DSTATE_CC_STATE_POINTERS_header   \
3323   .DWordLength                         =      0,  \
3324   ._3DCommandSubOpcode                 =     14,  \
3325   ._3DCommandOpcode                    =      0,  \
3326   .CommandSubType                      =      3,  \
3327   .CommandType                         =      3
3328
3329struct GEN9_3DSTATE_CC_STATE_POINTERS {
3330   uint32_t                             DWordLength;
3331   uint32_t                             _3DCommandSubOpcode;
3332   uint32_t                             _3DCommandOpcode;
3333   uint32_t                             CommandSubType;
3334   uint32_t                             CommandType;
3335   bool                                 ColorCalcStatePointerValid;
3336   uint64_t                             ColorCalcStatePointer;
3337};
3338
3339static inline void
3340GEN9_3DSTATE_CC_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
3341                                    __attribute__((unused)) void * restrict dst,
3342                                    __attribute__((unused)) const struct GEN9_3DSTATE_CC_STATE_POINTERS * restrict values)
3343{
3344   uint32_t * restrict dw = (uint32_t * restrict) dst;
3345
3346   dw[0] =
3347      __gen_uint(values->DWordLength, 0, 7) |
3348      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3349      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3350      __gen_uint(values->CommandSubType, 27, 28) |
3351      __gen_uint(values->CommandType, 29, 31);
3352
3353   dw[1] =
3354      __gen_uint(values->ColorCalcStatePointerValid, 0, 0) |
3355      __gen_offset(values->ColorCalcStatePointer, 6, 31);
3356}
3357
3358#define GEN9_3DSTATE_CHROMA_KEY_length         4
3359#define GEN9_3DSTATE_CHROMA_KEY_length_bias      2
3360#define GEN9_3DSTATE_CHROMA_KEY_header          \
3361   .DWordLength                         =      2,  \
3362   ._3DCommandSubOpcode                 =      4,  \
3363   ._3DCommandOpcode                    =      1,  \
3364   .CommandSubType                      =      3,  \
3365   .CommandType                         =      3
3366
3367struct GEN9_3DSTATE_CHROMA_KEY {
3368   uint32_t                             DWordLength;
3369   uint32_t                             _3DCommandSubOpcode;
3370   uint32_t                             _3DCommandOpcode;
3371   uint32_t                             CommandSubType;
3372   uint32_t                             CommandType;
3373   uint32_t                             ChromaKeyTableIndex;
3374   uint32_t                             ChromaKeyLowValue;
3375   uint32_t                             ChromaKeyHighValue;
3376};
3377
3378static inline void
3379GEN9_3DSTATE_CHROMA_KEY_pack(__attribute__((unused)) __gen_user_data *data,
3380                             __attribute__((unused)) void * restrict dst,
3381                             __attribute__((unused)) const struct GEN9_3DSTATE_CHROMA_KEY * restrict values)
3382{
3383   uint32_t * restrict dw = (uint32_t * restrict) dst;
3384
3385   dw[0] =
3386      __gen_uint(values->DWordLength, 0, 7) |
3387      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3388      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3389      __gen_uint(values->CommandSubType, 27, 28) |
3390      __gen_uint(values->CommandType, 29, 31);
3391
3392   dw[1] =
3393      __gen_uint(values->ChromaKeyTableIndex, 30, 31);
3394
3395   dw[2] =
3396      __gen_uint(values->ChromaKeyLowValue, 0, 31);
3397
3398   dw[3] =
3399      __gen_uint(values->ChromaKeyHighValue, 0, 31);
3400}
3401
3402#define GEN9_3DSTATE_CLEAR_PARAMS_length       3
3403#define GEN9_3DSTATE_CLEAR_PARAMS_length_bias      2
3404#define GEN9_3DSTATE_CLEAR_PARAMS_header        \
3405   .DWordLength                         =      1,  \
3406   ._3DCommandSubOpcode                 =      4,  \
3407   ._3DCommandOpcode                    =      0,  \
3408   .CommandSubType                      =      3,  \
3409   .CommandType                         =      3
3410
3411struct GEN9_3DSTATE_CLEAR_PARAMS {
3412   uint32_t                             DWordLength;
3413   uint32_t                             _3DCommandSubOpcode;
3414   uint32_t                             _3DCommandOpcode;
3415   uint32_t                             CommandSubType;
3416   uint32_t                             CommandType;
3417   float                                DepthClearValue;
3418   bool                                 DepthClearValueValid;
3419};
3420
3421static inline void
3422GEN9_3DSTATE_CLEAR_PARAMS_pack(__attribute__((unused)) __gen_user_data *data,
3423                               __attribute__((unused)) void * restrict dst,
3424                               __attribute__((unused)) const struct GEN9_3DSTATE_CLEAR_PARAMS * restrict values)
3425{
3426   uint32_t * restrict dw = (uint32_t * restrict) dst;
3427
3428   dw[0] =
3429      __gen_uint(values->DWordLength, 0, 7) |
3430      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3431      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3432      __gen_uint(values->CommandSubType, 27, 28) |
3433      __gen_uint(values->CommandType, 29, 31);
3434
3435   dw[1] =
3436      __gen_float(values->DepthClearValue);
3437
3438   dw[2] =
3439      __gen_uint(values->DepthClearValueValid, 0, 0);
3440}
3441
3442#define GEN9_3DSTATE_CLIP_length               4
3443#define GEN9_3DSTATE_CLIP_length_bias          2
3444#define GEN9_3DSTATE_CLIP_header                \
3445   .DWordLength                         =      2,  \
3446   ._3DCommandSubOpcode                 =     18,  \
3447   ._3DCommandOpcode                    =      0,  \
3448   .CommandSubType                      =      3,  \
3449   .CommandType                         =      3
3450
3451struct GEN9_3DSTATE_CLIP {
3452   uint32_t                             DWordLength;
3453   uint32_t                             _3DCommandSubOpcode;
3454   uint32_t                             _3DCommandOpcode;
3455   uint32_t                             CommandSubType;
3456   uint32_t                             CommandType;
3457   uint32_t                             UserClipDistanceCullTestEnableBitmask;
3458   bool                                 StatisticsEnable;
3459   bool                                 ForceClipMode;
3460   bool                                 ForceUserClipDistanceClipTestEnableBitmask;
3461   bool                                 EarlyCullEnable;
3462   uint32_t                             VertexSubPixelPrecisionSelect;
3463#define _8Bit                                    0
3464#define _4Bit                                    1
3465   bool                                 ForceUserClipDistanceCullTestEnableBitmask;
3466   uint32_t                             TriangleFanProvokingVertexSelect;
3467   uint32_t                             LineStripListProvokingVertexSelect;
3468   uint32_t                             TriangleStripListProvokingVertexSelect;
3469   bool                                 NonPerspectiveBarycentricEnable;
3470   bool                                 PerspectiveDivideDisable;
3471   uint32_t                             ClipMode;
3472#define CLIPMODE_NORMAL                          0
3473#define CLIPMODE_REJECT_ALL                      3
3474#define CLIPMODE_ACCEPT_ALL                      4
3475   uint32_t                             UserClipDistanceClipTestEnableBitmask;
3476   bool                                 GuardbandClipTestEnable;
3477   bool                                 ViewportXYClipTestEnable;
3478   uint32_t                             APIMode;
3479#define APIMODE_OGL                              0
3480#define APIMODE_D3D                              1
3481   bool                                 ClipEnable;
3482   uint32_t                             MaximumVPIndex;
3483   bool                                 ForceZeroRTAIndexEnable;
3484   float                                MaximumPointWidth;
3485   float                                MinimumPointWidth;
3486};
3487
3488static inline void
3489GEN9_3DSTATE_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
3490                       __attribute__((unused)) void * restrict dst,
3491                       __attribute__((unused)) const struct GEN9_3DSTATE_CLIP * restrict values)
3492{
3493   uint32_t * restrict dw = (uint32_t * restrict) dst;
3494
3495   dw[0] =
3496      __gen_uint(values->DWordLength, 0, 7) |
3497      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3498      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3499      __gen_uint(values->CommandSubType, 27, 28) |
3500      __gen_uint(values->CommandType, 29, 31);
3501
3502   dw[1] =
3503      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
3504      __gen_uint(values->StatisticsEnable, 10, 10) |
3505      __gen_uint(values->ForceClipMode, 16, 16) |
3506      __gen_uint(values->ForceUserClipDistanceClipTestEnableBitmask, 17, 17) |
3507      __gen_uint(values->EarlyCullEnable, 18, 18) |
3508      __gen_uint(values->VertexSubPixelPrecisionSelect, 19, 19) |
3509      __gen_uint(values->ForceUserClipDistanceCullTestEnableBitmask, 20, 20);
3510
3511   dw[2] =
3512      __gen_uint(values->TriangleFanProvokingVertexSelect, 0, 1) |
3513      __gen_uint(values->LineStripListProvokingVertexSelect, 2, 3) |
3514      __gen_uint(values->TriangleStripListProvokingVertexSelect, 4, 5) |
3515      __gen_uint(values->NonPerspectiveBarycentricEnable, 8, 8) |
3516      __gen_uint(values->PerspectiveDivideDisable, 9, 9) |
3517      __gen_uint(values->ClipMode, 13, 15) |
3518      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 16, 23) |
3519      __gen_uint(values->GuardbandClipTestEnable, 26, 26) |
3520      __gen_uint(values->ViewportXYClipTestEnable, 28, 28) |
3521      __gen_uint(values->APIMode, 30, 30) |
3522      __gen_uint(values->ClipEnable, 31, 31);
3523
3524   dw[3] =
3525      __gen_uint(values->MaximumVPIndex, 0, 3) |
3526      __gen_uint(values->ForceZeroRTAIndexEnable, 5, 5) |
3527      __gen_ufixed(values->MaximumPointWidth, 6, 16, 3) |
3528      __gen_ufixed(values->MinimumPointWidth, 17, 27, 3);
3529}
3530
3531#define GEN9_3DSTATE_CONSTANT_DS_length       11
3532#define GEN9_3DSTATE_CONSTANT_DS_length_bias      2
3533#define GEN9_3DSTATE_CONSTANT_DS_header         \
3534   .DWordLength                         =      9,  \
3535   ._3DCommandSubOpcode                 =     26,  \
3536   ._3DCommandOpcode                    =      0,  \
3537   .CommandSubType                      =      3,  \
3538   .CommandType                         =      3
3539
3540struct GEN9_3DSTATE_CONSTANT_DS {
3541   uint32_t                             DWordLength;
3542   uint32_t                             MOCS;
3543   uint32_t                             _3DCommandSubOpcode;
3544   uint32_t                             _3DCommandOpcode;
3545   uint32_t                             CommandSubType;
3546   uint32_t                             CommandType;
3547   struct GEN9_3DSTATE_CONSTANT_BODY    ConstantBody;
3548};
3549
3550static inline void
3551GEN9_3DSTATE_CONSTANT_DS_pack(__attribute__((unused)) __gen_user_data *data,
3552                              __attribute__((unused)) void * restrict dst,
3553                              __attribute__((unused)) const struct GEN9_3DSTATE_CONSTANT_DS * restrict values)
3554{
3555   uint32_t * restrict dw = (uint32_t * restrict) dst;
3556
3557   dw[0] =
3558      __gen_uint(values->DWordLength, 0, 7) |
3559      __gen_uint(values->MOCS, 8, 14) |
3560      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3561      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3562      __gen_uint(values->CommandSubType, 27, 28) |
3563      __gen_uint(values->CommandType, 29, 31);
3564
3565   GEN9_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
3566}
3567
3568#define GEN9_3DSTATE_CONSTANT_GS_length       11
3569#define GEN9_3DSTATE_CONSTANT_GS_length_bias      2
3570#define GEN9_3DSTATE_CONSTANT_GS_header         \
3571   .DWordLength                         =      9,  \
3572   ._3DCommandSubOpcode                 =     22,  \
3573   ._3DCommandOpcode                    =      0,  \
3574   .CommandSubType                      =      3,  \
3575   .CommandType                         =      3
3576
3577struct GEN9_3DSTATE_CONSTANT_GS {
3578   uint32_t                             DWordLength;
3579   uint32_t                             MOCS;
3580   uint32_t                             _3DCommandSubOpcode;
3581   uint32_t                             _3DCommandOpcode;
3582   uint32_t                             CommandSubType;
3583   uint32_t                             CommandType;
3584   struct GEN9_3DSTATE_CONSTANT_BODY    ConstantBody;
3585};
3586
3587static inline void
3588GEN9_3DSTATE_CONSTANT_GS_pack(__attribute__((unused)) __gen_user_data *data,
3589                              __attribute__((unused)) void * restrict dst,
3590                              __attribute__((unused)) const struct GEN9_3DSTATE_CONSTANT_GS * restrict values)
3591{
3592   uint32_t * restrict dw = (uint32_t * restrict) dst;
3593
3594   dw[0] =
3595      __gen_uint(values->DWordLength, 0, 7) |
3596      __gen_uint(values->MOCS, 8, 14) |
3597      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3598      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3599      __gen_uint(values->CommandSubType, 27, 28) |
3600      __gen_uint(values->CommandType, 29, 31);
3601
3602   GEN9_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
3603}
3604
3605#define GEN9_3DSTATE_CONSTANT_HS_length       11
3606#define GEN9_3DSTATE_CONSTANT_HS_length_bias      2
3607#define GEN9_3DSTATE_CONSTANT_HS_header         \
3608   .DWordLength                         =      9,  \
3609   ._3DCommandSubOpcode                 =     25,  \
3610   ._3DCommandOpcode                    =      0,  \
3611   .CommandSubType                      =      3,  \
3612   .CommandType                         =      3
3613
3614struct GEN9_3DSTATE_CONSTANT_HS {
3615   uint32_t                             DWordLength;
3616   uint32_t                             MOCS;
3617   uint32_t                             _3DCommandSubOpcode;
3618   uint32_t                             _3DCommandOpcode;
3619   uint32_t                             CommandSubType;
3620   uint32_t                             CommandType;
3621   struct GEN9_3DSTATE_CONSTANT_BODY    ConstantBody;
3622};
3623
3624static inline void
3625GEN9_3DSTATE_CONSTANT_HS_pack(__attribute__((unused)) __gen_user_data *data,
3626                              __attribute__((unused)) void * restrict dst,
3627                              __attribute__((unused)) const struct GEN9_3DSTATE_CONSTANT_HS * restrict values)
3628{
3629   uint32_t * restrict dw = (uint32_t * restrict) dst;
3630
3631   dw[0] =
3632      __gen_uint(values->DWordLength, 0, 7) |
3633      __gen_uint(values->MOCS, 8, 14) |
3634      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3635      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3636      __gen_uint(values->CommandSubType, 27, 28) |
3637      __gen_uint(values->CommandType, 29, 31);
3638
3639   GEN9_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
3640}
3641
3642#define GEN9_3DSTATE_CONSTANT_PS_length       11
3643#define GEN9_3DSTATE_CONSTANT_PS_length_bias      2
3644#define GEN9_3DSTATE_CONSTANT_PS_header         \
3645   .DWordLength                         =      9,  \
3646   ._3DCommandSubOpcode                 =     23,  \
3647   ._3DCommandOpcode                    =      0,  \
3648   .CommandSubType                      =      3,  \
3649   .CommandType                         =      3
3650
3651struct GEN9_3DSTATE_CONSTANT_PS {
3652   uint32_t                             DWordLength;
3653   uint32_t                             MOCS;
3654   uint32_t                             _3DCommandSubOpcode;
3655   uint32_t                             _3DCommandOpcode;
3656   uint32_t                             CommandSubType;
3657   uint32_t                             CommandType;
3658   struct GEN9_3DSTATE_CONSTANT_BODY    ConstantBody;
3659};
3660
3661static inline void
3662GEN9_3DSTATE_CONSTANT_PS_pack(__attribute__((unused)) __gen_user_data *data,
3663                              __attribute__((unused)) void * restrict dst,
3664                              __attribute__((unused)) const struct GEN9_3DSTATE_CONSTANT_PS * restrict values)
3665{
3666   uint32_t * restrict dw = (uint32_t * restrict) dst;
3667
3668   dw[0] =
3669      __gen_uint(values->DWordLength, 0, 7) |
3670      __gen_uint(values->MOCS, 8, 14) |
3671      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3672      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3673      __gen_uint(values->CommandSubType, 27, 28) |
3674      __gen_uint(values->CommandType, 29, 31);
3675
3676   GEN9_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
3677}
3678
3679#define GEN9_3DSTATE_CONSTANT_VS_length       11
3680#define GEN9_3DSTATE_CONSTANT_VS_length_bias      2
3681#define GEN9_3DSTATE_CONSTANT_VS_header         \
3682   .DWordLength                         =      9,  \
3683   ._3DCommandSubOpcode                 =     21,  \
3684   ._3DCommandOpcode                    =      0,  \
3685   .CommandSubType                      =      3,  \
3686   .CommandType                         =      3
3687
3688struct GEN9_3DSTATE_CONSTANT_VS {
3689   uint32_t                             DWordLength;
3690   uint32_t                             MOCS;
3691   uint32_t                             _3DCommandSubOpcode;
3692   uint32_t                             _3DCommandOpcode;
3693   uint32_t                             CommandSubType;
3694   uint32_t                             CommandType;
3695   struct GEN9_3DSTATE_CONSTANT_BODY    ConstantBody;
3696};
3697
3698static inline void
3699GEN9_3DSTATE_CONSTANT_VS_pack(__attribute__((unused)) __gen_user_data *data,
3700                              __attribute__((unused)) void * restrict dst,
3701                              __attribute__((unused)) const struct GEN9_3DSTATE_CONSTANT_VS * restrict values)
3702{
3703   uint32_t * restrict dw = (uint32_t * restrict) dst;
3704
3705   dw[0] =
3706      __gen_uint(values->DWordLength, 0, 7) |
3707      __gen_uint(values->MOCS, 8, 14) |
3708      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3709      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3710      __gen_uint(values->CommandSubType, 27, 28) |
3711      __gen_uint(values->CommandType, 29, 31);
3712
3713   GEN9_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
3714}
3715
3716#define GEN9_3DSTATE_DEPTH_BUFFER_length       8
3717#define GEN9_3DSTATE_DEPTH_BUFFER_length_bias      2
3718#define GEN9_3DSTATE_DEPTH_BUFFER_header        \
3719   .DWordLength                         =      6,  \
3720   ._3DCommandSubOpcode                 =      5,  \
3721   ._3DCommandOpcode                    =      0,  \
3722   .CommandSubType                      =      3,  \
3723   .CommandType                         =      3
3724
3725struct GEN9_3DSTATE_DEPTH_BUFFER {
3726   uint32_t                             DWordLength;
3727   uint32_t                             _3DCommandSubOpcode;
3728   uint32_t                             _3DCommandOpcode;
3729   uint32_t                             CommandSubType;
3730   uint32_t                             CommandType;
3731   uint32_t                             SurfacePitch;
3732   uint32_t                             SurfaceFormat;
3733#define D32_FLOAT                                1
3734#define D24_UNORM_X8_UINT                        3
3735#define D16_UNORM                                5
3736   bool                                 HierarchicalDepthBufferEnable;
3737   bool                                 StencilWriteEnable;
3738   bool                                 DepthWriteEnable;
3739   uint32_t                             SurfaceType;
3740#define SURFTYPE_2D                              1
3741#define SURFTYPE_CUBE                            3
3742#define SURFTYPE_NULL                            7
3743   __gen_address_type                   SurfaceBaseAddress;
3744   uint32_t                             LOD;
3745   uint32_t                             Width;
3746   uint32_t                             Height;
3747   uint32_t                             MOCS;
3748   uint32_t                             MinimumArrayElement;
3749   uint32_t                             Depth;
3750   uint32_t                             MipTailStartLOD;
3751   uint32_t                             TiledResourceMode;
3752#define NONE                                     0
3753#define TILEYF                                   1
3754#define TILEYS                                   2
3755   uint32_t                             SurfaceQPitch;
3756   uint32_t                             RenderTargetViewExtent;
3757};
3758
3759static inline void
3760GEN9_3DSTATE_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
3761                               __attribute__((unused)) void * restrict dst,
3762                               __attribute__((unused)) const struct GEN9_3DSTATE_DEPTH_BUFFER * restrict values)
3763{
3764   uint32_t * restrict dw = (uint32_t * restrict) dst;
3765
3766   dw[0] =
3767      __gen_uint(values->DWordLength, 0, 7) |
3768      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3769      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3770      __gen_uint(values->CommandSubType, 27, 28) |
3771      __gen_uint(values->CommandType, 29, 31);
3772
3773   dw[1] =
3774      __gen_uint(values->SurfacePitch, 0, 17) |
3775      __gen_uint(values->SurfaceFormat, 18, 20) |
3776      __gen_uint(values->HierarchicalDepthBufferEnable, 22, 22) |
3777      __gen_uint(values->StencilWriteEnable, 27, 27) |
3778      __gen_uint(values->DepthWriteEnable, 28, 28) |
3779      __gen_uint(values->SurfaceType, 29, 31);
3780
3781   const uint64_t v2_address =
3782      __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
3783   dw[2] = v2_address;
3784   dw[3] = v2_address >> 32;
3785
3786   dw[4] =
3787      __gen_uint(values->LOD, 0, 3) |
3788      __gen_uint(values->Width, 4, 17) |
3789      __gen_uint(values->Height, 18, 31);
3790
3791   dw[5] =
3792      __gen_uint(values->MOCS, 0, 6) |
3793      __gen_uint(values->MinimumArrayElement, 10, 20) |
3794      __gen_uint(values->Depth, 21, 31);
3795
3796   dw[6] =
3797      __gen_uint(values->MipTailStartLOD, 26, 29) |
3798      __gen_uint(values->TiledResourceMode, 30, 31);
3799
3800   dw[7] =
3801      __gen_uint(values->SurfaceQPitch, 0, 14) |
3802      __gen_uint(values->RenderTargetViewExtent, 21, 31);
3803}
3804
3805#define GEN9_3DSTATE_DRAWING_RECTANGLE_length      4
3806#define GEN9_3DSTATE_DRAWING_RECTANGLE_length_bias      2
3807#define GEN9_3DSTATE_DRAWING_RECTANGLE_header   \
3808   .DWordLength                         =      2,  \
3809   ._3DCommandSubOpcode                 =      0,  \
3810   ._3DCommandOpcode                    =      1,  \
3811   .CommandSubType                      =      3,  \
3812   .CommandType                         =      3
3813
3814struct GEN9_3DSTATE_DRAWING_RECTANGLE {
3815   uint32_t                             DWordLength;
3816   uint32_t                             CoreModeSelect;
3817#define Legacy                                   0
3818#define Core0Enabled                             1
3819#define Core1Enabled                             2
3820   uint32_t                             _3DCommandSubOpcode;
3821   uint32_t                             _3DCommandOpcode;
3822   uint32_t                             CommandSubType;
3823   uint32_t                             CommandType;
3824   uint32_t                             ClippedDrawingRectangleXMin;
3825   uint32_t                             ClippedDrawingRectangleYMin;
3826   uint32_t                             ClippedDrawingRectangleXMax;
3827   uint32_t                             ClippedDrawingRectangleYMax;
3828   int32_t                              DrawingRectangleOriginX;
3829   int32_t                              DrawingRectangleOriginY;
3830};
3831
3832static inline void
3833GEN9_3DSTATE_DRAWING_RECTANGLE_pack(__attribute__((unused)) __gen_user_data *data,
3834                                    __attribute__((unused)) void * restrict dst,
3835                                    __attribute__((unused)) const struct GEN9_3DSTATE_DRAWING_RECTANGLE * restrict values)
3836{
3837   uint32_t * restrict dw = (uint32_t * restrict) dst;
3838
3839   dw[0] =
3840      __gen_uint(values->DWordLength, 0, 7) |
3841      __gen_uint(values->CoreModeSelect, 14, 15) |
3842      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3843      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3844      __gen_uint(values->CommandSubType, 27, 28) |
3845      __gen_uint(values->CommandType, 29, 31);
3846
3847   dw[1] =
3848      __gen_uint(values->ClippedDrawingRectangleXMin, 0, 15) |
3849      __gen_uint(values->ClippedDrawingRectangleYMin, 16, 31);
3850
3851   dw[2] =
3852      __gen_uint(values->ClippedDrawingRectangleXMax, 0, 15) |
3853      __gen_uint(values->ClippedDrawingRectangleYMax, 16, 31);
3854
3855   dw[3] =
3856      __gen_sint(values->DrawingRectangleOriginX, 0, 15) |
3857      __gen_sint(values->DrawingRectangleOriginY, 16, 31);
3858}
3859
3860#define GEN9_3DSTATE_DS_length                11
3861#define GEN9_3DSTATE_DS_length_bias            2
3862#define GEN9_3DSTATE_DS_header                  \
3863   .DWordLength                         =      9,  \
3864   ._3DCommandSubOpcode                 =     29,  \
3865   ._3DCommandOpcode                    =      0,  \
3866   .CommandSubType                      =      3,  \
3867   .CommandType                         =      3
3868
3869struct GEN9_3DSTATE_DS {
3870   uint32_t                             DWordLength;
3871   uint32_t                             _3DCommandSubOpcode;
3872   uint32_t                             _3DCommandOpcode;
3873   uint32_t                             CommandSubType;
3874   uint32_t                             CommandType;
3875   uint64_t                             KernelStartPointer;
3876   bool                                 SoftwareExceptionEnable;
3877   bool                                 IllegalOpcodeExceptionEnable;
3878   bool                                 AccessesUAV;
3879   uint32_t                             FloatingPointMode;
3880#define IEEE754                                  0
3881#define Alternate                                1
3882   uint32_t                             ThreadDispatchPriority;
3883#define High                                     1
3884   uint32_t                             BindingTableEntryCount;
3885   uint32_t                             SamplerCount;
3886#define NoSamplers                               0
3887#define _14Samplers                              1
3888#define _58Samplers                              2
3889#define _912Samplers                             3
3890#define _1316Samplers                            4
3891   bool                                 VectorMaskEnable;
3892   uint32_t                             PerThreadScratchSpace;
3893   __gen_address_type                   ScratchSpaceBasePointer;
3894   uint32_t                             PatchURBEntryReadOffset;
3895   uint32_t                             PatchURBEntryReadLength;
3896   uint32_t                             DispatchGRFStartRegisterForURBData;
3897   bool                                 Enable;
3898   bool                                 CacheDisable;
3899   bool                                 ComputeWCoordinateEnable;
3900   uint32_t                             DispatchMode;
3901#define DISPATCH_MODE_SIMD4X2                    0
3902#define DISPATCH_MODE_SIMD8_SINGLE_PATCH         1
3903#define DISPATCH_MODE_SIMD8_SINGLE_OR_DUAL_PATCH 2
3904   bool                                 StatisticsEnable;
3905   uint32_t                             MaximumNumberofThreads;
3906   uint32_t                             UserClipDistanceCullTestEnableBitmask;
3907   uint32_t                             UserClipDistanceClipTestEnableBitmask;
3908   uint32_t                             VertexURBEntryOutputLength;
3909   uint32_t                             VertexURBEntryOutputReadOffset;
3910   uint64_t                             DUAL_PATCHKernelStartPointer;
3911};
3912
3913static inline void
3914GEN9_3DSTATE_DS_pack(__attribute__((unused)) __gen_user_data *data,
3915                     __attribute__((unused)) void * restrict dst,
3916                     __attribute__((unused)) const struct GEN9_3DSTATE_DS * restrict values)
3917{
3918   uint32_t * restrict dw = (uint32_t * restrict) dst;
3919
3920   dw[0] =
3921      __gen_uint(values->DWordLength, 0, 7) |
3922      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3923      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3924      __gen_uint(values->CommandSubType, 27, 28) |
3925      __gen_uint(values->CommandType, 29, 31);
3926
3927   const uint64_t v1 =
3928      __gen_offset(values->KernelStartPointer, 6, 63);
3929   dw[1] = v1;
3930   dw[2] = v1 >> 32;
3931
3932   dw[3] =
3933      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
3934      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
3935      __gen_uint(values->AccessesUAV, 14, 14) |
3936      __gen_uint(values->FloatingPointMode, 16, 16) |
3937      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
3938      __gen_uint(values->BindingTableEntryCount, 18, 25) |
3939      __gen_uint(values->SamplerCount, 27, 29) |
3940      __gen_uint(values->VectorMaskEnable, 30, 30);
3941
3942   const uint64_t v4 =
3943      __gen_uint(values->PerThreadScratchSpace, 0, 3);
3944   const uint64_t v4_address =
3945      __gen_combine_address(data, &dw[4], values->ScratchSpaceBasePointer, v4);
3946   dw[4] = v4_address;
3947   dw[5] = (v4_address >> 32) | (v4 >> 32);
3948
3949   dw[6] =
3950      __gen_uint(values->PatchURBEntryReadOffset, 4, 9) |
3951      __gen_uint(values->PatchURBEntryReadLength, 11, 17) |
3952      __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
3953
3954   dw[7] =
3955      __gen_uint(values->Enable, 0, 0) |
3956      __gen_uint(values->CacheDisable, 1, 1) |
3957      __gen_uint(values->ComputeWCoordinateEnable, 2, 2) |
3958      __gen_uint(values->DispatchMode, 3, 4) |
3959      __gen_uint(values->StatisticsEnable, 10, 10) |
3960      __gen_uint(values->MaximumNumberofThreads, 21, 29);
3961
3962   dw[8] =
3963      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
3964      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 8, 15) |
3965      __gen_uint(values->VertexURBEntryOutputLength, 16, 20) |
3966      __gen_uint(values->VertexURBEntryOutputReadOffset, 21, 26);
3967
3968   const uint64_t v9 =
3969      __gen_offset(values->DUAL_PATCHKernelStartPointer, 6, 63);
3970   dw[9] = v9;
3971   dw[10] = v9 >> 32;
3972}
3973
3974#define GEN9_3DSTATE_GATHER_CONSTANT_DS_length_bias      2
3975#define GEN9_3DSTATE_GATHER_CONSTANT_DS_header  \
3976   .DWordLength                         =      1,  \
3977   ._3DCommandSubOpcode                 =     55,  \
3978   ._3DCommandOpcode                    =      0,  \
3979   .CommandSubType                      =      3,  \
3980   .CommandType                         =      3
3981
3982struct GEN9_3DSTATE_GATHER_CONSTANT_DS {
3983   uint32_t                             DWordLength;
3984   uint32_t                             _3DCommandSubOpcode;
3985   uint32_t                             _3DCommandOpcode;
3986   uint32_t                             CommandSubType;
3987   uint32_t                             CommandType;
3988   uint32_t                             UpdateGatherTableOnly;
3989#define CommitGather                             0
3990#define NonCommitGather                          1
3991   uint32_t                             ConstantBufferBindingTableBlock;
3992   uint32_t                             ConstantBufferValid;
3993   uint32_t                             OnDieTable;
3994#define Load                                     0
3995#define Read                                     1
3996   bool                                 ConstantBufferDx9GenerateStall;
3997   uint64_t                             GatherBufferOffset;
3998   /* variable length fields follow */
3999};
4000
4001static inline void
4002GEN9_3DSTATE_GATHER_CONSTANT_DS_pack(__attribute__((unused)) __gen_user_data *data,
4003                                     __attribute__((unused)) void * restrict dst,
4004                                     __attribute__((unused)) const struct GEN9_3DSTATE_GATHER_CONSTANT_DS * restrict values)
4005{
4006   uint32_t * restrict dw = (uint32_t * restrict) dst;
4007
4008   dw[0] =
4009      __gen_uint(values->DWordLength, 0, 7) |
4010      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4011      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4012      __gen_uint(values->CommandSubType, 27, 28) |
4013      __gen_uint(values->CommandType, 29, 31);
4014
4015   dw[1] =
4016      __gen_uint(values->UpdateGatherTableOnly, 1, 1) |
4017      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
4018      __gen_uint(values->ConstantBufferValid, 16, 31);
4019
4020   dw[2] =
4021      __gen_uint(values->OnDieTable, 3, 3) |
4022      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
4023      __gen_offset(values->GatherBufferOffset, 6, 22);
4024}
4025
4026#define GEN9_3DSTATE_GATHER_CONSTANT_GS_length_bias      2
4027#define GEN9_3DSTATE_GATHER_CONSTANT_GS_header  \
4028   .DWordLength                         =      1,  \
4029   ._3DCommandSubOpcode                 =     53,  \
4030   ._3DCommandOpcode                    =      0,  \
4031   .CommandSubType                      =      3,  \
4032   .CommandType                         =      3
4033
4034struct GEN9_3DSTATE_GATHER_CONSTANT_GS {
4035   uint32_t                             DWordLength;
4036   uint32_t                             _3DCommandSubOpcode;
4037   uint32_t                             _3DCommandOpcode;
4038   uint32_t                             CommandSubType;
4039   uint32_t                             CommandType;
4040   uint32_t                             UpdateGatherTableOnly;
4041#define CommitGather                             0
4042#define NonCommitGather                          1
4043   uint32_t                             ConstantBufferBindingTableBlock;
4044   uint32_t                             ConstantBufferValid;
4045   uint32_t                             OnDieTable;
4046#define Load                                     0
4047#define Read                                     1
4048   bool                                 ConstantBufferDx9GenerateStall;
4049   uint64_t                             GatherBufferOffset;
4050   /* variable length fields follow */
4051};
4052
4053static inline void
4054GEN9_3DSTATE_GATHER_CONSTANT_GS_pack(__attribute__((unused)) __gen_user_data *data,
4055                                     __attribute__((unused)) void * restrict dst,
4056                                     __attribute__((unused)) const struct GEN9_3DSTATE_GATHER_CONSTANT_GS * restrict values)
4057{
4058   uint32_t * restrict dw = (uint32_t * restrict) dst;
4059
4060   dw[0] =
4061      __gen_uint(values->DWordLength, 0, 7) |
4062      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4063      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4064      __gen_uint(values->CommandSubType, 27, 28) |
4065      __gen_uint(values->CommandType, 29, 31);
4066
4067   dw[1] =
4068      __gen_uint(values->UpdateGatherTableOnly, 1, 1) |
4069      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
4070      __gen_uint(values->ConstantBufferValid, 16, 31);
4071
4072   dw[2] =
4073      __gen_uint(values->OnDieTable, 3, 3) |
4074      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
4075      __gen_offset(values->GatherBufferOffset, 6, 22);
4076}
4077
4078#define GEN9_3DSTATE_GATHER_CONSTANT_HS_length_bias      2
4079#define GEN9_3DSTATE_GATHER_CONSTANT_HS_header  \
4080   .DWordLength                         =      1,  \
4081   ._3DCommandSubOpcode                 =     54,  \
4082   ._3DCommandOpcode                    =      0,  \
4083   .CommandSubType                      =      3,  \
4084   .CommandType                         =      3
4085
4086struct GEN9_3DSTATE_GATHER_CONSTANT_HS {
4087   uint32_t                             DWordLength;
4088   uint32_t                             _3DCommandSubOpcode;
4089   uint32_t                             _3DCommandOpcode;
4090   uint32_t                             CommandSubType;
4091   uint32_t                             CommandType;
4092   uint32_t                             UpdateGatherTableOnly;
4093#define CommitGather                             0
4094#define NonCommitGather                          1
4095   uint32_t                             ConstantBufferBindingTableBlock;
4096   uint32_t                             ConstantBufferValid;
4097   uint32_t                             OnDieTable;
4098#define Load                                     0
4099#define Read                                     1
4100   bool                                 ConstantBufferDx9GenerateStall;
4101   uint64_t                             GatherBufferOffset;
4102   /* variable length fields follow */
4103};
4104
4105static inline void
4106GEN9_3DSTATE_GATHER_CONSTANT_HS_pack(__attribute__((unused)) __gen_user_data *data,
4107                                     __attribute__((unused)) void * restrict dst,
4108                                     __attribute__((unused)) const struct GEN9_3DSTATE_GATHER_CONSTANT_HS * restrict values)
4109{
4110   uint32_t * restrict dw = (uint32_t * restrict) dst;
4111
4112   dw[0] =
4113      __gen_uint(values->DWordLength, 0, 7) |
4114      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4115      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4116      __gen_uint(values->CommandSubType, 27, 28) |
4117      __gen_uint(values->CommandType, 29, 31);
4118
4119   dw[1] =
4120      __gen_uint(values->UpdateGatherTableOnly, 1, 1) |
4121      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
4122      __gen_uint(values->ConstantBufferValid, 16, 31);
4123
4124   dw[2] =
4125      __gen_uint(values->OnDieTable, 3, 3) |
4126      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
4127      __gen_offset(values->GatherBufferOffset, 6, 22);
4128}
4129
4130#define GEN9_3DSTATE_GATHER_CONSTANT_PS_length_bias      2
4131#define GEN9_3DSTATE_GATHER_CONSTANT_PS_header  \
4132   .DWordLength                         =      1,  \
4133   ._3DCommandSubOpcode                 =     56,  \
4134   ._3DCommandOpcode                    =      0,  \
4135   .CommandSubType                      =      3,  \
4136   .CommandType                         =      3
4137
4138struct GEN9_3DSTATE_GATHER_CONSTANT_PS {
4139   uint32_t                             DWordLength;
4140   uint32_t                             _3DCommandSubOpcode;
4141   uint32_t                             _3DCommandOpcode;
4142   uint32_t                             CommandSubType;
4143   uint32_t                             CommandType;
4144   bool                                 DX9OnDieRegisterReadEnable;
4145   uint32_t                             UpdateGatherTableOnly;
4146#define CommitGather                             0
4147#define NonCommitGather                          1
4148   uint32_t                             ConstantBufferBindingTableBlock;
4149   uint32_t                             ConstantBufferValid;
4150   uint32_t                             OnDieTable;
4151#define Load                                     0
4152#define Read                                     1
4153   bool                                 ConstantBufferDx9Enable;
4154   bool                                 ConstantBufferDx9GenerateStall;
4155   uint64_t                             GatherBufferOffset;
4156   /* variable length fields follow */
4157};
4158
4159static inline void
4160GEN9_3DSTATE_GATHER_CONSTANT_PS_pack(__attribute__((unused)) __gen_user_data *data,
4161                                     __attribute__((unused)) void * restrict dst,
4162                                     __attribute__((unused)) const struct GEN9_3DSTATE_GATHER_CONSTANT_PS * restrict values)
4163{
4164   uint32_t * restrict dw = (uint32_t * restrict) dst;
4165
4166   dw[0] =
4167      __gen_uint(values->DWordLength, 0, 7) |
4168      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4169      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4170      __gen_uint(values->CommandSubType, 27, 28) |
4171      __gen_uint(values->CommandType, 29, 31);
4172
4173   dw[1] =
4174      __gen_uint(values->DX9OnDieRegisterReadEnable, 0, 0) |
4175      __gen_uint(values->UpdateGatherTableOnly, 1, 1) |
4176      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
4177      __gen_uint(values->ConstantBufferValid, 16, 31);
4178
4179   dw[2] =
4180      __gen_uint(values->OnDieTable, 3, 3) |
4181      __gen_uint(values->ConstantBufferDx9Enable, 4, 4) |
4182      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
4183      __gen_offset(values->GatherBufferOffset, 6, 22);
4184}
4185
4186#define GEN9_3DSTATE_GATHER_CONSTANT_VS_length_bias      2
4187#define GEN9_3DSTATE_GATHER_CONSTANT_VS_header  \
4188   .DWordLength                         =      0,  \
4189   ._3DCommandSubOpcode                 =     52,  \
4190   ._3DCommandOpcode                    =      0,  \
4191   .CommandSubType                      =      3,  \
4192   .CommandType                         =      3
4193
4194struct GEN9_3DSTATE_GATHER_CONSTANT_VS {
4195   uint32_t                             DWordLength;
4196   uint32_t                             _3DCommandSubOpcode;
4197   uint32_t                             _3DCommandOpcode;
4198   uint32_t                             CommandSubType;
4199   uint32_t                             CommandType;
4200   bool                                 DX9OnDieRegisterReadEnable;
4201   uint32_t                             UpdateGatherTableOnly;
4202#define CommitGather                             0
4203#define NonCommitGather                          1
4204   uint32_t                             ConstantBufferBindingTableBlock;
4205   uint32_t                             ConstantBufferValid;
4206   uint32_t                             OnDieTable;
4207#define Load                                     0
4208#define Read                                     1
4209   bool                                 ConstantBufferDx9Enable;
4210   bool                                 ConstantBufferDx9GenerateStall;
4211   uint64_t                             GatherBufferOffset;
4212   /* variable length fields follow */
4213};
4214
4215static inline void
4216GEN9_3DSTATE_GATHER_CONSTANT_VS_pack(__attribute__((unused)) __gen_user_data *data,
4217                                     __attribute__((unused)) void * restrict dst,
4218                                     __attribute__((unused)) const struct GEN9_3DSTATE_GATHER_CONSTANT_VS * restrict values)
4219{
4220   uint32_t * restrict dw = (uint32_t * restrict) dst;
4221
4222   dw[0] =
4223      __gen_uint(values->DWordLength, 0, 7) |
4224      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4225      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4226      __gen_uint(values->CommandSubType, 27, 28) |
4227      __gen_uint(values->CommandType, 29, 31);
4228
4229   dw[1] =
4230      __gen_uint(values->DX9OnDieRegisterReadEnable, 0, 0) |
4231      __gen_uint(values->UpdateGatherTableOnly, 1, 1) |
4232      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
4233      __gen_uint(values->ConstantBufferValid, 16, 31);
4234
4235   dw[2] =
4236      __gen_uint(values->OnDieTable, 3, 3) |
4237      __gen_uint(values->ConstantBufferDx9Enable, 4, 4) |
4238      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
4239      __gen_offset(values->GatherBufferOffset, 6, 22);
4240}
4241
4242#define GEN9_3DSTATE_GATHER_POOL_ALLOC_length      4
4243#define GEN9_3DSTATE_GATHER_POOL_ALLOC_length_bias      2
4244#define GEN9_3DSTATE_GATHER_POOL_ALLOC_header   \
4245   .DWordLength                         =      2,  \
4246   ._3DCommandSubOpcode                 =     26,  \
4247   ._3DCommandOpcode                    =      1,  \
4248   .CommandSubType                      =      3,  \
4249   .CommandType                         =      3
4250
4251struct GEN9_3DSTATE_GATHER_POOL_ALLOC {
4252   uint32_t                             DWordLength;
4253   uint32_t                             _3DCommandSubOpcode;
4254   uint32_t                             _3DCommandOpcode;
4255   uint32_t                             CommandSubType;
4256   uint32_t                             CommandType;
4257   uint32_t                             MOCS;
4258   bool                                 GatherPoolEnable;
4259   __gen_address_type                   GatherPoolBaseAddress;
4260   uint32_t                             GatherPoolBufferSize;
4261};
4262
4263static inline void
4264GEN9_3DSTATE_GATHER_POOL_ALLOC_pack(__attribute__((unused)) __gen_user_data *data,
4265                                    __attribute__((unused)) void * restrict dst,
4266                                    __attribute__((unused)) const struct GEN9_3DSTATE_GATHER_POOL_ALLOC * restrict values)
4267{
4268   uint32_t * restrict dw = (uint32_t * restrict) dst;
4269
4270   dw[0] =
4271      __gen_uint(values->DWordLength, 0, 7) |
4272      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4273      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4274      __gen_uint(values->CommandSubType, 27, 28) |
4275      __gen_uint(values->CommandType, 29, 31);
4276
4277   const uint64_t v1 =
4278      __gen_uint(values->MOCS, 0, 6) |
4279      __gen_uint(values->GatherPoolEnable, 11, 11);
4280   const uint64_t v1_address =
4281      __gen_combine_address(data, &dw[1], values->GatherPoolBaseAddress, v1);
4282   dw[1] = v1_address;
4283   dw[2] = (v1_address >> 32) | (v1 >> 32);
4284
4285   dw[3] =
4286      __gen_uint(values->GatherPoolBufferSize, 12, 31);
4287}
4288
4289#define GEN9_3DSTATE_GS_length                10
4290#define GEN9_3DSTATE_GS_length_bias            2
4291#define GEN9_3DSTATE_GS_header                  \
4292   .DWordLength                         =      8,  \
4293   ._3DCommandSubOpcode                 =     17,  \
4294   ._3DCommandOpcode                    =      0,  \
4295   .CommandSubType                      =      3,  \
4296   .CommandType                         =      3
4297
4298struct GEN9_3DSTATE_GS {
4299   uint32_t                             DWordLength;
4300   uint32_t                             _3DCommandSubOpcode;
4301   uint32_t                             _3DCommandOpcode;
4302   uint32_t                             CommandSubType;
4303   uint32_t                             CommandType;
4304   uint64_t                             KernelStartPointer;
4305   uint32_t                             ExpectedVertexCount;
4306   bool                                 SoftwareExceptionEnable;
4307   bool                                 MaskStackExceptionEnable;
4308   bool                                 AccessesUAV;
4309   bool                                 IllegalOpcodeExceptionEnable;
4310   uint32_t                             FloatingPointMode;
4311#define IEEE754                                  0
4312#define Alternate                                1
4313   uint32_t                             ThreadDispatchPriority;
4314#define High                                     1
4315   uint32_t                             BindingTableEntryCount;
4316   uint32_t                             SamplerCount;
4317#define NoSamplers                               0
4318#define _14Samplers                              1
4319#define _58Samplers                              2
4320#define _912Samplers                             3
4321#define _1316Samplers                            4
4322   bool                                 VectorMaskEnable;
4323   bool                                 SingleProgramFlow;
4324   uint32_t                             PerThreadScratchSpace;
4325   __gen_address_type                   ScratchSpaceBasePointer;
4326   uint32_t                             DispatchGRFStartRegisterForURBData;
4327   uint32_t                             VertexURBEntryReadOffset;
4328   bool                                 IncludeVertexHandles;
4329   uint32_t                             VertexURBEntryReadLength;
4330   enum GEN9_3D_Prim_Topo_Type          OutputTopology;
4331   uint32_t                             OutputVertexSize;
4332   uint32_t                             DispatchGRFStartRegisterForURBData54;
4333   bool                                 Enable;
4334   bool                                 DiscardAdjacency;
4335   uint32_t                             ReorderMode;
4336#define LEADING                                  0
4337#define TRAILING                                 1
4338   uint32_t                             Hint;
4339   bool                                 IncludePrimitiveID;
4340   uint32_t                             InvocationsIncrementValue;
4341   bool                                 StatisticsEnable;
4342   uint32_t                             DispatchMode;
4343#define DISPATCH_MODE_DualInstance               1
4344#define DISPATCH_MODE_DualObject                 2
4345#define DISPATCH_MODE_SIMD8                      3
4346   uint32_t                             DefaultStreamId;
4347   uint32_t                             InstanceControl;
4348   uint32_t                             ControlDataHeaderSize;
4349   uint32_t                             MaximumNumberofThreads;
4350   uint32_t                             StaticOutputVertexCount;
4351   bool                                 StaticOutput;
4352   uint32_t                             ControlDataFormat;
4353#define CUT                                      0
4354#define SID                                      1
4355   uint32_t                             UserClipDistanceCullTestEnableBitmask;
4356   uint32_t                             UserClipDistanceClipTestEnableBitmask;
4357   uint32_t                             VertexURBEntryOutputLength;
4358   uint32_t                             VertexURBEntryOutputReadOffset;
4359};
4360
4361static inline void
4362GEN9_3DSTATE_GS_pack(__attribute__((unused)) __gen_user_data *data,
4363                     __attribute__((unused)) void * restrict dst,
4364                     __attribute__((unused)) const struct GEN9_3DSTATE_GS * restrict values)
4365{
4366   uint32_t * restrict dw = (uint32_t * restrict) dst;
4367
4368   dw[0] =
4369      __gen_uint(values->DWordLength, 0, 7) |
4370      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4371      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4372      __gen_uint(values->CommandSubType, 27, 28) |
4373      __gen_uint(values->CommandType, 29, 31);
4374
4375   const uint64_t v1 =
4376      __gen_offset(values->KernelStartPointer, 6, 63);
4377   dw[1] = v1;
4378   dw[2] = v1 >> 32;
4379
4380   dw[3] =
4381      __gen_uint(values->ExpectedVertexCount, 0, 5) |
4382      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
4383      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
4384      __gen_uint(values->AccessesUAV, 12, 12) |
4385      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
4386      __gen_uint(values->FloatingPointMode, 16, 16) |
4387      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
4388      __gen_uint(values->BindingTableEntryCount, 18, 25) |
4389      __gen_uint(values->SamplerCount, 27, 29) |
4390      __gen_uint(values->VectorMaskEnable, 30, 30) |
4391      __gen_uint(values->SingleProgramFlow, 31, 31);
4392
4393   const uint64_t v4 =
4394      __gen_uint(values->PerThreadScratchSpace, 0, 3);
4395   const uint64_t v4_address =
4396      __gen_combine_address(data, &dw[4], values->ScratchSpaceBasePointer, v4);
4397   dw[4] = v4_address;
4398   dw[5] = (v4_address >> 32) | (v4 >> 32);
4399
4400   dw[6] =
4401      __gen_uint(values->DispatchGRFStartRegisterForURBData, 0, 3) |
4402      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
4403      __gen_uint(values->IncludeVertexHandles, 10, 10) |
4404      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
4405      __gen_uint(values->OutputTopology, 17, 22) |
4406      __gen_uint(values->OutputVertexSize, 23, 28) |
4407      __gen_uint(values->DispatchGRFStartRegisterForURBData54, 29, 30);
4408
4409   dw[7] =
4410      __gen_uint(values->Enable, 0, 0) |
4411      __gen_uint(values->DiscardAdjacency, 1, 1) |
4412      __gen_uint(values->ReorderMode, 2, 2) |
4413      __gen_uint(values->Hint, 3, 3) |
4414      __gen_uint(values->IncludePrimitiveID, 4, 4) |
4415      __gen_uint(values->InvocationsIncrementValue, 5, 9) |
4416      __gen_uint(values->StatisticsEnable, 10, 10) |
4417      __gen_uint(values->DispatchMode, 11, 12) |
4418      __gen_uint(values->DefaultStreamId, 13, 14) |
4419      __gen_uint(values->InstanceControl, 15, 19) |
4420      __gen_uint(values->ControlDataHeaderSize, 20, 23);
4421
4422   dw[8] =
4423      __gen_uint(values->MaximumNumberofThreads, 0, 8) |
4424      __gen_uint(values->StaticOutputVertexCount, 16, 26) |
4425      __gen_uint(values->StaticOutput, 30, 30) |
4426      __gen_uint(values->ControlDataFormat, 31, 31);
4427
4428   dw[9] =
4429      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
4430      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 8, 15) |
4431      __gen_uint(values->VertexURBEntryOutputLength, 16, 20) |
4432      __gen_uint(values->VertexURBEntryOutputReadOffset, 21, 26);
4433}
4434
4435#define GEN9_3DSTATE_HIER_DEPTH_BUFFER_length      5
4436#define GEN9_3DSTATE_HIER_DEPTH_BUFFER_length_bias      2
4437#define GEN9_3DSTATE_HIER_DEPTH_BUFFER_header   \
4438   .DWordLength                         =      3,  \
4439   ._3DCommandSubOpcode                 =      7,  \
4440   ._3DCommandOpcode                    =      0,  \
4441   .CommandSubType                      =      3,  \
4442   .CommandType                         =      3
4443
4444struct GEN9_3DSTATE_HIER_DEPTH_BUFFER {
4445   uint32_t                             DWordLength;
4446   uint32_t                             _3DCommandSubOpcode;
4447   uint32_t                             _3DCommandOpcode;
4448   uint32_t                             CommandSubType;
4449   uint32_t                             CommandType;
4450   uint32_t                             SurfacePitch;
4451   uint32_t                             MOCS;
4452   __gen_address_type                   SurfaceBaseAddress;
4453   uint32_t                             SurfaceQPitch;
4454};
4455
4456static inline void
4457GEN9_3DSTATE_HIER_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
4458                                    __attribute__((unused)) void * restrict dst,
4459                                    __attribute__((unused)) const struct GEN9_3DSTATE_HIER_DEPTH_BUFFER * restrict values)
4460{
4461   uint32_t * restrict dw = (uint32_t * restrict) dst;
4462
4463   dw[0] =
4464      __gen_uint(values->DWordLength, 0, 7) |
4465      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4466      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4467      __gen_uint(values->CommandSubType, 27, 28) |
4468      __gen_uint(values->CommandType, 29, 31);
4469
4470   dw[1] =
4471      __gen_uint(values->SurfacePitch, 0, 16) |
4472      __gen_uint(values->MOCS, 25, 31);
4473
4474   const uint64_t v2_address =
4475      __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
4476   dw[2] = v2_address;
4477   dw[3] = v2_address >> 32;
4478
4479   dw[4] =
4480      __gen_uint(values->SurfaceQPitch, 0, 14);
4481}
4482
4483#define GEN9_3DSTATE_HS_length                 9
4484#define GEN9_3DSTATE_HS_length_bias            2
4485#define GEN9_3DSTATE_HS_header                  \
4486   .DWordLength                         =      7,  \
4487   ._3DCommandSubOpcode                 =     27,  \
4488   ._3DCommandOpcode                    =      0,  \
4489   .CommandSubType                      =      3,  \
4490   .CommandType                         =      3
4491
4492struct GEN9_3DSTATE_HS {
4493   uint32_t                             DWordLength;
4494   uint32_t                             _3DCommandSubOpcode;
4495   uint32_t                             _3DCommandOpcode;
4496   uint32_t                             CommandSubType;
4497   uint32_t                             CommandType;
4498   bool                                 SoftwareExceptionEnable;
4499   bool                                 IllegalOpcodeExceptionEnable;
4500   uint32_t                             FloatingPointMode;
4501#define IEEE754                                  0
4502#define alternate                                1
4503   uint32_t                             ThreadDispatchPriority;
4504#define High                                     1
4505   uint32_t                             BindingTableEntryCount;
4506   uint32_t                             SamplerCount;
4507#define NoSamplers                               0
4508#define _14Samplers                              1
4509#define _58Samplers                              2
4510#define _912Samplers                             3
4511#define _1316Samplers                            4
4512   uint32_t                             InstanceCount;
4513   uint32_t                             MaximumNumberofThreads;
4514   bool                                 StatisticsEnable;
4515   bool                                 Enable;
4516   uint64_t                             KernelStartPointer;
4517   uint32_t                             PerThreadScratchSpace;
4518   __gen_address_type                   ScratchSpaceBasePointer;
4519   bool                                 IncludePrimitiveID;
4520   uint32_t                             VertexURBEntryReadOffset;
4521   uint32_t                             VertexURBEntryReadLength;
4522   uint32_t                             DispatchMode;
4523#define DISPATCH_MODE_SINGLE_PATCH               0
4524#define DISPATCH_MODE_DUAL_PATCH                 1
4525#define DISPATCH_MODE__8_PATCH                   2
4526   uint32_t                             DispatchGRFStartRegisterForURBData;
4527   bool                                 IncludeVertexHandles;
4528   bool                                 AccessesUAV;
4529   bool                                 VectorMaskEnable;
4530   bool                                 SingleProgramFlow;
4531   uint32_t                             DispatchGRFStartRegisterForURBData5;
4532};
4533
4534static inline void
4535GEN9_3DSTATE_HS_pack(__attribute__((unused)) __gen_user_data *data,
4536                     __attribute__((unused)) void * restrict dst,
4537                     __attribute__((unused)) const struct GEN9_3DSTATE_HS * restrict values)
4538{
4539   uint32_t * restrict dw = (uint32_t * restrict) dst;
4540
4541   dw[0] =
4542      __gen_uint(values->DWordLength, 0, 7) |
4543      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4544      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4545      __gen_uint(values->CommandSubType, 27, 28) |
4546      __gen_uint(values->CommandType, 29, 31);
4547
4548   dw[1] =
4549      __gen_uint(values->SoftwareExceptionEnable, 12, 12) |
4550      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
4551      __gen_uint(values->FloatingPointMode, 16, 16) |
4552      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
4553      __gen_uint(values->BindingTableEntryCount, 18, 25) |
4554      __gen_uint(values->SamplerCount, 27, 29);
4555
4556   dw[2] =
4557      __gen_uint(values->InstanceCount, 0, 3) |
4558      __gen_uint(values->MaximumNumberofThreads, 8, 16) |
4559      __gen_uint(values->StatisticsEnable, 29, 29) |
4560      __gen_uint(values->Enable, 31, 31);
4561
4562   const uint64_t v3 =
4563      __gen_offset(values->KernelStartPointer, 6, 63);
4564   dw[3] = v3;
4565   dw[4] = v3 >> 32;
4566
4567   const uint64_t v5 =
4568      __gen_uint(values->PerThreadScratchSpace, 0, 3);
4569   const uint64_t v5_address =
4570      __gen_combine_address(data, &dw[5], values->ScratchSpaceBasePointer, v5);
4571   dw[5] = v5_address;
4572   dw[6] = (v5_address >> 32) | (v5 >> 32);
4573
4574   dw[7] =
4575      __gen_uint(values->IncludePrimitiveID, 0, 0) |
4576      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
4577      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
4578      __gen_uint(values->DispatchMode, 17, 18) |
4579      __gen_uint(values->DispatchGRFStartRegisterForURBData, 19, 23) |
4580      __gen_uint(values->IncludeVertexHandles, 24, 24) |
4581      __gen_uint(values->AccessesUAV, 25, 25) |
4582      __gen_uint(values->VectorMaskEnable, 26, 26) |
4583      __gen_uint(values->SingleProgramFlow, 27, 27) |
4584      __gen_uint(values->DispatchGRFStartRegisterForURBData5, 28, 28);
4585
4586   dw[8] = 0;
4587}
4588
4589#define GEN9_3DSTATE_INDEX_BUFFER_length       5
4590#define GEN9_3DSTATE_INDEX_BUFFER_length_bias      2
4591#define GEN9_3DSTATE_INDEX_BUFFER_header        \
4592   .DWordLength                         =      3,  \
4593   ._3DCommandSubOpcode                 =     10,  \
4594   ._3DCommandOpcode                    =      0,  \
4595   .CommandSubType                      =      3,  \
4596   .CommandType                         =      3
4597
4598struct GEN9_3DSTATE_INDEX_BUFFER {
4599   uint32_t                             DWordLength;
4600   uint32_t                             _3DCommandSubOpcode;
4601   uint32_t                             _3DCommandOpcode;
4602   uint32_t                             CommandSubType;
4603   uint32_t                             CommandType;
4604   uint32_t                             MOCS;
4605   uint32_t                             IndexFormat;
4606#define INDEX_BYTE                               0
4607#define INDEX_WORD                               1
4608#define INDEX_DWORD                              2
4609   __gen_address_type                   BufferStartingAddress;
4610   uint32_t                             BufferSize;
4611};
4612
4613static inline void
4614GEN9_3DSTATE_INDEX_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
4615                               __attribute__((unused)) void * restrict dst,
4616                               __attribute__((unused)) const struct GEN9_3DSTATE_INDEX_BUFFER * restrict values)
4617{
4618   uint32_t * restrict dw = (uint32_t * restrict) dst;
4619
4620   dw[0] =
4621      __gen_uint(values->DWordLength, 0, 7) |
4622      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4623      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4624      __gen_uint(values->CommandSubType, 27, 28) |
4625      __gen_uint(values->CommandType, 29, 31);
4626
4627   dw[1] =
4628      __gen_uint(values->MOCS, 0, 6) |
4629      __gen_uint(values->IndexFormat, 8, 9);
4630
4631   const uint64_t v2_address =
4632      __gen_combine_address(data, &dw[2], values->BufferStartingAddress, 0);
4633   dw[2] = v2_address;
4634   dw[3] = v2_address >> 32;
4635
4636   dw[4] =
4637      __gen_uint(values->BufferSize, 0, 31);
4638}
4639
4640#define GEN9_3DSTATE_LINE_STIPPLE_length       3
4641#define GEN9_3DSTATE_LINE_STIPPLE_length_bias      2
4642#define GEN9_3DSTATE_LINE_STIPPLE_header        \
4643   .DWordLength                         =      1,  \
4644   ._3DCommandSubOpcode                 =      8,  \
4645   ._3DCommandOpcode                    =      1,  \
4646   .CommandSubType                      =      3,  \
4647   .CommandType                         =      3
4648
4649struct GEN9_3DSTATE_LINE_STIPPLE {
4650   uint32_t                             DWordLength;
4651   uint32_t                             _3DCommandSubOpcode;
4652   uint32_t                             _3DCommandOpcode;
4653   uint32_t                             CommandSubType;
4654   uint32_t                             CommandType;
4655   uint32_t                             LineStipplePattern;
4656   uint32_t                             CurrentStippleIndex;
4657   uint32_t                             CurrentRepeatCounter;
4658   bool                                 ModifyEnableCurrentRepeatCounterCurrentStippleIndex;
4659   uint32_t                             LineStippleRepeatCount;
4660   float                                LineStippleInverseRepeatCount;
4661};
4662
4663static inline void
4664GEN9_3DSTATE_LINE_STIPPLE_pack(__attribute__((unused)) __gen_user_data *data,
4665                               __attribute__((unused)) void * restrict dst,
4666                               __attribute__((unused)) const struct GEN9_3DSTATE_LINE_STIPPLE * restrict values)
4667{
4668   uint32_t * restrict dw = (uint32_t * restrict) dst;
4669
4670   dw[0] =
4671      __gen_uint(values->DWordLength, 0, 7) |
4672      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4673      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4674      __gen_uint(values->CommandSubType, 27, 28) |
4675      __gen_uint(values->CommandType, 29, 31);
4676
4677   dw[1] =
4678      __gen_uint(values->LineStipplePattern, 0, 15) |
4679      __gen_uint(values->CurrentStippleIndex, 16, 19) |
4680      __gen_uint(values->CurrentRepeatCounter, 21, 29) |
4681      __gen_uint(values->ModifyEnableCurrentRepeatCounterCurrentStippleIndex, 31, 31);
4682
4683   dw[2] =
4684      __gen_uint(values->LineStippleRepeatCount, 0, 8) |
4685      __gen_ufixed(values->LineStippleInverseRepeatCount, 15, 31, 16);
4686}
4687
4688#define GEN9_3DSTATE_MONOFILTER_SIZE_length      2
4689#define GEN9_3DSTATE_MONOFILTER_SIZE_length_bias      2
4690#define GEN9_3DSTATE_MONOFILTER_SIZE_header     \
4691   .DWordLength                         =      0,  \
4692   ._3DCommandSubOpcode                 =     17,  \
4693   ._3DCommandOpcode                    =      1,  \
4694   .CommandSubType                      =      3,  \
4695   .CommandType                         =      3
4696
4697struct GEN9_3DSTATE_MONOFILTER_SIZE {
4698   uint32_t                             DWordLength;
4699   uint32_t                             _3DCommandSubOpcode;
4700   uint32_t                             _3DCommandOpcode;
4701   uint32_t                             CommandSubType;
4702   uint32_t                             CommandType;
4703   uint32_t                             MonochromeFilterHeight;
4704   uint32_t                             MonochromeFilterWidth;
4705};
4706
4707static inline void
4708GEN9_3DSTATE_MONOFILTER_SIZE_pack(__attribute__((unused)) __gen_user_data *data,
4709                                  __attribute__((unused)) void * restrict dst,
4710                                  __attribute__((unused)) const struct GEN9_3DSTATE_MONOFILTER_SIZE * restrict values)
4711{
4712   uint32_t * restrict dw = (uint32_t * restrict) dst;
4713
4714   dw[0] =
4715      __gen_uint(values->DWordLength, 0, 7) |
4716      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4717      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4718      __gen_uint(values->CommandSubType, 27, 28) |
4719      __gen_uint(values->CommandType, 29, 31);
4720
4721   dw[1] =
4722      __gen_uint(values->MonochromeFilterHeight, 0, 2) |
4723      __gen_uint(values->MonochromeFilterWidth, 3, 5);
4724}
4725
4726#define GEN9_3DSTATE_MULTISAMPLE_length        2
4727#define GEN9_3DSTATE_MULTISAMPLE_length_bias      2
4728#define GEN9_3DSTATE_MULTISAMPLE_header         \
4729   .DWordLength                         =      0,  \
4730   ._3DCommandSubOpcode                 =     13,  \
4731   ._3DCommandOpcode                    =      0,  \
4732   .CommandSubType                      =      3,  \
4733   .CommandType                         =      3
4734
4735struct GEN9_3DSTATE_MULTISAMPLE {
4736   uint32_t                             DWordLength;
4737   uint32_t                             _3DCommandSubOpcode;
4738   uint32_t                             _3DCommandOpcode;
4739   uint32_t                             CommandSubType;
4740   uint32_t                             CommandType;
4741   uint32_t                             NumberofMultisamples;
4742   uint32_t                             PixelLocation;
4743#define CENTER                                   0
4744#define UL_CORNER                                1
4745   bool                                 PixelPositionOffsetEnable;
4746};
4747
4748static inline void
4749GEN9_3DSTATE_MULTISAMPLE_pack(__attribute__((unused)) __gen_user_data *data,
4750                              __attribute__((unused)) void * restrict dst,
4751                              __attribute__((unused)) const struct GEN9_3DSTATE_MULTISAMPLE * restrict values)
4752{
4753   uint32_t * restrict dw = (uint32_t * restrict) dst;
4754
4755   dw[0] =
4756      __gen_uint(values->DWordLength, 0, 7) |
4757      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4758      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4759      __gen_uint(values->CommandSubType, 27, 28) |
4760      __gen_uint(values->CommandType, 29, 31);
4761
4762   dw[1] =
4763      __gen_uint(values->NumberofMultisamples, 1, 3) |
4764      __gen_uint(values->PixelLocation, 4, 4) |
4765      __gen_uint(values->PixelPositionOffsetEnable, 5, 5);
4766}
4767
4768#define GEN9_3DSTATE_POLY_STIPPLE_OFFSET_length      2
4769#define GEN9_3DSTATE_POLY_STIPPLE_OFFSET_length_bias      2
4770#define GEN9_3DSTATE_POLY_STIPPLE_OFFSET_header \
4771   .DWordLength                         =      0,  \
4772   ._3DCommandSubOpcode                 =      6,  \
4773   ._3DCommandOpcode                    =      1,  \
4774   .CommandSubType                      =      3,  \
4775   .CommandType                         =      3
4776
4777struct GEN9_3DSTATE_POLY_STIPPLE_OFFSET {
4778   uint32_t                             DWordLength;
4779   uint32_t                             _3DCommandSubOpcode;
4780   uint32_t                             _3DCommandOpcode;
4781   uint32_t                             CommandSubType;
4782   uint32_t                             CommandType;
4783   uint32_t                             PolygonStippleYOffset;
4784   uint32_t                             PolygonStippleXOffset;
4785};
4786
4787static inline void
4788GEN9_3DSTATE_POLY_STIPPLE_OFFSET_pack(__attribute__((unused)) __gen_user_data *data,
4789                                      __attribute__((unused)) void * restrict dst,
4790                                      __attribute__((unused)) const struct GEN9_3DSTATE_POLY_STIPPLE_OFFSET * restrict values)
4791{
4792   uint32_t * restrict dw = (uint32_t * restrict) dst;
4793
4794   dw[0] =
4795      __gen_uint(values->DWordLength, 0, 7) |
4796      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4797      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4798      __gen_uint(values->CommandSubType, 27, 28) |
4799      __gen_uint(values->CommandType, 29, 31);
4800
4801   dw[1] =
4802      __gen_uint(values->PolygonStippleYOffset, 0, 4) |
4803      __gen_uint(values->PolygonStippleXOffset, 8, 12);
4804}
4805
4806#define GEN9_3DSTATE_POLY_STIPPLE_PATTERN_length     33
4807#define GEN9_3DSTATE_POLY_STIPPLE_PATTERN_length_bias      2
4808#define GEN9_3DSTATE_POLY_STIPPLE_PATTERN_header\
4809   .DWordLength                         =     31,  \
4810   ._3DCommandSubOpcode                 =      7,  \
4811   ._3DCommandOpcode                    =      1,  \
4812   .CommandSubType                      =      3,  \
4813   .CommandType                         =      3
4814
4815struct GEN9_3DSTATE_POLY_STIPPLE_PATTERN {
4816   uint32_t                             DWordLength;
4817   uint32_t                             _3DCommandSubOpcode;
4818   uint32_t                             _3DCommandOpcode;
4819   uint32_t                             CommandSubType;
4820   uint32_t                             CommandType;
4821   uint32_t                             PatternRow[32];
4822};
4823
4824static inline void
4825GEN9_3DSTATE_POLY_STIPPLE_PATTERN_pack(__attribute__((unused)) __gen_user_data *data,
4826                                       __attribute__((unused)) void * restrict dst,
4827                                       __attribute__((unused)) const struct GEN9_3DSTATE_POLY_STIPPLE_PATTERN * restrict values)
4828{
4829   uint32_t * restrict dw = (uint32_t * restrict) dst;
4830
4831   dw[0] =
4832      __gen_uint(values->DWordLength, 0, 7) |
4833      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4834      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4835      __gen_uint(values->CommandSubType, 27, 28) |
4836      __gen_uint(values->CommandType, 29, 31);
4837
4838   dw[1] =
4839      __gen_uint(values->PatternRow[0], 0, 31);
4840
4841   dw[2] =
4842      __gen_uint(values->PatternRow[1], 0, 31);
4843
4844   dw[3] =
4845      __gen_uint(values->PatternRow[2], 0, 31);
4846
4847   dw[4] =
4848      __gen_uint(values->PatternRow[3], 0, 31);
4849
4850   dw[5] =
4851      __gen_uint(values->PatternRow[4], 0, 31);
4852
4853   dw[6] =
4854      __gen_uint(values->PatternRow[5], 0, 31);
4855
4856   dw[7] =
4857      __gen_uint(values->PatternRow[6], 0, 31);
4858
4859   dw[8] =
4860      __gen_uint(values->PatternRow[7], 0, 31);
4861
4862   dw[9] =
4863      __gen_uint(values->PatternRow[8], 0, 31);
4864
4865   dw[10] =
4866      __gen_uint(values->PatternRow[9], 0, 31);
4867
4868   dw[11] =
4869      __gen_uint(values->PatternRow[10], 0, 31);
4870
4871   dw[12] =
4872      __gen_uint(values->PatternRow[11], 0, 31);
4873
4874   dw[13] =
4875      __gen_uint(values->PatternRow[12], 0, 31);
4876
4877   dw[14] =
4878      __gen_uint(values->PatternRow[13], 0, 31);
4879
4880   dw[15] =
4881      __gen_uint(values->PatternRow[14], 0, 31);
4882
4883   dw[16] =
4884      __gen_uint(values->PatternRow[15], 0, 31);
4885
4886   dw[17] =
4887      __gen_uint(values->PatternRow[16], 0, 31);
4888
4889   dw[18] =
4890      __gen_uint(values->PatternRow[17], 0, 31);
4891
4892   dw[19] =
4893      __gen_uint(values->PatternRow[18], 0, 31);
4894
4895   dw[20] =
4896      __gen_uint(values->PatternRow[19], 0, 31);
4897
4898   dw[21] =
4899      __gen_uint(values->PatternRow[20], 0, 31);
4900
4901   dw[22] =
4902      __gen_uint(values->PatternRow[21], 0, 31);
4903
4904   dw[23] =
4905      __gen_uint(values->PatternRow[22], 0, 31);
4906
4907   dw[24] =
4908      __gen_uint(values->PatternRow[23], 0, 31);
4909
4910   dw[25] =
4911      __gen_uint(values->PatternRow[24], 0, 31);
4912
4913   dw[26] =
4914      __gen_uint(values->PatternRow[25], 0, 31);
4915
4916   dw[27] =
4917      __gen_uint(values->PatternRow[26], 0, 31);
4918
4919   dw[28] =
4920      __gen_uint(values->PatternRow[27], 0, 31);
4921
4922   dw[29] =
4923      __gen_uint(values->PatternRow[28], 0, 31);
4924
4925   dw[30] =
4926      __gen_uint(values->PatternRow[29], 0, 31);
4927
4928   dw[31] =
4929      __gen_uint(values->PatternRow[30], 0, 31);
4930
4931   dw[32] =
4932      __gen_uint(values->PatternRow[31], 0, 31);
4933}
4934
4935#define GEN9_3DSTATE_PS_length                12
4936#define GEN9_3DSTATE_PS_length_bias            2
4937#define GEN9_3DSTATE_PS_header                  \
4938   .DWordLength                         =     10,  \
4939   ._3DCommandSubOpcode                 =     32,  \
4940   ._3DCommandOpcode                    =      0,  \
4941   .CommandSubType                      =      3,  \
4942   .CommandType                         =      3
4943
4944struct GEN9_3DSTATE_PS {
4945   uint32_t                             DWordLength;
4946   uint32_t                             _3DCommandSubOpcode;
4947   uint32_t                             _3DCommandOpcode;
4948   uint32_t                             CommandSubType;
4949   uint32_t                             CommandType;
4950   uint64_t                             KernelStartPointer0;
4951   bool                                 SoftwareExceptionEnable;
4952   bool                                 MaskStackExceptionEnable;
4953   bool                                 IllegalOpcodeExceptionEnable;
4954   uint32_t                             RoundingMode;
4955#define RTNE                                     0
4956#define RU                                       1
4957#define RD                                       2
4958#define RTZ                                      3
4959   uint32_t                             FloatingPointMode;
4960#define IEEE754                                  0
4961#define Alternate                                1
4962   uint32_t                             ThreadDispatchPriority;
4963#define High                                     1
4964   uint32_t                             BindingTableEntryCount;
4965   uint32_t                             SinglePrecisionDenormalMode;
4966#define FlushedtoZero                            0
4967#define Retained                                 1
4968   uint32_t                             SamplerCount;
4969#define NoSamplers                               0
4970#define _14Samplers                              1
4971#define _58Samplers                              2
4972#define _912Samplers                             3
4973#define _1316Samplers                            4
4974   bool                                 VectorMaskEnable;
4975   bool                                 SingleProgramFlow;
4976   uint32_t                             PerThreadScratchSpace;
4977   __gen_address_type                   ScratchSpaceBasePointer;
4978   bool                                 _8PixelDispatchEnable;
4979   bool                                 _16PixelDispatchEnable;
4980   bool                                 _32PixelDispatchEnable;
4981   uint32_t                             PositionXYOffsetSelect;
4982#define POSOFFSET_NONE                           0
4983#define POSOFFSET_CENTROID                       2
4984#define POSOFFSET_SAMPLE                         3
4985   uint32_t                             RenderTargetResolveType;
4986#define RESOLVE_DISABLED                         0
4987#define RESOLVE_PARTIAL                          1
4988#define RESOLVE_FULL                             3
4989   bool                                 RenderTargetFastClearEnable;
4990   bool                                 PushConstantEnable;
4991   uint32_t                             MaximumNumberofThreadsPerPSD;
4992   uint32_t                             DispatchGRFStartRegisterForConstantSetupData2;
4993   uint32_t                             DispatchGRFStartRegisterForConstantSetupData1;
4994   uint32_t                             DispatchGRFStartRegisterForConstantSetupData0;
4995   uint64_t                             KernelStartPointer1;
4996   uint64_t                             KernelStartPointer2;
4997};
4998
4999static inline void
5000GEN9_3DSTATE_PS_pack(__attribute__((unused)) __gen_user_data *data,
5001                     __attribute__((unused)) void * restrict dst,
5002                     __attribute__((unused)) const struct GEN9_3DSTATE_PS * restrict values)
5003{
5004   uint32_t * restrict dw = (uint32_t * restrict) dst;
5005
5006   dw[0] =
5007      __gen_uint(values->DWordLength, 0, 7) |
5008      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5009      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5010      __gen_uint(values->CommandSubType, 27, 28) |
5011      __gen_uint(values->CommandType, 29, 31);
5012
5013   const uint64_t v1 =
5014      __gen_offset(values->KernelStartPointer0, 6, 63);
5015   dw[1] = v1;
5016   dw[2] = v1 >> 32;
5017
5018   dw[3] =
5019      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
5020      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
5021      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
5022      __gen_uint(values->RoundingMode, 14, 15) |
5023      __gen_uint(values->FloatingPointMode, 16, 16) |
5024      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
5025      __gen_uint(values->BindingTableEntryCount, 18, 25) |
5026      __gen_uint(values->SinglePrecisionDenormalMode, 26, 26) |
5027      __gen_uint(values->SamplerCount, 27, 29) |
5028      __gen_uint(values->VectorMaskEnable, 30, 30) |
5029      __gen_uint(values->SingleProgramFlow, 31, 31);
5030
5031   const uint64_t v4 =
5032      __gen_uint(values->PerThreadScratchSpace, 0, 3);
5033   const uint64_t v4_address =
5034      __gen_combine_address(data, &dw[4], values->ScratchSpaceBasePointer, v4);
5035   dw[4] = v4_address;
5036   dw[5] = (v4_address >> 32) | (v4 >> 32);
5037
5038   dw[6] =
5039      __gen_uint(values->_8PixelDispatchEnable, 0, 0) |
5040      __gen_uint(values->_16PixelDispatchEnable, 1, 1) |
5041      __gen_uint(values->_32PixelDispatchEnable, 2, 2) |
5042      __gen_uint(values->PositionXYOffsetSelect, 3, 4) |
5043      __gen_uint(values->RenderTargetResolveType, 6, 7) |
5044      __gen_uint(values->RenderTargetFastClearEnable, 8, 8) |
5045      __gen_uint(values->PushConstantEnable, 11, 11) |
5046      __gen_uint(values->MaximumNumberofThreadsPerPSD, 23, 31);
5047
5048   dw[7] =
5049      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData2, 0, 6) |
5050      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData1, 8, 14) |
5051      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData0, 16, 22);
5052
5053   const uint64_t v8 =
5054      __gen_offset(values->KernelStartPointer1, 6, 63);
5055   dw[8] = v8;
5056   dw[9] = v8 >> 32;
5057
5058   const uint64_t v10 =
5059      __gen_offset(values->KernelStartPointer2, 6, 63);
5060   dw[10] = v10;
5061   dw[11] = v10 >> 32;
5062}
5063
5064#define GEN9_3DSTATE_PS_BLEND_length           2
5065#define GEN9_3DSTATE_PS_BLEND_length_bias      2
5066#define GEN9_3DSTATE_PS_BLEND_header            \
5067   .DWordLength                         =      0,  \
5068   ._3DCommandSubOpcode                 =     77,  \
5069   ._3DCommandOpcode                    =      0,  \
5070   .CommandSubType                      =      3,  \
5071   .CommandType                         =      3
5072
5073struct GEN9_3DSTATE_PS_BLEND {
5074   uint32_t                             DWordLength;
5075   uint32_t                             _3DCommandSubOpcode;
5076   uint32_t                             _3DCommandOpcode;
5077   uint32_t                             CommandSubType;
5078   uint32_t                             CommandType;
5079   bool                                 IndependentAlphaBlendEnable;
5080   bool                                 AlphaTestEnable;
5081   enum GEN9_3D_Color_Buffer_Blend_Factor DestinationBlendFactor;
5082   enum GEN9_3D_Color_Buffer_Blend_Factor SourceBlendFactor;
5083   enum GEN9_3D_Color_Buffer_Blend_Factor DestinationAlphaBlendFactor;
5084   enum GEN9_3D_Color_Buffer_Blend_Factor SourceAlphaBlendFactor;
5085   bool                                 ColorBufferBlendEnable;
5086   bool                                 HasWriteableRT;
5087   bool                                 AlphaToCoverageEnable;
5088};
5089
5090static inline void
5091GEN9_3DSTATE_PS_BLEND_pack(__attribute__((unused)) __gen_user_data *data,
5092                           __attribute__((unused)) void * restrict dst,
5093                           __attribute__((unused)) const struct GEN9_3DSTATE_PS_BLEND * restrict values)
5094{
5095   uint32_t * restrict dw = (uint32_t * restrict) dst;
5096
5097   dw[0] =
5098      __gen_uint(values->DWordLength, 0, 7) |
5099      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5100      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5101      __gen_uint(values->CommandSubType, 27, 28) |
5102      __gen_uint(values->CommandType, 29, 31);
5103
5104   dw[1] =
5105      __gen_uint(values->IndependentAlphaBlendEnable, 7, 7) |
5106      __gen_uint(values->AlphaTestEnable, 8, 8) |
5107      __gen_uint(values->DestinationBlendFactor, 9, 13) |
5108      __gen_uint(values->SourceBlendFactor, 14, 18) |
5109      __gen_uint(values->DestinationAlphaBlendFactor, 19, 23) |
5110      __gen_uint(values->SourceAlphaBlendFactor, 24, 28) |
5111      __gen_uint(values->ColorBufferBlendEnable, 29, 29) |
5112      __gen_uint(values->HasWriteableRT, 30, 30) |
5113      __gen_uint(values->AlphaToCoverageEnable, 31, 31);
5114}
5115
5116#define GEN9_3DSTATE_PS_EXTRA_length           2
5117#define GEN9_3DSTATE_PS_EXTRA_length_bias      2
5118#define GEN9_3DSTATE_PS_EXTRA_header            \
5119   .DWordLength                         =      0,  \
5120   ._3DCommandSubOpcode                 =     79,  \
5121   ._3DCommandOpcode                    =      0,  \
5122   .CommandSubType                      =      3,  \
5123   .CommandType                         =      3
5124
5125struct GEN9_3DSTATE_PS_EXTRA {
5126   uint32_t                             DWordLength;
5127   uint32_t                             _3DCommandSubOpcode;
5128   uint32_t                             _3DCommandOpcode;
5129   uint32_t                             CommandSubType;
5130   uint32_t                             CommandType;
5131   uint32_t                             InputCoverageMaskState;
5132#define ICMS_NONE                                0
5133#define ICMS_NORMAL                              1
5134#define ICMS_INNER_CONSERVATIVE                  2
5135#define ICMS_DEPTH_COVERAGE                      3
5136   bool                                 PixelShaderHasUAV;
5137   bool                                 PixelShaderPullsBary;
5138   bool                                 PixelShaderComputesStencil;
5139   bool                                 PixelShaderIsPerSample;
5140   bool                                 PixelShaderDisablesAlphaToCoverage;
5141   bool                                 AttributeEnable;
5142   bool                                 PixelShaderUsesSourceW;
5143   bool                                 PixelShaderUsesSourceDepth;
5144   bool                                 ForceComputedDepth;
5145   uint32_t                             PixelShaderComputedDepthMode;
5146#define PSCDEPTH_OFF                             0
5147#define PSCDEPTH_ON                              1
5148#define PSCDEPTH_ON_GE                           2
5149#define PSCDEPTH_ON_LE                           3
5150   bool                                 PixelShaderKillsPixel;
5151   bool                                 oMaskPresenttoRenderTarget;
5152   bool                                 PixelShaderDoesnotwritetoRT;
5153   bool                                 PixelShaderValid;
5154};
5155
5156static inline void
5157GEN9_3DSTATE_PS_EXTRA_pack(__attribute__((unused)) __gen_user_data *data,
5158                           __attribute__((unused)) void * restrict dst,
5159                           __attribute__((unused)) const struct GEN9_3DSTATE_PS_EXTRA * restrict values)
5160{
5161   uint32_t * restrict dw = (uint32_t * restrict) dst;
5162
5163   dw[0] =
5164      __gen_uint(values->DWordLength, 0, 7) |
5165      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5166      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5167      __gen_uint(values->CommandSubType, 27, 28) |
5168      __gen_uint(values->CommandType, 29, 31);
5169
5170   dw[1] =
5171      __gen_uint(values->InputCoverageMaskState, 0, 1) |
5172      __gen_uint(values->PixelShaderHasUAV, 2, 2) |
5173      __gen_uint(values->PixelShaderPullsBary, 3, 3) |
5174      __gen_uint(values->PixelShaderComputesStencil, 5, 5) |
5175      __gen_uint(values->PixelShaderIsPerSample, 6, 6) |
5176      __gen_uint(values->PixelShaderDisablesAlphaToCoverage, 7, 7) |
5177      __gen_uint(values->AttributeEnable, 8, 8) |
5178      __gen_uint(values->PixelShaderUsesSourceW, 23, 23) |
5179      __gen_uint(values->PixelShaderUsesSourceDepth, 24, 24) |
5180      __gen_uint(values->ForceComputedDepth, 25, 25) |
5181      __gen_uint(values->PixelShaderComputedDepthMode, 26, 27) |
5182      __gen_uint(values->PixelShaderKillsPixel, 28, 28) |
5183      __gen_uint(values->oMaskPresenttoRenderTarget, 29, 29) |
5184      __gen_uint(values->PixelShaderDoesnotwritetoRT, 30, 30) |
5185      __gen_uint(values->PixelShaderValid, 31, 31);
5186}
5187
5188#define GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_DS_length      2
5189#define GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_DS_length_bias      2
5190#define GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_DS_header\
5191   .DWordLength                         =      0,  \
5192   ._3DCommandSubOpcode                 =     20,  \
5193   ._3DCommandOpcode                    =      1,  \
5194   .CommandSubType                      =      3,  \
5195   .CommandType                         =      3
5196
5197struct GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_DS {
5198   uint32_t                             DWordLength;
5199   uint32_t                             _3DCommandSubOpcode;
5200   uint32_t                             _3DCommandOpcode;
5201   uint32_t                             CommandSubType;
5202   uint32_t                             CommandType;
5203   uint32_t                             ConstantBufferSize;
5204   uint32_t                             ConstantBufferOffset;
5205};
5206
5207static inline void
5208GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_DS_pack(__attribute__((unused)) __gen_user_data *data,
5209                                         __attribute__((unused)) void * restrict dst,
5210                                         __attribute__((unused)) const struct GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_DS * restrict values)
5211{
5212   uint32_t * restrict dw = (uint32_t * restrict) dst;
5213
5214   dw[0] =
5215      __gen_uint(values->DWordLength, 0, 7) |
5216      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5217      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5218      __gen_uint(values->CommandSubType, 27, 28) |
5219      __gen_uint(values->CommandType, 29, 31);
5220
5221   dw[1] =
5222      __gen_uint(values->ConstantBufferSize, 0, 5) |
5223      __gen_uint(values->ConstantBufferOffset, 16, 20);
5224}
5225
5226#define GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_GS_length      2
5227#define GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_GS_length_bias      2
5228#define GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_GS_header\
5229   .DWordLength                         =      0,  \
5230   ._3DCommandSubOpcode                 =     21,  \
5231   ._3DCommandOpcode                    =      1,  \
5232   .CommandSubType                      =      3,  \
5233   .CommandType                         =      3
5234
5235struct GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_GS {
5236   uint32_t                             DWordLength;
5237   uint32_t                             _3DCommandSubOpcode;
5238   uint32_t                             _3DCommandOpcode;
5239   uint32_t                             CommandSubType;
5240   uint32_t                             CommandType;
5241   uint32_t                             ConstantBufferSize;
5242   uint32_t                             ConstantBufferOffset;
5243};
5244
5245static inline void
5246GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_GS_pack(__attribute__((unused)) __gen_user_data *data,
5247                                         __attribute__((unused)) void * restrict dst,
5248                                         __attribute__((unused)) const struct GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_GS * restrict values)
5249{
5250   uint32_t * restrict dw = (uint32_t * restrict) dst;
5251
5252   dw[0] =
5253      __gen_uint(values->DWordLength, 0, 7) |
5254      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5255      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5256      __gen_uint(values->CommandSubType, 27, 28) |
5257      __gen_uint(values->CommandType, 29, 31);
5258
5259   dw[1] =
5260      __gen_uint(values->ConstantBufferSize, 0, 5) |
5261      __gen_uint(values->ConstantBufferOffset, 16, 20);
5262}
5263
5264#define GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_HS_length      2
5265#define GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_HS_length_bias      2
5266#define GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_HS_header\
5267   .DWordLength                         =      0,  \
5268   ._3DCommandSubOpcode                 =     19,  \
5269   ._3DCommandOpcode                    =      1,  \
5270   .CommandSubType                      =      3,  \
5271   .CommandType                         =      3
5272
5273struct GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_HS {
5274   uint32_t                             DWordLength;
5275   uint32_t                             _3DCommandSubOpcode;
5276   uint32_t                             _3DCommandOpcode;
5277   uint32_t                             CommandSubType;
5278   uint32_t                             CommandType;
5279   uint32_t                             ConstantBufferSize;
5280   uint32_t                             ConstantBufferOffset;
5281};
5282
5283static inline void
5284GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_HS_pack(__attribute__((unused)) __gen_user_data *data,
5285                                         __attribute__((unused)) void * restrict dst,
5286                                         __attribute__((unused)) const struct GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_HS * restrict values)
5287{
5288   uint32_t * restrict dw = (uint32_t * restrict) dst;
5289
5290   dw[0] =
5291      __gen_uint(values->DWordLength, 0, 7) |
5292      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5293      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5294      __gen_uint(values->CommandSubType, 27, 28) |
5295      __gen_uint(values->CommandType, 29, 31);
5296
5297   dw[1] =
5298      __gen_uint(values->ConstantBufferSize, 0, 5) |
5299      __gen_uint(values->ConstantBufferOffset, 16, 20);
5300}
5301
5302#define GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_PS_length      2
5303#define GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_PS_length_bias      2
5304#define GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_PS_header\
5305   .DWordLength                         =      0,  \
5306   ._3DCommandSubOpcode                 =     22,  \
5307   ._3DCommandOpcode                    =      1,  \
5308   .CommandSubType                      =      3,  \
5309   .CommandType                         =      3
5310
5311struct GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_PS {
5312   uint32_t                             DWordLength;
5313   uint32_t                             _3DCommandSubOpcode;
5314   uint32_t                             _3DCommandOpcode;
5315   uint32_t                             CommandSubType;
5316   uint32_t                             CommandType;
5317   uint32_t                             ConstantBufferSize;
5318   uint32_t                             ConstantBufferOffset;
5319};
5320
5321static inline void
5322GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_PS_pack(__attribute__((unused)) __gen_user_data *data,
5323                                         __attribute__((unused)) void * restrict dst,
5324                                         __attribute__((unused)) const struct GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_PS * restrict values)
5325{
5326   uint32_t * restrict dw = (uint32_t * restrict) dst;
5327
5328   dw[0] =
5329      __gen_uint(values->DWordLength, 0, 7) |
5330      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5331      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5332      __gen_uint(values->CommandSubType, 27, 28) |
5333      __gen_uint(values->CommandType, 29, 31);
5334
5335   dw[1] =
5336      __gen_uint(values->ConstantBufferSize, 0, 5) |
5337      __gen_uint(values->ConstantBufferOffset, 16, 20);
5338}
5339
5340#define GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_VS_length      2
5341#define GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_VS_length_bias      2
5342#define GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_VS_header\
5343   .DWordLength                         =      0,  \
5344   ._3DCommandSubOpcode                 =     18,  \
5345   ._3DCommandOpcode                    =      1,  \
5346   .CommandSubType                      =      3,  \
5347   .CommandType                         =      3
5348
5349struct GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_VS {
5350   uint32_t                             DWordLength;
5351   uint32_t                             _3DCommandSubOpcode;
5352   uint32_t                             _3DCommandOpcode;
5353   uint32_t                             CommandSubType;
5354   uint32_t                             CommandType;
5355   uint32_t                             ConstantBufferSize;
5356   uint32_t                             ConstantBufferOffset;
5357};
5358
5359static inline void
5360GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_VS_pack(__attribute__((unused)) __gen_user_data *data,
5361                                         __attribute__((unused)) void * restrict dst,
5362                                         __attribute__((unused)) const struct GEN9_3DSTATE_PUSH_CONSTANT_ALLOC_VS * restrict values)
5363{
5364   uint32_t * restrict dw = (uint32_t * restrict) dst;
5365
5366   dw[0] =
5367      __gen_uint(values->DWordLength, 0, 7) |
5368      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5369      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5370      __gen_uint(values->CommandSubType, 27, 28) |
5371      __gen_uint(values->CommandType, 29, 31);
5372
5373   dw[1] =
5374      __gen_uint(values->ConstantBufferSize, 0, 5) |
5375      __gen_uint(values->ConstantBufferOffset, 16, 20);
5376}
5377
5378#define GEN9_3DSTATE_RASTER_length             5
5379#define GEN9_3DSTATE_RASTER_length_bias        2
5380#define GEN9_3DSTATE_RASTER_header              \
5381   .DWordLength                         =      3,  \
5382   ._3DCommandSubOpcode                 =     80,  \
5383   ._3DCommandOpcode                    =      0,  \
5384   .CommandSubType                      =      3,  \
5385   .CommandType                         =      3
5386
5387struct GEN9_3DSTATE_RASTER {
5388   uint32_t                             DWordLength;
5389   uint32_t                             _3DCommandSubOpcode;
5390   uint32_t                             _3DCommandOpcode;
5391   uint32_t                             CommandSubType;
5392   uint32_t                             CommandType;
5393   bool                                 ViewportZNearClipTestEnable;
5394   bool                                 ScissorRectangleEnable;
5395   bool                                 AntialiasingEnable;
5396   uint32_t                             BackFaceFillMode;
5397#define FILL_MODE_SOLID                          0
5398#define FILL_MODE_WIREFRAME                      1
5399#define FILL_MODE_POINT                          2
5400   uint32_t                             FrontFaceFillMode;
5401#define FILL_MODE_SOLID                          0
5402#define FILL_MODE_WIREFRAME                      1
5403#define FILL_MODE_POINT                          2
5404   bool                                 GlobalDepthOffsetEnablePoint;
5405   bool                                 GlobalDepthOffsetEnableWireframe;
5406   bool                                 GlobalDepthOffsetEnableSolid;
5407   uint32_t                             DXMultisampleRasterizationMode;
5408#define MSRASTMODE_OFF_PIXEL                     0
5409#define MSRASTMODE_OFF_PATTERN                   1
5410#define MSRASTMODE_ON_PIXEL                      2
5411#define MSRASTMODE_ON_PATTERN                    3
5412   bool                                 DXMultisampleRasterizationEnable;
5413   bool                                 SmoothPointEnable;
5414   uint32_t                             ForceMultisampling;
5415   uint32_t                             CullMode;
5416#define CULLMODE_BOTH                            0
5417#define CULLMODE_NONE                            1
5418#define CULLMODE_FRONT                           2
5419#define CULLMODE_BACK                            3
5420   uint32_t                             ForcedSampleCount;
5421#define FSC_NUMRASTSAMPLES_0                     0
5422#define FSC_NUMRASTSAMPLES_1                     1
5423#define FSC_NUMRASTSAMPLES_2                     2
5424#define FSC_NUMRASTSAMPLES_4                     3
5425#define FSC_NUMRASTSAMPLES_8                     4
5426#define FSC_NUMRASTSAMPLES_16                    5
5427   uint32_t                             FrontWinding;
5428#define Clockwise                                0
5429#define CounterClockwise                         1
5430   uint32_t                             APIMode;
5431#define DX9OGL                                   0
5432#define DX100                                    1
5433#define DX101                                    2
5434   bool                                 ConservativeRasterizationEnable;
5435   bool                                 ViewportZFarClipTestEnable;
5436   float                                GlobalDepthOffsetConstant;
5437   float                                GlobalDepthOffsetScale;
5438   float                                GlobalDepthOffsetClamp;
5439};
5440
5441static inline void
5442GEN9_3DSTATE_RASTER_pack(__attribute__((unused)) __gen_user_data *data,
5443                         __attribute__((unused)) void * restrict dst,
5444                         __attribute__((unused)) const struct GEN9_3DSTATE_RASTER * restrict values)
5445{
5446   uint32_t * restrict dw = (uint32_t * restrict) dst;
5447
5448   dw[0] =
5449      __gen_uint(values->DWordLength, 0, 7) |
5450      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5451      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5452      __gen_uint(values->CommandSubType, 27, 28) |
5453      __gen_uint(values->CommandType, 29, 31);
5454
5455   dw[1] =
5456      __gen_uint(values->ViewportZNearClipTestEnable, 0, 0) |
5457      __gen_uint(values->ScissorRectangleEnable, 1, 1) |
5458      __gen_uint(values->AntialiasingEnable, 2, 2) |
5459      __gen_uint(values->BackFaceFillMode, 3, 4) |
5460      __gen_uint(values->FrontFaceFillMode, 5, 6) |
5461      __gen_uint(values->GlobalDepthOffsetEnablePoint, 7, 7) |
5462      __gen_uint(values->GlobalDepthOffsetEnableWireframe, 8, 8) |
5463      __gen_uint(values->GlobalDepthOffsetEnableSolid, 9, 9) |
5464      __gen_uint(values->DXMultisampleRasterizationMode, 10, 11) |
5465      __gen_uint(values->DXMultisampleRasterizationEnable, 12, 12) |
5466      __gen_uint(values->SmoothPointEnable, 13, 13) |
5467      __gen_uint(values->ForceMultisampling, 14, 14) |
5468      __gen_uint(values->CullMode, 16, 17) |
5469      __gen_uint(values->ForcedSampleCount, 18, 20) |
5470      __gen_uint(values->FrontWinding, 21, 21) |
5471      __gen_uint(values->APIMode, 22, 23) |
5472      __gen_uint(values->ConservativeRasterizationEnable, 24, 24) |
5473      __gen_uint(values->ViewportZFarClipTestEnable, 26, 26);
5474
5475   dw[2] =
5476      __gen_float(values->GlobalDepthOffsetConstant);
5477
5478   dw[3] =
5479      __gen_float(values->GlobalDepthOffsetScale);
5480
5481   dw[4] =
5482      __gen_float(values->GlobalDepthOffsetClamp);
5483}
5484
5485#define GEN9_3DSTATE_RS_CONSTANT_POINTER_length      4
5486#define GEN9_3DSTATE_RS_CONSTANT_POINTER_length_bias      2
5487#define GEN9_3DSTATE_RS_CONSTANT_POINTER_header \
5488   .DWordLength                         =      2,  \
5489   ._3DCommandSubOpcode                 =     84,  \
5490   ._3DCommandOpcode                    =      0,  \
5491   .CommandSubType                      =      3,  \
5492   .CommandType                         =      3
5493
5494struct GEN9_3DSTATE_RS_CONSTANT_POINTER {
5495   uint32_t                             DWordLength;
5496   uint32_t                             _3DCommandSubOpcode;
5497   uint32_t                             _3DCommandOpcode;
5498   uint32_t                             CommandSubType;
5499   uint32_t                             CommandType;
5500   uint32_t                             OperationLoadorStore;
5501#define RS_Store                                 0
5502#define RS_Load                                  1
5503   uint32_t                             ShaderSelect;
5504#define VS                                       0
5505#define PS                                       4
5506   __gen_address_type                   GlobalConstantBufferAddress;
5507   __gen_address_type                   GlobalConstantBufferAddressHigh;
5508};
5509
5510static inline void
5511GEN9_3DSTATE_RS_CONSTANT_POINTER_pack(__attribute__((unused)) __gen_user_data *data,
5512                                      __attribute__((unused)) void * restrict dst,
5513                                      __attribute__((unused)) const struct GEN9_3DSTATE_RS_CONSTANT_POINTER * restrict values)
5514{
5515   uint32_t * restrict dw = (uint32_t * restrict) dst;
5516
5517   dw[0] =
5518      __gen_uint(values->DWordLength, 0, 7) |
5519      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5520      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5521      __gen_uint(values->CommandSubType, 27, 28) |
5522      __gen_uint(values->CommandType, 29, 31);
5523
5524   dw[1] =
5525      __gen_uint(values->OperationLoadorStore, 12, 12) |
5526      __gen_uint(values->ShaderSelect, 28, 30);
5527
5528   dw[2] = __gen_combine_address(data, &dw[2], values->GlobalConstantBufferAddress, 0);
5529
5530   dw[3] = __gen_combine_address(data, &dw[3], values->GlobalConstantBufferAddressHigh, 0);
5531}
5532
5533#define GEN9_3DSTATE_SAMPLER_PALETTE_LOAD0_length_bias      2
5534#define GEN9_3DSTATE_SAMPLER_PALETTE_LOAD0_header\
5535   ._3DCommandSubOpcode                 =      2,  \
5536   ._3DCommandOpcode                    =      1,  \
5537   .CommandSubType                      =      3,  \
5538   .CommandType                         =      3
5539
5540struct GEN9_3DSTATE_SAMPLER_PALETTE_LOAD0 {
5541   uint32_t                             DWordLength;
5542   uint32_t                             _3DCommandSubOpcode;
5543   uint32_t                             _3DCommandOpcode;
5544   uint32_t                             CommandSubType;
5545   uint32_t                             CommandType;
5546   /* variable length fields follow */
5547};
5548
5549static inline void
5550GEN9_3DSTATE_SAMPLER_PALETTE_LOAD0_pack(__attribute__((unused)) __gen_user_data *data,
5551                                        __attribute__((unused)) void * restrict dst,
5552                                        __attribute__((unused)) const struct GEN9_3DSTATE_SAMPLER_PALETTE_LOAD0 * restrict values)
5553{
5554   uint32_t * restrict dw = (uint32_t * restrict) dst;
5555
5556   dw[0] =
5557      __gen_uint(values->DWordLength, 0, 7) |
5558      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5559      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5560      __gen_uint(values->CommandSubType, 27, 28) |
5561      __gen_uint(values->CommandType, 29, 31);
5562}
5563
5564#define GEN9_3DSTATE_SAMPLER_PALETTE_LOAD1_length_bias      2
5565#define GEN9_3DSTATE_SAMPLER_PALETTE_LOAD1_header\
5566   .DWordLength                         =      0,  \
5567   ._3DCommandSubOpcode                 =     12,  \
5568   ._3DCommandOpcode                    =      1,  \
5569   .CommandSubType                      =      3,  \
5570   .CommandType                         =      3
5571
5572struct GEN9_3DSTATE_SAMPLER_PALETTE_LOAD1 {
5573   uint32_t                             DWordLength;
5574   uint32_t                             _3DCommandSubOpcode;
5575   uint32_t                             _3DCommandOpcode;
5576   uint32_t                             CommandSubType;
5577   uint32_t                             CommandType;
5578   /* variable length fields follow */
5579};
5580
5581static inline void
5582GEN9_3DSTATE_SAMPLER_PALETTE_LOAD1_pack(__attribute__((unused)) __gen_user_data *data,
5583                                        __attribute__((unused)) void * restrict dst,
5584                                        __attribute__((unused)) const struct GEN9_3DSTATE_SAMPLER_PALETTE_LOAD1 * restrict values)
5585{
5586   uint32_t * restrict dw = (uint32_t * restrict) dst;
5587
5588   dw[0] =
5589      __gen_uint(values->DWordLength, 0, 7) |
5590      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5591      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5592      __gen_uint(values->CommandSubType, 27, 28) |
5593      __gen_uint(values->CommandType, 29, 31);
5594}
5595
5596#define GEN9_3DSTATE_SAMPLER_STATE_POINTERS_DS_length      2
5597#define GEN9_3DSTATE_SAMPLER_STATE_POINTERS_DS_length_bias      2
5598#define GEN9_3DSTATE_SAMPLER_STATE_POINTERS_DS_header\
5599   .DWordLength                         =      0,  \
5600   ._3DCommandSubOpcode                 =     45,  \
5601   ._3DCommandOpcode                    =      0,  \
5602   .CommandSubType                      =      3,  \
5603   .CommandType                         =      3
5604
5605struct GEN9_3DSTATE_SAMPLER_STATE_POINTERS_DS {
5606   uint32_t                             DWordLength;
5607   uint32_t                             _3DCommandSubOpcode;
5608   uint32_t                             _3DCommandOpcode;
5609   uint32_t                             CommandSubType;
5610   uint32_t                             CommandType;
5611   uint64_t                             PointertoDSSamplerState;
5612};
5613
5614static inline void
5615GEN9_3DSTATE_SAMPLER_STATE_POINTERS_DS_pack(__attribute__((unused)) __gen_user_data *data,
5616                                            __attribute__((unused)) void * restrict dst,
5617                                            __attribute__((unused)) const struct GEN9_3DSTATE_SAMPLER_STATE_POINTERS_DS * restrict values)
5618{
5619   uint32_t * restrict dw = (uint32_t * restrict) dst;
5620
5621   dw[0] =
5622      __gen_uint(values->DWordLength, 0, 7) |
5623      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5624      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5625      __gen_uint(values->CommandSubType, 27, 28) |
5626      __gen_uint(values->CommandType, 29, 31);
5627
5628   dw[1] =
5629      __gen_offset(values->PointertoDSSamplerState, 5, 31);
5630}
5631
5632#define GEN9_3DSTATE_SAMPLER_STATE_POINTERS_GS_length      2
5633#define GEN9_3DSTATE_SAMPLER_STATE_POINTERS_GS_length_bias      2
5634#define GEN9_3DSTATE_SAMPLER_STATE_POINTERS_GS_header\
5635   .DWordLength                         =      0,  \
5636   ._3DCommandSubOpcode                 =     46,  \
5637   ._3DCommandOpcode                    =      0,  \
5638   .CommandSubType                      =      3,  \
5639   .CommandType                         =      3
5640
5641struct GEN9_3DSTATE_SAMPLER_STATE_POINTERS_GS {
5642   uint32_t                             DWordLength;
5643   uint32_t                             _3DCommandSubOpcode;
5644   uint32_t                             _3DCommandOpcode;
5645   uint32_t                             CommandSubType;
5646   uint32_t                             CommandType;
5647   uint64_t                             PointertoGSSamplerState;
5648};
5649
5650static inline void
5651GEN9_3DSTATE_SAMPLER_STATE_POINTERS_GS_pack(__attribute__((unused)) __gen_user_data *data,
5652                                            __attribute__((unused)) void * restrict dst,
5653                                            __attribute__((unused)) const struct GEN9_3DSTATE_SAMPLER_STATE_POINTERS_GS * restrict values)
5654{
5655   uint32_t * restrict dw = (uint32_t * restrict) dst;
5656
5657   dw[0] =
5658      __gen_uint(values->DWordLength, 0, 7) |
5659      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5660      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5661      __gen_uint(values->CommandSubType, 27, 28) |
5662      __gen_uint(values->CommandType, 29, 31);
5663
5664   dw[1] =
5665      __gen_offset(values->PointertoGSSamplerState, 5, 31);
5666}
5667
5668#define GEN9_3DSTATE_SAMPLER_STATE_POINTERS_HS_length      2
5669#define GEN9_3DSTATE_SAMPLER_STATE_POINTERS_HS_length_bias      2
5670#define GEN9_3DSTATE_SAMPLER_STATE_POINTERS_HS_header\
5671   .DWordLength                         =      0,  \
5672   ._3DCommandSubOpcode                 =     44,  \
5673   ._3DCommandOpcode                    =      0,  \
5674   .CommandSubType                      =      3,  \
5675   .CommandType                         =      3
5676
5677struct GEN9_3DSTATE_SAMPLER_STATE_POINTERS_HS {
5678   uint32_t                             DWordLength;
5679   uint32_t                             _3DCommandSubOpcode;
5680   uint32_t                             _3DCommandOpcode;
5681   uint32_t                             CommandSubType;
5682   uint32_t                             CommandType;
5683   uint64_t                             PointertoHSSamplerState;
5684};
5685
5686static inline void
5687GEN9_3DSTATE_SAMPLER_STATE_POINTERS_HS_pack(__attribute__((unused)) __gen_user_data *data,
5688                                            __attribute__((unused)) void * restrict dst,
5689                                            __attribute__((unused)) const struct GEN9_3DSTATE_SAMPLER_STATE_POINTERS_HS * restrict values)
5690{
5691   uint32_t * restrict dw = (uint32_t * restrict) dst;
5692
5693   dw[0] =
5694      __gen_uint(values->DWordLength, 0, 7) |
5695      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5696      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5697      __gen_uint(values->CommandSubType, 27, 28) |
5698      __gen_uint(values->CommandType, 29, 31);
5699
5700   dw[1] =
5701      __gen_offset(values->PointertoHSSamplerState, 5, 31);
5702}
5703
5704#define GEN9_3DSTATE_SAMPLER_STATE_POINTERS_PS_length      2
5705#define GEN9_3DSTATE_SAMPLER_STATE_POINTERS_PS_length_bias      2
5706#define GEN9_3DSTATE_SAMPLER_STATE_POINTERS_PS_header\
5707   .DWordLength                         =      0,  \
5708   ._3DCommandSubOpcode                 =     47,  \
5709   ._3DCommandOpcode                    =      0,  \
5710   .CommandSubType                      =      3,  \
5711   .CommandType                         =      3
5712
5713struct GEN9_3DSTATE_SAMPLER_STATE_POINTERS_PS {
5714   uint32_t                             DWordLength;
5715   uint32_t                             _3DCommandSubOpcode;
5716   uint32_t                             _3DCommandOpcode;
5717   uint32_t                             CommandSubType;
5718   uint32_t                             CommandType;
5719   uint64_t                             PointertoPSSamplerState;
5720};
5721
5722static inline void
5723GEN9_3DSTATE_SAMPLER_STATE_POINTERS_PS_pack(__attribute__((unused)) __gen_user_data *data,
5724                                            __attribute__((unused)) void * restrict dst,
5725                                            __attribute__((unused)) const struct GEN9_3DSTATE_SAMPLER_STATE_POINTERS_PS * restrict values)
5726{
5727   uint32_t * restrict dw = (uint32_t * restrict) dst;
5728
5729   dw[0] =
5730      __gen_uint(values->DWordLength, 0, 7) |
5731      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5732      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5733      __gen_uint(values->CommandSubType, 27, 28) |
5734      __gen_uint(values->CommandType, 29, 31);
5735
5736   dw[1] =
5737      __gen_offset(values->PointertoPSSamplerState, 5, 31);
5738}
5739
5740#define GEN9_3DSTATE_SAMPLER_STATE_POINTERS_VS_length      2
5741#define GEN9_3DSTATE_SAMPLER_STATE_POINTERS_VS_length_bias      2
5742#define GEN9_3DSTATE_SAMPLER_STATE_POINTERS_VS_header\
5743   .DWordLength                         =      0,  \
5744   ._3DCommandSubOpcode                 =     43,  \
5745   ._3DCommandOpcode                    =      0,  \
5746   .CommandSubType                      =      3,  \
5747   .CommandType                         =      3
5748
5749struct GEN9_3DSTATE_SAMPLER_STATE_POINTERS_VS {
5750   uint32_t                             DWordLength;
5751   uint32_t                             _3DCommandSubOpcode;
5752   uint32_t                             _3DCommandOpcode;
5753   uint32_t                             CommandSubType;
5754   uint32_t                             CommandType;
5755   uint64_t                             PointertoVSSamplerState;
5756};
5757
5758static inline void
5759GEN9_3DSTATE_SAMPLER_STATE_POINTERS_VS_pack(__attribute__((unused)) __gen_user_data *data,
5760                                            __attribute__((unused)) void * restrict dst,
5761                                            __attribute__((unused)) const struct GEN9_3DSTATE_SAMPLER_STATE_POINTERS_VS * restrict values)
5762{
5763   uint32_t * restrict dw = (uint32_t * restrict) dst;
5764
5765   dw[0] =
5766      __gen_uint(values->DWordLength, 0, 7) |
5767      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5768      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5769      __gen_uint(values->CommandSubType, 27, 28) |
5770      __gen_uint(values->CommandType, 29, 31);
5771
5772   dw[1] =
5773      __gen_offset(values->PointertoVSSamplerState, 5, 31);
5774}
5775
5776#define GEN9_3DSTATE_SAMPLE_MASK_length        2
5777#define GEN9_3DSTATE_SAMPLE_MASK_length_bias      2
5778#define GEN9_3DSTATE_SAMPLE_MASK_header         \
5779   .DWordLength                         =      0,  \
5780   ._3DCommandSubOpcode                 =     24,  \
5781   ._3DCommandOpcode                    =      0,  \
5782   .CommandSubType                      =      3,  \
5783   .CommandType                         =      3
5784
5785struct GEN9_3DSTATE_SAMPLE_MASK {
5786   uint32_t                             DWordLength;
5787   uint32_t                             _3DCommandSubOpcode;
5788   uint32_t                             _3DCommandOpcode;
5789   uint32_t                             CommandSubType;
5790   uint32_t                             CommandType;
5791   uint32_t                             SampleMask;
5792};
5793
5794static inline void
5795GEN9_3DSTATE_SAMPLE_MASK_pack(__attribute__((unused)) __gen_user_data *data,
5796                              __attribute__((unused)) void * restrict dst,
5797                              __attribute__((unused)) const struct GEN9_3DSTATE_SAMPLE_MASK * restrict values)
5798{
5799   uint32_t * restrict dw = (uint32_t * restrict) dst;
5800
5801   dw[0] =
5802      __gen_uint(values->DWordLength, 0, 7) |
5803      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5804      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5805      __gen_uint(values->CommandSubType, 27, 28) |
5806      __gen_uint(values->CommandType, 29, 31);
5807
5808   dw[1] =
5809      __gen_uint(values->SampleMask, 0, 15);
5810}
5811
5812#define GEN9_3DSTATE_SAMPLE_PATTERN_length      9
5813#define GEN9_3DSTATE_SAMPLE_PATTERN_length_bias      2
5814#define GEN9_3DSTATE_SAMPLE_PATTERN_header      \
5815   .DWordLength                         =      7,  \
5816   ._3DCommandSubOpcode                 =     28,  \
5817   ._3DCommandOpcode                    =      1,  \
5818   .CommandSubType                      =      3,  \
5819   .CommandType                         =      3
5820
5821struct GEN9_3DSTATE_SAMPLE_PATTERN {
5822   uint32_t                             DWordLength;
5823   uint32_t                             _3DCommandSubOpcode;
5824   uint32_t                             _3DCommandOpcode;
5825   uint32_t                             CommandSubType;
5826   uint32_t                             CommandType;
5827   float                                _16xSample0YOffset;
5828   float                                _16xSample0XOffset;
5829   float                                _16xSample1YOffset;
5830   float                                _16xSample1XOffset;
5831   float                                _16xSample2YOffset;
5832   float                                _16xSample2XOffset;
5833   float                                _16xSample3YOffset;
5834   float                                _16xSample3XOffset;
5835   float                                _16xSample4YOffset;
5836   float                                _16xSample4XOffset;
5837   float                                _16xSample5YOffset;
5838   float                                _16xSample5XOffset;
5839   float                                _16xSample6YOffset;
5840   float                                _16xSample6XOffset;
5841   float                                _16xSample7YOffset;
5842   float                                _16xSample7XOffset;
5843   float                                _16xSample8YOffset;
5844   float                                _16xSample8XOffset;
5845   float                                _16xSample9YOffset;
5846   float                                _16xSample9XOffset;
5847   float                                _16xSample10YOffset;
5848   float                                _16xSample10XOffset;
5849   float                                _16xSample11YOffset;
5850   float                                _16xSample11XOffset;
5851   float                                _16xSample12YOffset;
5852   float                                _16xSample12XOffset;
5853   float                                _16xSample13YOffset;
5854   float                                _16xSample13XOffset;
5855   float                                _16xSample14YOffset;
5856   float                                _16xSample14XOffset;
5857   float                                _16xSample15YOffset;
5858   float                                _16xSample15XOffset;
5859   float                                _8xSample4YOffset;
5860   float                                _8xSample4XOffset;
5861   float                                _8xSample5YOffset;
5862   float                                _8xSample5XOffset;
5863   float                                _8xSample6YOffset;
5864   float                                _8xSample6XOffset;
5865   float                                _8xSample7YOffset;
5866   float                                _8xSample7XOffset;
5867   float                                _8xSample0YOffset;
5868   float                                _8xSample0XOffset;
5869   float                                _8xSample1YOffset;
5870   float                                _8xSample1XOffset;
5871   float                                _8xSample2YOffset;
5872   float                                _8xSample2XOffset;
5873   float                                _8xSample3YOffset;
5874   float                                _8xSample3XOffset;
5875   float                                _4xSample0YOffset;
5876   float                                _4xSample0XOffset;
5877   float                                _4xSample1YOffset;
5878   float                                _4xSample1XOffset;
5879   float                                _4xSample2YOffset;
5880   float                                _4xSample2XOffset;
5881   float                                _4xSample3YOffset;
5882   float                                _4xSample3XOffset;
5883   float                                _2xSample0YOffset;
5884   float                                _2xSample0XOffset;
5885   float                                _2xSample1YOffset;
5886   float                                _2xSample1XOffset;
5887   float                                _1xSample0YOffset;
5888   float                                _1xSample0XOffset;
5889};
5890
5891static inline void
5892GEN9_3DSTATE_SAMPLE_PATTERN_pack(__attribute__((unused)) __gen_user_data *data,
5893                                 __attribute__((unused)) void * restrict dst,
5894                                 __attribute__((unused)) const struct GEN9_3DSTATE_SAMPLE_PATTERN * restrict values)
5895{
5896   uint32_t * restrict dw = (uint32_t * restrict) dst;
5897
5898   dw[0] =
5899      __gen_uint(values->DWordLength, 0, 7) |
5900      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5901      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5902      __gen_uint(values->CommandSubType, 27, 28) |
5903      __gen_uint(values->CommandType, 29, 31);
5904
5905   dw[1] =
5906      __gen_ufixed(values->_16xSample0YOffset, 0, 3, 4) |
5907      __gen_ufixed(values->_16xSample0XOffset, 4, 7, 4) |
5908      __gen_ufixed(values->_16xSample1YOffset, 8, 11, 4) |
5909      __gen_ufixed(values->_16xSample1XOffset, 12, 15, 4) |
5910      __gen_ufixed(values->_16xSample2YOffset, 16, 19, 4) |
5911      __gen_ufixed(values->_16xSample2XOffset, 20, 23, 4) |
5912      __gen_ufixed(values->_16xSample3YOffset, 24, 27, 4) |
5913      __gen_ufixed(values->_16xSample3XOffset, 28, 31, 4);
5914
5915   dw[2] =
5916      __gen_ufixed(values->_16xSample4YOffset, 0, 3, 4) |
5917      __gen_ufixed(values->_16xSample4XOffset, 4, 7, 4) |
5918      __gen_ufixed(values->_16xSample5YOffset, 8, 11, 4) |
5919      __gen_ufixed(values->_16xSample5XOffset, 12, 15, 4) |
5920      __gen_ufixed(values->_16xSample6YOffset, 16, 19, 4) |
5921      __gen_ufixed(values->_16xSample6XOffset, 20, 23, 4) |
5922      __gen_ufixed(values->_16xSample7YOffset, 24, 27, 4) |
5923      __gen_ufixed(values->_16xSample7XOffset, 28, 31, 4);
5924
5925   dw[3] =
5926      __gen_ufixed(values->_16xSample8YOffset, 0, 3, 4) |
5927      __gen_ufixed(values->_16xSample8XOffset, 4, 7, 4) |
5928      __gen_ufixed(values->_16xSample9YOffset, 8, 11, 4) |
5929      __gen_ufixed(values->_16xSample9XOffset, 12, 15, 4) |
5930      __gen_ufixed(values->_16xSample10YOffset, 16, 19, 4) |
5931      __gen_ufixed(values->_16xSample10XOffset, 20, 23, 4) |
5932      __gen_ufixed(values->_16xSample11YOffset, 24, 27, 4) |
5933      __gen_ufixed(values->_16xSample11XOffset, 28, 31, 4);
5934
5935   dw[4] =
5936      __gen_ufixed(values->_16xSample12YOffset, 0, 3, 4) |
5937      __gen_ufixed(values->_16xSample12XOffset, 4, 7, 4) |
5938      __gen_ufixed(values->_16xSample13YOffset, 8, 11, 4) |
5939      __gen_ufixed(values->_16xSample13XOffset, 12, 15, 4) |
5940      __gen_ufixed(values->_16xSample14YOffset, 16, 19, 4) |
5941      __gen_ufixed(values->_16xSample14XOffset, 20, 23, 4) |
5942      __gen_ufixed(values->_16xSample15YOffset, 24, 27, 4) |
5943      __gen_ufixed(values->_16xSample15XOffset, 28, 31, 4);
5944
5945   dw[5] =
5946      __gen_ufixed(values->_8xSample4YOffset, 0, 3, 4) |
5947      __gen_ufixed(values->_8xSample4XOffset, 4, 7, 4) |
5948      __gen_ufixed(values->_8xSample5YOffset, 8, 11, 4) |
5949      __gen_ufixed(values->_8xSample5XOffset, 12, 15, 4) |
5950      __gen_ufixed(values->_8xSample6YOffset, 16, 19, 4) |
5951      __gen_ufixed(values->_8xSample6XOffset, 20, 23, 4) |
5952      __gen_ufixed(values->_8xSample7YOffset, 24, 27, 4) |
5953      __gen_ufixed(values->_8xSample7XOffset, 28, 31, 4);
5954
5955   dw[6] =
5956      __gen_ufixed(values->_8xSample0YOffset, 0, 3, 4) |
5957      __gen_ufixed(values->_8xSample0XOffset, 4, 7, 4) |
5958      __gen_ufixed(values->_8xSample1YOffset, 8, 11, 4) |
5959      __gen_ufixed(values->_8xSample1XOffset, 12, 15, 4) |
5960      __gen_ufixed(values->_8xSample2YOffset, 16, 19, 4) |
5961      __gen_ufixed(values->_8xSample2XOffset, 20, 23, 4) |
5962      __gen_ufixed(values->_8xSample3YOffset, 24, 27, 4) |
5963      __gen_ufixed(values->_8xSample3XOffset, 28, 31, 4);
5964
5965   dw[7] =
5966      __gen_ufixed(values->_4xSample0YOffset, 0, 3, 4) |
5967      __gen_ufixed(values->_4xSample0XOffset, 4, 7, 4) |
5968      __gen_ufixed(values->_4xSample1YOffset, 8, 11, 4) |
5969      __gen_ufixed(values->_4xSample1XOffset, 12, 15, 4) |
5970      __gen_ufixed(values->_4xSample2YOffset, 16, 19, 4) |
5971      __gen_ufixed(values->_4xSample2XOffset, 20, 23, 4) |
5972      __gen_ufixed(values->_4xSample3YOffset, 24, 27, 4) |
5973      __gen_ufixed(values->_4xSample3XOffset, 28, 31, 4);
5974
5975   dw[8] =
5976      __gen_ufixed(values->_2xSample0YOffset, 0, 3, 4) |
5977      __gen_ufixed(values->_2xSample0XOffset, 4, 7, 4) |
5978      __gen_ufixed(values->_2xSample1YOffset, 8, 11, 4) |
5979      __gen_ufixed(values->_2xSample1XOffset, 12, 15, 4) |
5980      __gen_ufixed(values->_1xSample0YOffset, 16, 19, 4) |
5981      __gen_ufixed(values->_1xSample0XOffset, 20, 23, 4);
5982}
5983
5984#define GEN9_3DSTATE_SBE_length                6
5985#define GEN9_3DSTATE_SBE_length_bias           2
5986#define GEN9_3DSTATE_SBE_header                 \
5987   .DWordLength                         =      4,  \
5988   ._3DCommandSubOpcode                 =     31,  \
5989   ._3DCommandOpcode                    =      0,  \
5990   .CommandSubType                      =      3,  \
5991   .CommandType                         =      3
5992
5993struct GEN9_3DSTATE_SBE {
5994   uint32_t                             DWordLength;
5995   uint32_t                             _3DCommandSubOpcode;
5996   uint32_t                             _3DCommandOpcode;
5997   uint32_t                             CommandSubType;
5998   uint32_t                             CommandType;
5999   uint32_t                             PrimitiveIDOverrideAttributeSelect;
6000   uint32_t                             VertexURBEntryReadOffset;
6001   uint32_t                             VertexURBEntryReadLength;
6002   bool                                 PrimitiveIDOverrideComponentX;
6003   bool                                 PrimitiveIDOverrideComponentY;
6004   bool                                 PrimitiveIDOverrideComponentZ;
6005   bool                                 PrimitiveIDOverrideComponentW;
6006   uint32_t                             PointSpriteTextureCoordinateOrigin;
6007#define UPPERLEFT                                0
6008#define LOWERLEFT                                1
6009   bool                                 AttributeSwizzleEnable;
6010   uint32_t                             NumberofSFOutputAttributes;
6011   bool                                 ForceVertexURBEntryReadOffset;
6012   bool                                 ForceVertexURBEntryReadLength;
6013   uint32_t                             PointSpriteTextureCoordinateEnable;
6014   uint32_t                             ConstantInterpolationEnable;
6015   uint32_t                             AttributeActiveComponentFormat[32];
6016#define ACTIVE_COMPONENT_DISABLED                0
6017#define ACTIVE_COMPONENT_XY                      1
6018#define ACTIVE_COMPONENT_XYZ                     2
6019#define ACTIVE_COMPONENT_XYZW                    3
6020};
6021
6022static inline void
6023GEN9_3DSTATE_SBE_pack(__attribute__((unused)) __gen_user_data *data,
6024                      __attribute__((unused)) void * restrict dst,
6025                      __attribute__((unused)) const struct GEN9_3DSTATE_SBE * restrict values)
6026{
6027   uint32_t * restrict dw = (uint32_t * restrict) dst;
6028
6029   dw[0] =
6030      __gen_uint(values->DWordLength, 0, 7) |
6031      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6032      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6033      __gen_uint(values->CommandSubType, 27, 28) |
6034      __gen_uint(values->CommandType, 29, 31);
6035
6036   dw[1] =
6037      __gen_uint(values->PrimitiveIDOverrideAttributeSelect, 0, 4) |
6038      __gen_uint(values->VertexURBEntryReadOffset, 5, 10) |
6039      __gen_uint(values->VertexURBEntryReadLength, 11, 15) |
6040      __gen_uint(values->PrimitiveIDOverrideComponentX, 16, 16) |
6041      __gen_uint(values->PrimitiveIDOverrideComponentY, 17, 17) |
6042      __gen_uint(values->PrimitiveIDOverrideComponentZ, 18, 18) |
6043      __gen_uint(values->PrimitiveIDOverrideComponentW, 19, 19) |
6044      __gen_uint(values->PointSpriteTextureCoordinateOrigin, 20, 20) |
6045      __gen_uint(values->AttributeSwizzleEnable, 21, 21) |
6046      __gen_uint(values->NumberofSFOutputAttributes, 22, 27) |
6047      __gen_uint(values->ForceVertexURBEntryReadOffset, 28, 28) |
6048      __gen_uint(values->ForceVertexURBEntryReadLength, 29, 29);
6049
6050   dw[2] =
6051      __gen_uint(values->PointSpriteTextureCoordinateEnable, 0, 31);
6052
6053   dw[3] =
6054      __gen_uint(values->ConstantInterpolationEnable, 0, 31);
6055
6056   dw[4] =
6057      __gen_uint(values->AttributeActiveComponentFormat[0], 0, 1) |
6058      __gen_uint(values->AttributeActiveComponentFormat[1], 2, 3) |
6059      __gen_uint(values->AttributeActiveComponentFormat[2], 4, 5) |
6060      __gen_uint(values->AttributeActiveComponentFormat[3], 6, 7) |
6061      __gen_uint(values->AttributeActiveComponentFormat[4], 8, 9) |
6062      __gen_uint(values->AttributeActiveComponentFormat[5], 10, 11) |
6063      __gen_uint(values->AttributeActiveComponentFormat[6], 12, 13) |
6064      __gen_uint(values->AttributeActiveComponentFormat[7], 14, 15) |
6065      __gen_uint(values->AttributeActiveComponentFormat[8], 16, 17) |
6066      __gen_uint(values->AttributeActiveComponentFormat[9], 18, 19) |
6067      __gen_uint(values->AttributeActiveComponentFormat[10], 20, 21) |
6068      __gen_uint(values->AttributeActiveComponentFormat[11], 22, 23) |
6069      __gen_uint(values->AttributeActiveComponentFormat[12], 24, 25) |
6070      __gen_uint(values->AttributeActiveComponentFormat[13], 26, 27) |
6071      __gen_uint(values->AttributeActiveComponentFormat[14], 28, 29) |
6072      __gen_uint(values->AttributeActiveComponentFormat[15], 30, 31);
6073
6074   dw[5] =
6075      __gen_uint(values->AttributeActiveComponentFormat[16], 0, 1) |
6076      __gen_uint(values->AttributeActiveComponentFormat[17], 2, 3) |
6077      __gen_uint(values->AttributeActiveComponentFormat[18], 4, 5) |
6078      __gen_uint(values->AttributeActiveComponentFormat[19], 6, 7) |
6079      __gen_uint(values->AttributeActiveComponentFormat[20], 8, 9) |
6080      __gen_uint(values->AttributeActiveComponentFormat[21], 10, 11) |
6081      __gen_uint(values->AttributeActiveComponentFormat[22], 12, 13) |
6082      __gen_uint(values->AttributeActiveComponentFormat[23], 14, 15) |
6083      __gen_uint(values->AttributeActiveComponentFormat[24], 16, 17) |
6084      __gen_uint(values->AttributeActiveComponentFormat[25], 18, 19) |
6085      __gen_uint(values->AttributeActiveComponentFormat[26], 20, 21) |
6086      __gen_uint(values->AttributeActiveComponentFormat[27], 22, 23) |
6087      __gen_uint(values->AttributeActiveComponentFormat[28], 24, 25) |
6088      __gen_uint(values->AttributeActiveComponentFormat[29], 26, 27) |
6089      __gen_uint(values->AttributeActiveComponentFormat[30], 28, 29) |
6090      __gen_uint(values->AttributeActiveComponentFormat[31], 30, 31);
6091}
6092
6093#define GEN9_3DSTATE_SBE_SWIZ_length          11
6094#define GEN9_3DSTATE_SBE_SWIZ_length_bias      2
6095#define GEN9_3DSTATE_SBE_SWIZ_header            \
6096   .DWordLength                         =      9,  \
6097   ._3DCommandSubOpcode                 =     81,  \
6098   ._3DCommandOpcode                    =      0,  \
6099   .CommandSubType                      =      3,  \
6100   .CommandType                         =      3
6101
6102struct GEN9_3DSTATE_SBE_SWIZ {
6103   uint32_t                             DWordLength;
6104   uint32_t                             _3DCommandSubOpcode;
6105   uint32_t                             _3DCommandOpcode;
6106   uint32_t                             CommandSubType;
6107   uint32_t                             CommandType;
6108   struct GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL Attribute[16];
6109   uint32_t                             AttributeWrapShortestEnables[16];
6110};
6111
6112static inline void
6113GEN9_3DSTATE_SBE_SWIZ_pack(__attribute__((unused)) __gen_user_data *data,
6114                           __attribute__((unused)) void * restrict dst,
6115                           __attribute__((unused)) const struct GEN9_3DSTATE_SBE_SWIZ * restrict values)
6116{
6117   uint32_t * restrict dw = (uint32_t * restrict) dst;
6118
6119   dw[0] =
6120      __gen_uint(values->DWordLength, 0, 7) |
6121      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6122      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6123      __gen_uint(values->CommandSubType, 27, 28) |
6124      __gen_uint(values->CommandType, 29, 31);
6125
6126   uint32_t v1_0;
6127   GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v1_0, &values->Attribute[0]);
6128
6129   uint32_t v1_1;
6130   GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v1_1, &values->Attribute[1]);
6131
6132   dw[1] =
6133      __gen_uint(v1_0, 0, 15) |
6134      __gen_uint(v1_1, 16, 31);
6135
6136   uint32_t v2_0;
6137   GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v2_0, &values->Attribute[2]);
6138
6139   uint32_t v2_1;
6140   GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v2_1, &values->Attribute[3]);
6141
6142   dw[2] =
6143      __gen_uint(v2_0, 0, 15) |
6144      __gen_uint(v2_1, 16, 31);
6145
6146   uint32_t v3_0;
6147   GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v3_0, &values->Attribute[4]);
6148
6149   uint32_t v3_1;
6150   GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v3_1, &values->Attribute[5]);
6151
6152   dw[3] =
6153      __gen_uint(v3_0, 0, 15) |
6154      __gen_uint(v3_1, 16, 31);
6155
6156   uint32_t v4_0;
6157   GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v4_0, &values->Attribute[6]);
6158
6159   uint32_t v4_1;
6160   GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v4_1, &values->Attribute[7]);
6161
6162   dw[4] =
6163      __gen_uint(v4_0, 0, 15) |
6164      __gen_uint(v4_1, 16, 31);
6165
6166   uint32_t v5_0;
6167   GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v5_0, &values->Attribute[8]);
6168
6169   uint32_t v5_1;
6170   GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v5_1, &values->Attribute[9]);
6171
6172   dw[5] =
6173      __gen_uint(v5_0, 0, 15) |
6174      __gen_uint(v5_1, 16, 31);
6175
6176   uint32_t v6_0;
6177   GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v6_0, &values->Attribute[10]);
6178
6179   uint32_t v6_1;
6180   GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v6_1, &values->Attribute[11]);
6181
6182   dw[6] =
6183      __gen_uint(v6_0, 0, 15) |
6184      __gen_uint(v6_1, 16, 31);
6185
6186   uint32_t v7_0;
6187   GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v7_0, &values->Attribute[12]);
6188
6189   uint32_t v7_1;
6190   GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v7_1, &values->Attribute[13]);
6191
6192   dw[7] =
6193      __gen_uint(v7_0, 0, 15) |
6194      __gen_uint(v7_1, 16, 31);
6195
6196   uint32_t v8_0;
6197   GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_0, &values->Attribute[14]);
6198
6199   uint32_t v8_1;
6200   GEN9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_1, &values->Attribute[15]);
6201
6202   dw[8] =
6203      __gen_uint(v8_0, 0, 15) |
6204      __gen_uint(v8_1, 16, 31);
6205
6206   dw[9] =
6207      __gen_uint(values->AttributeWrapShortestEnables[0], 0, 3) |
6208      __gen_uint(values->AttributeWrapShortestEnables[1], 4, 7) |
6209      __gen_uint(values->AttributeWrapShortestEnables[2], 8, 11) |
6210      __gen_uint(values->AttributeWrapShortestEnables[3], 12, 15) |
6211      __gen_uint(values->AttributeWrapShortestEnables[4], 16, 19) |
6212      __gen_uint(values->AttributeWrapShortestEnables[5], 20, 23) |
6213      __gen_uint(values->AttributeWrapShortestEnables[6], 24, 27) |
6214      __gen_uint(values->AttributeWrapShortestEnables[7], 28, 31);
6215
6216   dw[10] =
6217      __gen_uint(values->AttributeWrapShortestEnables[8], 0, 3) |
6218      __gen_uint(values->AttributeWrapShortestEnables[9], 4, 7) |
6219      __gen_uint(values->AttributeWrapShortestEnables[10], 8, 11) |
6220      __gen_uint(values->AttributeWrapShortestEnables[11], 12, 15) |
6221      __gen_uint(values->AttributeWrapShortestEnables[12], 16, 19) |
6222      __gen_uint(values->AttributeWrapShortestEnables[13], 20, 23) |
6223      __gen_uint(values->AttributeWrapShortestEnables[14], 24, 27) |
6224      __gen_uint(values->AttributeWrapShortestEnables[15], 28, 31);
6225}
6226
6227#define GEN9_3DSTATE_SCISSOR_STATE_POINTERS_length      2
6228#define GEN9_3DSTATE_SCISSOR_STATE_POINTERS_length_bias      2
6229#define GEN9_3DSTATE_SCISSOR_STATE_POINTERS_header\
6230   .DWordLength                         =      0,  \
6231   ._3DCommandSubOpcode                 =     15,  \
6232   ._3DCommandOpcode                    =      0,  \
6233   .CommandSubType                      =      3,  \
6234   .CommandType                         =      3
6235
6236struct GEN9_3DSTATE_SCISSOR_STATE_POINTERS {
6237   uint32_t                             DWordLength;
6238   uint32_t                             _3DCommandSubOpcode;
6239   uint32_t                             _3DCommandOpcode;
6240   uint32_t                             CommandSubType;
6241   uint32_t                             CommandType;
6242   uint64_t                             ScissorRectPointer;
6243};
6244
6245static inline void
6246GEN9_3DSTATE_SCISSOR_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
6247                                         __attribute__((unused)) void * restrict dst,
6248                                         __attribute__((unused)) const struct GEN9_3DSTATE_SCISSOR_STATE_POINTERS * restrict values)
6249{
6250   uint32_t * restrict dw = (uint32_t * restrict) dst;
6251
6252   dw[0] =
6253      __gen_uint(values->DWordLength, 0, 7) |
6254      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6255      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6256      __gen_uint(values->CommandSubType, 27, 28) |
6257      __gen_uint(values->CommandType, 29, 31);
6258
6259   dw[1] =
6260      __gen_offset(values->ScissorRectPointer, 5, 31);
6261}
6262
6263#define GEN9_3DSTATE_SF_length                 4
6264#define GEN9_3DSTATE_SF_length_bias            2
6265#define GEN9_3DSTATE_SF_header                  \
6266   .DWordLength                         =      2,  \
6267   ._3DCommandSubOpcode                 =     19,  \
6268   ._3DCommandOpcode                    =      0,  \
6269   .CommandSubType                      =      3,  \
6270   .CommandType                         =      3
6271
6272struct GEN9_3DSTATE_SF {
6273   uint32_t                             DWordLength;
6274   uint32_t                             _3DCommandSubOpcode;
6275   uint32_t                             _3DCommandOpcode;
6276   uint32_t                             CommandSubType;
6277   uint32_t                             CommandType;
6278   bool                                 ViewportTransformEnable;
6279   bool                                 StatisticsEnable;
6280   bool                                 LegacyGlobalDepthBiasEnable;
6281   float                                LineWidth;
6282   uint32_t                             LineEndCapAntialiasingRegionWidth;
6283#define _05pixels                                0
6284#define _10pixels                                1
6285#define _20pixels                                2
6286#define _40pixels                                3
6287   float                                PointWidth;
6288   uint32_t                             PointWidthSource;
6289#define Vertex                                   0
6290#define State                                    1
6291   uint32_t                             VertexSubPixelPrecisionSelect;
6292#define _8Bit                                    0
6293#define _4Bit                                    1
6294   bool                                 SmoothPointEnable;
6295   uint32_t                             AALineDistanceMode;
6296#define AALINEDISTANCE_TRUE                      1
6297   uint32_t                             TriangleFanProvokingVertexSelect;
6298   uint32_t                             LineStripListProvokingVertexSelect;
6299   uint32_t                             TriangleStripListProvokingVertexSelect;
6300   bool                                 LastPixelEnable;
6301};
6302
6303static inline void
6304GEN9_3DSTATE_SF_pack(__attribute__((unused)) __gen_user_data *data,
6305                     __attribute__((unused)) void * restrict dst,
6306                     __attribute__((unused)) const struct GEN9_3DSTATE_SF * restrict values)
6307{
6308   uint32_t * restrict dw = (uint32_t * restrict) dst;
6309
6310   dw[0] =
6311      __gen_uint(values->DWordLength, 0, 7) |
6312      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6313      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6314      __gen_uint(values->CommandSubType, 27, 28) |
6315      __gen_uint(values->CommandType, 29, 31);
6316
6317   dw[1] =
6318      __gen_uint(values->ViewportTransformEnable, 1, 1) |
6319      __gen_uint(values->StatisticsEnable, 10, 10) |
6320      __gen_uint(values->LegacyGlobalDepthBiasEnable, 11, 11) |
6321      __gen_ufixed(values->LineWidth, 12, 29, 7);
6322
6323   dw[2] =
6324      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 16, 17);
6325
6326   dw[3] =
6327      __gen_ufixed(values->PointWidth, 0, 10, 3) |
6328      __gen_uint(values->PointWidthSource, 11, 11) |
6329      __gen_uint(values->VertexSubPixelPrecisionSelect, 12, 12) |
6330      __gen_uint(values->SmoothPointEnable, 13, 13) |
6331      __gen_uint(values->AALineDistanceMode, 14, 14) |
6332      __gen_uint(values->TriangleFanProvokingVertexSelect, 25, 26) |
6333      __gen_uint(values->LineStripListProvokingVertexSelect, 27, 28) |
6334      __gen_uint(values->TriangleStripListProvokingVertexSelect, 29, 30) |
6335      __gen_uint(values->LastPixelEnable, 31, 31);
6336}
6337
6338#define GEN9_3DSTATE_SO_BUFFER_length          8
6339#define GEN9_3DSTATE_SO_BUFFER_length_bias      2
6340#define GEN9_3DSTATE_SO_BUFFER_header           \
6341   .DWordLength                         =      6,  \
6342   ._3DCommandSubOpcode                 =     24,  \
6343   ._3DCommandOpcode                    =      1,  \
6344   .CommandSubType                      =      3,  \
6345   .CommandType                         =      3
6346
6347struct GEN9_3DSTATE_SO_BUFFER {
6348   uint32_t                             DWordLength;
6349   uint32_t                             _3DCommandSubOpcode;
6350   uint32_t                             _3DCommandOpcode;
6351   uint32_t                             CommandSubType;
6352   uint32_t                             CommandType;
6353   bool                                 StreamOutputBufferOffsetAddressEnable;
6354   bool                                 StreamOffsetWriteEnable;
6355   uint32_t                             MOCS;
6356   uint32_t                             SOBufferIndex;
6357   bool                                 SOBufferEnable;
6358   __gen_address_type                   SurfaceBaseAddress;
6359   uint32_t                             SurfaceSize;
6360   __gen_address_type                   StreamOutputBufferOffsetAddress;
6361   uint32_t                             StreamOffset;
6362};
6363
6364static inline void
6365GEN9_3DSTATE_SO_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
6366                            __attribute__((unused)) void * restrict dst,
6367                            __attribute__((unused)) const struct GEN9_3DSTATE_SO_BUFFER * restrict values)
6368{
6369   uint32_t * restrict dw = (uint32_t * restrict) dst;
6370
6371   dw[0] =
6372      __gen_uint(values->DWordLength, 0, 7) |
6373      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6374      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6375      __gen_uint(values->CommandSubType, 27, 28) |
6376      __gen_uint(values->CommandType, 29, 31);
6377
6378   dw[1] =
6379      __gen_uint(values->StreamOutputBufferOffsetAddressEnable, 20, 20) |
6380      __gen_uint(values->StreamOffsetWriteEnable, 21, 21) |
6381      __gen_uint(values->MOCS, 22, 28) |
6382      __gen_uint(values->SOBufferIndex, 29, 30) |
6383      __gen_uint(values->SOBufferEnable, 31, 31);
6384
6385   const uint64_t v2_address =
6386      __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
6387   dw[2] = v2_address;
6388   dw[3] = v2_address >> 32;
6389
6390   dw[4] =
6391      __gen_uint(values->SurfaceSize, 0, 29);
6392
6393   const uint64_t v5_address =
6394      __gen_combine_address(data, &dw[5], values->StreamOutputBufferOffsetAddress, 0);
6395   dw[5] = v5_address;
6396   dw[6] = v5_address >> 32;
6397
6398   dw[7] =
6399      __gen_uint(values->StreamOffset, 0, 31);
6400}
6401
6402#define GEN9_3DSTATE_SO_DECL_LIST_length_bias      2
6403#define GEN9_3DSTATE_SO_DECL_LIST_header        \
6404   ._3DCommandSubOpcode                 =     23,  \
6405   ._3DCommandOpcode                    =      1,  \
6406   .CommandSubType                      =      3,  \
6407   .CommandType                         =      3
6408
6409struct GEN9_3DSTATE_SO_DECL_LIST {
6410   uint32_t                             DWordLength;
6411   uint32_t                             _3DCommandSubOpcode;
6412   uint32_t                             _3DCommandOpcode;
6413   uint32_t                             CommandSubType;
6414   uint32_t                             CommandType;
6415   uint32_t                             StreamtoBufferSelects0;
6416   uint32_t                             StreamtoBufferSelects1;
6417   uint32_t                             StreamtoBufferSelects2;
6418   uint32_t                             StreamtoBufferSelects3;
6419   uint32_t                             NumEntries0;
6420   uint32_t                             NumEntries1;
6421   uint32_t                             NumEntries2;
6422   uint32_t                             NumEntries3;
6423   /* variable length fields follow */
6424};
6425
6426static inline void
6427GEN9_3DSTATE_SO_DECL_LIST_pack(__attribute__((unused)) __gen_user_data *data,
6428                               __attribute__((unused)) void * restrict dst,
6429                               __attribute__((unused)) const struct GEN9_3DSTATE_SO_DECL_LIST * restrict values)
6430{
6431   uint32_t * restrict dw = (uint32_t * restrict) dst;
6432
6433   dw[0] =
6434      __gen_uint(values->DWordLength, 0, 8) |
6435      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6436      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6437      __gen_uint(values->CommandSubType, 27, 28) |
6438      __gen_uint(values->CommandType, 29, 31);
6439
6440   dw[1] =
6441      __gen_uint(values->StreamtoBufferSelects0, 0, 3) |
6442      __gen_uint(values->StreamtoBufferSelects1, 4, 7) |
6443      __gen_uint(values->StreamtoBufferSelects2, 8, 11) |
6444      __gen_uint(values->StreamtoBufferSelects3, 12, 15);
6445
6446   dw[2] =
6447      __gen_uint(values->NumEntries0, 0, 7) |
6448      __gen_uint(values->NumEntries1, 8, 15) |
6449      __gen_uint(values->NumEntries2, 16, 23) |
6450      __gen_uint(values->NumEntries3, 24, 31);
6451}
6452
6453#define GEN9_3DSTATE_STENCIL_BUFFER_length      5
6454#define GEN9_3DSTATE_STENCIL_BUFFER_length_bias      2
6455#define GEN9_3DSTATE_STENCIL_BUFFER_header      \
6456   .DWordLength                         =      3,  \
6457   ._3DCommandSubOpcode                 =      6,  \
6458   ._3DCommandOpcode                    =      0,  \
6459   .CommandSubType                      =      3,  \
6460   .CommandType                         =      3
6461
6462struct GEN9_3DSTATE_STENCIL_BUFFER {
6463   uint32_t                             DWordLength;
6464   uint32_t                             _3DCommandSubOpcode;
6465   uint32_t                             _3DCommandOpcode;
6466   uint32_t                             CommandSubType;
6467   uint32_t                             CommandType;
6468   uint32_t                             SurfacePitch;
6469   uint32_t                             MOCS;
6470   bool                                 StencilBufferEnable;
6471   __gen_address_type                   SurfaceBaseAddress;
6472   uint32_t                             SurfaceQPitch;
6473};
6474
6475static inline void
6476GEN9_3DSTATE_STENCIL_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
6477                                 __attribute__((unused)) void * restrict dst,
6478                                 __attribute__((unused)) const struct GEN9_3DSTATE_STENCIL_BUFFER * restrict values)
6479{
6480   uint32_t * restrict dw = (uint32_t * restrict) dst;
6481
6482   dw[0] =
6483      __gen_uint(values->DWordLength, 0, 7) |
6484      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6485      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6486      __gen_uint(values->CommandSubType, 27, 28) |
6487      __gen_uint(values->CommandType, 29, 31);
6488
6489   dw[1] =
6490      __gen_uint(values->SurfacePitch, 0, 16) |
6491      __gen_uint(values->MOCS, 22, 28) |
6492      __gen_uint(values->StencilBufferEnable, 31, 31);
6493
6494   const uint64_t v2_address =
6495      __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
6496   dw[2] = v2_address;
6497   dw[3] = v2_address >> 32;
6498
6499   dw[4] =
6500      __gen_uint(values->SurfaceQPitch, 0, 14);
6501}
6502
6503#define GEN9_3DSTATE_STREAMOUT_length          5
6504#define GEN9_3DSTATE_STREAMOUT_length_bias      2
6505#define GEN9_3DSTATE_STREAMOUT_header           \
6506   .DWordLength                         =      3,  \
6507   ._3DCommandSubOpcode                 =     30,  \
6508   ._3DCommandOpcode                    =      0,  \
6509   .CommandSubType                      =      3,  \
6510   .CommandType                         =      3
6511
6512struct GEN9_3DSTATE_STREAMOUT {
6513   uint32_t                             DWordLength;
6514   uint32_t                             _3DCommandSubOpcode;
6515   uint32_t                             _3DCommandOpcode;
6516   uint32_t                             CommandSubType;
6517   uint32_t                             CommandType;
6518   uint32_t                             ForceRendering;
6519#define Resreved                                 1
6520#define Force_Off                                2
6521#define Force_on                                 3
6522   bool                                 SOStatisticsEnable;
6523   uint32_t                             ReorderMode;
6524#define LEADING                                  0
6525#define TRAILING                                 1
6526   uint32_t                             RenderStreamSelect;
6527   bool                                 RenderingDisable;
6528   bool                                 SOFunctionEnable;
6529   uint32_t                             Stream0VertexReadLength;
6530   uint32_t                             Stream0VertexReadOffset;
6531   uint32_t                             Stream1VertexReadLength;
6532   uint32_t                             Stream1VertexReadOffset;
6533   uint32_t                             Stream2VertexReadLength;
6534   uint32_t                             Stream2VertexReadOffset;
6535   uint32_t                             Stream3VertexReadLength;
6536   uint32_t                             Stream3VertexReadOffset;
6537   uint32_t                             Buffer0SurfacePitch;
6538   uint32_t                             Buffer1SurfacePitch;
6539   uint32_t                             Buffer2SurfacePitch;
6540   uint32_t                             Buffer3SurfacePitch;
6541};
6542
6543static inline void
6544GEN9_3DSTATE_STREAMOUT_pack(__attribute__((unused)) __gen_user_data *data,
6545                            __attribute__((unused)) void * restrict dst,
6546                            __attribute__((unused)) const struct GEN9_3DSTATE_STREAMOUT * restrict values)
6547{
6548   uint32_t * restrict dw = (uint32_t * restrict) dst;
6549
6550   dw[0] =
6551      __gen_uint(values->DWordLength, 0, 7) |
6552      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6553      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6554      __gen_uint(values->CommandSubType, 27, 28) |
6555      __gen_uint(values->CommandType, 29, 31);
6556
6557   dw[1] =
6558      __gen_uint(values->ForceRendering, 23, 24) |
6559      __gen_uint(values->SOStatisticsEnable, 25, 25) |
6560      __gen_uint(values->ReorderMode, 26, 26) |
6561      __gen_uint(values->RenderStreamSelect, 27, 28) |
6562      __gen_uint(values->RenderingDisable, 30, 30) |
6563      __gen_uint(values->SOFunctionEnable, 31, 31);
6564
6565   dw[2] =
6566      __gen_uint(values->Stream0VertexReadLength, 0, 4) |
6567      __gen_uint(values->Stream0VertexReadOffset, 5, 5) |
6568      __gen_uint(values->Stream1VertexReadLength, 8, 12) |
6569      __gen_uint(values->Stream1VertexReadOffset, 13, 13) |
6570      __gen_uint(values->Stream2VertexReadLength, 16, 20) |
6571      __gen_uint(values->Stream2VertexReadOffset, 21, 21) |
6572      __gen_uint(values->Stream3VertexReadLength, 24, 28) |
6573      __gen_uint(values->Stream3VertexReadOffset, 29, 29);
6574
6575   dw[3] =
6576      __gen_uint(values->Buffer0SurfacePitch, 0, 11) |
6577      __gen_uint(values->Buffer1SurfacePitch, 16, 27);
6578
6579   dw[4] =
6580      __gen_uint(values->Buffer2SurfacePitch, 0, 11) |
6581      __gen_uint(values->Buffer3SurfacePitch, 16, 27);
6582}
6583
6584#define GEN9_3DSTATE_TE_length                 4
6585#define GEN9_3DSTATE_TE_length_bias            2
6586#define GEN9_3DSTATE_TE_header                  \
6587   .DWordLength                         =      2,  \
6588   ._3DCommandSubOpcode                 =     28,  \
6589   ._3DCommandOpcode                    =      0,  \
6590   .CommandSubType                      =      3,  \
6591   .CommandType                         =      3
6592
6593struct GEN9_3DSTATE_TE {
6594   uint32_t                             DWordLength;
6595   uint32_t                             _3DCommandSubOpcode;
6596   uint32_t                             _3DCommandOpcode;
6597   uint32_t                             CommandSubType;
6598   uint32_t                             CommandType;
6599   bool                                 TEEnable;
6600   uint32_t                             TEMode;
6601#define HW_TESS                                  0
6602   uint32_t                             TEDomain;
6603#define QUAD                                     0
6604#define TRI                                      1
6605#define ISOLINE                                  2
6606   uint32_t                             OutputTopology;
6607#define OUTPUT_POINT                             0
6608#define OUTPUT_LINE                              1
6609#define OUTPUT_TRI_CW                            2
6610#define OUTPUT_TRI_CCW                           3
6611   uint32_t                             Partitioning;
6612#define INTEGER                                  0
6613#define ODD_FRACTIONAL                           1
6614#define EVEN_FRACTIONAL                          2
6615   float                                MaximumTessellationFactorOdd;
6616   float                                MaximumTessellationFactorNotOdd;
6617};
6618
6619static inline void
6620GEN9_3DSTATE_TE_pack(__attribute__((unused)) __gen_user_data *data,
6621                     __attribute__((unused)) void * restrict dst,
6622                     __attribute__((unused)) const struct GEN9_3DSTATE_TE * restrict values)
6623{
6624   uint32_t * restrict dw = (uint32_t * restrict) dst;
6625
6626   dw[0] =
6627      __gen_uint(values->DWordLength, 0, 7) |
6628      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6629      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6630      __gen_uint(values->CommandSubType, 27, 28) |
6631      __gen_uint(values->CommandType, 29, 31);
6632
6633   dw[1] =
6634      __gen_uint(values->TEEnable, 0, 0) |
6635      __gen_uint(values->TEMode, 1, 2) |
6636      __gen_uint(values->TEDomain, 4, 5) |
6637      __gen_uint(values->OutputTopology, 8, 9) |
6638      __gen_uint(values->Partitioning, 12, 13);
6639
6640   dw[2] =
6641      __gen_float(values->MaximumTessellationFactorOdd);
6642
6643   dw[3] =
6644      __gen_float(values->MaximumTessellationFactorNotOdd);
6645}
6646
6647#define GEN9_3DSTATE_URB_CLEAR_length          2
6648#define GEN9_3DSTATE_URB_CLEAR_length_bias      2
6649#define GEN9_3DSTATE_URB_CLEAR_header           \
6650   .DWordLength                         =      0,  \
6651   ._3DCommandSubOpcode                 =     29,  \
6652   ._3DCommandOpcode                    =      1,  \
6653   .CommandSubType                      =      3,  \
6654   .CommandType                         =      3
6655
6656struct GEN9_3DSTATE_URB_CLEAR {
6657   uint32_t                             DWordLength;
6658   uint32_t                             _3DCommandSubOpcode;
6659   uint32_t                             _3DCommandOpcode;
6660   uint32_t                             CommandSubType;
6661   uint32_t                             CommandType;
6662   uint64_t                             URBAddress;
6663   uint32_t                             URBClearLength;
6664};
6665
6666static inline void
6667GEN9_3DSTATE_URB_CLEAR_pack(__attribute__((unused)) __gen_user_data *data,
6668                            __attribute__((unused)) void * restrict dst,
6669                            __attribute__((unused)) const struct GEN9_3DSTATE_URB_CLEAR * restrict values)
6670{
6671   uint32_t * restrict dw = (uint32_t * restrict) dst;
6672
6673   dw[0] =
6674      __gen_uint(values->DWordLength, 0, 7) |
6675      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6676      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6677      __gen_uint(values->CommandSubType, 27, 28) |
6678      __gen_uint(values->CommandType, 29, 31);
6679
6680   dw[1] =
6681      __gen_offset(values->URBAddress, 0, 14) |
6682      __gen_uint(values->URBClearLength, 16, 29);
6683}
6684
6685#define GEN9_3DSTATE_URB_DS_length             2
6686#define GEN9_3DSTATE_URB_DS_length_bias        2
6687#define GEN9_3DSTATE_URB_DS_header              \
6688   .DWordLength                         =      0,  \
6689   ._3DCommandSubOpcode                 =     50,  \
6690   ._3DCommandOpcode                    =      0,  \
6691   .CommandSubType                      =      3,  \
6692   .CommandType                         =      3
6693
6694struct GEN9_3DSTATE_URB_DS {
6695   uint32_t                             DWordLength;
6696   uint32_t                             _3DCommandSubOpcode;
6697   uint32_t                             _3DCommandOpcode;
6698   uint32_t                             CommandSubType;
6699   uint32_t                             CommandType;
6700   uint32_t                             DSNumberofURBEntries;
6701   uint32_t                             DSURBEntryAllocationSize;
6702   uint32_t                             DSURBStartingAddress;
6703};
6704
6705static inline void
6706GEN9_3DSTATE_URB_DS_pack(__attribute__((unused)) __gen_user_data *data,
6707                         __attribute__((unused)) void * restrict dst,
6708                         __attribute__((unused)) const struct GEN9_3DSTATE_URB_DS * restrict values)
6709{
6710   uint32_t * restrict dw = (uint32_t * restrict) dst;
6711
6712   dw[0] =
6713      __gen_uint(values->DWordLength, 0, 7) |
6714      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6715      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6716      __gen_uint(values->CommandSubType, 27, 28) |
6717      __gen_uint(values->CommandType, 29, 31);
6718
6719   dw[1] =
6720      __gen_uint(values->DSNumberofURBEntries, 0, 15) |
6721      __gen_uint(values->DSURBEntryAllocationSize, 16, 24) |
6722      __gen_uint(values->DSURBStartingAddress, 25, 31);
6723}
6724
6725#define GEN9_3DSTATE_URB_GS_length             2
6726#define GEN9_3DSTATE_URB_GS_length_bias        2
6727#define GEN9_3DSTATE_URB_GS_header              \
6728   .DWordLength                         =      0,  \
6729   ._3DCommandSubOpcode                 =     51,  \
6730   ._3DCommandOpcode                    =      0,  \
6731   .CommandSubType                      =      3,  \
6732   .CommandType                         =      3
6733
6734struct GEN9_3DSTATE_URB_GS {
6735   uint32_t                             DWordLength;
6736   uint32_t                             _3DCommandSubOpcode;
6737   uint32_t                             _3DCommandOpcode;
6738   uint32_t                             CommandSubType;
6739   uint32_t                             CommandType;
6740   uint32_t                             GSNumberofURBEntries;
6741   uint32_t                             GSURBEntryAllocationSize;
6742   uint32_t                             GSURBStartingAddress;
6743};
6744
6745static inline void
6746GEN9_3DSTATE_URB_GS_pack(__attribute__((unused)) __gen_user_data *data,
6747                         __attribute__((unused)) void * restrict dst,
6748                         __attribute__((unused)) const struct GEN9_3DSTATE_URB_GS * restrict values)
6749{
6750   uint32_t * restrict dw = (uint32_t * restrict) dst;
6751
6752   dw[0] =
6753      __gen_uint(values->DWordLength, 0, 7) |
6754      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6755      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6756      __gen_uint(values->CommandSubType, 27, 28) |
6757      __gen_uint(values->CommandType, 29, 31);
6758
6759   dw[1] =
6760      __gen_uint(values->GSNumberofURBEntries, 0, 15) |
6761      __gen_uint(values->GSURBEntryAllocationSize, 16, 24) |
6762      __gen_uint(values->GSURBStartingAddress, 25, 31);
6763}
6764
6765#define GEN9_3DSTATE_URB_HS_length             2
6766#define GEN9_3DSTATE_URB_HS_length_bias        2
6767#define GEN9_3DSTATE_URB_HS_header              \
6768   .DWordLength                         =      0,  \
6769   ._3DCommandSubOpcode                 =     49,  \
6770   ._3DCommandOpcode                    =      0,  \
6771   .CommandSubType                      =      3,  \
6772   .CommandType                         =      3
6773
6774struct GEN9_3DSTATE_URB_HS {
6775   uint32_t                             DWordLength;
6776   uint32_t                             _3DCommandSubOpcode;
6777   uint32_t                             _3DCommandOpcode;
6778   uint32_t                             CommandSubType;
6779   uint32_t                             CommandType;
6780   uint32_t                             HSNumberofURBEntries;
6781   uint32_t                             HSURBEntryAllocationSize;
6782   uint32_t                             HSURBStartingAddress;
6783};
6784
6785static inline void
6786GEN9_3DSTATE_URB_HS_pack(__attribute__((unused)) __gen_user_data *data,
6787                         __attribute__((unused)) void * restrict dst,
6788                         __attribute__((unused)) const struct GEN9_3DSTATE_URB_HS * restrict values)
6789{
6790   uint32_t * restrict dw = (uint32_t * restrict) dst;
6791
6792   dw[0] =
6793      __gen_uint(values->DWordLength, 0, 7) |
6794      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6795      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6796      __gen_uint(values->CommandSubType, 27, 28) |
6797      __gen_uint(values->CommandType, 29, 31);
6798
6799   dw[1] =
6800      __gen_uint(values->HSNumberofURBEntries, 0, 15) |
6801      __gen_uint(values->HSURBEntryAllocationSize, 16, 24) |
6802      __gen_uint(values->HSURBStartingAddress, 25, 31);
6803}
6804
6805#define GEN9_3DSTATE_URB_VS_length             2
6806#define GEN9_3DSTATE_URB_VS_length_bias        2
6807#define GEN9_3DSTATE_URB_VS_header              \
6808   .DWordLength                         =      0,  \
6809   ._3DCommandSubOpcode                 =     48,  \
6810   ._3DCommandOpcode                    =      0,  \
6811   .CommandSubType                      =      3,  \
6812   .CommandType                         =      3
6813
6814struct GEN9_3DSTATE_URB_VS {
6815   uint32_t                             DWordLength;
6816   uint32_t                             _3DCommandSubOpcode;
6817   uint32_t                             _3DCommandOpcode;
6818   uint32_t                             CommandSubType;
6819   uint32_t                             CommandType;
6820   uint32_t                             VSNumberofURBEntries;
6821   uint32_t                             VSURBEntryAllocationSize;
6822   uint32_t                             VSURBStartingAddress;
6823};
6824
6825static inline void
6826GEN9_3DSTATE_URB_VS_pack(__attribute__((unused)) __gen_user_data *data,
6827                         __attribute__((unused)) void * restrict dst,
6828                         __attribute__((unused)) const struct GEN9_3DSTATE_URB_VS * restrict values)
6829{
6830   uint32_t * restrict dw = (uint32_t * restrict) dst;
6831
6832   dw[0] =
6833      __gen_uint(values->DWordLength, 0, 7) |
6834      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6835      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6836      __gen_uint(values->CommandSubType, 27, 28) |
6837      __gen_uint(values->CommandType, 29, 31);
6838
6839   dw[1] =
6840      __gen_uint(values->VSNumberofURBEntries, 0, 15) |
6841      __gen_uint(values->VSURBEntryAllocationSize, 16, 24) |
6842      __gen_uint(values->VSURBStartingAddress, 25, 31);
6843}
6844
6845#define GEN9_3DSTATE_VERTEX_BUFFERS_length_bias      2
6846#define GEN9_3DSTATE_VERTEX_BUFFERS_header      \
6847   .DWordLength                         =      3,  \
6848   ._3DCommandSubOpcode                 =      8,  \
6849   ._3DCommandOpcode                    =      0,  \
6850   .CommandSubType                      =      3,  \
6851   .CommandType                         =      3
6852
6853struct GEN9_3DSTATE_VERTEX_BUFFERS {
6854   uint32_t                             DWordLength;
6855   uint32_t                             _3DCommandSubOpcode;
6856   uint32_t                             _3DCommandOpcode;
6857   uint32_t                             CommandSubType;
6858   uint32_t                             CommandType;
6859   /* variable length fields follow */
6860};
6861
6862static inline void
6863GEN9_3DSTATE_VERTEX_BUFFERS_pack(__attribute__((unused)) __gen_user_data *data,
6864                                 __attribute__((unused)) void * restrict dst,
6865                                 __attribute__((unused)) const struct GEN9_3DSTATE_VERTEX_BUFFERS * restrict values)
6866{
6867   uint32_t * restrict dw = (uint32_t * restrict) dst;
6868
6869   dw[0] =
6870      __gen_uint(values->DWordLength, 0, 7) |
6871      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6872      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6873      __gen_uint(values->CommandSubType, 27, 28) |
6874      __gen_uint(values->CommandType, 29, 31);
6875}
6876
6877#define GEN9_3DSTATE_VERTEX_ELEMENTS_length_bias      2
6878#define GEN9_3DSTATE_VERTEX_ELEMENTS_header     \
6879   .DWordLength                         =      1,  \
6880   ._3DCommandSubOpcode                 =      9,  \
6881   ._3DCommandOpcode                    =      0,  \
6882   .CommandSubType                      =      3,  \
6883   .CommandType                         =      3
6884
6885struct GEN9_3DSTATE_VERTEX_ELEMENTS {
6886   uint32_t                             DWordLength;
6887   uint32_t                             _3DCommandSubOpcode;
6888   uint32_t                             _3DCommandOpcode;
6889   uint32_t                             CommandSubType;
6890   uint32_t                             CommandType;
6891   /* variable length fields follow */
6892};
6893
6894static inline void
6895GEN9_3DSTATE_VERTEX_ELEMENTS_pack(__attribute__((unused)) __gen_user_data *data,
6896                                  __attribute__((unused)) void * restrict dst,
6897                                  __attribute__((unused)) const struct GEN9_3DSTATE_VERTEX_ELEMENTS * restrict values)
6898{
6899   uint32_t * restrict dw = (uint32_t * restrict) dst;
6900
6901   dw[0] =
6902      __gen_uint(values->DWordLength, 0, 7) |
6903      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6904      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6905      __gen_uint(values->CommandSubType, 27, 28) |
6906      __gen_uint(values->CommandType, 29, 31);
6907}
6908
6909#define GEN9_3DSTATE_VF_length                 2
6910#define GEN9_3DSTATE_VF_length_bias            2
6911#define GEN9_3DSTATE_VF_header                  \
6912   .DWordLength                         =      0,  \
6913   ._3DCommandSubOpcode                 =     12,  \
6914   ._3DCommandOpcode                    =      0,  \
6915   .CommandSubType                      =      3,  \
6916   .CommandType                         =      3
6917
6918struct GEN9_3DSTATE_VF {
6919   uint32_t                             DWordLength;
6920   bool                                 IndexedDrawCutIndexEnable;
6921   bool                                 ComponentPackingEnable;
6922   bool                                 SequentialDrawCutIndexEnable;
6923   uint32_t                             _3DCommandSubOpcode;
6924   uint32_t                             _3DCommandOpcode;
6925   uint32_t                             CommandSubType;
6926   uint32_t                             CommandType;
6927   uint32_t                             CutIndex;
6928};
6929
6930static inline void
6931GEN9_3DSTATE_VF_pack(__attribute__((unused)) __gen_user_data *data,
6932                     __attribute__((unused)) void * restrict dst,
6933                     __attribute__((unused)) const struct GEN9_3DSTATE_VF * restrict values)
6934{
6935   uint32_t * restrict dw = (uint32_t * restrict) dst;
6936
6937   dw[0] =
6938      __gen_uint(values->DWordLength, 0, 7) |
6939      __gen_uint(values->IndexedDrawCutIndexEnable, 8, 8) |
6940      __gen_uint(values->ComponentPackingEnable, 9, 9) |
6941      __gen_uint(values->SequentialDrawCutIndexEnable, 10, 10) |
6942      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6943      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6944      __gen_uint(values->CommandSubType, 27, 28) |
6945      __gen_uint(values->CommandType, 29, 31);
6946
6947   dw[1] =
6948      __gen_uint(values->CutIndex, 0, 31);
6949}
6950
6951#define GEN9_3DSTATE_VF_COMPONENT_PACKING_length      5
6952#define GEN9_3DSTATE_VF_COMPONENT_PACKING_length_bias      2
6953#define GEN9_3DSTATE_VF_COMPONENT_PACKING_header\
6954   .DWordLength                         =      3,  \
6955   ._3DCommandSubOpcode                 =     85,  \
6956   ._3DCommandOpcode                    =      0,  \
6957   .CommandSubType                      =      3,  \
6958   .CommandType                         =      3
6959
6960struct GEN9_3DSTATE_VF_COMPONENT_PACKING {
6961   uint32_t                             DWordLength;
6962   uint32_t                             _3DCommandSubOpcode;
6963   uint32_t                             _3DCommandOpcode;
6964   uint32_t                             CommandSubType;
6965   uint32_t                             CommandType;
6966   uint32_t                             VertexElement00Enables;
6967   uint32_t                             VertexElement01Enables;
6968   uint32_t                             VertexElement02Enables;
6969   uint32_t                             VertexElement03Enables;
6970   uint32_t                             VertexElement04Enables;
6971   uint32_t                             VertexElement05Enables;
6972   uint32_t                             VertexElement06Enables;
6973   uint32_t                             VertexElement07Enables;
6974   uint32_t                             VertexElement08Enables;
6975   uint32_t                             VertexElement09Enables;
6976   uint32_t                             VertexElement10Enables;
6977   uint32_t                             VertexElement11Enables;
6978   uint32_t                             VertexElement12Enables;
6979   uint32_t                             VertexElement13Enables;
6980   uint32_t                             VertexElement14Enables;
6981   uint32_t                             VertexElement15Enables;
6982   uint32_t                             VertexElement16Enables;
6983   uint32_t                             VertexElement17Enables;
6984   uint32_t                             VertexElement18Enables;
6985   uint32_t                             VertexElement19Enables;
6986   uint32_t                             VertexElement20Enables;
6987   uint32_t                             VertexElement21Enables;
6988   uint32_t                             VertexElement22Enables;
6989   uint32_t                             VertexElement23Enables;
6990   uint32_t                             VertexElement24Enables;
6991   uint32_t                             VertexElement25Enables;
6992   uint32_t                             VertexElement26Enables;
6993   uint32_t                             VertexElement27Enables;
6994   uint32_t                             VertexElement28Enables;
6995   uint32_t                             VertexElement29Enables;
6996   uint32_t                             VertexElement30Enables;
6997   uint32_t                             VertexElement31Enables;
6998};
6999
7000static inline void
7001GEN9_3DSTATE_VF_COMPONENT_PACKING_pack(__attribute__((unused)) __gen_user_data *data,
7002                                       __attribute__((unused)) void * restrict dst,
7003                                       __attribute__((unused)) const struct GEN9_3DSTATE_VF_COMPONENT_PACKING * restrict values)
7004{
7005   uint32_t * restrict dw = (uint32_t * restrict) dst;
7006
7007   dw[0] =
7008      __gen_uint(values->DWordLength, 0, 7) |
7009      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7010      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7011      __gen_uint(values->CommandSubType, 27, 28) |
7012      __gen_uint(values->CommandType, 29, 31);
7013
7014   dw[1] =
7015      __gen_uint(values->VertexElement00Enables, 0, 3) |
7016      __gen_uint(values->VertexElement01Enables, 4, 7) |
7017      __gen_uint(values->VertexElement02Enables, 8, 11) |
7018      __gen_uint(values->VertexElement03Enables, 12, 15) |
7019      __gen_uint(values->VertexElement04Enables, 16, 19) |
7020      __gen_uint(values->VertexElement05Enables, 20, 23) |
7021      __gen_uint(values->VertexElement06Enables, 24, 27) |
7022      __gen_uint(values->VertexElement07Enables, 28, 31);
7023
7024   dw[2] =
7025      __gen_uint(values->VertexElement08Enables, 0, 3) |
7026      __gen_uint(values->VertexElement09Enables, 4, 7) |
7027      __gen_uint(values->VertexElement10Enables, 8, 11) |
7028      __gen_uint(values->VertexElement11Enables, 12, 15) |
7029      __gen_uint(values->VertexElement12Enables, 16, 19) |
7030      __gen_uint(values->VertexElement13Enables, 20, 23) |
7031      __gen_uint(values->VertexElement14Enables, 24, 27) |
7032      __gen_uint(values->VertexElement15Enables, 28, 31);
7033
7034   dw[3] =
7035      __gen_uint(values->VertexElement16Enables, 0, 3) |
7036      __gen_uint(values->VertexElement17Enables, 4, 7) |
7037      __gen_uint(values->VertexElement18Enables, 8, 11) |
7038      __gen_uint(values->VertexElement19Enables, 12, 15) |
7039      __gen_uint(values->VertexElement20Enables, 16, 19) |
7040      __gen_uint(values->VertexElement21Enables, 20, 23) |
7041      __gen_uint(values->VertexElement22Enables, 24, 27) |
7042      __gen_uint(values->VertexElement23Enables, 28, 31);
7043
7044   dw[4] =
7045      __gen_uint(values->VertexElement24Enables, 0, 3) |
7046      __gen_uint(values->VertexElement25Enables, 4, 7) |
7047      __gen_uint(values->VertexElement26Enables, 8, 11) |
7048      __gen_uint(values->VertexElement27Enables, 12, 15) |
7049      __gen_uint(values->VertexElement28Enables, 16, 19) |
7050      __gen_uint(values->VertexElement29Enables, 20, 23) |
7051      __gen_uint(values->VertexElement30Enables, 24, 27) |
7052      __gen_uint(values->VertexElement31Enables, 28, 31);
7053}
7054
7055#define GEN9_3DSTATE_VF_INSTANCING_length      3
7056#define GEN9_3DSTATE_VF_INSTANCING_length_bias      2
7057#define GEN9_3DSTATE_VF_INSTANCING_header       \
7058   .DWordLength                         =      1,  \
7059   ._3DCommandSubOpcode                 =     73,  \
7060   ._3DCommandOpcode                    =      0,  \
7061   .CommandSubType                      =      3,  \
7062   .CommandType                         =      3
7063
7064struct GEN9_3DSTATE_VF_INSTANCING {
7065   uint32_t                             DWordLength;
7066   uint32_t                             _3DCommandSubOpcode;
7067   uint32_t                             _3DCommandOpcode;
7068   uint32_t                             CommandSubType;
7069   uint32_t                             CommandType;
7070   uint32_t                             VertexElementIndex;
7071   bool                                 InstancingEnable;
7072   uint32_t                             InstanceDataStepRate;
7073};
7074
7075static inline void
7076GEN9_3DSTATE_VF_INSTANCING_pack(__attribute__((unused)) __gen_user_data *data,
7077                                __attribute__((unused)) void * restrict dst,
7078                                __attribute__((unused)) const struct GEN9_3DSTATE_VF_INSTANCING * restrict values)
7079{
7080   uint32_t * restrict dw = (uint32_t * restrict) dst;
7081
7082   dw[0] =
7083      __gen_uint(values->DWordLength, 0, 7) |
7084      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7085      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7086      __gen_uint(values->CommandSubType, 27, 28) |
7087      __gen_uint(values->CommandType, 29, 31);
7088
7089   dw[1] =
7090      __gen_uint(values->VertexElementIndex, 0, 5) |
7091      __gen_uint(values->InstancingEnable, 8, 8);
7092
7093   dw[2] =
7094      __gen_uint(values->InstanceDataStepRate, 0, 31);
7095}
7096
7097#define GEN9_3DSTATE_VF_SGVS_length            2
7098#define GEN9_3DSTATE_VF_SGVS_length_bias       2
7099#define GEN9_3DSTATE_VF_SGVS_header             \
7100   .DWordLength                         =      0,  \
7101   ._3DCommandSubOpcode                 =     74,  \
7102   ._3DCommandOpcode                    =      0,  \
7103   .CommandSubType                      =      3,  \
7104   .CommandType                         =      3
7105
7106struct GEN9_3DSTATE_VF_SGVS {
7107   uint32_t                             DWordLength;
7108   uint32_t                             _3DCommandSubOpcode;
7109   uint32_t                             _3DCommandOpcode;
7110   uint32_t                             CommandSubType;
7111   uint32_t                             CommandType;
7112   uint32_t                             VertexIDElementOffset;
7113   uint32_t                             VertexIDComponentNumber;
7114#define COMP_0                                   0
7115#define COMP_1                                   1
7116#define COMP_2                                   2
7117#define COMP_3                                   3
7118   bool                                 VertexIDEnable;
7119   uint32_t                             InstanceIDElementOffset;
7120   uint32_t                             InstanceIDComponentNumber;
7121#define COMP_0                                   0
7122#define COMP_1                                   1
7123#define COMP_2                                   2
7124#define COMP_3                                   3
7125   bool                                 InstanceIDEnable;
7126};
7127
7128static inline void
7129GEN9_3DSTATE_VF_SGVS_pack(__attribute__((unused)) __gen_user_data *data,
7130                          __attribute__((unused)) void * restrict dst,
7131                          __attribute__((unused)) const struct GEN9_3DSTATE_VF_SGVS * restrict values)
7132{
7133   uint32_t * restrict dw = (uint32_t * restrict) dst;
7134
7135   dw[0] =
7136      __gen_uint(values->DWordLength, 0, 7) |
7137      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7138      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7139      __gen_uint(values->CommandSubType, 27, 28) |
7140      __gen_uint(values->CommandType, 29, 31);
7141
7142   dw[1] =
7143      __gen_uint(values->VertexIDElementOffset, 0, 5) |
7144      __gen_uint(values->VertexIDComponentNumber, 13, 14) |
7145      __gen_uint(values->VertexIDEnable, 15, 15) |
7146      __gen_uint(values->InstanceIDElementOffset, 16, 21) |
7147      __gen_uint(values->InstanceIDComponentNumber, 29, 30) |
7148      __gen_uint(values->InstanceIDEnable, 31, 31);
7149}
7150
7151#define GEN9_3DSTATE_VF_STATISTICS_length      1
7152#define GEN9_3DSTATE_VF_STATISTICS_length_bias      1
7153#define GEN9_3DSTATE_VF_STATISTICS_header       \
7154   ._3DCommandSubOpcode                 =     11,  \
7155   ._3DCommandOpcode                    =      0,  \
7156   .CommandSubType                      =      1,  \
7157   .CommandType                         =      3
7158
7159struct GEN9_3DSTATE_VF_STATISTICS {
7160   bool                                 StatisticsEnable;
7161   uint32_t                             _3DCommandSubOpcode;
7162   uint32_t                             _3DCommandOpcode;
7163   uint32_t                             CommandSubType;
7164   uint32_t                             CommandType;
7165};
7166
7167static inline void
7168GEN9_3DSTATE_VF_STATISTICS_pack(__attribute__((unused)) __gen_user_data *data,
7169                                __attribute__((unused)) void * restrict dst,
7170                                __attribute__((unused)) const struct GEN9_3DSTATE_VF_STATISTICS * restrict values)
7171{
7172   uint32_t * restrict dw = (uint32_t * restrict) dst;
7173
7174   dw[0] =
7175      __gen_uint(values->StatisticsEnable, 0, 0) |
7176      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7177      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7178      __gen_uint(values->CommandSubType, 27, 28) |
7179      __gen_uint(values->CommandType, 29, 31);
7180}
7181
7182#define GEN9_3DSTATE_VF_TOPOLOGY_length        2
7183#define GEN9_3DSTATE_VF_TOPOLOGY_length_bias      2
7184#define GEN9_3DSTATE_VF_TOPOLOGY_header         \
7185   .DWordLength                         =      0,  \
7186   ._3DCommandSubOpcode                 =     75,  \
7187   ._3DCommandOpcode                    =      0,  \
7188   .CommandSubType                      =      3,  \
7189   .CommandType                         =      3
7190
7191struct GEN9_3DSTATE_VF_TOPOLOGY {
7192   uint32_t                             DWordLength;
7193   uint32_t                             _3DCommandSubOpcode;
7194   uint32_t                             _3DCommandOpcode;
7195   uint32_t                             CommandSubType;
7196   uint32_t                             CommandType;
7197   enum GEN9_3D_Prim_Topo_Type          PrimitiveTopologyType;
7198};
7199
7200static inline void
7201GEN9_3DSTATE_VF_TOPOLOGY_pack(__attribute__((unused)) __gen_user_data *data,
7202                              __attribute__((unused)) void * restrict dst,
7203                              __attribute__((unused)) const struct GEN9_3DSTATE_VF_TOPOLOGY * restrict values)
7204{
7205   uint32_t * restrict dw = (uint32_t * restrict) dst;
7206
7207   dw[0] =
7208      __gen_uint(values->DWordLength, 0, 7) |
7209      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7210      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7211      __gen_uint(values->CommandSubType, 27, 28) |
7212      __gen_uint(values->CommandType, 29, 31);
7213
7214   dw[1] =
7215      __gen_uint(values->PrimitiveTopologyType, 0, 5);
7216}
7217
7218#define GEN9_3DSTATE_VIEWPORT_STATE_POINTERS_CC_length      2
7219#define GEN9_3DSTATE_VIEWPORT_STATE_POINTERS_CC_length_bias      2
7220#define GEN9_3DSTATE_VIEWPORT_STATE_POINTERS_CC_header\
7221   .DWordLength                         =      0,  \
7222   ._3DCommandSubOpcode                 =     35,  \
7223   ._3DCommandOpcode                    =      0,  \
7224   .CommandSubType                      =      3,  \
7225   .CommandType                         =      3
7226
7227struct GEN9_3DSTATE_VIEWPORT_STATE_POINTERS_CC {
7228   uint32_t                             DWordLength;
7229   uint32_t                             _3DCommandSubOpcode;
7230   uint32_t                             _3DCommandOpcode;
7231   uint32_t                             CommandSubType;
7232   uint32_t                             CommandType;
7233   uint64_t                             CCViewportPointer;
7234};
7235
7236static inline void
7237GEN9_3DSTATE_VIEWPORT_STATE_POINTERS_CC_pack(__attribute__((unused)) __gen_user_data *data,
7238                                             __attribute__((unused)) void * restrict dst,
7239                                             __attribute__((unused)) const struct GEN9_3DSTATE_VIEWPORT_STATE_POINTERS_CC * restrict values)
7240{
7241   uint32_t * restrict dw = (uint32_t * restrict) dst;
7242
7243   dw[0] =
7244      __gen_uint(values->DWordLength, 0, 7) |
7245      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7246      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7247      __gen_uint(values->CommandSubType, 27, 28) |
7248      __gen_uint(values->CommandType, 29, 31);
7249
7250   dw[1] =
7251      __gen_offset(values->CCViewportPointer, 5, 31);
7252}
7253
7254#define GEN9_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_length      2
7255#define GEN9_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_length_bias      2
7256#define GEN9_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_header\
7257   .DWordLength                         =      0,  \
7258   ._3DCommandSubOpcode                 =     33,  \
7259   ._3DCommandOpcode                    =      0,  \
7260   .CommandSubType                      =      3,  \
7261   .CommandType                         =      3
7262
7263struct GEN9_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP {
7264   uint32_t                             DWordLength;
7265   uint32_t                             _3DCommandSubOpcode;
7266   uint32_t                             _3DCommandOpcode;
7267   uint32_t                             CommandSubType;
7268   uint32_t                             CommandType;
7269   uint64_t                             SFClipViewportPointer;
7270};
7271
7272static inline void
7273GEN9_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
7274                                                  __attribute__((unused)) void * restrict dst,
7275                                                  __attribute__((unused)) const struct GEN9_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP * restrict values)
7276{
7277   uint32_t * restrict dw = (uint32_t * restrict) dst;
7278
7279   dw[0] =
7280      __gen_uint(values->DWordLength, 0, 7) |
7281      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7282      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7283      __gen_uint(values->CommandSubType, 27, 28) |
7284      __gen_uint(values->CommandType, 29, 31);
7285
7286   dw[1] =
7287      __gen_offset(values->SFClipViewportPointer, 6, 31);
7288}
7289
7290#define GEN9_3DSTATE_VS_length                 9
7291#define GEN9_3DSTATE_VS_length_bias            2
7292#define GEN9_3DSTATE_VS_header                  \
7293   .DWordLength                         =      7,  \
7294   ._3DCommandSubOpcode                 =     16,  \
7295   ._3DCommandOpcode                    =      0,  \
7296   .CommandSubType                      =      3,  \
7297   .CommandType                         =      3
7298
7299struct GEN9_3DSTATE_VS {
7300   uint32_t                             DWordLength;
7301   uint32_t                             _3DCommandSubOpcode;
7302   uint32_t                             _3DCommandOpcode;
7303   uint32_t                             CommandSubType;
7304   uint32_t                             CommandType;
7305   uint64_t                             KernelStartPointer;
7306   bool                                 SoftwareExceptionEnable;
7307   bool                                 AccessesUAV;
7308   bool                                 IllegalOpcodeExceptionEnable;
7309   uint32_t                             FloatingPointMode;
7310#define IEEE754                                  0
7311#define Alternate                                1
7312   uint32_t                             ThreadDispatchPriority;
7313#define High                                     1
7314   uint32_t                             BindingTableEntryCount;
7315   uint32_t                             SamplerCount;
7316#define NoSamplers                               0
7317#define _14Samplers                              1
7318#define _58Samplers                              2
7319#define _912Samplers                             3
7320#define _1316Samplers                            4
7321   bool                                 VectorMaskEnable;
7322   bool                                 SingleVertexDispatch;
7323   uint32_t                             PerThreadScratchSpace;
7324   __gen_address_type                   ScratchSpaceBasePointer;
7325   uint32_t                             VertexURBEntryReadOffset;
7326   uint32_t                             VertexURBEntryReadLength;
7327   uint32_t                             DispatchGRFStartRegisterForURBData;
7328   bool                                 Enable;
7329   bool                                 VertexCacheDisable;
7330   bool                                 SIMD8DispatchEnable;
7331   bool                                 StatisticsEnable;
7332   uint32_t                             MaximumNumberofThreads;
7333   uint32_t                             UserClipDistanceCullTestEnableBitmask;
7334   uint32_t                             UserClipDistanceClipTestEnableBitmask;
7335   uint32_t                             VertexURBEntryOutputLength;
7336   uint32_t                             VertexURBEntryOutputReadOffset;
7337};
7338
7339static inline void
7340GEN9_3DSTATE_VS_pack(__attribute__((unused)) __gen_user_data *data,
7341                     __attribute__((unused)) void * restrict dst,
7342                     __attribute__((unused)) const struct GEN9_3DSTATE_VS * restrict values)
7343{
7344   uint32_t * restrict dw = (uint32_t * restrict) dst;
7345
7346   dw[0] =
7347      __gen_uint(values->DWordLength, 0, 7) |
7348      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7349      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7350      __gen_uint(values->CommandSubType, 27, 28) |
7351      __gen_uint(values->CommandType, 29, 31);
7352
7353   const uint64_t v1 =
7354      __gen_offset(values->KernelStartPointer, 6, 63);
7355   dw[1] = v1;
7356   dw[2] = v1 >> 32;
7357
7358   dw[3] =
7359      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
7360      __gen_uint(values->AccessesUAV, 12, 12) |
7361      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
7362      __gen_uint(values->FloatingPointMode, 16, 16) |
7363      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
7364      __gen_uint(values->BindingTableEntryCount, 18, 25) |
7365      __gen_uint(values->SamplerCount, 27, 29) |
7366      __gen_uint(values->VectorMaskEnable, 30, 30) |
7367      __gen_uint(values->SingleVertexDispatch, 31, 31);
7368
7369   const uint64_t v4 =
7370      __gen_uint(values->PerThreadScratchSpace, 0, 3);
7371   const uint64_t v4_address =
7372      __gen_combine_address(data, &dw[4], values->ScratchSpaceBasePointer, v4);
7373   dw[4] = v4_address;
7374   dw[5] = (v4_address >> 32) | (v4 >> 32);
7375
7376   dw[6] =
7377      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
7378      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
7379      __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
7380
7381   dw[7] =
7382      __gen_uint(values->Enable, 0, 0) |
7383      __gen_uint(values->VertexCacheDisable, 1, 1) |
7384      __gen_uint(values->SIMD8DispatchEnable, 2, 2) |
7385      __gen_uint(values->StatisticsEnable, 10, 10) |
7386      __gen_uint(values->MaximumNumberofThreads, 23, 31);
7387
7388   dw[8] =
7389      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
7390      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 8, 15) |
7391      __gen_uint(values->VertexURBEntryOutputLength, 16, 20) |
7392      __gen_uint(values->VertexURBEntryOutputReadOffset, 21, 26);
7393}
7394
7395#define GEN9_3DSTATE_WM_length                 2
7396#define GEN9_3DSTATE_WM_length_bias            2
7397#define GEN9_3DSTATE_WM_header                  \
7398   .DWordLength                         =      0,  \
7399   ._3DCommandSubOpcode                 =     20,  \
7400   ._3DCommandOpcode                    =      0,  \
7401   .CommandSubType                      =      3,  \
7402   .CommandType                         =      3
7403
7404struct GEN9_3DSTATE_WM {
7405   uint32_t                             DWordLength;
7406   uint32_t                             _3DCommandSubOpcode;
7407   uint32_t                             _3DCommandOpcode;
7408   uint32_t                             CommandSubType;
7409   uint32_t                             CommandType;
7410   uint32_t                             ForceKillPixelEnable;
7411#define ForceOff                                 1
7412#define ForceON                                  2
7413   uint32_t                             PointRasterizationRule;
7414#define RASTRULE_UPPER_LEFT                      0
7415#define RASTRULE_UPPER_RIGHT                     1
7416   bool                                 LineStippleEnable;
7417   bool                                 PolygonStippleEnable;
7418   uint32_t                             LineAntialiasingRegionWidth;
7419#define _05pixels                                0
7420#define _10pixels                                1
7421#define _20pixels                                2
7422#define _40pixels                                3
7423   uint32_t                             LineEndCapAntialiasingRegionWidth;
7424#define _05pixels                                0
7425#define _10pixels                                1
7426#define _20pixels                                2
7427#define _40pixels                                3
7428   uint32_t                             BarycentricInterpolationMode;
7429#define BIM_PERSPECTIVE_PIXEL                    1
7430#define BIM_PERSPECTIVE_CENTROID                 2
7431#define BIM_PERSPECTIVE_SAMPLE                   4
7432#define BIM_LINEAR_PIXEL                         8
7433#define BIM_LINEAR_CENTROID                      16
7434#define BIM_LINEAR_SAMPLE                        32
7435   uint32_t                             PositionZWInterpolationMode;
7436#define INTERP_PIXEL                             0
7437#define INTERP_CENTROID                          2
7438#define INTERP_SAMPLE                            3
7439   uint32_t                             ForceThreadDispatchEnable;
7440#define ForceOff                                 1
7441#define ForceON                                  2
7442   uint32_t                             EarlyDepthStencilControl;
7443#define EDSC_NORMAL                              0
7444#define EDSC_PSEXEC                              1
7445#define EDSC_PREPS                               2
7446   bool                                 LegacyDiamondLineRasterization;
7447   bool                                 LegacyHierarchicalDepthBufferResolveEnable;
7448   bool                                 LegacyDepthBufferResolveEnable;
7449   bool                                 LegacyDepthBufferClearEnable;
7450   bool                                 StatisticsEnable;
7451};
7452
7453static inline void
7454GEN9_3DSTATE_WM_pack(__attribute__((unused)) __gen_user_data *data,
7455                     __attribute__((unused)) void * restrict dst,
7456                     __attribute__((unused)) const struct GEN9_3DSTATE_WM * restrict values)
7457{
7458   uint32_t * restrict dw = (uint32_t * restrict) dst;
7459
7460   dw[0] =
7461      __gen_uint(values->DWordLength, 0, 7) |
7462      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7463      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7464      __gen_uint(values->CommandSubType, 27, 28) |
7465      __gen_uint(values->CommandType, 29, 31);
7466
7467   dw[1] =
7468      __gen_uint(values->ForceKillPixelEnable, 0, 1) |
7469      __gen_uint(values->PointRasterizationRule, 2, 2) |
7470      __gen_uint(values->LineStippleEnable, 3, 3) |
7471      __gen_uint(values->PolygonStippleEnable, 4, 4) |
7472      __gen_uint(values->LineAntialiasingRegionWidth, 6, 7) |
7473      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 8, 9) |
7474      __gen_uint(values->BarycentricInterpolationMode, 11, 16) |
7475      __gen_uint(values->PositionZWInterpolationMode, 17, 18) |
7476      __gen_uint(values->ForceThreadDispatchEnable, 19, 20) |
7477      __gen_uint(values->EarlyDepthStencilControl, 21, 22) |
7478      __gen_uint(values->LegacyDiamondLineRasterization, 26, 26) |
7479      __gen_uint(values->LegacyHierarchicalDepthBufferResolveEnable, 27, 27) |
7480      __gen_uint(values->LegacyDepthBufferResolveEnable, 28, 28) |
7481      __gen_uint(values->LegacyDepthBufferClearEnable, 30, 30) |
7482      __gen_uint(values->StatisticsEnable, 31, 31);
7483}
7484
7485#define GEN9_3DSTATE_WM_CHROMAKEY_length       2
7486#define GEN9_3DSTATE_WM_CHROMAKEY_length_bias      2
7487#define GEN9_3DSTATE_WM_CHROMAKEY_header        \
7488   .DWordLength                         =      0,  \
7489   ._3DCommandSubOpcode                 =     76,  \
7490   ._3DCommandOpcode                    =      0,  \
7491   .CommandSubType                      =      3,  \
7492   .CommandType                         =      3
7493
7494struct GEN9_3DSTATE_WM_CHROMAKEY {
7495   uint32_t                             DWordLength;
7496   uint32_t                             _3DCommandSubOpcode;
7497   uint32_t                             _3DCommandOpcode;
7498   uint32_t                             CommandSubType;
7499   uint32_t                             CommandType;
7500   bool                                 ChromaKeyKillEnable;
7501};
7502
7503static inline void
7504GEN9_3DSTATE_WM_CHROMAKEY_pack(__attribute__((unused)) __gen_user_data *data,
7505                               __attribute__((unused)) void * restrict dst,
7506                               __attribute__((unused)) const struct GEN9_3DSTATE_WM_CHROMAKEY * restrict values)
7507{
7508   uint32_t * restrict dw = (uint32_t * restrict) dst;
7509
7510   dw[0] =
7511      __gen_uint(values->DWordLength, 0, 7) |
7512      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7513      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7514      __gen_uint(values->CommandSubType, 27, 28) |
7515      __gen_uint(values->CommandType, 29, 31);
7516
7517   dw[1] =
7518      __gen_uint(values->ChromaKeyKillEnable, 31, 31);
7519}
7520
7521#define GEN9_3DSTATE_WM_DEPTH_STENCIL_length      4
7522#define GEN9_3DSTATE_WM_DEPTH_STENCIL_length_bias      2
7523#define GEN9_3DSTATE_WM_DEPTH_STENCIL_header    \
7524   .DWordLength                         =      2,  \
7525   ._3DCommandSubOpcode                 =     78,  \
7526   ._3DCommandOpcode                    =      0,  \
7527   .CommandSubType                      =      3,  \
7528   .CommandType                         =      3
7529
7530struct GEN9_3DSTATE_WM_DEPTH_STENCIL {
7531   uint32_t                             DWordLength;
7532   uint32_t                             _3DCommandSubOpcode;
7533   uint32_t                             _3DCommandOpcode;
7534   uint32_t                             CommandSubType;
7535   uint32_t                             CommandType;
7536   bool                                 DepthBufferWriteEnable;
7537   bool                                 DepthTestEnable;
7538   bool                                 StencilBufferWriteEnable;
7539   bool                                 StencilTestEnable;
7540   bool                                 DoubleSidedStencilEnable;
7541   enum GEN9_3D_Compare_Function        DepthTestFunction;
7542   enum GEN9_3D_Compare_Function        StencilTestFunction;
7543   enum GEN9_3D_Stencil_Operation       BackfaceStencilPassDepthPassOp;
7544   enum GEN9_3D_Stencil_Operation       BackfaceStencilPassDepthFailOp;
7545   enum GEN9_3D_Stencil_Operation       BackfaceStencilFailOp;
7546   enum GEN9_3D_Compare_Function        BackfaceStencilTestFunction;
7547   enum GEN9_3D_Stencil_Operation       StencilPassDepthPassOp;
7548   enum GEN9_3D_Stencil_Operation       StencilPassDepthFailOp;
7549   enum GEN9_3D_Stencil_Operation       StencilFailOp;
7550   uint32_t                             BackfaceStencilWriteMask;
7551   uint32_t                             BackfaceStencilTestMask;
7552   uint32_t                             StencilWriteMask;
7553   uint32_t                             StencilTestMask;
7554   uint32_t                             BackfaceStencilReferenceValue;
7555   uint32_t                             StencilReferenceValue;
7556};
7557
7558static inline void
7559GEN9_3DSTATE_WM_DEPTH_STENCIL_pack(__attribute__((unused)) __gen_user_data *data,
7560                                   __attribute__((unused)) void * restrict dst,
7561                                   __attribute__((unused)) const struct GEN9_3DSTATE_WM_DEPTH_STENCIL * restrict values)
7562{
7563   uint32_t * restrict dw = (uint32_t * restrict) dst;
7564
7565   dw[0] =
7566      __gen_uint(values->DWordLength, 0, 7) |
7567      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7568      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7569      __gen_uint(values->CommandSubType, 27, 28) |
7570      __gen_uint(values->CommandType, 29, 31);
7571
7572   dw[1] =
7573      __gen_uint(values->DepthBufferWriteEnable, 0, 0) |
7574      __gen_uint(values->DepthTestEnable, 1, 1) |
7575      __gen_uint(values->StencilBufferWriteEnable, 2, 2) |
7576      __gen_uint(values->StencilTestEnable, 3, 3) |
7577      __gen_uint(values->DoubleSidedStencilEnable, 4, 4) |
7578      __gen_uint(values->DepthTestFunction, 5, 7) |
7579      __gen_uint(values->StencilTestFunction, 8, 10) |
7580      __gen_uint(values->BackfaceStencilPassDepthPassOp, 11, 13) |
7581      __gen_uint(values->BackfaceStencilPassDepthFailOp, 14, 16) |
7582      __gen_uint(values->BackfaceStencilFailOp, 17, 19) |
7583      __gen_uint(values->BackfaceStencilTestFunction, 20, 22) |
7584      __gen_uint(values->StencilPassDepthPassOp, 23, 25) |
7585      __gen_uint(values->StencilPassDepthFailOp, 26, 28) |
7586      __gen_uint(values->StencilFailOp, 29, 31);
7587
7588   dw[2] =
7589      __gen_uint(values->BackfaceStencilWriteMask, 0, 7) |
7590      __gen_uint(values->BackfaceStencilTestMask, 8, 15) |
7591      __gen_uint(values->StencilWriteMask, 16, 23) |
7592      __gen_uint(values->StencilTestMask, 24, 31);
7593
7594   dw[3] =
7595      __gen_uint(values->BackfaceStencilReferenceValue, 0, 7) |
7596      __gen_uint(values->StencilReferenceValue, 8, 15);
7597}
7598
7599#define GEN9_3DSTATE_WM_HZ_OP_length           5
7600#define GEN9_3DSTATE_WM_HZ_OP_length_bias      2
7601#define GEN9_3DSTATE_WM_HZ_OP_header            \
7602   .DWordLength                         =      3,  \
7603   ._3DCommandSubOpcode                 =     82,  \
7604   ._3DCommandOpcode                    =      0,  \
7605   .CommandSubType                      =      3,  \
7606   .CommandType                         =      3
7607
7608struct GEN9_3DSTATE_WM_HZ_OP {
7609   uint32_t                             DWordLength;
7610   uint32_t                             _3DCommandSubOpcode;
7611   uint32_t                             _3DCommandOpcode;
7612   uint32_t                             CommandSubType;
7613   uint32_t                             CommandType;
7614   uint32_t                             NumberofMultisamples;
7615   uint32_t                             StencilClearValue;
7616   bool                                 FullSurfaceDepthandStencilClear;
7617   bool                                 PixelPositionOffsetEnable;
7618   bool                                 HierarchicalDepthBufferResolveEnable;
7619   bool                                 DepthBufferResolveEnable;
7620   bool                                 ScissorRectangleEnable;
7621   bool                                 DepthBufferClearEnable;
7622   bool                                 StencilBufferClearEnable;
7623   uint32_t                             ClearRectangleXMin;
7624   uint32_t                             ClearRectangleYMin;
7625   uint32_t                             ClearRectangleXMax;
7626   uint32_t                             ClearRectangleYMax;
7627   uint32_t                             SampleMask;
7628};
7629
7630static inline void
7631GEN9_3DSTATE_WM_HZ_OP_pack(__attribute__((unused)) __gen_user_data *data,
7632                           __attribute__((unused)) void * restrict dst,
7633                           __attribute__((unused)) const struct GEN9_3DSTATE_WM_HZ_OP * restrict values)
7634{
7635   uint32_t * restrict dw = (uint32_t * restrict) dst;
7636
7637   dw[0] =
7638      __gen_uint(values->DWordLength, 0, 7) |
7639      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7640      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7641      __gen_uint(values->CommandSubType, 27, 28) |
7642      __gen_uint(values->CommandType, 29, 31);
7643
7644   dw[1] =
7645      __gen_uint(values->NumberofMultisamples, 13, 15) |
7646      __gen_uint(values->StencilClearValue, 16, 23) |
7647      __gen_uint(values->FullSurfaceDepthandStencilClear, 25, 25) |
7648      __gen_uint(values->PixelPositionOffsetEnable, 26, 26) |
7649      __gen_uint(values->HierarchicalDepthBufferResolveEnable, 27, 27) |
7650      __gen_uint(values->DepthBufferResolveEnable, 28, 28) |
7651      __gen_uint(values->ScissorRectangleEnable, 29, 29) |
7652      __gen_uint(values->DepthBufferClearEnable, 30, 30) |
7653      __gen_uint(values->StencilBufferClearEnable, 31, 31);
7654
7655   dw[2] =
7656      __gen_uint(values->ClearRectangleXMin, 0, 15) |
7657      __gen_uint(values->ClearRectangleYMin, 16, 31);
7658
7659   dw[3] =
7660      __gen_uint(values->ClearRectangleXMax, 0, 15) |
7661      __gen_uint(values->ClearRectangleYMax, 16, 31);
7662
7663   dw[4] =
7664      __gen_uint(values->SampleMask, 0, 15);
7665}
7666
7667#define GEN9_GPGPU_CSR_BASE_ADDRESS_length      3
7668#define GEN9_GPGPU_CSR_BASE_ADDRESS_length_bias      2
7669#define GEN9_GPGPU_CSR_BASE_ADDRESS_header      \
7670   .DWordLength                         =      1,  \
7671   ._3DCommandSubOpcode                 =      4,  \
7672   ._3DCommandOpcode                    =      1,  \
7673   .CommandSubType                      =      0,  \
7674   .CommandType                         =      3
7675
7676struct GEN9_GPGPU_CSR_BASE_ADDRESS {
7677   uint32_t                             DWordLength;
7678   uint32_t                             _3DCommandSubOpcode;
7679   uint32_t                             _3DCommandOpcode;
7680   uint32_t                             CommandSubType;
7681   uint32_t                             CommandType;
7682   __gen_address_type                   GPGPUCSRBaseAddress;
7683};
7684
7685static inline void
7686GEN9_GPGPU_CSR_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
7687                                 __attribute__((unused)) void * restrict dst,
7688                                 __attribute__((unused)) const struct GEN9_GPGPU_CSR_BASE_ADDRESS * restrict values)
7689{
7690   uint32_t * restrict dw = (uint32_t * restrict) dst;
7691
7692   dw[0] =
7693      __gen_uint(values->DWordLength, 0, 7) |
7694      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7695      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7696      __gen_uint(values->CommandSubType, 27, 28) |
7697      __gen_uint(values->CommandType, 29, 31);
7698
7699   const uint64_t v1_address =
7700      __gen_combine_address(data, &dw[1], values->GPGPUCSRBaseAddress, 0);
7701   dw[1] = v1_address;
7702   dw[2] = v1_address >> 32;
7703}
7704
7705#define GEN9_GPGPU_WALKER_length              15
7706#define GEN9_GPGPU_WALKER_length_bias          2
7707#define GEN9_GPGPU_WALKER_header                \
7708   .DWordLength                         =     13,  \
7709   .SubOpcode                           =      5,  \
7710   .MediaCommandOpcode                  =      1,  \
7711   .Pipeline                            =      2,  \
7712   .CommandType                         =      3
7713
7714struct GEN9_GPGPU_WALKER {
7715   uint32_t                             DWordLength;
7716   bool                                 PredicateEnable;
7717   bool                                 IndirectParameterEnable;
7718   uint32_t                             SubOpcode;
7719   uint32_t                             MediaCommandOpcode;
7720   uint32_t                             Pipeline;
7721   uint32_t                             CommandType;
7722   uint32_t                             InterfaceDescriptorOffset;
7723   uint32_t                             IndirectDataLength;
7724   uint64_t                             IndirectDataStartAddress;
7725   uint32_t                             ThreadWidthCounterMaximum;
7726   uint32_t                             ThreadHeightCounterMaximum;
7727   uint32_t                             ThreadDepthCounterMaximum;
7728   uint32_t                             SIMDSize;
7729#define SIMD8                                    0
7730#define SIMD16                                   1
7731#define SIMD32                                   2
7732   uint32_t                             ThreadGroupIDStartingX;
7733   uint32_t                             ThreadGroupIDXDimension;
7734   uint32_t                             ThreadGroupIDStartingY;
7735   uint32_t                             ThreadGroupIDYDimension;
7736   uint32_t                             ThreadGroupIDStartingResumeZ;
7737   uint32_t                             ThreadGroupIDZDimension;
7738   uint32_t                             RightExecutionMask;
7739   uint32_t                             BottomExecutionMask;
7740};
7741
7742static inline void
7743GEN9_GPGPU_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
7744                       __attribute__((unused)) void * restrict dst,
7745                       __attribute__((unused)) const struct GEN9_GPGPU_WALKER * restrict values)
7746{
7747   uint32_t * restrict dw = (uint32_t * restrict) dst;
7748
7749   dw[0] =
7750      __gen_uint(values->DWordLength, 0, 7) |
7751      __gen_uint(values->PredicateEnable, 8, 8) |
7752      __gen_uint(values->IndirectParameterEnable, 10, 10) |
7753      __gen_uint(values->SubOpcode, 16, 23) |
7754      __gen_uint(values->MediaCommandOpcode, 24, 26) |
7755      __gen_uint(values->Pipeline, 27, 28) |
7756      __gen_uint(values->CommandType, 29, 31);
7757
7758   dw[1] =
7759      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
7760
7761   dw[2] =
7762      __gen_uint(values->IndirectDataLength, 0, 16);
7763
7764   dw[3] =
7765      __gen_offset(values->IndirectDataStartAddress, 6, 31);
7766
7767   dw[4] =
7768      __gen_uint(values->ThreadWidthCounterMaximum, 0, 5) |
7769      __gen_uint(values->ThreadHeightCounterMaximum, 8, 13) |
7770      __gen_uint(values->ThreadDepthCounterMaximum, 16, 21) |
7771      __gen_uint(values->SIMDSize, 30, 31);
7772
7773   dw[5] =
7774      __gen_uint(values->ThreadGroupIDStartingX, 0, 31);
7775
7776   dw[6] = 0;
7777
7778   dw[7] =
7779      __gen_uint(values->ThreadGroupIDXDimension, 0, 31);
7780
7781   dw[8] =
7782      __gen_uint(values->ThreadGroupIDStartingY, 0, 31);
7783
7784   dw[9] = 0;
7785
7786   dw[10] =
7787      __gen_uint(values->ThreadGroupIDYDimension, 0, 31);
7788
7789   dw[11] =
7790      __gen_uint(values->ThreadGroupIDStartingResumeZ, 0, 31);
7791
7792   dw[12] =
7793      __gen_uint(values->ThreadGroupIDZDimension, 0, 31);
7794
7795   dw[13] =
7796      __gen_uint(values->RightExecutionMask, 0, 31);
7797
7798   dw[14] =
7799      __gen_uint(values->BottomExecutionMask, 0, 31);
7800}
7801
7802#define GEN9_MEDIA_CURBE_LOAD_length           4
7803#define GEN9_MEDIA_CURBE_LOAD_length_bias      2
7804#define GEN9_MEDIA_CURBE_LOAD_header            \
7805   .DWordLength                         =      2,  \
7806   .SubOpcode                           =      1,  \
7807   .MediaCommandOpcode                  =      0,  \
7808   .Pipeline                            =      2,  \
7809   .CommandType                         =      3
7810
7811struct GEN9_MEDIA_CURBE_LOAD {
7812   uint32_t                             DWordLength;
7813   uint32_t                             SubOpcode;
7814   uint32_t                             MediaCommandOpcode;
7815   uint32_t                             Pipeline;
7816   uint32_t                             CommandType;
7817   uint32_t                             CURBETotalDataLength;
7818   uint32_t                             CURBEDataStartAddress;
7819};
7820
7821static inline void
7822GEN9_MEDIA_CURBE_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
7823                           __attribute__((unused)) void * restrict dst,
7824                           __attribute__((unused)) const struct GEN9_MEDIA_CURBE_LOAD * restrict values)
7825{
7826   uint32_t * restrict dw = (uint32_t * restrict) dst;
7827
7828   dw[0] =
7829      __gen_uint(values->DWordLength, 0, 15) |
7830      __gen_uint(values->SubOpcode, 16, 23) |
7831      __gen_uint(values->MediaCommandOpcode, 24, 26) |
7832      __gen_uint(values->Pipeline, 27, 28) |
7833      __gen_uint(values->CommandType, 29, 31);
7834
7835   dw[1] = 0;
7836
7837   dw[2] =
7838      __gen_uint(values->CURBETotalDataLength, 0, 16);
7839
7840   dw[3] =
7841      __gen_uint(values->CURBEDataStartAddress, 0, 31);
7842}
7843
7844#define GEN9_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length      4
7845#define GEN9_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length_bias      2
7846#define GEN9_MEDIA_INTERFACE_DESCRIPTOR_LOAD_header\
7847   .DWordLength                         =      2,  \
7848   .SubOpcode                           =      2,  \
7849   .MediaCommandOpcode                  =      0,  \
7850   .Pipeline                            =      2,  \
7851   .CommandType                         =      3
7852
7853struct GEN9_MEDIA_INTERFACE_DESCRIPTOR_LOAD {
7854   uint32_t                             DWordLength;
7855   uint32_t                             SubOpcode;
7856   uint32_t                             MediaCommandOpcode;
7857   uint32_t                             Pipeline;
7858   uint32_t                             CommandType;
7859   uint32_t                             InterfaceDescriptorTotalLength;
7860   uint64_t                             InterfaceDescriptorDataStartAddress;
7861};
7862
7863static inline void
7864GEN9_MEDIA_INTERFACE_DESCRIPTOR_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
7865                                          __attribute__((unused)) void * restrict dst,
7866                                          __attribute__((unused)) const struct GEN9_MEDIA_INTERFACE_DESCRIPTOR_LOAD * restrict values)
7867{
7868   uint32_t * restrict dw = (uint32_t * restrict) dst;
7869
7870   dw[0] =
7871      __gen_uint(values->DWordLength, 0, 15) |
7872      __gen_uint(values->SubOpcode, 16, 23) |
7873      __gen_uint(values->MediaCommandOpcode, 24, 26) |
7874      __gen_uint(values->Pipeline, 27, 28) |
7875      __gen_uint(values->CommandType, 29, 31);
7876
7877   dw[1] = 0;
7878
7879   dw[2] =
7880      __gen_uint(values->InterfaceDescriptorTotalLength, 0, 16);
7881
7882   dw[3] =
7883      __gen_offset(values->InterfaceDescriptorDataStartAddress, 0, 31);
7884}
7885
7886#define GEN9_MEDIA_OBJECT_length_bias          2
7887#define GEN9_MEDIA_OBJECT_header                \
7888   .DWordLength                         =      4,  \
7889   .MediaCommandSubOpcode               =      0,  \
7890   .MediaCommandOpcode                  =      1,  \
7891   .MediaCommandPipeline                =      2,  \
7892   .CommandType                         =      3
7893
7894struct GEN9_MEDIA_OBJECT {
7895   uint32_t                             DWordLength;
7896   uint32_t                             MediaCommandSubOpcode;
7897   uint32_t                             MediaCommandOpcode;
7898   uint32_t                             MediaCommandPipeline;
7899   uint32_t                             CommandType;
7900   uint32_t                             InterfaceDescriptorOffset;
7901   uint32_t                             IndirectDataLength;
7902   uint32_t                             SubSliceDestinationSelect;
7903#define Subslice3                                3
7904#define SubSlice2                                2
7905#define SubSlice1                                1
7906#define SubSlice0                                0
7907   uint32_t                             SliceDestinationSelect;
7908#define Slice0                                   0
7909#define Slice1                                   1
7910#define Slice2                                   2
7911   uint32_t                             UseScoreboard;
7912#define Notusingscoreboard                       0
7913#define Usingscoreboard                          1
7914   uint32_t                             ForceDestination;
7915   uint32_t                             ThreadSynchronization;
7916#define Nothreadsynchronization                  0
7917#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
7918   uint32_t                             SliceDestinationSelectMSBs;
7919   bool                                 ChildrenPresent;
7920   __gen_address_type                   IndirectDataStartAddress;
7921   uint32_t                             ScoreboardX;
7922   uint32_t                             ScoredboardY;
7923   uint32_t                             ScoreboardMask;
7924   uint32_t                             ScoreboardColor;
7925   /* variable length fields follow */
7926};
7927
7928static inline void
7929GEN9_MEDIA_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
7930                       __attribute__((unused)) void * restrict dst,
7931                       __attribute__((unused)) const struct GEN9_MEDIA_OBJECT * restrict values)
7932{
7933   uint32_t * restrict dw = (uint32_t * restrict) dst;
7934
7935   dw[0] =
7936      __gen_uint(values->DWordLength, 0, 15) |
7937      __gen_uint(values->MediaCommandSubOpcode, 16, 23) |
7938      __gen_uint(values->MediaCommandOpcode, 24, 26) |
7939      __gen_uint(values->MediaCommandPipeline, 27, 28) |
7940      __gen_uint(values->CommandType, 29, 31);
7941
7942   dw[1] =
7943      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
7944
7945   dw[2] =
7946      __gen_uint(values->IndirectDataLength, 0, 16) |
7947      __gen_uint(values->SubSliceDestinationSelect, 17, 18) |
7948      __gen_uint(values->SliceDestinationSelect, 19, 20) |
7949      __gen_uint(values->UseScoreboard, 21, 21) |
7950      __gen_uint(values->ForceDestination, 22, 22) |
7951      __gen_uint(values->ThreadSynchronization, 24, 24) |
7952      __gen_uint(values->SliceDestinationSelectMSBs, 25, 26) |
7953      __gen_uint(values->ChildrenPresent, 31, 31);
7954
7955   dw[3] = __gen_combine_address(data, &dw[3], values->IndirectDataStartAddress, 0);
7956
7957   dw[4] =
7958      __gen_uint(values->ScoreboardX, 0, 8) |
7959      __gen_uint(values->ScoredboardY, 16, 24);
7960
7961   dw[5] =
7962      __gen_uint(values->ScoreboardMask, 0, 7) |
7963      __gen_uint(values->ScoreboardColor, 16, 19);
7964}
7965
7966#define GEN9_MEDIA_OBJECT_GRPID_length_bias      2
7967#define GEN9_MEDIA_OBJECT_GRPID_header          \
7968   .DWordLength                         =      5,  \
7969   .MediaCommandSubOpcode               =      6,  \
7970   .MediaCommandOpcode                  =      1,  \
7971   .MediaCommandPipeline                =      2,  \
7972   .CommandType                         =      3
7973
7974struct GEN9_MEDIA_OBJECT_GRPID {
7975   uint32_t                             DWordLength;
7976   uint32_t                             MediaCommandSubOpcode;
7977   uint32_t                             MediaCommandOpcode;
7978   uint32_t                             MediaCommandPipeline;
7979   uint32_t                             CommandType;
7980   uint32_t                             InterfaceDescriptorOffset;
7981   uint32_t                             IndirectDataLength;
7982   uint32_t                             SubSliceDestinationSelect;
7983#define Subslice3                                3
7984#define SubSlice2                                2
7985#define SubSlice1                                1
7986#define SubSlice0                                0
7987   uint32_t                             SliceDestinationSelect;
7988#define Slice0                                   0
7989#define Slice1                                   1
7990#define Slice2                                   2
7991   uint32_t                             UseScoreboard;
7992#define Notusingscoreboard                       0
7993#define Usingscoreboard                          1
7994   uint32_t                             ForceDestination;
7995   uint32_t                             EndofThreadGroup;
7996   uint32_t                             SliceDestinationSelectMSB;
7997   __gen_address_type                   IndirectDataStartAddress;
7998   uint32_t                             ScoreboardX;
7999   uint32_t                             ScoreboardY;
8000   uint32_t                             ScoreboardMask;
8001   uint32_t                             ScoreboardColor;
8002   uint32_t                             GroupID;
8003   /* variable length fields follow */
8004};
8005
8006static inline void
8007GEN9_MEDIA_OBJECT_GRPID_pack(__attribute__((unused)) __gen_user_data *data,
8008                             __attribute__((unused)) void * restrict dst,
8009                             __attribute__((unused)) const struct GEN9_MEDIA_OBJECT_GRPID * restrict values)
8010{
8011   uint32_t * restrict dw = (uint32_t * restrict) dst;
8012
8013   dw[0] =
8014      __gen_uint(values->DWordLength, 0, 15) |
8015      __gen_uint(values->MediaCommandSubOpcode, 16, 23) |
8016      __gen_uint(values->MediaCommandOpcode, 24, 26) |
8017      __gen_uint(values->MediaCommandPipeline, 27, 28) |
8018      __gen_uint(values->CommandType, 29, 31);
8019
8020   dw[1] =
8021      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
8022
8023   dw[2] =
8024      __gen_uint(values->IndirectDataLength, 0, 16) |
8025      __gen_uint(values->SubSliceDestinationSelect, 17, 18) |
8026      __gen_uint(values->SliceDestinationSelect, 19, 20) |
8027      __gen_uint(values->UseScoreboard, 21, 21) |
8028      __gen_uint(values->ForceDestination, 22, 22) |
8029      __gen_uint(values->EndofThreadGroup, 23, 23) |
8030      __gen_uint(values->SliceDestinationSelectMSB, 24, 24);
8031
8032   dw[3] = __gen_combine_address(data, &dw[3], values->IndirectDataStartAddress, 0);
8033
8034   dw[4] =
8035      __gen_uint(values->ScoreboardX, 0, 8) |
8036      __gen_uint(values->ScoreboardY, 16, 24);
8037
8038   dw[5] =
8039      __gen_uint(values->ScoreboardMask, 0, 7) |
8040      __gen_uint(values->ScoreboardColor, 16, 19);
8041
8042   dw[6] =
8043      __gen_uint(values->GroupID, 0, 31);
8044}
8045
8046#define GEN9_MEDIA_OBJECT_PRT_length          16
8047#define GEN9_MEDIA_OBJECT_PRT_length_bias      2
8048#define GEN9_MEDIA_OBJECT_PRT_header            \
8049   .DWordLength                         =     14,  \
8050   .SubOpcode                           =      2,  \
8051   .MediaCommandOpcode                  =      1,  \
8052   .Pipeline                            =      2,  \
8053   .CommandType                         =      3
8054
8055struct GEN9_MEDIA_OBJECT_PRT {
8056   uint32_t                             DWordLength;
8057   uint32_t                             SubOpcode;
8058   uint32_t                             MediaCommandOpcode;
8059   uint32_t                             Pipeline;
8060   uint32_t                             CommandType;
8061   uint32_t                             InterfaceDescriptorOffset;
8062   uint32_t                             PRT_FenceType;
8063#define Rootthreadqueue                          0
8064#define VFEstateflush                            1
8065   bool                                 PRT_FenceNeeded;
8066   bool                                 ChildrenPresent;
8067   uint32_t                             InlineData[12];
8068};
8069
8070static inline void
8071GEN9_MEDIA_OBJECT_PRT_pack(__attribute__((unused)) __gen_user_data *data,
8072                           __attribute__((unused)) void * restrict dst,
8073                           __attribute__((unused)) const struct GEN9_MEDIA_OBJECT_PRT * restrict values)
8074{
8075   uint32_t * restrict dw = (uint32_t * restrict) dst;
8076
8077   dw[0] =
8078      __gen_uint(values->DWordLength, 0, 15) |
8079      __gen_uint(values->SubOpcode, 16, 23) |
8080      __gen_uint(values->MediaCommandOpcode, 24, 26) |
8081      __gen_uint(values->Pipeline, 27, 28) |
8082      __gen_uint(values->CommandType, 29, 31);
8083
8084   dw[1] =
8085      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
8086
8087   dw[2] =
8088      __gen_uint(values->PRT_FenceType, 22, 22) |
8089      __gen_uint(values->PRT_FenceNeeded, 23, 23) |
8090      __gen_uint(values->ChildrenPresent, 31, 31);
8091
8092   dw[3] = 0;
8093
8094   dw[4] =
8095      __gen_uint(values->InlineData[0], 0, 31);
8096
8097   dw[5] =
8098      __gen_uint(values->InlineData[1], 0, 31);
8099
8100   dw[6] =
8101      __gen_uint(values->InlineData[2], 0, 31);
8102
8103   dw[7] =
8104      __gen_uint(values->InlineData[3], 0, 31);
8105
8106   dw[8] =
8107      __gen_uint(values->InlineData[4], 0, 31);
8108
8109   dw[9] =
8110      __gen_uint(values->InlineData[5], 0, 31);
8111
8112   dw[10] =
8113      __gen_uint(values->InlineData[6], 0, 31);
8114
8115   dw[11] =
8116      __gen_uint(values->InlineData[7], 0, 31);
8117
8118   dw[12] =
8119      __gen_uint(values->InlineData[8], 0, 31);
8120
8121   dw[13] =
8122      __gen_uint(values->InlineData[9], 0, 31);
8123
8124   dw[14] =
8125      __gen_uint(values->InlineData[10], 0, 31);
8126
8127   dw[15] =
8128      __gen_uint(values->InlineData[11], 0, 31);
8129}
8130
8131#define GEN9_MEDIA_OBJECT_WALKER_length_bias      2
8132#define GEN9_MEDIA_OBJECT_WALKER_header         \
8133   .DWordLength                         =     15,  \
8134   .SubOpcode                           =      3,  \
8135   .MediaCommandOpcode                  =      1,  \
8136   .Pipeline                            =      2,  \
8137   .CommandType                         =      3
8138
8139struct GEN9_MEDIA_OBJECT_WALKER {
8140   uint32_t                             DWordLength;
8141   uint32_t                             SubOpcode;
8142   uint32_t                             MediaCommandOpcode;
8143   uint32_t                             Pipeline;
8144   uint32_t                             CommandType;
8145   uint32_t                             InterfaceDescriptorOffset;
8146   uint32_t                             IndirectDataLength;
8147   uint32_t                             UseScoreboard;
8148#define Notusingscoreboard                       0
8149#define Usingscoreboard                          1
8150   uint32_t                             MaskedDispatch;
8151   uint32_t                             ThreadSynchronization;
8152#define Nothreadsynchronization                  0
8153#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
8154   uint32_t                             IndirectDataStartAddress;
8155   uint32_t                             ScoreboardMask;
8156   uint32_t                             GroupIDLoopSelect;
8157#define No_Groups                                0
8158#define Color_Groups                             1
8159#define InnerLocal_Groups                        2
8160#define MidLocal_Groups                          3
8161#define OuterLocal_Groups                        4
8162#define InnerGlobal_Groups                       5
8163   int32_t                              MidLoopUnitX;
8164   int32_t                              LocalMidLoopUnitY;
8165   uint32_t                             MiddleLoopExtraSteps;
8166   uint32_t                             ColorCountMinusOne;
8167   uint32_t                             LocalLoopExecCount;
8168   uint32_t                             GlobalLoopExecCount;
8169   uint32_t                             BlockResolutionX;
8170   uint32_t                             BlockResolutionY;
8171   uint32_t                             LocalStartX;
8172   uint32_t                             LocalStartY;
8173   int32_t                              LocalOuterLoopStrideX;
8174   int32_t                              LocalOuterLoopStrideY;
8175   int32_t                              LocalInnerLoopUnitX;
8176   int32_t                              LocalInnerLoopUnitY;
8177   uint32_t                             GlobalResolutionX;
8178   uint32_t                             GlobalResolutionY;
8179   int32_t                              GlobalStartX;
8180   int32_t                              GlobalStartY;
8181   int32_t                              GlobalOuterLoopStrideX;
8182   int32_t                              GlobalOuterLoopStrideY;
8183   int32_t                              GlobalInnerLoopUnitX;
8184   int32_t                              GlobalInnerLoopUnitY;
8185   /* variable length fields follow */
8186};
8187
8188static inline void
8189GEN9_MEDIA_OBJECT_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
8190                              __attribute__((unused)) void * restrict dst,
8191                              __attribute__((unused)) const struct GEN9_MEDIA_OBJECT_WALKER * restrict values)
8192{
8193   uint32_t * restrict dw = (uint32_t * restrict) dst;
8194
8195   dw[0] =
8196      __gen_uint(values->DWordLength, 0, 15) |
8197      __gen_uint(values->SubOpcode, 16, 23) |
8198      __gen_uint(values->MediaCommandOpcode, 24, 26) |
8199      __gen_uint(values->Pipeline, 27, 28) |
8200      __gen_uint(values->CommandType, 29, 31);
8201
8202   dw[1] =
8203      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
8204
8205   dw[2] =
8206      __gen_uint(values->IndirectDataLength, 0, 16) |
8207      __gen_uint(values->UseScoreboard, 21, 21) |
8208      __gen_uint(values->MaskedDispatch, 22, 23) |
8209      __gen_uint(values->ThreadSynchronization, 24, 24);
8210
8211   dw[3] =
8212      __gen_uint(values->IndirectDataStartAddress, 0, 31);
8213
8214   dw[4] = 0;
8215
8216   dw[5] =
8217      __gen_uint(values->ScoreboardMask, 0, 7) |
8218      __gen_uint(values->GroupIDLoopSelect, 8, 31);
8219
8220   dw[6] =
8221      __gen_sint(values->MidLoopUnitX, 8, 9) |
8222      __gen_sint(values->LocalMidLoopUnitY, 12, 13) |
8223      __gen_uint(values->MiddleLoopExtraSteps, 16, 20) |
8224      __gen_uint(values->ColorCountMinusOne, 24, 27);
8225
8226   dw[7] =
8227      __gen_uint(values->LocalLoopExecCount, 0, 11) |
8228      __gen_uint(values->GlobalLoopExecCount, 16, 27);
8229
8230   dw[8] =
8231      __gen_uint(values->BlockResolutionX, 0, 10) |
8232      __gen_uint(values->BlockResolutionY, 16, 26);
8233
8234   dw[9] =
8235      __gen_uint(values->LocalStartX, 0, 10) |
8236      __gen_uint(values->LocalStartY, 16, 26);
8237
8238   dw[10] = 0;
8239
8240   dw[11] =
8241      __gen_sint(values->LocalOuterLoopStrideX, 0, 11) |
8242      __gen_sint(values->LocalOuterLoopStrideY, 16, 27);
8243
8244   dw[12] =
8245      __gen_sint(values->LocalInnerLoopUnitX, 0, 11) |
8246      __gen_sint(values->LocalInnerLoopUnitY, 16, 27);
8247
8248   dw[13] =
8249      __gen_uint(values->GlobalResolutionX, 0, 10) |
8250      __gen_uint(values->GlobalResolutionY, 16, 26);
8251
8252   dw[14] =
8253      __gen_sint(values->GlobalStartX, 0, 11) |
8254      __gen_sint(values->GlobalStartY, 16, 27);
8255
8256   dw[15] =
8257      __gen_sint(values->GlobalOuterLoopStrideX, 0, 11) |
8258      __gen_sint(values->GlobalOuterLoopStrideY, 16, 27);
8259
8260   dw[16] =
8261      __gen_sint(values->GlobalInnerLoopUnitX, 0, 11) |
8262      __gen_sint(values->GlobalInnerLoopUnitY, 16, 27);
8263}
8264
8265#define GEN9_MEDIA_STATE_FLUSH_length          2
8266#define GEN9_MEDIA_STATE_FLUSH_length_bias      2
8267#define GEN9_MEDIA_STATE_FLUSH_header           \
8268   .DWordLength                         =      0,  \
8269   .SubOpcode                           =      4,  \
8270   .MediaCommandOpcode                  =      0,  \
8271   .Pipeline                            =      2,  \
8272   .CommandType                         =      3
8273
8274struct GEN9_MEDIA_STATE_FLUSH {
8275   uint32_t                             DWordLength;
8276   uint32_t                             SubOpcode;
8277   uint32_t                             MediaCommandOpcode;
8278   uint32_t                             Pipeline;
8279   uint32_t                             CommandType;
8280   uint32_t                             InterfaceDescriptorOffset;
8281   uint32_t                             WatermarkRequired;
8282   bool                                 FlushtoGO;
8283};
8284
8285static inline void
8286GEN9_MEDIA_STATE_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
8287                            __attribute__((unused)) void * restrict dst,
8288                            __attribute__((unused)) const struct GEN9_MEDIA_STATE_FLUSH * restrict values)
8289{
8290   uint32_t * restrict dw = (uint32_t * restrict) dst;
8291
8292   dw[0] =
8293      __gen_uint(values->DWordLength, 0, 15) |
8294      __gen_uint(values->SubOpcode, 16, 23) |
8295      __gen_uint(values->MediaCommandOpcode, 24, 26) |
8296      __gen_uint(values->Pipeline, 27, 28) |
8297      __gen_uint(values->CommandType, 29, 31);
8298
8299   dw[1] =
8300      __gen_uint(values->InterfaceDescriptorOffset, 0, 5) |
8301      __gen_uint(values->WatermarkRequired, 6, 6) |
8302      __gen_uint(values->FlushtoGO, 7, 7);
8303}
8304
8305#define GEN9_MEDIA_VFE_STATE_length            9
8306#define GEN9_MEDIA_VFE_STATE_length_bias       2
8307#define GEN9_MEDIA_VFE_STATE_header             \
8308   .DWordLength                         =      7,  \
8309   .SubOpcode                           =      0,  \
8310   .MediaCommandOpcode                  =      0,  \
8311   .Pipeline                            =      2,  \
8312   .CommandType                         =      3
8313
8314struct GEN9_MEDIA_VFE_STATE {
8315   uint32_t                             DWordLength;
8316   uint32_t                             SubOpcode;
8317   uint32_t                             MediaCommandOpcode;
8318   uint32_t                             Pipeline;
8319   uint32_t                             CommandType;
8320   uint32_t                             PerThreadScratchSpace;
8321   uint32_t                             StackSize;
8322   __gen_address_type                   ScratchSpaceBasePointer;
8323   uint32_t                             ResetGatewayTimer;
8324#define Maintainingtheexistingtimestampstate     0
8325#define Resettingrelativetimerandlatchingtheglobaltimestamp 1
8326   uint32_t                             NumberofURBEntries;
8327   uint32_t                             MaximumNumberofThreads;
8328   uint32_t                             SliceDisable;
8329#define AllSubslicesEnabled                      0
8330#define OnlySlice0Enabled                        1
8331#define OnlySlice0Subslice0Enabled               3
8332   uint32_t                             CURBEAllocationSize;
8333   uint32_t                             URBEntryAllocationSize;
8334   uint32_t                             ScoreboardMask;
8335   uint32_t                             ScoreboardType;
8336#define StallingScoreboard                       0
8337#define NonStallingScoreboard                    1
8338   bool                                 ScoreboardEnable;
8339   int32_t                              Scoreboard0DeltaX;
8340   int32_t                              Scoreboard0DeltaY;
8341   int32_t                              Scoreboard1DeltaX;
8342   int32_t                              Scoreboard1DeltaY;
8343   int32_t                              Scoreboard2DeltaX;
8344   int32_t                              Scoreboard2DeltaY;
8345   int32_t                              Scoreboard3DeltaX;
8346   int32_t                              Scoreboard3DeltaY;
8347   int32_t                              Scoreboard4DeltaX;
8348   int32_t                              Scoreboard4DeltaY;
8349   int32_t                              Scoreboard5DeltaX;
8350   int32_t                              Scoreboard5DeltaY;
8351   int32_t                              Scoreboard6DeltaX;
8352   int32_t                              Scoreboard6DeltaY;
8353   int32_t                              Scoreboard7DeltaX;
8354   int32_t                              Scoreboard7DeltaY;
8355};
8356
8357static inline void
8358GEN9_MEDIA_VFE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
8359                          __attribute__((unused)) void * restrict dst,
8360                          __attribute__((unused)) const struct GEN9_MEDIA_VFE_STATE * restrict values)
8361{
8362   uint32_t * restrict dw = (uint32_t * restrict) dst;
8363
8364   dw[0] =
8365      __gen_uint(values->DWordLength, 0, 15) |
8366      __gen_uint(values->SubOpcode, 16, 23) |
8367      __gen_uint(values->MediaCommandOpcode, 24, 26) |
8368      __gen_uint(values->Pipeline, 27, 28) |
8369      __gen_uint(values->CommandType, 29, 31);
8370
8371   const uint64_t v1 =
8372      __gen_uint(values->PerThreadScratchSpace, 0, 3) |
8373      __gen_uint(values->StackSize, 4, 7);
8374   const uint64_t v1_address =
8375      __gen_combine_address(data, &dw[1], values->ScratchSpaceBasePointer, v1);
8376   dw[1] = v1_address;
8377   dw[2] = (v1_address >> 32) | (v1 >> 32);
8378
8379   dw[3] =
8380      __gen_uint(values->ResetGatewayTimer, 7, 7) |
8381      __gen_uint(values->NumberofURBEntries, 8, 15) |
8382      __gen_uint(values->MaximumNumberofThreads, 16, 31);
8383
8384   dw[4] =
8385      __gen_uint(values->SliceDisable, 0, 1);
8386
8387   dw[5] =
8388      __gen_uint(values->CURBEAllocationSize, 0, 15) |
8389      __gen_uint(values->URBEntryAllocationSize, 16, 31);
8390
8391   dw[6] =
8392      __gen_uint(values->ScoreboardMask, 0, 7) |
8393      __gen_uint(values->ScoreboardType, 30, 30) |
8394      __gen_uint(values->ScoreboardEnable, 31, 31);
8395
8396   dw[7] =
8397      __gen_sint(values->Scoreboard0DeltaX, 0, 3) |
8398      __gen_sint(values->Scoreboard0DeltaY, 4, 7) |
8399      __gen_sint(values->Scoreboard1DeltaX, 8, 11) |
8400      __gen_sint(values->Scoreboard1DeltaY, 12, 15) |
8401      __gen_sint(values->Scoreboard2DeltaX, 16, 19) |
8402      __gen_sint(values->Scoreboard2DeltaY, 20, 23) |
8403      __gen_sint(values->Scoreboard3DeltaX, 24, 27) |
8404      __gen_sint(values->Scoreboard3DeltaY, 28, 31);
8405
8406   dw[8] =
8407      __gen_sint(values->Scoreboard4DeltaX, 0, 3) |
8408      __gen_sint(values->Scoreboard4DeltaY, 4, 7) |
8409      __gen_sint(values->Scoreboard5DeltaX, 8, 11) |
8410      __gen_sint(values->Scoreboard5DeltaY, 12, 15) |
8411      __gen_sint(values->Scoreboard6DeltaX, 16, 19) |
8412      __gen_sint(values->Scoreboard6DeltaY, 20, 23) |
8413      __gen_sint(values->Scoreboard7DeltaX, 24, 27) |
8414      __gen_sint(values->Scoreboard7DeltaY, 28, 31);
8415}
8416
8417#define GEN9_MI_ARB_CHECK_length               1
8418#define GEN9_MI_ARB_CHECK_length_bias          1
8419#define GEN9_MI_ARB_CHECK_header                \
8420   .MICommandOpcode                     =      5,  \
8421   .CommandType                         =      0
8422
8423struct GEN9_MI_ARB_CHECK {
8424   uint32_t                             MICommandOpcode;
8425   uint32_t                             CommandType;
8426};
8427
8428static inline void
8429GEN9_MI_ARB_CHECK_pack(__attribute__((unused)) __gen_user_data *data,
8430                       __attribute__((unused)) void * restrict dst,
8431                       __attribute__((unused)) const struct GEN9_MI_ARB_CHECK * restrict values)
8432{
8433   uint32_t * restrict dw = (uint32_t * restrict) dst;
8434
8435   dw[0] =
8436      __gen_uint(values->MICommandOpcode, 23, 28) |
8437      __gen_uint(values->CommandType, 29, 31);
8438}
8439
8440#define GEN9_MI_ARB_ON_OFF_length              1
8441#define GEN9_MI_ARB_ON_OFF_length_bias         1
8442#define GEN9_MI_ARB_ON_OFF_header               \
8443   .ArbitrationEnable                   =      1,  \
8444   .MICommandOpcode                     =      8,  \
8445   .CommandType                         =      0
8446
8447struct GEN9_MI_ARB_ON_OFF {
8448   bool                                 ArbitrationEnable;
8449   uint32_t                             MICommandOpcode;
8450   uint32_t                             CommandType;
8451};
8452
8453static inline void
8454GEN9_MI_ARB_ON_OFF_pack(__attribute__((unused)) __gen_user_data *data,
8455                        __attribute__((unused)) void * restrict dst,
8456                        __attribute__((unused)) const struct GEN9_MI_ARB_ON_OFF * restrict values)
8457{
8458   uint32_t * restrict dw = (uint32_t * restrict) dst;
8459
8460   dw[0] =
8461      __gen_uint(values->ArbitrationEnable, 0, 0) |
8462      __gen_uint(values->MICommandOpcode, 23, 28) |
8463      __gen_uint(values->CommandType, 29, 31);
8464}
8465
8466#define GEN9_MI_ATOMIC_length                  3
8467#define GEN9_MI_ATOMIC_length_bias             2
8468#define GEN9_MI_ATOMIC_header                   \
8469   .DWordLength                         =      1,  \
8470   .MICommandOpcode                     =     47,  \
8471   .CommandType                         =      0
8472
8473struct GEN9_MI_ATOMIC {
8474   uint32_t                             DWordLength;
8475   enum GEN9_Atomic_OPCODE              ATOMICOPCODE;
8476   bool                                 ReturnDataControl;
8477   bool                                 CSSTALL;
8478   bool                                 InlineData;
8479   uint32_t                             DataSize;
8480#define MI_ATOMIC_DWORD                          0
8481#define MI_ATOMIC_QWORD                          1
8482#define MI_ATOMIC_OCTWORD                        2
8483#define MI_ATOMIC_RESERVED                       3
8484   bool                                 PostSyncOperation;
8485   uint32_t                             MemoryType;
8486#define PerProcessGraphicsAddress                0
8487#define GlobalGraphicsAddress                    1
8488   uint32_t                             MICommandOpcode;
8489   uint32_t                             CommandType;
8490   __gen_address_type                   MemoryAddress;
8491   uint32_t                             Operand1DataDword0;
8492   uint32_t                             Operand2DataDword0;
8493   uint32_t                             Operand1DataDword1;
8494   uint32_t                             Operand2DataDword1;
8495   uint32_t                             Operand1DataDword2;
8496   uint32_t                             Operand2DataDword2;
8497   uint32_t                             Operand1DataDword3;
8498   uint32_t                             Operand2DataDword3;
8499};
8500
8501static inline void
8502GEN9_MI_ATOMIC_pack(__attribute__((unused)) __gen_user_data *data,
8503                    __attribute__((unused)) void * restrict dst,
8504                    __attribute__((unused)) const struct GEN9_MI_ATOMIC * restrict values)
8505{
8506   uint32_t * restrict dw = (uint32_t * restrict) dst;
8507
8508   dw[0] =
8509      __gen_uint(values->DWordLength, 0, 7) |
8510      __gen_uint(values->ATOMICOPCODE, 8, 15) |
8511      __gen_uint(values->ReturnDataControl, 16, 16) |
8512      __gen_uint(values->CSSTALL, 17, 17) |
8513      __gen_uint(values->InlineData, 18, 18) |
8514      __gen_uint(values->DataSize, 19, 20) |
8515      __gen_uint(values->PostSyncOperation, 21, 21) |
8516      __gen_uint(values->MemoryType, 22, 22) |
8517      __gen_uint(values->MICommandOpcode, 23, 28) |
8518      __gen_uint(values->CommandType, 29, 31);
8519
8520   const uint64_t v1_address =
8521      __gen_combine_address(data, &dw[1], values->MemoryAddress, 0);
8522   dw[1] = v1_address;
8523   dw[2] = v1_address >> 32;
8524}
8525
8526#define GEN9_MI_BATCH_BUFFER_END_length        1
8527#define GEN9_MI_BATCH_BUFFER_END_length_bias      1
8528#define GEN9_MI_BATCH_BUFFER_END_header         \
8529   .MICommandOpcode                     =     10,  \
8530   .CommandType                         =      0
8531
8532struct GEN9_MI_BATCH_BUFFER_END {
8533   uint32_t                             MICommandOpcode;
8534   uint32_t                             CommandType;
8535};
8536
8537static inline void
8538GEN9_MI_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
8539                              __attribute__((unused)) void * restrict dst,
8540                              __attribute__((unused)) const struct GEN9_MI_BATCH_BUFFER_END * restrict values)
8541{
8542   uint32_t * restrict dw = (uint32_t * restrict) dst;
8543
8544   dw[0] =
8545      __gen_uint(values->MICommandOpcode, 23, 28) |
8546      __gen_uint(values->CommandType, 29, 31);
8547}
8548
8549#define GEN9_MI_BATCH_BUFFER_START_length      3
8550#define GEN9_MI_BATCH_BUFFER_START_length_bias      2
8551#define GEN9_MI_BATCH_BUFFER_START_header       \
8552   .DWordLength                         =      1,  \
8553   .MICommandOpcode                     =     49,  \
8554   .CommandType                         =      0
8555
8556struct GEN9_MI_BATCH_BUFFER_START {
8557   uint32_t                             DWordLength;
8558   uint32_t                             AddressSpaceIndicator;
8559#define ASI_GGTT                                 0
8560#define ASI_PPGTT                                1
8561   bool                                 ResourceStreamerEnable;
8562   bool                                 PredicationEnable;
8563   bool                                 AddOffsetEnable;
8564   uint32_t                             SecondLevelBatchBuffer;
8565#define Firstlevelbatch                          0
8566#define Secondlevelbatch                         1
8567   uint32_t                             MICommandOpcode;
8568   uint32_t                             CommandType;
8569   __gen_address_type                   BatchBufferStartAddress;
8570};
8571
8572static inline void
8573GEN9_MI_BATCH_BUFFER_START_pack(__attribute__((unused)) __gen_user_data *data,
8574                                __attribute__((unused)) void * restrict dst,
8575                                __attribute__((unused)) const struct GEN9_MI_BATCH_BUFFER_START * restrict values)
8576{
8577   uint32_t * restrict dw = (uint32_t * restrict) dst;
8578
8579   dw[0] =
8580      __gen_uint(values->DWordLength, 0, 7) |
8581      __gen_uint(values->AddressSpaceIndicator, 8, 8) |
8582      __gen_uint(values->ResourceStreamerEnable, 10, 10) |
8583      __gen_uint(values->PredicationEnable, 15, 15) |
8584      __gen_uint(values->AddOffsetEnable, 16, 16) |
8585      __gen_uint(values->SecondLevelBatchBuffer, 22, 22) |
8586      __gen_uint(values->MICommandOpcode, 23, 28) |
8587      __gen_uint(values->CommandType, 29, 31);
8588
8589   const uint64_t v1_address =
8590      __gen_combine_address(data, &dw[1], values->BatchBufferStartAddress, 0);
8591   dw[1] = v1_address;
8592   dw[2] = v1_address >> 32;
8593}
8594
8595#define GEN9_MI_CLFLUSH_length_bias            2
8596#define GEN9_MI_CLFLUSH_header                  \
8597   .DWordLength                         =      1,  \
8598   .MICommandOpcode                     =     39,  \
8599   .CommandType                         =      0
8600
8601struct GEN9_MI_CLFLUSH {
8602   uint32_t                             DWordLength;
8603   bool                                 UseGlobalGTT;
8604   uint32_t                             MICommandOpcode;
8605   uint32_t                             CommandType;
8606   uint32_t                             StartingCachelineOffset;
8607   __gen_address_type                   PageBaseAddress;
8608   /* variable length fields follow */
8609};
8610
8611static inline void
8612GEN9_MI_CLFLUSH_pack(__attribute__((unused)) __gen_user_data *data,
8613                     __attribute__((unused)) void * restrict dst,
8614                     __attribute__((unused)) const struct GEN9_MI_CLFLUSH * restrict values)
8615{
8616   uint32_t * restrict dw = (uint32_t * restrict) dst;
8617
8618   dw[0] =
8619      __gen_uint(values->DWordLength, 0, 9) |
8620      __gen_uint(values->UseGlobalGTT, 22, 22) |
8621      __gen_uint(values->MICommandOpcode, 23, 28) |
8622      __gen_uint(values->CommandType, 29, 31);
8623
8624   const uint64_t v1 =
8625      __gen_uint(values->StartingCachelineOffset, 6, 11);
8626   const uint64_t v1_address =
8627      __gen_combine_address(data, &dw[1], values->PageBaseAddress, v1);
8628   dw[1] = v1_address;
8629   dw[2] = (v1_address >> 32) | (v1 >> 32);
8630}
8631
8632#define GEN9_MI_CONDITIONAL_BATCH_BUFFER_END_length      4
8633#define GEN9_MI_CONDITIONAL_BATCH_BUFFER_END_length_bias      2
8634#define GEN9_MI_CONDITIONAL_BATCH_BUFFER_END_header\
8635   .DWordLength                         =      2,  \
8636   .CompareSemaphore                    =      0,  \
8637   .MICommandOpcode                     =     54,  \
8638   .CommandType                         =      0
8639
8640struct GEN9_MI_CONDITIONAL_BATCH_BUFFER_END {
8641   uint32_t                             DWordLength;
8642   uint32_t                             CompareMaskMode;
8643#define CompareMaskModeDisabled                  0
8644#define CompareMaskModeEnabled                   1
8645   uint32_t                             CompareSemaphore;
8646   bool                                 UseGlobalGTT;
8647   uint32_t                             MICommandOpcode;
8648   uint32_t                             CommandType;
8649   uint32_t                             CompareDataDword;
8650   __gen_address_type                   CompareAddress;
8651};
8652
8653static inline void
8654GEN9_MI_CONDITIONAL_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
8655                                          __attribute__((unused)) void * restrict dst,
8656                                          __attribute__((unused)) const struct GEN9_MI_CONDITIONAL_BATCH_BUFFER_END * restrict values)
8657{
8658   uint32_t * restrict dw = (uint32_t * restrict) dst;
8659
8660   dw[0] =
8661      __gen_uint(values->DWordLength, 0, 7) |
8662      __gen_uint(values->CompareMaskMode, 19, 19) |
8663      __gen_uint(values->CompareSemaphore, 21, 21) |
8664      __gen_uint(values->UseGlobalGTT, 22, 22) |
8665      __gen_uint(values->MICommandOpcode, 23, 28) |
8666      __gen_uint(values->CommandType, 29, 31);
8667
8668   dw[1] =
8669      __gen_uint(values->CompareDataDword, 0, 31);
8670
8671   const uint64_t v2_address =
8672      __gen_combine_address(data, &dw[2], values->CompareAddress, 0);
8673   dw[2] = v2_address;
8674   dw[3] = v2_address >> 32;
8675}
8676
8677#define GEN9_MI_COPY_MEM_MEM_length            5
8678#define GEN9_MI_COPY_MEM_MEM_length_bias       2
8679#define GEN9_MI_COPY_MEM_MEM_header             \
8680   .DWordLength                         =      3,  \
8681   .MICommandOpcode                     =     46,  \
8682   .CommandType                         =      0
8683
8684struct GEN9_MI_COPY_MEM_MEM {
8685   uint32_t                             DWordLength;
8686   bool                                 UseGlobalGTTDestination;
8687   bool                                 UseGlobalGTTSource;
8688   uint32_t                             MICommandOpcode;
8689   uint32_t                             CommandType;
8690   __gen_address_type                   DestinationMemoryAddress;
8691   __gen_address_type                   SourceMemoryAddress;
8692};
8693
8694static inline void
8695GEN9_MI_COPY_MEM_MEM_pack(__attribute__((unused)) __gen_user_data *data,
8696                          __attribute__((unused)) void * restrict dst,
8697                          __attribute__((unused)) const struct GEN9_MI_COPY_MEM_MEM * restrict values)
8698{
8699   uint32_t * restrict dw = (uint32_t * restrict) dst;
8700
8701   dw[0] =
8702      __gen_uint(values->DWordLength, 0, 7) |
8703      __gen_uint(values->UseGlobalGTTDestination, 21, 21) |
8704      __gen_uint(values->UseGlobalGTTSource, 22, 22) |
8705      __gen_uint(values->MICommandOpcode, 23, 28) |
8706      __gen_uint(values->CommandType, 29, 31);
8707
8708   const uint64_t v1_address =
8709      __gen_combine_address(data, &dw[1], values->DestinationMemoryAddress, 0);
8710   dw[1] = v1_address;
8711   dw[2] = v1_address >> 32;
8712
8713   const uint64_t v3_address =
8714      __gen_combine_address(data, &dw[3], values->SourceMemoryAddress, 0);
8715   dw[3] = v3_address;
8716   dw[4] = v3_address >> 32;
8717}
8718
8719#define GEN9_MI_DISPLAY_FLIP_length            3
8720#define GEN9_MI_DISPLAY_FLIP_length_bias       2
8721#define GEN9_MI_DISPLAY_FLIP_header             \
8722   .DWordLength                         =      1,  \
8723   .MICommandOpcode                     =     20,  \
8724   .CommandType                         =      0
8725
8726struct GEN9_MI_DISPLAY_FLIP {
8727   uint32_t                             DWordLength;
8728   uint32_t                             DisplayPlaneSelect;
8729#define DisplayPlane1                            0
8730#define DisplayPlane2                            1
8731#define DisplayPlane3                            2
8732#define DisplayPlane4                            4
8733#define DisplayPlane5                            5
8734#define DisplayPlane6                            6
8735#define DisplayPlane7                            7
8736#define DisplayPlane8                            8
8737#define DisplayPlane9                            9
8738#define DisplayPlane10                           10
8739#define DisplayPlane11                           11
8740#define DisplayPlane12                           12
8741   bool                                 AsyncFlipIndicator;
8742   uint32_t                             MICommandOpcode;
8743   uint32_t                             CommandType;
8744   uint32_t                             TileParameter;
8745   uint32_t                             DisplayBufferPitch;
8746   bool                                 Stereoscopic3DMode;
8747   uint32_t                             FlipType;
8748#define SyncFlip                                 0
8749#define AsyncFlip                                1
8750#define Stereo3DFlip                             2
8751   __gen_address_type                   DisplayBufferBaseAddress;
8752   __gen_address_type                   LeftEyeDisplayBufferBaseAddress;
8753};
8754
8755static inline void
8756GEN9_MI_DISPLAY_FLIP_pack(__attribute__((unused)) __gen_user_data *data,
8757                          __attribute__((unused)) void * restrict dst,
8758                          __attribute__((unused)) const struct GEN9_MI_DISPLAY_FLIP * restrict values)
8759{
8760   uint32_t * restrict dw = (uint32_t * restrict) dst;
8761
8762   dw[0] =
8763      __gen_uint(values->DWordLength, 0, 7) |
8764      __gen_uint(values->DisplayPlaneSelect, 8, 12) |
8765      __gen_uint(values->AsyncFlipIndicator, 22, 22) |
8766      __gen_uint(values->MICommandOpcode, 23, 28) |
8767      __gen_uint(values->CommandType, 29, 31);
8768
8769   dw[1] =
8770      __gen_uint(values->TileParameter, 0, 2) |
8771      __gen_uint(values->DisplayBufferPitch, 6, 15) |
8772      __gen_uint(values->Stereoscopic3DMode, 31, 31);
8773
8774   const uint32_t v2 =
8775      __gen_uint(values->FlipType, 0, 1);
8776   dw[2] = __gen_combine_address(data, &dw[2], values->DisplayBufferBaseAddress, v2);
8777}
8778
8779#define GEN9_MI_FORCE_WAKEUP_length            2
8780#define GEN9_MI_FORCE_WAKEUP_length_bias       2
8781#define GEN9_MI_FORCE_WAKEUP_header             \
8782   .DWordLength                         =      0,  \
8783   .MICommandOpcode                     =     29,  \
8784   .CommandType                         =      0
8785
8786struct GEN9_MI_FORCE_WAKEUP {
8787   uint32_t                             DWordLength;
8788   uint32_t                             MICommandOpcode;
8789   uint32_t                             CommandType;
8790   uint32_t                             ForceMediaAwake;
8791   uint32_t                             ForceRenderAwake;
8792   uint32_t                             MaskBits;
8793};
8794
8795static inline void
8796GEN9_MI_FORCE_WAKEUP_pack(__attribute__((unused)) __gen_user_data *data,
8797                          __attribute__((unused)) void * restrict dst,
8798                          __attribute__((unused)) const struct GEN9_MI_FORCE_WAKEUP * restrict values)
8799{
8800   uint32_t * restrict dw = (uint32_t * restrict) dst;
8801
8802   dw[0] =
8803      __gen_uint(values->DWordLength, 0, 7) |
8804      __gen_uint(values->MICommandOpcode, 23, 28) |
8805      __gen_uint(values->CommandType, 29, 31);
8806
8807   dw[1] =
8808      __gen_uint(values->ForceMediaAwake, 0, 0) |
8809      __gen_uint(values->ForceRenderAwake, 1, 1) |
8810      __gen_uint(values->MaskBits, 16, 31);
8811}
8812
8813#define GEN9_MI_LOAD_REGISTER_IMM_length       3
8814#define GEN9_MI_LOAD_REGISTER_IMM_length_bias      2
8815#define GEN9_MI_LOAD_REGISTER_IMM_header        \
8816   .DWordLength                         =      1,  \
8817   .MICommandOpcode                     =     34,  \
8818   .CommandType                         =      0
8819
8820struct GEN9_MI_LOAD_REGISTER_IMM {
8821   uint32_t                             DWordLength;
8822   uint32_t                             ByteWriteDisables;
8823   uint32_t                             MICommandOpcode;
8824   uint32_t                             CommandType;
8825   uint64_t                             RegisterOffset;
8826   uint32_t                             DataDWord;
8827   /* variable length fields follow */
8828};
8829
8830static inline void
8831GEN9_MI_LOAD_REGISTER_IMM_pack(__attribute__((unused)) __gen_user_data *data,
8832                               __attribute__((unused)) void * restrict dst,
8833                               __attribute__((unused)) const struct GEN9_MI_LOAD_REGISTER_IMM * restrict values)
8834{
8835   uint32_t * restrict dw = (uint32_t * restrict) dst;
8836
8837   dw[0] =
8838      __gen_uint(values->DWordLength, 0, 7) |
8839      __gen_uint(values->ByteWriteDisables, 8, 11) |
8840      __gen_uint(values->MICommandOpcode, 23, 28) |
8841      __gen_uint(values->CommandType, 29, 31);
8842
8843   dw[1] =
8844      __gen_offset(values->RegisterOffset, 2, 22);
8845
8846   dw[2] =
8847      __gen_uint(values->DataDWord, 0, 31);
8848}
8849
8850#define GEN9_MI_LOAD_REGISTER_MEM_length       4
8851#define GEN9_MI_LOAD_REGISTER_MEM_length_bias      2
8852#define GEN9_MI_LOAD_REGISTER_MEM_header        \
8853   .DWordLength                         =      2,  \
8854   .MICommandOpcode                     =     41,  \
8855   .CommandType                         =      0
8856
8857struct GEN9_MI_LOAD_REGISTER_MEM {
8858   uint32_t                             DWordLength;
8859   bool                                 AsyncModeEnable;
8860   bool                                 UseGlobalGTT;
8861   uint32_t                             MICommandOpcode;
8862   uint32_t                             CommandType;
8863   uint64_t                             RegisterAddress;
8864   __gen_address_type                   MemoryAddress;
8865};
8866
8867static inline void
8868GEN9_MI_LOAD_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
8869                               __attribute__((unused)) void * restrict dst,
8870                               __attribute__((unused)) const struct GEN9_MI_LOAD_REGISTER_MEM * restrict values)
8871{
8872   uint32_t * restrict dw = (uint32_t * restrict) dst;
8873
8874   dw[0] =
8875      __gen_uint(values->DWordLength, 0, 7) |
8876      __gen_uint(values->AsyncModeEnable, 21, 21) |
8877      __gen_uint(values->UseGlobalGTT, 22, 22) |
8878      __gen_uint(values->MICommandOpcode, 23, 28) |
8879      __gen_uint(values->CommandType, 29, 31);
8880
8881   dw[1] =
8882      __gen_offset(values->RegisterAddress, 2, 22);
8883
8884   const uint64_t v2_address =
8885      __gen_combine_address(data, &dw[2], values->MemoryAddress, 0);
8886   dw[2] = v2_address;
8887   dw[3] = v2_address >> 32;
8888}
8889
8890#define GEN9_MI_LOAD_REGISTER_REG_length       3
8891#define GEN9_MI_LOAD_REGISTER_REG_length_bias      2
8892#define GEN9_MI_LOAD_REGISTER_REG_header        \
8893   .DWordLength                         =      1,  \
8894   .MICommandOpcode                     =     42,  \
8895   .CommandType                         =      0
8896
8897struct GEN9_MI_LOAD_REGISTER_REG {
8898   uint32_t                             DWordLength;
8899   uint32_t                             MICommandOpcode;
8900   uint32_t                             CommandType;
8901   uint64_t                             SourceRegisterAddress;
8902   uint64_t                             DestinationRegisterAddress;
8903};
8904
8905static inline void
8906GEN9_MI_LOAD_REGISTER_REG_pack(__attribute__((unused)) __gen_user_data *data,
8907                               __attribute__((unused)) void * restrict dst,
8908                               __attribute__((unused)) const struct GEN9_MI_LOAD_REGISTER_REG * restrict values)
8909{
8910   uint32_t * restrict dw = (uint32_t * restrict) dst;
8911
8912   dw[0] =
8913      __gen_uint(values->DWordLength, 0, 7) |
8914      __gen_uint(values->MICommandOpcode, 23, 28) |
8915      __gen_uint(values->CommandType, 29, 31);
8916
8917   dw[1] =
8918      __gen_offset(values->SourceRegisterAddress, 2, 22);
8919
8920   dw[2] =
8921      __gen_offset(values->DestinationRegisterAddress, 2, 22);
8922}
8923
8924#define GEN9_MI_LOAD_SCAN_LINES_EXCL_length      2
8925#define GEN9_MI_LOAD_SCAN_LINES_EXCL_length_bias      2
8926#define GEN9_MI_LOAD_SCAN_LINES_EXCL_header     \
8927   .DWordLength                         =      0,  \
8928   .MICommandOpcode                     =     19,  \
8929   .CommandType                         =      0
8930
8931struct GEN9_MI_LOAD_SCAN_LINES_EXCL {
8932   uint32_t                             DWordLength;
8933   uint32_t                             DisplayPlaneSelect;
8934#define DisplayPlaneA                            0
8935#define DisplayPlaneB                            1
8936#define DisplayPlaneC                            4
8937   uint32_t                             MICommandOpcode;
8938   uint32_t                             CommandType;
8939   uint32_t                             EndScanLineNumber;
8940   uint32_t                             StartScanLineNumber;
8941};
8942
8943static inline void
8944GEN9_MI_LOAD_SCAN_LINES_EXCL_pack(__attribute__((unused)) __gen_user_data *data,
8945                                  __attribute__((unused)) void * restrict dst,
8946                                  __attribute__((unused)) const struct GEN9_MI_LOAD_SCAN_LINES_EXCL * restrict values)
8947{
8948   uint32_t * restrict dw = (uint32_t * restrict) dst;
8949
8950   dw[0] =
8951      __gen_uint(values->DWordLength, 0, 5) |
8952      __gen_uint(values->DisplayPlaneSelect, 19, 21) |
8953      __gen_uint(values->MICommandOpcode, 23, 28) |
8954      __gen_uint(values->CommandType, 29, 31);
8955
8956   dw[1] =
8957      __gen_uint(values->EndScanLineNumber, 0, 12) |
8958      __gen_uint(values->StartScanLineNumber, 16, 28);
8959}
8960
8961#define GEN9_MI_LOAD_SCAN_LINES_INCL_length      2
8962#define GEN9_MI_LOAD_SCAN_LINES_INCL_length_bias      2
8963#define GEN9_MI_LOAD_SCAN_LINES_INCL_header     \
8964   .DWordLength                         =      0,  \
8965   .MICommandOpcode                     =     18,  \
8966   .CommandType                         =      0
8967
8968struct GEN9_MI_LOAD_SCAN_LINES_INCL {
8969   uint32_t                             DWordLength;
8970   uint32_t                             ScanLineEventDoneForward;
8971   uint32_t                             DisplayPlaneSelect;
8972#define DisplayPlane1A                           0
8973#define DisplayPlane1B                           1
8974#define DisplayPlane1C                           4
8975   uint32_t                             MICommandOpcode;
8976   uint32_t                             CommandType;
8977   uint32_t                             EndScanLineNumber;
8978   uint32_t                             StartScanLineNumber;
8979};
8980
8981static inline void
8982GEN9_MI_LOAD_SCAN_LINES_INCL_pack(__attribute__((unused)) __gen_user_data *data,
8983                                  __attribute__((unused)) void * restrict dst,
8984                                  __attribute__((unused)) const struct GEN9_MI_LOAD_SCAN_LINES_INCL * restrict values)
8985{
8986   uint32_t * restrict dw = (uint32_t * restrict) dst;
8987
8988   dw[0] =
8989      __gen_uint(values->DWordLength, 0, 5) |
8990      __gen_uint(values->ScanLineEventDoneForward, 17, 18) |
8991      __gen_uint(values->DisplayPlaneSelect, 19, 21) |
8992      __gen_uint(values->MICommandOpcode, 23, 28) |
8993      __gen_uint(values->CommandType, 29, 31);
8994
8995   dw[1] =
8996      __gen_uint(values->EndScanLineNumber, 0, 12) |
8997      __gen_uint(values->StartScanLineNumber, 16, 28);
8998}
8999
9000#define GEN9_MI_LOAD_URB_MEM_length            4
9001#define GEN9_MI_LOAD_URB_MEM_length_bias       2
9002#define GEN9_MI_LOAD_URB_MEM_header             \
9003   .DWordLength                         =      2,  \
9004   .MICommandOpcode                     =     44,  \
9005   .CommandType                         =      0
9006
9007struct GEN9_MI_LOAD_URB_MEM {
9008   uint32_t                             DWordLength;
9009   uint32_t                             MICommandOpcode;
9010   uint32_t                             CommandType;
9011   uint32_t                             URBAddress;
9012   __gen_address_type                   MemoryAddress;
9013};
9014
9015static inline void
9016GEN9_MI_LOAD_URB_MEM_pack(__attribute__((unused)) __gen_user_data *data,
9017                          __attribute__((unused)) void * restrict dst,
9018                          __attribute__((unused)) const struct GEN9_MI_LOAD_URB_MEM * restrict values)
9019{
9020   uint32_t * restrict dw = (uint32_t * restrict) dst;
9021
9022   dw[0] =
9023      __gen_uint(values->DWordLength, 0, 7) |
9024      __gen_uint(values->MICommandOpcode, 23, 28) |
9025      __gen_uint(values->CommandType, 29, 31);
9026
9027   dw[1] =
9028      __gen_uint(values->URBAddress, 2, 14);
9029
9030   const uint64_t v2_address =
9031      __gen_combine_address(data, &dw[2], values->MemoryAddress, 0);
9032   dw[2] = v2_address;
9033   dw[3] = v2_address >> 32;
9034}
9035
9036#define GEN9_MI_MATH_length_bias               2
9037#define GEN9_MI_MATH_header                     \
9038   .DWordLength                         =      0,  \
9039   .MICommandOpcode                     =     26,  \
9040   .CommandType                         =      0
9041
9042struct GEN9_MI_MATH {
9043   uint32_t                             DWordLength;
9044   uint32_t                             MICommandOpcode;
9045   uint32_t                             CommandType;
9046   /* variable length fields follow */
9047};
9048
9049static inline void
9050GEN9_MI_MATH_pack(__attribute__((unused)) __gen_user_data *data,
9051                  __attribute__((unused)) void * restrict dst,
9052                  __attribute__((unused)) const struct GEN9_MI_MATH * restrict values)
9053{
9054   uint32_t * restrict dw = (uint32_t * restrict) dst;
9055
9056   dw[0] =
9057      __gen_uint(values->DWordLength, 0, 7) |
9058      __gen_uint(values->MICommandOpcode, 23, 28) |
9059      __gen_uint(values->CommandType, 29, 31);
9060}
9061
9062#define GEN9_MI_NOOP_length                    1
9063#define GEN9_MI_NOOP_length_bias               1
9064#define GEN9_MI_NOOP_header                     \
9065   .MICommandOpcode                     =      0,  \
9066   .CommandType                         =      0
9067
9068struct GEN9_MI_NOOP {
9069   uint32_t                             IdentificationNumber;
9070   bool                                 IdentificationNumberRegisterWriteEnable;
9071   uint32_t                             MICommandOpcode;
9072   uint32_t                             CommandType;
9073};
9074
9075static inline void
9076GEN9_MI_NOOP_pack(__attribute__((unused)) __gen_user_data *data,
9077                  __attribute__((unused)) void * restrict dst,
9078                  __attribute__((unused)) const struct GEN9_MI_NOOP * restrict values)
9079{
9080   uint32_t * restrict dw = (uint32_t * restrict) dst;
9081
9082   dw[0] =
9083      __gen_uint(values->IdentificationNumber, 0, 21) |
9084      __gen_uint(values->IdentificationNumberRegisterWriteEnable, 22, 22) |
9085      __gen_uint(values->MICommandOpcode, 23, 28) |
9086      __gen_uint(values->CommandType, 29, 31);
9087}
9088
9089#define GEN9_MI_PREDICATE_length               1
9090#define GEN9_MI_PREDICATE_length_bias          1
9091#define GEN9_MI_PREDICATE_header                \
9092   .MICommandOpcode                     =     12,  \
9093   .CommandType                         =      0
9094
9095struct GEN9_MI_PREDICATE {
9096   uint32_t                             CompareOperation;
9097#define COMPARE_TRUE                             0
9098#define COMPARE_FALSE                            1
9099#define COMPARE_SRCS_EQUAL                       2
9100#define COMPARE_DELTAS_EQUAL                     3
9101   uint32_t                             CombineOperation;
9102#define COMBINE_SET                              0
9103#define COMBINE_AND                              1
9104#define COMBINE_OR                               2
9105#define COMBINE_XOR                              3
9106   uint32_t                             LoadOperation;
9107#define LOAD_KEEP                                0
9108#define LOAD_LOAD                                2
9109#define LOAD_LOADINV                             3
9110   uint32_t                             MICommandOpcode;
9111   uint32_t                             CommandType;
9112};
9113
9114static inline void
9115GEN9_MI_PREDICATE_pack(__attribute__((unused)) __gen_user_data *data,
9116                       __attribute__((unused)) void * restrict dst,
9117                       __attribute__((unused)) const struct GEN9_MI_PREDICATE * restrict values)
9118{
9119   uint32_t * restrict dw = (uint32_t * restrict) dst;
9120
9121   dw[0] =
9122      __gen_uint(values->CompareOperation, 0, 1) |
9123      __gen_uint(values->CombineOperation, 3, 4) |
9124      __gen_uint(values->LoadOperation, 6, 7) |
9125      __gen_uint(values->MICommandOpcode, 23, 28) |
9126      __gen_uint(values->CommandType, 29, 31);
9127}
9128
9129#define GEN9_MI_REPORT_HEAD_length             1
9130#define GEN9_MI_REPORT_HEAD_length_bias        1
9131#define GEN9_MI_REPORT_HEAD_header              \
9132   .MICommandOpcode                     =      7,  \
9133   .CommandType                         =      0
9134
9135struct GEN9_MI_REPORT_HEAD {
9136   uint32_t                             MICommandOpcode;
9137   uint32_t                             CommandType;
9138};
9139
9140static inline void
9141GEN9_MI_REPORT_HEAD_pack(__attribute__((unused)) __gen_user_data *data,
9142                         __attribute__((unused)) void * restrict dst,
9143                         __attribute__((unused)) const struct GEN9_MI_REPORT_HEAD * restrict values)
9144{
9145   uint32_t * restrict dw = (uint32_t * restrict) dst;
9146
9147   dw[0] =
9148      __gen_uint(values->MICommandOpcode, 23, 28) |
9149      __gen_uint(values->CommandType, 29, 31);
9150}
9151
9152#define GEN9_MI_REPORT_PERF_COUNT_length       4
9153#define GEN9_MI_REPORT_PERF_COUNT_length_bias      2
9154#define GEN9_MI_REPORT_PERF_COUNT_header        \
9155   .DWordLength                         =      2,  \
9156   .MICommandOpcode                     =     40,  \
9157   .CommandType                         =      0
9158
9159struct GEN9_MI_REPORT_PERF_COUNT {
9160   uint32_t                             DWordLength;
9161   uint32_t                             MICommandOpcode;
9162   uint32_t                             CommandType;
9163   bool                                 UseGlobalGTT;
9164   uint32_t                             CoreModeEnable;
9165   __gen_address_type                   MemoryAddress;
9166   uint32_t                             ReportID;
9167};
9168
9169static inline void
9170GEN9_MI_REPORT_PERF_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
9171                               __attribute__((unused)) void * restrict dst,
9172                               __attribute__((unused)) const struct GEN9_MI_REPORT_PERF_COUNT * restrict values)
9173{
9174   uint32_t * restrict dw = (uint32_t * restrict) dst;
9175
9176   dw[0] =
9177      __gen_uint(values->DWordLength, 0, 5) |
9178      __gen_uint(values->MICommandOpcode, 23, 28) |
9179      __gen_uint(values->CommandType, 29, 31);
9180
9181   const uint64_t v1 =
9182      __gen_uint(values->UseGlobalGTT, 0, 0) |
9183      __gen_uint(values->CoreModeEnable, 4, 4);
9184   const uint64_t v1_address =
9185      __gen_combine_address(data, &dw[1], values->MemoryAddress, v1);
9186   dw[1] = v1_address;
9187   dw[2] = (v1_address >> 32) | (v1 >> 32);
9188
9189   dw[3] =
9190      __gen_uint(values->ReportID, 0, 31);
9191}
9192
9193#define GEN9_MI_RS_CONTEXT_length              1
9194#define GEN9_MI_RS_CONTEXT_length_bias         1
9195#define GEN9_MI_RS_CONTEXT_header               \
9196   .MICommandOpcode                     =     15,  \
9197   .CommandType                         =      0
9198
9199struct GEN9_MI_RS_CONTEXT {
9200   uint32_t                             ResourceStreamerSave;
9201#define RS_Restore                               0
9202#define RS_Save                                  1
9203   uint32_t                             MICommandOpcode;
9204   uint32_t                             CommandType;
9205};
9206
9207static inline void
9208GEN9_MI_RS_CONTEXT_pack(__attribute__((unused)) __gen_user_data *data,
9209                        __attribute__((unused)) void * restrict dst,
9210                        __attribute__((unused)) const struct GEN9_MI_RS_CONTEXT * restrict values)
9211{
9212   uint32_t * restrict dw = (uint32_t * restrict) dst;
9213
9214   dw[0] =
9215      __gen_uint(values->ResourceStreamerSave, 0, 0) |
9216      __gen_uint(values->MICommandOpcode, 23, 28) |
9217      __gen_uint(values->CommandType, 29, 31);
9218}
9219
9220#define GEN9_MI_RS_CONTROL_length              1
9221#define GEN9_MI_RS_CONTROL_length_bias         1
9222#define GEN9_MI_RS_CONTROL_header               \
9223   .MICommandOpcode                     =      6,  \
9224   .CommandType                         =      0
9225
9226struct GEN9_MI_RS_CONTROL {
9227   uint32_t                             ResourceStreamerControl;
9228#define RS_Stop                                  0
9229#define RS_Start                                 1
9230   uint32_t                             MICommandOpcode;
9231   uint32_t                             CommandType;
9232};
9233
9234static inline void
9235GEN9_MI_RS_CONTROL_pack(__attribute__((unused)) __gen_user_data *data,
9236                        __attribute__((unused)) void * restrict dst,
9237                        __attribute__((unused)) const struct GEN9_MI_RS_CONTROL * restrict values)
9238{
9239   uint32_t * restrict dw = (uint32_t * restrict) dst;
9240
9241   dw[0] =
9242      __gen_uint(values->ResourceStreamerControl, 0, 0) |
9243      __gen_uint(values->MICommandOpcode, 23, 28) |
9244      __gen_uint(values->CommandType, 29, 31);
9245}
9246
9247#define GEN9_MI_RS_STORE_DATA_IMM_length       4
9248#define GEN9_MI_RS_STORE_DATA_IMM_length_bias      2
9249#define GEN9_MI_RS_STORE_DATA_IMM_header        \
9250   .DWordLength                         =      2,  \
9251   .MICommandOpcode                     =     43,  \
9252   .CommandType                         =      0
9253
9254struct GEN9_MI_RS_STORE_DATA_IMM {
9255   uint32_t                             DWordLength;
9256   uint32_t                             MICommandOpcode;
9257   uint32_t                             CommandType;
9258   uint32_t                             CoreModeEnable;
9259   __gen_address_type                   DestinationAddress;
9260   uint32_t                             DataDWord0;
9261};
9262
9263static inline void
9264GEN9_MI_RS_STORE_DATA_IMM_pack(__attribute__((unused)) __gen_user_data *data,
9265                               __attribute__((unused)) void * restrict dst,
9266                               __attribute__((unused)) const struct GEN9_MI_RS_STORE_DATA_IMM * restrict values)
9267{
9268   uint32_t * restrict dw = (uint32_t * restrict) dst;
9269
9270   dw[0] =
9271      __gen_uint(values->DWordLength, 0, 7) |
9272      __gen_uint(values->MICommandOpcode, 23, 28) |
9273      __gen_uint(values->CommandType, 29, 31);
9274
9275   const uint64_t v1 =
9276      __gen_uint(values->CoreModeEnable, 0, 0);
9277   const uint64_t v1_address =
9278      __gen_combine_address(data, &dw[1], values->DestinationAddress, v1);
9279   dw[1] = v1_address;
9280   dw[2] = (v1_address >> 32) | (v1 >> 32);
9281
9282   dw[3] =
9283      __gen_uint(values->DataDWord0, 0, 31);
9284}
9285
9286#define GEN9_MI_SEMAPHORE_SIGNAL_length        2
9287#define GEN9_MI_SEMAPHORE_SIGNAL_length_bias      2
9288#define GEN9_MI_SEMAPHORE_SIGNAL_header         \
9289   .DWordLength                         =      0,  \
9290   .MICommandOpcode                     =     27,  \
9291   .CommandType                         =      0
9292
9293struct GEN9_MI_SEMAPHORE_SIGNAL {
9294   uint32_t                             DWordLength;
9295   uint32_t                             TargetEngineSelect;
9296#define RCS                                      0
9297#define VCS0                                     1
9298#define BCS                                      2
9299#define VECS                                     3
9300#define VCS1                                     4
9301   bool                                 PostSyncOperation;
9302   uint32_t                             MICommandOpcode;
9303   uint32_t                             CommandType;
9304   uint32_t                             TargetContextID;
9305};
9306
9307static inline void
9308GEN9_MI_SEMAPHORE_SIGNAL_pack(__attribute__((unused)) __gen_user_data *data,
9309                              __attribute__((unused)) void * restrict dst,
9310                              __attribute__((unused)) const struct GEN9_MI_SEMAPHORE_SIGNAL * restrict values)
9311{
9312   uint32_t * restrict dw = (uint32_t * restrict) dst;
9313
9314   dw[0] =
9315      __gen_uint(values->DWordLength, 0, 7) |
9316      __gen_uint(values->TargetEngineSelect, 15, 17) |
9317      __gen_uint(values->PostSyncOperation, 21, 21) |
9318      __gen_uint(values->MICommandOpcode, 23, 28) |
9319      __gen_uint(values->CommandType, 29, 31);
9320
9321   dw[1] =
9322      __gen_uint(values->TargetContextID, 0, 31);
9323}
9324
9325#define GEN9_MI_SEMAPHORE_WAIT_length          4
9326#define GEN9_MI_SEMAPHORE_WAIT_length_bias      2
9327#define GEN9_MI_SEMAPHORE_WAIT_header           \
9328   .DWordLength                         =      2,  \
9329   .MICommandOpcode                     =     28,  \
9330   .CommandType                         =      0
9331
9332struct GEN9_MI_SEMAPHORE_WAIT {
9333   uint32_t                             DWordLength;
9334   uint32_t                             CompareOperation;
9335#define COMPARE_SAD_GREATER_THAN_SDD             0
9336#define COMPARE_SAD_GREATER_THAN_OR_EQUAL_SDD    1
9337#define COMPARE_SAD_LESS_THAN_SDD                2
9338#define COMPARE_SAD_LESS_THAN_OR_EQUAL_SDD       3
9339#define COMPARE_SAD_EQUAL_SDD                    4
9340#define COMPARE_SAD_NOT_EQUAL_SDD                5
9341   uint32_t                             WaitMode;
9342#define PollingMode                              1
9343#define SignalMode                               0
9344   bool                                 RegisterPollMode;
9345   uint32_t                             MemoryType;
9346#define PerProcessGraphicsAddress                0
9347#define GlobalGraphicsAddress                    1
9348   uint32_t                             MICommandOpcode;
9349   uint32_t                             CommandType;
9350   uint32_t                             SemaphoreDataDword;
9351   __gen_address_type                   SemaphoreAddress;
9352};
9353
9354static inline void
9355GEN9_MI_SEMAPHORE_WAIT_pack(__attribute__((unused)) __gen_user_data *data,
9356                            __attribute__((unused)) void * restrict dst,
9357                            __attribute__((unused)) const struct GEN9_MI_SEMAPHORE_WAIT * restrict values)
9358{
9359   uint32_t * restrict dw = (uint32_t * restrict) dst;
9360
9361   dw[0] =
9362      __gen_uint(values->DWordLength, 0, 7) |
9363      __gen_uint(values->CompareOperation, 12, 14) |
9364      __gen_uint(values->WaitMode, 15, 15) |
9365      __gen_uint(values->RegisterPollMode, 16, 16) |
9366      __gen_uint(values->MemoryType, 22, 22) |
9367      __gen_uint(values->MICommandOpcode, 23, 28) |
9368      __gen_uint(values->CommandType, 29, 31);
9369
9370   dw[1] =
9371      __gen_uint(values->SemaphoreDataDword, 0, 31);
9372
9373   const uint64_t v2_address =
9374      __gen_combine_address(data, &dw[2], values->SemaphoreAddress, 0);
9375   dw[2] = v2_address;
9376   dw[3] = v2_address >> 32;
9377}
9378
9379#define GEN9_MI_SET_CONTEXT_length             2
9380#define GEN9_MI_SET_CONTEXT_length_bias        2
9381#define GEN9_MI_SET_CONTEXT_header              \
9382   .DWordLength                         =      0,  \
9383   .MICommandOpcode                     =     24,  \
9384   .CommandType                         =      0
9385
9386struct GEN9_MI_SET_CONTEXT {
9387   uint32_t                             DWordLength;
9388   uint32_t                             MICommandOpcode;
9389   uint32_t                             CommandType;
9390   uint32_t                             RestoreInhibit;
9391   uint32_t                             ForceRestore;
9392   bool                                 ResourceStreamerStateRestoreEnable;
9393   bool                                 ResourceStreamerStateSaveEnable;
9394   bool                                 CoreModeEnable;
9395   uint32_t                             ReservedMustbe1;
9396   __gen_address_type                   LogicalContextAddress;
9397};
9398
9399static inline void
9400GEN9_MI_SET_CONTEXT_pack(__attribute__((unused)) __gen_user_data *data,
9401                         __attribute__((unused)) void * restrict dst,
9402                         __attribute__((unused)) const struct GEN9_MI_SET_CONTEXT * restrict values)
9403{
9404   uint32_t * restrict dw = (uint32_t * restrict) dst;
9405
9406   dw[0] =
9407      __gen_uint(values->DWordLength, 0, 7) |
9408      __gen_uint(values->MICommandOpcode, 23, 28) |
9409      __gen_uint(values->CommandType, 29, 31);
9410
9411   const uint32_t v1 =
9412      __gen_uint(values->RestoreInhibit, 0, 0) |
9413      __gen_uint(values->ForceRestore, 1, 1) |
9414      __gen_uint(values->ResourceStreamerStateRestoreEnable, 2, 2) |
9415      __gen_uint(values->ResourceStreamerStateSaveEnable, 3, 3) |
9416      __gen_uint(values->CoreModeEnable, 4, 4) |
9417      __gen_uint(values->ReservedMustbe1, 8, 8);
9418   dw[1] = __gen_combine_address(data, &dw[1], values->LogicalContextAddress, v1);
9419}
9420
9421#define GEN9_MI_SET_PREDICATE_length           1
9422#define GEN9_MI_SET_PREDICATE_length_bias      1
9423#define GEN9_MI_SET_PREDICATE_header            \
9424   .MICommandOpcode                     =      1,  \
9425   .CommandType                         =      0
9426
9427struct GEN9_MI_SET_PREDICATE {
9428   uint32_t                             PREDICATEENABLE;
9429#define NOOPNever                                0
9430#define NOOPonResult2clear                       1
9431#define NOOPonResult2set                         2
9432#define NOOPonResultclear                        3
9433#define NOOPonResultset                          4
9434#define Executewhenonesliceenabled               5
9435#define Executewhentwoslicesareenabled           6
9436#define Executewhenthreeslicesareenabled         7
9437#define NOOPAlways                               15
9438   uint32_t                             MICommandOpcode;
9439   uint32_t                             CommandType;
9440};
9441
9442static inline void
9443GEN9_MI_SET_PREDICATE_pack(__attribute__((unused)) __gen_user_data *data,
9444                           __attribute__((unused)) void * restrict dst,
9445                           __attribute__((unused)) const struct GEN9_MI_SET_PREDICATE * restrict values)
9446{
9447   uint32_t * restrict dw = (uint32_t * restrict) dst;
9448
9449   dw[0] =
9450      __gen_uint(values->PREDICATEENABLE, 0, 3) |
9451      __gen_uint(values->MICommandOpcode, 23, 28) |
9452      __gen_uint(values->CommandType, 29, 31);
9453}
9454
9455#define GEN9_MI_STORE_DATA_IMM_length          4
9456#define GEN9_MI_STORE_DATA_IMM_length_bias      2
9457#define GEN9_MI_STORE_DATA_IMM_header           \
9458   .DWordLength                         =      2,  \
9459   .MICommandOpcode                     =     32,  \
9460   .CommandType                         =      0
9461
9462struct GEN9_MI_STORE_DATA_IMM {
9463   uint32_t                             DWordLength;
9464   uint32_t                             StoreQword;
9465   bool                                 UseGlobalGTT;
9466   uint32_t                             MICommandOpcode;
9467   uint32_t                             CommandType;
9468   uint32_t                             CoreModeEnable;
9469   __gen_address_type                   Address;
9470   uint64_t                             ImmediateData;
9471};
9472
9473static inline void
9474GEN9_MI_STORE_DATA_IMM_pack(__attribute__((unused)) __gen_user_data *data,
9475                            __attribute__((unused)) void * restrict dst,
9476                            __attribute__((unused)) const struct GEN9_MI_STORE_DATA_IMM * restrict values)
9477{
9478   uint32_t * restrict dw = (uint32_t * restrict) dst;
9479
9480   dw[0] =
9481      __gen_uint(values->DWordLength, 0, 9) |
9482      __gen_uint(values->StoreQword, 21, 21) |
9483      __gen_uint(values->UseGlobalGTT, 22, 22) |
9484      __gen_uint(values->MICommandOpcode, 23, 28) |
9485      __gen_uint(values->CommandType, 29, 31);
9486
9487   const uint64_t v1 =
9488      __gen_uint(values->CoreModeEnable, 0, 0);
9489   const uint64_t v1_address =
9490      __gen_combine_address(data, &dw[1], values->Address, v1);
9491   dw[1] = v1_address;
9492   dw[2] = (v1_address >> 32) | (v1 >> 32);
9493
9494   const uint64_t v3 =
9495      __gen_uint(values->ImmediateData, 0, 63);
9496   dw[3] = v3;
9497   dw[4] = v3 >> 32;
9498}
9499
9500#define GEN9_MI_STORE_DATA_INDEX_length        3
9501#define GEN9_MI_STORE_DATA_INDEX_length_bias      2
9502#define GEN9_MI_STORE_DATA_INDEX_header         \
9503   .DWordLength                         =      1,  \
9504   .MICommandOpcode                     =     33,  \
9505   .CommandType                         =      0
9506
9507struct GEN9_MI_STORE_DATA_INDEX {
9508   uint32_t                             DWordLength;
9509   uint32_t                             UsePerProcessHardwareStatusPage;
9510   uint32_t                             MICommandOpcode;
9511   uint32_t                             CommandType;
9512   uint32_t                             Offset;
9513   uint32_t                             DataDWord0;
9514   uint32_t                             DataDWord1;
9515};
9516
9517static inline void
9518GEN9_MI_STORE_DATA_INDEX_pack(__attribute__((unused)) __gen_user_data *data,
9519                              __attribute__((unused)) void * restrict dst,
9520                              __attribute__((unused)) const struct GEN9_MI_STORE_DATA_INDEX * restrict values)
9521{
9522   uint32_t * restrict dw = (uint32_t * restrict) dst;
9523
9524   dw[0] =
9525      __gen_uint(values->DWordLength, 0, 7) |
9526      __gen_uint(values->UsePerProcessHardwareStatusPage, 21, 21) |
9527      __gen_uint(values->MICommandOpcode, 23, 28) |
9528      __gen_uint(values->CommandType, 29, 31);
9529
9530   dw[1] =
9531      __gen_uint(values->Offset, 2, 11);
9532
9533   dw[2] =
9534      __gen_uint(values->DataDWord0, 0, 31);
9535}
9536
9537#define GEN9_MI_STORE_REGISTER_MEM_length      4
9538#define GEN9_MI_STORE_REGISTER_MEM_length_bias      2
9539#define GEN9_MI_STORE_REGISTER_MEM_header       \
9540   .DWordLength                         =      2,  \
9541   .MICommandOpcode                     =     36,  \
9542   .CommandType                         =      0
9543
9544struct GEN9_MI_STORE_REGISTER_MEM {
9545   uint32_t                             DWordLength;
9546   bool                                 PredicateEnable;
9547   bool                                 UseGlobalGTT;
9548   uint32_t                             MICommandOpcode;
9549   uint32_t                             CommandType;
9550   uint64_t                             RegisterAddress;
9551   __gen_address_type                   MemoryAddress;
9552};
9553
9554static inline void
9555GEN9_MI_STORE_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
9556                                __attribute__((unused)) void * restrict dst,
9557                                __attribute__((unused)) const struct GEN9_MI_STORE_REGISTER_MEM * restrict values)
9558{
9559   uint32_t * restrict dw = (uint32_t * restrict) dst;
9560
9561   dw[0] =
9562      __gen_uint(values->DWordLength, 0, 7) |
9563      __gen_uint(values->PredicateEnable, 21, 21) |
9564      __gen_uint(values->UseGlobalGTT, 22, 22) |
9565      __gen_uint(values->MICommandOpcode, 23, 28) |
9566      __gen_uint(values->CommandType, 29, 31);
9567
9568   dw[1] =
9569      __gen_offset(values->RegisterAddress, 2, 22);
9570
9571   const uint64_t v2_address =
9572      __gen_combine_address(data, &dw[2], values->MemoryAddress, 0);
9573   dw[2] = v2_address;
9574   dw[3] = v2_address >> 32;
9575}
9576
9577#define GEN9_MI_STORE_URB_MEM_length           4
9578#define GEN9_MI_STORE_URB_MEM_length_bias      2
9579#define GEN9_MI_STORE_URB_MEM_header            \
9580   .DWordLength                         =      2,  \
9581   .MICommandOpcode                     =     45,  \
9582   .CommandType                         =      0
9583
9584struct GEN9_MI_STORE_URB_MEM {
9585   uint32_t                             DWordLength;
9586   uint32_t                             MICommandOpcode;
9587   uint32_t                             CommandType;
9588   uint32_t                             URBAddress;
9589   __gen_address_type                   MemoryAddress;
9590};
9591
9592static inline void
9593GEN9_MI_STORE_URB_MEM_pack(__attribute__((unused)) __gen_user_data *data,
9594                           __attribute__((unused)) void * restrict dst,
9595                           __attribute__((unused)) const struct GEN9_MI_STORE_URB_MEM * restrict values)
9596{
9597   uint32_t * restrict dw = (uint32_t * restrict) dst;
9598
9599   dw[0] =
9600      __gen_uint(values->DWordLength, 0, 7) |
9601      __gen_uint(values->MICommandOpcode, 23, 28) |
9602      __gen_uint(values->CommandType, 29, 31);
9603
9604   dw[1] =
9605      __gen_uint(values->URBAddress, 2, 14);
9606
9607   const uint64_t v2_address =
9608      __gen_combine_address(data, &dw[2], values->MemoryAddress, 0);
9609   dw[2] = v2_address;
9610   dw[3] = v2_address >> 32;
9611}
9612
9613#define GEN9_MI_SUSPEND_FLUSH_length           1
9614#define GEN9_MI_SUSPEND_FLUSH_length_bias      1
9615#define GEN9_MI_SUSPEND_FLUSH_header            \
9616   .MICommandOpcode                     =     11,  \
9617   .CommandType                         =      0
9618
9619struct GEN9_MI_SUSPEND_FLUSH {
9620   bool                                 SuspendFlush;
9621   uint32_t                             MICommandOpcode;
9622   uint32_t                             CommandType;
9623};
9624
9625static inline void
9626GEN9_MI_SUSPEND_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
9627                           __attribute__((unused)) void * restrict dst,
9628                           __attribute__((unused)) const struct GEN9_MI_SUSPEND_FLUSH * restrict values)
9629{
9630   uint32_t * restrict dw = (uint32_t * restrict) dst;
9631
9632   dw[0] =
9633      __gen_uint(values->SuspendFlush, 0, 0) |
9634      __gen_uint(values->MICommandOpcode, 23, 28) |
9635      __gen_uint(values->CommandType, 29, 31);
9636}
9637
9638#define GEN9_MI_TOPOLOGY_FILTER_length         1
9639#define GEN9_MI_TOPOLOGY_FILTER_length_bias      1
9640#define GEN9_MI_TOPOLOGY_FILTER_header          \
9641   .MICommandOpcode                     =     13,  \
9642   .CommandType                         =      0
9643
9644struct GEN9_MI_TOPOLOGY_FILTER {
9645   enum GEN9_3D_Prim_Topo_Type          TopologyFilterValue;
9646   uint32_t                             MICommandOpcode;
9647   uint32_t                             CommandType;
9648};
9649
9650static inline void
9651GEN9_MI_TOPOLOGY_FILTER_pack(__attribute__((unused)) __gen_user_data *data,
9652                             __attribute__((unused)) void * restrict dst,
9653                             __attribute__((unused)) const struct GEN9_MI_TOPOLOGY_FILTER * restrict values)
9654{
9655   uint32_t * restrict dw = (uint32_t * restrict) dst;
9656
9657   dw[0] =
9658      __gen_uint(values->TopologyFilterValue, 0, 5) |
9659      __gen_uint(values->MICommandOpcode, 23, 28) |
9660      __gen_uint(values->CommandType, 29, 31);
9661}
9662
9663#define GEN9_MI_URB_ATOMIC_ALLOC_length        1
9664#define GEN9_MI_URB_ATOMIC_ALLOC_length_bias      1
9665#define GEN9_MI_URB_ATOMIC_ALLOC_header         \
9666   .MICommandOpcode                     =      9,  \
9667   .CommandType                         =      0
9668
9669struct GEN9_MI_URB_ATOMIC_ALLOC {
9670   uint32_t                             URBAtomicStorageSize;
9671   uint32_t                             URBAtomicStorageOffset;
9672   uint32_t                             MICommandOpcode;
9673   uint32_t                             CommandType;
9674};
9675
9676static inline void
9677GEN9_MI_URB_ATOMIC_ALLOC_pack(__attribute__((unused)) __gen_user_data *data,
9678                              __attribute__((unused)) void * restrict dst,
9679                              __attribute__((unused)) const struct GEN9_MI_URB_ATOMIC_ALLOC * restrict values)
9680{
9681   uint32_t * restrict dw = (uint32_t * restrict) dst;
9682
9683   dw[0] =
9684      __gen_uint(values->URBAtomicStorageSize, 0, 8) |
9685      __gen_uint(values->URBAtomicStorageOffset, 12, 19) |
9686      __gen_uint(values->MICommandOpcode, 23, 28) |
9687      __gen_uint(values->CommandType, 29, 31);
9688}
9689
9690#define GEN9_MI_USER_INTERRUPT_length          1
9691#define GEN9_MI_USER_INTERRUPT_length_bias      1
9692#define GEN9_MI_USER_INTERRUPT_header           \
9693   .MICommandOpcode                     =      2,  \
9694   .CommandType                         =      0
9695
9696struct GEN9_MI_USER_INTERRUPT {
9697   uint32_t                             MICommandOpcode;
9698   uint32_t                             CommandType;
9699};
9700
9701static inline void
9702GEN9_MI_USER_INTERRUPT_pack(__attribute__((unused)) __gen_user_data *data,
9703                            __attribute__((unused)) void * restrict dst,
9704                            __attribute__((unused)) const struct GEN9_MI_USER_INTERRUPT * restrict values)
9705{
9706   uint32_t * restrict dw = (uint32_t * restrict) dst;
9707
9708   dw[0] =
9709      __gen_uint(values->MICommandOpcode, 23, 28) |
9710      __gen_uint(values->CommandType, 29, 31);
9711}
9712
9713#define GEN9_MI_WAIT_FOR_EVENT_length          1
9714#define GEN9_MI_WAIT_FOR_EVENT_length_bias      1
9715#define GEN9_MI_WAIT_FOR_EVENT_header           \
9716   .MICommandOpcode                     =      3,  \
9717   .CommandType                         =      0
9718
9719struct GEN9_MI_WAIT_FOR_EVENT {
9720   bool                                 DisplayPlnae1AScanLineWaitEnable;
9721   bool                                 DisplayPlane1FlipPendingWaitEnable;
9722   bool                                 DisplayPlane4FlipPendingWaitEnable;
9723   bool                                 DisplayPlane1AVerticalBlankWaitEnable;
9724   bool                                 DisplayPlane7FlipPendingWaitEnable;
9725   bool                                 DisplayPlane8FlipPendingWaitEnable;
9726   bool                                 DisplayPlane1BScanLineWaitEnable;
9727   bool                                 DisplayPlane2FlipPendingWaitEnable;
9728   bool                                 DisplayPlane5FlipPendingWaitEnable;
9729   bool                                 DisplayPlane1BVerticalBlankWaitEnable;
9730   bool                                 DisplayPlane1CScanLineWaitEnable;
9731   bool                                 DisplayPlane3FlipPendingWaitEnable;
9732   bool                                 DisplayPlane9FlipPendingWaitEnable;
9733   bool                                 DisplayPlane10FlipPendingWaitEnable;
9734   bool                                 DisplayPlane11FlipPendingWaitEnable;
9735   bool                                 DisplayPlane12FlipPendingWaitEnable;
9736   bool                                 DisplayPlane6FlipPendingWaitEnable;
9737   bool                                 DisplayPlane1CVerticalBlankWaitEnable;
9738   uint32_t                             MICommandOpcode;
9739   uint32_t                             CommandType;
9740};
9741
9742static inline void
9743GEN9_MI_WAIT_FOR_EVENT_pack(__attribute__((unused)) __gen_user_data *data,
9744                            __attribute__((unused)) void * restrict dst,
9745                            __attribute__((unused)) const struct GEN9_MI_WAIT_FOR_EVENT * restrict values)
9746{
9747   uint32_t * restrict dw = (uint32_t * restrict) dst;
9748
9749   dw[0] =
9750      __gen_uint(values->DisplayPlnae1AScanLineWaitEnable, 0, 0) |
9751      __gen_uint(values->DisplayPlane1FlipPendingWaitEnable, 1, 1) |
9752      __gen_uint(values->DisplayPlane4FlipPendingWaitEnable, 2, 2) |
9753      __gen_uint(values->DisplayPlane1AVerticalBlankWaitEnable, 3, 3) |
9754      __gen_uint(values->DisplayPlane7FlipPendingWaitEnable, 6, 6) |
9755      __gen_uint(values->DisplayPlane8FlipPendingWaitEnable, 7, 7) |
9756      __gen_uint(values->DisplayPlane1BScanLineWaitEnable, 8, 8) |
9757      __gen_uint(values->DisplayPlane2FlipPendingWaitEnable, 9, 9) |
9758      __gen_uint(values->DisplayPlane5FlipPendingWaitEnable, 10, 10) |
9759      __gen_uint(values->DisplayPlane1BVerticalBlankWaitEnable, 11, 11) |
9760      __gen_uint(values->DisplayPlane1CScanLineWaitEnable, 14, 14) |
9761      __gen_uint(values->DisplayPlane3FlipPendingWaitEnable, 15, 15) |
9762      __gen_uint(values->DisplayPlane9FlipPendingWaitEnable, 16, 16) |
9763      __gen_uint(values->DisplayPlane10FlipPendingWaitEnable, 17, 17) |
9764      __gen_uint(values->DisplayPlane11FlipPendingWaitEnable, 18, 18) |
9765      __gen_uint(values->DisplayPlane12FlipPendingWaitEnable, 19, 19) |
9766      __gen_uint(values->DisplayPlane6FlipPendingWaitEnable, 20, 20) |
9767      __gen_uint(values->DisplayPlane1CVerticalBlankWaitEnable, 21, 21) |
9768      __gen_uint(values->MICommandOpcode, 23, 28) |
9769      __gen_uint(values->CommandType, 29, 31);
9770}
9771
9772#define GEN9_PIPELINE_SELECT_length            1
9773#define GEN9_PIPELINE_SELECT_length_bias       1
9774#define GEN9_PIPELINE_SELECT_header             \
9775   ._3DCommandSubOpcode                 =      4,  \
9776   ._3DCommandOpcode                    =      1,  \
9777   .CommandSubType                      =      1,  \
9778   .CommandType                         =      3
9779
9780struct GEN9_PIPELINE_SELECT {
9781   uint32_t                             PipelineSelection;
9782#define _3D                                      0
9783#define Media                                    1
9784#define GPGPU                                    2
9785   bool                                 MediaSamplerDOPClockGateEnable;
9786   bool                                 ForceMediaAwake;
9787   uint32_t                             MaskBits;
9788   uint32_t                             _3DCommandSubOpcode;
9789   uint32_t                             _3DCommandOpcode;
9790   uint32_t                             CommandSubType;
9791   uint32_t                             CommandType;
9792};
9793
9794static inline void
9795GEN9_PIPELINE_SELECT_pack(__attribute__((unused)) __gen_user_data *data,
9796                          __attribute__((unused)) void * restrict dst,
9797                          __attribute__((unused)) const struct GEN9_PIPELINE_SELECT * restrict values)
9798{
9799   uint32_t * restrict dw = (uint32_t * restrict) dst;
9800
9801   dw[0] =
9802      __gen_uint(values->PipelineSelection, 0, 1) |
9803      __gen_uint(values->MediaSamplerDOPClockGateEnable, 4, 4) |
9804      __gen_uint(values->ForceMediaAwake, 5, 5) |
9805      __gen_uint(values->MaskBits, 8, 15) |
9806      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
9807      __gen_uint(values->_3DCommandOpcode, 24, 26) |
9808      __gen_uint(values->CommandSubType, 27, 28) |
9809      __gen_uint(values->CommandType, 29, 31);
9810}
9811
9812#define GEN9_PIPE_CONTROL_length               6
9813#define GEN9_PIPE_CONTROL_length_bias          2
9814#define GEN9_PIPE_CONTROL_header                \
9815   .DWordLength                         =      4,  \
9816   ._3DCommandSubOpcode                 =      0,  \
9817   ._3DCommandOpcode                    =      2,  \
9818   .CommandSubType                      =      3,  \
9819   .CommandType                         =      3
9820
9821struct GEN9_PIPE_CONTROL {
9822   uint32_t                             DWordLength;
9823   uint32_t                             _3DCommandSubOpcode;
9824   uint32_t                             _3DCommandOpcode;
9825   uint32_t                             CommandSubType;
9826   uint32_t                             CommandType;
9827   bool                                 DepthCacheFlushEnable;
9828   bool                                 StallAtPixelScoreboard;
9829   bool                                 StateCacheInvalidationEnable;
9830   bool                                 ConstantCacheInvalidationEnable;
9831   bool                                 VFCacheInvalidationEnable;
9832   bool                                 DCFlushEnable;
9833   bool                                 PipeControlFlushEnable;
9834   bool                                 NotifyEnable;
9835   bool                                 IndirectStatePointersDisable;
9836   bool                                 TextureCacheInvalidationEnable;
9837   bool                                 InstructionCacheInvalidateEnable;
9838   bool                                 RenderTargetCacheFlushEnable;
9839   bool                                 DepthStallEnable;
9840   uint32_t                             PostSyncOperation;
9841#define NoWrite                                  0
9842#define WriteImmediateData                       1
9843#define WritePSDepthCount                        2
9844#define WriteTimestamp                           3
9845   bool                                 GenericMediaStateClear;
9846   bool                                 TLBInvalidate;
9847   bool                                 GlobalSnapshotCountReset;
9848   bool                                 CommandStreamerStallEnable;
9849   uint32_t                             StoreDataIndex;
9850   uint32_t                             LRIPostSyncOperation;
9851#define NoLRIOperation                           0
9852#define MMIOWriteImmediateData                   1
9853   uint32_t                             DestinationAddressType;
9854#define DAT_PPGTT                                0
9855#define DAT_GGTT                                 1
9856   bool                                 FlushLLC;
9857   __gen_address_type                   Address;
9858   uint64_t                             ImmediateData;
9859};
9860
9861static inline void
9862GEN9_PIPE_CONTROL_pack(__attribute__((unused)) __gen_user_data *data,
9863                       __attribute__((unused)) void * restrict dst,
9864                       __attribute__((unused)) const struct GEN9_PIPE_CONTROL * restrict values)
9865{
9866   uint32_t * restrict dw = (uint32_t * restrict) dst;
9867
9868   dw[0] =
9869      __gen_uint(values->DWordLength, 0, 7) |
9870      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
9871      __gen_uint(values->_3DCommandOpcode, 24, 26) |
9872      __gen_uint(values->CommandSubType, 27, 28) |
9873      __gen_uint(values->CommandType, 29, 31);
9874
9875   dw[1] =
9876      __gen_uint(values->DepthCacheFlushEnable, 0, 0) |
9877      __gen_uint(values->StallAtPixelScoreboard, 1, 1) |
9878      __gen_uint(values->StateCacheInvalidationEnable, 2, 2) |
9879      __gen_uint(values->ConstantCacheInvalidationEnable, 3, 3) |
9880      __gen_uint(values->VFCacheInvalidationEnable, 4, 4) |
9881      __gen_uint(values->DCFlushEnable, 5, 5) |
9882      __gen_uint(values->PipeControlFlushEnable, 7, 7) |
9883      __gen_uint(values->NotifyEnable, 8, 8) |
9884      __gen_uint(values->IndirectStatePointersDisable, 9, 9) |
9885      __gen_uint(values->TextureCacheInvalidationEnable, 10, 10) |
9886      __gen_uint(values->InstructionCacheInvalidateEnable, 11, 11) |
9887      __gen_uint(values->RenderTargetCacheFlushEnable, 12, 12) |
9888      __gen_uint(values->DepthStallEnable, 13, 13) |
9889      __gen_uint(values->PostSyncOperation, 14, 15) |
9890      __gen_uint(values->GenericMediaStateClear, 16, 16) |
9891      __gen_uint(values->TLBInvalidate, 18, 18) |
9892      __gen_uint(values->GlobalSnapshotCountReset, 19, 19) |
9893      __gen_uint(values->CommandStreamerStallEnable, 20, 20) |
9894      __gen_uint(values->StoreDataIndex, 21, 21) |
9895      __gen_uint(values->LRIPostSyncOperation, 23, 23) |
9896      __gen_uint(values->DestinationAddressType, 24, 24) |
9897      __gen_uint(values->FlushLLC, 26, 26);
9898
9899   const uint64_t v2_address =
9900      __gen_combine_address(data, &dw[2], values->Address, 0);
9901   dw[2] = v2_address;
9902   dw[3] = v2_address >> 32;
9903
9904   const uint64_t v4 =
9905      __gen_uint(values->ImmediateData, 0, 63);
9906   dw[4] = v4;
9907   dw[5] = v4 >> 32;
9908}
9909
9910#define GEN9_STATE_BASE_ADDRESS_length        19
9911#define GEN9_STATE_BASE_ADDRESS_length_bias      2
9912#define GEN9_STATE_BASE_ADDRESS_header          \
9913   .DWordLength                         =     17,  \
9914   ._3DCommandSubOpcode                 =      1,  \
9915   ._3DCommandOpcode                    =      1,  \
9916   .CommandSubType                      =      0,  \
9917   .CommandType                         =      3
9918
9919struct GEN9_STATE_BASE_ADDRESS {
9920   uint32_t                             DWordLength;
9921   uint32_t                             _3DCommandSubOpcode;
9922   uint32_t                             _3DCommandOpcode;
9923   uint32_t                             CommandSubType;
9924   uint32_t                             CommandType;
9925   bool                                 GeneralStateBaseAddressModifyEnable;
9926   uint32_t                             GeneralStateMOCS;
9927   __gen_address_type                   GeneralStateBaseAddress;
9928   uint32_t                             StatelessDataPortAccessMOCS;
9929   bool                                 SurfaceStateBaseAddressModifyEnable;
9930   uint32_t                             SurfaceStateMOCS;
9931   __gen_address_type                   SurfaceStateBaseAddress;
9932   bool                                 DynamicStateBaseAddressModifyEnable;
9933   uint32_t                             DynamicStateMOCS;
9934   __gen_address_type                   DynamicStateBaseAddress;
9935   bool                                 IndirectObjectBaseAddressModifyEnable;
9936   uint32_t                             IndirectObjectMOCS;
9937   __gen_address_type                   IndirectObjectBaseAddress;
9938   bool                                 InstructionBaseAddressModifyEnable;
9939   uint32_t                             InstructionMOCS;
9940   __gen_address_type                   InstructionBaseAddress;
9941   bool                                 GeneralStateBufferSizeModifyEnable;
9942   uint32_t                             GeneralStateBufferSize;
9943   bool                                 DynamicStateBufferSizeModifyEnable;
9944   uint32_t                             DynamicStateBufferSize;
9945   bool                                 IndirectObjectBufferSizeModifyEnable;
9946   uint32_t                             IndirectObjectBufferSize;
9947   bool                                 InstructionBuffersizeModifyEnable;
9948   uint32_t                             InstructionBufferSize;
9949   bool                                 BindlessSurfaceStateBaseAddressModifyEnable;
9950   uint32_t                             BindlessSurfaceStateMOCS;
9951   __gen_address_type                   BindlessSurfaceStateBaseAddress;
9952   uint32_t                             BindlessSurfaceStateSize;
9953};
9954
9955static inline void
9956GEN9_STATE_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
9957                             __attribute__((unused)) void * restrict dst,
9958                             __attribute__((unused)) const struct GEN9_STATE_BASE_ADDRESS * restrict values)
9959{
9960   uint32_t * restrict dw = (uint32_t * restrict) dst;
9961
9962   dw[0] =
9963      __gen_uint(values->DWordLength, 0, 7) |
9964      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
9965      __gen_uint(values->_3DCommandOpcode, 24, 26) |
9966      __gen_uint(values->CommandSubType, 27, 28) |
9967      __gen_uint(values->CommandType, 29, 31);
9968
9969   const uint64_t v1 =
9970      __gen_uint(values->GeneralStateBaseAddressModifyEnable, 0, 0) |
9971      __gen_uint(values->GeneralStateMOCS, 4, 10);
9972   const uint64_t v1_address =
9973      __gen_combine_address(data, &dw[1], values->GeneralStateBaseAddress, v1);
9974   dw[1] = v1_address;
9975   dw[2] = (v1_address >> 32) | (v1 >> 32);
9976
9977   dw[3] =
9978      __gen_uint(values->StatelessDataPortAccessMOCS, 16, 22);
9979
9980   const uint64_t v4 =
9981      __gen_uint(values->SurfaceStateBaseAddressModifyEnable, 0, 0) |
9982      __gen_uint(values->SurfaceStateMOCS, 4, 10);
9983   const uint64_t v4_address =
9984      __gen_combine_address(data, &dw[4], values->SurfaceStateBaseAddress, v4);
9985   dw[4] = v4_address;
9986   dw[5] = (v4_address >> 32) | (v4 >> 32);
9987
9988   const uint64_t v6 =
9989      __gen_uint(values->DynamicStateBaseAddressModifyEnable, 0, 0) |
9990      __gen_uint(values->DynamicStateMOCS, 4, 10);
9991   const uint64_t v6_address =
9992      __gen_combine_address(data, &dw[6], values->DynamicStateBaseAddress, v6);
9993   dw[6] = v6_address;
9994   dw[7] = (v6_address >> 32) | (v6 >> 32);
9995
9996   const uint64_t v8 =
9997      __gen_uint(values->IndirectObjectBaseAddressModifyEnable, 0, 0) |
9998      __gen_uint(values->IndirectObjectMOCS, 4, 10);
9999   const uint64_t v8_address =
10000      __gen_combine_address(data, &dw[8], values->IndirectObjectBaseAddress, v8);
10001   dw[8] = v8_address;
10002   dw[9] = (v8_address >> 32) | (v8 >> 32);
10003
10004   const uint64_t v10 =
10005      __gen_uint(values->InstructionBaseAddressModifyEnable, 0, 0) |
10006      __gen_uint(values->InstructionMOCS, 4, 10);
10007   const uint64_t v10_address =
10008      __gen_combine_address(data, &dw[10], values->InstructionBaseAddress, v10);
10009   dw[10] = v10_address;
10010   dw[11] = (v10_address >> 32) | (v10 >> 32);
10011
10012   dw[12] =
10013      __gen_uint(values->GeneralStateBufferSizeModifyEnable, 0, 0) |
10014      __gen_uint(values->GeneralStateBufferSize, 12, 31);
10015
10016   dw[13] =
10017      __gen_uint(values->DynamicStateBufferSizeModifyEnable, 0, 0) |
10018      __gen_uint(values->DynamicStateBufferSize, 12, 31);
10019
10020   dw[14] =
10021      __gen_uint(values->IndirectObjectBufferSizeModifyEnable, 0, 0) |
10022      __gen_uint(values->IndirectObjectBufferSize, 12, 31);
10023
10024   dw[15] =
10025      __gen_uint(values->InstructionBuffersizeModifyEnable, 0, 0) |
10026      __gen_uint(values->InstructionBufferSize, 12, 31);
10027
10028   const uint64_t v16 =
10029      __gen_uint(values->BindlessSurfaceStateBaseAddressModifyEnable, 0, 0) |
10030      __gen_uint(values->BindlessSurfaceStateMOCS, 4, 10);
10031   const uint64_t v16_address =
10032      __gen_combine_address(data, &dw[16], values->BindlessSurfaceStateBaseAddress, v16);
10033   dw[16] = v16_address;
10034   dw[17] = (v16_address >> 32) | (v16 >> 32);
10035
10036   dw[18] =
10037      __gen_uint(values->BindlessSurfaceStateSize, 12, 31);
10038}
10039
10040#define GEN9_STATE_PREFETCH_length             2
10041#define GEN9_STATE_PREFETCH_length_bias        2
10042#define GEN9_STATE_PREFETCH_header              \
10043   .DWordLength                         =      0,  \
10044   ._3DCommandSubOpcode                 =      3,  \
10045   ._3DCommandOpcode                    =      0,  \
10046   .CommandSubType                      =      0,  \
10047   .CommandType                         =      3
10048
10049struct GEN9_STATE_PREFETCH {
10050   uint32_t                             DWordLength;
10051   uint32_t                             _3DCommandSubOpcode;
10052   uint32_t                             _3DCommandOpcode;
10053   uint32_t                             CommandSubType;
10054   uint32_t                             CommandType;
10055   uint32_t                             PrefetchCount;
10056   __gen_address_type                   PrefetchPointer;
10057};
10058
10059static inline void
10060GEN9_STATE_PREFETCH_pack(__attribute__((unused)) __gen_user_data *data,
10061                         __attribute__((unused)) void * restrict dst,
10062                         __attribute__((unused)) const struct GEN9_STATE_PREFETCH * restrict values)
10063{
10064   uint32_t * restrict dw = (uint32_t * restrict) dst;
10065
10066   dw[0] =
10067      __gen_uint(values->DWordLength, 0, 7) |
10068      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
10069      __gen_uint(values->_3DCommandOpcode, 24, 26) |
10070      __gen_uint(values->CommandSubType, 27, 28) |
10071      __gen_uint(values->CommandType, 29, 31);
10072
10073   const uint32_t v1 =
10074      __gen_uint(values->PrefetchCount, 0, 2);
10075   dw[1] = __gen_combine_address(data, &dw[1], values->PrefetchPointer, v1);
10076}
10077
10078#define GEN9_STATE_SIP_length                  3
10079#define GEN9_STATE_SIP_length_bias             2
10080#define GEN9_STATE_SIP_header                   \
10081   .DWordLength                         =      1,  \
10082   ._3DCommandSubOpcode                 =      2,  \
10083   ._3DCommandOpcode                    =      1,  \
10084   .CommandSubType                      =      0,  \
10085   .CommandType                         =      3
10086
10087struct GEN9_STATE_SIP {
10088   uint32_t                             DWordLength;
10089   uint32_t                             _3DCommandSubOpcode;
10090   uint32_t                             _3DCommandOpcode;
10091   uint32_t                             CommandSubType;
10092   uint32_t                             CommandType;
10093   uint64_t                             SystemInstructionPointer;
10094};
10095
10096static inline void
10097GEN9_STATE_SIP_pack(__attribute__((unused)) __gen_user_data *data,
10098                    __attribute__((unused)) void * restrict dst,
10099                    __attribute__((unused)) const struct GEN9_STATE_SIP * restrict values)
10100{
10101   uint32_t * restrict dw = (uint32_t * restrict) dst;
10102
10103   dw[0] =
10104      __gen_uint(values->DWordLength, 0, 7) |
10105      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
10106      __gen_uint(values->_3DCommandOpcode, 24, 26) |
10107      __gen_uint(values->CommandSubType, 27, 28) |
10108      __gen_uint(values->CommandType, 29, 31);
10109
10110   const uint64_t v1 =
10111      __gen_offset(values->SystemInstructionPointer, 4, 63);
10112   dw[1] = v1;
10113   dw[2] = v1 >> 32;
10114}
10115
10116#define GEN9_ACTHD_UDW_num                0x205c
10117#define GEN9_ACTHD_UDW_length                  1
10118struct GEN9_ACTHD_UDW {
10119   uint32_t                             HeadPointerUpperDWORD;
10120};
10121
10122static inline void
10123GEN9_ACTHD_UDW_pack(__attribute__((unused)) __gen_user_data *data,
10124                    __attribute__((unused)) void * restrict dst,
10125                    __attribute__((unused)) const struct GEN9_ACTHD_UDW * restrict values)
10126{
10127   uint32_t * restrict dw = (uint32_t * restrict) dst;
10128
10129   dw[0] =
10130      __gen_uint(values->HeadPointerUpperDWORD, 0, 15);
10131}
10132
10133#define GEN9_BCS_ACTHD_UDW_num            0x2205c
10134#define GEN9_BCS_ACTHD_UDW_length              1
10135struct GEN9_BCS_ACTHD_UDW {
10136   uint32_t                             HeadPointerUpperDWORD;
10137};
10138
10139static inline void
10140GEN9_BCS_ACTHD_UDW_pack(__attribute__((unused)) __gen_user_data *data,
10141                        __attribute__((unused)) void * restrict dst,
10142                        __attribute__((unused)) const struct GEN9_BCS_ACTHD_UDW * restrict values)
10143{
10144   uint32_t * restrict dw = (uint32_t * restrict) dst;
10145
10146   dw[0] =
10147      __gen_uint(values->HeadPointerUpperDWORD, 0, 15);
10148}
10149
10150#define GEN9_BCS_INSTDONE_num             0x2206c
10151#define GEN9_BCS_INSTDONE_length               1
10152struct GEN9_BCS_INSTDONE {
10153   bool                                 RingEnable;
10154   bool                                 BlitterIDLE;
10155   bool                                 GABIDLE;
10156   bool                                 BCSDone;
10157};
10158
10159static inline void
10160GEN9_BCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
10161                       __attribute__((unused)) void * restrict dst,
10162                       __attribute__((unused)) const struct GEN9_BCS_INSTDONE * restrict values)
10163{
10164   uint32_t * restrict dw = (uint32_t * restrict) dst;
10165
10166   dw[0] =
10167      __gen_uint(values->RingEnable, 0, 0) |
10168      __gen_uint(values->BlitterIDLE, 1, 1) |
10169      __gen_uint(values->GABIDLE, 2, 2) |
10170      __gen_uint(values->BCSDone, 3, 3);
10171}
10172
10173#define GEN9_BCS_RING_BUFFER_CTL_num      0x2203c
10174#define GEN9_BCS_RING_BUFFER_CTL_length        1
10175struct GEN9_BCS_RING_BUFFER_CTL {
10176   bool                                 RingBufferEnable;
10177   uint32_t                             AutomaticReportHeadPointer;
10178#define MI_AUTOREPORT_OFF                        0
10179#define MI_AUTOREPORT_64KB                       1
10180#define MI_AUTOREPORT_4KB                        2
10181#define MI_AUTOREPORT_128KB                      3
10182   bool                                 DisableRegisterAccesses;
10183   bool                                 SemaphoreWait;
10184   bool                                 RBWait;
10185   uint32_t                             BufferLengthinpages1;
10186};
10187
10188static inline void
10189GEN9_BCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
10190                              __attribute__((unused)) void * restrict dst,
10191                              __attribute__((unused)) const struct GEN9_BCS_RING_BUFFER_CTL * restrict values)
10192{
10193   uint32_t * restrict dw = (uint32_t * restrict) dst;
10194
10195   dw[0] =
10196      __gen_uint(values->RingBufferEnable, 0, 0) |
10197      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
10198      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
10199      __gen_uint(values->SemaphoreWait, 10, 10) |
10200      __gen_uint(values->RBWait, 11, 11) |
10201      __gen_uint(values->BufferLengthinpages1, 12, 20);
10202}
10203
10204#define GEN9_CACHE_MODE_0_num             0x7000
10205#define GEN9_CACHE_MODE_0_length               1
10206struct GEN9_CACHE_MODE_0 {
10207   bool                                 Nulltilefixdisable;
10208   bool                                 Disableclockgatinginthepixelbackend;
10209   bool                                 HierarchicalZRAWStallOptimizationDisable;
10210   bool                                 RCCEvictionPolicy;
10211   bool                                 STCPMAOptimizationEnable;
10212   uint32_t                             SamplerL2RequestArbitration;
10213#define RoundRobin                               0
10214#define FetchareHighestPriority                  1
10215#define ConstantsareHighestPriority              2
10216   bool                                 SamplerL2TLBPrefetchEnable;
10217   bool                                 SamplerSetRemappingfor3DDisable;
10218   uint32_t                             MSAACompressionPlaneNumberThresholdforeLLC;
10219   bool                                 SamplerL2Disable;
10220   bool                                 NulltilefixdisableMask;
10221   bool                                 DisableclockgatinginthepixelbackendMask;
10222   bool                                 HierarchicalZRAWStallOptimizationDisableMask;
10223   bool                                 RCCEvictionPolicyMask;
10224   bool                                 STCPMAOptimizationEnableMask;
10225   uint32_t                             SamplerL2RequestArbitrationMask;
10226   bool                                 SamplerL2TLBPrefetchEnableMask;
10227   bool                                 SamplerSetRemappingfor3DDisableMask;
10228   uint32_t                             MSAACompressionPlaneNumberThresholdforeLLCMask;
10229   bool                                 SamplerL2DisableMask;
10230};
10231
10232static inline void
10233GEN9_CACHE_MODE_0_pack(__attribute__((unused)) __gen_user_data *data,
10234                       __attribute__((unused)) void * restrict dst,
10235                       __attribute__((unused)) const struct GEN9_CACHE_MODE_0 * restrict values)
10236{
10237   uint32_t * restrict dw = (uint32_t * restrict) dst;
10238
10239   dw[0] =
10240      __gen_uint(values->Nulltilefixdisable, 0, 0) |
10241      __gen_uint(values->Disableclockgatinginthepixelbackend, 1, 1) |
10242      __gen_uint(values->HierarchicalZRAWStallOptimizationDisable, 2, 2) |
10243      __gen_uint(values->RCCEvictionPolicy, 4, 4) |
10244      __gen_uint(values->STCPMAOptimizationEnable, 5, 5) |
10245      __gen_uint(values->SamplerL2RequestArbitration, 6, 7) |
10246      __gen_uint(values->SamplerL2TLBPrefetchEnable, 9, 9) |
10247      __gen_uint(values->SamplerSetRemappingfor3DDisable, 11, 11) |
10248      __gen_uint(values->MSAACompressionPlaneNumberThresholdforeLLC, 12, 14) |
10249      __gen_uint(values->SamplerL2Disable, 15, 15) |
10250      __gen_uint(values->NulltilefixdisableMask, 16, 16) |
10251      __gen_uint(values->DisableclockgatinginthepixelbackendMask, 17, 17) |
10252      __gen_uint(values->HierarchicalZRAWStallOptimizationDisableMask, 18, 18) |
10253      __gen_uint(values->RCCEvictionPolicyMask, 20, 20) |
10254      __gen_uint(values->STCPMAOptimizationEnableMask, 21, 21) |
10255      __gen_uint(values->SamplerL2RequestArbitrationMask, 22, 23) |
10256      __gen_uint(values->SamplerL2TLBPrefetchEnableMask, 25, 25) |
10257      __gen_uint(values->SamplerSetRemappingfor3DDisableMask, 27, 27) |
10258      __gen_uint(values->MSAACompressionPlaneNumberThresholdforeLLCMask, 28, 30) |
10259      __gen_uint(values->SamplerL2DisableMask, 31, 31);
10260}
10261
10262#define GEN9_CACHE_MODE_1_num             0x7004
10263#define GEN9_CACHE_MODE_1_length               1
10264struct GEN9_CACHE_MODE_1 {
10265   bool                                 PartialResolveDisableInVC;
10266   bool                                 RCZReadafterexpansioncontrolfix2;
10267   bool                                 DepthReadHitWriteOnlyOptimizationDisable;
10268   bool                                 FloatBlendOptimizationEnable;
10269   bool                                 MCSCacheDisable;
10270   bool                                 _4X4RCPFESTCOptimizationDisable;
10271   uint32_t                             SamplerCacheSetXORselection;
10272   bool                                 MSCRAWHazardAvoidanceBit;
10273   uint32_t                             NPPMAFixEnable;
10274   uint32_t                             HIZEvictionPolicy;
10275   uint32_t                             NPEarlyZFailsDisable;
10276   bool                                 BlendOptimizationFixDisable;
10277   bool                                 ColorCompressionDisable;
10278   bool                                 PartialResolveDisableInVCMask;
10279   bool                                 RCZReadafterexpansioncontrolfix2Mask;
10280   bool                                 DepthReadHitWriteOnlyOptimizationDisableMask;
10281   bool                                 FloatBlendOptimizationEnableMask;
10282   bool                                 MCSCacheDisableMask;
10283   bool                                 _4X4RCPFESTCOptimizationDisableMask;
10284   uint32_t                             SamplerCacheSetXORselectionMask;
10285   bool                                 MSCRAWHazardAvoidanceBitMask;
10286   bool                                 NPPMAFixEnableMask;
10287   bool                                 HIZEvictionPolicyMask;
10288   bool                                 NPEarlyZFailsDisableMask;
10289   bool                                 BlendOptimizationFixDisableMask;
10290   bool                                 ColorCompressionDisableMask;
10291};
10292
10293static inline void
10294GEN9_CACHE_MODE_1_pack(__attribute__((unused)) __gen_user_data *data,
10295                       __attribute__((unused)) void * restrict dst,
10296                       __attribute__((unused)) const struct GEN9_CACHE_MODE_1 * restrict values)
10297{
10298   uint32_t * restrict dw = (uint32_t * restrict) dst;
10299
10300   dw[0] =
10301      __gen_uint(values->PartialResolveDisableInVC, 1, 1) |
10302      __gen_uint(values->RCZReadafterexpansioncontrolfix2, 2, 2) |
10303      __gen_uint(values->DepthReadHitWriteOnlyOptimizationDisable, 3, 3) |
10304      __gen_uint(values->FloatBlendOptimizationEnable, 4, 4) |
10305      __gen_uint(values->MCSCacheDisable, 5, 5) |
10306      __gen_uint(values->_4X4RCPFESTCOptimizationDisable, 6, 6) |
10307      __gen_uint(values->SamplerCacheSetXORselection, 7, 8) |
10308      __gen_uint(values->MSCRAWHazardAvoidanceBit, 9, 9) |
10309      __gen_uint(values->NPPMAFixEnable, 11, 11) |
10310      __gen_uint(values->HIZEvictionPolicy, 12, 12) |
10311      __gen_uint(values->NPEarlyZFailsDisable, 13, 13) |
10312      __gen_uint(values->BlendOptimizationFixDisable, 14, 14) |
10313      __gen_uint(values->ColorCompressionDisable, 15, 15) |
10314      __gen_uint(values->PartialResolveDisableInVCMask, 17, 17) |
10315      __gen_uint(values->RCZReadafterexpansioncontrolfix2Mask, 18, 18) |
10316      __gen_uint(values->DepthReadHitWriteOnlyOptimizationDisableMask, 19, 19) |
10317      __gen_uint(values->FloatBlendOptimizationEnableMask, 20, 20) |
10318      __gen_uint(values->MCSCacheDisableMask, 21, 21) |
10319      __gen_uint(values->_4X4RCPFESTCOptimizationDisableMask, 22, 22) |
10320      __gen_uint(values->SamplerCacheSetXORselectionMask, 23, 24) |
10321      __gen_uint(values->MSCRAWHazardAvoidanceBitMask, 25, 25) |
10322      __gen_uint(values->NPPMAFixEnableMask, 27, 27) |
10323      __gen_uint(values->HIZEvictionPolicyMask, 28, 28) |
10324      __gen_uint(values->NPEarlyZFailsDisableMask, 29, 29) |
10325      __gen_uint(values->BlendOptimizationFixDisableMask, 30, 30) |
10326      __gen_uint(values->ColorCompressionDisableMask, 31, 31);
10327}
10328
10329#define GEN9_CL_INVOCATION_COUNT_num      0x2338
10330#define GEN9_CL_INVOCATION_COUNT_length        2
10331struct GEN9_CL_INVOCATION_COUNT {
10332   uint64_t                             CLInvocationCountReport;
10333};
10334
10335static inline void
10336GEN9_CL_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
10337                              __attribute__((unused)) void * restrict dst,
10338                              __attribute__((unused)) const struct GEN9_CL_INVOCATION_COUNT * restrict values)
10339{
10340   uint32_t * restrict dw = (uint32_t * restrict) dst;
10341
10342   const uint64_t v0 =
10343      __gen_uint(values->CLInvocationCountReport, 0, 63);
10344   dw[0] = v0;
10345   dw[1] = v0 >> 32;
10346}
10347
10348#define GEN9_CL_PRIMITIVES_COUNT_num      0x2340
10349#define GEN9_CL_PRIMITIVES_COUNT_length        2
10350struct GEN9_CL_PRIMITIVES_COUNT {
10351   uint64_t                             CLPrimitivesCountReport;
10352};
10353
10354static inline void
10355GEN9_CL_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
10356                              __attribute__((unused)) void * restrict dst,
10357                              __attribute__((unused)) const struct GEN9_CL_PRIMITIVES_COUNT * restrict values)
10358{
10359   uint32_t * restrict dw = (uint32_t * restrict) dst;
10360
10361   const uint64_t v0 =
10362      __gen_uint(values->CLPrimitivesCountReport, 0, 63);
10363   dw[0] = v0;
10364   dw[1] = v0 >> 32;
10365}
10366
10367#define GEN9_CS_CHICKEN1_num              0x2580
10368#define GEN9_CS_CHICKEN1_length                1
10369struct GEN9_CS_CHICKEN1 {
10370   uint32_t                             ReplayMode;
10371#define MidcmdbufferPreemption                   0
10372#define ObjectLevelPreemption                    1
10373   bool                                 ReplayModeMask;
10374};
10375
10376static inline void
10377GEN9_CS_CHICKEN1_pack(__attribute__((unused)) __gen_user_data *data,
10378                      __attribute__((unused)) void * restrict dst,
10379                      __attribute__((unused)) const struct GEN9_CS_CHICKEN1 * restrict values)
10380{
10381   uint32_t * restrict dw = (uint32_t * restrict) dst;
10382
10383   dw[0] =
10384      __gen_uint(values->ReplayMode, 0, 0) |
10385      __gen_uint(values->ReplayModeMask, 16, 16);
10386}
10387
10388#define GEN9_CS_DEBUG_MODE2_num           0x20d8
10389#define GEN9_CS_DEBUG_MODE2_length             1
10390struct GEN9_CS_DEBUG_MODE2 {
10391   bool                                 _3DRenderingInstructionDisable;
10392   bool                                 MediaInstructionDisable;
10393   bool                                 CONSTANT_BUFFERAddressOffsetDisable;
10394   bool                                 _3DRenderingInstructionDisableMask;
10395   bool                                 MediaInstructionDisableMask;
10396   bool                                 CONSTANT_BUFFERAddressOffsetDisableMask;
10397};
10398
10399static inline void
10400GEN9_CS_DEBUG_MODE2_pack(__attribute__((unused)) __gen_user_data *data,
10401                         __attribute__((unused)) void * restrict dst,
10402                         __attribute__((unused)) const struct GEN9_CS_DEBUG_MODE2 * restrict values)
10403{
10404   uint32_t * restrict dw = (uint32_t * restrict) dst;
10405
10406   dw[0] =
10407      __gen_uint(values->_3DRenderingInstructionDisable, 0, 0) |
10408      __gen_uint(values->MediaInstructionDisable, 1, 1) |
10409      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisable, 4, 4) |
10410      __gen_uint(values->_3DRenderingInstructionDisableMask, 16, 16) |
10411      __gen_uint(values->MediaInstructionDisableMask, 17, 17) |
10412      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisableMask, 20, 20);
10413}
10414
10415#define GEN9_CS_INVOCATION_COUNT_num      0x2290
10416#define GEN9_CS_INVOCATION_COUNT_length        2
10417struct GEN9_CS_INVOCATION_COUNT {
10418   uint64_t                             CSInvocationCountReport;
10419};
10420
10421static inline void
10422GEN9_CS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
10423                              __attribute__((unused)) void * restrict dst,
10424                              __attribute__((unused)) const struct GEN9_CS_INVOCATION_COUNT * restrict values)
10425{
10426   uint32_t * restrict dw = (uint32_t * restrict) dst;
10427
10428   const uint64_t v0 =
10429      __gen_uint(values->CSInvocationCountReport, 0, 63);
10430   dw[0] = v0;
10431   dw[1] = v0 >> 32;
10432}
10433
10434#define GEN9_DS_INVOCATION_COUNT_num      0x2308
10435#define GEN9_DS_INVOCATION_COUNT_length        2
10436struct GEN9_DS_INVOCATION_COUNT {
10437   uint64_t                             DSInvocationCountReport;
10438};
10439
10440static inline void
10441GEN9_DS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
10442                              __attribute__((unused)) void * restrict dst,
10443                              __attribute__((unused)) const struct GEN9_DS_INVOCATION_COUNT * restrict values)
10444{
10445   uint32_t * restrict dw = (uint32_t * restrict) dst;
10446
10447   const uint64_t v0 =
10448      __gen_uint(values->DSInvocationCountReport, 0, 63);
10449   dw[0] = v0;
10450   dw[1] = v0 >> 32;
10451}
10452
10453#define GEN9_FAULT_REG_num                0x4094
10454#define GEN9_FAULT_REG_length                  1
10455struct GEN9_FAULT_REG {
10456   bool                                 ValidBit;
10457   uint32_t                             FaultType;
10458#define InvalidPTEFault                          0
10459#define InvalidPDEFault                          1
10460#define InvalidPDPEFault                         2
10461#define InvalidPML4EFault                        3
10462   uint32_t                             SRCIDofFault;
10463   uint32_t                             GTTSEL;
10464#define PPGTT                                    0
10465#define GGTT                                     1
10466   uint32_t                             EngineID;
10467#define GFX                                      0
10468#define MFX0                                     1
10469#define MFX1                                     2
10470#define VEBX                                     3
10471#define BLT                                      4
10472#define GUC                                      5
10473};
10474
10475static inline void
10476GEN9_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
10477                    __attribute__((unused)) void * restrict dst,
10478                    __attribute__((unused)) const struct GEN9_FAULT_REG * restrict values)
10479{
10480   uint32_t * restrict dw = (uint32_t * restrict) dst;
10481
10482   dw[0] =
10483      __gen_uint(values->ValidBit, 0, 0) |
10484      __gen_uint(values->FaultType, 1, 2) |
10485      __gen_uint(values->SRCIDofFault, 3, 10) |
10486      __gen_uint(values->GTTSEL, 11, 11) |
10487      __gen_uint(values->EngineID, 12, 14);
10488}
10489
10490#define GEN9_GFX_ARB_ERROR_RPT_num        0x40a0
10491#define GEN9_GFX_ARB_ERROR_RPT_length          1
10492struct GEN9_GFX_ARB_ERROR_RPT {
10493   bool                                 TLBPageFaultError;
10494   bool                                 RSTRMPAVPReadInvalid;
10495   bool                                 InvalidPageDirectoryEntryError;
10496   bool                                 ROSTRMPAVPInvalidPhysicalAddress;
10497   bool                                 TLBPageVTDTranslationError;
10498   bool                                 WRDPPAVPInvalid;
10499   bool                                 PageDirectoryEntryVTDTranslationError;
10500   bool                                 UnloadedPDError;
10501   bool                                 GuCVTdtranslationPageFault2ndlevelUndefineddoorbell;
10502   bool                                 NonWBmemorytypeforAdvancedContext;
10503   bool                                 PASIDNotEnabled;
10504   bool                                 PASIDBoundaryViolation;
10505   bool                                 PASIDNotValid;
10506   bool                                 PASIDWasZeroForUntranslatedRequest;
10507   bool                                 ContextWasNotMarkedAsPresentWhenDoingDMA;
10508};
10509
10510static inline void
10511GEN9_GFX_ARB_ERROR_RPT_pack(__attribute__((unused)) __gen_user_data *data,
10512                            __attribute__((unused)) void * restrict dst,
10513                            __attribute__((unused)) const struct GEN9_GFX_ARB_ERROR_RPT * restrict values)
10514{
10515   uint32_t * restrict dw = (uint32_t * restrict) dst;
10516
10517   dw[0] =
10518      __gen_uint(values->TLBPageFaultError, 0, 0) |
10519      __gen_uint(values->RSTRMPAVPReadInvalid, 1, 1) |
10520      __gen_uint(values->InvalidPageDirectoryEntryError, 2, 2) |
10521      __gen_uint(values->ROSTRMPAVPInvalidPhysicalAddress, 3, 3) |
10522      __gen_uint(values->TLBPageVTDTranslationError, 4, 4) |
10523      __gen_uint(values->WRDPPAVPInvalid, 5, 5) |
10524      __gen_uint(values->PageDirectoryEntryVTDTranslationError, 6, 6) |
10525      __gen_uint(values->UnloadedPDError, 8, 8) |
10526      __gen_uint(values->GuCVTdtranslationPageFault2ndlevelUndefineddoorbell, 9, 9) |
10527      __gen_uint(values->NonWBmemorytypeforAdvancedContext, 10, 10) |
10528      __gen_uint(values->PASIDNotEnabled, 11, 11) |
10529      __gen_uint(values->PASIDBoundaryViolation, 12, 12) |
10530      __gen_uint(values->PASIDNotValid, 13, 13) |
10531      __gen_uint(values->PASIDWasZeroForUntranslatedRequest, 14, 14) |
10532      __gen_uint(values->ContextWasNotMarkedAsPresentWhenDoingDMA, 15, 15);
10533}
10534
10535#define GEN9_GS_INVOCATION_COUNT_num      0x2328
10536#define GEN9_GS_INVOCATION_COUNT_length        2
10537struct GEN9_GS_INVOCATION_COUNT {
10538   uint64_t                             GSInvocationCountReport;
10539};
10540
10541static inline void
10542GEN9_GS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
10543                              __attribute__((unused)) void * restrict dst,
10544                              __attribute__((unused)) const struct GEN9_GS_INVOCATION_COUNT * restrict values)
10545{
10546   uint32_t * restrict dw = (uint32_t * restrict) dst;
10547
10548   const uint64_t v0 =
10549      __gen_uint(values->GSInvocationCountReport, 0, 63);
10550   dw[0] = v0;
10551   dw[1] = v0 >> 32;
10552}
10553
10554#define GEN9_GS_PRIMITIVES_COUNT_num      0x2330
10555#define GEN9_GS_PRIMITIVES_COUNT_length        2
10556struct GEN9_GS_PRIMITIVES_COUNT {
10557   uint64_t                             GSPrimitivesCountReport;
10558};
10559
10560static inline void
10561GEN9_GS_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
10562                              __attribute__((unused)) void * restrict dst,
10563                              __attribute__((unused)) const struct GEN9_GS_PRIMITIVES_COUNT * restrict values)
10564{
10565   uint32_t * restrict dw = (uint32_t * restrict) dst;
10566
10567   const uint64_t v0 =
10568      __gen_uint(values->GSPrimitivesCountReport, 0, 63);
10569   dw[0] = v0;
10570   dw[1] = v0 >> 32;
10571}
10572
10573#define GEN9_HS_INVOCATION_COUNT_num      0x2300
10574#define GEN9_HS_INVOCATION_COUNT_length        2
10575struct GEN9_HS_INVOCATION_COUNT {
10576   uint64_t                             HSInvocationCountReport;
10577};
10578
10579static inline void
10580GEN9_HS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
10581                              __attribute__((unused)) void * restrict dst,
10582                              __attribute__((unused)) const struct GEN9_HS_INVOCATION_COUNT * restrict values)
10583{
10584   uint32_t * restrict dw = (uint32_t * restrict) dst;
10585
10586   const uint64_t v0 =
10587      __gen_uint(values->HSInvocationCountReport, 0, 63);
10588   dw[0] = v0;
10589   dw[1] = v0 >> 32;
10590}
10591
10592#define GEN9_IA_PRIMITIVES_COUNT_num      0x2318
10593#define GEN9_IA_PRIMITIVES_COUNT_length        2
10594struct GEN9_IA_PRIMITIVES_COUNT {
10595   uint64_t                             IAPrimitivesCountReport;
10596};
10597
10598static inline void
10599GEN9_IA_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
10600                              __attribute__((unused)) void * restrict dst,
10601                              __attribute__((unused)) const struct GEN9_IA_PRIMITIVES_COUNT * restrict values)
10602{
10603   uint32_t * restrict dw = (uint32_t * restrict) dst;
10604
10605   const uint64_t v0 =
10606      __gen_uint(values->IAPrimitivesCountReport, 0, 63);
10607   dw[0] = v0;
10608   dw[1] = v0 >> 32;
10609}
10610
10611#define GEN9_IA_VERTICES_COUNT_num        0x2310
10612#define GEN9_IA_VERTICES_COUNT_length          2
10613struct GEN9_IA_VERTICES_COUNT {
10614   uint64_t                             IAVerticesCountReport;
10615};
10616
10617static inline void
10618GEN9_IA_VERTICES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
10619                            __attribute__((unused)) void * restrict dst,
10620                            __attribute__((unused)) const struct GEN9_IA_VERTICES_COUNT * restrict values)
10621{
10622   uint32_t * restrict dw = (uint32_t * restrict) dst;
10623
10624   const uint64_t v0 =
10625      __gen_uint(values->IAVerticesCountReport, 0, 63);
10626   dw[0] = v0;
10627   dw[1] = v0 >> 32;
10628}
10629
10630#define GEN9_INSTDONE_1_num               0x206c
10631#define GEN9_INSTDONE_1_length                 1
10632struct GEN9_INSTDONE_1 {
10633   bool                                 PRB0RingEnable;
10634   bool                                 VFGDone;
10635   bool                                 VSDone;
10636   bool                                 HSDone;
10637   bool                                 TEDone;
10638   bool                                 DSDone;
10639   bool                                 GSDone;
10640   bool                                 SOLDone;
10641   bool                                 CLDone;
10642   bool                                 SFDone;
10643   bool                                 TDGDone;
10644   bool                                 URBMDone;
10645   bool                                 SVGDone;
10646   bool                                 GAFSDone;
10647   bool                                 VFEDone;
10648   bool                                 TSGDone;
10649   bool                                 GAFMDone;
10650   bool                                 GAMDone;
10651   bool                                 RSDone;
10652   bool                                 CSDone;
10653   bool                                 SDEDone;
10654   bool                                 RCCFBCCSDone;
10655};
10656
10657static inline void
10658GEN9_INSTDONE_1_pack(__attribute__((unused)) __gen_user_data *data,
10659                     __attribute__((unused)) void * restrict dst,
10660                     __attribute__((unused)) const struct GEN9_INSTDONE_1 * restrict values)
10661{
10662   uint32_t * restrict dw = (uint32_t * restrict) dst;
10663
10664   dw[0] =
10665      __gen_uint(values->PRB0RingEnable, 0, 0) |
10666      __gen_uint(values->VFGDone, 1, 1) |
10667      __gen_uint(values->VSDone, 2, 2) |
10668      __gen_uint(values->HSDone, 3, 3) |
10669      __gen_uint(values->TEDone, 4, 4) |
10670      __gen_uint(values->DSDone, 5, 5) |
10671      __gen_uint(values->GSDone, 6, 6) |
10672      __gen_uint(values->SOLDone, 7, 7) |
10673      __gen_uint(values->CLDone, 8, 8) |
10674      __gen_uint(values->SFDone, 9, 9) |
10675      __gen_uint(values->TDGDone, 12, 12) |
10676      __gen_uint(values->URBMDone, 13, 13) |
10677      __gen_uint(values->SVGDone, 14, 14) |
10678      __gen_uint(values->GAFSDone, 15, 15) |
10679      __gen_uint(values->VFEDone, 16, 16) |
10680      __gen_uint(values->TSGDone, 17, 17) |
10681      __gen_uint(values->GAFMDone, 18, 18) |
10682      __gen_uint(values->GAMDone, 19, 19) |
10683      __gen_uint(values->RSDone, 20, 20) |
10684      __gen_uint(values->CSDone, 21, 21) |
10685      __gen_uint(values->SDEDone, 22, 22) |
10686      __gen_uint(values->RCCFBCCSDone, 23, 23);
10687}
10688
10689#define GEN9_L3CNTLREG_num                0x7034
10690#define GEN9_L3CNTLREG_length                  1
10691struct GEN9_L3CNTLREG {
10692   bool                                 SLMEnable;
10693   uint32_t                             URBAllocation;
10694   uint32_t                             ROAllocation;
10695   uint32_t                             DCAllocation;
10696   uint32_t                             AllAllocation;
10697};
10698
10699static inline void
10700GEN9_L3CNTLREG_pack(__attribute__((unused)) __gen_user_data *data,
10701                    __attribute__((unused)) void * restrict dst,
10702                    __attribute__((unused)) const struct GEN9_L3CNTLREG * restrict values)
10703{
10704   uint32_t * restrict dw = (uint32_t * restrict) dst;
10705
10706   dw[0] =
10707      __gen_uint(values->SLMEnable, 0, 0) |
10708      __gen_uint(values->URBAllocation, 1, 7) |
10709      __gen_uint(values->ROAllocation, 11, 17) |
10710      __gen_uint(values->DCAllocation, 18, 24) |
10711      __gen_uint(values->AllAllocation, 25, 31);
10712}
10713
10714#define GEN9_PS_INVOCATION_COUNT_num      0x2348
10715#define GEN9_PS_INVOCATION_COUNT_length        2
10716struct GEN9_PS_INVOCATION_COUNT {
10717   uint64_t                             PSInvocationCountReport;
10718};
10719
10720static inline void
10721GEN9_PS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
10722                              __attribute__((unused)) void * restrict dst,
10723                              __attribute__((unused)) const struct GEN9_PS_INVOCATION_COUNT * restrict values)
10724{
10725   uint32_t * restrict dw = (uint32_t * restrict) dst;
10726
10727   const uint64_t v0 =
10728      __gen_uint(values->PSInvocationCountReport, 0, 63);
10729   dw[0] = v0;
10730   dw[1] = v0 >> 32;
10731}
10732
10733#define GEN9_RCS_RING_BUFFER_CTL_num      0x203c
10734#define GEN9_RCS_RING_BUFFER_CTL_length        1
10735struct GEN9_RCS_RING_BUFFER_CTL {
10736   bool                                 RingBufferEnable;
10737   uint32_t                             AutomaticReportHeadPointer;
10738#define MI_AUTOREPORT_OFF                        0
10739#define MI_AUTOREPORT_64KB                       1
10740#define MI_AUTOREPORT_4KB                        2
10741#define MI_AUTOREPORT_128KB                      3
10742   bool                                 SemaphoreWait;
10743   bool                                 RBWait;
10744   uint32_t                             BufferLengthinpages1;
10745};
10746
10747static inline void
10748GEN9_RCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
10749                              __attribute__((unused)) void * restrict dst,
10750                              __attribute__((unused)) const struct GEN9_RCS_RING_BUFFER_CTL * restrict values)
10751{
10752   uint32_t * restrict dw = (uint32_t * restrict) dst;
10753
10754   dw[0] =
10755      __gen_uint(values->RingBufferEnable, 0, 0) |
10756      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
10757      __gen_uint(values->SemaphoreWait, 10, 10) |
10758      __gen_uint(values->RBWait, 11, 11) |
10759      __gen_uint(values->BufferLengthinpages1, 12, 20);
10760}
10761
10762#define GEN9_ROW_INSTDONE_num             0xe164
10763#define GEN9_ROW_INSTDONE_length               1
10764struct GEN9_ROW_INSTDONE {
10765   bool                                 BCDone;
10766   bool                                 PSDDone;
10767   bool                                 DAPRDone;
10768   bool                                 TDLDone;
10769   bool                                 ICDone;
10770   bool                                 MA0Done;
10771   bool                                 EU00DoneSS0;
10772   bool                                 EU01DoneSS0;
10773   bool                                 EU02DoneSS0;
10774   bool                                 EU03DoneSS0;
10775   bool                                 EU10DoneSS0;
10776   bool                                 EU11DoneSS0;
10777   bool                                 EU12DoneSS0;
10778   bool                                 EU13DoneSS0;
10779   bool                                 MA1DoneSS0;
10780};
10781
10782static inline void
10783GEN9_ROW_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
10784                       __attribute__((unused)) void * restrict dst,
10785                       __attribute__((unused)) const struct GEN9_ROW_INSTDONE * restrict values)
10786{
10787   uint32_t * restrict dw = (uint32_t * restrict) dst;
10788
10789   dw[0] =
10790      __gen_uint(values->BCDone, 0, 0) |
10791      __gen_uint(values->PSDDone, 1, 1) |
10792      __gen_uint(values->DAPRDone, 3, 3) |
10793      __gen_uint(values->TDLDone, 6, 6) |
10794      __gen_uint(values->ICDone, 12, 12) |
10795      __gen_uint(values->MA0Done, 15, 15) |
10796      __gen_uint(values->EU00DoneSS0, 16, 16) |
10797      __gen_uint(values->EU01DoneSS0, 17, 17) |
10798      __gen_uint(values->EU02DoneSS0, 18, 18) |
10799      __gen_uint(values->EU03DoneSS0, 19, 19) |
10800      __gen_uint(values->EU10DoneSS0, 21, 21) |
10801      __gen_uint(values->EU11DoneSS0, 22, 22) |
10802      __gen_uint(values->EU12DoneSS0, 23, 23) |
10803      __gen_uint(values->EU13DoneSS0, 24, 24) |
10804      __gen_uint(values->MA1DoneSS0, 26, 26);
10805}
10806
10807#define GEN9_SAMPLER_INSTDONE_num         0xe160
10808#define GEN9_SAMPLER_INSTDONE_length           1
10809struct GEN9_SAMPLER_INSTDONE {
10810   bool                                 IMEDone;
10811   bool                                 PL0Done;
10812   bool                                 SO0Done;
10813   bool                                 DG0Done;
10814   bool                                 FT0Done;
10815   bool                                 DM0Done;
10816   bool                                 SCDone;
10817   bool                                 FL0Done;
10818   bool                                 QCDone;
10819   bool                                 SVSMDone;
10820   bool                                 SI0Done;
10821   bool                                 MT0Done;
10822   bool                                 AVSDone;
10823   bool                                 IEFDone;
10824   bool                                 CREDone;
10825   bool                                 SVSMARB3;
10826   bool                                 SVSMARB2;
10827   bool                                 SVSMARB1;
10828   bool                                 SVSMAdapter;
10829   bool                                 BDMDone;
10830};
10831
10832static inline void
10833GEN9_SAMPLER_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
10834                           __attribute__((unused)) void * restrict dst,
10835                           __attribute__((unused)) const struct GEN9_SAMPLER_INSTDONE * restrict values)
10836{
10837   uint32_t * restrict dw = (uint32_t * restrict) dst;
10838
10839   dw[0] =
10840      __gen_uint(values->IMEDone, 0, 0) |
10841      __gen_uint(values->PL0Done, 1, 1) |
10842      __gen_uint(values->SO0Done, 2, 2) |
10843      __gen_uint(values->DG0Done, 3, 3) |
10844      __gen_uint(values->FT0Done, 4, 4) |
10845      __gen_uint(values->DM0Done, 5, 5) |
10846      __gen_uint(values->SCDone, 6, 6) |
10847      __gen_uint(values->FL0Done, 7, 7) |
10848      __gen_uint(values->QCDone, 8, 8) |
10849      __gen_uint(values->SVSMDone, 9, 9) |
10850      __gen_uint(values->SI0Done, 10, 10) |
10851      __gen_uint(values->MT0Done, 11, 11) |
10852      __gen_uint(values->AVSDone, 12, 12) |
10853      __gen_uint(values->IEFDone, 13, 13) |
10854      __gen_uint(values->CREDone, 14, 14) |
10855      __gen_uint(values->SVSMARB3, 15, 15) |
10856      __gen_uint(values->SVSMARB2, 16, 16) |
10857      __gen_uint(values->SVSMARB1, 17, 17) |
10858      __gen_uint(values->SVSMAdapter, 18, 18) |
10859      __gen_uint(values->BDMDone, 19, 19);
10860}
10861
10862#define GEN9_SC_INSTDONE_num              0x7100
10863#define GEN9_SC_INSTDONE_length                1
10864struct GEN9_SC_INSTDONE {
10865   bool                                 SVLDone;
10866   bool                                 WMFEDone;
10867   bool                                 WMBEDone;
10868   bool                                 HIZDone;
10869   bool                                 STCDone;
10870   bool                                 IZDone;
10871   bool                                 SBEDone;
10872   bool                                 RCZDone;
10873   bool                                 RCCDone;
10874   bool                                 RCPBEDone;
10875   bool                                 RCPFEDone;
10876   bool                                 DAPBDone;
10877   bool                                 DAPRBEDone;
10878   bool                                 SARBDone;
10879   bool                                 DC0Done;
10880   bool                                 DC1Done;
10881   bool                                 DC2Done;
10882   bool                                 DC3Done;
10883   bool                                 GW0Done;
10884   bool                                 GW1Done;
10885   bool                                 GW2Done;
10886   bool                                 GW3Done;
10887   bool                                 TDCDone;
10888};
10889
10890static inline void
10891GEN9_SC_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
10892                      __attribute__((unused)) void * restrict dst,
10893                      __attribute__((unused)) const struct GEN9_SC_INSTDONE * restrict values)
10894{
10895   uint32_t * restrict dw = (uint32_t * restrict) dst;
10896
10897   dw[0] =
10898      __gen_uint(values->SVLDone, 0, 0) |
10899      __gen_uint(values->WMFEDone, 1, 1) |
10900      __gen_uint(values->WMBEDone, 2, 2) |
10901      __gen_uint(values->HIZDone, 3, 3) |
10902      __gen_uint(values->STCDone, 4, 4) |
10903      __gen_uint(values->IZDone, 5, 5) |
10904      __gen_uint(values->SBEDone, 6, 6) |
10905      __gen_uint(values->RCZDone, 8, 8) |
10906      __gen_uint(values->RCCDone, 9, 9) |
10907      __gen_uint(values->RCPBEDone, 10, 10) |
10908      __gen_uint(values->RCPFEDone, 11, 11) |
10909      __gen_uint(values->DAPBDone, 12, 12) |
10910      __gen_uint(values->DAPRBEDone, 13, 13) |
10911      __gen_uint(values->SARBDone, 15, 15) |
10912      __gen_uint(values->DC0Done, 16, 16) |
10913      __gen_uint(values->DC1Done, 17, 17) |
10914      __gen_uint(values->DC2Done, 18, 18) |
10915      __gen_uint(values->DC3Done, 19, 19) |
10916      __gen_uint(values->GW0Done, 20, 20) |
10917      __gen_uint(values->GW1Done, 21, 21) |
10918      __gen_uint(values->GW2Done, 22, 22) |
10919      __gen_uint(values->GW3Done, 23, 23) |
10920      __gen_uint(values->TDCDone, 24, 24);
10921}
10922
10923#define GEN9_SLICE_COMMON_ECO_CHICKEN1_num 0x731c
10924#define GEN9_SLICE_COMMON_ECO_CHICKEN1_length      1
10925struct GEN9_SLICE_COMMON_ECO_CHICKEN1 {
10926   uint32_t                             GLKBarrierMode;
10927#define GLK_BARRIER_MODE_GPGPU                   0
10928#define GLK_BARRIER_MODE_3D_HULL                 1
10929   bool                                 GLKBarrierModeMask;
10930};
10931
10932static inline void
10933GEN9_SLICE_COMMON_ECO_CHICKEN1_pack(__attribute__((unused)) __gen_user_data *data,
10934                                    __attribute__((unused)) void * restrict dst,
10935                                    __attribute__((unused)) const struct GEN9_SLICE_COMMON_ECO_CHICKEN1 * restrict values)
10936{
10937   uint32_t * restrict dw = (uint32_t * restrict) dst;
10938
10939   dw[0] =
10940      __gen_uint(values->GLKBarrierMode, 7, 7) |
10941      __gen_uint(values->GLKBarrierModeMask, 23, 23);
10942}
10943
10944#define GEN9_SO_NUM_PRIMS_WRITTEN0_num    0x5200
10945#define GEN9_SO_NUM_PRIMS_WRITTEN0_length      2
10946struct GEN9_SO_NUM_PRIMS_WRITTEN0 {
10947   uint64_t                             NumPrimsWrittenCount;
10948};
10949
10950static inline void
10951GEN9_SO_NUM_PRIMS_WRITTEN0_pack(__attribute__((unused)) __gen_user_data *data,
10952                                __attribute__((unused)) void * restrict dst,
10953                                __attribute__((unused)) const struct GEN9_SO_NUM_PRIMS_WRITTEN0 * restrict values)
10954{
10955   uint32_t * restrict dw = (uint32_t * restrict) dst;
10956
10957   const uint64_t v0 =
10958      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
10959   dw[0] = v0;
10960   dw[1] = v0 >> 32;
10961}
10962
10963#define GEN9_SO_NUM_PRIMS_WRITTEN1_num    0x5208
10964#define GEN9_SO_NUM_PRIMS_WRITTEN1_length      2
10965struct GEN9_SO_NUM_PRIMS_WRITTEN1 {
10966   uint64_t                             NumPrimsWrittenCount;
10967};
10968
10969static inline void
10970GEN9_SO_NUM_PRIMS_WRITTEN1_pack(__attribute__((unused)) __gen_user_data *data,
10971                                __attribute__((unused)) void * restrict dst,
10972                                __attribute__((unused)) const struct GEN9_SO_NUM_PRIMS_WRITTEN1 * restrict values)
10973{
10974   uint32_t * restrict dw = (uint32_t * restrict) dst;
10975
10976   const uint64_t v0 =
10977      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
10978   dw[0] = v0;
10979   dw[1] = v0 >> 32;
10980}
10981
10982#define GEN9_SO_NUM_PRIMS_WRITTEN2_num    0x5210
10983#define GEN9_SO_NUM_PRIMS_WRITTEN2_length      2
10984struct GEN9_SO_NUM_PRIMS_WRITTEN2 {
10985   uint64_t                             NumPrimsWrittenCount;
10986};
10987
10988static inline void
10989GEN9_SO_NUM_PRIMS_WRITTEN2_pack(__attribute__((unused)) __gen_user_data *data,
10990                                __attribute__((unused)) void * restrict dst,
10991                                __attribute__((unused)) const struct GEN9_SO_NUM_PRIMS_WRITTEN2 * restrict values)
10992{
10993   uint32_t * restrict dw = (uint32_t * restrict) dst;
10994
10995   const uint64_t v0 =
10996      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
10997   dw[0] = v0;
10998   dw[1] = v0 >> 32;
10999}
11000
11001#define GEN9_SO_NUM_PRIMS_WRITTEN3_num    0x5218
11002#define GEN9_SO_NUM_PRIMS_WRITTEN3_length      2
11003struct GEN9_SO_NUM_PRIMS_WRITTEN3 {
11004   uint64_t                             NumPrimsWrittenCount;
11005};
11006
11007static inline void
11008GEN9_SO_NUM_PRIMS_WRITTEN3_pack(__attribute__((unused)) __gen_user_data *data,
11009                                __attribute__((unused)) void * restrict dst,
11010                                __attribute__((unused)) const struct GEN9_SO_NUM_PRIMS_WRITTEN3 * restrict values)
11011{
11012   uint32_t * restrict dw = (uint32_t * restrict) dst;
11013
11014   const uint64_t v0 =
11015      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
11016   dw[0] = v0;
11017   dw[1] = v0 >> 32;
11018}
11019
11020#define GEN9_SO_PRIM_STORAGE_NEEDED0_num  0x5240
11021#define GEN9_SO_PRIM_STORAGE_NEEDED0_length      2
11022struct GEN9_SO_PRIM_STORAGE_NEEDED0 {
11023   uint64_t                             PrimStorageNeededCount;
11024};
11025
11026static inline void
11027GEN9_SO_PRIM_STORAGE_NEEDED0_pack(__attribute__((unused)) __gen_user_data *data,
11028                                  __attribute__((unused)) void * restrict dst,
11029                                  __attribute__((unused)) const struct GEN9_SO_PRIM_STORAGE_NEEDED0 * restrict values)
11030{
11031   uint32_t * restrict dw = (uint32_t * restrict) dst;
11032
11033   const uint64_t v0 =
11034      __gen_uint(values->PrimStorageNeededCount, 0, 63);
11035   dw[0] = v0;
11036   dw[1] = v0 >> 32;
11037}
11038
11039#define GEN9_SO_PRIM_STORAGE_NEEDED1_num  0x5248
11040#define GEN9_SO_PRIM_STORAGE_NEEDED1_length      2
11041struct GEN9_SO_PRIM_STORAGE_NEEDED1 {
11042   uint64_t                             PrimStorageNeededCount;
11043};
11044
11045static inline void
11046GEN9_SO_PRIM_STORAGE_NEEDED1_pack(__attribute__((unused)) __gen_user_data *data,
11047                                  __attribute__((unused)) void * restrict dst,
11048                                  __attribute__((unused)) const struct GEN9_SO_PRIM_STORAGE_NEEDED1 * restrict values)
11049{
11050   uint32_t * restrict dw = (uint32_t * restrict) dst;
11051
11052   const uint64_t v0 =
11053      __gen_uint(values->PrimStorageNeededCount, 0, 63);
11054   dw[0] = v0;
11055   dw[1] = v0 >> 32;
11056}
11057
11058#define GEN9_SO_PRIM_STORAGE_NEEDED2_num  0x5250
11059#define GEN9_SO_PRIM_STORAGE_NEEDED2_length      2
11060struct GEN9_SO_PRIM_STORAGE_NEEDED2 {
11061   uint64_t                             PrimStorageNeededCount;
11062};
11063
11064static inline void
11065GEN9_SO_PRIM_STORAGE_NEEDED2_pack(__attribute__((unused)) __gen_user_data *data,
11066                                  __attribute__((unused)) void * restrict dst,
11067                                  __attribute__((unused)) const struct GEN9_SO_PRIM_STORAGE_NEEDED2 * restrict values)
11068{
11069   uint32_t * restrict dw = (uint32_t * restrict) dst;
11070
11071   const uint64_t v0 =
11072      __gen_uint(values->PrimStorageNeededCount, 0, 63);
11073   dw[0] = v0;
11074   dw[1] = v0 >> 32;
11075}
11076
11077#define GEN9_SO_PRIM_STORAGE_NEEDED3_num  0x5258
11078#define GEN9_SO_PRIM_STORAGE_NEEDED3_length      2
11079struct GEN9_SO_PRIM_STORAGE_NEEDED3 {
11080   uint64_t                             PrimStorageNeededCount;
11081};
11082
11083static inline void
11084GEN9_SO_PRIM_STORAGE_NEEDED3_pack(__attribute__((unused)) __gen_user_data *data,
11085                                  __attribute__((unused)) void * restrict dst,
11086                                  __attribute__((unused)) const struct GEN9_SO_PRIM_STORAGE_NEEDED3 * restrict values)
11087{
11088   uint32_t * restrict dw = (uint32_t * restrict) dst;
11089
11090   const uint64_t v0 =
11091      __gen_uint(values->PrimStorageNeededCount, 0, 63);
11092   dw[0] = v0;
11093   dw[1] = v0 >> 32;
11094}
11095
11096#define GEN9_SO_WRITE_OFFSET0_num         0x5280
11097#define GEN9_SO_WRITE_OFFSET0_length           1
11098struct GEN9_SO_WRITE_OFFSET0 {
11099   uint64_t                             WriteOffset;
11100};
11101
11102static inline void
11103GEN9_SO_WRITE_OFFSET0_pack(__attribute__((unused)) __gen_user_data *data,
11104                           __attribute__((unused)) void * restrict dst,
11105                           __attribute__((unused)) const struct GEN9_SO_WRITE_OFFSET0 * restrict values)
11106{
11107   uint32_t * restrict dw = (uint32_t * restrict) dst;
11108
11109   dw[0] =
11110      __gen_offset(values->WriteOffset, 2, 31);
11111}
11112
11113#define GEN9_SO_WRITE_OFFSET1_num         0x5284
11114#define GEN9_SO_WRITE_OFFSET1_length           1
11115struct GEN9_SO_WRITE_OFFSET1 {
11116   uint64_t                             WriteOffset;
11117};
11118
11119static inline void
11120GEN9_SO_WRITE_OFFSET1_pack(__attribute__((unused)) __gen_user_data *data,
11121                           __attribute__((unused)) void * restrict dst,
11122                           __attribute__((unused)) const struct GEN9_SO_WRITE_OFFSET1 * restrict values)
11123{
11124   uint32_t * restrict dw = (uint32_t * restrict) dst;
11125
11126   dw[0] =
11127      __gen_offset(values->WriteOffset, 2, 31);
11128}
11129
11130#define GEN9_SO_WRITE_OFFSET2_num         0x5288
11131#define GEN9_SO_WRITE_OFFSET2_length           1
11132struct GEN9_SO_WRITE_OFFSET2 {
11133   uint64_t                             WriteOffset;
11134};
11135
11136static inline void
11137GEN9_SO_WRITE_OFFSET2_pack(__attribute__((unused)) __gen_user_data *data,
11138                           __attribute__((unused)) void * restrict dst,
11139                           __attribute__((unused)) const struct GEN9_SO_WRITE_OFFSET2 * restrict values)
11140{
11141   uint32_t * restrict dw = (uint32_t * restrict) dst;
11142
11143   dw[0] =
11144      __gen_offset(values->WriteOffset, 2, 31);
11145}
11146
11147#define GEN9_SO_WRITE_OFFSET3_num         0x528c
11148#define GEN9_SO_WRITE_OFFSET3_length           1
11149struct GEN9_SO_WRITE_OFFSET3 {
11150   uint64_t                             WriteOffset;
11151};
11152
11153static inline void
11154GEN9_SO_WRITE_OFFSET3_pack(__attribute__((unused)) __gen_user_data *data,
11155                           __attribute__((unused)) void * restrict dst,
11156                           __attribute__((unused)) const struct GEN9_SO_WRITE_OFFSET3 * restrict values)
11157{
11158   uint32_t * restrict dw = (uint32_t * restrict) dst;
11159
11160   dw[0] =
11161      __gen_offset(values->WriteOffset, 2, 31);
11162}
11163
11164#define GEN9_VCS2_RING_BUFFER_CTL_num     0x1203c
11165#define GEN9_VCS2_RING_BUFFER_CTL_length       1
11166struct GEN9_VCS2_RING_BUFFER_CTL {
11167   bool                                 RingBufferEnable;
11168   uint32_t                             AutomaticReportHeadPointer;
11169#define MI_AUTOREPORT_OFF                        0
11170#define MI_AUTOREPORT_64KB                       1
11171#define MI_AUTOREPORT_4KB                        2
11172#define MI_AUTOREPORT_128KB                      3
11173   bool                                 DisableRegisterAccesses;
11174   bool                                 SemaphoreWait;
11175   bool                                 RBWait;
11176   uint32_t                             BufferLengthinpages1;
11177};
11178
11179static inline void
11180GEN9_VCS2_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
11181                               __attribute__((unused)) void * restrict dst,
11182                               __attribute__((unused)) const struct GEN9_VCS2_RING_BUFFER_CTL * restrict values)
11183{
11184   uint32_t * restrict dw = (uint32_t * restrict) dst;
11185
11186   dw[0] =
11187      __gen_uint(values->RingBufferEnable, 0, 0) |
11188      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
11189      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
11190      __gen_uint(values->SemaphoreWait, 10, 10) |
11191      __gen_uint(values->RBWait, 11, 11) |
11192      __gen_uint(values->BufferLengthinpages1, 12, 20);
11193}
11194
11195#define GEN9_VCS_ACTHD_UDW_num            0x1205c
11196#define GEN9_VCS_ACTHD_UDW_length              1
11197struct GEN9_VCS_ACTHD_UDW {
11198   uint32_t                             HeadPointerUpperDWORD;
11199};
11200
11201static inline void
11202GEN9_VCS_ACTHD_UDW_pack(__attribute__((unused)) __gen_user_data *data,
11203                        __attribute__((unused)) void * restrict dst,
11204                        __attribute__((unused)) const struct GEN9_VCS_ACTHD_UDW * restrict values)
11205{
11206   uint32_t * restrict dw = (uint32_t * restrict) dst;
11207
11208   dw[0] =
11209      __gen_uint(values->HeadPointerUpperDWORD, 0, 15);
11210}
11211
11212#define GEN9_VCS_INSTDONE_num             0x1206c
11213#define GEN9_VCS_INSTDONE_length               1
11214struct GEN9_VCS_INSTDONE {
11215   bool                                 RingEnable;
11216   bool                                 USBDone;
11217   bool                                 QRCDone;
11218   bool                                 SECDone;
11219   bool                                 MPCDone;
11220   bool                                 VFTDone;
11221   bool                                 BSPDone;
11222   bool                                 VLFDone;
11223   bool                                 VOPDone;
11224   bool                                 VMCDone;
11225   bool                                 VIPDone;
11226   bool                                 VITDone;
11227   bool                                 VDSDone;
11228   bool                                 VMXDone;
11229   bool                                 VCPDone;
11230   bool                                 VCDDone;
11231   bool                                 VADDone;
11232   bool                                 VMDDone;
11233   bool                                 VISDone;
11234   bool                                 VACDone;
11235   bool                                 VAMDone;
11236   bool                                 JPGDone;
11237   bool                                 VBPDone;
11238   bool                                 VHRDone;
11239   bool                                 VCIDone;
11240   bool                                 VCRDone;
11241   bool                                 VINDone;
11242   bool                                 VPRDone;
11243   bool                                 VTQDone;
11244   bool                                 Reserved;
11245   bool                                 VCSDone;
11246   bool                                 GACDone;
11247};
11248
11249static inline void
11250GEN9_VCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
11251                       __attribute__((unused)) void * restrict dst,
11252                       __attribute__((unused)) const struct GEN9_VCS_INSTDONE * restrict values)
11253{
11254   uint32_t * restrict dw = (uint32_t * restrict) dst;
11255
11256   dw[0] =
11257      __gen_uint(values->RingEnable, 0, 0) |
11258      __gen_uint(values->USBDone, 1, 1) |
11259      __gen_uint(values->QRCDone, 2, 2) |
11260      __gen_uint(values->SECDone, 3, 3) |
11261      __gen_uint(values->MPCDone, 4, 4) |
11262      __gen_uint(values->VFTDone, 5, 5) |
11263      __gen_uint(values->BSPDone, 6, 6) |
11264      __gen_uint(values->VLFDone, 7, 7) |
11265      __gen_uint(values->VOPDone, 8, 8) |
11266      __gen_uint(values->VMCDone, 9, 9) |
11267      __gen_uint(values->VIPDone, 10, 10) |
11268      __gen_uint(values->VITDone, 11, 11) |
11269      __gen_uint(values->VDSDone, 12, 12) |
11270      __gen_uint(values->VMXDone, 13, 13) |
11271      __gen_uint(values->VCPDone, 14, 14) |
11272      __gen_uint(values->VCDDone, 15, 15) |
11273      __gen_uint(values->VADDone, 16, 16) |
11274      __gen_uint(values->VMDDone, 17, 17) |
11275      __gen_uint(values->VISDone, 18, 18) |
11276      __gen_uint(values->VACDone, 19, 19) |
11277      __gen_uint(values->VAMDone, 20, 20) |
11278      __gen_uint(values->JPGDone, 21, 21) |
11279      __gen_uint(values->VBPDone, 22, 22) |
11280      __gen_uint(values->VHRDone, 23, 23) |
11281      __gen_uint(values->VCIDone, 24, 24) |
11282      __gen_uint(values->VCRDone, 25, 25) |
11283      __gen_uint(values->VINDone, 26, 26) |
11284      __gen_uint(values->VPRDone, 27, 27) |
11285      __gen_uint(values->VTQDone, 28, 28) |
11286      __gen_uint(values->Reserved, 29, 29) |
11287      __gen_uint(values->VCSDone, 30, 30) |
11288      __gen_uint(values->GACDone, 31, 31);
11289}
11290
11291#define GEN9_VCS_RING_BUFFER_CTL_num      0x1203c
11292#define GEN9_VCS_RING_BUFFER_CTL_length        1
11293struct GEN9_VCS_RING_BUFFER_CTL {
11294   bool                                 RingBufferEnable;
11295   uint32_t                             AutomaticReportHeadPointer;
11296#define MI_AUTOREPORT_OFF                        0
11297#define MI_AUTOREPORT_64KB                       1
11298#define MI_AUTOREPORT_4KB                        2
11299#define MI_AUTOREPORT_128KB                      3
11300   bool                                 DisableRegisterAccesses;
11301   bool                                 SemaphoreWait;
11302   bool                                 RBWait;
11303   uint32_t                             BufferLengthinpages1;
11304};
11305
11306static inline void
11307GEN9_VCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
11308                              __attribute__((unused)) void * restrict dst,
11309                              __attribute__((unused)) const struct GEN9_VCS_RING_BUFFER_CTL * restrict values)
11310{
11311   uint32_t * restrict dw = (uint32_t * restrict) dst;
11312
11313   dw[0] =
11314      __gen_uint(values->RingBufferEnable, 0, 0) |
11315      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
11316      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
11317      __gen_uint(values->SemaphoreWait, 10, 10) |
11318      __gen_uint(values->RBWait, 11, 11) |
11319      __gen_uint(values->BufferLengthinpages1, 12, 20);
11320}
11321
11322#define GEN9_VECS_ACTHD_UDW_num           0x1a05c
11323#define GEN9_VECS_ACTHD_UDW_length             1
11324struct GEN9_VECS_ACTHD_UDW {
11325   uint32_t                             HeadPointerUpperDWORD;
11326};
11327
11328static inline void
11329GEN9_VECS_ACTHD_UDW_pack(__attribute__((unused)) __gen_user_data *data,
11330                         __attribute__((unused)) void * restrict dst,
11331                         __attribute__((unused)) const struct GEN9_VECS_ACTHD_UDW * restrict values)
11332{
11333   uint32_t * restrict dw = (uint32_t * restrict) dst;
11334
11335   dw[0] =
11336      __gen_uint(values->HeadPointerUpperDWORD, 0, 15);
11337}
11338
11339#define GEN9_VECS_INSTDONE_num            0x1a06c
11340#define GEN9_VECS_INSTDONE_length              1
11341struct GEN9_VECS_INSTDONE {
11342   bool                                 RingEnable;
11343   bool                                 VECSDone;
11344   bool                                 GAMDone;
11345};
11346
11347static inline void
11348GEN9_VECS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
11349                        __attribute__((unused)) void * restrict dst,
11350                        __attribute__((unused)) const struct GEN9_VECS_INSTDONE * restrict values)
11351{
11352   uint32_t * restrict dw = (uint32_t * restrict) dst;
11353
11354   dw[0] =
11355      __gen_uint(values->RingEnable, 0, 0) |
11356      __gen_uint(values->VECSDone, 30, 30) |
11357      __gen_uint(values->GAMDone, 31, 31);
11358}
11359
11360#define GEN9_VECS_RING_BUFFER_CTL_num     0x1a03c
11361#define GEN9_VECS_RING_BUFFER_CTL_length       1
11362struct GEN9_VECS_RING_BUFFER_CTL {
11363   bool                                 RingBufferEnable;
11364   uint32_t                             AutomaticReportHeadPointer;
11365#define MI_AUTOREPORT_OFF                        0
11366#define MI_AUTOREPORT_64KB                       1
11367#define MI_AUTOREPORT_4KB                        2
11368#define MI_AUTOREPORT_128KB                      3
11369   bool                                 DisableRegisterAccesses;
11370   bool                                 SemaphoreWait;
11371   bool                                 RBWait;
11372   uint32_t                             BufferLengthinpages1;
11373};
11374
11375static inline void
11376GEN9_VECS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
11377                               __attribute__((unused)) void * restrict dst,
11378                               __attribute__((unused)) const struct GEN9_VECS_RING_BUFFER_CTL * restrict values)
11379{
11380   uint32_t * restrict dw = (uint32_t * restrict) dst;
11381
11382   dw[0] =
11383      __gen_uint(values->RingBufferEnable, 0, 0) |
11384      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
11385      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
11386      __gen_uint(values->SemaphoreWait, 10, 10) |
11387      __gen_uint(values->RBWait, 11, 11) |
11388      __gen_uint(values->BufferLengthinpages1, 12, 20);
11389}
11390
11391#define GEN9_VS_INVOCATION_COUNT_num      0x2320
11392#define GEN9_VS_INVOCATION_COUNT_length        2
11393struct GEN9_VS_INVOCATION_COUNT {
11394   uint64_t                             VSInvocationCountReport;
11395};
11396
11397static inline void
11398GEN9_VS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
11399                              __attribute__((unused)) void * restrict dst,
11400                              __attribute__((unused)) const struct GEN9_VS_INVOCATION_COUNT * restrict values)
11401{
11402   uint32_t * restrict dw = (uint32_t * restrict) dst;
11403
11404   const uint64_t v0 =
11405      __gen_uint(values->VSInvocationCountReport, 0, 63);
11406   dw[0] = v0;
11407   dw[1] = v0 >> 32;
11408}
11409
11410#endif /* GEN9_PACK_H */
11411