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 HSW.
26 *
27 * This file has been generated, do not hand edit.
28 */
29
30#ifndef GFX75_PACK_H
31#define GFX75_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 __intel_field_functions
44#define __intel_field_functions
45
46#ifdef NDEBUG
47#define NDEBUG_UNUSED __attribute__((unused))
48#else
49#define NDEBUG_UNUSED
50#endif
51
52union __intel_value {
53   float f;
54   uint32_t dw;
55};
56
57static inline __attribute__((always_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 __attribute__((always_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 __attribute__((always_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 __attribute__((always_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 __attribute__((always_inline)) uint64_t
113__gen_address(__gen_user_data *data, void *location,
114              __gen_address_type address, uint32_t delta,
115              __attribute__((unused)) uint32_t start, uint32_t end)
116{
117   uint64_t addr_u64 = __gen_combine_address(data, location, address, delta);
118   if (end == 31) {
119      return addr_u64;
120   } else if (end < 63) {
121      const unsigned shift = 63 - end;
122      return (addr_u64 << shift) >> shift;
123   } else {
124      return addr_u64;
125   }
126}
127
128static inline __attribute__((always_inline)) uint32_t
129__gen_float(float v)
130{
131   __gen_validate_value(v);
132   return ((union __intel_value) { .f = (v) }).dw;
133}
134
135static inline __attribute__((always_inline)) uint64_t
136__gen_sfixed(float v, uint32_t start, uint32_t end, uint32_t fract_bits)
137{
138   __gen_validate_value(v);
139
140   const float factor = (1 << fract_bits);
141
142#ifndef NDEBUG
143   const float max = ((1 << (end - start)) - 1) / factor;
144   const float min = -(1 << (end - start)) / factor;
145   assert(min <= v && v <= max);
146#endif
147
148   const int64_t int_val = llroundf(v * factor);
149   const uint64_t mask = ~0ull >> (64 - (end - start + 1));
150
151   return (int_val & mask) << start;
152}
153
154static inline __attribute__((always_inline)) uint64_t
155__gen_ufixed(float v, uint32_t start, NDEBUG_UNUSED uint32_t end, uint32_t fract_bits)
156{
157   __gen_validate_value(v);
158
159   const float factor = (1 << fract_bits);
160
161#ifndef NDEBUG
162   const float max = ((1 << (end - start + 1)) - 1) / factor;
163   const float min = 0.0f;
164   assert(min <= v && v <= max);
165#endif
166
167   const uint64_t uint_val = llroundf(v * factor);
168
169   return uint_val << start;
170}
171
172#ifndef __gen_address_type
173#error #define __gen_address_type before including this file
174#endif
175
176#ifndef __gen_user_data
177#error #define __gen_combine_address before including this file
178#endif
179
180#undef NDEBUG_UNUSED
181
182#endif
183
184
185enum GFX75_3D_Color_Buffer_Blend_Factor {
186   BLENDFACTOR_ONE                      =      1,
187   BLENDFACTOR_SRC_COLOR                =      2,
188   BLENDFACTOR_SRC_ALPHA                =      3,
189   BLENDFACTOR_DST_ALPHA                =      4,
190   BLENDFACTOR_DST_COLOR                =      5,
191   BLENDFACTOR_SRC_ALPHA_SATURATE       =      6,
192   BLENDFACTOR_CONST_COLOR              =      7,
193   BLENDFACTOR_CONST_ALPHA              =      8,
194   BLENDFACTOR_SRC1_COLOR               =      9,
195   BLENDFACTOR_SRC1_ALPHA               =     10,
196   BLENDFACTOR_ZERO                     =     17,
197   BLENDFACTOR_INV_SRC_COLOR            =     18,
198   BLENDFACTOR_INV_SRC_ALPHA            =     19,
199   BLENDFACTOR_INV_DST_ALPHA            =     20,
200   BLENDFACTOR_INV_DST_COLOR            =     21,
201   BLENDFACTOR_INV_CONST_COLOR          =     23,
202   BLENDFACTOR_INV_CONST_ALPHA          =     24,
203   BLENDFACTOR_INV_SRC1_COLOR           =     25,
204   BLENDFACTOR_INV_SRC1_ALPHA           =     26,
205};
206
207enum GFX75_3D_Color_Buffer_Blend_Function {
208   BLENDFUNCTION_ADD                    =      0,
209   BLENDFUNCTION_SUBTRACT               =      1,
210   BLENDFUNCTION_REVERSE_SUBTRACT       =      2,
211   BLENDFUNCTION_MIN                    =      3,
212   BLENDFUNCTION_MAX                    =      4,
213};
214
215enum GFX75_3D_Compare_Function {
216   COMPAREFUNCTION_ALWAYS               =      0,
217   COMPAREFUNCTION_NEVER                =      1,
218   COMPAREFUNCTION_LESS                 =      2,
219   COMPAREFUNCTION_EQUAL                =      3,
220   COMPAREFUNCTION_LEQUAL               =      4,
221   COMPAREFUNCTION_GREATER              =      5,
222   COMPAREFUNCTION_NOTEQUAL             =      6,
223   COMPAREFUNCTION_GEQUAL               =      7,
224};
225
226enum GFX75_3D_Logic_Op_Function {
227   LOGICOP_CLEAR                        =      0,
228   LOGICOP_NOR                          =      1,
229   LOGICOP_AND_INVERTED                 =      2,
230   LOGICOP_COPY_INVERTED                =      3,
231   LOGICOP_AND_REVERSE                  =      4,
232   LOGICOP_INVERT                       =      5,
233   LOGICOP_XOR                          =      6,
234   LOGICOP_NAND                         =      7,
235   LOGICOP_AND                          =      8,
236   LOGICOP_EQUIV                        =      9,
237   LOGICOP_NOOP                         =     10,
238   LOGICOP_OR_INVERTED                  =     11,
239   LOGICOP_COPY                         =     12,
240   LOGICOP_OR_REVERSE                   =     13,
241   LOGICOP_OR                           =     14,
242   LOGICOP_SET                          =     15,
243};
244
245enum GFX75_3D_Prim_Topo_Type {
246   _3DPRIM_POINTLIST                    =      1,
247   _3DPRIM_LINELIST                     =      2,
248   _3DPRIM_LINESTRIP                    =      3,
249   _3DPRIM_TRILIST                      =      4,
250   _3DPRIM_TRISTRIP                     =      5,
251   _3DPRIM_TRIFAN                       =      6,
252   _3DPRIM_QUADLIST                     =      7,
253   _3DPRIM_QUADSTRIP                    =      8,
254   _3DPRIM_LINELIST_ADJ                 =      9,
255   _3DPRIM_LINESTRIP_ADJ                =     10,
256   _3DPRIM_TRILIST_ADJ                  =     11,
257   _3DPRIM_TRISTRIP_ADJ                 =     12,
258   _3DPRIM_TRISTRIP_REVERSE             =     13,
259   _3DPRIM_POLYGON                      =     14,
260   _3DPRIM_RECTLIST                     =     15,
261   _3DPRIM_LINELOOP                     =     16,
262   _3DPRIM_POINTLIST_BF                 =     17,
263   _3DPRIM_LINESTRIP_CONT               =     18,
264   _3DPRIM_LINESTRIP_BF                 =     19,
265   _3DPRIM_LINESTRIP_CONT_BF            =     20,
266   _3DPRIM_TRIFAN_NOSTIPPLE             =     22,
267   _3DPRIM_PATCHLIST_1                  =     32,
268   _3DPRIM_PATCHLIST_2                  =     33,
269   _3DPRIM_PATCHLIST_3                  =     34,
270   _3DPRIM_PATCHLIST_4                  =     35,
271   _3DPRIM_PATCHLIST_5                  =     36,
272   _3DPRIM_PATCHLIST_6                  =     37,
273   _3DPRIM_PATCHLIST_7                  =     38,
274   _3DPRIM_PATCHLIST_8                  =     39,
275   _3DPRIM_PATCHLIST_9                  =     40,
276   _3DPRIM_PATCHLIST_10                 =     41,
277   _3DPRIM_PATCHLIST_11                 =     42,
278   _3DPRIM_PATCHLIST_12                 =     43,
279   _3DPRIM_PATCHLIST_13                 =     44,
280   _3DPRIM_PATCHLIST_14                 =     45,
281   _3DPRIM_PATCHLIST_15                 =     46,
282   _3DPRIM_PATCHLIST_16                 =     47,
283   _3DPRIM_PATCHLIST_17                 =     48,
284   _3DPRIM_PATCHLIST_18                 =     49,
285   _3DPRIM_PATCHLIST_19                 =     50,
286   _3DPRIM_PATCHLIST_20                 =     51,
287   _3DPRIM_PATCHLIST_21                 =     52,
288   _3DPRIM_PATCHLIST_22                 =     53,
289   _3DPRIM_PATCHLIST_23                 =     54,
290   _3DPRIM_PATCHLIST_24                 =     55,
291   _3DPRIM_PATCHLIST_25                 =     56,
292   _3DPRIM_PATCHLIST_26                 =     57,
293   _3DPRIM_PATCHLIST_27                 =     58,
294   _3DPRIM_PATCHLIST_28                 =     59,
295   _3DPRIM_PATCHLIST_29                 =     60,
296   _3DPRIM_PATCHLIST_30                 =     61,
297   _3DPRIM_PATCHLIST_31                 =     62,
298   _3DPRIM_PATCHLIST_32                 =     63,
299};
300
301enum GFX75_3D_Stencil_Operation {
302   STENCILOP_KEEP                       =      0,
303   STENCILOP_ZERO                       =      1,
304   STENCILOP_REPLACE                    =      2,
305   STENCILOP_INCRSAT                    =      3,
306   STENCILOP_DECRSAT                    =      4,
307   STENCILOP_INCR                       =      5,
308   STENCILOP_DECR                       =      6,
309   STENCILOP_INVERT                     =      7,
310};
311
312enum GFX75_3D_Vertex_Component_Control {
313   VFCOMP_NOSTORE                       =      0,
314   VFCOMP_STORE_SRC                     =      1,
315   VFCOMP_STORE_0                       =      2,
316   VFCOMP_STORE_1_FP                    =      3,
317   VFCOMP_STORE_1_INT                   =      4,
318   VFCOMP_STORE_VID                     =      5,
319   VFCOMP_STORE_IID                     =      6,
320   VFCOMP_STORE_PID                     =      7,
321};
322
323enum GFX75_ShaderChannelSelect {
324   SCS_ZERO                             =      0,
325   SCS_ONE                              =      1,
326   SCS_RED                              =      4,
327   SCS_GREEN                            =      5,
328   SCS_BLUE                             =      6,
329   SCS_ALPHA                            =      7,
330};
331
332enum GFX75_TextureCoordinateMode {
333   TCM_WRAP                             =      0,
334   TCM_MIRROR                           =      1,
335   TCM_CLAMP                            =      2,
336   TCM_CUBE                             =      3,
337   TCM_CLAMP_BORDER                     =      4,
338   TCM_MIRROR_ONCE                      =      5,
339};
340
341#define GFX75_3DSTATE_CONSTANT_BODY_length      6
342struct GFX75_3DSTATE_CONSTANT_BODY {
343   uint32_t                             ReadLength[4];
344   uint32_t                             MOCS;
345   __gen_address_type                   Buffer[4];
346};
347
348static inline __attribute__((always_inline)) void
349GFX75_3DSTATE_CONSTANT_BODY_pack(__attribute__((unused)) __gen_user_data *data,
350                                 __attribute__((unused)) void * restrict dst,
351                                 __attribute__((unused)) const struct GFX75_3DSTATE_CONSTANT_BODY * restrict values)
352{
353   uint32_t * restrict dw = (uint32_t * restrict) dst;
354
355   dw[0] =
356      __gen_uint(values->ReadLength[0], 0, 15) |
357      __gen_uint(values->ReadLength[1], 16, 31);
358
359   dw[1] =
360      __gen_uint(values->ReadLength[2], 0, 15) |
361      __gen_uint(values->ReadLength[3], 16, 31);
362
363   const uint32_t v2 =
364      __gen_uint(values->MOCS, 0, 4);
365   dw[2] = __gen_address(data, &dw[2], values->Buffer[0], v2, 5, 31);
366
367   dw[3] = __gen_address(data, &dw[3], values->Buffer[1], 0, 5, 31);
368
369   dw[4] = __gen_address(data, &dw[4], values->Buffer[2], 0, 5, 31);
370
371   dw[5] = __gen_address(data, &dw[5], values->Buffer[3], 0, 5, 31);
372}
373
374#define GFX75_BINDING_TABLE_EDIT_ENTRY_length      1
375struct GFX75_BINDING_TABLE_EDIT_ENTRY {
376   uint64_t                             SurfaceStatePointer;
377   uint32_t                             BindingTableIndex;
378};
379
380static inline __attribute__((always_inline)) void
381GFX75_BINDING_TABLE_EDIT_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
382                                    __attribute__((unused)) void * restrict dst,
383                                    __attribute__((unused)) const struct GFX75_BINDING_TABLE_EDIT_ENTRY * restrict values)
384{
385   uint32_t * restrict dw = (uint32_t * restrict) dst;
386
387   dw[0] =
388      __gen_offset(values->SurfaceStatePointer, 0, 15) |
389      __gen_uint(values->BindingTableIndex, 16, 23);
390}
391
392#define GFX75_BINDING_TABLE_STATE_length       1
393struct GFX75_BINDING_TABLE_STATE {
394   uint64_t                             SurfaceStatePointer;
395};
396
397static inline __attribute__((always_inline)) void
398GFX75_BINDING_TABLE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
399                               __attribute__((unused)) void * restrict dst,
400                               __attribute__((unused)) const struct GFX75_BINDING_TABLE_STATE * restrict values)
401{
402   uint32_t * restrict dw = (uint32_t * restrict) dst;
403
404   dw[0] =
405      __gen_offset(values->SurfaceStatePointer, 5, 31);
406}
407
408#define GFX75_BLEND_STATE_ENTRY_length         2
409struct GFX75_BLEND_STATE_ENTRY {
410   enum GFX75_3D_Color_Buffer_Blend_Factor DestinationBlendFactor;
411   enum GFX75_3D_Color_Buffer_Blend_Factor SourceBlendFactor;
412   enum GFX75_3D_Color_Buffer_Blend_Function ColorBlendFunction;
413   enum GFX75_3D_Color_Buffer_Blend_Factor DestinationAlphaBlendFactor;
414   enum GFX75_3D_Color_Buffer_Blend_Factor SourceAlphaBlendFactor;
415   enum GFX75_3D_Color_Buffer_Blend_Function AlphaBlendFunction;
416   bool                                 IndependentAlphaBlendEnable;
417   bool                                 ColorBufferBlendEnable;
418   bool                                 PostBlendColorClampEnable;
419   bool                                 PreBlendColorClampEnable;
420   uint32_t                             ColorClampRange;
421#define COLORCLAMP_UNORM                         0
422#define COLORCLAMP_SNORM                         1
423#define COLORCLAMP_RTFORMAT                      2
424   uint32_t                             YDitherOffset;
425   uint32_t                             XDitherOffset;
426   bool                                 ColorDitherEnable;
427   enum GFX75_3D_Compare_Function       AlphaTestFunction;
428   bool                                 AlphaTestEnable;
429   enum GFX75_3D_Logic_Op_Function      LogicOpFunction;
430   bool                                 LogicOpEnable;
431   bool                                 WriteDisableBlue;
432   bool                                 WriteDisableGreen;
433   bool                                 WriteDisableRed;
434   bool                                 WriteDisableAlpha;
435   bool                                 AlphaToCoverageDitherEnable;
436   bool                                 AlphaToOneEnable;
437   bool                                 AlphaToCoverageEnable;
438};
439
440static inline __attribute__((always_inline)) void
441GFX75_BLEND_STATE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
442                             __attribute__((unused)) void * restrict dst,
443                             __attribute__((unused)) const struct GFX75_BLEND_STATE_ENTRY * restrict values)
444{
445   uint32_t * restrict dw = (uint32_t * restrict) dst;
446
447   dw[0] =
448      __gen_uint(values->DestinationBlendFactor, 0, 4) |
449      __gen_uint(values->SourceBlendFactor, 5, 9) |
450      __gen_uint(values->ColorBlendFunction, 11, 13) |
451      __gen_uint(values->DestinationAlphaBlendFactor, 15, 19) |
452      __gen_uint(values->SourceAlphaBlendFactor, 20, 24) |
453      __gen_uint(values->AlphaBlendFunction, 26, 28) |
454      __gen_uint(values->IndependentAlphaBlendEnable, 30, 30) |
455      __gen_uint(values->ColorBufferBlendEnable, 31, 31);
456
457   dw[1] =
458      __gen_uint(values->PostBlendColorClampEnable, 0, 0) |
459      __gen_uint(values->PreBlendColorClampEnable, 1, 1) |
460      __gen_uint(values->ColorClampRange, 2, 3) |
461      __gen_uint(values->YDitherOffset, 8, 9) |
462      __gen_uint(values->XDitherOffset, 10, 11) |
463      __gen_uint(values->ColorDitherEnable, 12, 12) |
464      __gen_uint(values->AlphaTestFunction, 13, 15) |
465      __gen_uint(values->AlphaTestEnable, 16, 16) |
466      __gen_uint(values->LogicOpFunction, 18, 21) |
467      __gen_uint(values->LogicOpEnable, 22, 22) |
468      __gen_uint(values->WriteDisableBlue, 24, 24) |
469      __gen_uint(values->WriteDisableGreen, 25, 25) |
470      __gen_uint(values->WriteDisableRed, 26, 26) |
471      __gen_uint(values->WriteDisableAlpha, 27, 27) |
472      __gen_uint(values->AlphaToCoverageDitherEnable, 29, 29) |
473      __gen_uint(values->AlphaToOneEnable, 30, 30) |
474      __gen_uint(values->AlphaToCoverageEnable, 31, 31);
475}
476
477#define GFX75_BLEND_STATE_length               0
478struct GFX75_BLEND_STATE {
479   /* variable length fields follow */
480};
481
482static inline __attribute__((always_inline)) void
483GFX75_BLEND_STATE_pack(__attribute__((unused)) __gen_user_data *data,
484                       __attribute__((unused)) void * restrict dst,
485                       __attribute__((unused)) const struct GFX75_BLEND_STATE * restrict values)
486{
487}
488
489#define GFX75_CC_VIEWPORT_length               2
490struct GFX75_CC_VIEWPORT {
491   float                                MinimumDepth;
492   float                                MaximumDepth;
493};
494
495static inline __attribute__((always_inline)) void
496GFX75_CC_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
497                       __attribute__((unused)) void * restrict dst,
498                       __attribute__((unused)) const struct GFX75_CC_VIEWPORT * restrict values)
499{
500   uint32_t * restrict dw = (uint32_t * restrict) dst;
501
502   dw[0] =
503      __gen_float(values->MinimumDepth);
504
505   dw[1] =
506      __gen_float(values->MaximumDepth);
507}
508
509#define GFX75_COLOR_CALC_STATE_length          6
510struct GFX75_COLOR_CALC_STATE {
511   uint32_t                             AlphaTestFormat;
512#define ALPHATEST_UNORM8                         0
513#define ALPHATEST_FLOAT32                        1
514   bool                                 RoundDisableFunctionDisable;
515   uint32_t                             BackfaceStencilReferenceValue;
516   uint32_t                             StencilReferenceValue;
517   uint32_t                             AlphaReferenceValueAsUNORM8;
518   float                                AlphaReferenceValueAsFLOAT32;
519   float                                BlendConstantColorRed;
520   float                                BlendConstantColorGreen;
521   float                                BlendConstantColorBlue;
522   float                                BlendConstantColorAlpha;
523};
524
525static inline __attribute__((always_inline)) void
526GFX75_COLOR_CALC_STATE_pack(__attribute__((unused)) __gen_user_data *data,
527                            __attribute__((unused)) void * restrict dst,
528                            __attribute__((unused)) const struct GFX75_COLOR_CALC_STATE * restrict values)
529{
530   uint32_t * restrict dw = (uint32_t * restrict) dst;
531
532   dw[0] =
533      __gen_uint(values->AlphaTestFormat, 0, 0) |
534      __gen_uint(values->RoundDisableFunctionDisable, 15, 15) |
535      __gen_uint(values->BackfaceStencilReferenceValue, 16, 23) |
536      __gen_uint(values->StencilReferenceValue, 24, 31);
537
538   dw[1] =
539      __gen_uint(values->AlphaReferenceValueAsUNORM8, 0, 31) |
540      __gen_float(values->AlphaReferenceValueAsFLOAT32);
541
542   dw[2] =
543      __gen_float(values->BlendConstantColorRed);
544
545   dw[3] =
546      __gen_float(values->BlendConstantColorGreen);
547
548   dw[4] =
549      __gen_float(values->BlendConstantColorBlue);
550
551   dw[5] =
552      __gen_float(values->BlendConstantColorAlpha);
553}
554
555#define GFX75_DEPTH_STENCIL_STATE_length       3
556struct GFX75_DEPTH_STENCIL_STATE {
557   enum GFX75_3D_Stencil_Operation      BackfaceStencilPassDepthPassOp;
558   enum GFX75_3D_Stencil_Operation      BackfaceStencilPassDepthFailOp;
559   enum GFX75_3D_Stencil_Operation      BackfaceStencilFailOp;
560   enum GFX75_3D_Compare_Function       BackfaceStencilTestFunction;
561   bool                                 DoubleSidedStencilEnable;
562   bool                                 StencilBufferWriteEnable;
563   enum GFX75_3D_Stencil_Operation      StencilPassDepthPassOp;
564   enum GFX75_3D_Stencil_Operation      StencilPassDepthFailOp;
565   enum GFX75_3D_Stencil_Operation      StencilFailOp;
566   enum GFX75_3D_Compare_Function       StencilTestFunction;
567   bool                                 StencilTestEnable;
568   uint32_t                             BackfaceStencilWriteMask;
569   uint32_t                             BackfaceStencilTestMask;
570   uint32_t                             StencilWriteMask;
571   uint32_t                             StencilTestMask;
572   bool                                 DepthBufferWriteEnable;
573   enum GFX75_3D_Compare_Function       DepthTestFunction;
574   bool                                 DepthTestEnable;
575};
576
577static inline __attribute__((always_inline)) void
578GFX75_DEPTH_STENCIL_STATE_pack(__attribute__((unused)) __gen_user_data *data,
579                               __attribute__((unused)) void * restrict dst,
580                               __attribute__((unused)) const struct GFX75_DEPTH_STENCIL_STATE * restrict values)
581{
582   uint32_t * restrict dw = (uint32_t * restrict) dst;
583
584   dw[0] =
585      __gen_uint(values->BackfaceStencilPassDepthPassOp, 3, 5) |
586      __gen_uint(values->BackfaceStencilPassDepthFailOp, 6, 8) |
587      __gen_uint(values->BackfaceStencilFailOp, 9, 11) |
588      __gen_uint(values->BackfaceStencilTestFunction, 12, 14) |
589      __gen_uint(values->DoubleSidedStencilEnable, 15, 15) |
590      __gen_uint(values->StencilBufferWriteEnable, 18, 18) |
591      __gen_uint(values->StencilPassDepthPassOp, 19, 21) |
592      __gen_uint(values->StencilPassDepthFailOp, 22, 24) |
593      __gen_uint(values->StencilFailOp, 25, 27) |
594      __gen_uint(values->StencilTestFunction, 28, 30) |
595      __gen_uint(values->StencilTestEnable, 31, 31);
596
597   dw[1] =
598      __gen_uint(values->BackfaceStencilWriteMask, 0, 7) |
599      __gen_uint(values->BackfaceStencilTestMask, 8, 15) |
600      __gen_uint(values->StencilWriteMask, 16, 23) |
601      __gen_uint(values->StencilTestMask, 24, 31);
602
603   dw[2] =
604      __gen_uint(values->DepthBufferWriteEnable, 26, 26) |
605      __gen_uint(values->DepthTestFunction, 27, 29) |
606      __gen_uint(values->DepthTestEnable, 31, 31);
607}
608
609#define GFX75_GATHER_CONSTANT_ENTRY_length      1
610struct GFX75_GATHER_CONSTANT_ENTRY {
611   uint32_t                             BindingTableIndexOffset;
612   uint32_t                             ChannelMask;
613   uint64_t                             ConstantBufferOffset;
614};
615
616static inline __attribute__((always_inline)) void
617GFX75_GATHER_CONSTANT_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
618                                 __attribute__((unused)) void * restrict dst,
619                                 __attribute__((unused)) const struct GFX75_GATHER_CONSTANT_ENTRY * restrict values)
620{
621   uint32_t * restrict dw = (uint32_t * restrict) dst;
622
623   dw[0] =
624      __gen_uint(values->BindingTableIndexOffset, 0, 3) |
625      __gen_uint(values->ChannelMask, 4, 7) |
626      __gen_offset(values->ConstantBufferOffset, 8, 15);
627}
628
629#define GFX75_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT_length      3
630struct GFX75_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT {
631   bool                                 MBErrorConcealmentPSliceWeightPredictionDisable;
632   bool                                 MBErrorConcealmentPSliceMotionVectorsOverrideDisable;
633   bool                                 MBErrorConcealmentBSpatialWeightPredictionDisable;
634   bool                                 MBErrorConcealmentBSpatialMotionVectorsOverrideDisable;
635   uint32_t                             MBErrorConcealmentBSpatialPredictionMode;
636   bool                                 MBHeaderErrorHandling;
637   bool                                 EntropyErrorHandling;
638   bool                                 MPRErrorHandling;
639   bool                                 BSDPrematureCompleteErrorHandling;
640   uint32_t                             ConcealmentPictureID;
641   bool                                 MBErrorConcealmentBTemporalWeightPredictionDisable;
642   bool                                 MBErrorConcealmentBTemporalMotionVectorsOverrideEnable;
643   uint32_t                             MBErrorConcealmentBTemporalPredictionMode;
644   bool                                 IntraPredMode4x48x8LumaErrorControl;
645   uint32_t                             InitCurrentMBNumber;
646   uint32_t                             ConcealmentMethod;
647   uint32_t                             FirstMBBitOffset;
648   bool                                 LastSlice;
649   bool                                 EmulationPreventionBytePresent;
650   bool                                 FixPrevMBSkipped;
651   uint32_t                             FirstMBByteOffsetofSliceDataorSliceHeader;
652   bool                                 IntraPredictionErrorControl;
653   bool                                 Intra8x84x4PredictionErrorConcealmentControl;
654   uint32_t                             BSliceTemporalInterConcealmentMode;
655   uint32_t                             BSliceSpatialInterConcealmentMode;
656   uint32_t                             BSliceInterDirectTypeConcealmentMode;
657   uint32_t                             BSliceConcealmentMode;
658#define IntraConcealment                         1
659#define InterConcealment                         0
660   uint32_t                             PSliceInterConcealmentMode;
661   uint32_t                             PSliceConcealmentMode;
662#define IntraConcealment                         1
663#define InterConcealment                         0
664   uint32_t                             ConcealmentReferencePictureFieldBit;
665   uint32_t                             ISliceConcealmentMode;
666#define IntraConcealment                         1
667#define InterConcealment                         0
668};
669
670static inline __attribute__((always_inline)) void
671GFX75_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
672                                                          __attribute__((unused)) void * restrict dst,
673                                                          __attribute__((unused)) const struct GFX75_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT * restrict values)
674{
675   uint32_t * restrict dw = (uint32_t * restrict) dst;
676
677   dw[0] =
678      __gen_uint(values->MBErrorConcealmentPSliceWeightPredictionDisable, 0, 0) |
679      __gen_uint(values->MBErrorConcealmentPSliceMotionVectorsOverrideDisable, 1, 1) |
680      __gen_uint(values->MBErrorConcealmentBSpatialWeightPredictionDisable, 3, 3) |
681      __gen_uint(values->MBErrorConcealmentBSpatialMotionVectorsOverrideDisable, 4, 4) |
682      __gen_uint(values->MBErrorConcealmentBSpatialPredictionMode, 6, 7) |
683      __gen_uint(values->MBHeaderErrorHandling, 8, 8) |
684      __gen_uint(values->EntropyErrorHandling, 10, 10) |
685      __gen_uint(values->MPRErrorHandling, 12, 12) |
686      __gen_uint(values->BSDPrematureCompleteErrorHandling, 14, 14) |
687      __gen_uint(values->ConcealmentPictureID, 16, 21) |
688      __gen_uint(values->MBErrorConcealmentBTemporalWeightPredictionDisable, 24, 24) |
689      __gen_uint(values->MBErrorConcealmentBTemporalMotionVectorsOverrideEnable, 25, 25) |
690      __gen_uint(values->MBErrorConcealmentBTemporalPredictionMode, 27, 28) |
691      __gen_uint(values->IntraPredMode4x48x8LumaErrorControl, 29, 29) |
692      __gen_uint(values->InitCurrentMBNumber, 30, 30) |
693      __gen_uint(values->ConcealmentMethod, 31, 31);
694
695   dw[1] =
696      __gen_uint(values->FirstMBBitOffset, 0, 2) |
697      __gen_uint(values->LastSlice, 3, 3) |
698      __gen_uint(values->EmulationPreventionBytePresent, 4, 4) |
699      __gen_uint(values->FixPrevMBSkipped, 7, 7) |
700      __gen_uint(values->FirstMBByteOffsetofSliceDataorSliceHeader, 16, 31);
701
702   dw[2] =
703      __gen_uint(values->IntraPredictionErrorControl, 0, 0) |
704      __gen_uint(values->Intra8x84x4PredictionErrorConcealmentControl, 1, 1) |
705      __gen_uint(values->BSliceTemporalInterConcealmentMode, 4, 6) |
706      __gen_uint(values->BSliceSpatialInterConcealmentMode, 8, 10) |
707      __gen_uint(values->BSliceInterDirectTypeConcealmentMode, 12, 13) |
708      __gen_uint(values->BSliceConcealmentMode, 15, 15) |
709      __gen_uint(values->PSliceInterConcealmentMode, 16, 18) |
710      __gen_uint(values->PSliceConcealmentMode, 23, 23) |
711      __gen_uint(values->ConcealmentReferencePictureFieldBit, 24, 29) |
712      __gen_uint(values->ISliceConcealmentMode, 31, 31);
713}
714
715#define GFX75_INTERFACE_DESCRIPTOR_DATA_length      8
716struct GFX75_INTERFACE_DESCRIPTOR_DATA {
717   uint64_t                             KernelStartPointer;
718   bool                                 SoftwareExceptionEnable;
719   bool                                 MaskStackExceptionEnable;
720   bool                                 IllegalOpcodeExceptionEnable;
721   uint32_t                             FloatingPointMode;
722#define IEEE754                                  0
723#define Alternate                                1
724   uint32_t                             ThreadPriority;
725#define NormalPriority                           0
726#define HighPriority                             1
727   bool                                 SingleProgramFlow;
728   uint32_t                             SamplerCount;
729#define Nosamplersused                           0
730#define Between1and4samplersused                 1
731#define Between5and8samplersused                 2
732#define Between9and12samplersused                3
733#define Between13and16samplersused               4
734   uint64_t                             SamplerStatePointer;
735   uint32_t                             BindingTableEntryCount;
736   uint64_t                             BindingTablePointer;
737   uint32_t                             ConstantURBEntryReadLength;
738   uint32_t                             NumberofThreadsinGPGPUThreadGroup;
739   uint32_t                             SharedLocalMemorySize;
740   bool                                 BarrierEnable;
741   uint32_t                             RoundingMode;
742#define RTNE                                     0
743#define RU                                       1
744#define RD                                       2
745#define RTZ                                      3
746   uint32_t                             CrossThreadConstantDataReadLength;
747};
748
749static inline __attribute__((always_inline)) void
750GFX75_INTERFACE_DESCRIPTOR_DATA_pack(__attribute__((unused)) __gen_user_data *data,
751                                     __attribute__((unused)) void * restrict dst,
752                                     __attribute__((unused)) const struct GFX75_INTERFACE_DESCRIPTOR_DATA * restrict values)
753{
754   uint32_t * restrict dw = (uint32_t * restrict) dst;
755
756   dw[0] =
757      __gen_offset(values->KernelStartPointer, 6, 31);
758
759   dw[1] =
760      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
761      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
762      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
763      __gen_uint(values->FloatingPointMode, 16, 16) |
764      __gen_uint(values->ThreadPriority, 17, 17) |
765      __gen_uint(values->SingleProgramFlow, 18, 18);
766
767   dw[2] =
768      __gen_uint(values->SamplerCount, 2, 4) |
769      __gen_offset(values->SamplerStatePointer, 5, 31);
770
771   dw[3] =
772      __gen_uint(values->BindingTableEntryCount, 0, 4) |
773      __gen_offset(values->BindingTablePointer, 5, 15);
774
775   dw[4] =
776      __gen_uint(values->ConstantURBEntryReadLength, 16, 31);
777
778   dw[5] =
779      __gen_uint(values->NumberofThreadsinGPGPUThreadGroup, 0, 7) |
780      __gen_uint(values->SharedLocalMemorySize, 16, 20) |
781      __gen_uint(values->BarrierEnable, 21, 21) |
782      __gen_uint(values->RoundingMode, 22, 23);
783
784   dw[6] =
785      __gen_uint(values->CrossThreadConstantDataReadLength, 0, 7);
786
787   dw[7] = 0;
788}
789
790#define GFX75_MEMORY_OBJECT_CONTROL_STATE_length      1
791struct GFX75_MEMORY_OBJECT_CONTROL_STATE {
792   uint32_t                             L3CacheabilityControlL3CC;
793   uint32_t                             LLCeLLCCacheabilityControlLLCCC;
794};
795
796static inline __attribute__((always_inline)) void
797GFX75_MEMORY_OBJECT_CONTROL_STATE_pack(__attribute__((unused)) __gen_user_data *data,
798                                       __attribute__((unused)) void * restrict dst,
799                                       __attribute__((unused)) const struct GFX75_MEMORY_OBJECT_CONTROL_STATE * restrict values)
800{
801   uint32_t * restrict dw = (uint32_t * restrict) dst;
802
803   dw[0] =
804      __gen_uint(values->L3CacheabilityControlL3CC, 0, 0) |
805      __gen_uint(values->LLCeLLCCacheabilityControlLLCCC, 1, 2);
806}
807
808#define GFX75_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION_length      2
809struct GFX75_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION {
810   uint32_t                             FirstMBBitOffset;
811   bool                                 LastMB;
812   bool                                 LastPicSlice;
813   uint32_t                             SliceConcealmentType;
814   uint32_t                             SliceConcealmentOverride;
815   uint32_t                             MBCount;
816   uint32_t                             SliceVerticalPosition;
817   uint32_t                             SliceHorizontalPosition;
818   uint32_t                             NextSliceHorizontalPosition;
819   uint32_t                             NextSliceVerticalPosition;
820   uint32_t                             QuantizerScaleCode;
821};
822
823static inline __attribute__((always_inline)) void
824GFX75_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION_pack(__attribute__((unused)) __gen_user_data *data,
825                                                        __attribute__((unused)) void * restrict dst,
826                                                        __attribute__((unused)) const struct GFX75_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION * restrict values)
827{
828   uint32_t * restrict dw = (uint32_t * restrict) dst;
829
830   dw[0] =
831      __gen_uint(values->FirstMBBitOffset, 0, 2) |
832      __gen_uint(values->LastMB, 3, 3) |
833      __gen_uint(values->LastPicSlice, 5, 5) |
834      __gen_uint(values->SliceConcealmentType, 6, 6) |
835      __gen_uint(values->SliceConcealmentOverride, 7, 7) |
836      __gen_uint(values->MBCount, 8, 15) |
837      __gen_uint(values->SliceVerticalPosition, 16, 23) |
838      __gen_uint(values->SliceHorizontalPosition, 24, 31);
839
840   dw[1] =
841      __gen_uint(values->NextSliceHorizontalPosition, 0, 7) |
842      __gen_uint(values->NextSliceVerticalPosition, 8, 16) |
843      __gen_uint(values->QuantizerScaleCode, 24, 28);
844}
845
846#define GFX75_MI_MATH_ALU_INSTRUCTION_length      1
847struct GFX75_MI_MATH_ALU_INSTRUCTION {
848   uint32_t                             Operand2;
849#define MI_ALU_REG0                              0
850#define MI_ALU_REG1                              1
851#define MI_ALU_REG2                              2
852#define MI_ALU_REG3                              3
853#define MI_ALU_REG4                              4
854#define MI_ALU_REG5                              5
855#define MI_ALU_REG6                              6
856#define MI_ALU_REG7                              7
857#define MI_ALU_REG8                              8
858#define MI_ALU_REG9                              9
859#define MI_ALU_REG10                             10
860#define MI_ALU_REG11                             11
861#define MI_ALU_REG12                             12
862#define MI_ALU_REG13                             13
863#define MI_ALU_REG14                             14
864#define MI_ALU_REG15                             15
865#define MI_ALU_SRCA                              32
866#define MI_ALU_SRCB                              33
867#define MI_ALU_ACCU                              49
868#define MI_ALU_ZF                                50
869#define MI_ALU_CF                                51
870   uint32_t                             Operand1;
871#define MI_ALU_REG0                              0
872#define MI_ALU_REG1                              1
873#define MI_ALU_REG2                              2
874#define MI_ALU_REG3                              3
875#define MI_ALU_REG4                              4
876#define MI_ALU_REG5                              5
877#define MI_ALU_REG6                              6
878#define MI_ALU_REG7                              7
879#define MI_ALU_REG8                              8
880#define MI_ALU_REG9                              9
881#define MI_ALU_REG10                             10
882#define MI_ALU_REG11                             11
883#define MI_ALU_REG12                             12
884#define MI_ALU_REG13                             13
885#define MI_ALU_REG14                             14
886#define MI_ALU_REG15                             15
887#define MI_ALU_SRCA                              32
888#define MI_ALU_SRCB                              33
889#define MI_ALU_ACCU                              49
890#define MI_ALU_ZF                                50
891#define MI_ALU_CF                                51
892   uint32_t                             ALUOpcode;
893#define MI_ALU_NOOP                              0
894#define MI_ALU_LOAD                              128
895#define MI_ALU_LOADINV                           1152
896#define MI_ALU_LOAD0                             129
897#define MI_ALU_LOAD1                             1153
898#define MI_ALU_ADD                               256
899#define MI_ALU_SUB                               257
900#define MI_ALU_AND                               258
901#define MI_ALU_OR                                259
902#define MI_ALU_XOR                               260
903#define MI_ALU_STORE                             384
904#define MI_ALU_STOREINV                          1408
905};
906
907static inline __attribute__((always_inline)) void
908GFX75_MI_MATH_ALU_INSTRUCTION_pack(__attribute__((unused)) __gen_user_data *data,
909                                   __attribute__((unused)) void * restrict dst,
910                                   __attribute__((unused)) const struct GFX75_MI_MATH_ALU_INSTRUCTION * restrict values)
911{
912   uint32_t * restrict dw = (uint32_t * restrict) dst;
913
914   dw[0] =
915      __gen_uint(values->Operand2, 0, 9) |
916      __gen_uint(values->Operand1, 10, 19) |
917      __gen_uint(values->ALUOpcode, 20, 31);
918}
919
920#define GFX75_PALETTE_ENTRY_length             1
921struct GFX75_PALETTE_ENTRY {
922   uint32_t                             Blue;
923   uint32_t                             Green;
924   uint32_t                             Red;
925   uint32_t                             Alpha;
926};
927
928static inline __attribute__((always_inline)) void
929GFX75_PALETTE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
930                         __attribute__((unused)) void * restrict dst,
931                         __attribute__((unused)) const struct GFX75_PALETTE_ENTRY * restrict values)
932{
933   uint32_t * restrict dw = (uint32_t * restrict) dst;
934
935   dw[0] =
936      __gen_uint(values->Blue, 0, 7) |
937      __gen_uint(values->Green, 8, 15) |
938      __gen_uint(values->Red, 16, 23) |
939      __gen_uint(values->Alpha, 24, 31);
940}
941
942#define GFX75_RENDER_SURFACE_STATE_length      8
943struct GFX75_RENDER_SURFACE_STATE {
944   bool                                 CubeFaceEnablePositiveZ;
945   bool                                 CubeFaceEnableNegativeZ;
946   bool                                 CubeFaceEnablePositiveY;
947   bool                                 CubeFaceEnableNegativeY;
948   bool                                 CubeFaceEnablePositiveX;
949   bool                                 CubeFaceEnableNegativeX;
950   uint32_t                             MediaBoundaryPixelMode;
951#define NORMAL_MODE                              0
952#define PROGRESSIVE_FRAME                        2
953#define INTERLACED_FRAME                         3
954   uint32_t                             RenderCacheReadWriteMode;
955   uint32_t                             SurfaceArraySpacing;
956#define ARYSPC_FULL                              0
957#define ARYSPC_LOD0                              1
958   uint32_t                             VerticalLineStrideOffset;
959   uint32_t                             VerticalLineStride;
960   uint32_t                             TileWalk;
961#define TILEWALK_XMAJOR                          0
962#define TILEWALK_YMAJOR                          1
963   bool                                 TiledSurface;
964   uint32_t                             SurfaceHorizontalAlignment;
965#define HALIGN_4                                 0
966#define HALIGN_8                                 1
967   uint32_t                             SurfaceVerticalAlignment;
968#define VALIGN_2                                 0
969#define VALIGN_4                                 1
970   uint32_t                             SurfaceFormat;
971   bool                                 SurfaceArray;
972   uint32_t                             SurfaceType;
973#define SURFTYPE_1D                              0
974#define SURFTYPE_2D                              1
975#define SURFTYPE_3D                              2
976#define SURFTYPE_CUBE                            3
977#define SURFTYPE_BUFFER                          4
978#define SURFTYPE_STRBUF                          5
979#define SURFTYPE_NULL                            7
980   __gen_address_type                   SurfaceBaseAddress;
981   uint32_t                             Width;
982   uint32_t                             Height;
983   uint32_t                             SurfacePitch;
984   uint32_t                             IntegerSurfaceFormat;
985   uint32_t                             Depth;
986   uint32_t                             MultisamplePositionPaletteIndex;
987   uint32_t                             StrbufMinimumArrayElement;
988   uint32_t                             NumberofMultisamples;
989#define MULTISAMPLECOUNT_1                       0
990#define MULTISAMPLECOUNT_4                       2
991#define MULTISAMPLECOUNT_8                       3
992   uint32_t                             MultisampledSurfaceStorageFormat;
993#define MSFMT_MSS                                0
994#define MSFMT_DEPTH_STENCIL                      1
995   uint32_t                             RenderTargetViewExtent;
996   uint32_t                             MinimumArrayElement;
997   uint32_t                             RenderTargetRotation;
998#define RTROTATE_0DEG                            0
999#define RTROTATE_90DEG                           1
1000#define RTROTATE_270DEG                          3
1001   uint32_t                             MIPCountLOD;
1002   uint32_t                             SurfaceMinLOD;
1003   uint32_t                             MOCS;
1004   uint32_t                             YOffset;
1005   uint32_t                             XOffset;
1006   bool                                 MCSEnable;
1007   uint32_t                             YOffsetforUVPlane;
1008   bool                                 AppendCounterEnable;
1009   uint32_t                             AuxiliarySurfacePitch;
1010   __gen_address_type                   AppendCounterAddress;
1011   __gen_address_type                   AuxiliarySurfaceBaseAddress;
1012   uint32_t                             XOffsetforUVPlane;
1013   uint32_t                             ReservedMBZ;
1014   float                                ResourceMinLOD;
1015   enum GFX75_ShaderChannelSelect       ShaderChannelSelectAlpha;
1016   enum GFX75_ShaderChannelSelect       ShaderChannelSelectBlue;
1017   enum GFX75_ShaderChannelSelect       ShaderChannelSelectGreen;
1018   enum GFX75_ShaderChannelSelect       ShaderChannelSelectRed;
1019   uint32_t                             AlphaClearColor;
1020   uint32_t                             BlueClearColor;
1021   uint32_t                             GreenClearColor;
1022   uint32_t                             RedClearColor;
1023};
1024
1025static inline __attribute__((always_inline)) void
1026GFX75_RENDER_SURFACE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
1027                                __attribute__((unused)) void * restrict dst,
1028                                __attribute__((unused)) const struct GFX75_RENDER_SURFACE_STATE * restrict values)
1029{
1030   uint32_t * restrict dw = (uint32_t * restrict) dst;
1031
1032   dw[0] =
1033      __gen_uint(values->CubeFaceEnablePositiveZ, 0, 0) |
1034      __gen_uint(values->CubeFaceEnableNegativeZ, 1, 1) |
1035      __gen_uint(values->CubeFaceEnablePositiveY, 2, 2) |
1036      __gen_uint(values->CubeFaceEnableNegativeY, 3, 3) |
1037      __gen_uint(values->CubeFaceEnablePositiveX, 4, 4) |
1038      __gen_uint(values->CubeFaceEnableNegativeX, 5, 5) |
1039      __gen_uint(values->MediaBoundaryPixelMode, 6, 7) |
1040      __gen_uint(values->RenderCacheReadWriteMode, 8, 8) |
1041      __gen_uint(values->SurfaceArraySpacing, 10, 10) |
1042      __gen_uint(values->VerticalLineStrideOffset, 11, 11) |
1043      __gen_uint(values->VerticalLineStride, 12, 12) |
1044      __gen_uint(values->TileWalk, 13, 13) |
1045      __gen_uint(values->TiledSurface, 14, 14) |
1046      __gen_uint(values->SurfaceHorizontalAlignment, 15, 15) |
1047      __gen_uint(values->SurfaceVerticalAlignment, 16, 17) |
1048      __gen_uint(values->SurfaceFormat, 18, 26) |
1049      __gen_uint(values->SurfaceArray, 28, 28) |
1050      __gen_uint(values->SurfaceType, 29, 31);
1051
1052   dw[1] = __gen_address(data, &dw[1], values->SurfaceBaseAddress, 0, 0, 31);
1053
1054   dw[2] =
1055      __gen_uint(values->Width, 0, 13) |
1056      __gen_uint(values->Height, 16, 29);
1057
1058   dw[3] =
1059      __gen_uint(values->SurfacePitch, 0, 17) |
1060      __gen_uint(values->IntegerSurfaceFormat, 18, 20) |
1061      __gen_uint(values->Depth, 21, 31);
1062
1063   dw[4] =
1064      __gen_uint(values->MultisamplePositionPaletteIndex, 0, 2) |
1065      __gen_uint(values->StrbufMinimumArrayElement, 0, 26) |
1066      __gen_uint(values->NumberofMultisamples, 3, 5) |
1067      __gen_uint(values->MultisampledSurfaceStorageFormat, 6, 6) |
1068      __gen_uint(values->RenderTargetViewExtent, 7, 17) |
1069      __gen_uint(values->MinimumArrayElement, 18, 28) |
1070      __gen_uint(values->RenderTargetRotation, 29, 30);
1071
1072   dw[5] =
1073      __gen_uint(values->MIPCountLOD, 0, 3) |
1074      __gen_uint(values->SurfaceMinLOD, 4, 7) |
1075      __gen_uint(values->MOCS, 16, 19) |
1076      __gen_uint(values->YOffset, 20, 23) |
1077      __gen_uint(values->XOffset, 25, 31);
1078
1079   const uint32_t v6 =
1080      __gen_uint(values->MCSEnable, 0, 0) |
1081      __gen_uint(values->YOffsetforUVPlane, 0, 13) |
1082      __gen_uint(values->AppendCounterEnable, 1, 1) |
1083      __gen_uint(values->AuxiliarySurfacePitch, 3, 11) |
1084      __gen_uint(values->XOffsetforUVPlane, 16, 29) |
1085      __gen_uint(values->ReservedMBZ, 30, 31);
1086   dw[6] = __gen_address(data, &dw[6], values->AuxiliarySurfaceBaseAddress, v6, 12, 31);
1087
1088   dw[7] =
1089      __gen_ufixed(values->ResourceMinLOD, 0, 11, 8) |
1090      __gen_uint(values->ShaderChannelSelectAlpha, 16, 18) |
1091      __gen_uint(values->ShaderChannelSelectBlue, 19, 21) |
1092      __gen_uint(values->ShaderChannelSelectGreen, 22, 24) |
1093      __gen_uint(values->ShaderChannelSelectRed, 25, 27) |
1094      __gen_uint(values->AlphaClearColor, 28, 28) |
1095      __gen_uint(values->BlueClearColor, 29, 29) |
1096      __gen_uint(values->GreenClearColor, 30, 30) |
1097      __gen_uint(values->RedClearColor, 31, 31);
1098}
1099
1100#define GFX75_SAMPLER_BORDER_COLOR_STATE_length     20
1101struct GFX75_SAMPLER_BORDER_COLOR_STATE {
1102   float                                BorderColorFloatRed;
1103   float                                BorderColorFloatGreen;
1104   float                                BorderColorFloatBlue;
1105   float                                BorderColorFloatAlpha;
1106   uint32_t                             BorderColor8bitRed;
1107   uint32_t                             BorderColor16bitRed;
1108   uint32_t                             BorderColor32bitRed;
1109   uint32_t                             BorderColor8bitGreen;
1110   uint32_t                             BorderColor8bitBlue;
1111   uint32_t                             BorderColor16bitGreen;
1112   uint32_t                             BorderColor8bitAlpha;
1113   uint32_t                             BorderColor32bitGreen;
1114   uint32_t                             BorderColor16bitBlue;
1115   uint32_t                             BorderColor32bitBlue;
1116   uint32_t                             BorderColor16bitAlpha;
1117   uint32_t                             BorderColor32bitAlpha;
1118};
1119
1120static inline __attribute__((always_inline)) void
1121GFX75_SAMPLER_BORDER_COLOR_STATE_pack(__attribute__((unused)) __gen_user_data *data,
1122                                      __attribute__((unused)) void * restrict dst,
1123                                      __attribute__((unused)) const struct GFX75_SAMPLER_BORDER_COLOR_STATE * restrict values)
1124{
1125   uint32_t * restrict dw = (uint32_t * restrict) dst;
1126
1127   dw[0] =
1128      __gen_float(values->BorderColorFloatRed);
1129
1130   dw[1] =
1131      __gen_float(values->BorderColorFloatGreen);
1132
1133   dw[2] =
1134      __gen_float(values->BorderColorFloatBlue);
1135
1136   dw[3] =
1137      __gen_float(values->BorderColorFloatAlpha);
1138
1139   dw[4] = 0;
1140
1141   dw[5] = 0;
1142
1143   dw[6] = 0;
1144
1145   dw[7] = 0;
1146
1147   dw[8] = 0;
1148
1149   dw[9] = 0;
1150
1151   dw[10] = 0;
1152
1153   dw[11] = 0;
1154
1155   dw[12] = 0;
1156
1157   dw[13] = 0;
1158
1159   dw[14] = 0;
1160
1161   dw[15] = 0;
1162
1163   dw[16] =
1164      __gen_uint(values->BorderColor8bitRed, 0, 7) |
1165      __gen_uint(values->BorderColor16bitRed, 0, 15) |
1166      __gen_uint(values->BorderColor32bitRed, 0, 31) |
1167      __gen_uint(values->BorderColor8bitGreen, 8, 15) |
1168      __gen_uint(values->BorderColor8bitBlue, 16, 23) |
1169      __gen_uint(values->BorderColor16bitGreen, 16, 31) |
1170      __gen_uint(values->BorderColor8bitAlpha, 24, 31);
1171
1172   dw[17] =
1173      __gen_uint(values->BorderColor32bitGreen, 0, 31);
1174
1175   dw[18] =
1176      __gen_uint(values->BorderColor16bitBlue, 0, 15) |
1177      __gen_uint(values->BorderColor32bitBlue, 0, 31) |
1178      __gen_uint(values->BorderColor16bitAlpha, 16, 31);
1179
1180   dw[19] =
1181      __gen_uint(values->BorderColor32bitAlpha, 0, 31);
1182}
1183
1184#define GFX75_SAMPLER_STATE_length             4
1185struct GFX75_SAMPLER_STATE {
1186   uint32_t                             AnisotropicAlgorithm;
1187#define LEGACY                                   0
1188#define EWAApproximation                         1
1189   float                                TextureLODBias;
1190   uint32_t                             MinModeFilter;
1191#define MAPFILTER_NEAREST                        0
1192#define MAPFILTER_LINEAR                         1
1193#define MAPFILTER_ANISOTROPIC                    2
1194#define MAPFILTER_MONO                           6
1195   uint32_t                             MagModeFilter;
1196#define MAPFILTER_NEAREST                        0
1197#define MAPFILTER_LINEAR                         1
1198#define MAPFILTER_ANISOTROPIC                    2
1199#define MAPFILTER_MONO                           6
1200   uint32_t                             MipModeFilter;
1201#define MIPFILTER_NONE                           0
1202#define MIPFILTER_NEAREST                        1
1203#define MIPFILTER_LINEAR                         3
1204   float                                BaseMipLevel;
1205   uint32_t                             LODPreClampEnable;
1206#define CLAMP_ENABLE_OGL                         1
1207   uint32_t                             TextureBorderColorMode;
1208#define DX10OGL                                  0
1209#define DX9                                      1
1210   bool                                 SamplerDisable;
1211   uint32_t                             CubeSurfaceControlMode;
1212#define PROGRAMMED                               0
1213#define OVERRIDE                                 1
1214   uint32_t                             ShadowFunction;
1215#define PREFILTEROP_ALWAYS                       0
1216#define PREFILTEROP_NEVER                        1
1217#define PREFILTEROP_LESS                         2
1218#define PREFILTEROP_EQUAL                        3
1219#define PREFILTEROP_LEQUAL                       4
1220#define PREFILTEROP_GREATER                      5
1221#define PREFILTEROP_NOTEQUAL                     6
1222#define PREFILTEROP_GEQUAL                       7
1223   float                                MaxLOD;
1224   float                                MinLOD;
1225   uint64_t                             BorderColorPointer;
1226   enum GFX75_TextureCoordinateMode     TCZAddressControlMode;
1227   enum GFX75_TextureCoordinateMode     TCYAddressControlMode;
1228   enum GFX75_TextureCoordinateMode     TCXAddressControlMode;
1229   bool                                 NonnormalizedCoordinateEnable;
1230   uint32_t                             TrilinearFilterQuality;
1231#define FULL                                     0
1232#define TRIQUAL_HIGHMAG_CLAMP_MIPFILTER          1
1233#define MED                                      2
1234#define LOW                                      3
1235   bool                                 RAddressMinFilterRoundingEnable;
1236   bool                                 RAddressMagFilterRoundingEnable;
1237   bool                                 VAddressMinFilterRoundingEnable;
1238   bool                                 VAddressMagFilterRoundingEnable;
1239   bool                                 UAddressMinFilterRoundingEnable;
1240   bool                                 UAddressMagFilterRoundingEnable;
1241   uint32_t                             MaximumAnisotropy;
1242#define RATIO21                                  0
1243#define RATIO41                                  1
1244#define RATIO61                                  2
1245#define RATIO81                                  3
1246#define RATIO101                                 4
1247#define RATIO121                                 5
1248#define RATIO141                                 6
1249#define RATIO161                                 7
1250   uint32_t                             ChromaKeyMode;
1251#define KEYFILTER_KILL_ON_ANY_MATCH              0
1252#define KEYFILTER_REPLACE_BLACK                  1
1253   uint32_t                             ChromaKeyIndex;
1254   bool                                 ChromaKeyEnable;
1255};
1256
1257static inline __attribute__((always_inline)) void
1258GFX75_SAMPLER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
1259                         __attribute__((unused)) void * restrict dst,
1260                         __attribute__((unused)) const struct GFX75_SAMPLER_STATE * restrict values)
1261{
1262   uint32_t * restrict dw = (uint32_t * restrict) dst;
1263
1264   dw[0] =
1265      __gen_uint(values->AnisotropicAlgorithm, 0, 0) |
1266      __gen_sfixed(values->TextureLODBias, 1, 13, 8) |
1267      __gen_uint(values->MinModeFilter, 14, 16) |
1268      __gen_uint(values->MagModeFilter, 17, 19) |
1269      __gen_uint(values->MipModeFilter, 20, 21) |
1270      __gen_ufixed(values->BaseMipLevel, 22, 26, 1) |
1271      __gen_uint(values->LODPreClampEnable, 28, 28) |
1272      __gen_uint(values->TextureBorderColorMode, 29, 29) |
1273      __gen_uint(values->SamplerDisable, 31, 31);
1274
1275   dw[1] =
1276      __gen_uint(values->CubeSurfaceControlMode, 0, 0) |
1277      __gen_uint(values->ShadowFunction, 1, 3) |
1278      __gen_ufixed(values->MaxLOD, 8, 19, 8) |
1279      __gen_ufixed(values->MinLOD, 20, 31, 8);
1280
1281   dw[2] =
1282      __gen_offset(values->BorderColorPointer, 5, 31);
1283
1284   dw[3] =
1285      __gen_uint(values->TCZAddressControlMode, 0, 2) |
1286      __gen_uint(values->TCYAddressControlMode, 3, 5) |
1287      __gen_uint(values->TCXAddressControlMode, 6, 8) |
1288      __gen_uint(values->NonnormalizedCoordinateEnable, 10, 10) |
1289      __gen_uint(values->TrilinearFilterQuality, 11, 12) |
1290      __gen_uint(values->RAddressMinFilterRoundingEnable, 13, 13) |
1291      __gen_uint(values->RAddressMagFilterRoundingEnable, 14, 14) |
1292      __gen_uint(values->VAddressMinFilterRoundingEnable, 15, 15) |
1293      __gen_uint(values->VAddressMagFilterRoundingEnable, 16, 16) |
1294      __gen_uint(values->UAddressMinFilterRoundingEnable, 17, 17) |
1295      __gen_uint(values->UAddressMagFilterRoundingEnable, 18, 18) |
1296      __gen_uint(values->MaximumAnisotropy, 19, 21) |
1297      __gen_uint(values->ChromaKeyMode, 22, 22) |
1298      __gen_uint(values->ChromaKeyIndex, 23, 24) |
1299      __gen_uint(values->ChromaKeyEnable, 25, 25);
1300}
1301
1302#define GFX75_SCISSOR_RECT_length              2
1303struct GFX75_SCISSOR_RECT {
1304   uint32_t                             ScissorRectangleXMin;
1305   uint32_t                             ScissorRectangleYMin;
1306   uint32_t                             ScissorRectangleXMax;
1307   uint32_t                             ScissorRectangleYMax;
1308};
1309
1310static inline __attribute__((always_inline)) void
1311GFX75_SCISSOR_RECT_pack(__attribute__((unused)) __gen_user_data *data,
1312                        __attribute__((unused)) void * restrict dst,
1313                        __attribute__((unused)) const struct GFX75_SCISSOR_RECT * restrict values)
1314{
1315   uint32_t * restrict dw = (uint32_t * restrict) dst;
1316
1317   dw[0] =
1318      __gen_uint(values->ScissorRectangleXMin, 0, 15) |
1319      __gen_uint(values->ScissorRectangleYMin, 16, 31);
1320
1321   dw[1] =
1322      __gen_uint(values->ScissorRectangleXMax, 0, 15) |
1323      __gen_uint(values->ScissorRectangleYMax, 16, 31);
1324}
1325
1326#define GFX75_SF_CLIP_VIEWPORT_length         16
1327struct GFX75_SF_CLIP_VIEWPORT {
1328   float                                ViewportMatrixElementm00;
1329   float                                ViewportMatrixElementm11;
1330   float                                ViewportMatrixElementm22;
1331   float                                ViewportMatrixElementm30;
1332   float                                ViewportMatrixElementm31;
1333   float                                ViewportMatrixElementm32;
1334   float                                XMinClipGuardband;
1335   float                                XMaxClipGuardband;
1336   float                                YMinClipGuardband;
1337   float                                YMaxClipGuardband;
1338};
1339
1340static inline __attribute__((always_inline)) void
1341GFX75_SF_CLIP_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
1342                            __attribute__((unused)) void * restrict dst,
1343                            __attribute__((unused)) const struct GFX75_SF_CLIP_VIEWPORT * restrict values)
1344{
1345   uint32_t * restrict dw = (uint32_t * restrict) dst;
1346
1347   dw[0] =
1348      __gen_float(values->ViewportMatrixElementm00);
1349
1350   dw[1] =
1351      __gen_float(values->ViewportMatrixElementm11);
1352
1353   dw[2] =
1354      __gen_float(values->ViewportMatrixElementm22);
1355
1356   dw[3] =
1357      __gen_float(values->ViewportMatrixElementm30);
1358
1359   dw[4] =
1360      __gen_float(values->ViewportMatrixElementm31);
1361
1362   dw[5] =
1363      __gen_float(values->ViewportMatrixElementm32);
1364
1365   dw[6] = 0;
1366
1367   dw[7] = 0;
1368
1369   dw[8] =
1370      __gen_float(values->XMinClipGuardband);
1371
1372   dw[9] =
1373      __gen_float(values->XMaxClipGuardband);
1374
1375   dw[10] =
1376      __gen_float(values->YMinClipGuardband);
1377
1378   dw[11] =
1379      __gen_float(values->YMaxClipGuardband);
1380
1381   dw[12] = 0;
1382
1383   dw[13] = 0;
1384
1385   dw[14] = 0;
1386
1387   dw[15] = 0;
1388}
1389
1390#define GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL_length      1
1391struct GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL {
1392   uint32_t                             SourceAttribute;
1393   uint32_t                             SwizzleSelect;
1394#define INPUTATTR                                0
1395#define INPUTATTR_FACING                         1
1396#define INPUTATTR_W                              2
1397#define INPUTATTR_FACING_W                       3
1398   uint32_t                             ConstantSource;
1399#define CONST_0000                               0
1400#define CONST_0001_FLOAT                         1
1401#define CONST_1111_FLOAT                         2
1402#define PRIM_ID                                  3
1403   uint32_t                             SwizzleControlMode;
1404   bool                                 ComponentOverrideX;
1405   bool                                 ComponentOverrideY;
1406   bool                                 ComponentOverrideZ;
1407   bool                                 ComponentOverrideW;
1408};
1409
1410static inline __attribute__((always_inline)) void
1411GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(__attribute__((unused)) __gen_user_data *data,
1412                                      __attribute__((unused)) void * restrict dst,
1413                                      __attribute__((unused)) const struct GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL * restrict values)
1414{
1415   uint32_t * restrict dw = (uint32_t * restrict) dst;
1416
1417   dw[0] =
1418      __gen_uint(values->SourceAttribute, 0, 4) |
1419      __gen_uint(values->SwizzleSelect, 6, 7) |
1420      __gen_uint(values->ConstantSource, 9, 10) |
1421      __gen_uint(values->SwizzleControlMode, 11, 11) |
1422      __gen_uint(values->ComponentOverrideX, 12, 12) |
1423      __gen_uint(values->ComponentOverrideY, 13, 13) |
1424      __gen_uint(values->ComponentOverrideZ, 14, 14) |
1425      __gen_uint(values->ComponentOverrideW, 15, 15);
1426}
1427
1428#define GFX75_SO_DECL_length                   1
1429struct GFX75_SO_DECL {
1430   uint32_t                             ComponentMask;
1431   uint32_t                             RegisterIndex;
1432   bool                                 HoleFlag;
1433   uint32_t                             OutputBufferSlot;
1434};
1435
1436static inline __attribute__((always_inline)) void
1437GFX75_SO_DECL_pack(__attribute__((unused)) __gen_user_data *data,
1438                   __attribute__((unused)) void * restrict dst,
1439                   __attribute__((unused)) const struct GFX75_SO_DECL * restrict values)
1440{
1441   uint32_t * restrict dw = (uint32_t * restrict) dst;
1442
1443   dw[0] =
1444      __gen_uint(values->ComponentMask, 0, 3) |
1445      __gen_uint(values->RegisterIndex, 4, 9) |
1446      __gen_uint(values->HoleFlag, 11, 11) |
1447      __gen_uint(values->OutputBufferSlot, 12, 13);
1448}
1449
1450#define GFX75_SO_DECL_ENTRY_length             2
1451struct GFX75_SO_DECL_ENTRY {
1452   struct GFX75_SO_DECL                 Stream0Decl;
1453   struct GFX75_SO_DECL                 Stream1Decl;
1454   struct GFX75_SO_DECL                 Stream2Decl;
1455   struct GFX75_SO_DECL                 Stream3Decl;
1456};
1457
1458static inline __attribute__((always_inline)) void
1459GFX75_SO_DECL_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
1460                         __attribute__((unused)) void * restrict dst,
1461                         __attribute__((unused)) const struct GFX75_SO_DECL_ENTRY * restrict values)
1462{
1463   uint32_t * restrict dw = (uint32_t * restrict) dst;
1464
1465   uint32_t v0_0;
1466   GFX75_SO_DECL_pack(data, &v0_0, &values->Stream0Decl);
1467
1468   uint32_t v0_1;
1469   GFX75_SO_DECL_pack(data, &v0_1, &values->Stream1Decl);
1470
1471   dw[0] =
1472      __gen_uint(v0_0, 0, 15) |
1473      __gen_uint(v0_1, 16, 31);
1474
1475   uint32_t v1_0;
1476   GFX75_SO_DECL_pack(data, &v1_0, &values->Stream2Decl);
1477
1478   uint32_t v1_1;
1479   GFX75_SO_DECL_pack(data, &v1_1, &values->Stream3Decl);
1480
1481   dw[1] =
1482      __gen_uint(v1_0, 0, 15) |
1483      __gen_uint(v1_1, 16, 31);
1484}
1485
1486#define GFX75_VERTEX_BUFFER_STATE_length       4
1487struct GFX75_VERTEX_BUFFER_STATE {
1488   uint32_t                             BufferPitch;
1489   bool                                 VertexFetchInvalidate;
1490   bool                                 NullVertexBuffer;
1491   bool                                 AddressModifyEnable;
1492   uint32_t                             MOCS;
1493   uint32_t                             BufferAccessType;
1494#define VERTEXDATA                               0
1495#define INSTANCEDATA                             1
1496   uint32_t                             VertexBufferIndex;
1497   __gen_address_type                   BufferStartingAddress;
1498   __gen_address_type                   EndAddress;
1499   uint32_t                             InstanceDataStepRate;
1500};
1501
1502static inline __attribute__((always_inline)) void
1503GFX75_VERTEX_BUFFER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
1504                               __attribute__((unused)) void * restrict dst,
1505                               __attribute__((unused)) const struct GFX75_VERTEX_BUFFER_STATE * restrict values)
1506{
1507   uint32_t * restrict dw = (uint32_t * restrict) dst;
1508
1509   dw[0] =
1510      __gen_uint(values->BufferPitch, 0, 11) |
1511      __gen_uint(values->VertexFetchInvalidate, 12, 12) |
1512      __gen_uint(values->NullVertexBuffer, 13, 13) |
1513      __gen_uint(values->AddressModifyEnable, 14, 14) |
1514      __gen_uint(values->MOCS, 16, 19) |
1515      __gen_uint(values->BufferAccessType, 20, 20) |
1516      __gen_uint(values->VertexBufferIndex, 26, 31);
1517
1518   dw[1] = __gen_address(data, &dw[1], values->BufferStartingAddress, 0, 0, 31);
1519
1520   dw[2] = __gen_address(data, &dw[2], values->EndAddress, 0, 0, 31);
1521
1522   dw[3] =
1523      __gen_uint(values->InstanceDataStepRate, 0, 31);
1524}
1525
1526#define GFX75_VERTEX_ELEMENT_STATE_length      2
1527struct GFX75_VERTEX_ELEMENT_STATE {
1528   uint32_t                             SourceElementOffset;
1529   bool                                 EdgeFlagEnable;
1530   uint32_t                             SourceElementFormat;
1531   bool                                 Valid;
1532   uint32_t                             VertexBufferIndex;
1533   enum GFX75_3D_Vertex_Component_Control Component3Control;
1534   enum GFX75_3D_Vertex_Component_Control Component2Control;
1535   enum GFX75_3D_Vertex_Component_Control Component1Control;
1536   enum GFX75_3D_Vertex_Component_Control Component0Control;
1537};
1538
1539static inline __attribute__((always_inline)) void
1540GFX75_VERTEX_ELEMENT_STATE_pack(__attribute__((unused)) __gen_user_data *data,
1541                                __attribute__((unused)) void * restrict dst,
1542                                __attribute__((unused)) const struct GFX75_VERTEX_ELEMENT_STATE * restrict values)
1543{
1544   uint32_t * restrict dw = (uint32_t * restrict) dst;
1545
1546   dw[0] =
1547      __gen_uint(values->SourceElementOffset, 0, 11) |
1548      __gen_uint(values->EdgeFlagEnable, 15, 15) |
1549      __gen_uint(values->SourceElementFormat, 16, 24) |
1550      __gen_uint(values->Valid, 25, 25) |
1551      __gen_uint(values->VertexBufferIndex, 26, 31);
1552
1553   dw[1] =
1554      __gen_uint(values->Component3Control, 16, 18) |
1555      __gen_uint(values->Component2Control, 20, 22) |
1556      __gen_uint(values->Component1Control, 24, 26) |
1557      __gen_uint(values->Component0Control, 28, 30);
1558}
1559
1560#define GFX75_3DPRIMITIVE_length               7
1561#define GFX75_3DPRIMITIVE_length_bias          2
1562#define GFX75_3DPRIMITIVE_header                \
1563   .DWordLength                         =      5,  \
1564   ._3DCommandSubOpcode                 =      0,  \
1565   ._3DCommandOpcode                    =      3,  \
1566   .CommandSubType                      =      3,  \
1567   .CommandType                         =      3
1568
1569struct GFX75_3DPRIMITIVE {
1570   uint32_t                             DWordLength;
1571   bool                                 PredicateEnable;
1572   bool                                 UAVCoherencyRequired;
1573   bool                                 IndirectParameterEnable;
1574   uint32_t                             _3DCommandSubOpcode;
1575   uint32_t                             _3DCommandOpcode;
1576   uint32_t                             CommandSubType;
1577   uint32_t                             CommandType;
1578   enum GFX75_3D_Prim_Topo_Type         PrimitiveTopologyType;
1579   uint32_t                             VertexAccessType;
1580#define SEQUENTIAL                               0
1581#define RANDOM                                   1
1582   bool                                 EndOffsetEnable;
1583   uint32_t                             VertexCountPerInstance;
1584   uint32_t                             StartVertexLocation;
1585   uint32_t                             InstanceCount;
1586   uint32_t                             StartInstanceLocation;
1587   int32_t                              BaseVertexLocation;
1588};
1589
1590static inline __attribute__((always_inline)) void
1591GFX75_3DPRIMITIVE_pack(__attribute__((unused)) __gen_user_data *data,
1592                       __attribute__((unused)) void * restrict dst,
1593                       __attribute__((unused)) const struct GFX75_3DPRIMITIVE * restrict values)
1594{
1595   uint32_t * restrict dw = (uint32_t * restrict) dst;
1596
1597   dw[0] =
1598      __gen_uint(values->DWordLength, 0, 7) |
1599      __gen_uint(values->PredicateEnable, 8, 8) |
1600      __gen_uint(values->UAVCoherencyRequired, 9, 9) |
1601      __gen_uint(values->IndirectParameterEnable, 10, 10) |
1602      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1603      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1604      __gen_uint(values->CommandSubType, 27, 28) |
1605      __gen_uint(values->CommandType, 29, 31);
1606
1607   dw[1] =
1608      __gen_uint(values->PrimitiveTopologyType, 0, 5) |
1609      __gen_uint(values->VertexAccessType, 8, 8) |
1610      __gen_uint(values->EndOffsetEnable, 9, 9);
1611
1612   dw[2] =
1613      __gen_uint(values->VertexCountPerInstance, 0, 31);
1614
1615   dw[3] =
1616      __gen_uint(values->StartVertexLocation, 0, 31);
1617
1618   dw[4] =
1619      __gen_uint(values->InstanceCount, 0, 31);
1620
1621   dw[5] =
1622      __gen_uint(values->StartInstanceLocation, 0, 31);
1623
1624   dw[6] =
1625      __gen_sint(values->BaseVertexLocation, 0, 31);
1626}
1627
1628#define GFX75_3DSTATE_AA_LINE_PARAMETERS_length      3
1629#define GFX75_3DSTATE_AA_LINE_PARAMETERS_length_bias      2
1630#define GFX75_3DSTATE_AA_LINE_PARAMETERS_header \
1631   .DWordLength                         =      1,  \
1632   ._3DCommandSubOpcode                 =     10,  \
1633   ._3DCommandOpcode                    =      1,  \
1634   .CommandSubType                      =      3,  \
1635   .CommandType                         =      3
1636
1637struct GFX75_3DSTATE_AA_LINE_PARAMETERS {
1638   uint32_t                             DWordLength;
1639   uint32_t                             _3DCommandSubOpcode;
1640   uint32_t                             _3DCommandOpcode;
1641   uint32_t                             CommandSubType;
1642   uint32_t                             CommandType;
1643   float                                AACoverageSlope;
1644   float                                AACoverageBias;
1645   float                                AACoverageEndCapSlope;
1646   float                                AACoverageEndCapBias;
1647};
1648
1649static inline __attribute__((always_inline)) void
1650GFX75_3DSTATE_AA_LINE_PARAMETERS_pack(__attribute__((unused)) __gen_user_data *data,
1651                                      __attribute__((unused)) void * restrict dst,
1652                                      __attribute__((unused)) const struct GFX75_3DSTATE_AA_LINE_PARAMETERS * restrict values)
1653{
1654   uint32_t * restrict dw = (uint32_t * restrict) dst;
1655
1656   dw[0] =
1657      __gen_uint(values->DWordLength, 0, 7) |
1658      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1659      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1660      __gen_uint(values->CommandSubType, 27, 28) |
1661      __gen_uint(values->CommandType, 29, 31);
1662
1663   dw[1] =
1664      __gen_ufixed(values->AACoverageSlope, 0, 7, 8) |
1665      __gen_ufixed(values->AACoverageBias, 16, 23, 8);
1666
1667   dw[2] =
1668      __gen_ufixed(values->AACoverageEndCapSlope, 0, 7, 8) |
1669      __gen_ufixed(values->AACoverageEndCapBias, 16, 23, 8);
1670}
1671
1672#define GFX75_3DSTATE_BINDING_TABLE_EDIT_DS_length_bias      2
1673#define GFX75_3DSTATE_BINDING_TABLE_EDIT_DS_header\
1674   .DWordLength                         =      0,  \
1675   ._3DCommandSubOpcode                 =     70,  \
1676   ._3DCommandOpcode                    =      0,  \
1677   .CommandSubType                      =      3,  \
1678   .CommandType                         =      3
1679
1680struct GFX75_3DSTATE_BINDING_TABLE_EDIT_DS {
1681   uint32_t                             DWordLength;
1682   uint32_t                             _3DCommandSubOpcode;
1683   uint32_t                             _3DCommandOpcode;
1684   uint32_t                             CommandSubType;
1685   uint32_t                             CommandType;
1686   uint32_t                             BindingTableEditTarget;
1687#define AllCores                                 3
1688#define Core1                                    2
1689#define Core0                                    1
1690   uint32_t                             BindingTableBlockClear;
1691   /* variable length fields follow */
1692};
1693
1694static inline __attribute__((always_inline)) void
1695GFX75_3DSTATE_BINDING_TABLE_EDIT_DS_pack(__attribute__((unused)) __gen_user_data *data,
1696                                         __attribute__((unused)) void * restrict dst,
1697                                         __attribute__((unused)) const struct GFX75_3DSTATE_BINDING_TABLE_EDIT_DS * restrict values)
1698{
1699   uint32_t * restrict dw = (uint32_t * restrict) dst;
1700
1701   dw[0] =
1702      __gen_uint(values->DWordLength, 0, 8) |
1703      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1704      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1705      __gen_uint(values->CommandSubType, 27, 28) |
1706      __gen_uint(values->CommandType, 29, 31);
1707
1708   dw[1] =
1709      __gen_uint(values->BindingTableEditTarget, 0, 1) |
1710      __gen_uint(values->BindingTableBlockClear, 16, 31);
1711}
1712
1713#define GFX75_3DSTATE_BINDING_TABLE_EDIT_GS_length_bias      2
1714#define GFX75_3DSTATE_BINDING_TABLE_EDIT_GS_header\
1715   .DWordLength                         =      0,  \
1716   ._3DCommandSubOpcode                 =     68,  \
1717   ._3DCommandOpcode                    =      0,  \
1718   .CommandSubType                      =      3,  \
1719   .CommandType                         =      3
1720
1721struct GFX75_3DSTATE_BINDING_TABLE_EDIT_GS {
1722   uint32_t                             DWordLength;
1723   uint32_t                             _3DCommandSubOpcode;
1724   uint32_t                             _3DCommandOpcode;
1725   uint32_t                             CommandSubType;
1726   uint32_t                             CommandType;
1727   uint32_t                             BindingTableEditTarget;
1728#define AllCores                                 3
1729#define Core1                                    2
1730#define Core0                                    1
1731   uint32_t                             BindingTableBlockClear;
1732   /* variable length fields follow */
1733};
1734
1735static inline __attribute__((always_inline)) void
1736GFX75_3DSTATE_BINDING_TABLE_EDIT_GS_pack(__attribute__((unused)) __gen_user_data *data,
1737                                         __attribute__((unused)) void * restrict dst,
1738                                         __attribute__((unused)) const struct GFX75_3DSTATE_BINDING_TABLE_EDIT_GS * restrict values)
1739{
1740   uint32_t * restrict dw = (uint32_t * restrict) dst;
1741
1742   dw[0] =
1743      __gen_uint(values->DWordLength, 0, 8) |
1744      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1745      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1746      __gen_uint(values->CommandSubType, 27, 28) |
1747      __gen_uint(values->CommandType, 29, 31);
1748
1749   dw[1] =
1750      __gen_uint(values->BindingTableEditTarget, 0, 1) |
1751      __gen_uint(values->BindingTableBlockClear, 16, 31);
1752}
1753
1754#define GFX75_3DSTATE_BINDING_TABLE_EDIT_HS_length_bias      2
1755#define GFX75_3DSTATE_BINDING_TABLE_EDIT_HS_header\
1756   .DWordLength                         =      0,  \
1757   ._3DCommandSubOpcode                 =     69,  \
1758   ._3DCommandOpcode                    =      0,  \
1759   .CommandSubType                      =      3,  \
1760   .CommandType                         =      3
1761
1762struct GFX75_3DSTATE_BINDING_TABLE_EDIT_HS {
1763   uint32_t                             DWordLength;
1764   uint32_t                             _3DCommandSubOpcode;
1765   uint32_t                             _3DCommandOpcode;
1766   uint32_t                             CommandSubType;
1767   uint32_t                             CommandType;
1768   uint32_t                             BindingTableEditTarget;
1769#define AllCores                                 3
1770#define Core1                                    2
1771#define Core0                                    1
1772   uint32_t                             BindingTableBlockClear;
1773   /* variable length fields follow */
1774};
1775
1776static inline __attribute__((always_inline)) void
1777GFX75_3DSTATE_BINDING_TABLE_EDIT_HS_pack(__attribute__((unused)) __gen_user_data *data,
1778                                         __attribute__((unused)) void * restrict dst,
1779                                         __attribute__((unused)) const struct GFX75_3DSTATE_BINDING_TABLE_EDIT_HS * restrict values)
1780{
1781   uint32_t * restrict dw = (uint32_t * restrict) dst;
1782
1783   dw[0] =
1784      __gen_uint(values->DWordLength, 0, 8) |
1785      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1786      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1787      __gen_uint(values->CommandSubType, 27, 28) |
1788      __gen_uint(values->CommandType, 29, 31);
1789
1790   dw[1] =
1791      __gen_uint(values->BindingTableEditTarget, 0, 1) |
1792      __gen_uint(values->BindingTableBlockClear, 16, 31);
1793}
1794
1795#define GFX75_3DSTATE_BINDING_TABLE_EDIT_PS_length_bias      2
1796#define GFX75_3DSTATE_BINDING_TABLE_EDIT_PS_header\
1797   .DWordLength                         =      0,  \
1798   ._3DCommandSubOpcode                 =     71,  \
1799   ._3DCommandOpcode                    =      0,  \
1800   .CommandSubType                      =      3,  \
1801   .CommandType                         =      3
1802
1803struct GFX75_3DSTATE_BINDING_TABLE_EDIT_PS {
1804   uint32_t                             DWordLength;
1805   uint32_t                             _3DCommandSubOpcode;
1806   uint32_t                             _3DCommandOpcode;
1807   uint32_t                             CommandSubType;
1808   uint32_t                             CommandType;
1809   uint32_t                             BindingTableEditTarget;
1810#define AllCores                                 3
1811#define Core1                                    2
1812#define Core0                                    1
1813   uint32_t                             BindingTableBlockClear;
1814   /* variable length fields follow */
1815};
1816
1817static inline __attribute__((always_inline)) void
1818GFX75_3DSTATE_BINDING_TABLE_EDIT_PS_pack(__attribute__((unused)) __gen_user_data *data,
1819                                         __attribute__((unused)) void * restrict dst,
1820                                         __attribute__((unused)) const struct GFX75_3DSTATE_BINDING_TABLE_EDIT_PS * restrict values)
1821{
1822   uint32_t * restrict dw = (uint32_t * restrict) dst;
1823
1824   dw[0] =
1825      __gen_uint(values->DWordLength, 0, 8) |
1826      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1827      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1828      __gen_uint(values->CommandSubType, 27, 28) |
1829      __gen_uint(values->CommandType, 29, 31);
1830
1831   dw[1] =
1832      __gen_uint(values->BindingTableEditTarget, 0, 1) |
1833      __gen_uint(values->BindingTableBlockClear, 16, 31);
1834}
1835
1836#define GFX75_3DSTATE_BINDING_TABLE_EDIT_VS_length_bias      2
1837#define GFX75_3DSTATE_BINDING_TABLE_EDIT_VS_header\
1838   .DWordLength                         =      0,  \
1839   ._3DCommandSubOpcode                 =     67,  \
1840   ._3DCommandOpcode                    =      0,  \
1841   .CommandSubType                      =      3,  \
1842   .CommandType                         =      3
1843
1844struct GFX75_3DSTATE_BINDING_TABLE_EDIT_VS {
1845   uint32_t                             DWordLength;
1846   uint32_t                             _3DCommandSubOpcode;
1847   uint32_t                             _3DCommandOpcode;
1848   uint32_t                             CommandSubType;
1849   uint32_t                             CommandType;
1850   uint32_t                             BindingTableEditTarget;
1851#define AllCores                                 3
1852#define Core1                                    2
1853#define Core0                                    1
1854   uint32_t                             BindingTableBlockClear;
1855   /* variable length fields follow */
1856};
1857
1858static inline __attribute__((always_inline)) void
1859GFX75_3DSTATE_BINDING_TABLE_EDIT_VS_pack(__attribute__((unused)) __gen_user_data *data,
1860                                         __attribute__((unused)) void * restrict dst,
1861                                         __attribute__((unused)) const struct GFX75_3DSTATE_BINDING_TABLE_EDIT_VS * restrict values)
1862{
1863   uint32_t * restrict dw = (uint32_t * restrict) dst;
1864
1865   dw[0] =
1866      __gen_uint(values->DWordLength, 0, 8) |
1867      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1868      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1869      __gen_uint(values->CommandSubType, 27, 28) |
1870      __gen_uint(values->CommandType, 29, 31);
1871
1872   dw[1] =
1873      __gen_uint(values->BindingTableEditTarget, 0, 1) |
1874      __gen_uint(values->BindingTableBlockClear, 16, 31);
1875}
1876
1877#define GFX75_3DSTATE_BINDING_TABLE_POINTERS_DS_length      2
1878#define GFX75_3DSTATE_BINDING_TABLE_POINTERS_DS_length_bias      2
1879#define GFX75_3DSTATE_BINDING_TABLE_POINTERS_DS_header\
1880   .DWordLength                         =      0,  \
1881   ._3DCommandSubOpcode                 =     40,  \
1882   ._3DCommandOpcode                    =      0,  \
1883   .CommandSubType                      =      3,  \
1884   .CommandType                         =      3
1885
1886struct GFX75_3DSTATE_BINDING_TABLE_POINTERS_DS {
1887   uint32_t                             DWordLength;
1888   uint32_t                             _3DCommandSubOpcode;
1889   uint32_t                             _3DCommandOpcode;
1890   uint32_t                             CommandSubType;
1891   uint32_t                             CommandType;
1892   uint64_t                             PointertoDSBindingTable;
1893};
1894
1895static inline __attribute__((always_inline)) void
1896GFX75_3DSTATE_BINDING_TABLE_POINTERS_DS_pack(__attribute__((unused)) __gen_user_data *data,
1897                                             __attribute__((unused)) void * restrict dst,
1898                                             __attribute__((unused)) const struct GFX75_3DSTATE_BINDING_TABLE_POINTERS_DS * restrict values)
1899{
1900   uint32_t * restrict dw = (uint32_t * restrict) dst;
1901
1902   dw[0] =
1903      __gen_uint(values->DWordLength, 0, 7) |
1904      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1905      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1906      __gen_uint(values->CommandSubType, 27, 28) |
1907      __gen_uint(values->CommandType, 29, 31);
1908
1909   dw[1] =
1910      __gen_offset(values->PointertoDSBindingTable, 5, 15);
1911}
1912
1913#define GFX75_3DSTATE_BINDING_TABLE_POINTERS_GS_length      2
1914#define GFX75_3DSTATE_BINDING_TABLE_POINTERS_GS_length_bias      2
1915#define GFX75_3DSTATE_BINDING_TABLE_POINTERS_GS_header\
1916   .DWordLength                         =      0,  \
1917   ._3DCommandSubOpcode                 =     41,  \
1918   ._3DCommandOpcode                    =      0,  \
1919   .CommandSubType                      =      3,  \
1920   .CommandType                         =      3
1921
1922struct GFX75_3DSTATE_BINDING_TABLE_POINTERS_GS {
1923   uint32_t                             DWordLength;
1924   uint32_t                             _3DCommandSubOpcode;
1925   uint32_t                             _3DCommandOpcode;
1926   uint32_t                             CommandSubType;
1927   uint32_t                             CommandType;
1928   uint64_t                             PointertoGSBindingTable;
1929};
1930
1931static inline __attribute__((always_inline)) void
1932GFX75_3DSTATE_BINDING_TABLE_POINTERS_GS_pack(__attribute__((unused)) __gen_user_data *data,
1933                                             __attribute__((unused)) void * restrict dst,
1934                                             __attribute__((unused)) const struct GFX75_3DSTATE_BINDING_TABLE_POINTERS_GS * restrict values)
1935{
1936   uint32_t * restrict dw = (uint32_t * restrict) dst;
1937
1938   dw[0] =
1939      __gen_uint(values->DWordLength, 0, 7) |
1940      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1941      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1942      __gen_uint(values->CommandSubType, 27, 28) |
1943      __gen_uint(values->CommandType, 29, 31);
1944
1945   dw[1] =
1946      __gen_offset(values->PointertoGSBindingTable, 5, 15);
1947}
1948
1949#define GFX75_3DSTATE_BINDING_TABLE_POINTERS_HS_length      2
1950#define GFX75_3DSTATE_BINDING_TABLE_POINTERS_HS_length_bias      2
1951#define GFX75_3DSTATE_BINDING_TABLE_POINTERS_HS_header\
1952   .DWordLength                         =      0,  \
1953   ._3DCommandSubOpcode                 =     39,  \
1954   ._3DCommandOpcode                    =      0,  \
1955   .CommandSubType                      =      3,  \
1956   .CommandType                         =      3
1957
1958struct GFX75_3DSTATE_BINDING_TABLE_POINTERS_HS {
1959   uint32_t                             DWordLength;
1960   uint32_t                             _3DCommandSubOpcode;
1961   uint32_t                             _3DCommandOpcode;
1962   uint32_t                             CommandSubType;
1963   uint32_t                             CommandType;
1964   uint64_t                             PointertoHSBindingTable;
1965};
1966
1967static inline __attribute__((always_inline)) void
1968GFX75_3DSTATE_BINDING_TABLE_POINTERS_HS_pack(__attribute__((unused)) __gen_user_data *data,
1969                                             __attribute__((unused)) void * restrict dst,
1970                                             __attribute__((unused)) const struct GFX75_3DSTATE_BINDING_TABLE_POINTERS_HS * restrict values)
1971{
1972   uint32_t * restrict dw = (uint32_t * restrict) dst;
1973
1974   dw[0] =
1975      __gen_uint(values->DWordLength, 0, 7) |
1976      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1977      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1978      __gen_uint(values->CommandSubType, 27, 28) |
1979      __gen_uint(values->CommandType, 29, 31);
1980
1981   dw[1] =
1982      __gen_offset(values->PointertoHSBindingTable, 5, 15);
1983}
1984
1985#define GFX75_3DSTATE_BINDING_TABLE_POINTERS_PS_length      2
1986#define GFX75_3DSTATE_BINDING_TABLE_POINTERS_PS_length_bias      2
1987#define GFX75_3DSTATE_BINDING_TABLE_POINTERS_PS_header\
1988   .DWordLength                         =      0,  \
1989   ._3DCommandSubOpcode                 =     42,  \
1990   ._3DCommandOpcode                    =      0,  \
1991   .CommandSubType                      =      3,  \
1992   .CommandType                         =      3
1993
1994struct GFX75_3DSTATE_BINDING_TABLE_POINTERS_PS {
1995   uint32_t                             DWordLength;
1996   uint32_t                             _3DCommandSubOpcode;
1997   uint32_t                             _3DCommandOpcode;
1998   uint32_t                             CommandSubType;
1999   uint32_t                             CommandType;
2000   uint64_t                             PointertoPSBindingTable;
2001};
2002
2003static inline __attribute__((always_inline)) void
2004GFX75_3DSTATE_BINDING_TABLE_POINTERS_PS_pack(__attribute__((unused)) __gen_user_data *data,
2005                                             __attribute__((unused)) void * restrict dst,
2006                                             __attribute__((unused)) const struct GFX75_3DSTATE_BINDING_TABLE_POINTERS_PS * restrict values)
2007{
2008   uint32_t * restrict dw = (uint32_t * restrict) dst;
2009
2010   dw[0] =
2011      __gen_uint(values->DWordLength, 0, 7) |
2012      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2013      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2014      __gen_uint(values->CommandSubType, 27, 28) |
2015      __gen_uint(values->CommandType, 29, 31);
2016
2017   dw[1] =
2018      __gen_offset(values->PointertoPSBindingTable, 5, 15);
2019}
2020
2021#define GFX75_3DSTATE_BINDING_TABLE_POINTERS_VS_length      2
2022#define GFX75_3DSTATE_BINDING_TABLE_POINTERS_VS_length_bias      2
2023#define GFX75_3DSTATE_BINDING_TABLE_POINTERS_VS_header\
2024   .DWordLength                         =      0,  \
2025   ._3DCommandSubOpcode                 =     38,  \
2026   ._3DCommandOpcode                    =      0,  \
2027   .CommandSubType                      =      3,  \
2028   .CommandType                         =      3
2029
2030struct GFX75_3DSTATE_BINDING_TABLE_POINTERS_VS {
2031   uint32_t                             DWordLength;
2032   uint32_t                             _3DCommandSubOpcode;
2033   uint32_t                             _3DCommandOpcode;
2034   uint32_t                             CommandSubType;
2035   uint32_t                             CommandType;
2036   uint64_t                             PointertoVSBindingTable;
2037};
2038
2039static inline __attribute__((always_inline)) void
2040GFX75_3DSTATE_BINDING_TABLE_POINTERS_VS_pack(__attribute__((unused)) __gen_user_data *data,
2041                                             __attribute__((unused)) void * restrict dst,
2042                                             __attribute__((unused)) const struct GFX75_3DSTATE_BINDING_TABLE_POINTERS_VS * restrict values)
2043{
2044   uint32_t * restrict dw = (uint32_t * restrict) dst;
2045
2046   dw[0] =
2047      __gen_uint(values->DWordLength, 0, 7) |
2048      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2049      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2050      __gen_uint(values->CommandSubType, 27, 28) |
2051      __gen_uint(values->CommandType, 29, 31);
2052
2053   dw[1] =
2054      __gen_offset(values->PointertoVSBindingTable, 5, 15);
2055}
2056
2057#define GFX75_3DSTATE_BINDING_TABLE_POOL_ALLOC_length      3
2058#define GFX75_3DSTATE_BINDING_TABLE_POOL_ALLOC_length_bias      2
2059#define GFX75_3DSTATE_BINDING_TABLE_POOL_ALLOC_header\
2060   .DWordLength                         =      1,  \
2061   ._3DCommandSubOpcode                 =     25,  \
2062   ._3DCommandOpcode                    =      1,  \
2063   .CommandSubType                      =      3,  \
2064   .CommandType                         =      3
2065
2066struct GFX75_3DSTATE_BINDING_TABLE_POOL_ALLOC {
2067   uint32_t                             DWordLength;
2068   uint32_t                             _3DCommandSubOpcode;
2069   uint32_t                             _3DCommandOpcode;
2070   uint32_t                             CommandSubType;
2071   uint32_t                             CommandType;
2072   uint32_t                             MOCS;
2073   bool                                 BindingTablePoolEnable;
2074   __gen_address_type                   BindingTablePoolBaseAddress;
2075   __gen_address_type                   BindingTablePoolUpperBound;
2076};
2077
2078static inline __attribute__((always_inline)) void
2079GFX75_3DSTATE_BINDING_TABLE_POOL_ALLOC_pack(__attribute__((unused)) __gen_user_data *data,
2080                                            __attribute__((unused)) void * restrict dst,
2081                                            __attribute__((unused)) const struct GFX75_3DSTATE_BINDING_TABLE_POOL_ALLOC * restrict values)
2082{
2083   uint32_t * restrict dw = (uint32_t * restrict) dst;
2084
2085   dw[0] =
2086      __gen_uint(values->DWordLength, 0, 7) |
2087      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2088      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2089      __gen_uint(values->CommandSubType, 27, 28) |
2090      __gen_uint(values->CommandType, 29, 31);
2091
2092   const uint32_t v1 =
2093      __gen_uint(values->MOCS, 7, 10) |
2094      __gen_uint(values->BindingTablePoolEnable, 11, 11);
2095   dw[1] = __gen_address(data, &dw[1], values->BindingTablePoolBaseAddress, v1, 12, 31);
2096
2097   dw[2] = __gen_address(data, &dw[2], values->BindingTablePoolUpperBound, 0, 12, 31);
2098}
2099
2100#define GFX75_3DSTATE_BLEND_STATE_POINTERS_length      2
2101#define GFX75_3DSTATE_BLEND_STATE_POINTERS_length_bias      2
2102#define GFX75_3DSTATE_BLEND_STATE_POINTERS_header\
2103   .DWordLength                         =      0,  \
2104   ._3DCommandSubOpcode                 =     36,  \
2105   ._3DCommandOpcode                    =      0,  \
2106   .CommandSubType                      =      3,  \
2107   .CommandType                         =      3
2108
2109struct GFX75_3DSTATE_BLEND_STATE_POINTERS {
2110   uint32_t                             DWordLength;
2111   uint32_t                             _3DCommandSubOpcode;
2112   uint32_t                             _3DCommandOpcode;
2113   uint32_t                             CommandSubType;
2114   uint32_t                             CommandType;
2115   uint64_t                             BlendStatePointer;
2116};
2117
2118static inline __attribute__((always_inline)) void
2119GFX75_3DSTATE_BLEND_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
2120                                        __attribute__((unused)) void * restrict dst,
2121                                        __attribute__((unused)) const struct GFX75_3DSTATE_BLEND_STATE_POINTERS * restrict values)
2122{
2123   uint32_t * restrict dw = (uint32_t * restrict) dst;
2124
2125   dw[0] =
2126      __gen_uint(values->DWordLength, 0, 7) |
2127      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2128      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2129      __gen_uint(values->CommandSubType, 27, 28) |
2130      __gen_uint(values->CommandType, 29, 31);
2131
2132   dw[1] =
2133      __gen_mbo(0, 0) |
2134      __gen_offset(values->BlendStatePointer, 6, 31);
2135}
2136
2137#define GFX75_3DSTATE_CC_STATE_POINTERS_length      2
2138#define GFX75_3DSTATE_CC_STATE_POINTERS_length_bias      2
2139#define GFX75_3DSTATE_CC_STATE_POINTERS_header  \
2140   .DWordLength                         =      0,  \
2141   ._3DCommandSubOpcode                 =     14,  \
2142   ._3DCommandOpcode                    =      0,  \
2143   .CommandSubType                      =      3,  \
2144   .CommandType                         =      3
2145
2146struct GFX75_3DSTATE_CC_STATE_POINTERS {
2147   uint32_t                             DWordLength;
2148   uint32_t                             _3DCommandSubOpcode;
2149   uint32_t                             _3DCommandOpcode;
2150   uint32_t                             CommandSubType;
2151   uint32_t                             CommandType;
2152   uint64_t                             ColorCalcStatePointer;
2153};
2154
2155static inline __attribute__((always_inline)) void
2156GFX75_3DSTATE_CC_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
2157                                     __attribute__((unused)) void * restrict dst,
2158                                     __attribute__((unused)) const struct GFX75_3DSTATE_CC_STATE_POINTERS * restrict values)
2159{
2160   uint32_t * restrict dw = (uint32_t * restrict) dst;
2161
2162   dw[0] =
2163      __gen_uint(values->DWordLength, 0, 7) |
2164      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2165      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2166      __gen_uint(values->CommandSubType, 27, 28) |
2167      __gen_uint(values->CommandType, 29, 31);
2168
2169   dw[1] =
2170      __gen_mbo(0, 0) |
2171      __gen_offset(values->ColorCalcStatePointer, 6, 31);
2172}
2173
2174#define GFX75_3DSTATE_CHROMA_KEY_length        4
2175#define GFX75_3DSTATE_CHROMA_KEY_length_bias      2
2176#define GFX75_3DSTATE_CHROMA_KEY_header         \
2177   .DWordLength                         =      2,  \
2178   ._3DCommandSubOpcode                 =      4,  \
2179   ._3DCommandOpcode                    =      1,  \
2180   .CommandSubType                      =      3,  \
2181   .CommandType                         =      3
2182
2183struct GFX75_3DSTATE_CHROMA_KEY {
2184   uint32_t                             DWordLength;
2185   uint32_t                             _3DCommandSubOpcode;
2186   uint32_t                             _3DCommandOpcode;
2187   uint32_t                             CommandSubType;
2188   uint32_t                             CommandType;
2189   uint32_t                             ChromaKeyTableIndex;
2190   uint32_t                             ChromaKeyLowValue;
2191   uint32_t                             ChromaKeyHighValue;
2192};
2193
2194static inline __attribute__((always_inline)) void
2195GFX75_3DSTATE_CHROMA_KEY_pack(__attribute__((unused)) __gen_user_data *data,
2196                              __attribute__((unused)) void * restrict dst,
2197                              __attribute__((unused)) const struct GFX75_3DSTATE_CHROMA_KEY * restrict values)
2198{
2199   uint32_t * restrict dw = (uint32_t * restrict) dst;
2200
2201   dw[0] =
2202      __gen_uint(values->DWordLength, 0, 7) |
2203      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2204      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2205      __gen_uint(values->CommandSubType, 27, 28) |
2206      __gen_uint(values->CommandType, 29, 31);
2207
2208   dw[1] =
2209      __gen_uint(values->ChromaKeyTableIndex, 30, 31);
2210
2211   dw[2] =
2212      __gen_uint(values->ChromaKeyLowValue, 0, 31);
2213
2214   dw[3] =
2215      __gen_uint(values->ChromaKeyHighValue, 0, 31);
2216}
2217
2218#define GFX75_3DSTATE_CLEAR_PARAMS_length      3
2219#define GFX75_3DSTATE_CLEAR_PARAMS_length_bias      2
2220#define GFX75_3DSTATE_CLEAR_PARAMS_header       \
2221   .DWordLength                         =      1,  \
2222   ._3DCommandSubOpcode                 =      4,  \
2223   ._3DCommandOpcode                    =      0,  \
2224   .CommandSubType                      =      3,  \
2225   .CommandType                         =      3
2226
2227struct GFX75_3DSTATE_CLEAR_PARAMS {
2228   uint32_t                             DWordLength;
2229   uint32_t                             _3DCommandSubOpcode;
2230   uint32_t                             _3DCommandOpcode;
2231   uint32_t                             CommandSubType;
2232   uint32_t                             CommandType;
2233   uint32_t                             DepthClearValue;
2234   bool                                 DepthClearValueValid;
2235};
2236
2237static inline __attribute__((always_inline)) void
2238GFX75_3DSTATE_CLEAR_PARAMS_pack(__attribute__((unused)) __gen_user_data *data,
2239                                __attribute__((unused)) void * restrict dst,
2240                                __attribute__((unused)) const struct GFX75_3DSTATE_CLEAR_PARAMS * restrict values)
2241{
2242   uint32_t * restrict dw = (uint32_t * restrict) dst;
2243
2244   dw[0] =
2245      __gen_uint(values->DWordLength, 0, 7) |
2246      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2247      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2248      __gen_uint(values->CommandSubType, 27, 28) |
2249      __gen_uint(values->CommandType, 29, 31);
2250
2251   dw[1] =
2252      __gen_uint(values->DepthClearValue, 0, 31);
2253
2254   dw[2] =
2255      __gen_uint(values->DepthClearValueValid, 0, 0);
2256}
2257
2258#define GFX75_3DSTATE_CLIP_length              4
2259#define GFX75_3DSTATE_CLIP_length_bias         2
2260#define GFX75_3DSTATE_CLIP_header               \
2261   .DWordLength                         =      2,  \
2262   ._3DCommandSubOpcode                 =     18,  \
2263   ._3DCommandOpcode                    =      0,  \
2264   .CommandSubType                      =      3,  \
2265   .CommandType                         =      3
2266
2267struct GFX75_3DSTATE_CLIP {
2268   uint32_t                             DWordLength;
2269   uint32_t                             _3DCommandSubOpcode;
2270   uint32_t                             _3DCommandOpcode;
2271   uint32_t                             CommandSubType;
2272   uint32_t                             CommandType;
2273   uint32_t                             UserClipDistanceCullTestEnableBitmask;
2274   bool                                 StatisticsEnable;
2275   uint32_t                             CullMode;
2276#define CULLMODE_BOTH                            0
2277#define CULLMODE_NONE                            1
2278#define CULLMODE_FRONT                           2
2279#define CULLMODE_BACK                            3
2280   bool                                 EarlyCullEnable;
2281   uint32_t                             VertexSubPixelPrecisionSelect;
2282   uint32_t                             FrontWinding;
2283   uint32_t                             TriangleFanProvokingVertexSelect;
2284#define Vertex0                                  0
2285#define Vertex1                                  1
2286#define Vertex2                                  2
2287   uint32_t                             LineStripListProvokingVertexSelect;
2288#define Vertex0                                  0
2289#define Vertex1                                  1
2290   uint32_t                             TriangleStripListProvokingVertexSelect;
2291#define Vertex0                                  0
2292#define Vertex1                                  1
2293#define Vertex2                                  2
2294   bool                                 NonPerspectiveBarycentricEnable;
2295   bool                                 PerspectiveDivideDisable;
2296   uint32_t                             ClipMode;
2297#define CLIPMODE_NORMAL                          0
2298#define CLIPMODE_REJECT_ALL                      3
2299#define CLIPMODE_ACCEPT_ALL                      4
2300   uint32_t                             UserClipDistanceClipTestEnableBitmask;
2301   bool                                 GuardbandClipTestEnable;
2302   bool                                 ViewportZClipTestEnable;
2303   bool                                 ViewportXYClipTestEnable;
2304   uint32_t                             APIMode;
2305#define APIMODE_OGL                              0
2306#define APIMODE_D3D                              1
2307   bool                                 ClipEnable;
2308   uint32_t                             MaximumVPIndex;
2309   bool                                 ForceZeroRTAIndexEnable;
2310   float                                MaximumPointWidth;
2311   float                                MinimumPointWidth;
2312};
2313
2314static inline __attribute__((always_inline)) void
2315GFX75_3DSTATE_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
2316                        __attribute__((unused)) void * restrict dst,
2317                        __attribute__((unused)) const struct GFX75_3DSTATE_CLIP * restrict values)
2318{
2319   uint32_t * restrict dw = (uint32_t * restrict) dst;
2320
2321   dw[0] =
2322      __gen_uint(values->DWordLength, 0, 7) |
2323      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2324      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2325      __gen_uint(values->CommandSubType, 27, 28) |
2326      __gen_uint(values->CommandType, 29, 31);
2327
2328   dw[1] =
2329      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
2330      __gen_uint(values->StatisticsEnable, 10, 10) |
2331      __gen_uint(values->CullMode, 16, 17) |
2332      __gen_uint(values->EarlyCullEnable, 18, 18) |
2333      __gen_uint(values->VertexSubPixelPrecisionSelect, 19, 19) |
2334      __gen_uint(values->FrontWinding, 20, 20);
2335
2336   dw[2] =
2337      __gen_uint(values->TriangleFanProvokingVertexSelect, 0, 1) |
2338      __gen_uint(values->LineStripListProvokingVertexSelect, 2, 3) |
2339      __gen_uint(values->TriangleStripListProvokingVertexSelect, 4, 5) |
2340      __gen_uint(values->NonPerspectiveBarycentricEnable, 8, 8) |
2341      __gen_uint(values->PerspectiveDivideDisable, 9, 9) |
2342      __gen_uint(values->ClipMode, 13, 15) |
2343      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 16, 23) |
2344      __gen_uint(values->GuardbandClipTestEnable, 26, 26) |
2345      __gen_uint(values->ViewportZClipTestEnable, 27, 27) |
2346      __gen_uint(values->ViewportXYClipTestEnable, 28, 28) |
2347      __gen_uint(values->APIMode, 30, 30) |
2348      __gen_uint(values->ClipEnable, 31, 31);
2349
2350   dw[3] =
2351      __gen_uint(values->MaximumVPIndex, 0, 3) |
2352      __gen_uint(values->ForceZeroRTAIndexEnable, 5, 5) |
2353      __gen_ufixed(values->MaximumPointWidth, 6, 16, 3) |
2354      __gen_ufixed(values->MinimumPointWidth, 17, 27, 3);
2355}
2356
2357#define GFX75_3DSTATE_CONSTANT_DS_length       7
2358#define GFX75_3DSTATE_CONSTANT_DS_length_bias      2
2359#define GFX75_3DSTATE_CONSTANT_DS_header        \
2360   .DWordLength                         =      5,  \
2361   ._3DCommandSubOpcode                 =     26,  \
2362   ._3DCommandOpcode                    =      0,  \
2363   .CommandSubType                      =      3,  \
2364   .CommandType                         =      3
2365
2366struct GFX75_3DSTATE_CONSTANT_DS {
2367   uint32_t                             DWordLength;
2368   uint32_t                             _3DCommandSubOpcode;
2369   uint32_t                             _3DCommandOpcode;
2370   uint32_t                             CommandSubType;
2371   uint32_t                             CommandType;
2372   struct GFX75_3DSTATE_CONSTANT_BODY   ConstantBody;
2373};
2374
2375static inline __attribute__((always_inline)) void
2376GFX75_3DSTATE_CONSTANT_DS_pack(__attribute__((unused)) __gen_user_data *data,
2377                               __attribute__((unused)) void * restrict dst,
2378                               __attribute__((unused)) const struct GFX75_3DSTATE_CONSTANT_DS * restrict values)
2379{
2380   uint32_t * restrict dw = (uint32_t * restrict) dst;
2381
2382   dw[0] =
2383      __gen_uint(values->DWordLength, 0, 7) |
2384      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2385      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2386      __gen_uint(values->CommandSubType, 27, 28) |
2387      __gen_uint(values->CommandType, 29, 31);
2388
2389   GFX75_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
2390}
2391
2392#define GFX75_3DSTATE_CONSTANT_GS_length       7
2393#define GFX75_3DSTATE_CONSTANT_GS_length_bias      2
2394#define GFX75_3DSTATE_CONSTANT_GS_header        \
2395   .DWordLength                         =      5,  \
2396   ._3DCommandSubOpcode                 =     22,  \
2397   ._3DCommandOpcode                    =      0,  \
2398   .CommandSubType                      =      3,  \
2399   .CommandType                         =      3
2400
2401struct GFX75_3DSTATE_CONSTANT_GS {
2402   uint32_t                             DWordLength;
2403   uint32_t                             _3DCommandSubOpcode;
2404   uint32_t                             _3DCommandOpcode;
2405   uint32_t                             CommandSubType;
2406   uint32_t                             CommandType;
2407   struct GFX75_3DSTATE_CONSTANT_BODY   ConstantBody;
2408};
2409
2410static inline __attribute__((always_inline)) void
2411GFX75_3DSTATE_CONSTANT_GS_pack(__attribute__((unused)) __gen_user_data *data,
2412                               __attribute__((unused)) void * restrict dst,
2413                               __attribute__((unused)) const struct GFX75_3DSTATE_CONSTANT_GS * restrict values)
2414{
2415   uint32_t * restrict dw = (uint32_t * restrict) dst;
2416
2417   dw[0] =
2418      __gen_uint(values->DWordLength, 0, 7) |
2419      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2420      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2421      __gen_uint(values->CommandSubType, 27, 28) |
2422      __gen_uint(values->CommandType, 29, 31);
2423
2424   GFX75_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
2425}
2426
2427#define GFX75_3DSTATE_CONSTANT_HS_length       7
2428#define GFX75_3DSTATE_CONSTANT_HS_length_bias      2
2429#define GFX75_3DSTATE_CONSTANT_HS_header        \
2430   .DWordLength                         =      5,  \
2431   ._3DCommandSubOpcode                 =     25,  \
2432   ._3DCommandOpcode                    =      0,  \
2433   .CommandSubType                      =      3,  \
2434   .CommandType                         =      3
2435
2436struct GFX75_3DSTATE_CONSTANT_HS {
2437   uint32_t                             DWordLength;
2438   uint32_t                             _3DCommandSubOpcode;
2439   uint32_t                             _3DCommandOpcode;
2440   uint32_t                             CommandSubType;
2441   uint32_t                             CommandType;
2442   struct GFX75_3DSTATE_CONSTANT_BODY   ConstantBody;
2443};
2444
2445static inline __attribute__((always_inline)) void
2446GFX75_3DSTATE_CONSTANT_HS_pack(__attribute__((unused)) __gen_user_data *data,
2447                               __attribute__((unused)) void * restrict dst,
2448                               __attribute__((unused)) const struct GFX75_3DSTATE_CONSTANT_HS * restrict values)
2449{
2450   uint32_t * restrict dw = (uint32_t * restrict) dst;
2451
2452   dw[0] =
2453      __gen_uint(values->DWordLength, 0, 7) |
2454      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2455      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2456      __gen_uint(values->CommandSubType, 27, 28) |
2457      __gen_uint(values->CommandType, 29, 31);
2458
2459   GFX75_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
2460}
2461
2462#define GFX75_3DSTATE_CONSTANT_PS_length       7
2463#define GFX75_3DSTATE_CONSTANT_PS_length_bias      2
2464#define GFX75_3DSTATE_CONSTANT_PS_header        \
2465   .DWordLength                         =      5,  \
2466   ._3DCommandSubOpcode                 =     23,  \
2467   ._3DCommandOpcode                    =      0,  \
2468   .CommandSubType                      =      3,  \
2469   .CommandType                         =      3
2470
2471struct GFX75_3DSTATE_CONSTANT_PS {
2472   uint32_t                             DWordLength;
2473   uint32_t                             _3DCommandSubOpcode;
2474   uint32_t                             _3DCommandOpcode;
2475   uint32_t                             CommandSubType;
2476   uint32_t                             CommandType;
2477   struct GFX75_3DSTATE_CONSTANT_BODY   ConstantBody;
2478};
2479
2480static inline __attribute__((always_inline)) void
2481GFX75_3DSTATE_CONSTANT_PS_pack(__attribute__((unused)) __gen_user_data *data,
2482                               __attribute__((unused)) void * restrict dst,
2483                               __attribute__((unused)) const struct GFX75_3DSTATE_CONSTANT_PS * restrict values)
2484{
2485   uint32_t * restrict dw = (uint32_t * restrict) dst;
2486
2487   dw[0] =
2488      __gen_uint(values->DWordLength, 0, 7) |
2489      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2490      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2491      __gen_uint(values->CommandSubType, 27, 28) |
2492      __gen_uint(values->CommandType, 29, 31);
2493
2494   GFX75_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
2495}
2496
2497#define GFX75_3DSTATE_CONSTANT_VS_length       7
2498#define GFX75_3DSTATE_CONSTANT_VS_length_bias      2
2499#define GFX75_3DSTATE_CONSTANT_VS_header        \
2500   .DWordLength                         =      5,  \
2501   ._3DCommandSubOpcode                 =     21,  \
2502   ._3DCommandOpcode                    =      0,  \
2503   .CommandSubType                      =      3,  \
2504   .CommandType                         =      3
2505
2506struct GFX75_3DSTATE_CONSTANT_VS {
2507   uint32_t                             DWordLength;
2508   uint32_t                             _3DCommandSubOpcode;
2509   uint32_t                             _3DCommandOpcode;
2510   uint32_t                             CommandSubType;
2511   uint32_t                             CommandType;
2512   struct GFX75_3DSTATE_CONSTANT_BODY   ConstantBody;
2513};
2514
2515static inline __attribute__((always_inline)) void
2516GFX75_3DSTATE_CONSTANT_VS_pack(__attribute__((unused)) __gen_user_data *data,
2517                               __attribute__((unused)) void * restrict dst,
2518                               __attribute__((unused)) const struct GFX75_3DSTATE_CONSTANT_VS * restrict values)
2519{
2520   uint32_t * restrict dw = (uint32_t * restrict) dst;
2521
2522   dw[0] =
2523      __gen_uint(values->DWordLength, 0, 7) |
2524      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2525      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2526      __gen_uint(values->CommandSubType, 27, 28) |
2527      __gen_uint(values->CommandType, 29, 31);
2528
2529   GFX75_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
2530}
2531
2532#define GFX75_3DSTATE_DEPTH_BUFFER_length      7
2533#define GFX75_3DSTATE_DEPTH_BUFFER_length_bias      2
2534#define GFX75_3DSTATE_DEPTH_BUFFER_header       \
2535   .DWordLength                         =      5,  \
2536   ._3DCommandSubOpcode                 =      5,  \
2537   ._3DCommandOpcode                    =      0,  \
2538   .CommandSubType                      =      3,  \
2539   .CommandType                         =      3
2540
2541struct GFX75_3DSTATE_DEPTH_BUFFER {
2542   uint32_t                             DWordLength;
2543   uint32_t                             _3DCommandSubOpcode;
2544   uint32_t                             _3DCommandOpcode;
2545   uint32_t                             CommandSubType;
2546   uint32_t                             CommandType;
2547   uint32_t                             SurfacePitch;
2548   uint32_t                             SurfaceFormat;
2549#define D32_FLOAT                                1
2550#define D24_UNORM_X8_UINT                        3
2551#define D16_UNORM                                5
2552   bool                                 HierarchicalDepthBufferEnable;
2553   bool                                 StencilWriteEnable;
2554   bool                                 DepthWriteEnable;
2555   uint32_t                             SurfaceType;
2556#define SURFTYPE_1D                              0
2557#define SURFTYPE_2D                              1
2558#define SURFTYPE_3D                              2
2559#define SURFTYPE_CUBE                            3
2560#define SURFTYPE_NULL                            7
2561   __gen_address_type                   SurfaceBaseAddress;
2562   uint32_t                             LOD;
2563   uint32_t                             Width;
2564   uint32_t                             Height;
2565   uint32_t                             MOCS;
2566   uint32_t                             MinimumArrayElement;
2567   uint32_t                             Depth;
2568#define SURFTYPE_CUBEmustbezero                  0
2569   int32_t                              DepthCoordinateOffsetX;
2570   int32_t                              DepthCoordinateOffsetY;
2571   uint32_t                             RenderTargetViewExtent;
2572};
2573
2574static inline __attribute__((always_inline)) void
2575GFX75_3DSTATE_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
2576                                __attribute__((unused)) void * restrict dst,
2577                                __attribute__((unused)) const struct GFX75_3DSTATE_DEPTH_BUFFER * restrict values)
2578{
2579   uint32_t * restrict dw = (uint32_t * restrict) dst;
2580
2581   dw[0] =
2582      __gen_uint(values->DWordLength, 0, 7) |
2583      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2584      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2585      __gen_uint(values->CommandSubType, 27, 28) |
2586      __gen_uint(values->CommandType, 29, 31);
2587
2588   dw[1] =
2589      __gen_uint(values->SurfacePitch, 0, 17) |
2590      __gen_uint(values->SurfaceFormat, 18, 20) |
2591      __gen_uint(values->HierarchicalDepthBufferEnable, 22, 22) |
2592      __gen_uint(values->StencilWriteEnable, 27, 27) |
2593      __gen_uint(values->DepthWriteEnable, 28, 28) |
2594      __gen_uint(values->SurfaceType, 29, 31);
2595
2596   dw[2] = __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 0, 31);
2597
2598   dw[3] =
2599      __gen_uint(values->LOD, 0, 3) |
2600      __gen_uint(values->Width, 4, 17) |
2601      __gen_uint(values->Height, 18, 31);
2602
2603   dw[4] =
2604      __gen_uint(values->MOCS, 0, 3) |
2605      __gen_uint(values->MinimumArrayElement, 10, 20) |
2606      __gen_uint(values->Depth, 21, 31);
2607
2608   dw[5] =
2609      __gen_sint(values->DepthCoordinateOffsetX, 0, 15) |
2610      __gen_sint(values->DepthCoordinateOffsetY, 16, 31);
2611
2612   dw[6] =
2613      __gen_uint(values->RenderTargetViewExtent, 21, 31);
2614}
2615
2616#define GFX75_3DSTATE_DEPTH_STENCIL_STATE_POINTERS_length      2
2617#define GFX75_3DSTATE_DEPTH_STENCIL_STATE_POINTERS_length_bias      2
2618#define GFX75_3DSTATE_DEPTH_STENCIL_STATE_POINTERS_header\
2619   .DWordLength                         =      0,  \
2620   ._3DCommandSubOpcode                 =     37,  \
2621   ._3DCommandOpcode                    =      0,  \
2622   .CommandSubType                      =      3,  \
2623   .CommandType                         =      3
2624
2625struct GFX75_3DSTATE_DEPTH_STENCIL_STATE_POINTERS {
2626   uint32_t                             DWordLength;
2627   uint32_t                             _3DCommandSubOpcode;
2628   uint32_t                             _3DCommandOpcode;
2629   uint32_t                             CommandSubType;
2630   uint32_t                             CommandType;
2631   uint64_t                             PointertoDEPTH_STENCIL_STATE;
2632};
2633
2634static inline __attribute__((always_inline)) void
2635GFX75_3DSTATE_DEPTH_STENCIL_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
2636                                                __attribute__((unused)) void * restrict dst,
2637                                                __attribute__((unused)) const struct GFX75_3DSTATE_DEPTH_STENCIL_STATE_POINTERS * restrict values)
2638{
2639   uint32_t * restrict dw = (uint32_t * restrict) dst;
2640
2641   dw[0] =
2642      __gen_uint(values->DWordLength, 0, 7) |
2643      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2644      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2645      __gen_uint(values->CommandSubType, 27, 28) |
2646      __gen_uint(values->CommandType, 29, 31);
2647
2648   dw[1] =
2649      __gen_mbo(0, 0) |
2650      __gen_offset(values->PointertoDEPTH_STENCIL_STATE, 6, 31);
2651}
2652
2653#define GFX75_3DSTATE_DRAWING_RECTANGLE_length      4
2654#define GFX75_3DSTATE_DRAWING_RECTANGLE_length_bias      2
2655#define GFX75_3DSTATE_DRAWING_RECTANGLE_header  \
2656   .DWordLength                         =      2,  \
2657   ._3DCommandSubOpcode                 =      0,  \
2658   ._3DCommandOpcode                    =      1,  \
2659   .CommandSubType                      =      3,  \
2660   .CommandType                         =      3
2661
2662struct GFX75_3DSTATE_DRAWING_RECTANGLE {
2663   uint32_t                             DWordLength;
2664   uint32_t                             CoreModeSelect;
2665#define Legacy                                   0
2666#define Core0Enabled                             1
2667#define Core1Enabled                             2
2668   uint32_t                             _3DCommandSubOpcode;
2669   uint32_t                             _3DCommandOpcode;
2670   uint32_t                             CommandSubType;
2671   uint32_t                             CommandType;
2672   uint32_t                             ClippedDrawingRectangleXMin;
2673   uint32_t                             ClippedDrawingRectangleYMin;
2674   uint32_t                             ClippedDrawingRectangleXMax;
2675   uint32_t                             ClippedDrawingRectangleYMax;
2676   int32_t                              DrawingRectangleOriginX;
2677   int32_t                              DrawingRectangleOriginY;
2678};
2679
2680static inline __attribute__((always_inline)) void
2681GFX75_3DSTATE_DRAWING_RECTANGLE_pack(__attribute__((unused)) __gen_user_data *data,
2682                                     __attribute__((unused)) void * restrict dst,
2683                                     __attribute__((unused)) const struct GFX75_3DSTATE_DRAWING_RECTANGLE * restrict values)
2684{
2685   uint32_t * restrict dw = (uint32_t * restrict) dst;
2686
2687   dw[0] =
2688      __gen_uint(values->DWordLength, 0, 7) |
2689      __gen_uint(values->CoreModeSelect, 14, 15) |
2690      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2691      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2692      __gen_uint(values->CommandSubType, 27, 28) |
2693      __gen_uint(values->CommandType, 29, 31);
2694
2695   dw[1] =
2696      __gen_uint(values->ClippedDrawingRectangleXMin, 0, 15) |
2697      __gen_uint(values->ClippedDrawingRectangleYMin, 16, 31);
2698
2699   dw[2] =
2700      __gen_uint(values->ClippedDrawingRectangleXMax, 0, 15) |
2701      __gen_uint(values->ClippedDrawingRectangleYMax, 16, 31);
2702
2703   dw[3] =
2704      __gen_sint(values->DrawingRectangleOriginX, 0, 15) |
2705      __gen_sint(values->DrawingRectangleOriginY, 16, 31);
2706}
2707
2708#define GFX75_3DSTATE_DS_length                6
2709#define GFX75_3DSTATE_DS_length_bias           2
2710#define GFX75_3DSTATE_DS_header                 \
2711   .DWordLength                         =      4,  \
2712   ._3DCommandSubOpcode                 =     29,  \
2713   ._3DCommandOpcode                    =      0,  \
2714   .CommandSubType                      =      3,  \
2715   .CommandType                         =      3
2716
2717struct GFX75_3DSTATE_DS {
2718   uint32_t                             DWordLength;
2719   uint32_t                             _3DCommandSubOpcode;
2720   uint32_t                             _3DCommandOpcode;
2721   uint32_t                             CommandSubType;
2722   uint32_t                             CommandType;
2723   uint64_t                             KernelStartPointer;
2724   bool                                 SoftwareExceptionEnable;
2725   bool                                 IllegalOpcodeExceptionEnable;
2726   bool                                 AccessesUAV;
2727   uint32_t                             FloatingPointMode;
2728#define IEEE754                                  0
2729#define Alternate                                1
2730   uint32_t                             ThreadDispatchPriority;
2731#define High                                     1
2732   uint32_t                             BindingTableEntryCount;
2733   uint32_t                             SamplerCount;
2734#define NoSamplers                               0
2735#define _14Samplers                              1
2736#define _58Samplers                              2
2737#define _912Samplers                             3
2738#define _1316Samplers                            4
2739   bool                                 VectorMaskEnable;
2740   uint32_t                             SingleDomainPointDispatch;
2741   uint32_t                             PerThreadScratchSpace;
2742   __gen_address_type                   ScratchSpaceBasePointer;
2743   uint32_t                             PatchURBEntryReadOffset;
2744   uint32_t                             PatchURBEntryReadLength;
2745   uint32_t                             DispatchGRFStartRegisterForURBData;
2746   bool                                 Enable;
2747   bool                                 DSCacheDisable;
2748   bool                                 ComputeWCoordinateEnable;
2749   bool                                 StatisticsEnable;
2750   uint32_t                             MaximumNumberofThreads;
2751};
2752
2753static inline __attribute__((always_inline)) void
2754GFX75_3DSTATE_DS_pack(__attribute__((unused)) __gen_user_data *data,
2755                      __attribute__((unused)) void * restrict dst,
2756                      __attribute__((unused)) const struct GFX75_3DSTATE_DS * restrict values)
2757{
2758   uint32_t * restrict dw = (uint32_t * restrict) dst;
2759
2760   dw[0] =
2761      __gen_uint(values->DWordLength, 0, 7) |
2762      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2763      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2764      __gen_uint(values->CommandSubType, 27, 28) |
2765      __gen_uint(values->CommandType, 29, 31);
2766
2767   dw[1] =
2768      __gen_offset(values->KernelStartPointer, 6, 31);
2769
2770   dw[2] =
2771      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
2772      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
2773      __gen_uint(values->AccessesUAV, 14, 14) |
2774      __gen_uint(values->FloatingPointMode, 16, 16) |
2775      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
2776      __gen_uint(values->BindingTableEntryCount, 18, 25) |
2777      __gen_uint(values->SamplerCount, 27, 29) |
2778      __gen_uint(values->VectorMaskEnable, 30, 30) |
2779      __gen_uint(values->SingleDomainPointDispatch, 31, 31);
2780
2781   const uint32_t v3 =
2782      __gen_uint(values->PerThreadScratchSpace, 0, 3);
2783   dw[3] = __gen_address(data, &dw[3], values->ScratchSpaceBasePointer, v3, 10, 31);
2784
2785   dw[4] =
2786      __gen_uint(values->PatchURBEntryReadOffset, 4, 9) |
2787      __gen_uint(values->PatchURBEntryReadLength, 11, 17) |
2788      __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
2789
2790   dw[5] =
2791      __gen_uint(values->Enable, 0, 0) |
2792      __gen_uint(values->DSCacheDisable, 1, 1) |
2793      __gen_uint(values->ComputeWCoordinateEnable, 2, 2) |
2794      __gen_uint(values->StatisticsEnable, 10, 10) |
2795      __gen_uint(values->MaximumNumberofThreads, 21, 29);
2796}
2797
2798#define GFX75_3DSTATE_GATHER_CONSTANT_DS_length_bias      2
2799#define GFX75_3DSTATE_GATHER_CONSTANT_DS_header \
2800   .DWordLength                         =      1,  \
2801   ._3DCommandSubOpcode                 =     55,  \
2802   ._3DCommandOpcode                    =      0,  \
2803   .CommandSubType                      =      3,  \
2804   .CommandType                         =      3
2805
2806struct GFX75_3DSTATE_GATHER_CONSTANT_DS {
2807   uint32_t                             DWordLength;
2808   uint32_t                             _3DCommandSubOpcode;
2809   uint32_t                             _3DCommandOpcode;
2810   uint32_t                             CommandSubType;
2811   uint32_t                             CommandType;
2812   uint32_t                             ConstantBufferBindingTableBlock;
2813   uint32_t                             ConstantBufferValid;
2814   uint64_t                             GatherBufferOffset;
2815   /* variable length fields follow */
2816};
2817
2818static inline __attribute__((always_inline)) void
2819GFX75_3DSTATE_GATHER_CONSTANT_DS_pack(__attribute__((unused)) __gen_user_data *data,
2820                                      __attribute__((unused)) void * restrict dst,
2821                                      __attribute__((unused)) const struct GFX75_3DSTATE_GATHER_CONSTANT_DS * restrict values)
2822{
2823   uint32_t * restrict dw = (uint32_t * restrict) dst;
2824
2825   dw[0] =
2826      __gen_uint(values->DWordLength, 0, 7) |
2827      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2828      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2829      __gen_uint(values->CommandSubType, 27, 28) |
2830      __gen_uint(values->CommandType, 29, 31);
2831
2832   dw[1] =
2833      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
2834      __gen_uint(values->ConstantBufferValid, 16, 31);
2835
2836   dw[2] =
2837      __gen_offset(values->GatherBufferOffset, 6, 22);
2838}
2839
2840#define GFX75_3DSTATE_GATHER_CONSTANT_GS_length_bias      2
2841#define GFX75_3DSTATE_GATHER_CONSTANT_GS_header \
2842   .DWordLength                         =      1,  \
2843   ._3DCommandSubOpcode                 =     53,  \
2844   ._3DCommandOpcode                    =      0,  \
2845   .CommandSubType                      =      3,  \
2846   .CommandType                         =      3
2847
2848struct GFX75_3DSTATE_GATHER_CONSTANT_GS {
2849   uint32_t                             DWordLength;
2850   uint32_t                             _3DCommandSubOpcode;
2851   uint32_t                             _3DCommandOpcode;
2852   uint32_t                             CommandSubType;
2853   uint32_t                             CommandType;
2854   uint32_t                             ConstantBufferBindingTableBlock;
2855   uint32_t                             ConstantBufferValid;
2856   uint64_t                             GatherBufferOffset;
2857   /* variable length fields follow */
2858};
2859
2860static inline __attribute__((always_inline)) void
2861GFX75_3DSTATE_GATHER_CONSTANT_GS_pack(__attribute__((unused)) __gen_user_data *data,
2862                                      __attribute__((unused)) void * restrict dst,
2863                                      __attribute__((unused)) const struct GFX75_3DSTATE_GATHER_CONSTANT_GS * restrict values)
2864{
2865   uint32_t * restrict dw = (uint32_t * restrict) dst;
2866
2867   dw[0] =
2868      __gen_uint(values->DWordLength, 0, 7) |
2869      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2870      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2871      __gen_uint(values->CommandSubType, 27, 28) |
2872      __gen_uint(values->CommandType, 29, 31);
2873
2874   dw[1] =
2875      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
2876      __gen_uint(values->ConstantBufferValid, 16, 31);
2877
2878   dw[2] =
2879      __gen_offset(values->GatherBufferOffset, 6, 22);
2880}
2881
2882#define GFX75_3DSTATE_GATHER_CONSTANT_HS_length_bias      2
2883#define GFX75_3DSTATE_GATHER_CONSTANT_HS_header \
2884   .DWordLength                         =      1,  \
2885   ._3DCommandSubOpcode                 =     54,  \
2886   ._3DCommandOpcode                    =      0,  \
2887   .CommandSubType                      =      3,  \
2888   .CommandType                         =      3
2889
2890struct GFX75_3DSTATE_GATHER_CONSTANT_HS {
2891   uint32_t                             DWordLength;
2892   uint32_t                             _3DCommandSubOpcode;
2893   uint32_t                             _3DCommandOpcode;
2894   uint32_t                             CommandSubType;
2895   uint32_t                             CommandType;
2896   uint32_t                             ConstantBufferBindingTableBlock;
2897   uint32_t                             ConstantBufferValid;
2898   uint64_t                             GatherBufferOffset;
2899   /* variable length fields follow */
2900};
2901
2902static inline __attribute__((always_inline)) void
2903GFX75_3DSTATE_GATHER_CONSTANT_HS_pack(__attribute__((unused)) __gen_user_data *data,
2904                                      __attribute__((unused)) void * restrict dst,
2905                                      __attribute__((unused)) const struct GFX75_3DSTATE_GATHER_CONSTANT_HS * restrict values)
2906{
2907   uint32_t * restrict dw = (uint32_t * restrict) dst;
2908
2909   dw[0] =
2910      __gen_uint(values->DWordLength, 0, 7) |
2911      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2912      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2913      __gen_uint(values->CommandSubType, 27, 28) |
2914      __gen_uint(values->CommandType, 29, 31);
2915
2916   dw[1] =
2917      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
2918      __gen_uint(values->ConstantBufferValid, 16, 31);
2919
2920   dw[2] =
2921      __gen_offset(values->GatherBufferOffset, 6, 22);
2922}
2923
2924#define GFX75_3DSTATE_GATHER_CONSTANT_PS_length_bias      2
2925#define GFX75_3DSTATE_GATHER_CONSTANT_PS_header \
2926   .DWordLength                         =      1,  \
2927   ._3DCommandSubOpcode                 =     56,  \
2928   ._3DCommandOpcode                    =      0,  \
2929   .CommandSubType                      =      3,  \
2930   .CommandType                         =      3
2931
2932struct GFX75_3DSTATE_GATHER_CONSTANT_PS {
2933   uint32_t                             DWordLength;
2934   uint32_t                             _3DCommandSubOpcode;
2935   uint32_t                             _3DCommandOpcode;
2936   uint32_t                             CommandSubType;
2937   uint32_t                             CommandType;
2938   uint32_t                             ConstantBufferBindingTableBlock;
2939   uint32_t                             ConstantBufferValid;
2940   bool                                 ConstantBufferDx9Enable;
2941   uint64_t                             GatherBufferOffset;
2942   /* variable length fields follow */
2943};
2944
2945static inline __attribute__((always_inline)) void
2946GFX75_3DSTATE_GATHER_CONSTANT_PS_pack(__attribute__((unused)) __gen_user_data *data,
2947                                      __attribute__((unused)) void * restrict dst,
2948                                      __attribute__((unused)) const struct GFX75_3DSTATE_GATHER_CONSTANT_PS * restrict values)
2949{
2950   uint32_t * restrict dw = (uint32_t * restrict) dst;
2951
2952   dw[0] =
2953      __gen_uint(values->DWordLength, 0, 7) |
2954      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2955      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2956      __gen_uint(values->CommandSubType, 27, 28) |
2957      __gen_uint(values->CommandType, 29, 31);
2958
2959   dw[1] =
2960      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
2961      __gen_uint(values->ConstantBufferValid, 16, 31);
2962
2963   dw[2] =
2964      __gen_uint(values->ConstantBufferDx9Enable, 4, 4) |
2965      __gen_offset(values->GatherBufferOffset, 6, 22);
2966}
2967
2968#define GFX75_3DSTATE_GATHER_CONSTANT_VS_length_bias      2
2969#define GFX75_3DSTATE_GATHER_CONSTANT_VS_header \
2970   .DWordLength                         =      0,  \
2971   ._3DCommandSubOpcode                 =     52,  \
2972   ._3DCommandOpcode                    =      0,  \
2973   .CommandSubType                      =      3,  \
2974   .CommandType                         =      3
2975
2976struct GFX75_3DSTATE_GATHER_CONSTANT_VS {
2977   uint32_t                             DWordLength;
2978   uint32_t                             _3DCommandSubOpcode;
2979   uint32_t                             _3DCommandOpcode;
2980   uint32_t                             CommandSubType;
2981   uint32_t                             CommandType;
2982   uint32_t                             ConstantBufferBindingTableBlock;
2983   uint32_t                             ConstantBufferValid;
2984   bool                                 ConstantBufferDx9Enable;
2985   uint64_t                             GatherBufferOffset;
2986   /* variable length fields follow */
2987};
2988
2989static inline __attribute__((always_inline)) void
2990GFX75_3DSTATE_GATHER_CONSTANT_VS_pack(__attribute__((unused)) __gen_user_data *data,
2991                                      __attribute__((unused)) void * restrict dst,
2992                                      __attribute__((unused)) const struct GFX75_3DSTATE_GATHER_CONSTANT_VS * restrict values)
2993{
2994   uint32_t * restrict dw = (uint32_t * restrict) dst;
2995
2996   dw[0] =
2997      __gen_uint(values->DWordLength, 0, 7) |
2998      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2999      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3000      __gen_uint(values->CommandSubType, 27, 28) |
3001      __gen_uint(values->CommandType, 29, 31);
3002
3003   dw[1] =
3004      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
3005      __gen_uint(values->ConstantBufferValid, 16, 31);
3006
3007   dw[2] =
3008      __gen_uint(values->ConstantBufferDx9Enable, 4, 4) |
3009      __gen_offset(values->GatherBufferOffset, 6, 22);
3010}
3011
3012#define GFX75_3DSTATE_GATHER_POOL_ALLOC_length      3
3013#define GFX75_3DSTATE_GATHER_POOL_ALLOC_length_bias      2
3014#define GFX75_3DSTATE_GATHER_POOL_ALLOC_header  \
3015   .DWordLength                         =      1,  \
3016   ._3DCommandSubOpcode                 =     26,  \
3017   ._3DCommandOpcode                    =      1,  \
3018   .CommandSubType                      =      3,  \
3019   .CommandType                         =      3
3020
3021struct GFX75_3DSTATE_GATHER_POOL_ALLOC {
3022   uint32_t                             DWordLength;
3023   uint32_t                             _3DCommandSubOpcode;
3024   uint32_t                             _3DCommandOpcode;
3025   uint32_t                             CommandSubType;
3026   uint32_t                             CommandType;
3027   uint32_t                             MOCS;
3028   bool                                 GatherPoolEnable;
3029   __gen_address_type                   GatherPoolBaseAddress;
3030   __gen_address_type                   GatherPoolUpperBound;
3031};
3032
3033static inline __attribute__((always_inline)) void
3034GFX75_3DSTATE_GATHER_POOL_ALLOC_pack(__attribute__((unused)) __gen_user_data *data,
3035                                     __attribute__((unused)) void * restrict dst,
3036                                     __attribute__((unused)) const struct GFX75_3DSTATE_GATHER_POOL_ALLOC * restrict values)
3037{
3038   uint32_t * restrict dw = (uint32_t * restrict) dst;
3039
3040   dw[0] =
3041      __gen_uint(values->DWordLength, 0, 7) |
3042      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3043      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3044      __gen_uint(values->CommandSubType, 27, 28) |
3045      __gen_uint(values->CommandType, 29, 31);
3046
3047   const uint32_t v1 =
3048      __gen_uint(values->MOCS, 0, 3) |
3049      __gen_mbo(4, 5) |
3050      __gen_uint(values->GatherPoolEnable, 11, 11);
3051   dw[1] = __gen_address(data, &dw[1], values->GatherPoolBaseAddress, v1, 12, 31);
3052
3053   dw[2] = __gen_address(data, &dw[2], values->GatherPoolUpperBound, 0, 12, 31);
3054}
3055
3056#define GFX75_3DSTATE_GS_length                7
3057#define GFX75_3DSTATE_GS_length_bias           2
3058#define GFX75_3DSTATE_GS_header                 \
3059   .DWordLength                         =      5,  \
3060   ._3DCommandSubOpcode                 =     17,  \
3061   ._3DCommandOpcode                    =      0,  \
3062   .CommandSubType                      =      3,  \
3063   .CommandType                         =      3
3064
3065struct GFX75_3DSTATE_GS {
3066   uint32_t                             DWordLength;
3067   uint32_t                             _3DCommandSubOpcode;
3068   uint32_t                             _3DCommandOpcode;
3069   uint32_t                             CommandSubType;
3070   uint32_t                             CommandType;
3071   uint64_t                             KernelStartPointer;
3072   bool                                 SoftwareExceptionEnable;
3073   bool                                 MaskStackExceptionEnable;
3074   uint32_t                             GSaccessesUAV;
3075   bool                                 IllegalOpcodeExceptionEnable;
3076   uint32_t                             FloatingPointMode;
3077#define IEEE754                                  0
3078#define Alternate                                1
3079   uint32_t                             ThreadPriority;
3080#define NormalPriority                           0
3081#define HighPriority                             1
3082   uint32_t                             BindingTableEntryCount;
3083   uint32_t                             SamplerCount;
3084#define NoSamplers                               0
3085#define _14Samplers                              1
3086#define _58Samplers                              2
3087#define _912Samplers                             3
3088#define _1316Samplers                            4
3089   bool                                 VectorMaskEnable;
3090   bool                                 SingleProgramFlow;
3091   uint32_t                             PerThreadScratchSpace;
3092   __gen_address_type                   ScratchSpaceBasePointer;
3093   uint32_t                             DispatchGRFStartRegisterForURBData;
3094   uint32_t                             VertexURBEntryReadOffset;
3095   bool                                 IncludeVertexHandles;
3096   uint32_t                             VertexURBEntryReadLength;
3097   enum GFX75_3D_Prim_Topo_Type         OutputTopology;
3098   uint32_t                             OutputVertexSize;
3099   bool                                 Enable;
3100   bool                                 DiscardAdjacency;
3101   uint32_t                             ReorderMode;
3102#define LEADING                                  0
3103#define TRAILING                                 1
3104   uint32_t                             Hint;
3105   bool                                 IncludePrimitiveID;
3106   uint32_t                             GSInvocationsIncrementValue;
3107   uint32_t                             StatisticsEnable;
3108   uint32_t                             DispatchMode;
3109#define DISPATCH_MODE_SINGLE                     0
3110#define DISPATCH_MODE_DUAL_INSTANCE              1
3111#define DISPATCH_MODE_DUAL_OBJECT                2
3112   uint32_t                             DefaultStreamID;
3113   uint32_t                             InstanceControl;
3114   uint32_t                             ControlDataHeaderSize;
3115   uint32_t                             MaximumNumberofThreads;
3116   uint64_t                             SemaphoreHandle;
3117   uint32_t                             ControlDataFormat;
3118#define GSCTL_CUT                                0
3119#define GSCTL_SID                                1
3120};
3121
3122static inline __attribute__((always_inline)) void
3123GFX75_3DSTATE_GS_pack(__attribute__((unused)) __gen_user_data *data,
3124                      __attribute__((unused)) void * restrict dst,
3125                      __attribute__((unused)) const struct GFX75_3DSTATE_GS * restrict values)
3126{
3127   uint32_t * restrict dw = (uint32_t * restrict) dst;
3128
3129   dw[0] =
3130      __gen_uint(values->DWordLength, 0, 7) |
3131      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3132      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3133      __gen_uint(values->CommandSubType, 27, 28) |
3134      __gen_uint(values->CommandType, 29, 31);
3135
3136   dw[1] =
3137      __gen_offset(values->KernelStartPointer, 6, 31);
3138
3139   dw[2] =
3140      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
3141      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
3142      __gen_uint(values->GSaccessesUAV, 12, 12) |
3143      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
3144      __gen_uint(values->FloatingPointMode, 16, 16) |
3145      __gen_uint(values->ThreadPriority, 17, 17) |
3146      __gen_uint(values->BindingTableEntryCount, 18, 25) |
3147      __gen_uint(values->SamplerCount, 27, 29) |
3148      __gen_uint(values->VectorMaskEnable, 30, 30) |
3149      __gen_uint(values->SingleProgramFlow, 31, 31);
3150
3151   const uint32_t v3 =
3152      __gen_uint(values->PerThreadScratchSpace, 0, 3);
3153   dw[3] = __gen_address(data, &dw[3], values->ScratchSpaceBasePointer, v3, 10, 31);
3154
3155   dw[4] =
3156      __gen_uint(values->DispatchGRFStartRegisterForURBData, 0, 3) |
3157      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
3158      __gen_uint(values->IncludeVertexHandles, 10, 10) |
3159      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
3160      __gen_uint(values->OutputTopology, 17, 22) |
3161      __gen_uint(values->OutputVertexSize, 23, 28);
3162
3163   dw[5] =
3164      __gen_uint(values->Enable, 0, 0) |
3165      __gen_uint(values->DiscardAdjacency, 1, 1) |
3166      __gen_uint(values->ReorderMode, 2, 2) |
3167      __gen_uint(values->Hint, 3, 3) |
3168      __gen_uint(values->IncludePrimitiveID, 4, 4) |
3169      __gen_uint(values->GSInvocationsIncrementValue, 5, 9) |
3170      __gen_uint(values->StatisticsEnable, 10, 10) |
3171      __gen_uint(values->DispatchMode, 11, 12) |
3172      __gen_uint(values->DefaultStreamID, 13, 14) |
3173      __gen_uint(values->InstanceControl, 15, 19) |
3174      __gen_uint(values->ControlDataHeaderSize, 20, 23) |
3175      __gen_uint(values->MaximumNumberofThreads, 24, 31);
3176
3177   dw[6] =
3178      __gen_offset(values->SemaphoreHandle, 0, 12) |
3179      __gen_uint(values->ControlDataFormat, 31, 31);
3180}
3181
3182#define GFX75_3DSTATE_HIER_DEPTH_BUFFER_length      3
3183#define GFX75_3DSTATE_HIER_DEPTH_BUFFER_length_bias      2
3184#define GFX75_3DSTATE_HIER_DEPTH_BUFFER_header  \
3185   .DWordLength                         =      1,  \
3186   ._3DCommandSubOpcode                 =      7,  \
3187   ._3DCommandOpcode                    =      0,  \
3188   .CommandSubType                      =      3,  \
3189   .CommandType                         =      3
3190
3191struct GFX75_3DSTATE_HIER_DEPTH_BUFFER {
3192   uint32_t                             DWordLength;
3193   uint32_t                             _3DCommandSubOpcode;
3194   uint32_t                             _3DCommandOpcode;
3195   uint32_t                             CommandSubType;
3196   uint32_t                             CommandType;
3197   uint32_t                             SurfacePitch;
3198   uint32_t                             MOCS;
3199   __gen_address_type                   SurfaceBaseAddress;
3200};
3201
3202static inline __attribute__((always_inline)) void
3203GFX75_3DSTATE_HIER_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
3204                                     __attribute__((unused)) void * restrict dst,
3205                                     __attribute__((unused)) const struct GFX75_3DSTATE_HIER_DEPTH_BUFFER * restrict values)
3206{
3207   uint32_t * restrict dw = (uint32_t * restrict) dst;
3208
3209   dw[0] =
3210      __gen_uint(values->DWordLength, 0, 7) |
3211      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3212      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3213      __gen_uint(values->CommandSubType, 27, 28) |
3214      __gen_uint(values->CommandType, 29, 31);
3215
3216   dw[1] =
3217      __gen_uint(values->SurfacePitch, 0, 16) |
3218      __gen_uint(values->MOCS, 25, 28);
3219
3220   dw[2] = __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 0, 31);
3221}
3222
3223#define GFX75_3DSTATE_HS_length                7
3224#define GFX75_3DSTATE_HS_length_bias           2
3225#define GFX75_3DSTATE_HS_header                 \
3226   .DWordLength                         =      5,  \
3227   ._3DCommandSubOpcode                 =     27,  \
3228   ._3DCommandOpcode                    =      0,  \
3229   .CommandSubType                      =      3,  \
3230   .CommandType                         =      3
3231
3232struct GFX75_3DSTATE_HS {
3233   uint32_t                             DWordLength;
3234   uint32_t                             _3DCommandSubOpcode;
3235   uint32_t                             _3DCommandOpcode;
3236   uint32_t                             CommandSubType;
3237   uint32_t                             CommandType;
3238   uint32_t                             MaximumNumberofThreads;
3239   bool                                 SoftwareExceptionEnable;
3240   bool                                 IllegalOpcodeExceptionEnable;
3241   uint32_t                             FloatingPointMode;
3242#define IEEE754                                  0
3243#define Alternate                                1
3244   uint32_t                             ThreadDispatchPriority;
3245#define High                                     1
3246   uint32_t                             BindingTableEntryCount;
3247   uint32_t                             SamplerCount;
3248#define NoSamplers                               0
3249#define _14Samplers                              1
3250#define _58Samplers                              2
3251#define _912Samplers                             3
3252#define _1316Samplers                            4
3253   uint32_t                             InstanceCount;
3254   bool                                 StatisticsEnable;
3255   bool                                 Enable;
3256   uint64_t                             KernelStartPointer;
3257   uint32_t                             PerThreadScratchSpace;
3258   __gen_address_type                   ScratchSpaceBasePointer;
3259   uint32_t                             VertexURBEntryReadOffset;
3260   uint32_t                             VertexURBEntryReadLength;
3261   uint32_t                             DispatchGRFStartRegisterForURBData;
3262   bool                                 IncludeVertexHandles;
3263   bool                                 HSaccessesUAV;
3264   bool                                 VectorMaskEnable;
3265   bool                                 SingleProgramFlow;
3266   uint64_t                             SemaphoreHandle;
3267};
3268
3269static inline __attribute__((always_inline)) void
3270GFX75_3DSTATE_HS_pack(__attribute__((unused)) __gen_user_data *data,
3271                      __attribute__((unused)) void * restrict dst,
3272                      __attribute__((unused)) const struct GFX75_3DSTATE_HS * restrict values)
3273{
3274   uint32_t * restrict dw = (uint32_t * restrict) dst;
3275
3276   dw[0] =
3277      __gen_uint(values->DWordLength, 0, 7) |
3278      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3279      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3280      __gen_uint(values->CommandSubType, 27, 28) |
3281      __gen_uint(values->CommandType, 29, 31);
3282
3283   dw[1] =
3284      __gen_uint(values->MaximumNumberofThreads, 0, 7) |
3285      __gen_uint(values->SoftwareExceptionEnable, 12, 12) |
3286      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
3287      __gen_uint(values->FloatingPointMode, 16, 16) |
3288      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
3289      __gen_uint(values->BindingTableEntryCount, 18, 25) |
3290      __gen_uint(values->SamplerCount, 27, 29);
3291
3292   dw[2] =
3293      __gen_uint(values->InstanceCount, 0, 3) |
3294      __gen_uint(values->StatisticsEnable, 29, 29) |
3295      __gen_uint(values->Enable, 31, 31);
3296
3297   dw[3] =
3298      __gen_offset(values->KernelStartPointer, 6, 31);
3299
3300   const uint32_t v4 =
3301      __gen_uint(values->PerThreadScratchSpace, 0, 3);
3302   dw[4] = __gen_address(data, &dw[4], values->ScratchSpaceBasePointer, v4, 10, 31);
3303
3304   dw[5] =
3305      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
3306      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
3307      __gen_uint(values->DispatchGRFStartRegisterForURBData, 19, 23) |
3308      __gen_uint(values->IncludeVertexHandles, 24, 24) |
3309      __gen_uint(values->HSaccessesUAV, 25, 25) |
3310      __gen_uint(values->VectorMaskEnable, 26, 26) |
3311      __gen_uint(values->SingleProgramFlow, 27, 27);
3312
3313   dw[6] =
3314      __gen_offset(values->SemaphoreHandle, 0, 12);
3315}
3316
3317#define GFX75_3DSTATE_INDEX_BUFFER_length      3
3318#define GFX75_3DSTATE_INDEX_BUFFER_length_bias      2
3319#define GFX75_3DSTATE_INDEX_BUFFER_header       \
3320   .DWordLength                         =      1,  \
3321   ._3DCommandSubOpcode                 =     10,  \
3322   ._3DCommandOpcode                    =      0,  \
3323   .CommandSubType                      =      3,  \
3324   .CommandType                         =      3
3325
3326struct GFX75_3DSTATE_INDEX_BUFFER {
3327   uint32_t                             DWordLength;
3328   uint32_t                             IndexFormat;
3329#define INDEX_BYTE                               0
3330#define INDEX_WORD                               1
3331#define INDEX_DWORD                              2
3332   uint32_t                             MOCS;
3333   uint32_t                             _3DCommandSubOpcode;
3334   uint32_t                             _3DCommandOpcode;
3335   uint32_t                             CommandSubType;
3336   uint32_t                             CommandType;
3337   __gen_address_type                   BufferStartingAddress;
3338   __gen_address_type                   BufferEndingAddress;
3339};
3340
3341static inline __attribute__((always_inline)) void
3342GFX75_3DSTATE_INDEX_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
3343                                __attribute__((unused)) void * restrict dst,
3344                                __attribute__((unused)) const struct GFX75_3DSTATE_INDEX_BUFFER * restrict values)
3345{
3346   uint32_t * restrict dw = (uint32_t * restrict) dst;
3347
3348   dw[0] =
3349      __gen_uint(values->DWordLength, 0, 7) |
3350      __gen_uint(values->IndexFormat, 8, 9) |
3351      __gen_uint(values->MOCS, 12, 15) |
3352      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3353      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3354      __gen_uint(values->CommandSubType, 27, 28) |
3355      __gen_uint(values->CommandType, 29, 31);
3356
3357   dw[1] = __gen_address(data, &dw[1], values->BufferStartingAddress, 0, 0, 31);
3358
3359   dw[2] = __gen_address(data, &dw[2], values->BufferEndingAddress, 0, 0, 31);
3360}
3361
3362#define GFX75_3DSTATE_LINE_STIPPLE_length      3
3363#define GFX75_3DSTATE_LINE_STIPPLE_length_bias      2
3364#define GFX75_3DSTATE_LINE_STIPPLE_header       \
3365   .DWordLength                         =      1,  \
3366   ._3DCommandSubOpcode                 =      8,  \
3367   ._3DCommandOpcode                    =      1,  \
3368   .CommandSubType                      =      3,  \
3369   .CommandType                         =      3
3370
3371struct GFX75_3DSTATE_LINE_STIPPLE {
3372   uint32_t                             DWordLength;
3373   uint32_t                             _3DCommandSubOpcode;
3374   uint32_t                             _3DCommandOpcode;
3375   uint32_t                             CommandSubType;
3376   uint32_t                             CommandType;
3377   uint32_t                             LineStipplePattern;
3378   uint32_t                             CurrentStippleIndex;
3379   uint32_t                             CurrentRepeatCounter;
3380   bool                                 ModifyEnableCurrentRepeatCounterCurrentStippleIndex;
3381   uint32_t                             LineStippleRepeatCount;
3382   float                                LineStippleInverseRepeatCount;
3383};
3384
3385static inline __attribute__((always_inline)) void
3386GFX75_3DSTATE_LINE_STIPPLE_pack(__attribute__((unused)) __gen_user_data *data,
3387                                __attribute__((unused)) void * restrict dst,
3388                                __attribute__((unused)) const struct GFX75_3DSTATE_LINE_STIPPLE * restrict values)
3389{
3390   uint32_t * restrict dw = (uint32_t * restrict) dst;
3391
3392   dw[0] =
3393      __gen_uint(values->DWordLength, 0, 7) |
3394      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3395      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3396      __gen_uint(values->CommandSubType, 27, 28) |
3397      __gen_uint(values->CommandType, 29, 31);
3398
3399   dw[1] =
3400      __gen_uint(values->LineStipplePattern, 0, 15) |
3401      __gen_uint(values->CurrentStippleIndex, 16, 19) |
3402      __gen_uint(values->CurrentRepeatCounter, 21, 29) |
3403      __gen_uint(values->ModifyEnableCurrentRepeatCounterCurrentStippleIndex, 31, 31);
3404
3405   dw[2] =
3406      __gen_uint(values->LineStippleRepeatCount, 0, 8) |
3407      __gen_ufixed(values->LineStippleInverseRepeatCount, 15, 31, 16);
3408}
3409
3410#define GFX75_3DSTATE_MONOFILTER_SIZE_length      2
3411#define GFX75_3DSTATE_MONOFILTER_SIZE_length_bias      2
3412#define GFX75_3DSTATE_MONOFILTER_SIZE_header    \
3413   .DWordLength                         =      0,  \
3414   ._3DCommandSubOpcode                 =     17,  \
3415   ._3DCommandOpcode                    =      1,  \
3416   .CommandSubType                      =      3,  \
3417   .CommandType                         =      3
3418
3419struct GFX75_3DSTATE_MONOFILTER_SIZE {
3420   uint32_t                             DWordLength;
3421   uint32_t                             _3DCommandSubOpcode;
3422   uint32_t                             _3DCommandOpcode;
3423   uint32_t                             CommandSubType;
3424   uint32_t                             CommandType;
3425   uint32_t                             MonochromeFilterHeight;
3426   uint32_t                             MonochromeFilterWidth;
3427};
3428
3429static inline __attribute__((always_inline)) void
3430GFX75_3DSTATE_MONOFILTER_SIZE_pack(__attribute__((unused)) __gen_user_data *data,
3431                                   __attribute__((unused)) void * restrict dst,
3432                                   __attribute__((unused)) const struct GFX75_3DSTATE_MONOFILTER_SIZE * restrict values)
3433{
3434   uint32_t * restrict dw = (uint32_t * restrict) dst;
3435
3436   dw[0] =
3437      __gen_uint(values->DWordLength, 0, 7) |
3438      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3439      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3440      __gen_uint(values->CommandSubType, 27, 28) |
3441      __gen_uint(values->CommandType, 29, 31);
3442
3443   dw[1] =
3444      __gen_uint(values->MonochromeFilterHeight, 0, 2) |
3445      __gen_uint(values->MonochromeFilterWidth, 3, 5);
3446}
3447
3448#define GFX75_3DSTATE_MULTISAMPLE_length       4
3449#define GFX75_3DSTATE_MULTISAMPLE_length_bias      2
3450#define GFX75_3DSTATE_MULTISAMPLE_header        \
3451   .DWordLength                         =      2,  \
3452   ._3DCommandSubOpcode                 =     13,  \
3453   ._3DCommandOpcode                    =      1,  \
3454   .CommandSubType                      =      3,  \
3455   .CommandType                         =      3
3456
3457struct GFX75_3DSTATE_MULTISAMPLE {
3458   uint32_t                             DWordLength;
3459   uint32_t                             _3DCommandSubOpcode;
3460   uint32_t                             _3DCommandOpcode;
3461   uint32_t                             CommandSubType;
3462   uint32_t                             CommandType;
3463   uint32_t                             NumberofMultisamples;
3464#define NUMSAMPLES_1                             0
3465#define NUMSAMPLES_4                             2
3466#define NUMSAMPLES_8                             3
3467   uint32_t                             PixelLocation;
3468#define CENTER                                   0
3469#define UL_CORNER                                1
3470   bool                                 MultiSampleEnable;
3471   float                                Sample0YOffset;
3472   float                                Sample0XOffset;
3473   float                                Sample1YOffset;
3474   float                                Sample1XOffset;
3475   float                                Sample2YOffset;
3476   float                                Sample2XOffset;
3477   float                                Sample3YOffset;
3478   float                                Sample3XOffset;
3479   float                                Sample4YOffset;
3480   float                                Sample4XOffset;
3481   float                                Sample5YOffset;
3482   float                                Sample5XOffset;
3483   float                                Sample6YOffset;
3484   float                                Sample6XOffset;
3485   float                                Sample7YOffset;
3486   float                                Sample7XOffset;
3487};
3488
3489static inline __attribute__((always_inline)) void
3490GFX75_3DSTATE_MULTISAMPLE_pack(__attribute__((unused)) __gen_user_data *data,
3491                               __attribute__((unused)) void * restrict dst,
3492                               __attribute__((unused)) const struct GFX75_3DSTATE_MULTISAMPLE * restrict values)
3493{
3494   uint32_t * restrict dw = (uint32_t * restrict) dst;
3495
3496   dw[0] =
3497      __gen_uint(values->DWordLength, 0, 7) |
3498      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3499      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3500      __gen_uint(values->CommandSubType, 27, 28) |
3501      __gen_uint(values->CommandType, 29, 31);
3502
3503   dw[1] =
3504      __gen_uint(values->NumberofMultisamples, 1, 3) |
3505      __gen_uint(values->PixelLocation, 4, 4) |
3506      __gen_uint(values->MultiSampleEnable, 5, 5);
3507
3508   dw[2] =
3509      __gen_ufixed(values->Sample0YOffset, 0, 3, 4) |
3510      __gen_ufixed(values->Sample0XOffset, 4, 7, 4) |
3511      __gen_ufixed(values->Sample1YOffset, 8, 11, 4) |
3512      __gen_ufixed(values->Sample1XOffset, 12, 15, 4) |
3513      __gen_ufixed(values->Sample2YOffset, 16, 19, 4) |
3514      __gen_ufixed(values->Sample2XOffset, 20, 23, 4) |
3515      __gen_ufixed(values->Sample3YOffset, 24, 27, 4) |
3516      __gen_ufixed(values->Sample3XOffset, 28, 31, 4);
3517
3518   dw[3] =
3519      __gen_ufixed(values->Sample4YOffset, 0, 3, 4) |
3520      __gen_ufixed(values->Sample4XOffset, 4, 7, 4) |
3521      __gen_ufixed(values->Sample5YOffset, 8, 11, 4) |
3522      __gen_ufixed(values->Sample5XOffset, 12, 15, 4) |
3523      __gen_ufixed(values->Sample6YOffset, 16, 19, 4) |
3524      __gen_ufixed(values->Sample6XOffset, 20, 23, 4) |
3525      __gen_ufixed(values->Sample7YOffset, 24, 27, 4) |
3526      __gen_ufixed(values->Sample7XOffset, 28, 31, 4);
3527}
3528
3529#define GFX75_3DSTATE_POLY_STIPPLE_OFFSET_length      2
3530#define GFX75_3DSTATE_POLY_STIPPLE_OFFSET_length_bias      2
3531#define GFX75_3DSTATE_POLY_STIPPLE_OFFSET_header\
3532   .DWordLength                         =      0,  \
3533   ._3DCommandSubOpcode                 =      6,  \
3534   ._3DCommandOpcode                    =      1,  \
3535   .CommandSubType                      =      3,  \
3536   .CommandType                         =      3
3537
3538struct GFX75_3DSTATE_POLY_STIPPLE_OFFSET {
3539   uint32_t                             DWordLength;
3540   uint32_t                             _3DCommandSubOpcode;
3541   uint32_t                             _3DCommandOpcode;
3542   uint32_t                             CommandSubType;
3543   uint32_t                             CommandType;
3544   uint32_t                             PolygonStippleYOffset;
3545   uint32_t                             PolygonStippleXOffset;
3546};
3547
3548static inline __attribute__((always_inline)) void
3549GFX75_3DSTATE_POLY_STIPPLE_OFFSET_pack(__attribute__((unused)) __gen_user_data *data,
3550                                       __attribute__((unused)) void * restrict dst,
3551                                       __attribute__((unused)) const struct GFX75_3DSTATE_POLY_STIPPLE_OFFSET * restrict values)
3552{
3553   uint32_t * restrict dw = (uint32_t * restrict) dst;
3554
3555   dw[0] =
3556      __gen_uint(values->DWordLength, 0, 7) |
3557      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3558      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3559      __gen_uint(values->CommandSubType, 27, 28) |
3560      __gen_uint(values->CommandType, 29, 31);
3561
3562   dw[1] =
3563      __gen_uint(values->PolygonStippleYOffset, 0, 4) |
3564      __gen_uint(values->PolygonStippleXOffset, 8, 12);
3565}
3566
3567#define GFX75_3DSTATE_POLY_STIPPLE_PATTERN_length     33
3568#define GFX75_3DSTATE_POLY_STIPPLE_PATTERN_length_bias      2
3569#define GFX75_3DSTATE_POLY_STIPPLE_PATTERN_header\
3570   .DWordLength                         =     31,  \
3571   ._3DCommandSubOpcode                 =      7,  \
3572   ._3DCommandOpcode                    =      1,  \
3573   .CommandSubType                      =      3,  \
3574   .CommandType                         =      3
3575
3576struct GFX75_3DSTATE_POLY_STIPPLE_PATTERN {
3577   uint32_t                             DWordLength;
3578   uint32_t                             _3DCommandSubOpcode;
3579   uint32_t                             _3DCommandOpcode;
3580   uint32_t                             CommandSubType;
3581   uint32_t                             CommandType;
3582   uint32_t                             PatternRow[32];
3583};
3584
3585static inline __attribute__((always_inline)) void
3586GFX75_3DSTATE_POLY_STIPPLE_PATTERN_pack(__attribute__((unused)) __gen_user_data *data,
3587                                        __attribute__((unused)) void * restrict dst,
3588                                        __attribute__((unused)) const struct GFX75_3DSTATE_POLY_STIPPLE_PATTERN * restrict values)
3589{
3590   uint32_t * restrict dw = (uint32_t * restrict) dst;
3591
3592   dw[0] =
3593      __gen_uint(values->DWordLength, 0, 7) |
3594      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3595      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3596      __gen_uint(values->CommandSubType, 27, 28) |
3597      __gen_uint(values->CommandType, 29, 31);
3598
3599   dw[1] =
3600      __gen_uint(values->PatternRow[0], 0, 31);
3601
3602   dw[2] =
3603      __gen_uint(values->PatternRow[1], 0, 31);
3604
3605   dw[3] =
3606      __gen_uint(values->PatternRow[2], 0, 31);
3607
3608   dw[4] =
3609      __gen_uint(values->PatternRow[3], 0, 31);
3610
3611   dw[5] =
3612      __gen_uint(values->PatternRow[4], 0, 31);
3613
3614   dw[6] =
3615      __gen_uint(values->PatternRow[5], 0, 31);
3616
3617   dw[7] =
3618      __gen_uint(values->PatternRow[6], 0, 31);
3619
3620   dw[8] =
3621      __gen_uint(values->PatternRow[7], 0, 31);
3622
3623   dw[9] =
3624      __gen_uint(values->PatternRow[8], 0, 31);
3625
3626   dw[10] =
3627      __gen_uint(values->PatternRow[9], 0, 31);
3628
3629   dw[11] =
3630      __gen_uint(values->PatternRow[10], 0, 31);
3631
3632   dw[12] =
3633      __gen_uint(values->PatternRow[11], 0, 31);
3634
3635   dw[13] =
3636      __gen_uint(values->PatternRow[12], 0, 31);
3637
3638   dw[14] =
3639      __gen_uint(values->PatternRow[13], 0, 31);
3640
3641   dw[15] =
3642      __gen_uint(values->PatternRow[14], 0, 31);
3643
3644   dw[16] =
3645      __gen_uint(values->PatternRow[15], 0, 31);
3646
3647   dw[17] =
3648      __gen_uint(values->PatternRow[16], 0, 31);
3649
3650   dw[18] =
3651      __gen_uint(values->PatternRow[17], 0, 31);
3652
3653   dw[19] =
3654      __gen_uint(values->PatternRow[18], 0, 31);
3655
3656   dw[20] =
3657      __gen_uint(values->PatternRow[19], 0, 31);
3658
3659   dw[21] =
3660      __gen_uint(values->PatternRow[20], 0, 31);
3661
3662   dw[22] =
3663      __gen_uint(values->PatternRow[21], 0, 31);
3664
3665   dw[23] =
3666      __gen_uint(values->PatternRow[22], 0, 31);
3667
3668   dw[24] =
3669      __gen_uint(values->PatternRow[23], 0, 31);
3670
3671   dw[25] =
3672      __gen_uint(values->PatternRow[24], 0, 31);
3673
3674   dw[26] =
3675      __gen_uint(values->PatternRow[25], 0, 31);
3676
3677   dw[27] =
3678      __gen_uint(values->PatternRow[26], 0, 31);
3679
3680   dw[28] =
3681      __gen_uint(values->PatternRow[27], 0, 31);
3682
3683   dw[29] =
3684      __gen_uint(values->PatternRow[28], 0, 31);
3685
3686   dw[30] =
3687      __gen_uint(values->PatternRow[29], 0, 31);
3688
3689   dw[31] =
3690      __gen_uint(values->PatternRow[30], 0, 31);
3691
3692   dw[32] =
3693      __gen_uint(values->PatternRow[31], 0, 31);
3694}
3695
3696#define GFX75_3DSTATE_PS_length                8
3697#define GFX75_3DSTATE_PS_length_bias           2
3698#define GFX75_3DSTATE_PS_header                 \
3699   .DWordLength                         =      6,  \
3700   ._3DCommandSubOpcode                 =     32,  \
3701   ._3DCommandOpcode                    =      0,  \
3702   .CommandSubType                      =      3,  \
3703   .CommandType                         =      3
3704
3705struct GFX75_3DSTATE_PS {
3706   uint32_t                             DWordLength;
3707   uint32_t                             _3DCommandSubOpcode;
3708   uint32_t                             _3DCommandOpcode;
3709   uint32_t                             CommandSubType;
3710   uint32_t                             CommandType;
3711   uint64_t                             KernelStartPointer0;
3712   bool                                 SoftwareExceptionEnable;
3713   bool                                 MaskStackExceptionEnable;
3714   bool                                 IllegalOpcodeExceptionEnable;
3715   uint32_t                             RoundingMode;
3716#define RTNE                                     0
3717#define RU                                       1
3718#define RD                                       2
3719#define RTZ                                      3
3720   uint32_t                             FloatingPointMode;
3721#define IEEE754                                  0
3722#define Alternate                                1
3723   uint32_t                             ThreadPriority;
3724#define High                                     1
3725   uint32_t                             BindingTableEntryCount;
3726   uint32_t                             DenormalMode;
3727#define FTZ                                      0
3728#define RET                                      1
3729   uint32_t                             SamplerCount;
3730   bool                                 VectorMaskEnable;
3731   bool                                 SingleProgramFlow;
3732   uint32_t                             PerThreadScratchSpace;
3733   __gen_address_type                   ScratchSpaceBasePointer;
3734   bool                                 _8PixelDispatchEnable;
3735   bool                                 _16PixelDispatchEnable;
3736   bool                                 _32PixelDispatchEnable;
3737   uint32_t                             PositionXYOffsetSelect;
3738#define POSOFFSET_NONE                           0
3739#define POSOFFSET_CENTROID                       2
3740#define POSOFFSET_SAMPLE                         3
3741   bool                                 PSAccessesUAV;
3742   bool                                 RenderTargetResolveEnable;
3743   bool                                 DualSourceBlendEnable;
3744   bool                                 RenderTargetFastClearEnable;
3745   bool                                 oMaskPresenttoRenderTarget;
3746   bool                                 AttributeEnable;
3747   bool                                 PushConstantEnable;
3748   uint32_t                             SampleMask;
3749   uint32_t                             MaximumNumberofThreads;
3750   uint32_t                             DispatchGRFStartRegisterForConstantSetupData2;
3751   uint32_t                             DispatchGRFStartRegisterForConstantSetupData1;
3752   uint32_t                             DispatchGRFStartRegisterForConstantSetupData0;
3753   uint64_t                             KernelStartPointer1;
3754   uint64_t                             KernelStartPointer2;
3755};
3756
3757static inline __attribute__((always_inline)) void
3758GFX75_3DSTATE_PS_pack(__attribute__((unused)) __gen_user_data *data,
3759                      __attribute__((unused)) void * restrict dst,
3760                      __attribute__((unused)) const struct GFX75_3DSTATE_PS * restrict values)
3761{
3762   uint32_t * restrict dw = (uint32_t * restrict) dst;
3763
3764   dw[0] =
3765      __gen_uint(values->DWordLength, 0, 7) |
3766      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3767      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3768      __gen_uint(values->CommandSubType, 27, 28) |
3769      __gen_uint(values->CommandType, 29, 31);
3770
3771   dw[1] =
3772      __gen_offset(values->KernelStartPointer0, 6, 31);
3773
3774   dw[2] =
3775      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
3776      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
3777      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
3778      __gen_uint(values->RoundingMode, 14, 15) |
3779      __gen_uint(values->FloatingPointMode, 16, 16) |
3780      __gen_uint(values->ThreadPriority, 17, 17) |
3781      __gen_uint(values->BindingTableEntryCount, 18, 25) |
3782      __gen_uint(values->DenormalMode, 26, 26) |
3783      __gen_uint(values->SamplerCount, 27, 29) |
3784      __gen_uint(values->VectorMaskEnable, 30, 30) |
3785      __gen_uint(values->SingleProgramFlow, 31, 31);
3786
3787   const uint32_t v3 =
3788      __gen_uint(values->PerThreadScratchSpace, 0, 3);
3789   dw[3] = __gen_address(data, &dw[3], values->ScratchSpaceBasePointer, v3, 10, 31);
3790
3791   dw[4] =
3792      __gen_uint(values->_8PixelDispatchEnable, 0, 0) |
3793      __gen_uint(values->_16PixelDispatchEnable, 1, 1) |
3794      __gen_uint(values->_32PixelDispatchEnable, 2, 2) |
3795      __gen_uint(values->PositionXYOffsetSelect, 3, 4) |
3796      __gen_uint(values->PSAccessesUAV, 5, 5) |
3797      __gen_uint(values->RenderTargetResolveEnable, 6, 6) |
3798      __gen_uint(values->DualSourceBlendEnable, 7, 7) |
3799      __gen_uint(values->RenderTargetFastClearEnable, 8, 8) |
3800      __gen_uint(values->oMaskPresenttoRenderTarget, 9, 9) |
3801      __gen_uint(values->AttributeEnable, 10, 10) |
3802      __gen_uint(values->PushConstantEnable, 11, 11) |
3803      __gen_uint(values->SampleMask, 12, 19) |
3804      __gen_uint(values->MaximumNumberofThreads, 23, 31);
3805
3806   dw[5] =
3807      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData2, 0, 6) |
3808      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData1, 8, 14) |
3809      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData0, 16, 22);
3810
3811   dw[6] =
3812      __gen_offset(values->KernelStartPointer1, 6, 31);
3813
3814   dw[7] =
3815      __gen_offset(values->KernelStartPointer2, 6, 31);
3816}
3817
3818#define GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_DS_length      2
3819#define GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_DS_length_bias      2
3820#define GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_DS_header\
3821   .DWordLength                         =      0,  \
3822   ._3DCommandSubOpcode                 =     20,  \
3823   ._3DCommandOpcode                    =      1,  \
3824   .CommandSubType                      =      3,  \
3825   .CommandType                         =      3
3826
3827struct GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_DS {
3828   uint32_t                             DWordLength;
3829   uint32_t                             _3DCommandSubOpcode;
3830   uint32_t                             _3DCommandOpcode;
3831   uint32_t                             CommandSubType;
3832   uint32_t                             CommandType;
3833   uint32_t                             ConstantBufferSize;
3834   uint32_t                             ConstantBufferOffset;
3835};
3836
3837static inline __attribute__((always_inline)) void
3838GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_DS_pack(__attribute__((unused)) __gen_user_data *data,
3839                                          __attribute__((unused)) void * restrict dst,
3840                                          __attribute__((unused)) const struct GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_DS * restrict values)
3841{
3842   uint32_t * restrict dw = (uint32_t * restrict) dst;
3843
3844   dw[0] =
3845      __gen_uint(values->DWordLength, 0, 7) |
3846      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3847      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3848      __gen_uint(values->CommandSubType, 27, 28) |
3849      __gen_uint(values->CommandType, 29, 31);
3850
3851   dw[1] =
3852      __gen_uint(values->ConstantBufferSize, 0, 5) |
3853      __gen_uint(values->ConstantBufferOffset, 16, 20);
3854}
3855
3856#define GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_GS_length      2
3857#define GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_GS_length_bias      2
3858#define GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_GS_header\
3859   .DWordLength                         =      0,  \
3860   ._3DCommandSubOpcode                 =     21,  \
3861   ._3DCommandOpcode                    =      1,  \
3862   .CommandSubType                      =      3,  \
3863   .CommandType                         =      3
3864
3865struct GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_GS {
3866   uint32_t                             DWordLength;
3867   uint32_t                             _3DCommandSubOpcode;
3868   uint32_t                             _3DCommandOpcode;
3869   uint32_t                             CommandSubType;
3870   uint32_t                             CommandType;
3871   uint32_t                             ConstantBufferSize;
3872   uint32_t                             ConstantBufferOffset;
3873};
3874
3875static inline __attribute__((always_inline)) void
3876GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_GS_pack(__attribute__((unused)) __gen_user_data *data,
3877                                          __attribute__((unused)) void * restrict dst,
3878                                          __attribute__((unused)) const struct GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_GS * restrict values)
3879{
3880   uint32_t * restrict dw = (uint32_t * restrict) dst;
3881
3882   dw[0] =
3883      __gen_uint(values->DWordLength, 0, 7) |
3884      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3885      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3886      __gen_uint(values->CommandSubType, 27, 28) |
3887      __gen_uint(values->CommandType, 29, 31);
3888
3889   dw[1] =
3890      __gen_uint(values->ConstantBufferSize, 0, 5) |
3891      __gen_uint(values->ConstantBufferOffset, 16, 20);
3892}
3893
3894#define GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_HS_length      2
3895#define GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_HS_length_bias      2
3896#define GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_HS_header\
3897   .DWordLength                         =      0,  \
3898   ._3DCommandSubOpcode                 =     19,  \
3899   ._3DCommandOpcode                    =      1,  \
3900   .CommandSubType                      =      3,  \
3901   .CommandType                         =      3
3902
3903struct GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_HS {
3904   uint32_t                             DWordLength;
3905   uint32_t                             _3DCommandSubOpcode;
3906   uint32_t                             _3DCommandOpcode;
3907   uint32_t                             CommandSubType;
3908   uint32_t                             CommandType;
3909   uint32_t                             ConstantBufferSize;
3910   uint32_t                             ConstantBufferOffset;
3911};
3912
3913static inline __attribute__((always_inline)) void
3914GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_HS_pack(__attribute__((unused)) __gen_user_data *data,
3915                                          __attribute__((unused)) void * restrict dst,
3916                                          __attribute__((unused)) const struct GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_HS * 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   dw[1] =
3928      __gen_uint(values->ConstantBufferSize, 0, 5) |
3929      __gen_uint(values->ConstantBufferOffset, 16, 20);
3930}
3931
3932#define GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_PS_length      2
3933#define GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_PS_length_bias      2
3934#define GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_PS_header\
3935   .DWordLength                         =      0,  \
3936   ._3DCommandSubOpcode                 =     22,  \
3937   ._3DCommandOpcode                    =      1,  \
3938   .CommandSubType                      =      3,  \
3939   .CommandType                         =      3
3940
3941struct GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_PS {
3942   uint32_t                             DWordLength;
3943   uint32_t                             _3DCommandSubOpcode;
3944   uint32_t                             _3DCommandOpcode;
3945   uint32_t                             CommandSubType;
3946   uint32_t                             CommandType;
3947   uint32_t                             ConstantBufferSize;
3948   uint32_t                             ConstantBufferOffset;
3949};
3950
3951static inline __attribute__((always_inline)) void
3952GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_PS_pack(__attribute__((unused)) __gen_user_data *data,
3953                                          __attribute__((unused)) void * restrict dst,
3954                                          __attribute__((unused)) const struct GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_PS * restrict values)
3955{
3956   uint32_t * restrict dw = (uint32_t * restrict) dst;
3957
3958   dw[0] =
3959      __gen_uint(values->DWordLength, 0, 7) |
3960      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3961      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3962      __gen_uint(values->CommandSubType, 27, 28) |
3963      __gen_uint(values->CommandType, 29, 31);
3964
3965   dw[1] =
3966      __gen_uint(values->ConstantBufferSize, 0, 5) |
3967      __gen_uint(values->ConstantBufferOffset, 16, 20);
3968}
3969
3970#define GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_VS_length      2
3971#define GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_VS_length_bias      2
3972#define GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_VS_header\
3973   .DWordLength                         =      0,  \
3974   ._3DCommandSubOpcode                 =     18,  \
3975   ._3DCommandOpcode                    =      1,  \
3976   .CommandSubType                      =      3,  \
3977   .CommandType                         =      3
3978
3979struct GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_VS {
3980   uint32_t                             DWordLength;
3981   uint32_t                             _3DCommandSubOpcode;
3982   uint32_t                             _3DCommandOpcode;
3983   uint32_t                             CommandSubType;
3984   uint32_t                             CommandType;
3985   uint32_t                             ConstantBufferSize;
3986   uint32_t                             ConstantBufferOffset;
3987};
3988
3989static inline __attribute__((always_inline)) void
3990GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_VS_pack(__attribute__((unused)) __gen_user_data *data,
3991                                          __attribute__((unused)) void * restrict dst,
3992                                          __attribute__((unused)) const struct GFX75_3DSTATE_PUSH_CONSTANT_ALLOC_VS * restrict values)
3993{
3994   uint32_t * restrict dw = (uint32_t * restrict) dst;
3995
3996   dw[0] =
3997      __gen_uint(values->DWordLength, 0, 7) |
3998      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3999      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4000      __gen_uint(values->CommandSubType, 27, 28) |
4001      __gen_uint(values->CommandType, 29, 31);
4002
4003   dw[1] =
4004      __gen_uint(values->ConstantBufferSize, 0, 5) |
4005      __gen_uint(values->ConstantBufferOffset, 16, 20);
4006}
4007
4008#define GFX75_3DSTATE_RAST_MULTISAMPLE_length      6
4009#define GFX75_3DSTATE_RAST_MULTISAMPLE_length_bias      2
4010#define GFX75_3DSTATE_RAST_MULTISAMPLE_header   \
4011   .DWordLength                         =      4,  \
4012   ._3DCommandSubOpcode                 =     14,  \
4013   ._3DCommandOpcode                    =      1,  \
4014   .CommandSubType                      =      3,  \
4015   .CommandType                         =      3
4016
4017struct GFX75_3DSTATE_RAST_MULTISAMPLE {
4018   uint32_t                             DWordLength;
4019   uint32_t                             _3DCommandSubOpcode;
4020   uint32_t                             _3DCommandOpcode;
4021   uint32_t                             CommandSubType;
4022   uint32_t                             CommandType;
4023   uint32_t                             NumberofRasterizationMultisamples;
4024#define NRM_NUMRASTSAMPLES_1                     0
4025#define NRM_NUMRASTSAMPLES_2                     1
4026#define NRM_NUMRASTSAMPLES_4                     2
4027#define NRM_NUMRASTSAMPLES_8                     3
4028#define NRM_NUMRASTSAMPLES_16                    4
4029   float                                Sample0YOffset;
4030   float                                Sample0XOffset;
4031   float                                Sample1YOffset;
4032   float                                Sample1XOffset;
4033   float                                Sample2YOffset;
4034   float                                Sample2XOffset;
4035   float                                Sample3YOffset;
4036   float                                Sample3XOffset;
4037   float                                Sample4YOffset;
4038   float                                Sample4XOffset;
4039   float                                Sample5YOffset;
4040   float                                Sample5XOffset;
4041   float                                Sample6YOffset;
4042   float                                Sample6XOffset;
4043   float                                Sample7YOffset;
4044   float                                Sample7XOffset;
4045   float                                Sample8YOffset;
4046   float                                Sample8XOffset;
4047   float                                Sample9YOffset;
4048   float                                Sample9XOffset;
4049   float                                Sample10YOffset;
4050   float                                Sample10XOffset;
4051   float                                Sample11YOffset;
4052   float                                Sample11XOffset;
4053   float                                Sample12YOffset;
4054   float                                Sample12XOffset;
4055   float                                Sample13YOffset;
4056   float                                Sample13XOffset;
4057   float                                Sample14YOffset;
4058   float                                Sample14XOffset;
4059   float                                Sample15YOffset;
4060   float                                Sample15XOffset;
4061};
4062
4063static inline __attribute__((always_inline)) void
4064GFX75_3DSTATE_RAST_MULTISAMPLE_pack(__attribute__((unused)) __gen_user_data *data,
4065                                    __attribute__((unused)) void * restrict dst,
4066                                    __attribute__((unused)) const struct GFX75_3DSTATE_RAST_MULTISAMPLE * restrict values)
4067{
4068   uint32_t * restrict dw = (uint32_t * restrict) dst;
4069
4070   dw[0] =
4071      __gen_uint(values->DWordLength, 0, 7) |
4072      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4073      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4074      __gen_uint(values->CommandSubType, 27, 28) |
4075      __gen_uint(values->CommandType, 29, 31);
4076
4077   dw[1] =
4078      __gen_uint(values->NumberofRasterizationMultisamples, 1, 3);
4079
4080   dw[2] =
4081      __gen_ufixed(values->Sample0YOffset, 0, 3, 4) |
4082      __gen_ufixed(values->Sample0XOffset, 4, 7, 4) |
4083      __gen_ufixed(values->Sample1YOffset, 8, 11, 4) |
4084      __gen_ufixed(values->Sample1XOffset, 12, 15, 4) |
4085      __gen_ufixed(values->Sample2YOffset, 16, 19, 4) |
4086      __gen_ufixed(values->Sample2XOffset, 20, 23, 4) |
4087      __gen_ufixed(values->Sample3YOffset, 24, 27, 4) |
4088      __gen_ufixed(values->Sample3XOffset, 28, 31, 4);
4089
4090   dw[3] =
4091      __gen_ufixed(values->Sample4YOffset, 0, 3, 4) |
4092      __gen_ufixed(values->Sample4XOffset, 4, 7, 4) |
4093      __gen_ufixed(values->Sample5YOffset, 8, 11, 4) |
4094      __gen_ufixed(values->Sample5XOffset, 12, 15, 4) |
4095      __gen_ufixed(values->Sample6YOffset, 16, 19, 4) |
4096      __gen_ufixed(values->Sample6XOffset, 20, 23, 4) |
4097      __gen_ufixed(values->Sample7YOffset, 24, 27, 4) |
4098      __gen_ufixed(values->Sample7XOffset, 28, 31, 4);
4099
4100   dw[4] =
4101      __gen_ufixed(values->Sample8YOffset, 0, 3, 4) |
4102      __gen_ufixed(values->Sample8XOffset, 4, 7, 4) |
4103      __gen_ufixed(values->Sample9YOffset, 8, 11, 4) |
4104      __gen_ufixed(values->Sample9XOffset, 12, 15, 4) |
4105      __gen_ufixed(values->Sample10YOffset, 16, 19, 4) |
4106      __gen_ufixed(values->Sample10XOffset, 20, 23, 4) |
4107      __gen_ufixed(values->Sample11YOffset, 24, 27, 4) |
4108      __gen_ufixed(values->Sample11XOffset, 28, 31, 4);
4109
4110   dw[5] =
4111      __gen_ufixed(values->Sample12YOffset, 0, 3, 4) |
4112      __gen_ufixed(values->Sample12XOffset, 4, 7, 4) |
4113      __gen_ufixed(values->Sample13YOffset, 8, 11, 4) |
4114      __gen_ufixed(values->Sample13XOffset, 12, 15, 4) |
4115      __gen_ufixed(values->Sample14YOffset, 16, 19, 4) |
4116      __gen_ufixed(values->Sample14XOffset, 20, 23, 4) |
4117      __gen_ufixed(values->Sample15YOffset, 24, 27, 4) |
4118      __gen_ufixed(values->Sample15XOffset, 28, 31, 4);
4119}
4120
4121#define GFX75_3DSTATE_SAMPLER_PALETTE_LOAD0_length_bias      2
4122#define GFX75_3DSTATE_SAMPLER_PALETTE_LOAD0_header\
4123   ._3DCommandSubOpcode                 =      2,  \
4124   ._3DCommandOpcode                    =      1,  \
4125   .CommandSubType                      =      3,  \
4126   .CommandType                         =      3
4127
4128struct GFX75_3DSTATE_SAMPLER_PALETTE_LOAD0 {
4129   uint32_t                             DWordLength;
4130   uint32_t                             _3DCommandSubOpcode;
4131   uint32_t                             _3DCommandOpcode;
4132   uint32_t                             CommandSubType;
4133   uint32_t                             CommandType;
4134   /* variable length fields follow */
4135};
4136
4137static inline __attribute__((always_inline)) void
4138GFX75_3DSTATE_SAMPLER_PALETTE_LOAD0_pack(__attribute__((unused)) __gen_user_data *data,
4139                                         __attribute__((unused)) void * restrict dst,
4140                                         __attribute__((unused)) const struct GFX75_3DSTATE_SAMPLER_PALETTE_LOAD0 * restrict values)
4141{
4142   uint32_t * restrict dw = (uint32_t * restrict) dst;
4143
4144   dw[0] =
4145      __gen_uint(values->DWordLength, 0, 7) |
4146      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4147      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4148      __gen_uint(values->CommandSubType, 27, 28) |
4149      __gen_uint(values->CommandType, 29, 31);
4150}
4151
4152#define GFX75_3DSTATE_SAMPLER_PALETTE_LOAD1_length_bias      2
4153#define GFX75_3DSTATE_SAMPLER_PALETTE_LOAD1_header\
4154   .DWordLength                         =      0,  \
4155   ._3DCommandSubOpcode                 =     12,  \
4156   ._3DCommandOpcode                    =      1,  \
4157   .CommandSubType                      =      3,  \
4158   .CommandType                         =      3
4159
4160struct GFX75_3DSTATE_SAMPLER_PALETTE_LOAD1 {
4161   uint32_t                             DWordLength;
4162   uint32_t                             _3DCommandSubOpcode;
4163   uint32_t                             _3DCommandOpcode;
4164   uint32_t                             CommandSubType;
4165   uint32_t                             CommandType;
4166   /* variable length fields follow */
4167};
4168
4169static inline __attribute__((always_inline)) void
4170GFX75_3DSTATE_SAMPLER_PALETTE_LOAD1_pack(__attribute__((unused)) __gen_user_data *data,
4171                                         __attribute__((unused)) void * restrict dst,
4172                                         __attribute__((unused)) const struct GFX75_3DSTATE_SAMPLER_PALETTE_LOAD1 * restrict values)
4173{
4174   uint32_t * restrict dw = (uint32_t * restrict) dst;
4175
4176   dw[0] =
4177      __gen_uint(values->DWordLength, 0, 7) |
4178      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4179      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4180      __gen_uint(values->CommandSubType, 27, 28) |
4181      __gen_uint(values->CommandType, 29, 31);
4182}
4183
4184#define GFX75_3DSTATE_SAMPLER_STATE_POINTERS_DS_length      2
4185#define GFX75_3DSTATE_SAMPLER_STATE_POINTERS_DS_length_bias      2
4186#define GFX75_3DSTATE_SAMPLER_STATE_POINTERS_DS_header\
4187   .DWordLength                         =      0,  \
4188   ._3DCommandSubOpcode                 =     45,  \
4189   ._3DCommandOpcode                    =      0,  \
4190   .CommandSubType                      =      3,  \
4191   .CommandType                         =      3
4192
4193struct GFX75_3DSTATE_SAMPLER_STATE_POINTERS_DS {
4194   uint32_t                             DWordLength;
4195   uint32_t                             _3DCommandSubOpcode;
4196   uint32_t                             _3DCommandOpcode;
4197   uint32_t                             CommandSubType;
4198   uint32_t                             CommandType;
4199   uint64_t                             PointertoDSSamplerState;
4200};
4201
4202static inline __attribute__((always_inline)) void
4203GFX75_3DSTATE_SAMPLER_STATE_POINTERS_DS_pack(__attribute__((unused)) __gen_user_data *data,
4204                                             __attribute__((unused)) void * restrict dst,
4205                                             __attribute__((unused)) const struct GFX75_3DSTATE_SAMPLER_STATE_POINTERS_DS * restrict values)
4206{
4207   uint32_t * restrict dw = (uint32_t * restrict) dst;
4208
4209   dw[0] =
4210      __gen_uint(values->DWordLength, 0, 7) |
4211      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4212      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4213      __gen_uint(values->CommandSubType, 27, 28) |
4214      __gen_uint(values->CommandType, 29, 31);
4215
4216   dw[1] =
4217      __gen_offset(values->PointertoDSSamplerState, 5, 31);
4218}
4219
4220#define GFX75_3DSTATE_SAMPLER_STATE_POINTERS_GS_length      2
4221#define GFX75_3DSTATE_SAMPLER_STATE_POINTERS_GS_length_bias      2
4222#define GFX75_3DSTATE_SAMPLER_STATE_POINTERS_GS_header\
4223   .DWordLength                         =      0,  \
4224   ._3DCommandSubOpcode                 =     46,  \
4225   ._3DCommandOpcode                    =      0,  \
4226   .CommandSubType                      =      3,  \
4227   .CommandType                         =      3
4228
4229struct GFX75_3DSTATE_SAMPLER_STATE_POINTERS_GS {
4230   uint32_t                             DWordLength;
4231   uint32_t                             _3DCommandSubOpcode;
4232   uint32_t                             _3DCommandOpcode;
4233   uint32_t                             CommandSubType;
4234   uint32_t                             CommandType;
4235   uint64_t                             PointertoGSSamplerState;
4236};
4237
4238static inline __attribute__((always_inline)) void
4239GFX75_3DSTATE_SAMPLER_STATE_POINTERS_GS_pack(__attribute__((unused)) __gen_user_data *data,
4240                                             __attribute__((unused)) void * restrict dst,
4241                                             __attribute__((unused)) const struct GFX75_3DSTATE_SAMPLER_STATE_POINTERS_GS * restrict values)
4242{
4243   uint32_t * restrict dw = (uint32_t * restrict) dst;
4244
4245   dw[0] =
4246      __gen_uint(values->DWordLength, 0, 7) |
4247      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4248      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4249      __gen_uint(values->CommandSubType, 27, 28) |
4250      __gen_uint(values->CommandType, 29, 31);
4251
4252   dw[1] =
4253      __gen_offset(values->PointertoGSSamplerState, 5, 31);
4254}
4255
4256#define GFX75_3DSTATE_SAMPLER_STATE_POINTERS_HS_length      2
4257#define GFX75_3DSTATE_SAMPLER_STATE_POINTERS_HS_length_bias      2
4258#define GFX75_3DSTATE_SAMPLER_STATE_POINTERS_HS_header\
4259   .DWordLength                         =      0,  \
4260   ._3DCommandSubOpcode                 =     44,  \
4261   ._3DCommandOpcode                    =      0,  \
4262   .CommandSubType                      =      3,  \
4263   .CommandType                         =      3
4264
4265struct GFX75_3DSTATE_SAMPLER_STATE_POINTERS_HS {
4266   uint32_t                             DWordLength;
4267   uint32_t                             _3DCommandSubOpcode;
4268   uint32_t                             _3DCommandOpcode;
4269   uint32_t                             CommandSubType;
4270   uint32_t                             CommandType;
4271   uint64_t                             PointertoHSSamplerState;
4272};
4273
4274static inline __attribute__((always_inline)) void
4275GFX75_3DSTATE_SAMPLER_STATE_POINTERS_HS_pack(__attribute__((unused)) __gen_user_data *data,
4276                                             __attribute__((unused)) void * restrict dst,
4277                                             __attribute__((unused)) const struct GFX75_3DSTATE_SAMPLER_STATE_POINTERS_HS * restrict values)
4278{
4279   uint32_t * restrict dw = (uint32_t * restrict) dst;
4280
4281   dw[0] =
4282      __gen_uint(values->DWordLength, 0, 7) |
4283      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4284      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4285      __gen_uint(values->CommandSubType, 27, 28) |
4286      __gen_uint(values->CommandType, 29, 31);
4287
4288   dw[1] =
4289      __gen_offset(values->PointertoHSSamplerState, 5, 31);
4290}
4291
4292#define GFX75_3DSTATE_SAMPLER_STATE_POINTERS_PS_length      2
4293#define GFX75_3DSTATE_SAMPLER_STATE_POINTERS_PS_length_bias      2
4294#define GFX75_3DSTATE_SAMPLER_STATE_POINTERS_PS_header\
4295   .DWordLength                         =      0,  \
4296   ._3DCommandSubOpcode                 =     47,  \
4297   ._3DCommandOpcode                    =      0,  \
4298   .CommandSubType                      =      3,  \
4299   .CommandType                         =      3
4300
4301struct GFX75_3DSTATE_SAMPLER_STATE_POINTERS_PS {
4302   uint32_t                             DWordLength;
4303   uint32_t                             _3DCommandSubOpcode;
4304   uint32_t                             _3DCommandOpcode;
4305   uint32_t                             CommandSubType;
4306   uint32_t                             CommandType;
4307   uint64_t                             PointertoPSSamplerState;
4308};
4309
4310static inline __attribute__((always_inline)) void
4311GFX75_3DSTATE_SAMPLER_STATE_POINTERS_PS_pack(__attribute__((unused)) __gen_user_data *data,
4312                                             __attribute__((unused)) void * restrict dst,
4313                                             __attribute__((unused)) const struct GFX75_3DSTATE_SAMPLER_STATE_POINTERS_PS * restrict values)
4314{
4315   uint32_t * restrict dw = (uint32_t * restrict) dst;
4316
4317   dw[0] =
4318      __gen_uint(values->DWordLength, 0, 7) |
4319      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4320      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4321      __gen_uint(values->CommandSubType, 27, 28) |
4322      __gen_uint(values->CommandType, 29, 31);
4323
4324   dw[1] =
4325      __gen_offset(values->PointertoPSSamplerState, 5, 31);
4326}
4327
4328#define GFX75_3DSTATE_SAMPLER_STATE_POINTERS_VS_length      2
4329#define GFX75_3DSTATE_SAMPLER_STATE_POINTERS_VS_length_bias      2
4330#define GFX75_3DSTATE_SAMPLER_STATE_POINTERS_VS_header\
4331   .DWordLength                         =      0,  \
4332   ._3DCommandSubOpcode                 =     43,  \
4333   ._3DCommandOpcode                    =      0,  \
4334   .CommandSubType                      =      3,  \
4335   .CommandType                         =      3
4336
4337struct GFX75_3DSTATE_SAMPLER_STATE_POINTERS_VS {
4338   uint32_t                             DWordLength;
4339   uint32_t                             _3DCommandSubOpcode;
4340   uint32_t                             _3DCommandOpcode;
4341   uint32_t                             CommandSubType;
4342   uint32_t                             CommandType;
4343   uint64_t                             PointertoVSSamplerState;
4344};
4345
4346static inline __attribute__((always_inline)) void
4347GFX75_3DSTATE_SAMPLER_STATE_POINTERS_VS_pack(__attribute__((unused)) __gen_user_data *data,
4348                                             __attribute__((unused)) void * restrict dst,
4349                                             __attribute__((unused)) const struct GFX75_3DSTATE_SAMPLER_STATE_POINTERS_VS * restrict values)
4350{
4351   uint32_t * restrict dw = (uint32_t * restrict) dst;
4352
4353   dw[0] =
4354      __gen_uint(values->DWordLength, 0, 7) |
4355      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4356      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4357      __gen_uint(values->CommandSubType, 27, 28) |
4358      __gen_uint(values->CommandType, 29, 31);
4359
4360   dw[1] =
4361      __gen_offset(values->PointertoVSSamplerState, 5, 31);
4362}
4363
4364#define GFX75_3DSTATE_SAMPLE_MASK_length       2
4365#define GFX75_3DSTATE_SAMPLE_MASK_length_bias      2
4366#define GFX75_3DSTATE_SAMPLE_MASK_header        \
4367   .DWordLength                         =      0,  \
4368   ._3DCommandSubOpcode                 =     24,  \
4369   ._3DCommandOpcode                    =      0,  \
4370   .CommandSubType                      =      3,  \
4371   .CommandType                         =      3
4372
4373struct GFX75_3DSTATE_SAMPLE_MASK {
4374   uint32_t                             DWordLength;
4375   uint32_t                             _3DCommandSubOpcode;
4376   uint32_t                             _3DCommandOpcode;
4377   uint32_t                             CommandSubType;
4378   uint32_t                             CommandType;
4379   uint32_t                             SampleMask;
4380};
4381
4382static inline __attribute__((always_inline)) void
4383GFX75_3DSTATE_SAMPLE_MASK_pack(__attribute__((unused)) __gen_user_data *data,
4384                               __attribute__((unused)) void * restrict dst,
4385                               __attribute__((unused)) const struct GFX75_3DSTATE_SAMPLE_MASK * restrict values)
4386{
4387   uint32_t * restrict dw = (uint32_t * restrict) dst;
4388
4389   dw[0] =
4390      __gen_uint(values->DWordLength, 0, 7) |
4391      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4392      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4393      __gen_uint(values->CommandSubType, 27, 28) |
4394      __gen_uint(values->CommandType, 29, 31);
4395
4396   dw[1] =
4397      __gen_uint(values->SampleMask, 0, 7);
4398}
4399
4400#define GFX75_3DSTATE_SBE_length              14
4401#define GFX75_3DSTATE_SBE_length_bias          2
4402#define GFX75_3DSTATE_SBE_header                \
4403   .DWordLength                         =     12,  \
4404   ._3DCommandSubOpcode                 =     31,  \
4405   ._3DCommandOpcode                    =      0,  \
4406   .CommandSubType                      =      3,  \
4407   .CommandType                         =      3
4408
4409struct GFX75_3DSTATE_SBE {
4410   uint32_t                             DWordLength;
4411   uint32_t                             _3DCommandSubOpcode;
4412   uint32_t                             _3DCommandOpcode;
4413   uint32_t                             CommandSubType;
4414   uint32_t                             CommandType;
4415   uint32_t                             VertexURBEntryReadOffset;
4416   uint32_t                             VertexURBEntryReadLength;
4417   uint32_t                             PointSpriteTextureCoordinateOrigin;
4418#define UPPERLEFT                                0
4419#define LOWERLEFT                                1
4420   bool                                 AttributeSwizzleEnable;
4421   uint32_t                             NumberofSFOutputAttributes;
4422   uint32_t                             AttributeSwizzleControlMode;
4423   struct GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL Attribute[16];
4424   uint32_t                             PointSpriteTextureCoordinateEnable;
4425   uint32_t                             ConstantInterpolationEnable;
4426   uint32_t                             Attribute0WrapShortestEnables;
4427   uint32_t                             Attribute1WrapShortestEnables;
4428   uint32_t                             Attribute2WrapShortestEnables;
4429   uint32_t                             Attribute3WrapShortestEnables;
4430   uint32_t                             Attribute4WrapShortestEnables;
4431   uint32_t                             Attribute5WrapShortestEnables;
4432   uint32_t                             Attribute6WrapShortestEnables;
4433   uint32_t                             Attribute7WrapShortestEnables;
4434   uint32_t                             Attribute8WrapShortestEnables;
4435   uint32_t                             Attribute9WrapShortestEnables;
4436   uint32_t                             Attribute10WrapShortestEnables;
4437   uint32_t                             Attribute11WrapShortestEnables;
4438   uint32_t                             Attribute12WrapShortestEnables;
4439   uint32_t                             Attribute13WrapShortestEnables;
4440   uint32_t                             Attribute14WrapShortestEnables;
4441   uint32_t                             Attribute15WrapShortestEnables;
4442};
4443
4444static inline __attribute__((always_inline)) void
4445GFX75_3DSTATE_SBE_pack(__attribute__((unused)) __gen_user_data *data,
4446                       __attribute__((unused)) void * restrict dst,
4447                       __attribute__((unused)) const struct GFX75_3DSTATE_SBE * restrict values)
4448{
4449   uint32_t * restrict dw = (uint32_t * restrict) dst;
4450
4451   dw[0] =
4452      __gen_uint(values->DWordLength, 0, 7) |
4453      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4454      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4455      __gen_uint(values->CommandSubType, 27, 28) |
4456      __gen_uint(values->CommandType, 29, 31);
4457
4458   dw[1] =
4459      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
4460      __gen_uint(values->VertexURBEntryReadLength, 11, 15) |
4461      __gen_uint(values->PointSpriteTextureCoordinateOrigin, 20, 20) |
4462      __gen_uint(values->AttributeSwizzleEnable, 21, 21) |
4463      __gen_uint(values->NumberofSFOutputAttributes, 22, 27) |
4464      __gen_uint(values->AttributeSwizzleControlMode, 28, 28);
4465
4466   uint32_t v2_0;
4467   GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v2_0, &values->Attribute[0]);
4468
4469   uint32_t v2_1;
4470   GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v2_1, &values->Attribute[1]);
4471
4472   dw[2] =
4473      __gen_uint(v2_0, 0, 15) |
4474      __gen_uint(v2_1, 16, 31);
4475
4476   uint32_t v3_0;
4477   GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v3_0, &values->Attribute[2]);
4478
4479   uint32_t v3_1;
4480   GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v3_1, &values->Attribute[3]);
4481
4482   dw[3] =
4483      __gen_uint(v3_0, 0, 15) |
4484      __gen_uint(v3_1, 16, 31);
4485
4486   uint32_t v4_0;
4487   GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v4_0, &values->Attribute[4]);
4488
4489   uint32_t v4_1;
4490   GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v4_1, &values->Attribute[5]);
4491
4492   dw[4] =
4493      __gen_uint(v4_0, 0, 15) |
4494      __gen_uint(v4_1, 16, 31);
4495
4496   uint32_t v5_0;
4497   GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v5_0, &values->Attribute[6]);
4498
4499   uint32_t v5_1;
4500   GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v5_1, &values->Attribute[7]);
4501
4502   dw[5] =
4503      __gen_uint(v5_0, 0, 15) |
4504      __gen_uint(v5_1, 16, 31);
4505
4506   uint32_t v6_0;
4507   GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v6_0, &values->Attribute[8]);
4508
4509   uint32_t v6_1;
4510   GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v6_1, &values->Attribute[9]);
4511
4512   dw[6] =
4513      __gen_uint(v6_0, 0, 15) |
4514      __gen_uint(v6_1, 16, 31);
4515
4516   uint32_t v7_0;
4517   GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v7_0, &values->Attribute[10]);
4518
4519   uint32_t v7_1;
4520   GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v7_1, &values->Attribute[11]);
4521
4522   dw[7] =
4523      __gen_uint(v7_0, 0, 15) |
4524      __gen_uint(v7_1, 16, 31);
4525
4526   uint32_t v8_0;
4527   GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_0, &values->Attribute[12]);
4528
4529   uint32_t v8_1;
4530   GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_1, &values->Attribute[13]);
4531
4532   dw[8] =
4533      __gen_uint(v8_0, 0, 15) |
4534      __gen_uint(v8_1, 16, 31);
4535
4536   uint32_t v9_0;
4537   GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v9_0, &values->Attribute[14]);
4538
4539   uint32_t v9_1;
4540   GFX75_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v9_1, &values->Attribute[15]);
4541
4542   dw[9] =
4543      __gen_uint(v9_0, 0, 15) |
4544      __gen_uint(v9_1, 16, 31);
4545
4546   dw[10] =
4547      __gen_uint(values->PointSpriteTextureCoordinateEnable, 0, 31);
4548
4549   dw[11] =
4550      __gen_uint(values->ConstantInterpolationEnable, 0, 31);
4551
4552   dw[12] =
4553      __gen_uint(values->Attribute0WrapShortestEnables, 0, 3) |
4554      __gen_uint(values->Attribute1WrapShortestEnables, 4, 7) |
4555      __gen_uint(values->Attribute2WrapShortestEnables, 8, 11) |
4556      __gen_uint(values->Attribute3WrapShortestEnables, 12, 15) |
4557      __gen_uint(values->Attribute4WrapShortestEnables, 16, 19) |
4558      __gen_uint(values->Attribute5WrapShortestEnables, 20, 23) |
4559      __gen_uint(values->Attribute6WrapShortestEnables, 24, 27) |
4560      __gen_uint(values->Attribute7WrapShortestEnables, 28, 31);
4561
4562   dw[13] =
4563      __gen_uint(values->Attribute8WrapShortestEnables, 0, 3) |
4564      __gen_uint(values->Attribute9WrapShortestEnables, 4, 7) |
4565      __gen_uint(values->Attribute10WrapShortestEnables, 8, 11) |
4566      __gen_uint(values->Attribute11WrapShortestEnables, 12, 15) |
4567      __gen_uint(values->Attribute12WrapShortestEnables, 16, 19) |
4568      __gen_uint(values->Attribute13WrapShortestEnables, 20, 23) |
4569      __gen_uint(values->Attribute14WrapShortestEnables, 24, 27) |
4570      __gen_uint(values->Attribute15WrapShortestEnables, 28, 31);
4571}
4572
4573#define GFX75_3DSTATE_SCISSOR_STATE_POINTERS_length      2
4574#define GFX75_3DSTATE_SCISSOR_STATE_POINTERS_length_bias      2
4575#define GFX75_3DSTATE_SCISSOR_STATE_POINTERS_header\
4576   .DWordLength                         =      0,  \
4577   ._3DCommandSubOpcode                 =     15,  \
4578   ._3DCommandOpcode                    =      0,  \
4579   .CommandSubType                      =      3,  \
4580   .CommandType                         =      3
4581
4582struct GFX75_3DSTATE_SCISSOR_STATE_POINTERS {
4583   uint32_t                             DWordLength;
4584   uint32_t                             _3DCommandSubOpcode;
4585   uint32_t                             _3DCommandOpcode;
4586   uint32_t                             CommandSubType;
4587   uint32_t                             CommandType;
4588   uint64_t                             ScissorRectPointer;
4589};
4590
4591static inline __attribute__((always_inline)) void
4592GFX75_3DSTATE_SCISSOR_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
4593                                          __attribute__((unused)) void * restrict dst,
4594                                          __attribute__((unused)) const struct GFX75_3DSTATE_SCISSOR_STATE_POINTERS * restrict values)
4595{
4596   uint32_t * restrict dw = (uint32_t * restrict) dst;
4597
4598   dw[0] =
4599      __gen_uint(values->DWordLength, 0, 7) |
4600      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4601      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4602      __gen_uint(values->CommandSubType, 27, 28) |
4603      __gen_uint(values->CommandType, 29, 31);
4604
4605   dw[1] =
4606      __gen_offset(values->ScissorRectPointer, 5, 31);
4607}
4608
4609#define GFX75_3DSTATE_SF_length                7
4610#define GFX75_3DSTATE_SF_length_bias           2
4611#define GFX75_3DSTATE_SF_header                 \
4612   .DWordLength                         =      5,  \
4613   ._3DCommandSubOpcode                 =     19,  \
4614   ._3DCommandOpcode                    =      0,  \
4615   .CommandSubType                      =      3,  \
4616   .CommandType                         =      3
4617
4618struct GFX75_3DSTATE_SF {
4619   uint32_t                             DWordLength;
4620   uint32_t                             _3DCommandSubOpcode;
4621   uint32_t                             _3DCommandOpcode;
4622   uint32_t                             CommandSubType;
4623   uint32_t                             CommandType;
4624   uint32_t                             FrontWinding;
4625   bool                                 ViewportTransformEnable;
4626   uint32_t                             BackFaceFillMode;
4627#define FILL_MODE_SOLID                          0
4628#define FILL_MODE_WIREFRAME                      1
4629#define FILL_MODE_POINT                          2
4630   uint32_t                             FrontFaceFillMode;
4631#define FILL_MODE_SOLID                          0
4632#define FILL_MODE_WIREFRAME                      1
4633#define FILL_MODE_POINT                          2
4634   bool                                 GlobalDepthOffsetEnablePoint;
4635   bool                                 GlobalDepthOffsetEnableWireframe;
4636   bool                                 GlobalDepthOffsetEnableSolid;
4637   bool                                 StatisticsEnable;
4638   bool                                 LegacyGlobalDepthBiasEnable;
4639   uint32_t                             DepthBufferSurfaceFormat;
4640#define D32_FLOAT_S8X24_UINT                     0
4641#define D32_FLOAT                                1
4642#define D24_UNORM_S8_UINT                        2
4643#define D24_UNORM_X8_UINT                        3
4644#define D16_UNORM                                5
4645   uint32_t                             MultisampleRasterizationMode;
4646   bool                                 RTIndependentRasterizationEnable;
4647   bool                                 ScissorRectangleEnable;
4648   bool                                 LineStippleEnable;
4649   uint32_t                             LineEndCapAntialiasingRegionWidth;
4650#define _05pixels                                0
4651#define _10pixels                                1
4652#define _20pixels                                2
4653#define _40pixels                                3
4654   float                                LineWidth;
4655   uint32_t                             CullMode;
4656#define CULLMODE_BOTH                            0
4657#define CULLMODE_NONE                            1
4658#define CULLMODE_FRONT                           2
4659#define CULLMODE_BACK                            3
4660   bool                                 AntialiasingEnable;
4661   float                                PointWidth;
4662   uint32_t                             PointWidthSource;
4663#define Vertex                                   0
4664#define State                                    1
4665   uint32_t                             VertexSubPixelPrecisionSelect;
4666#define _8Bit                                    0
4667#define _4Bit                                    1
4668   uint32_t                             AALineDistanceMode;
4669#define AALINEDISTANCE_TRUE                      1
4670   uint32_t                             TriangleFanProvokingVertexSelect;
4671#define Vertex0                                  0
4672#define Vertex1                                  1
4673#define Vertex2                                  2
4674   uint32_t                             LineStripListProvokingVertexSelect;
4675   uint32_t                             TriangleStripListProvokingVertexSelect;
4676#define Vertex0                                  0
4677#define Vertex1                                  1
4678#define Vertex2                                  2
4679   bool                                 LastPixelEnable;
4680   float                                GlobalDepthOffsetConstant;
4681   float                                GlobalDepthOffsetScale;
4682   float                                GlobalDepthOffsetClamp;
4683};
4684
4685static inline __attribute__((always_inline)) void
4686GFX75_3DSTATE_SF_pack(__attribute__((unused)) __gen_user_data *data,
4687                      __attribute__((unused)) void * restrict dst,
4688                      __attribute__((unused)) const struct GFX75_3DSTATE_SF * restrict values)
4689{
4690   uint32_t * restrict dw = (uint32_t * restrict) dst;
4691
4692   dw[0] =
4693      __gen_uint(values->DWordLength, 0, 7) |
4694      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4695      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4696      __gen_uint(values->CommandSubType, 27, 28) |
4697      __gen_uint(values->CommandType, 29, 31);
4698
4699   dw[1] =
4700      __gen_uint(values->FrontWinding, 0, 0) |
4701      __gen_uint(values->ViewportTransformEnable, 1, 1) |
4702      __gen_uint(values->BackFaceFillMode, 3, 4) |
4703      __gen_uint(values->FrontFaceFillMode, 5, 6) |
4704      __gen_uint(values->GlobalDepthOffsetEnablePoint, 7, 7) |
4705      __gen_uint(values->GlobalDepthOffsetEnableWireframe, 8, 8) |
4706      __gen_uint(values->GlobalDepthOffsetEnableSolid, 9, 9) |
4707      __gen_uint(values->StatisticsEnable, 10, 10) |
4708      __gen_uint(values->LegacyGlobalDepthBiasEnable, 11, 11) |
4709      __gen_uint(values->DepthBufferSurfaceFormat, 12, 14);
4710
4711   dw[2] =
4712      __gen_uint(values->MultisampleRasterizationMode, 8, 9) |
4713      __gen_uint(values->RTIndependentRasterizationEnable, 10, 10) |
4714      __gen_uint(values->ScissorRectangleEnable, 11, 11) |
4715      __gen_uint(values->LineStippleEnable, 14, 14) |
4716      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 16, 17) |
4717      __gen_ufixed(values->LineWidth, 18, 27, 7) |
4718      __gen_uint(values->CullMode, 29, 30) |
4719      __gen_uint(values->AntialiasingEnable, 31, 31);
4720
4721   dw[3] =
4722      __gen_ufixed(values->PointWidth, 0, 10, 3) |
4723      __gen_uint(values->PointWidthSource, 11, 11) |
4724      __gen_uint(values->VertexSubPixelPrecisionSelect, 12, 12) |
4725      __gen_uint(values->AALineDistanceMode, 14, 14) |
4726      __gen_uint(values->TriangleFanProvokingVertexSelect, 25, 26) |
4727      __gen_uint(values->LineStripListProvokingVertexSelect, 27, 28) |
4728      __gen_uint(values->TriangleStripListProvokingVertexSelect, 29, 30) |
4729      __gen_uint(values->LastPixelEnable, 31, 31);
4730
4731   dw[4] =
4732      __gen_float(values->GlobalDepthOffsetConstant);
4733
4734   dw[5] =
4735      __gen_float(values->GlobalDepthOffsetScale);
4736
4737   dw[6] =
4738      __gen_float(values->GlobalDepthOffsetClamp);
4739}
4740
4741#define GFX75_3DSTATE_SO_BUFFER_length         4
4742#define GFX75_3DSTATE_SO_BUFFER_length_bias      2
4743#define GFX75_3DSTATE_SO_BUFFER_header          \
4744   .DWordLength                         =      2,  \
4745   ._3DCommandSubOpcode                 =     24,  \
4746   ._3DCommandOpcode                    =      1,  \
4747   .CommandSubType                      =      3,  \
4748   .CommandType                         =      3
4749
4750struct GFX75_3DSTATE_SO_BUFFER {
4751   uint32_t                             DWordLength;
4752   uint32_t                             _3DCommandSubOpcode;
4753   uint32_t                             _3DCommandOpcode;
4754   uint32_t                             CommandSubType;
4755   uint32_t                             CommandType;
4756   uint32_t                             SurfacePitch;
4757   uint32_t                             MOCS;
4758   uint32_t                             SOBufferIndex;
4759   __gen_address_type                   SurfaceBaseAddress;
4760   __gen_address_type                   SurfaceEndAddress;
4761};
4762
4763static inline __attribute__((always_inline)) void
4764GFX75_3DSTATE_SO_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
4765                             __attribute__((unused)) void * restrict dst,
4766                             __attribute__((unused)) const struct GFX75_3DSTATE_SO_BUFFER * restrict values)
4767{
4768   uint32_t * restrict dw = (uint32_t * restrict) dst;
4769
4770   dw[0] =
4771      __gen_uint(values->DWordLength, 0, 7) |
4772      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4773      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4774      __gen_uint(values->CommandSubType, 27, 28) |
4775      __gen_uint(values->CommandType, 29, 31);
4776
4777   dw[1] =
4778      __gen_uint(values->SurfacePitch, 0, 11) |
4779      __gen_uint(values->MOCS, 25, 28) |
4780      __gen_uint(values->SOBufferIndex, 29, 30);
4781
4782   dw[2] = __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 2, 31);
4783
4784   dw[3] = __gen_address(data, &dw[3], values->SurfaceEndAddress, 0, 2, 31);
4785}
4786
4787#define GFX75_3DSTATE_SO_DECL_LIST_length_bias      2
4788#define GFX75_3DSTATE_SO_DECL_LIST_header       \
4789   ._3DCommandSubOpcode                 =     23,  \
4790   ._3DCommandOpcode                    =      1,  \
4791   .CommandSubType                      =      3,  \
4792   .CommandType                         =      3
4793
4794struct GFX75_3DSTATE_SO_DECL_LIST {
4795   uint32_t                             DWordLength;
4796   uint32_t                             _3DCommandSubOpcode;
4797   uint32_t                             _3DCommandOpcode;
4798   uint32_t                             CommandSubType;
4799   uint32_t                             CommandType;
4800   uint32_t                             StreamtoBufferSelects0;
4801   uint32_t                             StreamtoBufferSelects1;
4802   uint32_t                             StreamtoBufferSelects2;
4803   uint32_t                             StreamtoBufferSelects3;
4804   uint32_t                             NumEntries0;
4805   uint32_t                             NumEntries1;
4806   uint32_t                             NumEntries2;
4807   uint32_t                             NumEntries3;
4808   /* variable length fields follow */
4809};
4810
4811static inline __attribute__((always_inline)) void
4812GFX75_3DSTATE_SO_DECL_LIST_pack(__attribute__((unused)) __gen_user_data *data,
4813                                __attribute__((unused)) void * restrict dst,
4814                                __attribute__((unused)) const struct GFX75_3DSTATE_SO_DECL_LIST * restrict values)
4815{
4816   uint32_t * restrict dw = (uint32_t * restrict) dst;
4817
4818   dw[0] =
4819      __gen_uint(values->DWordLength, 0, 8) |
4820      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4821      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4822      __gen_uint(values->CommandSubType, 27, 28) |
4823      __gen_uint(values->CommandType, 29, 31);
4824
4825   dw[1] =
4826      __gen_uint(values->StreamtoBufferSelects0, 0, 3) |
4827      __gen_uint(values->StreamtoBufferSelects1, 4, 7) |
4828      __gen_uint(values->StreamtoBufferSelects2, 8, 11) |
4829      __gen_uint(values->StreamtoBufferSelects3, 12, 15);
4830
4831   dw[2] =
4832      __gen_uint(values->NumEntries0, 0, 7) |
4833      __gen_uint(values->NumEntries1, 8, 15) |
4834      __gen_uint(values->NumEntries2, 16, 23) |
4835      __gen_uint(values->NumEntries3, 24, 31);
4836}
4837
4838#define GFX75_3DSTATE_STENCIL_BUFFER_length      3
4839#define GFX75_3DSTATE_STENCIL_BUFFER_length_bias      2
4840#define GFX75_3DSTATE_STENCIL_BUFFER_header     \
4841   .DWordLength                         =      1,  \
4842   ._3DCommandSubOpcode                 =      6,  \
4843   ._3DCommandOpcode                    =      0,  \
4844   .CommandSubType                      =      3,  \
4845   .CommandType                         =      3
4846
4847struct GFX75_3DSTATE_STENCIL_BUFFER {
4848   uint32_t                             DWordLength;
4849   uint32_t                             _3DCommandSubOpcode;
4850   uint32_t                             _3DCommandOpcode;
4851   uint32_t                             CommandSubType;
4852   uint32_t                             CommandType;
4853   uint32_t                             SurfacePitch;
4854   uint32_t                             MOCS;
4855   bool                                 StencilBufferEnable;
4856   __gen_address_type                   SurfaceBaseAddress;
4857};
4858
4859static inline __attribute__((always_inline)) void
4860GFX75_3DSTATE_STENCIL_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
4861                                  __attribute__((unused)) void * restrict dst,
4862                                  __attribute__((unused)) const struct GFX75_3DSTATE_STENCIL_BUFFER * restrict values)
4863{
4864   uint32_t * restrict dw = (uint32_t * restrict) dst;
4865
4866   dw[0] =
4867      __gen_uint(values->DWordLength, 0, 7) |
4868      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4869      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4870      __gen_uint(values->CommandSubType, 27, 28) |
4871      __gen_uint(values->CommandType, 29, 31);
4872
4873   dw[1] =
4874      __gen_uint(values->SurfacePitch, 0, 16) |
4875      __gen_uint(values->MOCS, 25, 28) |
4876      __gen_uint(values->StencilBufferEnable, 31, 31);
4877
4878   dw[2] = __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 0, 31);
4879}
4880
4881#define GFX75_3DSTATE_STREAMOUT_length         3
4882#define GFX75_3DSTATE_STREAMOUT_length_bias      2
4883#define GFX75_3DSTATE_STREAMOUT_header          \
4884   .DWordLength                         =      1,  \
4885   ._3DCommandSubOpcode                 =     30,  \
4886   ._3DCommandOpcode                    =      0,  \
4887   .CommandSubType                      =      3,  \
4888   .CommandType                         =      3
4889
4890struct GFX75_3DSTATE_STREAMOUT {
4891   uint32_t                             DWordLength;
4892   uint32_t                             _3DCommandSubOpcode;
4893   uint32_t                             _3DCommandOpcode;
4894   uint32_t                             CommandSubType;
4895   uint32_t                             CommandType;
4896   bool                                 SOBufferEnable0;
4897   bool                                 SOBufferEnable1;
4898   bool                                 SOBufferEnable2;
4899   bool                                 SOBufferEnable3;
4900   bool                                 SOStatisticsEnable;
4901   uint32_t                             ReorderMode;
4902#define LEADING                                  0
4903#define TRAILING                                 1
4904   uint32_t                             RenderStreamSelect;
4905   bool                                 RenderingDisable;
4906   bool                                 SOFunctionEnable;
4907   uint32_t                             Stream0VertexReadLength;
4908   uint32_t                             Stream0VertexReadOffset;
4909   uint32_t                             Stream1VertexReadLength;
4910   uint32_t                             Stream1VertexReadOffset;
4911   uint32_t                             Stream2VertexReadLength;
4912   uint32_t                             Stream2VertexReadOffset;
4913   uint32_t                             Stream3VertexReadLength;
4914   uint32_t                             Stream3VertexReadOffset;
4915};
4916
4917static inline __attribute__((always_inline)) void
4918GFX75_3DSTATE_STREAMOUT_pack(__attribute__((unused)) __gen_user_data *data,
4919                             __attribute__((unused)) void * restrict dst,
4920                             __attribute__((unused)) const struct GFX75_3DSTATE_STREAMOUT * restrict values)
4921{
4922   uint32_t * restrict dw = (uint32_t * restrict) dst;
4923
4924   dw[0] =
4925      __gen_uint(values->DWordLength, 0, 7) |
4926      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4927      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4928      __gen_uint(values->CommandSubType, 27, 28) |
4929      __gen_uint(values->CommandType, 29, 31);
4930
4931   dw[1] =
4932      __gen_uint(values->SOBufferEnable0, 8, 8) |
4933      __gen_uint(values->SOBufferEnable1, 9, 9) |
4934      __gen_uint(values->SOBufferEnable2, 10, 10) |
4935      __gen_uint(values->SOBufferEnable3, 11, 11) |
4936      __gen_uint(values->SOStatisticsEnable, 25, 25) |
4937      __gen_uint(values->ReorderMode, 26, 26) |
4938      __gen_uint(values->RenderStreamSelect, 27, 28) |
4939      __gen_uint(values->RenderingDisable, 30, 30) |
4940      __gen_uint(values->SOFunctionEnable, 31, 31);
4941
4942   dw[2] =
4943      __gen_uint(values->Stream0VertexReadLength, 0, 4) |
4944      __gen_uint(values->Stream0VertexReadOffset, 5, 5) |
4945      __gen_uint(values->Stream1VertexReadLength, 8, 12) |
4946      __gen_uint(values->Stream1VertexReadOffset, 13, 13) |
4947      __gen_uint(values->Stream2VertexReadLength, 16, 20) |
4948      __gen_uint(values->Stream2VertexReadOffset, 21, 21) |
4949      __gen_uint(values->Stream3VertexReadLength, 24, 28) |
4950      __gen_uint(values->Stream3VertexReadOffset, 29, 29);
4951}
4952
4953#define GFX75_3DSTATE_TE_length                4
4954#define GFX75_3DSTATE_TE_length_bias           2
4955#define GFX75_3DSTATE_TE_header                 \
4956   .DWordLength                         =      2,  \
4957   ._3DCommandSubOpcode                 =     28,  \
4958   ._3DCommandOpcode                    =      0,  \
4959   .CommandSubType                      =      3,  \
4960   .CommandType                         =      3
4961
4962struct GFX75_3DSTATE_TE {
4963   uint32_t                             DWordLength;
4964   uint32_t                             _3DCommandSubOpcode;
4965   uint32_t                             _3DCommandOpcode;
4966   uint32_t                             CommandSubType;
4967   uint32_t                             CommandType;
4968   bool                                 TEEnable;
4969   uint32_t                             TEMode;
4970#define HW_TESS                                  0
4971#define SW_TESS                                  1
4972   uint32_t                             TEDomain;
4973#define QUAD                                     0
4974#define TRI                                      1
4975#define ISOLINE                                  2
4976   uint32_t                             OutputTopology;
4977#define OUTPUT_POINT                             0
4978#define OUTPUT_LINE                              1
4979#define OUTPUT_TRI_CW                            2
4980#define OUTPUT_TRI_CCW                           3
4981   uint32_t                             Partitioning;
4982#define INTEGER                                  0
4983#define ODD_FRACTIONAL                           1
4984#define EVEN_FRACTIONAL                          2
4985   float                                MaximumTessellationFactorOdd;
4986   float                                MaximumTessellationFactorNotOdd;
4987};
4988
4989static inline __attribute__((always_inline)) void
4990GFX75_3DSTATE_TE_pack(__attribute__((unused)) __gen_user_data *data,
4991                      __attribute__((unused)) void * restrict dst,
4992                      __attribute__((unused)) const struct GFX75_3DSTATE_TE * restrict values)
4993{
4994   uint32_t * restrict dw = (uint32_t * restrict) dst;
4995
4996   dw[0] =
4997      __gen_uint(values->DWordLength, 0, 7) |
4998      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4999      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5000      __gen_uint(values->CommandSubType, 27, 28) |
5001      __gen_uint(values->CommandType, 29, 31);
5002
5003   dw[1] =
5004      __gen_uint(values->TEEnable, 0, 0) |
5005      __gen_uint(values->TEMode, 1, 2) |
5006      __gen_uint(values->TEDomain, 4, 5) |
5007      __gen_uint(values->OutputTopology, 8, 9) |
5008      __gen_uint(values->Partitioning, 12, 13);
5009
5010   dw[2] =
5011      __gen_float(values->MaximumTessellationFactorOdd);
5012
5013   dw[3] =
5014      __gen_float(values->MaximumTessellationFactorNotOdd);
5015}
5016
5017#define GFX75_3DSTATE_URB_DS_length            2
5018#define GFX75_3DSTATE_URB_DS_length_bias       2
5019#define GFX75_3DSTATE_URB_DS_header             \
5020   .DWordLength                         =      0,  \
5021   ._3DCommandSubOpcode                 =     50,  \
5022   ._3DCommandOpcode                    =      0,  \
5023   .CommandSubType                      =      3,  \
5024   .CommandType                         =      3
5025
5026struct GFX75_3DSTATE_URB_DS {
5027   uint32_t                             DWordLength;
5028   uint32_t                             _3DCommandSubOpcode;
5029   uint32_t                             _3DCommandOpcode;
5030   uint32_t                             CommandSubType;
5031   uint32_t                             CommandType;
5032   uint32_t                             DSNumberofURBEntries;
5033   uint32_t                             DSURBEntryAllocationSize;
5034   uint32_t                             DSURBStartingAddress;
5035};
5036
5037static inline __attribute__((always_inline)) void
5038GFX75_3DSTATE_URB_DS_pack(__attribute__((unused)) __gen_user_data *data,
5039                          __attribute__((unused)) void * restrict dst,
5040                          __attribute__((unused)) const struct GFX75_3DSTATE_URB_DS * restrict values)
5041{
5042   uint32_t * restrict dw = (uint32_t * restrict) dst;
5043
5044   dw[0] =
5045      __gen_uint(values->DWordLength, 0, 7) |
5046      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5047      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5048      __gen_uint(values->CommandSubType, 27, 28) |
5049      __gen_uint(values->CommandType, 29, 31);
5050
5051   dw[1] =
5052      __gen_uint(values->DSNumberofURBEntries, 0, 15) |
5053      __gen_uint(values->DSURBEntryAllocationSize, 16, 24) |
5054      __gen_uint(values->DSURBStartingAddress, 25, 30);
5055}
5056
5057#define GFX75_3DSTATE_URB_GS_length            2
5058#define GFX75_3DSTATE_URB_GS_length_bias       2
5059#define GFX75_3DSTATE_URB_GS_header             \
5060   .DWordLength                         =      0,  \
5061   ._3DCommandSubOpcode                 =     51,  \
5062   ._3DCommandOpcode                    =      0,  \
5063   .CommandSubType                      =      3,  \
5064   .CommandType                         =      3
5065
5066struct GFX75_3DSTATE_URB_GS {
5067   uint32_t                             DWordLength;
5068   uint32_t                             _3DCommandSubOpcode;
5069   uint32_t                             _3DCommandOpcode;
5070   uint32_t                             CommandSubType;
5071   uint32_t                             CommandType;
5072   uint32_t                             GSNumberofURBEntries;
5073   uint32_t                             GSURBEntryAllocationSize;
5074   uint32_t                             GSURBStartingAddress;
5075};
5076
5077static inline __attribute__((always_inline)) void
5078GFX75_3DSTATE_URB_GS_pack(__attribute__((unused)) __gen_user_data *data,
5079                          __attribute__((unused)) void * restrict dst,
5080                          __attribute__((unused)) const struct GFX75_3DSTATE_URB_GS * restrict values)
5081{
5082   uint32_t * restrict dw = (uint32_t * restrict) dst;
5083
5084   dw[0] =
5085      __gen_uint(values->DWordLength, 0, 7) |
5086      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5087      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5088      __gen_uint(values->CommandSubType, 27, 28) |
5089      __gen_uint(values->CommandType, 29, 31);
5090
5091   dw[1] =
5092      __gen_uint(values->GSNumberofURBEntries, 0, 15) |
5093      __gen_uint(values->GSURBEntryAllocationSize, 16, 24) |
5094      __gen_uint(values->GSURBStartingAddress, 25, 30);
5095}
5096
5097#define GFX75_3DSTATE_URB_HS_length            2
5098#define GFX75_3DSTATE_URB_HS_length_bias       2
5099#define GFX75_3DSTATE_URB_HS_header             \
5100   .DWordLength                         =      0,  \
5101   ._3DCommandSubOpcode                 =     49,  \
5102   ._3DCommandOpcode                    =      0,  \
5103   .CommandSubType                      =      3,  \
5104   .CommandType                         =      3
5105
5106struct GFX75_3DSTATE_URB_HS {
5107   uint32_t                             DWordLength;
5108   uint32_t                             _3DCommandSubOpcode;
5109   uint32_t                             _3DCommandOpcode;
5110   uint32_t                             CommandSubType;
5111   uint32_t                             CommandType;
5112   uint32_t                             HSNumberofURBEntries;
5113   uint32_t                             HSURBEntryAllocationSize;
5114   uint32_t                             HSURBStartingAddress;
5115};
5116
5117static inline __attribute__((always_inline)) void
5118GFX75_3DSTATE_URB_HS_pack(__attribute__((unused)) __gen_user_data *data,
5119                          __attribute__((unused)) void * restrict dst,
5120                          __attribute__((unused)) const struct GFX75_3DSTATE_URB_HS * restrict values)
5121{
5122   uint32_t * restrict dw = (uint32_t * restrict) dst;
5123
5124   dw[0] =
5125      __gen_uint(values->DWordLength, 0, 7) |
5126      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5127      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5128      __gen_uint(values->CommandSubType, 27, 28) |
5129      __gen_uint(values->CommandType, 29, 31);
5130
5131   dw[1] =
5132      __gen_uint(values->HSNumberofURBEntries, 0, 15) |
5133      __gen_uint(values->HSURBEntryAllocationSize, 16, 24) |
5134      __gen_uint(values->HSURBStartingAddress, 25, 30);
5135}
5136
5137#define GFX75_3DSTATE_URB_VS_length            2
5138#define GFX75_3DSTATE_URB_VS_length_bias       2
5139#define GFX75_3DSTATE_URB_VS_header             \
5140   .DWordLength                         =      0,  \
5141   ._3DCommandSubOpcode                 =     48,  \
5142   ._3DCommandOpcode                    =      0,  \
5143   .CommandSubType                      =      3,  \
5144   .CommandType                         =      3
5145
5146struct GFX75_3DSTATE_URB_VS {
5147   uint32_t                             DWordLength;
5148   uint32_t                             _3DCommandSubOpcode;
5149   uint32_t                             _3DCommandOpcode;
5150   uint32_t                             CommandSubType;
5151   uint32_t                             CommandType;
5152   uint32_t                             VSNumberofURBEntries;
5153   uint32_t                             VSURBEntryAllocationSize;
5154   uint32_t                             VSURBStartingAddress;
5155};
5156
5157static inline __attribute__((always_inline)) void
5158GFX75_3DSTATE_URB_VS_pack(__attribute__((unused)) __gen_user_data *data,
5159                          __attribute__((unused)) void * restrict dst,
5160                          __attribute__((unused)) const struct GFX75_3DSTATE_URB_VS * restrict values)
5161{
5162   uint32_t * restrict dw = (uint32_t * restrict) dst;
5163
5164   dw[0] =
5165      __gen_uint(values->DWordLength, 0, 7) |
5166      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5167      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5168      __gen_uint(values->CommandSubType, 27, 28) |
5169      __gen_uint(values->CommandType, 29, 31);
5170
5171   dw[1] =
5172      __gen_uint(values->VSNumberofURBEntries, 0, 15) |
5173      __gen_uint(values->VSURBEntryAllocationSize, 16, 24) |
5174      __gen_uint(values->VSURBStartingAddress, 25, 30);
5175}
5176
5177#define GFX75_3DSTATE_VERTEX_BUFFERS_length_bias      2
5178#define GFX75_3DSTATE_VERTEX_BUFFERS_header     \
5179   .DWordLength                         =      3,  \
5180   ._3DCommandSubOpcode                 =      8,  \
5181   ._3DCommandOpcode                    =      0,  \
5182   .CommandSubType                      =      3,  \
5183   .CommandType                         =      3
5184
5185struct GFX75_3DSTATE_VERTEX_BUFFERS {
5186   uint32_t                             DWordLength;
5187   uint32_t                             _3DCommandSubOpcode;
5188   uint32_t                             _3DCommandOpcode;
5189   uint32_t                             CommandSubType;
5190   uint32_t                             CommandType;
5191   /* variable length fields follow */
5192};
5193
5194static inline __attribute__((always_inline)) void
5195GFX75_3DSTATE_VERTEX_BUFFERS_pack(__attribute__((unused)) __gen_user_data *data,
5196                                  __attribute__((unused)) void * restrict dst,
5197                                  __attribute__((unused)) const struct GFX75_3DSTATE_VERTEX_BUFFERS * restrict values)
5198{
5199   uint32_t * restrict dw = (uint32_t * restrict) dst;
5200
5201   dw[0] =
5202      __gen_uint(values->DWordLength, 0, 7) |
5203      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5204      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5205      __gen_uint(values->CommandSubType, 27, 28) |
5206      __gen_uint(values->CommandType, 29, 31);
5207}
5208
5209#define GFX75_3DSTATE_VERTEX_ELEMENTS_length_bias      2
5210#define GFX75_3DSTATE_VERTEX_ELEMENTS_header    \
5211   .DWordLength                         =      1,  \
5212   ._3DCommandSubOpcode                 =      9,  \
5213   ._3DCommandOpcode                    =      0,  \
5214   .CommandSubType                      =      3,  \
5215   .CommandType                         =      3
5216
5217struct GFX75_3DSTATE_VERTEX_ELEMENTS {
5218   uint32_t                             DWordLength;
5219   uint32_t                             _3DCommandSubOpcode;
5220   uint32_t                             _3DCommandOpcode;
5221   uint32_t                             CommandSubType;
5222   uint32_t                             CommandType;
5223   /* variable length fields follow */
5224};
5225
5226static inline __attribute__((always_inline)) void
5227GFX75_3DSTATE_VERTEX_ELEMENTS_pack(__attribute__((unused)) __gen_user_data *data,
5228                                   __attribute__((unused)) void * restrict dst,
5229                                   __attribute__((unused)) const struct GFX75_3DSTATE_VERTEX_ELEMENTS * restrict values)
5230{
5231   uint32_t * restrict dw = (uint32_t * restrict) dst;
5232
5233   dw[0] =
5234      __gen_uint(values->DWordLength, 0, 7) |
5235      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5236      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5237      __gen_uint(values->CommandSubType, 27, 28) |
5238      __gen_uint(values->CommandType, 29, 31);
5239}
5240
5241#define GFX75_3DSTATE_VF_length                2
5242#define GFX75_3DSTATE_VF_length_bias           2
5243#define GFX75_3DSTATE_VF_header                 \
5244   .DWordLength                         =      0,  \
5245   ._3DCommandSubOpcode                 =     12,  \
5246   ._3DCommandOpcode                    =      0,  \
5247   .CommandSubType                      =      3,  \
5248   .CommandType                         =      3
5249
5250struct GFX75_3DSTATE_VF {
5251   uint32_t                             DWordLength;
5252   bool                                 IndexedDrawCutIndexEnable;
5253   uint32_t                             _3DCommandSubOpcode;
5254   uint32_t                             _3DCommandOpcode;
5255   uint32_t                             CommandSubType;
5256   uint32_t                             CommandType;
5257   uint32_t                             CutIndex;
5258};
5259
5260static inline __attribute__((always_inline)) void
5261GFX75_3DSTATE_VF_pack(__attribute__((unused)) __gen_user_data *data,
5262                      __attribute__((unused)) void * restrict dst,
5263                      __attribute__((unused)) const struct GFX75_3DSTATE_VF * restrict values)
5264{
5265   uint32_t * restrict dw = (uint32_t * restrict) dst;
5266
5267   dw[0] =
5268      __gen_uint(values->DWordLength, 0, 7) |
5269      __gen_uint(values->IndexedDrawCutIndexEnable, 8, 8) |
5270      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5271      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5272      __gen_uint(values->CommandSubType, 27, 28) |
5273      __gen_uint(values->CommandType, 29, 31);
5274
5275   dw[1] =
5276      __gen_uint(values->CutIndex, 0, 31);
5277}
5278
5279#define GFX75_3DSTATE_VF_STATISTICS_length      1
5280#define GFX75_3DSTATE_VF_STATISTICS_length_bias      1
5281#define GFX75_3DSTATE_VF_STATISTICS_header      \
5282   ._3DCommandSubOpcode                 =     11,  \
5283   ._3DCommandOpcode                    =      0,  \
5284   .CommandSubType                      =      1,  \
5285   .CommandType                         =      3
5286
5287struct GFX75_3DSTATE_VF_STATISTICS {
5288   bool                                 StatisticsEnable;
5289   uint32_t                             _3DCommandSubOpcode;
5290   uint32_t                             _3DCommandOpcode;
5291   uint32_t                             CommandSubType;
5292   uint32_t                             CommandType;
5293};
5294
5295static inline __attribute__((always_inline)) void
5296GFX75_3DSTATE_VF_STATISTICS_pack(__attribute__((unused)) __gen_user_data *data,
5297                                 __attribute__((unused)) void * restrict dst,
5298                                 __attribute__((unused)) const struct GFX75_3DSTATE_VF_STATISTICS * restrict values)
5299{
5300   uint32_t * restrict dw = (uint32_t * restrict) dst;
5301
5302   dw[0] =
5303      __gen_uint(values->StatisticsEnable, 0, 0) |
5304      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5305      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5306      __gen_uint(values->CommandSubType, 27, 28) |
5307      __gen_uint(values->CommandType, 29, 31);
5308}
5309
5310#define GFX75_3DSTATE_VIEWPORT_STATE_POINTERS_CC_length      2
5311#define GFX75_3DSTATE_VIEWPORT_STATE_POINTERS_CC_length_bias      2
5312#define GFX75_3DSTATE_VIEWPORT_STATE_POINTERS_CC_header\
5313   .DWordLength                         =      0,  \
5314   ._3DCommandSubOpcode                 =     35,  \
5315   ._3DCommandOpcode                    =      0,  \
5316   .CommandSubType                      =      3,  \
5317   .CommandType                         =      3
5318
5319struct GFX75_3DSTATE_VIEWPORT_STATE_POINTERS_CC {
5320   uint32_t                             DWordLength;
5321   uint32_t                             _3DCommandSubOpcode;
5322   uint32_t                             _3DCommandOpcode;
5323   uint32_t                             CommandSubType;
5324   uint32_t                             CommandType;
5325   uint64_t                             CCViewportPointer;
5326};
5327
5328static inline __attribute__((always_inline)) void
5329GFX75_3DSTATE_VIEWPORT_STATE_POINTERS_CC_pack(__attribute__((unused)) __gen_user_data *data,
5330                                              __attribute__((unused)) void * restrict dst,
5331                                              __attribute__((unused)) const struct GFX75_3DSTATE_VIEWPORT_STATE_POINTERS_CC * restrict values)
5332{
5333   uint32_t * restrict dw = (uint32_t * restrict) dst;
5334
5335   dw[0] =
5336      __gen_uint(values->DWordLength, 0, 7) |
5337      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5338      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5339      __gen_uint(values->CommandSubType, 27, 28) |
5340      __gen_uint(values->CommandType, 29, 31);
5341
5342   dw[1] =
5343      __gen_offset(values->CCViewportPointer, 5, 31);
5344}
5345
5346#define GFX75_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_length      2
5347#define GFX75_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_length_bias      2
5348#define GFX75_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_header\
5349   .DWordLength                         =      0,  \
5350   ._3DCommandSubOpcode                 =     33,  \
5351   ._3DCommandOpcode                    =      0,  \
5352   .CommandSubType                      =      3,  \
5353   .CommandType                         =      3
5354
5355struct GFX75_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP {
5356   uint32_t                             DWordLength;
5357   uint32_t                             _3DCommandSubOpcode;
5358   uint32_t                             _3DCommandOpcode;
5359   uint32_t                             CommandSubType;
5360   uint32_t                             CommandType;
5361   uint64_t                             SFClipViewportPointer;
5362};
5363
5364static inline __attribute__((always_inline)) void
5365GFX75_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
5366                                                   __attribute__((unused)) void * restrict dst,
5367                                                   __attribute__((unused)) const struct GFX75_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP * restrict values)
5368{
5369   uint32_t * restrict dw = (uint32_t * restrict) dst;
5370
5371   dw[0] =
5372      __gen_uint(values->DWordLength, 0, 7) |
5373      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5374      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5375      __gen_uint(values->CommandSubType, 27, 28) |
5376      __gen_uint(values->CommandType, 29, 31);
5377
5378   dw[1] =
5379      __gen_offset(values->SFClipViewportPointer, 6, 31);
5380}
5381
5382#define GFX75_3DSTATE_VS_length                6
5383#define GFX75_3DSTATE_VS_length_bias           2
5384#define GFX75_3DSTATE_VS_header                 \
5385   .DWordLength                         =      4,  \
5386   ._3DCommandSubOpcode                 =     16,  \
5387   ._3DCommandOpcode                    =      0,  \
5388   .CommandSubType                      =      3,  \
5389   .CommandType                         =      3
5390
5391struct GFX75_3DSTATE_VS {
5392   uint32_t                             DWordLength;
5393   uint32_t                             _3DCommandSubOpcode;
5394   uint32_t                             _3DCommandOpcode;
5395   uint32_t                             CommandSubType;
5396   uint32_t                             CommandType;
5397   uint64_t                             KernelStartPointer;
5398   bool                                 SoftwareExceptionEnable;
5399   bool                                 VSaccessesUAV;
5400   bool                                 IllegalOpcodeExceptionEnable;
5401   uint32_t                             FloatingPointMode;
5402#define IEEE754                                  0
5403#define Alternate                                1
5404   uint32_t                             ThreadPriority;
5405#define NormalPriority                           0
5406#define HighPriority                             1
5407   uint32_t                             BindingTableEntryCount;
5408   uint32_t                             SamplerCount;
5409#define NoSamplers                               0
5410#define _14Samplers                              1
5411#define _58Samplers                              2
5412#define _912Samplers                             3
5413#define _1316Samplers                            4
5414   bool                                 VectorMaskEnable;
5415   bool                                 SingleVertexDispatch;
5416   uint32_t                             PerThreadScratchSpace;
5417   __gen_address_type                   ScratchSpaceBasePointer;
5418   uint32_t                             VertexURBEntryReadOffset;
5419   uint32_t                             VertexURBEntryReadLength;
5420   uint32_t                             DispatchGRFStartRegisterForURBData;
5421   bool                                 Enable;
5422   bool                                 VertexCacheDisable;
5423   bool                                 StatisticsEnable;
5424   uint32_t                             MaximumNumberofThreads;
5425};
5426
5427static inline __attribute__((always_inline)) void
5428GFX75_3DSTATE_VS_pack(__attribute__((unused)) __gen_user_data *data,
5429                      __attribute__((unused)) void * restrict dst,
5430                      __attribute__((unused)) const struct GFX75_3DSTATE_VS * restrict values)
5431{
5432   uint32_t * restrict dw = (uint32_t * restrict) dst;
5433
5434   dw[0] =
5435      __gen_uint(values->DWordLength, 0, 7) |
5436      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5437      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5438      __gen_uint(values->CommandSubType, 27, 28) |
5439      __gen_uint(values->CommandType, 29, 31);
5440
5441   dw[1] =
5442      __gen_offset(values->KernelStartPointer, 6, 31);
5443
5444   dw[2] =
5445      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
5446      __gen_uint(values->VSaccessesUAV, 12, 12) |
5447      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
5448      __gen_uint(values->FloatingPointMode, 16, 16) |
5449      __gen_uint(values->ThreadPriority, 17, 17) |
5450      __gen_uint(values->BindingTableEntryCount, 18, 25) |
5451      __gen_uint(values->SamplerCount, 27, 29) |
5452      __gen_uint(values->VectorMaskEnable, 30, 30) |
5453      __gen_uint(values->SingleVertexDispatch, 31, 31);
5454
5455   const uint32_t v3 =
5456      __gen_uint(values->PerThreadScratchSpace, 0, 3);
5457   dw[3] = __gen_address(data, &dw[3], values->ScratchSpaceBasePointer, v3, 10, 31);
5458
5459   dw[4] =
5460      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
5461      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
5462      __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
5463
5464   dw[5] =
5465      __gen_uint(values->Enable, 0, 0) |
5466      __gen_uint(values->VertexCacheDisable, 1, 1) |
5467      __gen_uint(values->StatisticsEnable, 10, 10) |
5468      __gen_uint(values->MaximumNumberofThreads, 23, 31);
5469}
5470
5471#define GFX75_3DSTATE_WM_length                3
5472#define GFX75_3DSTATE_WM_length_bias           2
5473#define GFX75_3DSTATE_WM_header                 \
5474   .DWordLength                         =      1,  \
5475   ._3DCommandSubOpcode                 =     20,  \
5476   ._3DCommandOpcode                    =      0,  \
5477   .CommandSubType                      =      3,  \
5478   .CommandType                         =      3
5479
5480struct GFX75_3DSTATE_WM {
5481   uint32_t                             DWordLength;
5482   uint32_t                             _3DCommandSubOpcode;
5483   uint32_t                             _3DCommandOpcode;
5484   uint32_t                             CommandSubType;
5485   uint32_t                             CommandType;
5486   uint32_t                             MultisampleRasterizationMode;
5487#define MSRASTMODE_OFF_PIXEL                     0
5488#define MSRASTMODE_OFF_PATTERN                   1
5489#define MSRASTMODE_ON_PIXEL                      2
5490#define MSRASTMODE_ON_PATTERN                    3
5491   uint32_t                             PointRasterizationRule;
5492#define RASTRULE_UPPER_LEFT                      0
5493#define RASTRULE_UPPER_RIGHT                     1
5494   bool                                 LineStippleEnable;
5495   bool                                 PolygonStippleEnable;
5496   bool                                 RTIndependentRasterizationEnable;
5497   uint32_t                             LineAntialiasingRegionWidth;
5498#define _05pixels                                0
5499#define _10pixels                                1
5500#define _20pixels                                2
5501#define _40pixels                                3
5502   uint32_t                             LineEndCapAntialiasingRegionWidth;
5503   bool                                 PixelShaderUsesInputCoverageMask;
5504   uint32_t                             BarycentricInterpolationMode;
5505#define BIM_PERSPECTIVE_PIXEL                    1
5506#define BIM_PERSPECTIVE_CENTROID                 2
5507#define BIM_PERSPECTIVE_SAMPLE                   4
5508#define BIM_LINEAR_PIXEL                         8
5509#define BIM_LINEAR_CENTROID                      16
5510#define BIM_LINEAR_SAMPLE                        32
5511   uint32_t                             PositionZWInterpolationMode;
5512#define INTERP_PIXEL                             0
5513#define INTERP_CENTROID                          2
5514#define INTERP_SAMPLE                            3
5515   bool                                 PixelShaderUsesSourceW;
5516   bool                                 PixelShaderUsesSourceDepth;
5517   uint32_t                             EarlyDepthStencilControl;
5518#define EDSC_NORMAL                              0
5519#define EDSC_PSEXEC                              1
5520#define EDSC_PREPS                               2
5521   uint32_t                             PixelShaderComputedDepthMode;
5522#define PSCDEPTH_OFF                             0
5523#define PSCDEPTH_ON                              1
5524#define PSCDEPTH_ON_GE                           2
5525#define PSCDEPTH_ON_LE                           3
5526   bool                                 PixelShaderKillsPixel;
5527   bool                                 LegacyDiamondLineRasterization;
5528   bool                                 HierarchicalDepthBufferResolveEnable;
5529   bool                                 DepthBufferResolveEnable;
5530   bool                                 ThreadDispatchEnable;
5531   bool                                 DepthBufferClear;
5532   bool                                 StatisticsEnable;
5533   uint32_t                             PSUAVonly;
5534#define OFF                                      0
5535#define ON                                       1
5536   uint32_t                             MultisampleDispatchMode;
5537#define MSDISPMODE_PERSAMPLE                     0
5538#define MSDISPMODE_PERPIXEL                      1
5539};
5540
5541static inline __attribute__((always_inline)) void
5542GFX75_3DSTATE_WM_pack(__attribute__((unused)) __gen_user_data *data,
5543                      __attribute__((unused)) void * restrict dst,
5544                      __attribute__((unused)) const struct GFX75_3DSTATE_WM * restrict values)
5545{
5546   uint32_t * restrict dw = (uint32_t * restrict) dst;
5547
5548   dw[0] =
5549      __gen_uint(values->DWordLength, 0, 7) |
5550      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5551      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5552      __gen_uint(values->CommandSubType, 27, 28) |
5553      __gen_uint(values->CommandType, 29, 31);
5554
5555   dw[1] =
5556      __gen_uint(values->MultisampleRasterizationMode, 0, 1) |
5557      __gen_uint(values->PointRasterizationRule, 2, 2) |
5558      __gen_uint(values->LineStippleEnable, 3, 3) |
5559      __gen_uint(values->PolygonStippleEnable, 4, 4) |
5560      __gen_uint(values->RTIndependentRasterizationEnable, 5, 5) |
5561      __gen_uint(values->LineAntialiasingRegionWidth, 6, 7) |
5562      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 8, 9) |
5563      __gen_uint(values->PixelShaderUsesInputCoverageMask, 10, 10) |
5564      __gen_uint(values->BarycentricInterpolationMode, 11, 16) |
5565      __gen_uint(values->PositionZWInterpolationMode, 17, 18) |
5566      __gen_uint(values->PixelShaderUsesSourceW, 19, 19) |
5567      __gen_uint(values->PixelShaderUsesSourceDepth, 20, 20) |
5568      __gen_uint(values->EarlyDepthStencilControl, 21, 22) |
5569      __gen_uint(values->PixelShaderComputedDepthMode, 23, 24) |
5570      __gen_uint(values->PixelShaderKillsPixel, 25, 25) |
5571      __gen_uint(values->LegacyDiamondLineRasterization, 26, 26) |
5572      __gen_uint(values->HierarchicalDepthBufferResolveEnable, 27, 27) |
5573      __gen_uint(values->DepthBufferResolveEnable, 28, 28) |
5574      __gen_uint(values->ThreadDispatchEnable, 29, 29) |
5575      __gen_uint(values->DepthBufferClear, 30, 30) |
5576      __gen_uint(values->StatisticsEnable, 31, 31);
5577
5578   dw[2] =
5579      __gen_uint(values->PSUAVonly, 30, 30) |
5580      __gen_uint(values->MultisampleDispatchMode, 31, 31);
5581}
5582
5583#define GFX75_GPGPU_CSR_BASE_ADDRESS_length      2
5584#define GFX75_GPGPU_CSR_BASE_ADDRESS_length_bias      2
5585#define GFX75_GPGPU_CSR_BASE_ADDRESS_header     \
5586   .DWordLength                         =      0,  \
5587   ._3DCommandSubOpcode                 =      4,  \
5588   ._3DCommandOpcode                    =      1,  \
5589   .CommandSubType                      =      0,  \
5590   .CommandType                         =      3
5591
5592struct GFX75_GPGPU_CSR_BASE_ADDRESS {
5593   uint32_t                             DWordLength;
5594   uint32_t                             _3DCommandSubOpcode;
5595   uint32_t                             _3DCommandOpcode;
5596   uint32_t                             CommandSubType;
5597   uint32_t                             CommandType;
5598   __gen_address_type                   GPGPUCSRBaseAddress;
5599};
5600
5601static inline __attribute__((always_inline)) void
5602GFX75_GPGPU_CSR_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
5603                                  __attribute__((unused)) void * restrict dst,
5604                                  __attribute__((unused)) const struct GFX75_GPGPU_CSR_BASE_ADDRESS * restrict values)
5605{
5606   uint32_t * restrict dw = (uint32_t * restrict) dst;
5607
5608   dw[0] =
5609      __gen_uint(values->DWordLength, 0, 7) |
5610      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5611      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5612      __gen_uint(values->CommandSubType, 27, 28) |
5613      __gen_uint(values->CommandType, 29, 31);
5614
5615   dw[1] = __gen_address(data, &dw[1], values->GPGPUCSRBaseAddress, 0, 12, 31);
5616}
5617
5618#define GFX75_GPGPU_OBJECT_length              8
5619#define GFX75_GPGPU_OBJECT_length_bias         2
5620#define GFX75_GPGPU_OBJECT_header               \
5621   .DWordLength                         =      6,  \
5622   .SubOpcode                           =      4,  \
5623   .MediaCommandOpcode                  =      1,  \
5624   .Pipeline                            =      2,  \
5625   .CommandType                         =      3
5626
5627struct GFX75_GPGPU_OBJECT {
5628   uint32_t                             DWordLength;
5629   bool                                 PredicateEnable;
5630   uint32_t                             SubOpcode;
5631   uint32_t                             MediaCommandOpcode;
5632   uint32_t                             Pipeline;
5633   uint32_t                             CommandType;
5634   uint32_t                             InterfaceDescriptorOffset;
5635   uint32_t                             SharedLocalMemoryFixedOffset;
5636   uint32_t                             IndirectDataLength;
5637   uint32_t                             HalfSliceDestinationSelect;
5638#define HalfSlice1                               2
5639#define HalfSlice0                               1
5640#define EitherHalfSlice                          0
5641   uint32_t                             SliceDestinationSelect;
5642#define Slice0                                   0
5643#define Slice1                                   1
5644   uint32_t                             EndofThreadGroup;
5645   uint32_t                             SharedLocalMemoryOffset;
5646   uint64_t                             IndirectDataStartAddress;
5647   uint32_t                             ThreadGroupIDX;
5648   uint32_t                             ThreadGroupIDY;
5649   uint32_t                             ThreadGroupIDZ;
5650   uint32_t                             ExecutionMask;
5651};
5652
5653static inline __attribute__((always_inline)) void
5654GFX75_GPGPU_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
5655                        __attribute__((unused)) void * restrict dst,
5656                        __attribute__((unused)) const struct GFX75_GPGPU_OBJECT * restrict values)
5657{
5658   uint32_t * restrict dw = (uint32_t * restrict) dst;
5659
5660   dw[0] =
5661      __gen_uint(values->DWordLength, 0, 7) |
5662      __gen_uint(values->PredicateEnable, 8, 8) |
5663      __gen_uint(values->SubOpcode, 16, 23) |
5664      __gen_uint(values->MediaCommandOpcode, 24, 26) |
5665      __gen_uint(values->Pipeline, 27, 28) |
5666      __gen_uint(values->CommandType, 29, 31);
5667
5668   dw[1] =
5669      __gen_uint(values->InterfaceDescriptorOffset, 0, 5) |
5670      __gen_uint(values->SharedLocalMemoryFixedOffset, 7, 7);
5671
5672   dw[2] =
5673      __gen_uint(values->IndirectDataLength, 0, 16) |
5674      __gen_uint(values->HalfSliceDestinationSelect, 17, 18) |
5675      __gen_uint(values->SliceDestinationSelect, 19, 19) |
5676      __gen_uint(values->EndofThreadGroup, 24, 24) |
5677      __gen_uint(values->SharedLocalMemoryOffset, 28, 31);
5678
5679   dw[3] =
5680      __gen_offset(values->IndirectDataStartAddress, 0, 31);
5681
5682   dw[4] =
5683      __gen_uint(values->ThreadGroupIDX, 0, 31);
5684
5685   dw[5] =
5686      __gen_uint(values->ThreadGroupIDY, 0, 31);
5687
5688   dw[6] =
5689      __gen_uint(values->ThreadGroupIDZ, 0, 31);
5690
5691   dw[7] =
5692      __gen_uint(values->ExecutionMask, 0, 31);
5693}
5694
5695#define GFX75_GPGPU_WALKER_length             11
5696#define GFX75_GPGPU_WALKER_length_bias         2
5697#define GFX75_GPGPU_WALKER_header               \
5698   .DWordLength                         =      9,  \
5699   .SubOpcodeA                          =      5,  \
5700   .MediaCommandOpcode                  =      1,  \
5701   .Pipeline                            =      2,  \
5702   .CommandType                         =      3
5703
5704struct GFX75_GPGPU_WALKER {
5705   uint32_t                             DWordLength;
5706   bool                                 PredicateEnable;
5707   bool                                 IndirectParameterEnable;
5708   uint32_t                             SubOpcodeA;
5709   uint32_t                             MediaCommandOpcode;
5710   uint32_t                             Pipeline;
5711   uint32_t                             CommandType;
5712   uint32_t                             InterfaceDescriptorOffset;
5713   uint32_t                             ThreadWidthCounterMaximum;
5714   uint32_t                             ThreadHeightCounterMaximum;
5715   uint32_t                             ThreadDepthCounterMaximum;
5716   uint32_t                             SIMDSize;
5717#define SIMD8                                    0
5718#define SIMD16                                   1
5719#define SIMD32                                   2
5720   uint32_t                             ThreadGroupIDStartingX;
5721   uint32_t                             ThreadGroupIDXDimension;
5722   uint32_t                             ThreadGroupIDStartingY;
5723   uint32_t                             ThreadGroupIDYDimension;
5724   uint32_t                             ThreadGroupIDStartingZ;
5725   uint32_t                             ThreadGroupIDZDimension;
5726   uint32_t                             RightExecutionMask;
5727   uint32_t                             BottomExecutionMask;
5728};
5729
5730static inline __attribute__((always_inline)) void
5731GFX75_GPGPU_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
5732                        __attribute__((unused)) void * restrict dst,
5733                        __attribute__((unused)) const struct GFX75_GPGPU_WALKER * restrict values)
5734{
5735   uint32_t * restrict dw = (uint32_t * restrict) dst;
5736
5737   dw[0] =
5738      __gen_uint(values->DWordLength, 0, 7) |
5739      __gen_uint(values->PredicateEnable, 8, 8) |
5740      __gen_uint(values->IndirectParameterEnable, 10, 10) |
5741      __gen_uint(values->SubOpcodeA, 16, 23) |
5742      __gen_uint(values->MediaCommandOpcode, 24, 26) |
5743      __gen_uint(values->Pipeline, 27, 28) |
5744      __gen_uint(values->CommandType, 29, 31);
5745
5746   dw[1] =
5747      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
5748
5749   dw[2] =
5750      __gen_uint(values->ThreadWidthCounterMaximum, 0, 5) |
5751      __gen_uint(values->ThreadHeightCounterMaximum, 8, 13) |
5752      __gen_uint(values->ThreadDepthCounterMaximum, 16, 21) |
5753      __gen_uint(values->SIMDSize, 30, 31);
5754
5755   dw[3] =
5756      __gen_uint(values->ThreadGroupIDStartingX, 0, 31);
5757
5758   dw[4] =
5759      __gen_uint(values->ThreadGroupIDXDimension, 0, 31);
5760
5761   dw[5] =
5762      __gen_uint(values->ThreadGroupIDStartingY, 0, 31);
5763
5764   dw[6] =
5765      __gen_uint(values->ThreadGroupIDYDimension, 0, 31);
5766
5767   dw[7] =
5768      __gen_uint(values->ThreadGroupIDStartingZ, 0, 31);
5769
5770   dw[8] =
5771      __gen_uint(values->ThreadGroupIDZDimension, 0, 31);
5772
5773   dw[9] =
5774      __gen_uint(values->RightExecutionMask, 0, 31);
5775
5776   dw[10] =
5777      __gen_uint(values->BottomExecutionMask, 0, 31);
5778}
5779
5780#define GFX75_MEDIA_CURBE_LOAD_length          4
5781#define GFX75_MEDIA_CURBE_LOAD_length_bias      2
5782#define GFX75_MEDIA_CURBE_LOAD_header           \
5783   .DWordLength                         =      2,  \
5784   .SubOpcode                           =      1,  \
5785   .MediaCommandOpcode                  =      0,  \
5786   .Pipeline                            =      2,  \
5787   .CommandType                         =      3
5788
5789struct GFX75_MEDIA_CURBE_LOAD {
5790   uint32_t                             DWordLength;
5791   uint32_t                             SubOpcode;
5792   uint32_t                             MediaCommandOpcode;
5793   uint32_t                             Pipeline;
5794   uint32_t                             CommandType;
5795   uint32_t                             CURBETotalDataLength;
5796   uint32_t                             CURBEDataStartAddress;
5797};
5798
5799static inline __attribute__((always_inline)) void
5800GFX75_MEDIA_CURBE_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
5801                            __attribute__((unused)) void * restrict dst,
5802                            __attribute__((unused)) const struct GFX75_MEDIA_CURBE_LOAD * restrict values)
5803{
5804   uint32_t * restrict dw = (uint32_t * restrict) dst;
5805
5806   dw[0] =
5807      __gen_uint(values->DWordLength, 0, 15) |
5808      __gen_uint(values->SubOpcode, 16, 23) |
5809      __gen_uint(values->MediaCommandOpcode, 24, 26) |
5810      __gen_uint(values->Pipeline, 27, 28) |
5811      __gen_uint(values->CommandType, 29, 31);
5812
5813   dw[1] = 0;
5814
5815   dw[2] =
5816      __gen_uint(values->CURBETotalDataLength, 0, 16);
5817
5818   dw[3] =
5819      __gen_uint(values->CURBEDataStartAddress, 0, 31);
5820}
5821
5822#define GFX75_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length      4
5823#define GFX75_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length_bias      2
5824#define GFX75_MEDIA_INTERFACE_DESCRIPTOR_LOAD_header\
5825   .DWordLength                         =      2,  \
5826   .SubOpcode                           =      2,  \
5827   .MediaCommandOpcode                  =      0,  \
5828   .Pipeline                            =      2,  \
5829   .CommandType                         =      3
5830
5831struct GFX75_MEDIA_INTERFACE_DESCRIPTOR_LOAD {
5832   uint32_t                             DWordLength;
5833   uint32_t                             SubOpcode;
5834   uint32_t                             MediaCommandOpcode;
5835   uint32_t                             Pipeline;
5836   uint32_t                             CommandType;
5837   uint32_t                             InterfaceDescriptorTotalLength;
5838   uint64_t                             InterfaceDescriptorDataStartAddress;
5839};
5840
5841static inline __attribute__((always_inline)) void
5842GFX75_MEDIA_INTERFACE_DESCRIPTOR_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
5843                                           __attribute__((unused)) void * restrict dst,
5844                                           __attribute__((unused)) const struct GFX75_MEDIA_INTERFACE_DESCRIPTOR_LOAD * restrict values)
5845{
5846   uint32_t * restrict dw = (uint32_t * restrict) dst;
5847
5848   dw[0] =
5849      __gen_uint(values->DWordLength, 0, 15) |
5850      __gen_uint(values->SubOpcode, 16, 23) |
5851      __gen_uint(values->MediaCommandOpcode, 24, 26) |
5852      __gen_uint(values->Pipeline, 27, 28) |
5853      __gen_uint(values->CommandType, 29, 31);
5854
5855   dw[1] = 0;
5856
5857   dw[2] =
5858      __gen_uint(values->InterfaceDescriptorTotalLength, 0, 16);
5859
5860   dw[3] =
5861      __gen_offset(values->InterfaceDescriptorDataStartAddress, 0, 31);
5862}
5863
5864#define GFX75_MEDIA_OBJECT_length_bias         2
5865#define GFX75_MEDIA_OBJECT_header               \
5866   .DWordLength                         =      4,  \
5867   .MediaCommandSubOpcode               =      0,  \
5868   .MediaCommandOpcode                  =      1,  \
5869   .MediaCommandPipeline                =      2,  \
5870   .CommandType                         =      3
5871
5872struct GFX75_MEDIA_OBJECT {
5873   uint32_t                             DWordLength;
5874   uint32_t                             MediaCommandSubOpcode;
5875   uint32_t                             MediaCommandOpcode;
5876   uint32_t                             MediaCommandPipeline;
5877   uint32_t                             CommandType;
5878   uint32_t                             InterfaceDescriptorOffset;
5879   uint32_t                             IndirectDataLength;
5880   uint32_t                             HalfSliceDestinationSelect;
5881#define HalfSlice1                               2
5882#define HalfSlice0                               1
5883#define Eitherhalfslice                          0
5884   uint32_t                             SliceDestinationSelect;
5885#define Slice0                                   0
5886#define Slice1                                   1
5887#define EitherSlice                              0
5888   uint32_t                             UseScoreboard;
5889#define Notusingscoreboard                       0
5890#define Usingscoreboard                          1
5891   uint32_t                             ThreadSynchronization;
5892#define Nothreadsynchronization                  0
5893#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
5894   bool                                 ChildrenPresent;
5895   __gen_address_type                   IndirectDataStartAddress;
5896   uint32_t                             ScoreboardX;
5897   uint32_t                             ScoredboardY;
5898   uint32_t                             ScoreboardMask;
5899   uint32_t                             ScoreboardColor;
5900   /* variable length fields follow */
5901};
5902
5903static inline __attribute__((always_inline)) void
5904GFX75_MEDIA_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
5905                        __attribute__((unused)) void * restrict dst,
5906                        __attribute__((unused)) const struct GFX75_MEDIA_OBJECT * restrict values)
5907{
5908   uint32_t * restrict dw = (uint32_t * restrict) dst;
5909
5910   dw[0] =
5911      __gen_uint(values->DWordLength, 0, 15) |
5912      __gen_uint(values->MediaCommandSubOpcode, 16, 23) |
5913      __gen_uint(values->MediaCommandOpcode, 24, 26) |
5914      __gen_uint(values->MediaCommandPipeline, 27, 28) |
5915      __gen_uint(values->CommandType, 29, 31);
5916
5917   dw[1] =
5918      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
5919
5920   dw[2] =
5921      __gen_uint(values->IndirectDataLength, 0, 16) |
5922      __gen_uint(values->HalfSliceDestinationSelect, 17, 18) |
5923      __gen_uint(values->SliceDestinationSelect, 19, 19) |
5924      __gen_uint(values->UseScoreboard, 21, 21) |
5925      __gen_uint(values->ThreadSynchronization, 24, 24) |
5926      __gen_uint(values->ChildrenPresent, 31, 31);
5927
5928   dw[3] = __gen_address(data, &dw[3], values->IndirectDataStartAddress, 0, 0, 31);
5929
5930   dw[4] =
5931      __gen_uint(values->ScoreboardX, 0, 8) |
5932      __gen_uint(values->ScoredboardY, 16, 24);
5933
5934   dw[5] =
5935      __gen_uint(values->ScoreboardMask, 0, 7) |
5936      __gen_uint(values->ScoreboardColor, 16, 19);
5937}
5938
5939#define GFX75_MEDIA_OBJECT_PRT_length         16
5940#define GFX75_MEDIA_OBJECT_PRT_length_bias      2
5941#define GFX75_MEDIA_OBJECT_PRT_header           \
5942   .DWordLength                         =     14,  \
5943   .SubOpcode                           =      2,  \
5944   .MediaCommandOpcode                  =      1,  \
5945   .Pipeline                            =      2,  \
5946   .CommandType                         =      3
5947
5948struct GFX75_MEDIA_OBJECT_PRT {
5949   uint32_t                             DWordLength;
5950   uint32_t                             SubOpcode;
5951   uint32_t                             MediaCommandOpcode;
5952   uint32_t                             Pipeline;
5953   uint32_t                             CommandType;
5954   uint32_t                             InterfaceDescriptorOffset;
5955   uint32_t                             PRT_FenceType;
5956#define Rootthreadqueue                          0
5957#define VFEstateflush                            1
5958   bool                                 PRT_FenceNeeded;
5959   bool                                 ChildrenPresent;
5960   uint32_t                             InlineData[12];
5961};
5962
5963static inline __attribute__((always_inline)) void
5964GFX75_MEDIA_OBJECT_PRT_pack(__attribute__((unused)) __gen_user_data *data,
5965                            __attribute__((unused)) void * restrict dst,
5966                            __attribute__((unused)) const struct GFX75_MEDIA_OBJECT_PRT * restrict values)
5967{
5968   uint32_t * restrict dw = (uint32_t * restrict) dst;
5969
5970   dw[0] =
5971      __gen_uint(values->DWordLength, 0, 15) |
5972      __gen_uint(values->SubOpcode, 16, 23) |
5973      __gen_uint(values->MediaCommandOpcode, 24, 26) |
5974      __gen_uint(values->Pipeline, 27, 28) |
5975      __gen_uint(values->CommandType, 29, 31);
5976
5977   dw[1] =
5978      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
5979
5980   dw[2] =
5981      __gen_uint(values->PRT_FenceType, 22, 22) |
5982      __gen_uint(values->PRT_FenceNeeded, 23, 23) |
5983      __gen_uint(values->ChildrenPresent, 31, 31);
5984
5985   dw[3] = 0;
5986
5987   dw[4] =
5988      __gen_uint(values->InlineData[0], 0, 31);
5989
5990   dw[5] =
5991      __gen_uint(values->InlineData[1], 0, 31);
5992
5993   dw[6] =
5994      __gen_uint(values->InlineData[2], 0, 31);
5995
5996   dw[7] =
5997      __gen_uint(values->InlineData[3], 0, 31);
5998
5999   dw[8] =
6000      __gen_uint(values->InlineData[4], 0, 31);
6001
6002   dw[9] =
6003      __gen_uint(values->InlineData[5], 0, 31);
6004
6005   dw[10] =
6006      __gen_uint(values->InlineData[6], 0, 31);
6007
6008   dw[11] =
6009      __gen_uint(values->InlineData[7], 0, 31);
6010
6011   dw[12] =
6012      __gen_uint(values->InlineData[8], 0, 31);
6013
6014   dw[13] =
6015      __gen_uint(values->InlineData[9], 0, 31);
6016
6017   dw[14] =
6018      __gen_uint(values->InlineData[10], 0, 31);
6019
6020   dw[15] =
6021      __gen_uint(values->InlineData[11], 0, 31);
6022}
6023
6024#define GFX75_MEDIA_OBJECT_WALKER_length_bias      2
6025#define GFX75_MEDIA_OBJECT_WALKER_header        \
6026   .DWordLength                         =     15,  \
6027   .SubOpcode                           =      3,  \
6028   .MediaCommandOpcode                  =      1,  \
6029   .Pipeline                            =      2,  \
6030   .CommandType                         =      3
6031
6032struct GFX75_MEDIA_OBJECT_WALKER {
6033   uint32_t                             DWordLength;
6034   uint32_t                             SubOpcode;
6035   uint32_t                             MediaCommandOpcode;
6036   uint32_t                             Pipeline;
6037   uint32_t                             CommandType;
6038   uint32_t                             InterfaceDescriptorOffset;
6039   uint32_t                             IndirectDataLength;
6040   uint32_t                             UseScoreboard;
6041#define Notusingscoreboard                       0
6042#define Usingscoreboard                          1
6043   uint32_t                             ThreadSynchronization;
6044#define Nothreadsynchronization                  0
6045#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
6046   uint32_t                             ChildrenPresent;
6047   uint64_t                             IndirectDataStartAddress;
6048   uint32_t                             ScoreboardMask;
6049   int32_t                              MidLoopUnitX;
6050   int32_t                              LocalMidLoopUnitY;
6051   uint32_t                             MiddleLoopExtraSteps;
6052   uint32_t                             ColorCountMinusOne;
6053   uint32_t                             QuadMode;
6054   uint32_t                             Repel;
6055   uint32_t                             DualMode;
6056   uint32_t                             LocalLoopExecCount;
6057   uint32_t                             GlobalLoopExecCount;
6058   uint32_t                             BlockResolutionX;
6059   uint32_t                             BlockResolutionY;
6060   uint32_t                             LocalStartX;
6061   uint32_t                             LocalStartY;
6062   int32_t                              LocalOuterLoopStrideX;
6063   int32_t                              LocalOuterLoopStrideY;
6064   int32_t                              LocalInnerLoopUnitX;
6065   int32_t                              LocalInnerLoopUnitY;
6066   uint32_t                             GlobalResolutionX;
6067   uint32_t                             GlobalResolutionY;
6068   int32_t                              GlobalStartX;
6069   int32_t                              GlobalStartY;
6070   int32_t                              GlobalOuterLoopStrideX;
6071   int32_t                              GlobalOuterLoopStrideY;
6072   int32_t                              GlobalInnerLoopUnitX;
6073   int32_t                              GlobalInnerLoopUnitY;
6074   /* variable length fields follow */
6075};
6076
6077static inline __attribute__((always_inline)) void
6078GFX75_MEDIA_OBJECT_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
6079                               __attribute__((unused)) void * restrict dst,
6080                               __attribute__((unused)) const struct GFX75_MEDIA_OBJECT_WALKER * restrict values)
6081{
6082   uint32_t * restrict dw = (uint32_t * restrict) dst;
6083
6084   dw[0] =
6085      __gen_uint(values->DWordLength, 0, 15) |
6086      __gen_uint(values->SubOpcode, 16, 23) |
6087      __gen_uint(values->MediaCommandOpcode, 24, 26) |
6088      __gen_uint(values->Pipeline, 27, 28) |
6089      __gen_uint(values->CommandType, 29, 31);
6090
6091   dw[1] =
6092      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
6093
6094   dw[2] =
6095      __gen_uint(values->IndirectDataLength, 0, 16) |
6096      __gen_uint(values->UseScoreboard, 21, 21) |
6097      __gen_uint(values->ThreadSynchronization, 24, 24) |
6098      __gen_uint(values->ChildrenPresent, 31, 31);
6099
6100   dw[3] =
6101      __gen_offset(values->IndirectDataStartAddress, 0, 31);
6102
6103   dw[4] = 0;
6104
6105   dw[5] =
6106      __gen_uint(values->ScoreboardMask, 0, 7);
6107
6108   dw[6] =
6109      __gen_sint(values->MidLoopUnitX, 8, 9) |
6110      __gen_sint(values->LocalMidLoopUnitY, 12, 13) |
6111      __gen_uint(values->MiddleLoopExtraSteps, 16, 20) |
6112      __gen_uint(values->ColorCountMinusOne, 24, 27) |
6113      __gen_uint(values->QuadMode, 29, 29) |
6114      __gen_uint(values->Repel, 30, 30) |
6115      __gen_uint(values->DualMode, 31, 31);
6116
6117   dw[7] =
6118      __gen_uint(values->LocalLoopExecCount, 0, 9) |
6119      __gen_uint(values->GlobalLoopExecCount, 16, 25);
6120
6121   dw[8] =
6122      __gen_uint(values->BlockResolutionX, 0, 8) |
6123      __gen_uint(values->BlockResolutionY, 16, 24);
6124
6125   dw[9] =
6126      __gen_uint(values->LocalStartX, 0, 8) |
6127      __gen_uint(values->LocalStartY, 16, 24);
6128
6129   dw[10] = 0;
6130
6131   dw[11] =
6132      __gen_sint(values->LocalOuterLoopStrideX, 0, 9) |
6133      __gen_sint(values->LocalOuterLoopStrideY, 16, 25);
6134
6135   dw[12] =
6136      __gen_sint(values->LocalInnerLoopUnitX, 0, 9) |
6137      __gen_sint(values->LocalInnerLoopUnitY, 16, 25);
6138
6139   dw[13] =
6140      __gen_uint(values->GlobalResolutionX, 0, 8) |
6141      __gen_uint(values->GlobalResolutionY, 16, 24);
6142
6143   dw[14] =
6144      __gen_sint(values->GlobalStartX, 0, 9) |
6145      __gen_sint(values->GlobalStartY, 16, 25);
6146
6147   dw[15] =
6148      __gen_sint(values->GlobalOuterLoopStrideX, 0, 9) |
6149      __gen_sint(values->GlobalOuterLoopStrideY, 16, 25);
6150
6151   dw[16] =
6152      __gen_sint(values->GlobalInnerLoopUnitX, 0, 9) |
6153      __gen_sint(values->GlobalInnerLoopUnitY, 16, 25);
6154}
6155
6156#define GFX75_MEDIA_STATE_FLUSH_length         2
6157#define GFX75_MEDIA_STATE_FLUSH_length_bias      2
6158#define GFX75_MEDIA_STATE_FLUSH_header          \
6159   .DWordLength                         =      0,  \
6160   .SubOpcode                           =      4,  \
6161   .MediaCommandOpcode                  =      0,  \
6162   .Pipeline                            =      2,  \
6163   .CommandType                         =      3
6164
6165struct GFX75_MEDIA_STATE_FLUSH {
6166   uint32_t                             DWordLength;
6167   uint32_t                             SubOpcode;
6168   uint32_t                             MediaCommandOpcode;
6169   uint32_t                             Pipeline;
6170   uint32_t                             CommandType;
6171   uint32_t                             InterfaceDescriptorOffset;
6172   uint32_t                             WatermarkRequired;
6173   bool                                 FlushtoGO;
6174   bool                                 DisablePreemption;
6175};
6176
6177static inline __attribute__((always_inline)) void
6178GFX75_MEDIA_STATE_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
6179                             __attribute__((unused)) void * restrict dst,
6180                             __attribute__((unused)) const struct GFX75_MEDIA_STATE_FLUSH * restrict values)
6181{
6182   uint32_t * restrict dw = (uint32_t * restrict) dst;
6183
6184   dw[0] =
6185      __gen_uint(values->DWordLength, 0, 15) |
6186      __gen_uint(values->SubOpcode, 16, 23) |
6187      __gen_uint(values->MediaCommandOpcode, 24, 26) |
6188      __gen_uint(values->Pipeline, 27, 28) |
6189      __gen_uint(values->CommandType, 29, 31);
6190
6191   dw[1] =
6192      __gen_uint(values->InterfaceDescriptorOffset, 0, 5) |
6193      __gen_uint(values->WatermarkRequired, 6, 6) |
6194      __gen_uint(values->FlushtoGO, 7, 7) |
6195      __gen_uint(values->DisablePreemption, 8, 8);
6196}
6197
6198#define GFX75_MEDIA_VFE_STATE_length           8
6199#define GFX75_MEDIA_VFE_STATE_length_bias      2
6200#define GFX75_MEDIA_VFE_STATE_header            \
6201   .DWordLength                         =      6,  \
6202   .SubOpcode                           =      0,  \
6203   .MediaCommandOpcode                  =      0,  \
6204   .Pipeline                            =      2,  \
6205   .CommandType                         =      3
6206
6207struct GFX75_MEDIA_VFE_STATE {
6208   uint32_t                             DWordLength;
6209   uint32_t                             SubOpcode;
6210   uint32_t                             MediaCommandOpcode;
6211   uint32_t                             Pipeline;
6212   uint32_t                             CommandType;
6213   uint32_t                             PerThreadScratchSpace;
6214   uint32_t                             StackSize;
6215   __gen_address_type                   ScratchSpaceBasePointer;
6216   bool                                 GPGPUMode;
6217   uint32_t                             BypassGatewayControl;
6218#define MaintainingOpenGatewayForwardMsgCloseGatewayprotocollegacymode 0
6219#define BypassingOpenGatewayCloseGatewayprotocol 1
6220   uint32_t                             ResetGatewayTimer;
6221#define Maintainingtheexistingtimestampstate     0
6222#define Resettingrelativetimerandlatchingtheglobaltimestamp 1
6223   uint32_t                             NumberofURBEntries;
6224   uint32_t                             MaximumNumberofThreads;
6225   uint32_t                             HalfSliceDisable;
6226   uint32_t                             CURBEAllocationSize;
6227   uint32_t                             URBEntryAllocationSize;
6228   uint32_t                             ScoreboardMask;
6229   uint32_t                             ScoreboardType;
6230#define StallingScoreboard                       0
6231#define NonStallingScoreboard                    1
6232   uint32_t                             ScoreboardEnable;
6233#define Scoreboarddisabled                       0
6234#define Scoreboardenabled                        1
6235   int32_t                              Scoreboard0DeltaX;
6236   int32_t                              Scoreboard0DeltaY;
6237   int32_t                              Scoreboard1DeltaX;
6238   int32_t                              Scoreboard1DeltaY;
6239   int32_t                              Scoreboard2DeltaX;
6240   int32_t                              Scoreboard2DeltaY;
6241   int32_t                              Scoreboard3DeltaX;
6242   int32_t                              Scoreboard3DeltaY;
6243   int32_t                              Scoreboard4DeltaX;
6244   int32_t                              Scoreboard4DeltaY;
6245   int32_t                              Scoreboard5DeltaX;
6246   int32_t                              Scoreboard5DeltaY;
6247   int32_t                              Scoreboard6DeltaX;
6248   int32_t                              Scoreboard6DeltaY;
6249   int32_t                              Scoreboard7DeltaX;
6250   int32_t                              Scoreboard7DeltaY;
6251};
6252
6253static inline __attribute__((always_inline)) void
6254GFX75_MEDIA_VFE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
6255                           __attribute__((unused)) void * restrict dst,
6256                           __attribute__((unused)) const struct GFX75_MEDIA_VFE_STATE * restrict values)
6257{
6258   uint32_t * restrict dw = (uint32_t * restrict) dst;
6259
6260   dw[0] =
6261      __gen_uint(values->DWordLength, 0, 15) |
6262      __gen_uint(values->SubOpcode, 16, 23) |
6263      __gen_uint(values->MediaCommandOpcode, 24, 26) |
6264      __gen_uint(values->Pipeline, 27, 28) |
6265      __gen_uint(values->CommandType, 29, 31);
6266
6267   const uint32_t v1 =
6268      __gen_uint(values->PerThreadScratchSpace, 0, 3) |
6269      __gen_uint(values->StackSize, 4, 7);
6270   dw[1] = __gen_address(data, &dw[1], values->ScratchSpaceBasePointer, v1, 10, 31);
6271
6272   dw[2] =
6273      __gen_uint(values->GPGPUMode, 2, 2) |
6274      __gen_uint(values->BypassGatewayControl, 6, 6) |
6275      __gen_uint(values->ResetGatewayTimer, 7, 7) |
6276      __gen_uint(values->NumberofURBEntries, 8, 15) |
6277      __gen_uint(values->MaximumNumberofThreads, 16, 31);
6278
6279   dw[3] =
6280      __gen_uint(values->HalfSliceDisable, 0, 1);
6281
6282   dw[4] =
6283      __gen_uint(values->CURBEAllocationSize, 0, 15) |
6284      __gen_uint(values->URBEntryAllocationSize, 16, 31);
6285
6286   dw[5] =
6287      __gen_uint(values->ScoreboardMask, 0, 7) |
6288      __gen_uint(values->ScoreboardType, 30, 30) |
6289      __gen_uint(values->ScoreboardEnable, 31, 31);
6290
6291   dw[6] =
6292      __gen_sint(values->Scoreboard0DeltaX, 0, 3) |
6293      __gen_sint(values->Scoreboard0DeltaY, 4, 7) |
6294      __gen_sint(values->Scoreboard1DeltaX, 8, 11) |
6295      __gen_sint(values->Scoreboard1DeltaY, 12, 15) |
6296      __gen_sint(values->Scoreboard2DeltaX, 16, 19) |
6297      __gen_sint(values->Scoreboard2DeltaY, 20, 23) |
6298      __gen_sint(values->Scoreboard3DeltaX, 24, 27) |
6299      __gen_sint(values->Scoreboard3DeltaY, 28, 31);
6300
6301   dw[7] =
6302      __gen_sint(values->Scoreboard4DeltaX, 0, 3) |
6303      __gen_sint(values->Scoreboard4DeltaY, 4, 7) |
6304      __gen_sint(values->Scoreboard5DeltaX, 8, 11) |
6305      __gen_sint(values->Scoreboard5DeltaY, 12, 15) |
6306      __gen_sint(values->Scoreboard6DeltaX, 16, 19) |
6307      __gen_sint(values->Scoreboard6DeltaY, 20, 23) |
6308      __gen_sint(values->Scoreboard7DeltaX, 24, 27) |
6309      __gen_sint(values->Scoreboard7DeltaY, 28, 31);
6310}
6311
6312#define GFX75_MI_ARB_CHECK_length              1
6313#define GFX75_MI_ARB_CHECK_length_bias         1
6314#define GFX75_MI_ARB_CHECK_header               \
6315   .MICommandOpcode                     =      5,  \
6316   .CommandType                         =      0
6317
6318struct GFX75_MI_ARB_CHECK {
6319   uint32_t                             MICommandOpcode;
6320   uint32_t                             CommandType;
6321};
6322
6323static inline __attribute__((always_inline)) void
6324GFX75_MI_ARB_CHECK_pack(__attribute__((unused)) __gen_user_data *data,
6325                        __attribute__((unused)) void * restrict dst,
6326                        __attribute__((unused)) const struct GFX75_MI_ARB_CHECK * restrict values)
6327{
6328   uint32_t * restrict dw = (uint32_t * restrict) dst;
6329
6330   dw[0] =
6331      __gen_uint(values->MICommandOpcode, 23, 28) |
6332      __gen_uint(values->CommandType, 29, 31);
6333}
6334
6335#define GFX75_MI_ARB_ON_OFF_length             1
6336#define GFX75_MI_ARB_ON_OFF_length_bias        1
6337#define GFX75_MI_ARB_ON_OFF_header              \
6338   .MICommandOpcode                     =      8,  \
6339   .CommandType                         =      0
6340
6341struct GFX75_MI_ARB_ON_OFF {
6342   bool                                 ArbitrationEnable;
6343   uint32_t                             MICommandOpcode;
6344   uint32_t                             CommandType;
6345};
6346
6347static inline __attribute__((always_inline)) void
6348GFX75_MI_ARB_ON_OFF_pack(__attribute__((unused)) __gen_user_data *data,
6349                         __attribute__((unused)) void * restrict dst,
6350                         __attribute__((unused)) const struct GFX75_MI_ARB_ON_OFF * restrict values)
6351{
6352   uint32_t * restrict dw = (uint32_t * restrict) dst;
6353
6354   dw[0] =
6355      __gen_uint(values->ArbitrationEnable, 0, 0) |
6356      __gen_uint(values->MICommandOpcode, 23, 28) |
6357      __gen_uint(values->CommandType, 29, 31);
6358}
6359
6360#define GFX75_MI_BATCH_BUFFER_END_length       1
6361#define GFX75_MI_BATCH_BUFFER_END_length_bias      1
6362#define GFX75_MI_BATCH_BUFFER_END_header        \
6363   .MICommandOpcode                     =     10,  \
6364   .CommandType                         =      0
6365
6366struct GFX75_MI_BATCH_BUFFER_END {
6367   uint32_t                             MICommandOpcode;
6368   uint32_t                             CommandType;
6369};
6370
6371static inline __attribute__((always_inline)) void
6372GFX75_MI_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
6373                               __attribute__((unused)) void * restrict dst,
6374                               __attribute__((unused)) const struct GFX75_MI_BATCH_BUFFER_END * restrict values)
6375{
6376   uint32_t * restrict dw = (uint32_t * restrict) dst;
6377
6378   dw[0] =
6379      __gen_uint(values->MICommandOpcode, 23, 28) |
6380      __gen_uint(values->CommandType, 29, 31);
6381}
6382
6383#define GFX75_MI_BATCH_BUFFER_START_length      2
6384#define GFX75_MI_BATCH_BUFFER_START_length_bias      2
6385#define GFX75_MI_BATCH_BUFFER_START_header      \
6386   .DWordLength                         =      0,  \
6387   .MICommandOpcode                     =     49,  \
6388   .CommandType                         =      0
6389
6390struct GFX75_MI_BATCH_BUFFER_START {
6391   uint32_t                             DWordLength;
6392   uint32_t                             AddressSpaceIndicator;
6393#define ASI_GGTT                                 0
6394#define ASI_PPGTT                                1
6395   bool                                 ResourceStreamerEnable;
6396   bool                                 ClearCommandBufferEnable;
6397   bool                                 NonPrivileged;
6398   bool                                 PredicationEnable;
6399   bool                                 AddOffsetEnable;
6400   uint32_t                             SecondLevelBatchBuffer;
6401#define Firstlevelbatch                          0
6402#define Secondlevelbatch                         1
6403   uint32_t                             MICommandOpcode;
6404   uint32_t                             CommandType;
6405   __gen_address_type                   BatchBufferStartAddress;
6406};
6407
6408static inline __attribute__((always_inline)) void
6409GFX75_MI_BATCH_BUFFER_START_pack(__attribute__((unused)) __gen_user_data *data,
6410                                 __attribute__((unused)) void * restrict dst,
6411                                 __attribute__((unused)) const struct GFX75_MI_BATCH_BUFFER_START * restrict values)
6412{
6413   uint32_t * restrict dw = (uint32_t * restrict) dst;
6414
6415   dw[0] =
6416      __gen_uint(values->DWordLength, 0, 7) |
6417      __gen_uint(values->AddressSpaceIndicator, 8, 8) |
6418      __gen_uint(values->ResourceStreamerEnable, 10, 10) |
6419      __gen_uint(values->ClearCommandBufferEnable, 11, 11) |
6420      __gen_uint(values->NonPrivileged, 13, 13) |
6421      __gen_uint(values->PredicationEnable, 15, 15) |
6422      __gen_uint(values->AddOffsetEnable, 16, 16) |
6423      __gen_uint(values->SecondLevelBatchBuffer, 22, 22) |
6424      __gen_uint(values->MICommandOpcode, 23, 28) |
6425      __gen_uint(values->CommandType, 29, 31);
6426
6427   dw[1] = __gen_address(data, &dw[1], values->BatchBufferStartAddress, 0, 2, 31);
6428}
6429
6430#define GFX75_MI_CLFLUSH_length_bias           2
6431#define GFX75_MI_CLFLUSH_header                 \
6432   .DWordLength                         =      1,  \
6433   .MICommandOpcode                     =     39,  \
6434   .CommandType                         =      0
6435
6436struct GFX75_MI_CLFLUSH {
6437   uint32_t                             DWordLength;
6438   bool                                 UseGlobalGTT;
6439   uint32_t                             MICommandOpcode;
6440   uint32_t                             CommandType;
6441   uint32_t                             StartingCachelineOffset;
6442   __gen_address_type                   PageBaseAddress;
6443   __gen_address_type                   PageBaseAddressHigh;
6444   /* variable length fields follow */
6445};
6446
6447static inline __attribute__((always_inline)) void
6448GFX75_MI_CLFLUSH_pack(__attribute__((unused)) __gen_user_data *data,
6449                      __attribute__((unused)) void * restrict dst,
6450                      __attribute__((unused)) const struct GFX75_MI_CLFLUSH * restrict values)
6451{
6452   uint32_t * restrict dw = (uint32_t * restrict) dst;
6453
6454   dw[0] =
6455      __gen_uint(values->DWordLength, 0, 9) |
6456      __gen_uint(values->UseGlobalGTT, 22, 22) |
6457      __gen_uint(values->MICommandOpcode, 23, 28) |
6458      __gen_uint(values->CommandType, 29, 31);
6459
6460   const uint32_t v1 =
6461      __gen_uint(values->StartingCachelineOffset, 6, 11);
6462   dw[1] = __gen_address(data, &dw[1], values->PageBaseAddress, v1, 12, 31);
6463
6464   dw[2] = __gen_address(data, &dw[2], values->PageBaseAddressHigh, 0, 0, 15);
6465}
6466
6467#define GFX75_MI_CONDITIONAL_BATCH_BUFFER_END_length      2
6468#define GFX75_MI_CONDITIONAL_BATCH_BUFFER_END_length_bias      2
6469#define GFX75_MI_CONDITIONAL_BATCH_BUFFER_END_header\
6470   .DWordLength                         =      0,  \
6471   .CompareSemaphore                    =      0,  \
6472   .MICommandOpcode                     =     54,  \
6473   .CommandType                         =      0
6474
6475struct GFX75_MI_CONDITIONAL_BATCH_BUFFER_END {
6476   uint32_t                             DWordLength;
6477   uint32_t                             CompareSemaphore;
6478   bool                                 UseGlobalGTT;
6479   uint32_t                             MICommandOpcode;
6480   uint32_t                             CommandType;
6481   uint32_t                             CompareDataDword;
6482   __gen_address_type                   CompareAddress;
6483};
6484
6485static inline __attribute__((always_inline)) void
6486GFX75_MI_CONDITIONAL_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
6487                                           __attribute__((unused)) void * restrict dst,
6488                                           __attribute__((unused)) const struct GFX75_MI_CONDITIONAL_BATCH_BUFFER_END * restrict values)
6489{
6490   uint32_t * restrict dw = (uint32_t * restrict) dst;
6491
6492   dw[0] =
6493      __gen_uint(values->DWordLength, 0, 7) |
6494      __gen_uint(values->CompareSemaphore, 21, 21) |
6495      __gen_uint(values->UseGlobalGTT, 22, 22) |
6496      __gen_uint(values->MICommandOpcode, 23, 28) |
6497      __gen_uint(values->CommandType, 29, 31);
6498
6499   dw[1] =
6500      __gen_uint(values->CompareDataDword, 0, 31);
6501}
6502
6503#define GFX75_MI_FLUSH_length                  1
6504#define GFX75_MI_FLUSH_length_bias             1
6505#define GFX75_MI_FLUSH_header                   \
6506   .MICommandOpcode                     =      4,  \
6507   .CommandType                         =      0
6508
6509struct GFX75_MI_FLUSH {
6510   uint32_t                             StateInstructionCacheInvalidate;
6511#define DontInvalidate                           0
6512#define Invalidate                               1
6513   uint32_t                             RenderCacheFlushInhibit;
6514#define Flush                                    0
6515#define DontFlush                                1
6516   uint32_t                             GlobalSnapshotCountReset;
6517#define DontReset                                0
6518#define Reset                                    1
6519   bool                                 GenericMediaStateClear;
6520   bool                                 IndirectStatePointersDisable;
6521   uint32_t                             MICommandOpcode;
6522   uint32_t                             CommandType;
6523};
6524
6525static inline __attribute__((always_inline)) void
6526GFX75_MI_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
6527                    __attribute__((unused)) void * restrict dst,
6528                    __attribute__((unused)) const struct GFX75_MI_FLUSH * restrict values)
6529{
6530   uint32_t * restrict dw = (uint32_t * restrict) dst;
6531
6532   dw[0] =
6533      __gen_uint(values->StateInstructionCacheInvalidate, 1, 1) |
6534      __gen_uint(values->RenderCacheFlushInhibit, 2, 2) |
6535      __gen_uint(values->GlobalSnapshotCountReset, 3, 3) |
6536      __gen_uint(values->GenericMediaStateClear, 4, 4) |
6537      __gen_uint(values->IndirectStatePointersDisable, 5, 5) |
6538      __gen_uint(values->MICommandOpcode, 23, 28) |
6539      __gen_uint(values->CommandType, 29, 31);
6540}
6541
6542#define GFX75_MI_LOAD_REGISTER_IMM_length      3
6543#define GFX75_MI_LOAD_REGISTER_IMM_length_bias      2
6544#define GFX75_MI_LOAD_REGISTER_IMM_header       \
6545   .DWordLength                         =      1,  \
6546   .MICommandOpcode                     =     34,  \
6547   .CommandType                         =      0
6548
6549struct GFX75_MI_LOAD_REGISTER_IMM {
6550   uint32_t                             DWordLength;
6551   uint32_t                             ByteWriteDisables;
6552   uint32_t                             MICommandOpcode;
6553   uint32_t                             CommandType;
6554   uint64_t                             RegisterOffset;
6555   uint32_t                             DataDWord;
6556   /* variable length fields follow */
6557};
6558
6559static inline __attribute__((always_inline)) void
6560GFX75_MI_LOAD_REGISTER_IMM_pack(__attribute__((unused)) __gen_user_data *data,
6561                                __attribute__((unused)) void * restrict dst,
6562                                __attribute__((unused)) const struct GFX75_MI_LOAD_REGISTER_IMM * restrict values)
6563{
6564   uint32_t * restrict dw = (uint32_t * restrict) dst;
6565
6566   dw[0] =
6567      __gen_uint(values->DWordLength, 0, 7) |
6568      __gen_uint(values->ByteWriteDisables, 8, 11) |
6569      __gen_uint(values->MICommandOpcode, 23, 28) |
6570      __gen_uint(values->CommandType, 29, 31);
6571
6572   dw[1] =
6573      __gen_offset(values->RegisterOffset, 2, 22);
6574
6575   dw[2] =
6576      __gen_uint(values->DataDWord, 0, 31);
6577}
6578
6579#define GFX75_MI_LOAD_REGISTER_MEM_length      3
6580#define GFX75_MI_LOAD_REGISTER_MEM_length_bias      2
6581#define GFX75_MI_LOAD_REGISTER_MEM_header       \
6582   .DWordLength                         =      1,  \
6583   .MICommandOpcode                     =     41,  \
6584   .CommandType                         =      0
6585
6586struct GFX75_MI_LOAD_REGISTER_MEM {
6587   uint32_t                             DWordLength;
6588   bool                                 AsyncModeEnable;
6589   bool                                 UseGlobalGTT;
6590   uint32_t                             MICommandOpcode;
6591   uint32_t                             CommandType;
6592   uint64_t                             RegisterAddress;
6593   __gen_address_type                   MemoryAddress;
6594};
6595
6596static inline __attribute__((always_inline)) void
6597GFX75_MI_LOAD_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
6598                                __attribute__((unused)) void * restrict dst,
6599                                __attribute__((unused)) const struct GFX75_MI_LOAD_REGISTER_MEM * restrict values)
6600{
6601   uint32_t * restrict dw = (uint32_t * restrict) dst;
6602
6603   dw[0] =
6604      __gen_uint(values->DWordLength, 0, 7) |
6605      __gen_uint(values->AsyncModeEnable, 21, 21) |
6606      __gen_uint(values->UseGlobalGTT, 22, 22) |
6607      __gen_uint(values->MICommandOpcode, 23, 28) |
6608      __gen_uint(values->CommandType, 29, 31);
6609
6610   dw[1] =
6611      __gen_offset(values->RegisterAddress, 2, 22);
6612
6613   dw[2] = __gen_address(data, &dw[2], values->MemoryAddress, 0, 2, 31);
6614}
6615
6616#define GFX75_MI_LOAD_REGISTER_REG_length      3
6617#define GFX75_MI_LOAD_REGISTER_REG_length_bias      2
6618#define GFX75_MI_LOAD_REGISTER_REG_header       \
6619   .DWordLength                         =      1,  \
6620   .MICommandOpcode                     =     42,  \
6621   .CommandType                         =      0
6622
6623struct GFX75_MI_LOAD_REGISTER_REG {
6624   uint32_t                             DWordLength;
6625   uint32_t                             MICommandOpcode;
6626   uint32_t                             CommandType;
6627   uint64_t                             SourceRegisterAddress;
6628   uint64_t                             DestinationRegisterAddress;
6629};
6630
6631static inline __attribute__((always_inline)) void
6632GFX75_MI_LOAD_REGISTER_REG_pack(__attribute__((unused)) __gen_user_data *data,
6633                                __attribute__((unused)) void * restrict dst,
6634                                __attribute__((unused)) const struct GFX75_MI_LOAD_REGISTER_REG * restrict values)
6635{
6636   uint32_t * restrict dw = (uint32_t * restrict) dst;
6637
6638   dw[0] =
6639      __gen_uint(values->DWordLength, 0, 7) |
6640      __gen_uint(values->MICommandOpcode, 23, 28) |
6641      __gen_uint(values->CommandType, 29, 31);
6642
6643   dw[1] =
6644      __gen_offset(values->SourceRegisterAddress, 2, 22);
6645
6646   dw[2] =
6647      __gen_offset(values->DestinationRegisterAddress, 2, 22);
6648}
6649
6650#define GFX75_MI_LOAD_SCAN_LINES_EXCL_length      2
6651#define GFX75_MI_LOAD_SCAN_LINES_EXCL_length_bias      2
6652#define GFX75_MI_LOAD_SCAN_LINES_EXCL_header    \
6653   .DWordLength                         =      0,  \
6654   .MICommandOpcode                     =     19,  \
6655   .CommandType                         =      0
6656
6657struct GFX75_MI_LOAD_SCAN_LINES_EXCL {
6658   uint32_t                             DWordLength;
6659   uint32_t                             DisplayPlaneSelect;
6660#define DisplayPlaneA                            0
6661#define DisplayPlaneB                            1
6662#define DisplayPlaneC                            4
6663   uint32_t                             MICommandOpcode;
6664   uint32_t                             CommandType;
6665   uint32_t                             EndScanLineNumber;
6666   uint32_t                             StartScanLineNumber;
6667};
6668
6669static inline __attribute__((always_inline)) void
6670GFX75_MI_LOAD_SCAN_LINES_EXCL_pack(__attribute__((unused)) __gen_user_data *data,
6671                                   __attribute__((unused)) void * restrict dst,
6672                                   __attribute__((unused)) const struct GFX75_MI_LOAD_SCAN_LINES_EXCL * restrict values)
6673{
6674   uint32_t * restrict dw = (uint32_t * restrict) dst;
6675
6676   dw[0] =
6677      __gen_uint(values->DWordLength, 0, 5) |
6678      __gen_uint(values->DisplayPlaneSelect, 19, 21) |
6679      __gen_uint(values->MICommandOpcode, 23, 28) |
6680      __gen_uint(values->CommandType, 29, 31);
6681
6682   dw[1] =
6683      __gen_uint(values->EndScanLineNumber, 0, 12) |
6684      __gen_uint(values->StartScanLineNumber, 16, 28);
6685}
6686
6687#define GFX75_MI_LOAD_SCAN_LINES_INCL_length      2
6688#define GFX75_MI_LOAD_SCAN_LINES_INCL_length_bias      2
6689#define GFX75_MI_LOAD_SCAN_LINES_INCL_header    \
6690   .DWordLength                         =      0,  \
6691   .MICommandOpcode                     =     18,  \
6692   .CommandType                         =      0
6693
6694struct GFX75_MI_LOAD_SCAN_LINES_INCL {
6695   uint32_t                             DWordLength;
6696   uint32_t                             DisplayPlaneSelect;
6697#define DisplayPlaneA                            0
6698#define DisplayPlaneB                            1
6699#define DisplayPlaneC                            4
6700   uint32_t                             MICommandOpcode;
6701   uint32_t                             CommandType;
6702   uint32_t                             EndScanLineNumber;
6703   uint32_t                             StartScanLineNumber;
6704};
6705
6706static inline __attribute__((always_inline)) void
6707GFX75_MI_LOAD_SCAN_LINES_INCL_pack(__attribute__((unused)) __gen_user_data *data,
6708                                   __attribute__((unused)) void * restrict dst,
6709                                   __attribute__((unused)) const struct GFX75_MI_LOAD_SCAN_LINES_INCL * restrict values)
6710{
6711   uint32_t * restrict dw = (uint32_t * restrict) dst;
6712
6713   dw[0] =
6714      __gen_uint(values->DWordLength, 0, 5) |
6715      __gen_uint(values->DisplayPlaneSelect, 19, 21) |
6716      __gen_uint(values->MICommandOpcode, 23, 28) |
6717      __gen_uint(values->CommandType, 29, 31);
6718
6719   dw[1] =
6720      __gen_uint(values->EndScanLineNumber, 0, 12) |
6721      __gen_uint(values->StartScanLineNumber, 16, 28);
6722}
6723
6724#define GFX75_MI_LOAD_URB_MEM_length           3
6725#define GFX75_MI_LOAD_URB_MEM_length_bias      2
6726#define GFX75_MI_LOAD_URB_MEM_header            \
6727   .DWordLength                         =      1,  \
6728   .MICommandOpcode                     =     44,  \
6729   .CommandType                         =      0
6730
6731struct GFX75_MI_LOAD_URB_MEM {
6732   uint32_t                             DWordLength;
6733   uint32_t                             MICommandOpcode;
6734   uint32_t                             CommandType;
6735   uint32_t                             URBAddress;
6736   __gen_address_type                   MemoryAddress;
6737};
6738
6739static inline __attribute__((always_inline)) void
6740GFX75_MI_LOAD_URB_MEM_pack(__attribute__((unused)) __gen_user_data *data,
6741                           __attribute__((unused)) void * restrict dst,
6742                           __attribute__((unused)) const struct GFX75_MI_LOAD_URB_MEM * restrict values)
6743{
6744   uint32_t * restrict dw = (uint32_t * restrict) dst;
6745
6746   dw[0] =
6747      __gen_uint(values->DWordLength, 0, 7) |
6748      __gen_uint(values->MICommandOpcode, 23, 28) |
6749      __gen_uint(values->CommandType, 29, 31);
6750
6751   dw[1] =
6752      __gen_uint(values->URBAddress, 2, 14);
6753
6754   dw[2] = __gen_address(data, &dw[2], values->MemoryAddress, 0, 6, 31);
6755}
6756
6757#define GFX75_MI_MATH_length_bias              2
6758#define GFX75_MI_MATH_header                    \
6759   .DWordLength                         =      0,  \
6760   .MICommandOpcode                     =     26,  \
6761   .CommandType                         =      0
6762
6763struct GFX75_MI_MATH {
6764   uint32_t                             DWordLength;
6765   uint32_t                             MICommandOpcode;
6766   uint32_t                             CommandType;
6767   /* variable length fields follow */
6768};
6769
6770static inline __attribute__((always_inline)) void
6771GFX75_MI_MATH_pack(__attribute__((unused)) __gen_user_data *data,
6772                   __attribute__((unused)) void * restrict dst,
6773                   __attribute__((unused)) const struct GFX75_MI_MATH * restrict values)
6774{
6775   uint32_t * restrict dw = (uint32_t * restrict) dst;
6776
6777   dw[0] =
6778      __gen_uint(values->DWordLength, 0, 5) |
6779      __gen_uint(values->MICommandOpcode, 23, 28) |
6780      __gen_uint(values->CommandType, 29, 31);
6781}
6782
6783#define GFX75_MI_NOOP_length                   1
6784#define GFX75_MI_NOOP_length_bias              1
6785#define GFX75_MI_NOOP_header                    \
6786   .MICommandOpcode                     =      0,  \
6787   .CommandType                         =      0
6788
6789struct GFX75_MI_NOOP {
6790   uint32_t                             IdentificationNumber;
6791   bool                                 IdentificationNumberRegisterWriteEnable;
6792   uint32_t                             MICommandOpcode;
6793   uint32_t                             CommandType;
6794};
6795
6796static inline __attribute__((always_inline)) void
6797GFX75_MI_NOOP_pack(__attribute__((unused)) __gen_user_data *data,
6798                   __attribute__((unused)) void * restrict dst,
6799                   __attribute__((unused)) const struct GFX75_MI_NOOP * restrict values)
6800{
6801   uint32_t * restrict dw = (uint32_t * restrict) dst;
6802
6803   dw[0] =
6804      __gen_uint(values->IdentificationNumber, 0, 21) |
6805      __gen_uint(values->IdentificationNumberRegisterWriteEnable, 22, 22) |
6806      __gen_uint(values->MICommandOpcode, 23, 28) |
6807      __gen_uint(values->CommandType, 29, 31);
6808}
6809
6810#define GFX75_MI_PREDICATE_length              1
6811#define GFX75_MI_PREDICATE_length_bias         1
6812#define GFX75_MI_PREDICATE_header               \
6813   .MICommandOpcode                     =     12,  \
6814   .CommandType                         =      0
6815
6816struct GFX75_MI_PREDICATE {
6817   uint32_t                             CompareOperation;
6818#define COMPARE_TRUE                             0
6819#define COMPARE_FALSE                            1
6820#define COMPARE_SRCS_EQUAL                       2
6821#define COMPARE_DELTAS_EQUAL                     3
6822   uint32_t                             CombineOperation;
6823#define COMBINE_SET                              0
6824#define COMBINE_AND                              1
6825#define COMBINE_OR                               2
6826#define COMBINE_XOR                              3
6827   uint32_t                             LoadOperation;
6828#define LOAD_KEEP                                0
6829#define LOAD_LOAD                                2
6830#define LOAD_LOADINV                             3
6831   uint32_t                             MICommandOpcode;
6832   uint32_t                             CommandType;
6833};
6834
6835static inline __attribute__((always_inline)) void
6836GFX75_MI_PREDICATE_pack(__attribute__((unused)) __gen_user_data *data,
6837                        __attribute__((unused)) void * restrict dst,
6838                        __attribute__((unused)) const struct GFX75_MI_PREDICATE * restrict values)
6839{
6840   uint32_t * restrict dw = (uint32_t * restrict) dst;
6841
6842   dw[0] =
6843      __gen_uint(values->CompareOperation, 0, 1) |
6844      __gen_uint(values->CombineOperation, 3, 4) |
6845      __gen_uint(values->LoadOperation, 6, 7) |
6846      __gen_uint(values->MICommandOpcode, 23, 28) |
6847      __gen_uint(values->CommandType, 29, 31);
6848}
6849
6850#define GFX75_MI_REPORT_HEAD_length            1
6851#define GFX75_MI_REPORT_HEAD_length_bias       1
6852#define GFX75_MI_REPORT_HEAD_header             \
6853   .MICommandOpcode                     =      7,  \
6854   .CommandType                         =      0
6855
6856struct GFX75_MI_REPORT_HEAD {
6857   uint32_t                             MICommandOpcode;
6858   uint32_t                             CommandType;
6859};
6860
6861static inline __attribute__((always_inline)) void
6862GFX75_MI_REPORT_HEAD_pack(__attribute__((unused)) __gen_user_data *data,
6863                          __attribute__((unused)) void * restrict dst,
6864                          __attribute__((unused)) const struct GFX75_MI_REPORT_HEAD * restrict values)
6865{
6866   uint32_t * restrict dw = (uint32_t * restrict) dst;
6867
6868   dw[0] =
6869      __gen_uint(values->MICommandOpcode, 23, 28) |
6870      __gen_uint(values->CommandType, 29, 31);
6871}
6872
6873#define GFX75_MI_REPORT_PERF_COUNT_length      3
6874#define GFX75_MI_REPORT_PERF_COUNT_length_bias      2
6875#define GFX75_MI_REPORT_PERF_COUNT_header       \
6876   .DWordLength                         =      1,  \
6877   .MICommandOpcode                     =     40,  \
6878   .CommandType                         =      0
6879
6880struct GFX75_MI_REPORT_PERF_COUNT {
6881   uint32_t                             DWordLength;
6882   uint32_t                             MICommandOpcode;
6883   uint32_t                             CommandType;
6884   bool                                 UseGlobalGTT;
6885   uint32_t                             CoreModeEnable;
6886   __gen_address_type                   MemoryAddress;
6887   uint32_t                             ReportID;
6888};
6889
6890static inline __attribute__((always_inline)) void
6891GFX75_MI_REPORT_PERF_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
6892                                __attribute__((unused)) void * restrict dst,
6893                                __attribute__((unused)) const struct GFX75_MI_REPORT_PERF_COUNT * restrict values)
6894{
6895   uint32_t * restrict dw = (uint32_t * restrict) dst;
6896
6897   dw[0] =
6898      __gen_uint(values->DWordLength, 0, 5) |
6899      __gen_uint(values->MICommandOpcode, 23, 28) |
6900      __gen_uint(values->CommandType, 29, 31);
6901
6902   const uint32_t v1 =
6903      __gen_uint(values->UseGlobalGTT, 0, 0) |
6904      __gen_uint(values->CoreModeEnable, 4, 4);
6905   dw[1] = __gen_address(data, &dw[1], values->MemoryAddress, v1, 6, 31);
6906
6907   dw[2] =
6908      __gen_uint(values->ReportID, 0, 31);
6909}
6910
6911#define GFX75_MI_RS_CONTEXT_length             1
6912#define GFX75_MI_RS_CONTEXT_length_bias        1
6913#define GFX75_MI_RS_CONTEXT_header              \
6914   .MICommandOpcode                     =     15,  \
6915   .CommandType                         =      0
6916
6917struct GFX75_MI_RS_CONTEXT {
6918   uint32_t                             ResourceStreamerSave;
6919#define RS_Restore                               0
6920#define RS_Save                                  1
6921   uint32_t                             MICommandOpcode;
6922   uint32_t                             CommandType;
6923};
6924
6925static inline __attribute__((always_inline)) void
6926GFX75_MI_RS_CONTEXT_pack(__attribute__((unused)) __gen_user_data *data,
6927                         __attribute__((unused)) void * restrict dst,
6928                         __attribute__((unused)) const struct GFX75_MI_RS_CONTEXT * restrict values)
6929{
6930   uint32_t * restrict dw = (uint32_t * restrict) dst;
6931
6932   dw[0] =
6933      __gen_uint(values->ResourceStreamerSave, 0, 0) |
6934      __gen_uint(values->MICommandOpcode, 23, 28) |
6935      __gen_uint(values->CommandType, 29, 31);
6936}
6937
6938#define GFX75_MI_RS_CONTROL_length             1
6939#define GFX75_MI_RS_CONTROL_length_bias        1
6940#define GFX75_MI_RS_CONTROL_header              \
6941   .MICommandOpcode                     =      6,  \
6942   .CommandType                         =      0
6943
6944struct GFX75_MI_RS_CONTROL {
6945   uint32_t                             ResourceStreamerControl;
6946#define RS_Stop                                  0
6947#define RS_Start                                 1
6948   uint32_t                             MICommandOpcode;
6949   uint32_t                             CommandType;
6950};
6951
6952static inline __attribute__((always_inline)) void
6953GFX75_MI_RS_CONTROL_pack(__attribute__((unused)) __gen_user_data *data,
6954                         __attribute__((unused)) void * restrict dst,
6955                         __attribute__((unused)) const struct GFX75_MI_RS_CONTROL * restrict values)
6956{
6957   uint32_t * restrict dw = (uint32_t * restrict) dst;
6958
6959   dw[0] =
6960      __gen_uint(values->ResourceStreamerControl, 0, 0) |
6961      __gen_uint(values->MICommandOpcode, 23, 28) |
6962      __gen_uint(values->CommandType, 29, 31);
6963}
6964
6965#define GFX75_MI_RS_STORE_DATA_IMM_length      4
6966#define GFX75_MI_RS_STORE_DATA_IMM_length_bias      2
6967#define GFX75_MI_RS_STORE_DATA_IMM_header       \
6968   .DWordLength                         =      2,  \
6969   .MICommandOpcode                     =     43,  \
6970   .CommandType                         =      0
6971
6972struct GFX75_MI_RS_STORE_DATA_IMM {
6973   uint32_t                             DWordLength;
6974   uint32_t                             MICommandOpcode;
6975   uint32_t                             CommandType;
6976   uint32_t                             CoreModeEnable;
6977   __gen_address_type                   DestinationAddress;
6978   uint32_t                             DataDWord0;
6979};
6980
6981static inline __attribute__((always_inline)) void
6982GFX75_MI_RS_STORE_DATA_IMM_pack(__attribute__((unused)) __gen_user_data *data,
6983                                __attribute__((unused)) void * restrict dst,
6984                                __attribute__((unused)) const struct GFX75_MI_RS_STORE_DATA_IMM * restrict values)
6985{
6986   uint32_t * restrict dw = (uint32_t * restrict) dst;
6987
6988   dw[0] =
6989      __gen_uint(values->DWordLength, 0, 7) |
6990      __gen_uint(values->MICommandOpcode, 23, 28) |
6991      __gen_uint(values->CommandType, 29, 31);
6992
6993   dw[1] = 0;
6994
6995   const uint32_t v2 =
6996      __gen_uint(values->CoreModeEnable, 0, 0);
6997   dw[2] = __gen_address(data, &dw[2], values->DestinationAddress, v2, 2, 31);
6998
6999   dw[3] =
7000      __gen_uint(values->DataDWord0, 0, 31);
7001}
7002
7003#define GFX75_MI_SEMAPHORE_MBOX_length         3
7004#define GFX75_MI_SEMAPHORE_MBOX_length_bias      2
7005#define GFX75_MI_SEMAPHORE_MBOX_header          \
7006   .DWordLength                         =      1,  \
7007   .MICommandOpcode                     =     22,  \
7008   .CommandType                         =      0
7009
7010struct GFX75_MI_SEMAPHORE_MBOX {
7011   uint32_t                             DWordLength;
7012   uint32_t                             GeneralRegisterSelect;
7013   uint32_t                             RegisterSelect;
7014#define RVSYNC                                   0
7015#define RVESYNC                                  1
7016#define RBSYNC                                   2
7017#define UseGeneralRegisterSelect                 3
7018   uint32_t                             MICommandOpcode;
7019   uint32_t                             CommandType;
7020   uint32_t                             SemaphoreDataDword;
7021};
7022
7023static inline __attribute__((always_inline)) void
7024GFX75_MI_SEMAPHORE_MBOX_pack(__attribute__((unused)) __gen_user_data *data,
7025                             __attribute__((unused)) void * restrict dst,
7026                             __attribute__((unused)) const struct GFX75_MI_SEMAPHORE_MBOX * restrict values)
7027{
7028   uint32_t * restrict dw = (uint32_t * restrict) dst;
7029
7030   dw[0] =
7031      __gen_uint(values->DWordLength, 0, 7) |
7032      __gen_uint(values->GeneralRegisterSelect, 8, 13) |
7033      __gen_uint(values->RegisterSelect, 16, 17) |
7034      __gen_uint(values->MICommandOpcode, 23, 28) |
7035      __gen_uint(values->CommandType, 29, 31);
7036
7037   dw[1] =
7038      __gen_uint(values->SemaphoreDataDword, 0, 31);
7039
7040   dw[2] = 0;
7041}
7042
7043#define GFX75_MI_SET_CONTEXT_length            2
7044#define GFX75_MI_SET_CONTEXT_length_bias       2
7045#define GFX75_MI_SET_CONTEXT_header             \
7046   .DWordLength                         =      0,  \
7047   .MICommandOpcode                     =     24,  \
7048   .CommandType                         =      0
7049
7050struct GFX75_MI_SET_CONTEXT {
7051   uint32_t                             DWordLength;
7052   uint32_t                             MICommandOpcode;
7053   uint32_t                             CommandType;
7054   uint32_t                             RestoreInhibit;
7055   uint32_t                             ForceRestore;
7056   bool                                 ResourceStreamerStateRestoreEnable;
7057   bool                                 ResourceStreamerStateSaveEnable;
7058   bool                                 CoreModeEnable;
7059   uint32_t                             ReservedMustbe1;
7060   __gen_address_type                   LogicalContextAddress;
7061};
7062
7063static inline __attribute__((always_inline)) void
7064GFX75_MI_SET_CONTEXT_pack(__attribute__((unused)) __gen_user_data *data,
7065                          __attribute__((unused)) void * restrict dst,
7066                          __attribute__((unused)) const struct GFX75_MI_SET_CONTEXT * restrict values)
7067{
7068   uint32_t * restrict dw = (uint32_t * restrict) dst;
7069
7070   dw[0] =
7071      __gen_uint(values->DWordLength, 0, 7) |
7072      __gen_uint(values->MICommandOpcode, 23, 28) |
7073      __gen_uint(values->CommandType, 29, 31);
7074
7075   const uint32_t v1 =
7076      __gen_uint(values->RestoreInhibit, 0, 0) |
7077      __gen_uint(values->ForceRestore, 1, 1) |
7078      __gen_uint(values->ResourceStreamerStateRestoreEnable, 2, 2) |
7079      __gen_uint(values->ResourceStreamerStateSaveEnable, 3, 3) |
7080      __gen_uint(values->CoreModeEnable, 4, 4) |
7081      __gen_uint(values->ReservedMustbe1, 8, 8);
7082   dw[1] = __gen_address(data, &dw[1], values->LogicalContextAddress, v1, 12, 31);
7083}
7084
7085#define GFX75_MI_SET_PREDICATE_length          1
7086#define GFX75_MI_SET_PREDICATE_length_bias      1
7087#define GFX75_MI_SET_PREDICATE_header           \
7088   .MICommandOpcode                     =      1,  \
7089   .CommandType                         =      0
7090
7091struct GFX75_MI_SET_PREDICATE {
7092   uint32_t                             PREDICATEENABLE;
7093   uint32_t                             MICommandOpcode;
7094   uint32_t                             CommandType;
7095};
7096
7097static inline __attribute__((always_inline)) void
7098GFX75_MI_SET_PREDICATE_pack(__attribute__((unused)) __gen_user_data *data,
7099                            __attribute__((unused)) void * restrict dst,
7100                            __attribute__((unused)) const struct GFX75_MI_SET_PREDICATE * restrict values)
7101{
7102   uint32_t * restrict dw = (uint32_t * restrict) dst;
7103
7104   dw[0] =
7105      __gen_uint(values->PREDICATEENABLE, 0, 1) |
7106      __gen_uint(values->MICommandOpcode, 23, 28) |
7107      __gen_uint(values->CommandType, 29, 31);
7108}
7109
7110#define GFX75_MI_STORE_DATA_IMM_length         4
7111#define GFX75_MI_STORE_DATA_IMM_length_bias      2
7112#define GFX75_MI_STORE_DATA_IMM_header          \
7113   .DWordLength                         =      2,  \
7114   .MICommandOpcode                     =     32,  \
7115   .CommandType                         =      0
7116
7117struct GFX75_MI_STORE_DATA_IMM {
7118   uint32_t                             DWordLength;
7119   bool                                 UseGlobalGTT;
7120   uint32_t                             MICommandOpcode;
7121   uint32_t                             CommandType;
7122   uint32_t                             CoreModeEnable;
7123   __gen_address_type                   Address;
7124   uint64_t                             ImmediateData;
7125};
7126
7127static inline __attribute__((always_inline)) void
7128GFX75_MI_STORE_DATA_IMM_pack(__attribute__((unused)) __gen_user_data *data,
7129                             __attribute__((unused)) void * restrict dst,
7130                             __attribute__((unused)) const struct GFX75_MI_STORE_DATA_IMM * restrict values)
7131{
7132   uint32_t * restrict dw = (uint32_t * restrict) dst;
7133
7134   dw[0] =
7135      __gen_uint(values->DWordLength, 0, 5) |
7136      __gen_uint(values->UseGlobalGTT, 22, 22) |
7137      __gen_uint(values->MICommandOpcode, 23, 28) |
7138      __gen_uint(values->CommandType, 29, 31);
7139
7140   dw[1] = 0;
7141
7142   const uint32_t v2 =
7143      __gen_uint(values->CoreModeEnable, 0, 0);
7144   dw[2] = __gen_address(data, &dw[2], values->Address, v2, 2, 31);
7145
7146   const uint64_t v3 =
7147      __gen_uint(values->ImmediateData, 0, 63);
7148   dw[3] = v3;
7149   dw[4] = v3 >> 32;
7150}
7151
7152#define GFX75_MI_STORE_DATA_INDEX_length       3
7153#define GFX75_MI_STORE_DATA_INDEX_length_bias      2
7154#define GFX75_MI_STORE_DATA_INDEX_header        \
7155   .DWordLength                         =      1,  \
7156   .MICommandOpcode                     =     33,  \
7157   .CommandType                         =      0
7158
7159struct GFX75_MI_STORE_DATA_INDEX {
7160   uint32_t                             DWordLength;
7161   uint32_t                             MICommandOpcode;
7162   uint32_t                             CommandType;
7163   uint32_t                             Offset;
7164   uint32_t                             DataDWord0;
7165   uint32_t                             DataDWord1;
7166};
7167
7168static inline __attribute__((always_inline)) void
7169GFX75_MI_STORE_DATA_INDEX_pack(__attribute__((unused)) __gen_user_data *data,
7170                               __attribute__((unused)) void * restrict dst,
7171                               __attribute__((unused)) const struct GFX75_MI_STORE_DATA_INDEX * restrict values)
7172{
7173   uint32_t * restrict dw = (uint32_t * restrict) dst;
7174
7175   dw[0] =
7176      __gen_uint(values->DWordLength, 0, 7) |
7177      __gen_uint(values->MICommandOpcode, 23, 28) |
7178      __gen_uint(values->CommandType, 29, 31);
7179
7180   dw[1] =
7181      __gen_uint(values->Offset, 2, 11);
7182
7183   dw[2] =
7184      __gen_uint(values->DataDWord0, 0, 31);
7185}
7186
7187#define GFX75_MI_STORE_REGISTER_MEM_length      3
7188#define GFX75_MI_STORE_REGISTER_MEM_length_bias      2
7189#define GFX75_MI_STORE_REGISTER_MEM_header      \
7190   .DWordLength                         =      1,  \
7191   .MICommandOpcode                     =     36,  \
7192   .CommandType                         =      0
7193
7194struct GFX75_MI_STORE_REGISTER_MEM {
7195   uint32_t                             DWordLength;
7196   bool                                 PredicateEnable;
7197   bool                                 UseGlobalGTT;
7198   uint32_t                             MICommandOpcode;
7199   uint32_t                             CommandType;
7200   uint64_t                             RegisterAddress;
7201   __gen_address_type                   MemoryAddress;
7202};
7203
7204static inline __attribute__((always_inline)) void
7205GFX75_MI_STORE_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
7206                                 __attribute__((unused)) void * restrict dst,
7207                                 __attribute__((unused)) const struct GFX75_MI_STORE_REGISTER_MEM * restrict values)
7208{
7209   uint32_t * restrict dw = (uint32_t * restrict) dst;
7210
7211   dw[0] =
7212      __gen_uint(values->DWordLength, 0, 7) |
7213      __gen_uint(values->PredicateEnable, 21, 21) |
7214      __gen_uint(values->UseGlobalGTT, 22, 22) |
7215      __gen_uint(values->MICommandOpcode, 23, 28) |
7216      __gen_uint(values->CommandType, 29, 31);
7217
7218   dw[1] =
7219      __gen_offset(values->RegisterAddress, 2, 22);
7220
7221   dw[2] = __gen_address(data, &dw[2], values->MemoryAddress, 0, 2, 31);
7222}
7223
7224#define GFX75_MI_STORE_URB_MEM_length          3
7225#define GFX75_MI_STORE_URB_MEM_length_bias      2
7226#define GFX75_MI_STORE_URB_MEM_header           \
7227   .DWordLength                         =      1,  \
7228   .MICommandOpcode                     =     45,  \
7229   .CommandType                         =      0
7230
7231struct GFX75_MI_STORE_URB_MEM {
7232   uint32_t                             DWordLength;
7233   uint32_t                             MICommandOpcode;
7234   uint32_t                             CommandType;
7235   uint32_t                             URBAddress;
7236   __gen_address_type                   MemoryAddress;
7237};
7238
7239static inline __attribute__((always_inline)) void
7240GFX75_MI_STORE_URB_MEM_pack(__attribute__((unused)) __gen_user_data *data,
7241                            __attribute__((unused)) void * restrict dst,
7242                            __attribute__((unused)) const struct GFX75_MI_STORE_URB_MEM * restrict values)
7243{
7244   uint32_t * restrict dw = (uint32_t * restrict) dst;
7245
7246   dw[0] =
7247      __gen_uint(values->DWordLength, 0, 7) |
7248      __gen_uint(values->MICommandOpcode, 23, 28) |
7249      __gen_uint(values->CommandType, 29, 31);
7250
7251   dw[1] =
7252      __gen_uint(values->URBAddress, 2, 14);
7253
7254   dw[2] = __gen_address(data, &dw[2], values->MemoryAddress, 0, 6, 31);
7255}
7256
7257#define GFX75_MI_SUSPEND_FLUSH_length          1
7258#define GFX75_MI_SUSPEND_FLUSH_length_bias      1
7259#define GFX75_MI_SUSPEND_FLUSH_header           \
7260   .MICommandOpcode                     =     11,  \
7261   .CommandType                         =      0
7262
7263struct GFX75_MI_SUSPEND_FLUSH {
7264   bool                                 SuspendFlush;
7265   uint32_t                             MICommandOpcode;
7266   uint32_t                             CommandType;
7267};
7268
7269static inline __attribute__((always_inline)) void
7270GFX75_MI_SUSPEND_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
7271                            __attribute__((unused)) void * restrict dst,
7272                            __attribute__((unused)) const struct GFX75_MI_SUSPEND_FLUSH * restrict values)
7273{
7274   uint32_t * restrict dw = (uint32_t * restrict) dst;
7275
7276   dw[0] =
7277      __gen_uint(values->SuspendFlush, 0, 0) |
7278      __gen_uint(values->MICommandOpcode, 23, 28) |
7279      __gen_uint(values->CommandType, 29, 31);
7280}
7281
7282#define GFX75_MI_TOPOLOGY_FILTER_length        1
7283#define GFX75_MI_TOPOLOGY_FILTER_length_bias      1
7284#define GFX75_MI_TOPOLOGY_FILTER_header         \
7285   .MICommandOpcode                     =     13,  \
7286   .CommandType                         =      0
7287
7288struct GFX75_MI_TOPOLOGY_FILTER {
7289   enum GFX75_3D_Prim_Topo_Type         TopologyFilterValue;
7290   uint32_t                             MICommandOpcode;
7291   uint32_t                             CommandType;
7292};
7293
7294static inline __attribute__((always_inline)) void
7295GFX75_MI_TOPOLOGY_FILTER_pack(__attribute__((unused)) __gen_user_data *data,
7296                              __attribute__((unused)) void * restrict dst,
7297                              __attribute__((unused)) const struct GFX75_MI_TOPOLOGY_FILTER * restrict values)
7298{
7299   uint32_t * restrict dw = (uint32_t * restrict) dst;
7300
7301   dw[0] =
7302      __gen_uint(values->TopologyFilterValue, 0, 5) |
7303      __gen_uint(values->MICommandOpcode, 23, 28) |
7304      __gen_uint(values->CommandType, 29, 31);
7305}
7306
7307#define GFX75_MI_URB_ATOMIC_ALLOC_length       1
7308#define GFX75_MI_URB_ATOMIC_ALLOC_length_bias      1
7309#define GFX75_MI_URB_ATOMIC_ALLOC_header        \
7310   .MICommandOpcode                     =      9,  \
7311   .CommandType                         =      0
7312
7313struct GFX75_MI_URB_ATOMIC_ALLOC {
7314   uint32_t                             URBAtomicStorageSize;
7315   uint32_t                             URBAtomicStorageOffset;
7316   uint32_t                             MICommandOpcode;
7317   uint32_t                             CommandType;
7318};
7319
7320static inline __attribute__((always_inline)) void
7321GFX75_MI_URB_ATOMIC_ALLOC_pack(__attribute__((unused)) __gen_user_data *data,
7322                               __attribute__((unused)) void * restrict dst,
7323                               __attribute__((unused)) const struct GFX75_MI_URB_ATOMIC_ALLOC * restrict values)
7324{
7325   uint32_t * restrict dw = (uint32_t * restrict) dst;
7326
7327   dw[0] =
7328      __gen_uint(values->URBAtomicStorageSize, 0, 8) |
7329      __gen_uint(values->URBAtomicStorageOffset, 12, 19) |
7330      __gen_uint(values->MICommandOpcode, 23, 28) |
7331      __gen_uint(values->CommandType, 29, 31);
7332}
7333
7334#define GFX75_MI_URB_CLEAR_length              2
7335#define GFX75_MI_URB_CLEAR_length_bias         2
7336#define GFX75_MI_URB_CLEAR_header               \
7337   .DWordLength                         =      0,  \
7338   .MICommandOpcode                     =     25,  \
7339   .CommandType                         =      0
7340
7341struct GFX75_MI_URB_CLEAR {
7342   uint32_t                             DWordLength;
7343   uint32_t                             MICommandOpcode;
7344   uint32_t                             CommandType;
7345   uint64_t                             URBAddress;
7346   uint32_t                             URBClearLength;
7347};
7348
7349static inline __attribute__((always_inline)) void
7350GFX75_MI_URB_CLEAR_pack(__attribute__((unused)) __gen_user_data *data,
7351                        __attribute__((unused)) void * restrict dst,
7352                        __attribute__((unused)) const struct GFX75_MI_URB_CLEAR * restrict values)
7353{
7354   uint32_t * restrict dw = (uint32_t * restrict) dst;
7355
7356   dw[0] =
7357      __gen_uint(values->DWordLength, 0, 7) |
7358      __gen_uint(values->MICommandOpcode, 23, 28) |
7359      __gen_uint(values->CommandType, 29, 31);
7360
7361   dw[1] =
7362      __gen_offset(values->URBAddress, 0, 14) |
7363      __gen_uint(values->URBClearLength, 16, 29);
7364}
7365
7366#define GFX75_MI_USER_INTERRUPT_length         1
7367#define GFX75_MI_USER_INTERRUPT_length_bias      1
7368#define GFX75_MI_USER_INTERRUPT_header          \
7369   .MICommandOpcode                     =      2,  \
7370   .CommandType                         =      0
7371
7372struct GFX75_MI_USER_INTERRUPT {
7373   uint32_t                             MICommandOpcode;
7374   uint32_t                             CommandType;
7375};
7376
7377static inline __attribute__((always_inline)) void
7378GFX75_MI_USER_INTERRUPT_pack(__attribute__((unused)) __gen_user_data *data,
7379                             __attribute__((unused)) void * restrict dst,
7380                             __attribute__((unused)) const struct GFX75_MI_USER_INTERRUPT * restrict values)
7381{
7382   uint32_t * restrict dw = (uint32_t * restrict) dst;
7383
7384   dw[0] =
7385      __gen_uint(values->MICommandOpcode, 23, 28) |
7386      __gen_uint(values->CommandType, 29, 31);
7387}
7388
7389#define GFX75_MI_WAIT_FOR_EVENT_length         1
7390#define GFX75_MI_WAIT_FOR_EVENT_length_bias      1
7391#define GFX75_MI_WAIT_FOR_EVENT_header          \
7392   .MICommandOpcode                     =      3,  \
7393   .CommandType                         =      0
7394
7395struct GFX75_MI_WAIT_FOR_EVENT {
7396   bool                                 DisplayPipeAScanLineWaitEnable;
7397   bool                                 DisplayPlaneAFlipPendingWaitEnable;
7398   bool                                 DisplaySpriteAFlipPendingWaitEnable;
7399   bool                                 DisplayPipeAVerticalBlankWaitEnable;
7400   bool                                 DisplayPipeAHorizontalBlankWaitEnable;
7401   bool                                 DisplayPipeBScanLineWaitEnable;
7402   bool                                 DisplayPlaneBFlipPendingWaitEnable;
7403   bool                                 DisplaySpriteBFlipPendingWaitEnable;
7404   bool                                 DisplayPipeBVerticalBlankWaitEnable;
7405   bool                                 DisplayPipeBHorizontalBlankWaitEnable;
7406   bool                                 DisplayPipeCScanLineWaitEnable;
7407   bool                                 DisplayPlaneCFlipPendingWaitEnable;
7408   uint32_t                             ConditionCodeWaitSelect;
7409#define Notenabled                               0
7410   bool                                 DisplaySpriteCFlipPendingWaitEnable;
7411   bool                                 DisplayPipeCVerticalBlankWaitEnable;
7412   bool                                 DisplayPipeCHorizontalBlankWaitEnable;
7413   uint32_t                             MICommandOpcode;
7414   uint32_t                             CommandType;
7415};
7416
7417static inline __attribute__((always_inline)) void
7418GFX75_MI_WAIT_FOR_EVENT_pack(__attribute__((unused)) __gen_user_data *data,
7419                             __attribute__((unused)) void * restrict dst,
7420                             __attribute__((unused)) const struct GFX75_MI_WAIT_FOR_EVENT * restrict values)
7421{
7422   uint32_t * restrict dw = (uint32_t * restrict) dst;
7423
7424   dw[0] =
7425      __gen_uint(values->DisplayPipeAScanLineWaitEnable, 0, 0) |
7426      __gen_uint(values->DisplayPlaneAFlipPendingWaitEnable, 1, 1) |
7427      __gen_uint(values->DisplaySpriteAFlipPendingWaitEnable, 2, 2) |
7428      __gen_uint(values->DisplayPipeAVerticalBlankWaitEnable, 3, 3) |
7429      __gen_uint(values->DisplayPipeAHorizontalBlankWaitEnable, 5, 5) |
7430      __gen_uint(values->DisplayPipeBScanLineWaitEnable, 8, 8) |
7431      __gen_uint(values->DisplayPlaneBFlipPendingWaitEnable, 9, 9) |
7432      __gen_uint(values->DisplaySpriteBFlipPendingWaitEnable, 10, 10) |
7433      __gen_uint(values->DisplayPipeBVerticalBlankWaitEnable, 11, 11) |
7434      __gen_uint(values->DisplayPipeBHorizontalBlankWaitEnable, 13, 13) |
7435      __gen_uint(values->DisplayPipeCScanLineWaitEnable, 14, 14) |
7436      __gen_uint(values->DisplayPlaneCFlipPendingWaitEnable, 15, 15) |
7437      __gen_uint(values->ConditionCodeWaitSelect, 16, 19) |
7438      __gen_uint(values->DisplaySpriteCFlipPendingWaitEnable, 20, 20) |
7439      __gen_uint(values->DisplayPipeCVerticalBlankWaitEnable, 21, 21) |
7440      __gen_uint(values->DisplayPipeCHorizontalBlankWaitEnable, 22, 22) |
7441      __gen_uint(values->MICommandOpcode, 23, 28) |
7442      __gen_uint(values->CommandType, 29, 31);
7443}
7444
7445#define GFX75_PIPELINE_SELECT_length           1
7446#define GFX75_PIPELINE_SELECT_length_bias      1
7447#define GFX75_PIPELINE_SELECT_header            \
7448   ._3DCommandSubOpcode                 =      4,  \
7449   ._3DCommandOpcode                    =      1,  \
7450   .CommandSubType                      =      1,  \
7451   .CommandType                         =      3
7452
7453struct GFX75_PIPELINE_SELECT {
7454   uint32_t                             PipelineSelection;
7455#define _3D                                      0
7456#define Media                                    1
7457#define GPGPU                                    2
7458   uint32_t                             _3DCommandSubOpcode;
7459   uint32_t                             _3DCommandOpcode;
7460   uint32_t                             CommandSubType;
7461   uint32_t                             CommandType;
7462};
7463
7464static inline __attribute__((always_inline)) void
7465GFX75_PIPELINE_SELECT_pack(__attribute__((unused)) __gen_user_data *data,
7466                           __attribute__((unused)) void * restrict dst,
7467                           __attribute__((unused)) const struct GFX75_PIPELINE_SELECT * restrict values)
7468{
7469   uint32_t * restrict dw = (uint32_t * restrict) dst;
7470
7471   dw[0] =
7472      __gen_uint(values->PipelineSelection, 0, 1) |
7473      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7474      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7475      __gen_uint(values->CommandSubType, 27, 28) |
7476      __gen_uint(values->CommandType, 29, 31);
7477}
7478
7479#define GFX75_PIPE_CONTROL_length              5
7480#define GFX75_PIPE_CONTROL_length_bias         2
7481#define GFX75_PIPE_CONTROL_header               \
7482   .DWordLength                         =      3,  \
7483   ._3DCommandSubOpcode                 =      0,  \
7484   ._3DCommandOpcode                    =      2,  \
7485   .CommandSubType                      =      3,  \
7486   .CommandType                         =      3
7487
7488struct GFX75_PIPE_CONTROL {
7489   uint32_t                             DWordLength;
7490   uint32_t                             _3DCommandSubOpcode;
7491   uint32_t                             _3DCommandOpcode;
7492   uint32_t                             CommandSubType;
7493   uint32_t                             CommandType;
7494   bool                                 DepthCacheFlushEnable;
7495   bool                                 StallAtPixelScoreboard;
7496   bool                                 StateCacheInvalidationEnable;
7497   bool                                 ConstantCacheInvalidationEnable;
7498   bool                                 VFCacheInvalidationEnable;
7499   bool                                 DCFlushEnable;
7500   bool                                 PipeControlFlushEnable;
7501   bool                                 NotifyEnable;
7502   bool                                 IndirectStatePointersDisable;
7503   bool                                 TextureCacheInvalidationEnable;
7504   bool                                 InstructionCacheInvalidateEnable;
7505   bool                                 RenderTargetCacheFlushEnable;
7506   bool                                 DepthStallEnable;
7507   uint32_t                             PostSyncOperation;
7508#define NoWrite                                  0
7509#define WriteImmediateData                       1
7510#define WritePSDepthCount                        2
7511#define WriteTimestamp                           3
7512   bool                                 GenericMediaStateClear;
7513   bool                                 TLBInvalidate;
7514   bool                                 GlobalSnapshotCountReset;
7515   bool                                 CommandStreamerStallEnable;
7516   uint32_t                             StoreDataIndex;
7517   uint32_t                             LRIPostSyncOperation;
7518#define NoLRIOperation                           0
7519#define MMIOWriteImmediateData                   1
7520   uint32_t                             DestinationAddressType;
7521#define DAT_PPGTT                                0
7522#define DAT_GGTT                                 1
7523   __gen_address_type                   Address;
7524   uint64_t                             ImmediateData;
7525};
7526
7527static inline __attribute__((always_inline)) void
7528GFX75_PIPE_CONTROL_pack(__attribute__((unused)) __gen_user_data *data,
7529                        __attribute__((unused)) void * restrict dst,
7530                        __attribute__((unused)) const struct GFX75_PIPE_CONTROL * restrict values)
7531{
7532   uint32_t * restrict dw = (uint32_t * restrict) dst;
7533
7534   dw[0] =
7535      __gen_uint(values->DWordLength, 0, 7) |
7536      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7537      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7538      __gen_uint(values->CommandSubType, 27, 28) |
7539      __gen_uint(values->CommandType, 29, 31);
7540
7541   dw[1] =
7542      __gen_uint(values->DepthCacheFlushEnable, 0, 0) |
7543      __gen_uint(values->StallAtPixelScoreboard, 1, 1) |
7544      __gen_uint(values->StateCacheInvalidationEnable, 2, 2) |
7545      __gen_uint(values->ConstantCacheInvalidationEnable, 3, 3) |
7546      __gen_uint(values->VFCacheInvalidationEnable, 4, 4) |
7547      __gen_uint(values->DCFlushEnable, 5, 5) |
7548      __gen_uint(values->PipeControlFlushEnable, 7, 7) |
7549      __gen_uint(values->NotifyEnable, 8, 8) |
7550      __gen_uint(values->IndirectStatePointersDisable, 9, 9) |
7551      __gen_uint(values->TextureCacheInvalidationEnable, 10, 10) |
7552      __gen_uint(values->InstructionCacheInvalidateEnable, 11, 11) |
7553      __gen_uint(values->RenderTargetCacheFlushEnable, 12, 12) |
7554      __gen_uint(values->DepthStallEnable, 13, 13) |
7555      __gen_uint(values->PostSyncOperation, 14, 15) |
7556      __gen_uint(values->GenericMediaStateClear, 16, 16) |
7557      __gen_uint(values->TLBInvalidate, 18, 18) |
7558      __gen_uint(values->GlobalSnapshotCountReset, 19, 19) |
7559      __gen_uint(values->CommandStreamerStallEnable, 20, 20) |
7560      __gen_uint(values->StoreDataIndex, 21, 21) |
7561      __gen_uint(values->LRIPostSyncOperation, 23, 23) |
7562      __gen_uint(values->DestinationAddressType, 24, 24);
7563
7564   dw[2] = __gen_address(data, &dw[2], values->Address, 0, 2, 31);
7565
7566   const uint64_t v3 =
7567      __gen_uint(values->ImmediateData, 0, 63);
7568   dw[3] = v3;
7569   dw[4] = v3 >> 32;
7570}
7571
7572#define GFX75_STATE_BASE_ADDRESS_length       10
7573#define GFX75_STATE_BASE_ADDRESS_length_bias      2
7574#define GFX75_STATE_BASE_ADDRESS_header         \
7575   .DWordLength                         =      8,  \
7576   ._3DCommandSubOpcode                 =      1,  \
7577   ._3DCommandOpcode                    =      1,  \
7578   .CommandSubType                      =      0,  \
7579   .CommandType                         =      3
7580
7581struct GFX75_STATE_BASE_ADDRESS {
7582   uint32_t                             DWordLength;
7583   uint32_t                             _3DCommandSubOpcode;
7584   uint32_t                             _3DCommandOpcode;
7585   uint32_t                             CommandSubType;
7586   uint32_t                             CommandType;
7587   bool                                 GeneralStateBaseAddressModifyEnable;
7588   uint32_t                             StatelessDataPortAccessMOCS;
7589   uint32_t                             GeneralStateMOCS;
7590   __gen_address_type                   GeneralStateBaseAddress;
7591   bool                                 SurfaceStateBaseAddressModifyEnable;
7592   uint32_t                             SurfaceStateMOCS;
7593   __gen_address_type                   SurfaceStateBaseAddress;
7594   bool                                 DynamicStateBaseAddressModifyEnable;
7595   uint32_t                             DynamicStateMOCS;
7596   __gen_address_type                   DynamicStateBaseAddress;
7597   bool                                 IndirectObjectBaseAddressModifyEnable;
7598   uint32_t                             IndirectObjectMOCS;
7599   __gen_address_type                   IndirectObjectBaseAddress;
7600   bool                                 InstructionBaseAddressModifyEnable;
7601   uint32_t                             InstructionMOCS;
7602   __gen_address_type                   InstructionBaseAddress;
7603   bool                                 GeneralStateAccessUpperBoundModifyEnable;
7604   __gen_address_type                   GeneralStateAccessUpperBound;
7605   bool                                 DynamicStateAccessUpperBoundModifyEnable;
7606   __gen_address_type                   DynamicStateAccessUpperBound;
7607   bool                                 IndirectObjectAccessUpperBoundModifyEnable;
7608   __gen_address_type                   IndirectObjectAccessUpperBound;
7609   bool                                 InstructionAccessUpperBoundModifyEnable;
7610   __gen_address_type                   InstructionAccessUpperBound;
7611};
7612
7613static inline __attribute__((always_inline)) void
7614GFX75_STATE_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
7615                              __attribute__((unused)) void * restrict dst,
7616                              __attribute__((unused)) const struct GFX75_STATE_BASE_ADDRESS * restrict values)
7617{
7618   uint32_t * restrict dw = (uint32_t * restrict) dst;
7619
7620   dw[0] =
7621      __gen_uint(values->DWordLength, 0, 7) |
7622      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7623      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7624      __gen_uint(values->CommandSubType, 27, 28) |
7625      __gen_uint(values->CommandType, 29, 31);
7626
7627   const uint32_t v1 =
7628      __gen_uint(values->GeneralStateBaseAddressModifyEnable, 0, 0) |
7629      __gen_uint(values->StatelessDataPortAccessMOCS, 4, 7) |
7630      __gen_uint(values->GeneralStateMOCS, 8, 11);
7631   dw[1] = __gen_address(data, &dw[1], values->GeneralStateBaseAddress, v1, 12, 31);
7632
7633   const uint32_t v2 =
7634      __gen_uint(values->SurfaceStateBaseAddressModifyEnable, 0, 0) |
7635      __gen_uint(values->SurfaceStateMOCS, 8, 11);
7636   dw[2] = __gen_address(data, &dw[2], values->SurfaceStateBaseAddress, v2, 12, 31);
7637
7638   const uint32_t v3 =
7639      __gen_uint(values->DynamicStateBaseAddressModifyEnable, 0, 0) |
7640      __gen_uint(values->DynamicStateMOCS, 8, 11);
7641   dw[3] = __gen_address(data, &dw[3], values->DynamicStateBaseAddress, v3, 12, 31);
7642
7643   const uint32_t v4 =
7644      __gen_uint(values->IndirectObjectBaseAddressModifyEnable, 0, 0) |
7645      __gen_uint(values->IndirectObjectMOCS, 8, 11);
7646   dw[4] = __gen_address(data, &dw[4], values->IndirectObjectBaseAddress, v4, 12, 31);
7647
7648   const uint32_t v5 =
7649      __gen_uint(values->InstructionBaseAddressModifyEnable, 0, 0) |
7650      __gen_uint(values->InstructionMOCS, 8, 11);
7651   dw[5] = __gen_address(data, &dw[5], values->InstructionBaseAddress, v5, 12, 31);
7652
7653   const uint32_t v6 =
7654      __gen_uint(values->GeneralStateAccessUpperBoundModifyEnable, 0, 0);
7655   dw[6] = __gen_address(data, &dw[6], values->GeneralStateAccessUpperBound, v6, 12, 31);
7656
7657   const uint32_t v7 =
7658      __gen_uint(values->DynamicStateAccessUpperBoundModifyEnable, 0, 0);
7659   dw[7] = __gen_address(data, &dw[7], values->DynamicStateAccessUpperBound, v7, 12, 31);
7660
7661   const uint32_t v8 =
7662      __gen_uint(values->IndirectObjectAccessUpperBoundModifyEnable, 0, 0);
7663   dw[8] = __gen_address(data, &dw[8], values->IndirectObjectAccessUpperBound, v8, 12, 31);
7664
7665   const uint32_t v9 =
7666      __gen_uint(values->InstructionAccessUpperBoundModifyEnable, 0, 0);
7667   dw[9] = __gen_address(data, &dw[9], values->InstructionAccessUpperBound, v9, 12, 31);
7668}
7669
7670#define GFX75_STATE_PREFETCH_length            2
7671#define GFX75_STATE_PREFETCH_length_bias       2
7672#define GFX75_STATE_PREFETCH_header             \
7673   .DWordLength                         =      0,  \
7674   ._3DCommandSubOpcode                 =      3,  \
7675   ._3DCommandOpcode                    =      0,  \
7676   .CommandSubType                      =      0,  \
7677   .CommandType                         =      3
7678
7679struct GFX75_STATE_PREFETCH {
7680   uint32_t                             DWordLength;
7681   uint32_t                             _3DCommandSubOpcode;
7682   uint32_t                             _3DCommandOpcode;
7683   uint32_t                             CommandSubType;
7684   uint32_t                             CommandType;
7685   uint32_t                             PrefetchCount;
7686   __gen_address_type                   PrefetchPointer;
7687};
7688
7689static inline __attribute__((always_inline)) void
7690GFX75_STATE_PREFETCH_pack(__attribute__((unused)) __gen_user_data *data,
7691                          __attribute__((unused)) void * restrict dst,
7692                          __attribute__((unused)) const struct GFX75_STATE_PREFETCH * restrict values)
7693{
7694   uint32_t * restrict dw = (uint32_t * restrict) dst;
7695
7696   dw[0] =
7697      __gen_uint(values->DWordLength, 0, 7) |
7698      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7699      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7700      __gen_uint(values->CommandSubType, 27, 28) |
7701      __gen_uint(values->CommandType, 29, 31);
7702
7703   const uint32_t v1 =
7704      __gen_uint(values->PrefetchCount, 0, 2);
7705   dw[1] = __gen_address(data, &dw[1], values->PrefetchPointer, v1, 6, 31);
7706}
7707
7708#define GFX75_STATE_SIP_length                 2
7709#define GFX75_STATE_SIP_length_bias            2
7710#define GFX75_STATE_SIP_header                  \
7711   .DWordLength                         =      0,  \
7712   ._3DCommandSubOpcode                 =      2,  \
7713   ._3DCommandOpcode                    =      1,  \
7714   .CommandSubType                      =      0,  \
7715   .CommandType                         =      3
7716
7717struct GFX75_STATE_SIP {
7718   uint32_t                             DWordLength;
7719   uint32_t                             _3DCommandSubOpcode;
7720   uint32_t                             _3DCommandOpcode;
7721   uint32_t                             CommandSubType;
7722   uint32_t                             CommandType;
7723   uint64_t                             SystemInstructionPointer;
7724};
7725
7726static inline __attribute__((always_inline)) void
7727GFX75_STATE_SIP_pack(__attribute__((unused)) __gen_user_data *data,
7728                     __attribute__((unused)) void * restrict dst,
7729                     __attribute__((unused)) const struct GFX75_STATE_SIP * restrict values)
7730{
7731   uint32_t * restrict dw = (uint32_t * restrict) dst;
7732
7733   dw[0] =
7734      __gen_uint(values->DWordLength, 0, 7) |
7735      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7736      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7737      __gen_uint(values->CommandSubType, 27, 28) |
7738      __gen_uint(values->CommandType, 29, 31);
7739
7740   dw[1] =
7741      __gen_offset(values->SystemInstructionPointer, 4, 31);
7742}
7743
7744#define GFX75_SWTESS_BASE_ADDRESS_length       2
7745#define GFX75_SWTESS_BASE_ADDRESS_length_bias      2
7746#define GFX75_SWTESS_BASE_ADDRESS_header        \
7747   .DWordLength                         =      0,  \
7748   ._3DCommandSubOpcode                 =      3,  \
7749   ._3DCommandOpcode                    =      1,  \
7750   .CommandSubType                      =      0,  \
7751   .CommandType                         =      3
7752
7753struct GFX75_SWTESS_BASE_ADDRESS {
7754   uint32_t                             DWordLength;
7755   uint32_t                             _3DCommandSubOpcode;
7756   uint32_t                             _3DCommandOpcode;
7757   uint32_t                             CommandSubType;
7758   uint32_t                             CommandType;
7759   uint32_t                             SWTessellationMOCS;
7760   __gen_address_type                   SWTessellationBaseAddress;
7761};
7762
7763static inline __attribute__((always_inline)) void
7764GFX75_SWTESS_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
7765                               __attribute__((unused)) void * restrict dst,
7766                               __attribute__((unused)) const struct GFX75_SWTESS_BASE_ADDRESS * restrict values)
7767{
7768   uint32_t * restrict dw = (uint32_t * restrict) dst;
7769
7770   dw[0] =
7771      __gen_uint(values->DWordLength, 0, 7) |
7772      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7773      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7774      __gen_uint(values->CommandSubType, 27, 28) |
7775      __gen_uint(values->CommandType, 29, 31);
7776
7777   const uint32_t v1 =
7778      __gen_uint(values->SWTessellationMOCS, 8, 11);
7779   dw[1] = __gen_address(data, &dw[1], values->SWTessellationBaseAddress, v1, 12, 31);
7780}
7781
7782#define GFX75_BCS_FAULT_REG_num           0x4294
7783#define GFX75_BCS_FAULT_REG_length             1
7784struct GFX75_BCS_FAULT_REG {
7785   bool                                 ValidBit;
7786   uint32_t                             FaultType;
7787#define PageFault                                0
7788#define InvalidPDFault                           1
7789#define UnloadedPDFault                          2
7790#define InvalidandUnloadedPDfault                3
7791   uint32_t                             SRCIDofFault;
7792   uint32_t                             GTTSEL;
7793#define PPGTT                                    0
7794#define GGTT                                     1
7795   __gen_address_type                   VirtualAddressofFault;
7796};
7797
7798static inline __attribute__((always_inline)) void
7799GFX75_BCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
7800                         __attribute__((unused)) void * restrict dst,
7801                         __attribute__((unused)) const struct GFX75_BCS_FAULT_REG * restrict values)
7802{
7803   uint32_t * restrict dw = (uint32_t * restrict) dst;
7804
7805   const uint32_t v0 =
7806      __gen_uint(values->ValidBit, 0, 0) |
7807      __gen_uint(values->FaultType, 1, 2) |
7808      __gen_uint(values->SRCIDofFault, 3, 10) |
7809      __gen_uint(values->GTTSEL, 11, 11);
7810   dw[0] = __gen_address(data, &dw[0], values->VirtualAddressofFault, v0, 12, 31);
7811}
7812
7813#define GFX75_BCS_INSTDONE_num            0x2206c
7814#define GFX75_BCS_INSTDONE_length              1
7815struct GFX75_BCS_INSTDONE {
7816   bool                                 RingEnable;
7817   bool                                 BlitterIDLE;
7818   bool                                 GABIDLE;
7819   bool                                 BCSDone;
7820};
7821
7822static inline __attribute__((always_inline)) void
7823GFX75_BCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
7824                        __attribute__((unused)) void * restrict dst,
7825                        __attribute__((unused)) const struct GFX75_BCS_INSTDONE * restrict values)
7826{
7827   uint32_t * restrict dw = (uint32_t * restrict) dst;
7828
7829   dw[0] =
7830      __gen_uint(values->RingEnable, 0, 0) |
7831      __gen_uint(values->BlitterIDLE, 1, 1) |
7832      __gen_uint(values->GABIDLE, 2, 2) |
7833      __gen_uint(values->BCSDone, 3, 3);
7834}
7835
7836#define GFX75_BCS_RING_BUFFER_CTL_num     0x2203c
7837#define GFX75_BCS_RING_BUFFER_CTL_length       1
7838struct GFX75_BCS_RING_BUFFER_CTL {
7839   bool                                 RingBufferEnable;
7840   uint32_t                             AutomaticReportHeadPointer;
7841#define MI_AUTOREPORT_OFF                        0
7842#define MI_AUTOREPORT_64KB                       1
7843#define MI_AUTOREPORT_4KB                        2
7844#define MI_AUTOREPORT_128KB                      3
7845   bool                                 DisableRegisterAccesses;
7846   bool                                 SemaphoreWait;
7847   bool                                 RBWait;
7848   uint32_t                             BufferLengthinpages1;
7849};
7850
7851static inline __attribute__((always_inline)) void
7852GFX75_BCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
7853                               __attribute__((unused)) void * restrict dst,
7854                               __attribute__((unused)) const struct GFX75_BCS_RING_BUFFER_CTL * restrict values)
7855{
7856   uint32_t * restrict dw = (uint32_t * restrict) dst;
7857
7858   dw[0] =
7859      __gen_uint(values->RingBufferEnable, 0, 0) |
7860      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
7861      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
7862      __gen_uint(values->SemaphoreWait, 10, 10) |
7863      __gen_uint(values->RBWait, 11, 11) |
7864      __gen_uint(values->BufferLengthinpages1, 12, 20);
7865}
7866
7867#define GFX75_CHICKEN3_num                0xe49c
7868#define GFX75_CHICKEN3_length                  1
7869struct GFX75_CHICKEN3 {
7870   uint32_t                             L3AtomicDisable;
7871   uint32_t                             L3AtomicDisableMask;
7872};
7873
7874static inline __attribute__((always_inline)) void
7875GFX75_CHICKEN3_pack(__attribute__((unused)) __gen_user_data *data,
7876                    __attribute__((unused)) void * restrict dst,
7877                    __attribute__((unused)) const struct GFX75_CHICKEN3 * restrict values)
7878{
7879   uint32_t * restrict dw = (uint32_t * restrict) dst;
7880
7881   dw[0] =
7882      __gen_uint(values->L3AtomicDisable, 6, 6) |
7883      __gen_uint(values->L3AtomicDisableMask, 22, 22);
7884}
7885
7886#define GFX75_CL_INVOCATION_COUNT_num     0x2338
7887#define GFX75_CL_INVOCATION_COUNT_length       2
7888struct GFX75_CL_INVOCATION_COUNT {
7889   uint64_t                             CLInvocationCountReport;
7890};
7891
7892static inline __attribute__((always_inline)) void
7893GFX75_CL_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
7894                               __attribute__((unused)) void * restrict dst,
7895                               __attribute__((unused)) const struct GFX75_CL_INVOCATION_COUNT * restrict values)
7896{
7897   uint32_t * restrict dw = (uint32_t * restrict) dst;
7898
7899   const uint64_t v0 =
7900      __gen_uint(values->CLInvocationCountReport, 0, 63);
7901   dw[0] = v0;
7902   dw[1] = v0 >> 32;
7903}
7904
7905#define GFX75_CL_PRIMITIVES_COUNT_num     0x2340
7906#define GFX75_CL_PRIMITIVES_COUNT_length       2
7907struct GFX75_CL_PRIMITIVES_COUNT {
7908   uint64_t                             CLPrimitivesCountReport;
7909};
7910
7911static inline __attribute__((always_inline)) void
7912GFX75_CL_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
7913                               __attribute__((unused)) void * restrict dst,
7914                               __attribute__((unused)) const struct GFX75_CL_PRIMITIVES_COUNT * restrict values)
7915{
7916   uint32_t * restrict dw = (uint32_t * restrict) dst;
7917
7918   const uint64_t v0 =
7919      __gen_uint(values->CLPrimitivesCountReport, 0, 63);
7920   dw[0] = v0;
7921   dw[1] = v0 >> 32;
7922}
7923
7924#define GFX75_CS_INVOCATION_COUNT_num     0x2290
7925#define GFX75_CS_INVOCATION_COUNT_length       2
7926struct GFX75_CS_INVOCATION_COUNT {
7927   uint64_t                             CSInvocationCountReport;
7928};
7929
7930static inline __attribute__((always_inline)) void
7931GFX75_CS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
7932                               __attribute__((unused)) void * restrict dst,
7933                               __attribute__((unused)) const struct GFX75_CS_INVOCATION_COUNT * restrict values)
7934{
7935   uint32_t * restrict dw = (uint32_t * restrict) dst;
7936
7937   const uint64_t v0 =
7938      __gen_uint(values->CSInvocationCountReport, 0, 63);
7939   dw[0] = v0;
7940   dw[1] = v0 >> 32;
7941}
7942
7943#define GFX75_DS_INVOCATION_COUNT_num     0x2308
7944#define GFX75_DS_INVOCATION_COUNT_length       2
7945struct GFX75_DS_INVOCATION_COUNT {
7946   uint64_t                             DSInvocationCountReport;
7947};
7948
7949static inline __attribute__((always_inline)) void
7950GFX75_DS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
7951                               __attribute__((unused)) void * restrict dst,
7952                               __attribute__((unused)) const struct GFX75_DS_INVOCATION_COUNT * restrict values)
7953{
7954   uint32_t * restrict dw = (uint32_t * restrict) dst;
7955
7956   const uint64_t v0 =
7957      __gen_uint(values->DSInvocationCountReport, 0, 63);
7958   dw[0] = v0;
7959   dw[1] = v0 >> 32;
7960}
7961
7962#define GFX75_ERR_INT_num                 0x44040
7963#define GFX75_ERR_INT_length                   1
7964struct GFX75_ERR_INT {
7965   bool                                 PrimaryAGTTFaultStatus;
7966   bool                                 PrimaryBGTTFaultStatus;
7967   bool                                 SpriteAGTTFaultStatus;
7968   bool                                 SpriteBGTTFaultStatus;
7969   bool                                 CursorAGTTFaultStatus;
7970   bool                                 CursorBGTTFaultStatus;
7971   bool                                 Invalidpagetableentrydata;
7972   bool                                 InvalidGTTpagetableentry;
7973};
7974
7975static inline __attribute__((always_inline)) void
7976GFX75_ERR_INT_pack(__attribute__((unused)) __gen_user_data *data,
7977                   __attribute__((unused)) void * restrict dst,
7978                   __attribute__((unused)) const struct GFX75_ERR_INT * restrict values)
7979{
7980   uint32_t * restrict dw = (uint32_t * restrict) dst;
7981
7982   dw[0] =
7983      __gen_uint(values->PrimaryAGTTFaultStatus, 0, 0) |
7984      __gen_uint(values->PrimaryBGTTFaultStatus, 1, 1) |
7985      __gen_uint(values->SpriteAGTTFaultStatus, 2, 2) |
7986      __gen_uint(values->SpriteBGTTFaultStatus, 3, 3) |
7987      __gen_uint(values->CursorAGTTFaultStatus, 4, 4) |
7988      __gen_uint(values->CursorBGTTFaultStatus, 5, 5) |
7989      __gen_uint(values->Invalidpagetableentrydata, 6, 6) |
7990      __gen_uint(values->InvalidGTTpagetableentry, 7, 7);
7991}
7992
7993#define GFX75_GFX_ARB_ERROR_RPT_num       0x40a0
7994#define GFX75_GFX_ARB_ERROR_RPT_length         1
7995struct GFX75_GFX_ARB_ERROR_RPT {
7996   bool                                 TLBPageFaultError;
7997   bool                                 ContextPageFaultError;
7998   bool                                 InvalidPageDirectoryentryerror;
7999   bool                                 HardwareStatusPageFaultError;
8000   bool                                 TLBPageVTDTranslationError;
8001   bool                                 ContextPageVTDTranslationError;
8002   bool                                 PageDirectoryEntryVTDTranslationError;
8003   bool                                 HardwareStatusPageVTDTranslationError;
8004   bool                                 UnloadedPDError;
8005   uint32_t                             PendingPageFaults;
8006};
8007
8008static inline __attribute__((always_inline)) void
8009GFX75_GFX_ARB_ERROR_RPT_pack(__attribute__((unused)) __gen_user_data *data,
8010                             __attribute__((unused)) void * restrict dst,
8011                             __attribute__((unused)) const struct GFX75_GFX_ARB_ERROR_RPT * restrict values)
8012{
8013   uint32_t * restrict dw = (uint32_t * restrict) dst;
8014
8015   dw[0] =
8016      __gen_uint(values->TLBPageFaultError, 0, 0) |
8017      __gen_uint(values->ContextPageFaultError, 1, 1) |
8018      __gen_uint(values->InvalidPageDirectoryentryerror, 2, 2) |
8019      __gen_uint(values->HardwareStatusPageFaultError, 3, 3) |
8020      __gen_uint(values->TLBPageVTDTranslationError, 4, 4) |
8021      __gen_uint(values->ContextPageVTDTranslationError, 5, 5) |
8022      __gen_uint(values->PageDirectoryEntryVTDTranslationError, 6, 6) |
8023      __gen_uint(values->HardwareStatusPageVTDTranslationError, 7, 7) |
8024      __gen_uint(values->UnloadedPDError, 8, 8) |
8025      __gen_uint(values->PendingPageFaults, 9, 15);
8026}
8027
8028#define GFX75_GS_INVOCATION_COUNT_num     0x2328
8029#define GFX75_GS_INVOCATION_COUNT_length       2
8030struct GFX75_GS_INVOCATION_COUNT {
8031   uint64_t                             GSInvocationCountReport;
8032};
8033
8034static inline __attribute__((always_inline)) void
8035GFX75_GS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
8036                               __attribute__((unused)) void * restrict dst,
8037                               __attribute__((unused)) const struct GFX75_GS_INVOCATION_COUNT * restrict values)
8038{
8039   uint32_t * restrict dw = (uint32_t * restrict) dst;
8040
8041   const uint64_t v0 =
8042      __gen_uint(values->GSInvocationCountReport, 0, 63);
8043   dw[0] = v0;
8044   dw[1] = v0 >> 32;
8045}
8046
8047#define GFX75_GS_PRIMITIVES_COUNT_num     0x2330
8048#define GFX75_GS_PRIMITIVES_COUNT_length       2
8049struct GFX75_GS_PRIMITIVES_COUNT {
8050   uint64_t                             GSPrimitivesCountReport;
8051};
8052
8053static inline __attribute__((always_inline)) void
8054GFX75_GS_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
8055                               __attribute__((unused)) void * restrict dst,
8056                               __attribute__((unused)) const struct GFX75_GS_PRIMITIVES_COUNT * restrict values)
8057{
8058   uint32_t * restrict dw = (uint32_t * restrict) dst;
8059
8060   const uint64_t v0 =
8061      __gen_uint(values->GSPrimitivesCountReport, 0, 63);
8062   dw[0] = v0;
8063   dw[1] = v0 >> 32;
8064}
8065
8066#define GFX75_HS_INVOCATION_COUNT_num     0x2300
8067#define GFX75_HS_INVOCATION_COUNT_length       2
8068struct GFX75_HS_INVOCATION_COUNT {
8069   uint64_t                             HSInvocationCountReport;
8070};
8071
8072static inline __attribute__((always_inline)) void
8073GFX75_HS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
8074                               __attribute__((unused)) void * restrict dst,
8075                               __attribute__((unused)) const struct GFX75_HS_INVOCATION_COUNT * restrict values)
8076{
8077   uint32_t * restrict dw = (uint32_t * restrict) dst;
8078
8079   const uint64_t v0 =
8080      __gen_uint(values->HSInvocationCountReport, 0, 63);
8081   dw[0] = v0;
8082   dw[1] = v0 >> 32;
8083}
8084
8085#define GFX75_IA_PRIMITIVES_COUNT_num     0x2318
8086#define GFX75_IA_PRIMITIVES_COUNT_length       2
8087struct GFX75_IA_PRIMITIVES_COUNT {
8088   uint64_t                             IAPrimitivesCountReport;
8089};
8090
8091static inline __attribute__((always_inline)) void
8092GFX75_IA_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
8093                               __attribute__((unused)) void * restrict dst,
8094                               __attribute__((unused)) const struct GFX75_IA_PRIMITIVES_COUNT * restrict values)
8095{
8096   uint32_t * restrict dw = (uint32_t * restrict) dst;
8097
8098   const uint64_t v0 =
8099      __gen_uint(values->IAPrimitivesCountReport, 0, 63);
8100   dw[0] = v0;
8101   dw[1] = v0 >> 32;
8102}
8103
8104#define GFX75_IA_VERTICES_COUNT_num       0x2310
8105#define GFX75_IA_VERTICES_COUNT_length         2
8106struct GFX75_IA_VERTICES_COUNT {
8107   uint64_t                             IAVerticesCountReport;
8108};
8109
8110static inline __attribute__((always_inline)) void
8111GFX75_IA_VERTICES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
8112                             __attribute__((unused)) void * restrict dst,
8113                             __attribute__((unused)) const struct GFX75_IA_VERTICES_COUNT * restrict values)
8114{
8115   uint32_t * restrict dw = (uint32_t * restrict) dst;
8116
8117   const uint64_t v0 =
8118      __gen_uint(values->IAVerticesCountReport, 0, 63);
8119   dw[0] = v0;
8120   dw[1] = v0 >> 32;
8121}
8122
8123#define GFX75_INSTDONE_1_num              0x206c
8124#define GFX75_INSTDONE_1_length                1
8125struct GFX75_INSTDONE_1 {
8126   bool                                 PRB0RingEnable;
8127   bool                                 VFGDone;
8128   bool                                 VSDone;
8129   bool                                 HSDone;
8130   bool                                 TEDone;
8131   bool                                 DSDone;
8132   bool                                 GSDone;
8133   bool                                 SOLDone;
8134   bool                                 CLDone;
8135   bool                                 SFDone;
8136   bool                                 TDGDone;
8137   bool                                 URBMDone;
8138   bool                                 SVGDone;
8139   bool                                 GAFSDone;
8140   bool                                 VFEDone;
8141   bool                                 TSGDone;
8142   bool                                 GAFMDone;
8143   bool                                 GAMDone;
8144   bool                                 RSDone;
8145   bool                                 CSDone;
8146   bool                                 SDEDone;
8147   bool                                 RCCFBCCSDone;
8148};
8149
8150static inline __attribute__((always_inline)) void
8151GFX75_INSTDONE_1_pack(__attribute__((unused)) __gen_user_data *data,
8152                      __attribute__((unused)) void * restrict dst,
8153                      __attribute__((unused)) const struct GFX75_INSTDONE_1 * restrict values)
8154{
8155   uint32_t * restrict dw = (uint32_t * restrict) dst;
8156
8157   dw[0] =
8158      __gen_uint(values->PRB0RingEnable, 0, 0) |
8159      __gen_uint(values->VFGDone, 1, 1) |
8160      __gen_uint(values->VSDone, 2, 2) |
8161      __gen_uint(values->HSDone, 3, 3) |
8162      __gen_uint(values->TEDone, 4, 4) |
8163      __gen_uint(values->DSDone, 5, 5) |
8164      __gen_uint(values->GSDone, 6, 6) |
8165      __gen_uint(values->SOLDone, 7, 7) |
8166      __gen_uint(values->CLDone, 8, 8) |
8167      __gen_uint(values->SFDone, 9, 9) |
8168      __gen_uint(values->TDGDone, 12, 12) |
8169      __gen_uint(values->URBMDone, 13, 13) |
8170      __gen_uint(values->SVGDone, 14, 14) |
8171      __gen_uint(values->GAFSDone, 15, 15) |
8172      __gen_uint(values->VFEDone, 16, 16) |
8173      __gen_uint(values->TSGDone, 17, 17) |
8174      __gen_uint(values->GAFMDone, 18, 18) |
8175      __gen_uint(values->GAMDone, 19, 19) |
8176      __gen_uint(values->RSDone, 20, 20) |
8177      __gen_uint(values->CSDone, 21, 21) |
8178      __gen_uint(values->SDEDone, 22, 22) |
8179      __gen_uint(values->RCCFBCCSDone, 23, 23);
8180}
8181
8182#define GFX75_INSTPM_num                  0x20c0
8183#define GFX75_INSTPM_length                    1
8184struct GFX75_INSTPM {
8185   bool                                 _3DStateInstructionDisable;
8186   bool                                 _3DRenderingInstructionDisable;
8187   bool                                 MediaInstructionDisable;
8188   bool                                 CONSTANT_BUFFERAddressOffsetDisable;
8189   bool                                 _3DStateInstructionDisableMask;
8190   bool                                 _3DRenderingInstructionDisableMask;
8191   bool                                 MediaInstructionDisableMask;
8192   bool                                 CONSTANT_BUFFERAddressOffsetDisableMask;
8193};
8194
8195static inline __attribute__((always_inline)) void
8196GFX75_INSTPM_pack(__attribute__((unused)) __gen_user_data *data,
8197                  __attribute__((unused)) void * restrict dst,
8198                  __attribute__((unused)) const struct GFX75_INSTPM * restrict values)
8199{
8200   uint32_t * restrict dw = (uint32_t * restrict) dst;
8201
8202   dw[0] =
8203      __gen_uint(values->_3DStateInstructionDisable, 1, 1) |
8204      __gen_uint(values->_3DRenderingInstructionDisable, 2, 2) |
8205      __gen_uint(values->MediaInstructionDisable, 3, 3) |
8206      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisable, 6, 6) |
8207      __gen_uint(values->_3DStateInstructionDisableMask, 17, 17) |
8208      __gen_uint(values->_3DRenderingInstructionDisableMask, 18, 18) |
8209      __gen_uint(values->MediaInstructionDisableMask, 19, 19) |
8210      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisableMask, 22, 22);
8211}
8212
8213#define GFX75_L3CNTLREG2_num              0xb020
8214#define GFX75_L3CNTLREG2_length                1
8215struct GFX75_L3CNTLREG2 {
8216   bool                                 SLMEnable;
8217   uint32_t                             URBAllocation;
8218   bool                                 URBLowBandwidth;
8219   uint32_t                             ROAllocation;
8220   bool                                 ROLowBandwidth;
8221   uint32_t                             DCAllocation;
8222   bool                                 DCLowBandwidth;
8223};
8224
8225static inline __attribute__((always_inline)) void
8226GFX75_L3CNTLREG2_pack(__attribute__((unused)) __gen_user_data *data,
8227                      __attribute__((unused)) void * restrict dst,
8228                      __attribute__((unused)) const struct GFX75_L3CNTLREG2 * restrict values)
8229{
8230   uint32_t * restrict dw = (uint32_t * restrict) dst;
8231
8232   dw[0] =
8233      __gen_uint(values->SLMEnable, 0, 0) |
8234      __gen_uint(values->URBAllocation, 1, 6) |
8235      __gen_uint(values->URBLowBandwidth, 7, 7) |
8236      __gen_uint(values->ROAllocation, 14, 19) |
8237      __gen_uint(values->ROLowBandwidth, 20, 20) |
8238      __gen_uint(values->DCAllocation, 21, 26) |
8239      __gen_uint(values->DCLowBandwidth, 27, 27);
8240}
8241
8242#define GFX75_L3CNTLREG3_num              0xb024
8243#define GFX75_L3CNTLREG3_length                1
8244struct GFX75_L3CNTLREG3 {
8245   uint32_t                             ISAllocation;
8246   bool                                 ISLowBandwidth;
8247   uint32_t                             CAllocation;
8248   bool                                 CLowBandwidth;
8249   uint32_t                             TAllocation;
8250   bool                                 TLowBandwidth;
8251};
8252
8253static inline __attribute__((always_inline)) void
8254GFX75_L3CNTLREG3_pack(__attribute__((unused)) __gen_user_data *data,
8255                      __attribute__((unused)) void * restrict dst,
8256                      __attribute__((unused)) const struct GFX75_L3CNTLREG3 * restrict values)
8257{
8258   uint32_t * restrict dw = (uint32_t * restrict) dst;
8259
8260   dw[0] =
8261      __gen_uint(values->ISAllocation, 1, 6) |
8262      __gen_uint(values->ISLowBandwidth, 7, 7) |
8263      __gen_uint(values->CAllocation, 8, 13) |
8264      __gen_uint(values->CLowBandwidth, 14, 14) |
8265      __gen_uint(values->TAllocation, 15, 20) |
8266      __gen_uint(values->TLowBandwidth, 21, 21);
8267}
8268
8269#define GFX75_L3SQCREG1_num               0xb010
8270#define GFX75_L3SQCREG1_length                 1
8271struct GFX75_L3SQCREG1 {
8272   uint32_t                             L3SQGeneralPriorityCreditInitialization;
8273#define SQGPCI_DEFAULT                           12
8274   uint32_t                             L3SQHighPriorityCreditInitialization;
8275#define SQHPCI_DEFAULT                           4
8276   bool                                 ConvertDC_UC;
8277   bool                                 ConvertIS_UC;
8278   bool                                 ConvertC_UC;
8279   bool                                 ConvertT_UC;
8280};
8281
8282static inline __attribute__((always_inline)) void
8283GFX75_L3SQCREG1_pack(__attribute__((unused)) __gen_user_data *data,
8284                     __attribute__((unused)) void * restrict dst,
8285                     __attribute__((unused)) const struct GFX75_L3SQCREG1 * restrict values)
8286{
8287   uint32_t * restrict dw = (uint32_t * restrict) dst;
8288
8289   dw[0] =
8290      __gen_uint(values->L3SQGeneralPriorityCreditInitialization, 19, 23) |
8291      __gen_uint(values->L3SQHighPriorityCreditInitialization, 14, 18) |
8292      __gen_uint(values->ConvertDC_UC, 24, 24) |
8293      __gen_uint(values->ConvertIS_UC, 25, 25) |
8294      __gen_uint(values->ConvertC_UC, 26, 26) |
8295      __gen_uint(values->ConvertT_UC, 27, 27);
8296}
8297
8298#define GFX75_PERFCNT1_num                0x91b8
8299#define GFX75_PERFCNT1_length                  2
8300struct GFX75_PERFCNT1 {
8301   uint64_t                             Value;
8302   uint32_t                             EventSelection;
8303   bool                                 CounterClear;
8304   bool                                 EdgeDetect;
8305   bool                                 OverflowEnable;
8306   bool                                 CounterEnable;
8307};
8308
8309static inline __attribute__((always_inline)) void
8310GFX75_PERFCNT1_pack(__attribute__((unused)) __gen_user_data *data,
8311                    __attribute__((unused)) void * restrict dst,
8312                    __attribute__((unused)) const struct GFX75_PERFCNT1 * restrict values)
8313{
8314   uint32_t * restrict dw = (uint32_t * restrict) dst;
8315
8316   const uint64_t v0 =
8317      __gen_uint(values->Value, 0, 43) |
8318      __gen_uint(values->EventSelection, 52, 59) |
8319      __gen_uint(values->CounterClear, 60, 60) |
8320      __gen_uint(values->EdgeDetect, 61, 61) |
8321      __gen_uint(values->OverflowEnable, 62, 62) |
8322      __gen_uint(values->CounterEnable, 63, 63);
8323   dw[0] = v0;
8324   dw[1] = v0 >> 32;
8325}
8326
8327#define GFX75_PERFCNT2_num                0x91c0
8328#define GFX75_PERFCNT2_length                  2
8329struct GFX75_PERFCNT2 {
8330   uint64_t                             Value;
8331   uint32_t                             EventSelection;
8332   bool                                 CounterClear;
8333   bool                                 EdgeDetect;
8334   bool                                 OverflowEnable;
8335   bool                                 CounterEnable;
8336};
8337
8338static inline __attribute__((always_inline)) void
8339GFX75_PERFCNT2_pack(__attribute__((unused)) __gen_user_data *data,
8340                    __attribute__((unused)) void * restrict dst,
8341                    __attribute__((unused)) const struct GFX75_PERFCNT2 * restrict values)
8342{
8343   uint32_t * restrict dw = (uint32_t * restrict) dst;
8344
8345   const uint64_t v0 =
8346      __gen_uint(values->Value, 0, 43) |
8347      __gen_uint(values->EventSelection, 52, 59) |
8348      __gen_uint(values->CounterClear, 60, 60) |
8349      __gen_uint(values->EdgeDetect, 61, 61) |
8350      __gen_uint(values->OverflowEnable, 62, 62) |
8351      __gen_uint(values->CounterEnable, 63, 63);
8352   dw[0] = v0;
8353   dw[1] = v0 >> 32;
8354}
8355
8356#define GFX75_PS_INVOCATION_COUNT_num     0x2348
8357#define GFX75_PS_INVOCATION_COUNT_length       2
8358struct GFX75_PS_INVOCATION_COUNT {
8359   uint64_t                             PSInvocationCountReport;
8360};
8361
8362static inline __attribute__((always_inline)) void
8363GFX75_PS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
8364                               __attribute__((unused)) void * restrict dst,
8365                               __attribute__((unused)) const struct GFX75_PS_INVOCATION_COUNT * restrict values)
8366{
8367   uint32_t * restrict dw = (uint32_t * restrict) dst;
8368
8369   const uint64_t v0 =
8370      __gen_uint(values->PSInvocationCountReport, 0, 63);
8371   dw[0] = v0;
8372   dw[1] = v0 >> 32;
8373}
8374
8375#define GFX75_RCS_FAULT_REG_num           0x4094
8376#define GFX75_RCS_FAULT_REG_length             1
8377struct GFX75_RCS_FAULT_REG {
8378   bool                                 ValidBit;
8379   uint32_t                             FaultType;
8380#define PageFault                                0
8381#define InvalidPDFault                           1
8382#define UnloadedPDFault                          2
8383#define InvalidandUnloadedPDfault                3
8384   uint32_t                             SRCIDofFault;
8385   uint32_t                             GTTSEL;
8386#define PPGTT                                    0
8387#define GGTT                                     1
8388   __gen_address_type                   VirtualAddressofFault;
8389};
8390
8391static inline __attribute__((always_inline)) void
8392GFX75_RCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
8393                         __attribute__((unused)) void * restrict dst,
8394                         __attribute__((unused)) const struct GFX75_RCS_FAULT_REG * restrict values)
8395{
8396   uint32_t * restrict dw = (uint32_t * restrict) dst;
8397
8398   const uint32_t v0 =
8399      __gen_uint(values->ValidBit, 0, 0) |
8400      __gen_uint(values->FaultType, 1, 2) |
8401      __gen_uint(values->SRCIDofFault, 3, 10) |
8402      __gen_uint(values->GTTSEL, 11, 11);
8403   dw[0] = __gen_address(data, &dw[0], values->VirtualAddressofFault, v0, 12, 31);
8404}
8405
8406#define GFX75_RCS_RING_BUFFER_CTL_num     0x203c
8407#define GFX75_RCS_RING_BUFFER_CTL_length       1
8408struct GFX75_RCS_RING_BUFFER_CTL {
8409   bool                                 RingBufferEnable;
8410   uint32_t                             AutomaticReportHeadPointer;
8411#define MI_AUTOREPORT_OFF                        0
8412#define MI_AUTOREPORT_64KBMI_AUTOREPORT_4KB      1
8413#define MI_AUTOREPORT_128KB                      3
8414   bool                                 SemaphoreWait;
8415   bool                                 RBWait;
8416   uint32_t                             BufferLengthinpages1;
8417};
8418
8419static inline __attribute__((always_inline)) void
8420GFX75_RCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
8421                               __attribute__((unused)) void * restrict dst,
8422                               __attribute__((unused)) const struct GFX75_RCS_RING_BUFFER_CTL * restrict values)
8423{
8424   uint32_t * restrict dw = (uint32_t * restrict) dst;
8425
8426   dw[0] =
8427      __gen_uint(values->RingBufferEnable, 0, 0) |
8428      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
8429      __gen_uint(values->SemaphoreWait, 10, 10) |
8430      __gen_uint(values->RBWait, 11, 11) |
8431      __gen_uint(values->BufferLengthinpages1, 12, 20);
8432}
8433
8434#define GFX75_ROW_INSTDONE_num            0xe164
8435#define GFX75_ROW_INSTDONE_length              1
8436struct GFX75_ROW_INSTDONE {
8437   bool                                 BCDone;
8438   bool                                 PSDDone;
8439   bool                                 DCDone;
8440   bool                                 DAPRDone;
8441   bool                                 TDLDone;
8442   bool                                 GWDone;
8443   bool                                 ICDone;
8444   bool                                 MA0Done;
8445   bool                                 EU00DoneSS0;
8446   bool                                 EU01DoneSS0;
8447   bool                                 EU02DoneSS0;
8448   bool                                 EU03DoneSS0;
8449   bool                                 EU04DoneSS0;
8450   bool                                 EU10DoneSS0;
8451   bool                                 EU11DoneSS0;
8452   bool                                 EU12DoneSS0;
8453   bool                                 EU13DoneSS0;
8454   bool                                 EU14DoneSS0;
8455   bool                                 MA1DoneSS0;
8456};
8457
8458static inline __attribute__((always_inline)) void
8459GFX75_ROW_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
8460                        __attribute__((unused)) void * restrict dst,
8461                        __attribute__((unused)) const struct GFX75_ROW_INSTDONE * restrict values)
8462{
8463   uint32_t * restrict dw = (uint32_t * restrict) dst;
8464
8465   dw[0] =
8466      __gen_uint(values->BCDone, 0, 0) |
8467      __gen_uint(values->PSDDone, 1, 1) |
8468      __gen_uint(values->DCDone, 2, 2) |
8469      __gen_uint(values->DAPRDone, 3, 3) |
8470      __gen_uint(values->TDLDone, 6, 6) |
8471      __gen_uint(values->GWDone, 8, 8) |
8472      __gen_uint(values->ICDone, 12, 12) |
8473      __gen_uint(values->MA0Done, 15, 15) |
8474      __gen_uint(values->EU00DoneSS0, 16, 16) |
8475      __gen_uint(values->EU01DoneSS0, 17, 17) |
8476      __gen_uint(values->EU02DoneSS0, 18, 18) |
8477      __gen_uint(values->EU03DoneSS0, 19, 19) |
8478      __gen_uint(values->EU04DoneSS0, 20, 20) |
8479      __gen_uint(values->EU10DoneSS0, 21, 21) |
8480      __gen_uint(values->EU11DoneSS0, 22, 22) |
8481      __gen_uint(values->EU12DoneSS0, 23, 23) |
8482      __gen_uint(values->EU13DoneSS0, 24, 24) |
8483      __gen_uint(values->EU14DoneSS0, 25, 25) |
8484      __gen_uint(values->MA1DoneSS0, 26, 26);
8485}
8486
8487#define GFX75_RPSTAT1_num                 0xa01c
8488#define GFX75_RPSTAT1_length                   1
8489struct GFX75_RPSTAT1 {
8490   uint32_t                             PreviousGTFrequency;
8491   uint32_t                             CurrentGTFrequency;
8492};
8493
8494static inline __attribute__((always_inline)) void
8495GFX75_RPSTAT1_pack(__attribute__((unused)) __gen_user_data *data,
8496                   __attribute__((unused)) void * restrict dst,
8497                   __attribute__((unused)) const struct GFX75_RPSTAT1 * restrict values)
8498{
8499   uint32_t * restrict dw = (uint32_t * restrict) dst;
8500
8501   dw[0] =
8502      __gen_uint(values->PreviousGTFrequency, 0, 6) |
8503      __gen_uint(values->CurrentGTFrequency, 7, 14);
8504}
8505
8506#define GFX75_SAMPLER_INSTDONE_num        0xe160
8507#define GFX75_SAMPLER_INSTDONE_length          1
8508struct GFX75_SAMPLER_INSTDONE {
8509   bool                                 IMEDone;
8510   bool                                 PL0Done;
8511   bool                                 SO0Done;
8512   bool                                 DG0Done;
8513   bool                                 FT0Done;
8514   bool                                 DM0Done;
8515   bool                                 SCDone;
8516   bool                                 FL0Done;
8517   bool                                 QCDone;
8518   bool                                 SVSMDone;
8519   bool                                 SI0Done;
8520   bool                                 MT0Done;
8521   bool                                 AVSDone;
8522   bool                                 IEFDone;
8523   bool                                 CREDone;
8524   bool                                 SVSMARB3;
8525   bool                                 SVSMARB2;
8526   bool                                 SVSMARB1;
8527   bool                                 SVSMAdapter;
8528   bool                                 FT1Done;
8529   bool                                 DM1Done;
8530   bool                                 MT1Done;
8531};
8532
8533static inline __attribute__((always_inline)) void
8534GFX75_SAMPLER_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
8535                            __attribute__((unused)) void * restrict dst,
8536                            __attribute__((unused)) const struct GFX75_SAMPLER_INSTDONE * restrict values)
8537{
8538   uint32_t * restrict dw = (uint32_t * restrict) dst;
8539
8540   dw[0] =
8541      __gen_uint(values->IMEDone, 0, 0) |
8542      __gen_uint(values->PL0Done, 1, 1) |
8543      __gen_uint(values->SO0Done, 2, 2) |
8544      __gen_uint(values->DG0Done, 3, 3) |
8545      __gen_uint(values->FT0Done, 4, 4) |
8546      __gen_uint(values->DM0Done, 5, 5) |
8547      __gen_uint(values->SCDone, 6, 6) |
8548      __gen_uint(values->FL0Done, 7, 7) |
8549      __gen_uint(values->QCDone, 8, 8) |
8550      __gen_uint(values->SVSMDone, 9, 9) |
8551      __gen_uint(values->SI0Done, 10, 10) |
8552      __gen_uint(values->MT0Done, 11, 11) |
8553      __gen_uint(values->AVSDone, 12, 12) |
8554      __gen_uint(values->IEFDone, 13, 13) |
8555      __gen_uint(values->CREDone, 14, 14) |
8556      __gen_uint(values->SVSMARB3, 15, 15) |
8557      __gen_uint(values->SVSMARB2, 16, 16) |
8558      __gen_uint(values->SVSMARB1, 17, 17) |
8559      __gen_uint(values->SVSMAdapter, 18, 18) |
8560      __gen_uint(values->FT1Done, 19, 19) |
8561      __gen_uint(values->DM1Done, 20, 20) |
8562      __gen_uint(values->MT1Done, 21, 21);
8563}
8564
8565#define GFX75_SCRATCH1_num                0xb038
8566#define GFX75_SCRATCH1_length                  1
8567struct GFX75_SCRATCH1 {
8568   uint32_t                             L3AtomicDisable;
8569};
8570
8571static inline __attribute__((always_inline)) void
8572GFX75_SCRATCH1_pack(__attribute__((unused)) __gen_user_data *data,
8573                    __attribute__((unused)) void * restrict dst,
8574                    __attribute__((unused)) const struct GFX75_SCRATCH1 * restrict values)
8575{
8576   uint32_t * restrict dw = (uint32_t * restrict) dst;
8577
8578   dw[0] =
8579      __gen_uint(values->L3AtomicDisable, 27, 27);
8580}
8581
8582#define GFX75_SC_INSTDONE_num             0x7100
8583#define GFX75_SC_INSTDONE_length               1
8584struct GFX75_SC_INSTDONE {
8585   bool                                 SVLDone;
8586   bool                                 WMFEDone;
8587   bool                                 WMBEDone;
8588   bool                                 HIZDone;
8589   bool                                 STCDone;
8590   bool                                 IZDone;
8591   bool                                 SBEDone;
8592   bool                                 RCZDone;
8593   bool                                 RCCDone;
8594   bool                                 RCPBEDone;
8595   bool                                 RCPFEDone;
8596   bool                                 DAPBDone;
8597   bool                                 DAPRBEDone;
8598   bool                                 SARBDone;
8599};
8600
8601static inline __attribute__((always_inline)) void
8602GFX75_SC_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
8603                       __attribute__((unused)) void * restrict dst,
8604                       __attribute__((unused)) const struct GFX75_SC_INSTDONE * restrict values)
8605{
8606   uint32_t * restrict dw = (uint32_t * restrict) dst;
8607
8608   dw[0] =
8609      __gen_uint(values->SVLDone, 0, 0) |
8610      __gen_uint(values->WMFEDone, 1, 1) |
8611      __gen_uint(values->WMBEDone, 2, 2) |
8612      __gen_uint(values->HIZDone, 3, 3) |
8613      __gen_uint(values->STCDone, 4, 4) |
8614      __gen_uint(values->IZDone, 5, 5) |
8615      __gen_uint(values->SBEDone, 6, 6) |
8616      __gen_uint(values->RCZDone, 8, 8) |
8617      __gen_uint(values->RCCDone, 9, 9) |
8618      __gen_uint(values->RCPBEDone, 10, 10) |
8619      __gen_uint(values->RCPFEDone, 11, 11) |
8620      __gen_uint(values->DAPBDone, 12, 12) |
8621      __gen_uint(values->DAPRBEDone, 13, 13) |
8622      __gen_uint(values->SARBDone, 15, 15);
8623}
8624
8625#define GFX75_SO_NUM_PRIMS_WRITTEN0_num   0x5200
8626#define GFX75_SO_NUM_PRIMS_WRITTEN0_length      2
8627struct GFX75_SO_NUM_PRIMS_WRITTEN0 {
8628   uint64_t                             NumPrimsWrittenCount;
8629};
8630
8631static inline __attribute__((always_inline)) void
8632GFX75_SO_NUM_PRIMS_WRITTEN0_pack(__attribute__((unused)) __gen_user_data *data,
8633                                 __attribute__((unused)) void * restrict dst,
8634                                 __attribute__((unused)) const struct GFX75_SO_NUM_PRIMS_WRITTEN0 * restrict values)
8635{
8636   uint32_t * restrict dw = (uint32_t * restrict) dst;
8637
8638   const uint64_t v0 =
8639      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
8640   dw[0] = v0;
8641   dw[1] = v0 >> 32;
8642}
8643
8644#define GFX75_SO_NUM_PRIMS_WRITTEN1_num   0x5208
8645#define GFX75_SO_NUM_PRIMS_WRITTEN1_length      2
8646struct GFX75_SO_NUM_PRIMS_WRITTEN1 {
8647   uint64_t                             NumPrimsWrittenCount;
8648};
8649
8650static inline __attribute__((always_inline)) void
8651GFX75_SO_NUM_PRIMS_WRITTEN1_pack(__attribute__((unused)) __gen_user_data *data,
8652                                 __attribute__((unused)) void * restrict dst,
8653                                 __attribute__((unused)) const struct GFX75_SO_NUM_PRIMS_WRITTEN1 * restrict values)
8654{
8655   uint32_t * restrict dw = (uint32_t * restrict) dst;
8656
8657   const uint64_t v0 =
8658      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
8659   dw[0] = v0;
8660   dw[1] = v0 >> 32;
8661}
8662
8663#define GFX75_SO_NUM_PRIMS_WRITTEN2_num   0x5210
8664#define GFX75_SO_NUM_PRIMS_WRITTEN2_length      2
8665struct GFX75_SO_NUM_PRIMS_WRITTEN2 {
8666   uint64_t                             NumPrimsWrittenCount;
8667};
8668
8669static inline __attribute__((always_inline)) void
8670GFX75_SO_NUM_PRIMS_WRITTEN2_pack(__attribute__((unused)) __gen_user_data *data,
8671                                 __attribute__((unused)) void * restrict dst,
8672                                 __attribute__((unused)) const struct GFX75_SO_NUM_PRIMS_WRITTEN2 * restrict values)
8673{
8674   uint32_t * restrict dw = (uint32_t * restrict) dst;
8675
8676   const uint64_t v0 =
8677      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
8678   dw[0] = v0;
8679   dw[1] = v0 >> 32;
8680}
8681
8682#define GFX75_SO_NUM_PRIMS_WRITTEN3_num   0x5218
8683#define GFX75_SO_NUM_PRIMS_WRITTEN3_length      2
8684struct GFX75_SO_NUM_PRIMS_WRITTEN3 {
8685   uint64_t                             NumPrimsWrittenCount;
8686};
8687
8688static inline __attribute__((always_inline)) void
8689GFX75_SO_NUM_PRIMS_WRITTEN3_pack(__attribute__((unused)) __gen_user_data *data,
8690                                 __attribute__((unused)) void * restrict dst,
8691                                 __attribute__((unused)) const struct GFX75_SO_NUM_PRIMS_WRITTEN3 * restrict values)
8692{
8693   uint32_t * restrict dw = (uint32_t * restrict) dst;
8694
8695   const uint64_t v0 =
8696      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
8697   dw[0] = v0;
8698   dw[1] = v0 >> 32;
8699}
8700
8701#define GFX75_SO_PRIM_STORAGE_NEEDED0_num 0x5240
8702#define GFX75_SO_PRIM_STORAGE_NEEDED0_length      2
8703struct GFX75_SO_PRIM_STORAGE_NEEDED0 {
8704   uint64_t                             PrimStorageNeededCount;
8705};
8706
8707static inline __attribute__((always_inline)) void
8708GFX75_SO_PRIM_STORAGE_NEEDED0_pack(__attribute__((unused)) __gen_user_data *data,
8709                                   __attribute__((unused)) void * restrict dst,
8710                                   __attribute__((unused)) const struct GFX75_SO_PRIM_STORAGE_NEEDED0 * restrict values)
8711{
8712   uint32_t * restrict dw = (uint32_t * restrict) dst;
8713
8714   const uint64_t v0 =
8715      __gen_uint(values->PrimStorageNeededCount, 0, 63);
8716   dw[0] = v0;
8717   dw[1] = v0 >> 32;
8718}
8719
8720#define GFX75_SO_PRIM_STORAGE_NEEDED1_num 0x5248
8721#define GFX75_SO_PRIM_STORAGE_NEEDED1_length      2
8722struct GFX75_SO_PRIM_STORAGE_NEEDED1 {
8723   uint64_t                             PrimStorageNeededCount;
8724};
8725
8726static inline __attribute__((always_inline)) void
8727GFX75_SO_PRIM_STORAGE_NEEDED1_pack(__attribute__((unused)) __gen_user_data *data,
8728                                   __attribute__((unused)) void * restrict dst,
8729                                   __attribute__((unused)) const struct GFX75_SO_PRIM_STORAGE_NEEDED1 * restrict values)
8730{
8731   uint32_t * restrict dw = (uint32_t * restrict) dst;
8732
8733   const uint64_t v0 =
8734      __gen_uint(values->PrimStorageNeededCount, 0, 63);
8735   dw[0] = v0;
8736   dw[1] = v0 >> 32;
8737}
8738
8739#define GFX75_SO_PRIM_STORAGE_NEEDED2_num 0x5250
8740#define GFX75_SO_PRIM_STORAGE_NEEDED2_length      2
8741struct GFX75_SO_PRIM_STORAGE_NEEDED2 {
8742   uint64_t                             PrimStorageNeededCount;
8743};
8744
8745static inline __attribute__((always_inline)) void
8746GFX75_SO_PRIM_STORAGE_NEEDED2_pack(__attribute__((unused)) __gen_user_data *data,
8747                                   __attribute__((unused)) void * restrict dst,
8748                                   __attribute__((unused)) const struct GFX75_SO_PRIM_STORAGE_NEEDED2 * restrict values)
8749{
8750   uint32_t * restrict dw = (uint32_t * restrict) dst;
8751
8752   const uint64_t v0 =
8753      __gen_uint(values->PrimStorageNeededCount, 0, 63);
8754   dw[0] = v0;
8755   dw[1] = v0 >> 32;
8756}
8757
8758#define GFX75_SO_PRIM_STORAGE_NEEDED3_num 0x5258
8759#define GFX75_SO_PRIM_STORAGE_NEEDED3_length      2
8760struct GFX75_SO_PRIM_STORAGE_NEEDED3 {
8761   uint64_t                             PrimStorageNeededCount;
8762};
8763
8764static inline __attribute__((always_inline)) void
8765GFX75_SO_PRIM_STORAGE_NEEDED3_pack(__attribute__((unused)) __gen_user_data *data,
8766                                   __attribute__((unused)) void * restrict dst,
8767                                   __attribute__((unused)) const struct GFX75_SO_PRIM_STORAGE_NEEDED3 * restrict values)
8768{
8769   uint32_t * restrict dw = (uint32_t * restrict) dst;
8770
8771   const uint64_t v0 =
8772      __gen_uint(values->PrimStorageNeededCount, 0, 63);
8773   dw[0] = v0;
8774   dw[1] = v0 >> 32;
8775}
8776
8777#define GFX75_SO_WRITE_OFFSET0_num        0x5280
8778#define GFX75_SO_WRITE_OFFSET0_length          1
8779struct GFX75_SO_WRITE_OFFSET0 {
8780   uint64_t                             WriteOffset;
8781};
8782
8783static inline __attribute__((always_inline)) void
8784GFX75_SO_WRITE_OFFSET0_pack(__attribute__((unused)) __gen_user_data *data,
8785                            __attribute__((unused)) void * restrict dst,
8786                            __attribute__((unused)) const struct GFX75_SO_WRITE_OFFSET0 * restrict values)
8787{
8788   uint32_t * restrict dw = (uint32_t * restrict) dst;
8789
8790   dw[0] =
8791      __gen_offset(values->WriteOffset, 2, 31);
8792}
8793
8794#define GFX75_SO_WRITE_OFFSET1_num        0x5284
8795#define GFX75_SO_WRITE_OFFSET1_length          1
8796struct GFX75_SO_WRITE_OFFSET1 {
8797   uint64_t                             WriteOffset;
8798};
8799
8800static inline __attribute__((always_inline)) void
8801GFX75_SO_WRITE_OFFSET1_pack(__attribute__((unused)) __gen_user_data *data,
8802                            __attribute__((unused)) void * restrict dst,
8803                            __attribute__((unused)) const struct GFX75_SO_WRITE_OFFSET1 * restrict values)
8804{
8805   uint32_t * restrict dw = (uint32_t * restrict) dst;
8806
8807   dw[0] =
8808      __gen_offset(values->WriteOffset, 2, 31);
8809}
8810
8811#define GFX75_SO_WRITE_OFFSET2_num        0x5288
8812#define GFX75_SO_WRITE_OFFSET2_length          1
8813struct GFX75_SO_WRITE_OFFSET2 {
8814   uint64_t                             WriteOffset;
8815};
8816
8817static inline __attribute__((always_inline)) void
8818GFX75_SO_WRITE_OFFSET2_pack(__attribute__((unused)) __gen_user_data *data,
8819                            __attribute__((unused)) void * restrict dst,
8820                            __attribute__((unused)) const struct GFX75_SO_WRITE_OFFSET2 * restrict values)
8821{
8822   uint32_t * restrict dw = (uint32_t * restrict) dst;
8823
8824   dw[0] =
8825      __gen_offset(values->WriteOffset, 2, 31);
8826}
8827
8828#define GFX75_SO_WRITE_OFFSET3_num        0x528c
8829#define GFX75_SO_WRITE_OFFSET3_length          1
8830struct GFX75_SO_WRITE_OFFSET3 {
8831   uint64_t                             WriteOffset;
8832};
8833
8834static inline __attribute__((always_inline)) void
8835GFX75_SO_WRITE_OFFSET3_pack(__attribute__((unused)) __gen_user_data *data,
8836                            __attribute__((unused)) void * restrict dst,
8837                            __attribute__((unused)) const struct GFX75_SO_WRITE_OFFSET3 * restrict values)
8838{
8839   uint32_t * restrict dw = (uint32_t * restrict) dst;
8840
8841   dw[0] =
8842      __gen_offset(values->WriteOffset, 2, 31);
8843}
8844
8845#define GFX75_VCS_FAULT_REG_num           0x4194
8846#define GFX75_VCS_FAULT_REG_length             1
8847struct GFX75_VCS_FAULT_REG {
8848   bool                                 ValidBit;
8849   uint32_t                             FaultType;
8850#define PageFault                                0
8851#define InvalidPDFault                           1
8852#define UnloadedPDFault                          2
8853#define InvalidandUnloadedPDfault                3
8854   uint32_t                             SRCIDofFault;
8855   uint32_t                             GTTSEL;
8856#define PPGTT                                    0
8857#define GGTT                                     1
8858   __gen_address_type                   VirtualAddressofFault;
8859};
8860
8861static inline __attribute__((always_inline)) void
8862GFX75_VCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
8863                         __attribute__((unused)) void * restrict dst,
8864                         __attribute__((unused)) const struct GFX75_VCS_FAULT_REG * restrict values)
8865{
8866   uint32_t * restrict dw = (uint32_t * restrict) dst;
8867
8868   const uint32_t v0 =
8869      __gen_uint(values->ValidBit, 0, 0) |
8870      __gen_uint(values->FaultType, 1, 2) |
8871      __gen_uint(values->SRCIDofFault, 3, 10) |
8872      __gen_uint(values->GTTSEL, 11, 11);
8873   dw[0] = __gen_address(data, &dw[0], values->VirtualAddressofFault, v0, 12, 31);
8874}
8875
8876#define GFX75_VCS_INSTDONE_num            0x1206c
8877#define GFX75_VCS_INSTDONE_length              1
8878struct GFX75_VCS_INSTDONE {
8879   bool                                 RingEnable;
8880   uint32_t                             USBDone;
8881   uint32_t                             QRCDone;
8882   uint32_t                             SECDone;
8883   uint32_t                             MPCDone;
8884   uint32_t                             VFTDone;
8885   uint32_t                             BSPDone;
8886   uint32_t                             VLFDone;
8887   uint32_t                             VOPDone;
8888   uint32_t                             VMCDone;
8889   uint32_t                             VIPDone;
8890   uint32_t                             VITDone;
8891   uint32_t                             VDSDone;
8892   uint32_t                             VMXDone;
8893   uint32_t                             VCPDone;
8894   uint32_t                             VCDDone;
8895   uint32_t                             VADDone;
8896   uint32_t                             VMDDone;
8897   uint32_t                             VISDone;
8898   uint32_t                             VACDone;
8899   uint32_t                             VAMDone;
8900   uint32_t                             JPGDone;
8901   uint32_t                             VBPDone;
8902   uint32_t                             VHRDone;
8903   uint32_t                             VCIDone;
8904   uint32_t                             VCRDone;
8905   uint32_t                             VINDone;
8906   uint32_t                             VPRDone;
8907   uint32_t                             VTQDone;
8908   uint32_t                             Reserved;
8909   uint32_t                             VCSDone;
8910   uint32_t                             GACDone;
8911};
8912
8913static inline __attribute__((always_inline)) void
8914GFX75_VCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
8915                        __attribute__((unused)) void * restrict dst,
8916                        __attribute__((unused)) const struct GFX75_VCS_INSTDONE * restrict values)
8917{
8918   uint32_t * restrict dw = (uint32_t * restrict) dst;
8919
8920   dw[0] =
8921      __gen_uint(values->RingEnable, 0, 0) |
8922      __gen_uint(values->USBDone, 1, 1) |
8923      __gen_uint(values->QRCDone, 2, 2) |
8924      __gen_uint(values->SECDone, 3, 3) |
8925      __gen_uint(values->MPCDone, 4, 4) |
8926      __gen_uint(values->VFTDone, 5, 5) |
8927      __gen_uint(values->BSPDone, 6, 6) |
8928      __gen_uint(values->VLFDone, 7, 7) |
8929      __gen_uint(values->VOPDone, 8, 8) |
8930      __gen_uint(values->VMCDone, 9, 9) |
8931      __gen_uint(values->VIPDone, 10, 10) |
8932      __gen_uint(values->VITDone, 11, 11) |
8933      __gen_uint(values->VDSDone, 12, 12) |
8934      __gen_uint(values->VMXDone, 13, 13) |
8935      __gen_uint(values->VCPDone, 14, 14) |
8936      __gen_uint(values->VCDDone, 15, 15) |
8937      __gen_uint(values->VADDone, 16, 16) |
8938      __gen_uint(values->VMDDone, 17, 17) |
8939      __gen_uint(values->VISDone, 18, 18) |
8940      __gen_uint(values->VACDone, 19, 19) |
8941      __gen_uint(values->VAMDone, 20, 20) |
8942      __gen_uint(values->JPGDone, 21, 21) |
8943      __gen_uint(values->VBPDone, 22, 22) |
8944      __gen_uint(values->VHRDone, 23, 23) |
8945      __gen_uint(values->VCIDone, 24, 24) |
8946      __gen_uint(values->VCRDone, 25, 25) |
8947      __gen_uint(values->VINDone, 26, 26) |
8948      __gen_uint(values->VPRDone, 27, 27) |
8949      __gen_uint(values->VTQDone, 28, 28) |
8950      __gen_uint(values->Reserved, 29, 29) |
8951      __gen_uint(values->VCSDone, 30, 30) |
8952      __gen_uint(values->GACDone, 31, 31);
8953}
8954
8955#define GFX75_VCS_RING_BUFFER_CTL_num     0x1203c
8956#define GFX75_VCS_RING_BUFFER_CTL_length       1
8957struct GFX75_VCS_RING_BUFFER_CTL {
8958   bool                                 RingBufferEnable;
8959   uint32_t                             AutomaticReportHeadPointer;
8960#define MI_AUTOREPORT_OFF                        0
8961#define MI_AUTOREPORT_64KB                       1
8962#define MI_AUTOREPORT_4KB                        2
8963#define MI_AUTOREPORT_128KB                      3
8964   bool                                 DisableRegisterAccesses;
8965   bool                                 SemaphoreWait;
8966   bool                                 RBWait;
8967   uint32_t                             BufferLengthinpages1;
8968};
8969
8970static inline __attribute__((always_inline)) void
8971GFX75_VCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
8972                               __attribute__((unused)) void * restrict dst,
8973                               __attribute__((unused)) const struct GFX75_VCS_RING_BUFFER_CTL * restrict values)
8974{
8975   uint32_t * restrict dw = (uint32_t * restrict) dst;
8976
8977   dw[0] =
8978      __gen_uint(values->RingBufferEnable, 0, 0) |
8979      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
8980      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
8981      __gen_uint(values->SemaphoreWait, 10, 10) |
8982      __gen_uint(values->RBWait, 11, 11) |
8983      __gen_uint(values->BufferLengthinpages1, 12, 20);
8984}
8985
8986#define GFX75_VECS_FAULT_REG_num          0x4394
8987#define GFX75_VECS_FAULT_REG_length            1
8988struct GFX75_VECS_FAULT_REG {
8989   bool                                 ValidBit;
8990   uint32_t                             FaultType;
8991#define PageFault                                0
8992#define InvalidPDFault                           1
8993#define UnloadedPDFault                          2
8994#define InvalidandUnloadedPDfault                3
8995   uint32_t                             SRCIDofFault;
8996   uint32_t                             GTTSEL;
8997#define PPGTT                                    0
8998#define GGTT                                     1
8999   __gen_address_type                   VirtualAddressofFault;
9000};
9001
9002static inline __attribute__((always_inline)) void
9003GFX75_VECS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
9004                          __attribute__((unused)) void * restrict dst,
9005                          __attribute__((unused)) const struct GFX75_VECS_FAULT_REG * restrict values)
9006{
9007   uint32_t * restrict dw = (uint32_t * restrict) dst;
9008
9009   const uint32_t v0 =
9010      __gen_uint(values->ValidBit, 0, 0) |
9011      __gen_uint(values->FaultType, 1, 2) |
9012      __gen_uint(values->SRCIDofFault, 3, 10) |
9013      __gen_uint(values->GTTSEL, 11, 11);
9014   dw[0] = __gen_address(data, &dw[0], values->VirtualAddressofFault, v0, 12, 31);
9015}
9016
9017#define GFX75_VECS_INSTDONE_num           0x1a06c
9018#define GFX75_VECS_INSTDONE_length             1
9019struct GFX75_VECS_INSTDONE {
9020   bool                                 RingEnable;
9021   uint32_t                             VECSDone;
9022   uint32_t                             GAMDone;
9023};
9024
9025static inline __attribute__((always_inline)) void
9026GFX75_VECS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
9027                         __attribute__((unused)) void * restrict dst,
9028                         __attribute__((unused)) const struct GFX75_VECS_INSTDONE * restrict values)
9029{
9030   uint32_t * restrict dw = (uint32_t * restrict) dst;
9031
9032   dw[0] =
9033      __gen_uint(values->RingEnable, 0, 0) |
9034      __gen_uint(values->VECSDone, 30, 30) |
9035      __gen_uint(values->GAMDone, 31, 31);
9036}
9037
9038#define GFX75_VECS_RING_BUFFER_CTL_num    0x1a03c
9039#define GFX75_VECS_RING_BUFFER_CTL_length      1
9040struct GFX75_VECS_RING_BUFFER_CTL {
9041   bool                                 RingBufferEnable;
9042   uint32_t                             AutomaticReportHeadPointer;
9043#define MI_AUTOREPORT_OFF                        0
9044#define MI_AUTOREPORT_64KB                       1
9045#define MI_AUTOREPORT_4KB                        2
9046#define MI_AUTOREPORT_128KB                      3
9047   bool                                 DisableRegisterAccesses;
9048   bool                                 SemaphoreWait;
9049   bool                                 RBWait;
9050   uint32_t                             BufferLengthinpages1;
9051};
9052
9053static inline __attribute__((always_inline)) void
9054GFX75_VECS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
9055                                __attribute__((unused)) void * restrict dst,
9056                                __attribute__((unused)) const struct GFX75_VECS_RING_BUFFER_CTL * restrict values)
9057{
9058   uint32_t * restrict dw = (uint32_t * restrict) dst;
9059
9060   dw[0] =
9061      __gen_uint(values->RingBufferEnable, 0, 0) |
9062      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
9063      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
9064      __gen_uint(values->SemaphoreWait, 10, 10) |
9065      __gen_uint(values->RBWait, 11, 11) |
9066      __gen_uint(values->BufferLengthinpages1, 12, 20);
9067}
9068
9069#define GFX75_VS_INVOCATION_COUNT_num     0x2320
9070#define GFX75_VS_INVOCATION_COUNT_length       2
9071struct GFX75_VS_INVOCATION_COUNT {
9072   uint64_t                             VSInvocationCountReport;
9073};
9074
9075static inline __attribute__((always_inline)) void
9076GFX75_VS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
9077                               __attribute__((unused)) void * restrict dst,
9078                               __attribute__((unused)) const struct GFX75_VS_INVOCATION_COUNT * restrict values)
9079{
9080   uint32_t * restrict dw = (uint32_t * restrict) dst;
9081
9082   const uint64_t v0 =
9083      __gen_uint(values->VSInvocationCountReport, 0, 63);
9084   dw[0] = v0;
9085   dw[1] = v0 >> 32;
9086}
9087
9088#endif /* GFX75_PACK_H */
9089