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 ICL.
26 *
27 * This file has been generated, do not hand edit.
28 */
29
30#ifndef GFX11_PACK_H
31#define GFX11_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 GFX11_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 GFX11_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 GFX11_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 GFX11_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 GFX11_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 GFX11_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 GFX11_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_PID                     =      7,
319};
320
321enum GFX11_Atomic_OPCODE {
322   MI_ATOMIC_OP_AND                     =      1,
323   MI_ATOMIC_OP_OR                      =      2,
324   MI_ATOMIC_OP_XOR                     =      3,
325   MI_ATOMIC_OP_MOVE                    =      4,
326   MI_ATOMIC_OP_INC                     =      5,
327   MI_ATOMIC_OP_DEC                     =      6,
328   MI_ATOMIC_OP_ADD                     =      7,
329   MI_ATOMIC_OP_SUB                     =      8,
330   MI_ATOMIC_OP_RSUB                    =      9,
331   MI_ATOMIC_OP_IMAX                    =     10,
332   MI_ATOMIC_OP_IMIN                    =     11,
333   MI_ATOMIC_OP_UMAX                    =     12,
334   MI_ATOMIC_OP_UMIN                    =     13,
335   MI_ATOMIC_OP_CMP_WR                  =     14,
336   MI_ATOMIC_OP_PREDEC                  =     15,
337   MI_ATOMIC_OP_AND8B                   =     33,
338   MI_ATOMIC_OP_OR8B                    =     34,
339   MI_ATOMIC_OP_XOR8B                   =     35,
340   MI_ATOMIC_OP_MOVE8B                  =     36,
341   MI_ATOMIC_OP_INC8B                   =     37,
342   MI_ATOMIC_OP_DEC8B                   =     38,
343   MI_ATOMIC_OP_ADD8B                   =     39,
344   MI_ATOMIC_OP_SUB8B                   =     40,
345   MI_ATOMIC_OP_RSUB8B                  =     41,
346   MI_ATOMIC_OP_IMAX8B                  =     42,
347   MI_ATOMIC_OP_IMIN8B                  =     43,
348   MI_ATOMIC_OP_UMAX8B                  =     44,
349   MI_ATOMIC_OP_UMIN8B                  =     45,
350   MI_ATOMIC_OP_CMP_WR8B                =     46,
351   MI_ATOMIC_OP_PREDEC8B                =     47,
352   MI_ATOMIC_OP_CMP_WR16B               =     78,
353};
354
355enum GFX11_Attribute_Component_Format {
356   ACF_DISABLED                         =      0,
357   ACF_XY                               =      1,
358   ACF_XYZ                              =      2,
359   ACF_XYZW                             =      3,
360};
361
362enum GFX11_COMPONENT_ENABLES {
363   CE_NONE                              =      0,
364   CE_X                                 =      1,
365   CE_Y                                 =      2,
366   CE_XY                                =      3,
367   CE_Z                                 =      4,
368   CE_XZ                                =      5,
369   CE_YZ                                =      6,
370   CE_XYZ                               =      7,
371   CE_W                                 =      8,
372   CE_XW                                =      9,
373   CE_YW                                =     10,
374   CE_XYW                               =     11,
375   CE_ZW                                =     12,
376   CE_XZW                               =     13,
377   CE_YZW                               =     14,
378   CE_XYZW                              =     15,
379};
380
381enum GFX11_ShaderChannelSelect {
382   SCS_ZERO                             =      0,
383   SCS_ONE                              =      1,
384   SCS_RED                              =      4,
385   SCS_GREEN                            =      5,
386   SCS_BLUE                             =      6,
387   SCS_ALPHA                            =      7,
388};
389
390enum GFX11_TextureCoordinateMode {
391   TCM_WRAP                             =      0,
392   TCM_MIRROR                           =      1,
393   TCM_CLAMP                            =      2,
394   TCM_CUBE                             =      3,
395   TCM_CLAMP_BORDER                     =      4,
396   TCM_MIRROR_ONCE                      =      5,
397   TCM_HALF_BORDER                      =      6,
398   TCM_MIRROR_101                       =      7,
399};
400
401enum GFX11_WRAP_SHORTEST_ENABLE {
402   WSE_X                                =      1,
403   WSE_Y                                =      2,
404   WSE_XY                               =      3,
405   WSE_Z                                =      4,
406   WSE_XZ                               =      5,
407   WSE_YZ                               =      6,
408   WSE_XYZ                              =      7,
409   WSE_W                                =      8,
410   WSE_XW                               =      9,
411   WSE_YW                               =     10,
412   WSE_XYW                              =     11,
413   WSE_ZW                               =     12,
414   WSE_XZW                              =     13,
415   WSE_YZW                              =     14,
416   WSE_XYZW                             =     15,
417};
418
419#define GFX11_3DSTATE_CONSTANT_BODY_length     10
420struct GFX11_3DSTATE_CONSTANT_BODY {
421   uint32_t                             ReadLength[4];
422   __gen_address_type                   Buffer[4];
423};
424
425static inline __attribute__((always_inline)) void
426GFX11_3DSTATE_CONSTANT_BODY_pack(__attribute__((unused)) __gen_user_data *data,
427                                 __attribute__((unused)) void * restrict dst,
428                                 __attribute__((unused)) const struct GFX11_3DSTATE_CONSTANT_BODY * restrict values)
429{
430   uint32_t * restrict dw = (uint32_t * restrict) dst;
431
432   dw[0] =
433      __gen_uint(values->ReadLength[0], 0, 15) |
434      __gen_uint(values->ReadLength[1], 16, 31);
435
436   dw[1] =
437      __gen_uint(values->ReadLength[2], 0, 15) |
438      __gen_uint(values->ReadLength[3], 16, 31);
439
440   const uint64_t v2_address =
441      __gen_address(data, &dw[2], values->Buffer[0], 0, 5, 63);
442   dw[2] = v2_address;
443   dw[3] = v2_address >> 32;
444
445   const uint64_t v4_address =
446      __gen_address(data, &dw[4], values->Buffer[1], 0, 5, 63);
447   dw[4] = v4_address;
448   dw[5] = v4_address >> 32;
449
450   const uint64_t v6_address =
451      __gen_address(data, &dw[6], values->Buffer[2], 0, 5, 63);
452   dw[6] = v6_address;
453   dw[7] = v6_address >> 32;
454
455   const uint64_t v8_address =
456      __gen_address(data, &dw[8], values->Buffer[3], 0, 5, 63);
457   dw[8] = v8_address;
458   dw[9] = v8_address >> 32;
459}
460
461#define GFX11_BINDING_TABLE_EDIT_ENTRY_length      1
462struct GFX11_BINDING_TABLE_EDIT_ENTRY {
463   uint64_t                             SurfaceStatePointer;
464   uint32_t                             BindingTableIndex;
465};
466
467static inline __attribute__((always_inline)) void
468GFX11_BINDING_TABLE_EDIT_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
469                                    __attribute__((unused)) void * restrict dst,
470                                    __attribute__((unused)) const struct GFX11_BINDING_TABLE_EDIT_ENTRY * restrict values)
471{
472   uint32_t * restrict dw = (uint32_t * restrict) dst;
473
474   dw[0] =
475      __gen_offset(values->SurfaceStatePointer, 0, 15) |
476      __gen_uint(values->BindingTableIndex, 16, 23);
477}
478
479#define GFX11_BINDING_TABLE_STATE_length       1
480struct GFX11_BINDING_TABLE_STATE {
481   uint64_t                             SurfaceStatePointer;
482};
483
484static inline __attribute__((always_inline)) void
485GFX11_BINDING_TABLE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
486                               __attribute__((unused)) void * restrict dst,
487                               __attribute__((unused)) const struct GFX11_BINDING_TABLE_STATE * restrict values)
488{
489   uint32_t * restrict dw = (uint32_t * restrict) dst;
490
491   dw[0] =
492      __gen_offset(values->SurfaceStatePointer, 6, 31);
493}
494
495#define GFX11_BLEND_STATE_ENTRY_length         2
496struct GFX11_BLEND_STATE_ENTRY {
497   bool                                 WriteDisableBlue;
498   bool                                 WriteDisableGreen;
499   bool                                 WriteDisableRed;
500   bool                                 WriteDisableAlpha;
501   enum GFX11_3D_Color_Buffer_Blend_Function AlphaBlendFunction;
502   enum GFX11_3D_Color_Buffer_Blend_Factor DestinationAlphaBlendFactor;
503   enum GFX11_3D_Color_Buffer_Blend_Factor SourceAlphaBlendFactor;
504   enum GFX11_3D_Color_Buffer_Blend_Function ColorBlendFunction;
505   enum GFX11_3D_Color_Buffer_Blend_Factor DestinationBlendFactor;
506   enum GFX11_3D_Color_Buffer_Blend_Factor SourceBlendFactor;
507   bool                                 ColorBufferBlendEnable;
508   bool                                 PostBlendColorClampEnable;
509   bool                                 PreBlendColorClampEnable;
510   uint32_t                             ColorClampRange;
511#define COLORCLAMP_UNORM                         0
512#define COLORCLAMP_SNORM                         1
513#define COLORCLAMP_RTFORMAT                      2
514   bool                                 PreBlendSourceOnlyClampEnable;
515   enum GFX11_3D_Logic_Op_Function      LogicOpFunction;
516   bool                                 LogicOpEnable;
517};
518
519static inline __attribute__((always_inline)) void
520GFX11_BLEND_STATE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
521                             __attribute__((unused)) void * restrict dst,
522                             __attribute__((unused)) const struct GFX11_BLEND_STATE_ENTRY * restrict values)
523{
524   uint32_t * restrict dw = (uint32_t * restrict) dst;
525
526   dw[0] =
527      __gen_uint(values->WriteDisableBlue, 0, 0) |
528      __gen_uint(values->WriteDisableGreen, 1, 1) |
529      __gen_uint(values->WriteDisableRed, 2, 2) |
530      __gen_uint(values->WriteDisableAlpha, 3, 3) |
531      __gen_uint(values->AlphaBlendFunction, 5, 7) |
532      __gen_uint(values->DestinationAlphaBlendFactor, 8, 12) |
533      __gen_uint(values->SourceAlphaBlendFactor, 13, 17) |
534      __gen_uint(values->ColorBlendFunction, 18, 20) |
535      __gen_uint(values->DestinationBlendFactor, 21, 25) |
536      __gen_uint(values->SourceBlendFactor, 26, 30) |
537      __gen_uint(values->ColorBufferBlendEnable, 31, 31);
538
539   dw[1] =
540      __gen_uint(values->PostBlendColorClampEnable, 0, 0) |
541      __gen_uint(values->PreBlendColorClampEnable, 1, 1) |
542      __gen_uint(values->ColorClampRange, 2, 3) |
543      __gen_uint(values->PreBlendSourceOnlyClampEnable, 4, 4) |
544      __gen_uint(values->LogicOpFunction, 27, 30) |
545      __gen_uint(values->LogicOpEnable, 31, 31);
546}
547
548#define GFX11_BLEND_STATE_length               1
549struct GFX11_BLEND_STATE {
550   uint32_t                             YDitherOffset;
551   uint32_t                             XDitherOffset;
552   bool                                 ColorDitherEnable;
553   enum GFX11_3D_Compare_Function       AlphaTestFunction;
554   bool                                 AlphaTestEnable;
555   bool                                 AlphaToCoverageDitherEnable;
556   bool                                 AlphaToOneEnable;
557   bool                                 IndependentAlphaBlendEnable;
558   bool                                 AlphaToCoverageEnable;
559   /* variable length fields follow */
560};
561
562static inline __attribute__((always_inline)) void
563GFX11_BLEND_STATE_pack(__attribute__((unused)) __gen_user_data *data,
564                       __attribute__((unused)) void * restrict dst,
565                       __attribute__((unused)) const struct GFX11_BLEND_STATE * restrict values)
566{
567   uint32_t * restrict dw = (uint32_t * restrict) dst;
568
569   dw[0] =
570      __gen_uint(values->YDitherOffset, 19, 20) |
571      __gen_uint(values->XDitherOffset, 21, 22) |
572      __gen_uint(values->ColorDitherEnable, 23, 23) |
573      __gen_uint(values->AlphaTestFunction, 24, 26) |
574      __gen_uint(values->AlphaTestEnable, 27, 27) |
575      __gen_uint(values->AlphaToCoverageDitherEnable, 28, 28) |
576      __gen_uint(values->AlphaToOneEnable, 29, 29) |
577      __gen_uint(values->IndependentAlphaBlendEnable, 30, 30) |
578      __gen_uint(values->AlphaToCoverageEnable, 31, 31);
579}
580
581#define GFX11_CC_VIEWPORT_length               2
582struct GFX11_CC_VIEWPORT {
583   float                                MinimumDepth;
584   float                                MaximumDepth;
585};
586
587static inline __attribute__((always_inline)) void
588GFX11_CC_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
589                       __attribute__((unused)) void * restrict dst,
590                       __attribute__((unused)) const struct GFX11_CC_VIEWPORT * restrict values)
591{
592   uint32_t * restrict dw = (uint32_t * restrict) dst;
593
594   dw[0] =
595      __gen_float(values->MinimumDepth);
596
597   dw[1] =
598      __gen_float(values->MaximumDepth);
599}
600
601#define GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_length      2
602struct GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY {
603   float                                Table1XFilterCoefficientn2;
604   float                                Table1YFilterCoefficientn2;
605   float                                Table1XFilterCoefficientn3;
606   float                                Table1YFilterCoefficientn3;
607   float                                Table1XFilterCoefficientn4;
608   float                                Table1YFilterCoefficientn4;
609   float                                Table1XFilterCoefficientn5;
610   float                                Table1YFilterCoefficientn5;
611};
612
613static inline __attribute__((always_inline)) void
614GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(__attribute__((unused)) __gen_user_data *data,
615                                            __attribute__((unused)) void * restrict dst,
616                                            __attribute__((unused)) const struct GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY * restrict values)
617{
618   uint32_t * restrict dw = (uint32_t * restrict) dst;
619
620   dw[0] =
621      __gen_sfixed(values->Table1XFilterCoefficientn2, 0, 7, 6) |
622      __gen_sfixed(values->Table1YFilterCoefficientn2, 8, 15, 6) |
623      __gen_sfixed(values->Table1XFilterCoefficientn3, 16, 23, 6) |
624      __gen_sfixed(values->Table1YFilterCoefficientn3, 24, 31, 6);
625
626   dw[1] =
627      __gen_sfixed(values->Table1XFilterCoefficientn4, 0, 7, 6) |
628      __gen_sfixed(values->Table1YFilterCoefficientn4, 8, 15, 6) |
629      __gen_sfixed(values->Table1XFilterCoefficientn5, 16, 23, 6) |
630      __gen_sfixed(values->Table1YFilterCoefficientn5, 24, 31, 6);
631}
632
633#define GFX11_CLEAR_COLOR_length               8
634struct GFX11_CLEAR_COLOR {
635   int32_t                              RawClearColorRed;
636   int32_t                              RawClearColorGreen;
637   int32_t                              RawClearColorBlue;
638   int32_t                              RawClearColorAlpha;
639   uint64_t                             ConvertedClearValueHiLow;
640};
641
642static inline __attribute__((always_inline)) void
643GFX11_CLEAR_COLOR_pack(__attribute__((unused)) __gen_user_data *data,
644                       __attribute__((unused)) void * restrict dst,
645                       __attribute__((unused)) const struct GFX11_CLEAR_COLOR * restrict values)
646{
647   uint32_t * restrict dw = (uint32_t * restrict) dst;
648
649   dw[0] =
650      __gen_sint(values->RawClearColorRed, 0, 31);
651
652   dw[1] =
653      __gen_sint(values->RawClearColorGreen, 0, 31);
654
655   dw[2] =
656      __gen_sint(values->RawClearColorBlue, 0, 31);
657
658   dw[3] =
659      __gen_sint(values->RawClearColorAlpha, 0, 31);
660
661   const uint64_t v4 =
662      __gen_uint(values->ConvertedClearValueHiLow, 0, 63);
663   dw[4] = v4;
664   dw[5] = v4 >> 32;
665
666   dw[6] = 0;
667
668   dw[7] = 0;
669}
670
671#define GFX11_COLOR_CALC_STATE_length          6
672struct GFX11_COLOR_CALC_STATE {
673   uint32_t                             AlphaTestFormat;
674#define ALPHATEST_UNORM8                         0
675#define ALPHATEST_FLOAT32                        1
676   bool                                 RoundDisableFunctionDisable;
677   uint32_t                             AlphaReferenceValueAsUNORM8;
678   float                                AlphaReferenceValueAsFLOAT32;
679   float                                BlendConstantColorRed;
680   float                                BlendConstantColorGreen;
681   float                                BlendConstantColorBlue;
682   float                                BlendConstantColorAlpha;
683};
684
685static inline __attribute__((always_inline)) void
686GFX11_COLOR_CALC_STATE_pack(__attribute__((unused)) __gen_user_data *data,
687                            __attribute__((unused)) void * restrict dst,
688                            __attribute__((unused)) const struct GFX11_COLOR_CALC_STATE * restrict values)
689{
690   uint32_t * restrict dw = (uint32_t * restrict) dst;
691
692   dw[0] =
693      __gen_uint(values->AlphaTestFormat, 0, 0) |
694      __gen_uint(values->RoundDisableFunctionDisable, 15, 15);
695
696   dw[1] =
697      __gen_uint(values->AlphaReferenceValueAsUNORM8, 0, 31) |
698      __gen_float(values->AlphaReferenceValueAsFLOAT32);
699
700   dw[2] =
701      __gen_float(values->BlendConstantColorRed);
702
703   dw[3] =
704      __gen_float(values->BlendConstantColorGreen);
705
706   dw[4] =
707      __gen_float(values->BlendConstantColorBlue);
708
709   dw[5] =
710      __gen_float(values->BlendConstantColorAlpha);
711}
712
713#define GFX11_EXECUTION_UNIT_EXTENDED_MESSAGE_DESCRIPTOR_length      1
714struct GFX11_EXECUTION_UNIT_EXTENDED_MESSAGE_DESCRIPTOR {
715   uint32_t                             TargetFunctionID;
716   uint32_t                             EndOfThread;
717#define NoTermination                            0
718#define EOT                                      1
719   uint32_t                             ExtendedMessageLength;
720};
721
722static inline __attribute__((always_inline)) void
723GFX11_EXECUTION_UNIT_EXTENDED_MESSAGE_DESCRIPTOR_pack(__attribute__((unused)) __gen_user_data *data,
724                                                      __attribute__((unused)) void * restrict dst,
725                                                      __attribute__((unused)) const struct GFX11_EXECUTION_UNIT_EXTENDED_MESSAGE_DESCRIPTOR * restrict values)
726{
727   uint32_t * restrict dw = (uint32_t * restrict) dst;
728
729   dw[0] =
730      __gen_uint(values->TargetFunctionID, 0, 3) |
731      __gen_uint(values->EndOfThread, 5, 5) |
732      __gen_uint(values->ExtendedMessageLength, 6, 9);
733}
734
735#define GFX11_FILTER_COEFFICIENT_length        1
736struct GFX11_FILTER_COEFFICIENT {
737   float                                FilterCoefficient;
738};
739
740static inline __attribute__((always_inline)) void
741GFX11_FILTER_COEFFICIENT_pack(__attribute__((unused)) __gen_user_data *data,
742                              __attribute__((unused)) void * restrict dst,
743                              __attribute__((unused)) const struct GFX11_FILTER_COEFFICIENT * restrict values)
744{
745   uint32_t * restrict dw = (uint32_t * restrict) dst;
746
747   dw[0] =
748      __gen_sfixed(values->FilterCoefficient, 0, 7, 6);
749}
750
751#define GFX11_FRAMEDELTAQP_length              2
752struct GFX11_FRAMEDELTAQP {
753   int32_t                              FrameDeltaQP[8];
754};
755
756static inline __attribute__((always_inline)) void
757GFX11_FRAMEDELTAQP_pack(__attribute__((unused)) __gen_user_data *data,
758                        __attribute__((unused)) void * restrict dst,
759                        __attribute__((unused)) const struct GFX11_FRAMEDELTAQP * restrict values)
760{
761   uint32_t * restrict dw = (uint32_t * restrict) dst;
762
763   dw[0] =
764      __gen_sint(values->FrameDeltaQP[0], 0, 7) |
765      __gen_sint(values->FrameDeltaQP[1], 8, 15) |
766      __gen_sint(values->FrameDeltaQP[2], 16, 23) |
767      __gen_sint(values->FrameDeltaQP[3], 24, 31);
768
769   dw[1] =
770      __gen_sint(values->FrameDeltaQP[4], 0, 7) |
771      __gen_sint(values->FrameDeltaQP[5], 8, 15) |
772      __gen_sint(values->FrameDeltaQP[6], 16, 23) |
773      __gen_sint(values->FrameDeltaQP[7], 24, 31);
774}
775
776#define GFX11_FRAMEDELTAQPRANGE_length         2
777struct GFX11_FRAMEDELTAQPRANGE {
778   uint32_t                             FrameDeltaQPRange[8];
779};
780
781static inline __attribute__((always_inline)) void
782GFX11_FRAMEDELTAQPRANGE_pack(__attribute__((unused)) __gen_user_data *data,
783                             __attribute__((unused)) void * restrict dst,
784                             __attribute__((unused)) const struct GFX11_FRAMEDELTAQPRANGE * restrict values)
785{
786   uint32_t * restrict dw = (uint32_t * restrict) dst;
787
788   dw[0] =
789      __gen_uint(values->FrameDeltaQPRange[0], 0, 7) |
790      __gen_uint(values->FrameDeltaQPRange[1], 8, 15) |
791      __gen_uint(values->FrameDeltaQPRange[2], 16, 23) |
792      __gen_uint(values->FrameDeltaQPRange[3], 24, 31);
793
794   dw[1] =
795      __gen_uint(values->FrameDeltaQPRange[4], 0, 7) |
796      __gen_uint(values->FrameDeltaQPRange[5], 8, 15) |
797      __gen_uint(values->FrameDeltaQPRange[6], 16, 23) |
798      __gen_uint(values->FrameDeltaQPRange[7], 24, 31);
799}
800
801#define GFX11_GATHER_CONSTANT_ENTRY_length      1
802struct GFX11_GATHER_CONSTANT_ENTRY {
803   uint32_t                             BindingTableIndexOffset;
804   uint32_t                             ChannelMask;
805   uint64_t                             ConstantBufferOffset;
806};
807
808static inline __attribute__((always_inline)) void
809GFX11_GATHER_CONSTANT_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
810                                 __attribute__((unused)) void * restrict dst,
811                                 __attribute__((unused)) const struct GFX11_GATHER_CONSTANT_ENTRY * restrict values)
812{
813   uint32_t * restrict dw = (uint32_t * restrict) dst;
814
815   dw[0] =
816      __gen_uint(values->BindingTableIndexOffset, 0, 3) |
817      __gen_uint(values->ChannelMask, 4, 7) |
818      __gen_offset(values->ConstantBufferOffset, 8, 15);
819}
820
821#define GFX11_HEVC_ARBITRATION_PRIORITY_length      1
822struct GFX11_HEVC_ARBITRATION_PRIORITY {
823   uint32_t                             Priority;
824#define Highestpriority                          0
825#define Secondhighestpriority                    1
826#define Thirdhighestpriority                     2
827#define Lowestpriority                           3
828};
829
830static inline __attribute__((always_inline)) void
831GFX11_HEVC_ARBITRATION_PRIORITY_pack(__attribute__((unused)) __gen_user_data *data,
832                                     __attribute__((unused)) void * restrict dst,
833                                     __attribute__((unused)) const struct GFX11_HEVC_ARBITRATION_PRIORITY * restrict values)
834{
835   uint32_t * restrict dw = (uint32_t * restrict) dst;
836
837   dw[0] =
838      __gen_uint(values->Priority, 0, 1);
839}
840
841#define GFX11_MEMORYADDRESSATTRIBUTES_length      1
842struct GFX11_MEMORYADDRESSATTRIBUTES {
843   uint32_t                             MOCS;
844   struct GFX11_HEVC_ARBITRATION_PRIORITY ArbitrationPriorityControl;
845   bool                                 MemoryCompressionEnable;
846   uint32_t                             MemoryCompressionMode;
847   uint32_t                             RowStoreScratchBufferCacheSelect;
848   uint32_t                             TiledResourceMode;
849#define TRMODE_NONE                              0
850#define TRMODE_TILEYF                            1
851#define TRMODE_TILEYS                            2
852};
853
854static inline __attribute__((always_inline)) void
855GFX11_MEMORYADDRESSATTRIBUTES_pack(__attribute__((unused)) __gen_user_data *data,
856                                   __attribute__((unused)) void * restrict dst,
857                                   __attribute__((unused)) const struct GFX11_MEMORYADDRESSATTRIBUTES * restrict values)
858{
859   uint32_t * restrict dw = (uint32_t * restrict) dst;
860
861   uint32_t v0_0;
862   GFX11_HEVC_ARBITRATION_PRIORITY_pack(data, &v0_0, &values->ArbitrationPriorityControl);
863
864   dw[0] =
865      __gen_uint(values->MOCS, 1, 6) |
866      __gen_uint(v0_0, 7, 8) |
867      __gen_uint(values->MemoryCompressionEnable, 9, 9) |
868      __gen_uint(values->MemoryCompressionMode, 10, 10) |
869      __gen_uint(values->RowStoreScratchBufferCacheSelect, 12, 12) |
870      __gen_uint(values->TiledResourceMode, 13, 14);
871}
872
873#define GFX11_HCP_PAK_INSERT_OBJECT_INDIRECT_PAYLOAD_length      4
874struct GFX11_HCP_PAK_INSERT_OBJECT_INDIRECT_PAYLOAD {
875   uint32_t                             IndirectPayloadDataSizeinbits;
876   __gen_address_type                   IndirectPayloadBaseAddress;
877   struct GFX11_MEMORYADDRESSATTRIBUTES IndirectPayloadBaseAddress2;
878};
879
880static inline __attribute__((always_inline)) void
881GFX11_HCP_PAK_INSERT_OBJECT_INDIRECT_PAYLOAD_pack(__attribute__((unused)) __gen_user_data *data,
882                                                  __attribute__((unused)) void * restrict dst,
883                                                  __attribute__((unused)) const struct GFX11_HCP_PAK_INSERT_OBJECT_INDIRECT_PAYLOAD * restrict values)
884{
885   uint32_t * restrict dw = (uint32_t * restrict) dst;
886
887   dw[0] =
888      __gen_uint(values->IndirectPayloadDataSizeinbits, 0, 31);
889
890   const uint64_t v1_address =
891      __gen_address(data, &dw[1], values->IndirectPayloadBaseAddress, 0, 0, 63);
892   dw[1] = v1_address;
893   dw[2] = v1_address >> 32;
894
895   GFX11_MEMORYADDRESSATTRIBUTES_pack(data, &dw[3], &values->IndirectPayloadBaseAddress2);
896}
897
898#define GFX11_HCP_REF_LIST_ENTRY_length        1
899struct GFX11_HCP_REF_LIST_ENTRY {
900   uint32_t                             ReferencePicturetbValue;
901   uint32_t                             ListEntry;
902   uint32_t                             ChromaWeightedPrediction;
903#define Default                                  0
904#define Explicit                                 1
905   uint32_t                             LumaWeightedPrediction;
906#define Default                                  0
907#define Explicit                                 1
908   bool                                 LongTermReference;
909   bool                                 FieldPic;
910   bool                                 TopField;
911};
912
913static inline __attribute__((always_inline)) void
914GFX11_HCP_REF_LIST_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
915                              __attribute__((unused)) void * restrict dst,
916                              __attribute__((unused)) const struct GFX11_HCP_REF_LIST_ENTRY * restrict values)
917{
918   uint32_t * restrict dw = (uint32_t * restrict) dst;
919
920   dw[0] =
921      __gen_uint(values->ReferencePicturetbValue, 0, 7) |
922      __gen_uint(values->ListEntry, 8, 10) |
923      __gen_uint(values->ChromaWeightedPrediction, 11, 11) |
924      __gen_uint(values->LumaWeightedPrediction, 12, 12) |
925      __gen_uint(values->LongTermReference, 13, 13) |
926      __gen_uint(values->FieldPic, 14, 14) |
927      __gen_uint(values->TopField, 15, 15);
928}
929
930#define GFX11_HCP_TILE_POSITION_IN_CTB_length      1
931struct GFX11_HCP_TILE_POSITION_IN_CTB {
932   uint32_t                             CtbPos0i;
933   uint32_t                             CtbPos1i;
934   uint32_t                             CtbPos2i;
935   uint32_t                             CtbPos3i;
936};
937
938static inline __attribute__((always_inline)) void
939GFX11_HCP_TILE_POSITION_IN_CTB_pack(__attribute__((unused)) __gen_user_data *data,
940                                    __attribute__((unused)) void * restrict dst,
941                                    __attribute__((unused)) const struct GFX11_HCP_TILE_POSITION_IN_CTB * restrict values)
942{
943   uint32_t * restrict dw = (uint32_t * restrict) dst;
944
945   dw[0] =
946      __gen_uint(values->CtbPos0i, 0, 7) |
947      __gen_uint(values->CtbPos1i, 8, 15) |
948      __gen_uint(values->CtbPos2i, 16, 23) |
949      __gen_uint(values->CtbPos3i, 24, 31);
950}
951
952#define GFX11_HCP_TILE_POSITION_IN_CTB_MSB_length      2
953struct GFX11_HCP_TILE_POSITION_IN_CTB_MSB {
954   uint32_t                             CtbRowPositionofTileColumn[22];
955};
956
957static inline __attribute__((always_inline)) void
958GFX11_HCP_TILE_POSITION_IN_CTB_MSB_pack(__attribute__((unused)) __gen_user_data *data,
959                                        __attribute__((unused)) void * restrict dst,
960                                        __attribute__((unused)) const struct GFX11_HCP_TILE_POSITION_IN_CTB_MSB * restrict values)
961{
962   uint32_t * restrict dw = (uint32_t * restrict) dst;
963
964   dw[0] =
965      __gen_uint(values->CtbRowPositionofTileColumn[0], 0, 1) |
966      __gen_uint(values->CtbRowPositionofTileColumn[1], 2, 3) |
967      __gen_uint(values->CtbRowPositionofTileColumn[2], 4, 5) |
968      __gen_uint(values->CtbRowPositionofTileColumn[3], 6, 7) |
969      __gen_uint(values->CtbRowPositionofTileColumn[4], 8, 9) |
970      __gen_uint(values->CtbRowPositionofTileColumn[5], 10, 11) |
971      __gen_uint(values->CtbRowPositionofTileColumn[6], 12, 13) |
972      __gen_uint(values->CtbRowPositionofTileColumn[7], 14, 15) |
973      __gen_uint(values->CtbRowPositionofTileColumn[8], 16, 17) |
974      __gen_uint(values->CtbRowPositionofTileColumn[9], 18, 19) |
975      __gen_uint(values->CtbRowPositionofTileColumn[10], 20, 21) |
976      __gen_uint(values->CtbRowPositionofTileColumn[11], 22, 23) |
977      __gen_uint(values->CtbRowPositionofTileColumn[12], 24, 25) |
978      __gen_uint(values->CtbRowPositionofTileColumn[13], 26, 27) |
979      __gen_uint(values->CtbRowPositionofTileColumn[14], 28, 29) |
980      __gen_uint(values->CtbRowPositionofTileColumn[15], 30, 31);
981
982   dw[1] =
983      __gen_uint(values->CtbRowPositionofTileColumn[16], 0, 1) |
984      __gen_uint(values->CtbRowPositionofTileColumn[17], 2, 3) |
985      __gen_uint(values->CtbRowPositionofTileColumn[18], 4, 5) |
986      __gen_uint(values->CtbRowPositionofTileColumn[19], 6, 7) |
987      __gen_uint(values->CtbRowPositionofTileColumn[20], 8, 9) |
988      __gen_uint(values->CtbRowPositionofTileColumn[21], 10, 11);
989}
990
991#define GFX11_HCP_WEIGHTOFFSET_CHROMA_ENTRY_length      1
992struct GFX11_HCP_WEIGHTOFFSET_CHROMA_ENTRY {
993   int32_t                              DeltaChromaWeightLX0;
994   uint32_t                             ChromaOffsetLX0;
995   int32_t                              DeltaChromaWeightLX1;
996   uint32_t                             ChromaOffsetLX1;
997};
998
999static inline __attribute__((always_inline)) void
1000GFX11_HCP_WEIGHTOFFSET_CHROMA_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
1001                                         __attribute__((unused)) void * restrict dst,
1002                                         __attribute__((unused)) const struct GFX11_HCP_WEIGHTOFFSET_CHROMA_ENTRY * restrict values)
1003{
1004   uint32_t * restrict dw = (uint32_t * restrict) dst;
1005
1006   dw[0] =
1007      __gen_sint(values->DeltaChromaWeightLX0, 0, 7) |
1008      __gen_uint(values->ChromaOffsetLX0, 8, 15) |
1009      __gen_sint(values->DeltaChromaWeightLX1, 16, 23) |
1010      __gen_uint(values->ChromaOffsetLX1, 24, 31);
1011}
1012
1013#define GFX11_HCP_WEIGHTOFFSET_CHROMA_EXT_ENTRY_length      1
1014struct GFX11_HCP_WEIGHTOFFSET_CHROMA_EXT_ENTRY {
1015   uint32_t                             ChromaOffsetLX0MSBytei;
1016   uint32_t                             ChromaOffsetLX0MSBytei1;
1017   uint32_t                             ChromaOffsetLX1MSBytei;
1018   uint32_t                             ChromaOffsetLX1MSBytei1;
1019};
1020
1021static inline __attribute__((always_inline)) void
1022GFX11_HCP_WEIGHTOFFSET_CHROMA_EXT_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
1023                                             __attribute__((unused)) void * restrict dst,
1024                                             __attribute__((unused)) const struct GFX11_HCP_WEIGHTOFFSET_CHROMA_EXT_ENTRY * restrict values)
1025{
1026   uint32_t * restrict dw = (uint32_t * restrict) dst;
1027
1028   dw[0] =
1029      __gen_uint(values->ChromaOffsetLX0MSBytei, 0, 7) |
1030      __gen_uint(values->ChromaOffsetLX0MSBytei1, 8, 15) |
1031      __gen_uint(values->ChromaOffsetLX1MSBytei, 16, 23) |
1032      __gen_uint(values->ChromaOffsetLX1MSBytei1, 24, 31);
1033}
1034
1035#define GFX11_HCP_WEIGHTOFFSET_LUMA_ENTRY_length      1
1036struct GFX11_HCP_WEIGHTOFFSET_LUMA_ENTRY {
1037   int32_t                              DeltaLumaWeightLX;
1038   uint32_t                             LumaOffsetLX;
1039   uint32_t                             LumaOffsetLXMSByte;
1040};
1041
1042static inline __attribute__((always_inline)) void
1043GFX11_HCP_WEIGHTOFFSET_LUMA_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
1044                                       __attribute__((unused)) void * restrict dst,
1045                                       __attribute__((unused)) const struct GFX11_HCP_WEIGHTOFFSET_LUMA_ENTRY * restrict values)
1046{
1047   uint32_t * restrict dw = (uint32_t * restrict) dst;
1048
1049   dw[0] =
1050      __gen_sint(values->DeltaLumaWeightLX, 0, 7) |
1051      __gen_uint(values->LumaOffsetLX, 8, 15) |
1052      __gen_uint(values->LumaOffsetLXMSByte, 24, 31);
1053}
1054
1055#define GFX11_HEVC_VP9_RDOQ_LAMBDA_FIELDS_length      1
1056struct GFX11_HEVC_VP9_RDOQ_LAMBDA_FIELDS {
1057   uint32_t                             LambdaValue0;
1058   uint32_t                             LambdaValue1;
1059};
1060
1061static inline __attribute__((always_inline)) void
1062GFX11_HEVC_VP9_RDOQ_LAMBDA_FIELDS_pack(__attribute__((unused)) __gen_user_data *data,
1063                                       __attribute__((unused)) void * restrict dst,
1064                                       __attribute__((unused)) const struct GFX11_HEVC_VP9_RDOQ_LAMBDA_FIELDS * restrict values)
1065{
1066   uint32_t * restrict dw = (uint32_t * restrict) dst;
1067
1068   dw[0] =
1069      __gen_uint(values->LambdaValue0, 0, 15) |
1070      __gen_uint(values->LambdaValue1, 16, 31);
1071}
1072
1073#define GFX11_HUC_VIRTUAL_ADDR_REGION_length      3
1074struct GFX11_HUC_VIRTUAL_ADDR_REGION {
1075   __gen_address_type                   Address;
1076   struct GFX11_MEMORYADDRESSATTRIBUTES MemoryAddressAttributes;
1077};
1078
1079static inline __attribute__((always_inline)) void
1080GFX11_HUC_VIRTUAL_ADDR_REGION_pack(__attribute__((unused)) __gen_user_data *data,
1081                                   __attribute__((unused)) void * restrict dst,
1082                                   __attribute__((unused)) const struct GFX11_HUC_VIRTUAL_ADDR_REGION * restrict values)
1083{
1084   uint32_t * restrict dw = (uint32_t * restrict) dst;
1085
1086   const uint64_t v0_address =
1087      __gen_address(data, &dw[0], values->Address, 0, 0, 63);
1088   dw[0] = v0_address;
1089   dw[1] = v0_address >> 32;
1090
1091   GFX11_MEMORYADDRESSATTRIBUTES_pack(data, &dw[2], &values->MemoryAddressAttributes);
1092}
1093
1094#define GFX11_IMAGE_STATE_COST_length          2
1095struct GFX11_IMAGE_STATE_COST {
1096   uint32_t                             MV0Cost;
1097   uint32_t                             MV1Cost;
1098   uint32_t                             MV2Cost;
1099   uint32_t                             MV3Cost;
1100   uint32_t                             MV4Cost;
1101   uint32_t                             MV5Cost;
1102   uint32_t                             MV6Cost;
1103   uint32_t                             MV7Cost;
1104};
1105
1106static inline __attribute__((always_inline)) void
1107GFX11_IMAGE_STATE_COST_pack(__attribute__((unused)) __gen_user_data *data,
1108                            __attribute__((unused)) void * restrict dst,
1109                            __attribute__((unused)) const struct GFX11_IMAGE_STATE_COST * restrict values)
1110{
1111   uint32_t * restrict dw = (uint32_t * restrict) dst;
1112
1113   dw[0] =
1114      __gen_uint(values->MV0Cost, 0, 7) |
1115      __gen_uint(values->MV1Cost, 8, 15) |
1116      __gen_uint(values->MV2Cost, 16, 23) |
1117      __gen_uint(values->MV3Cost, 24, 31);
1118
1119   dw[1] =
1120      __gen_uint(values->MV4Cost, 0, 7) |
1121      __gen_uint(values->MV5Cost, 8, 15) |
1122      __gen_uint(values->MV6Cost, 16, 23) |
1123      __gen_uint(values->MV7Cost, 24, 31);
1124}
1125
1126#define GFX11_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT_length      3
1127struct GFX11_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT {
1128   bool                                 MBErrorConcealmentPSliceWeightPredictionDisable;
1129   bool                                 MBErrorConcealmentPSliceMotionVectorsOverrideDisable;
1130   bool                                 MBErrorConcealmentBSpatialWeightPredictionDisable;
1131   bool                                 MBErrorConcealmentBSpatialMotionVectorsOverrideDisable;
1132   uint32_t                             MBErrorConcealmentBSpatialPredictionMode;
1133   bool                                 MBHeaderErrorHandling;
1134   bool                                 EntropyErrorHandling;
1135   bool                                 MPRErrorHandling;
1136   bool                                 BSDPrematureCompleteErrorHandling;
1137   uint32_t                             ConcealmentPictureID;
1138   bool                                 MBErrorConcealmentBTemporalWeightPredictionDisable;
1139   bool                                 MBErrorConcealmentBTemporalMotionVectorsOverrideEnable;
1140   uint32_t                             MBErrorConcealmentBTemporalPredictionMode;
1141   bool                                 IntraPredMode4x48x8LumaErrorControl;
1142   bool                                 InitCurrentMBNumber;
1143   uint32_t                             ConcealmentMethod;
1144   uint32_t                             FirstMBBitOffset;
1145   bool                                 LastSlice;
1146   bool                                 EmulationPreventionBytePresent;
1147   bool                                 FixPrevMBSkipped;
1148   uint32_t                             FirstMBByteOffsetofSliceDataorSliceHeader;
1149   bool                                 IntraPredictionErrorControl;
1150   bool                                 Intra8x84x4PredictionErrorConcealmentControl;
1151   uint32_t                             BSliceTemporalInterConcealmentMode;
1152   uint32_t                             BSliceSpatialInterConcealmentMode;
1153   uint32_t                             BSliceInterDirectTypeConcealmentMode;
1154   uint32_t                             BSliceConcealmentMode;
1155#define IntraConcealment                         1
1156#define InterConcealment                         0
1157   uint32_t                             PSliceInterConcealmentMode;
1158   uint32_t                             PSliceConcealmentMode;
1159#define IntraConcealment                         1
1160#define InterConcealment                         0
1161   uint32_t                             ConcealmentReferencePictureFieldBit;
1162   uint32_t                             ISliceConcealmentMode;
1163#define IntraConcealment                         1
1164#define InterConcealment                         0
1165};
1166
1167static inline __attribute__((always_inline)) void
1168GFX11_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
1169                                                          __attribute__((unused)) void * restrict dst,
1170                                                          __attribute__((unused)) const struct GFX11_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT * restrict values)
1171{
1172   uint32_t * restrict dw = (uint32_t * restrict) dst;
1173
1174   dw[0] =
1175      __gen_uint(values->MBErrorConcealmentPSliceWeightPredictionDisable, 0, 0) |
1176      __gen_uint(values->MBErrorConcealmentPSliceMotionVectorsOverrideDisable, 1, 1) |
1177      __gen_uint(values->MBErrorConcealmentBSpatialWeightPredictionDisable, 3, 3) |
1178      __gen_uint(values->MBErrorConcealmentBSpatialMotionVectorsOverrideDisable, 4, 4) |
1179      __gen_uint(values->MBErrorConcealmentBSpatialPredictionMode, 6, 7) |
1180      __gen_uint(values->MBHeaderErrorHandling, 8, 8) |
1181      __gen_uint(values->EntropyErrorHandling, 10, 10) |
1182      __gen_uint(values->MPRErrorHandling, 12, 12) |
1183      __gen_uint(values->BSDPrematureCompleteErrorHandling, 14, 14) |
1184      __gen_uint(values->ConcealmentPictureID, 16, 21) |
1185      __gen_uint(values->MBErrorConcealmentBTemporalWeightPredictionDisable, 24, 24) |
1186      __gen_uint(values->MBErrorConcealmentBTemporalMotionVectorsOverrideEnable, 25, 25) |
1187      __gen_uint(values->MBErrorConcealmentBTemporalPredictionMode, 27, 28) |
1188      __gen_uint(values->IntraPredMode4x48x8LumaErrorControl, 29, 29) |
1189      __gen_uint(values->InitCurrentMBNumber, 30, 30) |
1190      __gen_uint(values->ConcealmentMethod, 31, 31);
1191
1192   dw[1] =
1193      __gen_uint(values->FirstMBBitOffset, 0, 2) |
1194      __gen_uint(values->LastSlice, 3, 3) |
1195      __gen_uint(values->EmulationPreventionBytePresent, 4, 4) |
1196      __gen_uint(values->FixPrevMBSkipped, 7, 7) |
1197      __gen_uint(values->FirstMBByteOffsetofSliceDataorSliceHeader, 16, 31);
1198
1199   dw[2] =
1200      __gen_uint(values->IntraPredictionErrorControl, 0, 0) |
1201      __gen_uint(values->Intra8x84x4PredictionErrorConcealmentControl, 1, 1) |
1202      __gen_uint(values->BSliceTemporalInterConcealmentMode, 4, 6) |
1203      __gen_uint(values->BSliceSpatialInterConcealmentMode, 8, 10) |
1204      __gen_uint(values->BSliceInterDirectTypeConcealmentMode, 12, 13) |
1205      __gen_uint(values->BSliceConcealmentMode, 15, 15) |
1206      __gen_uint(values->PSliceInterConcealmentMode, 16, 18) |
1207      __gen_uint(values->PSliceConcealmentMode, 23, 23) |
1208      __gen_uint(values->ConcealmentReferencePictureFieldBit, 24, 29) |
1209      __gen_uint(values->ISliceConcealmentMode, 31, 31);
1210}
1211
1212#define GFX11_INTERFACE_DESCRIPTOR_DATA_length      8
1213struct GFX11_INTERFACE_DESCRIPTOR_DATA {
1214   uint64_t                             KernelStartPointer;
1215   bool                                 SoftwareExceptionEnable;
1216   bool                                 MaskStackExceptionEnable;
1217   bool                                 IllegalOpcodeExceptionEnable;
1218   uint32_t                             FloatingPointMode;
1219#define IEEE754                                  0
1220#define Alternate                                1
1221   uint32_t                             ThreadPriority;
1222#define NormalPriority                           0
1223#define HighPriority                             1
1224   bool                                 SingleProgramFlow;
1225   uint32_t                             DenormMode;
1226#define Ftz                                      0
1227#define SetByKernel                              1
1228   uint32_t                             SamplerCount;
1229#define Nosamplersused                           0
1230#define Between1and4samplersused                 1
1231#define Between5and8samplersused                 2
1232#define Between9and12samplersused                3
1233#define Between13and16samplersused               4
1234   uint64_t                             SamplerStatePointer;
1235   uint32_t                             BindingTableEntryCount;
1236   uint64_t                             BindingTablePointer;
1237   uint32_t                             ConstantURBEntryReadOffset;
1238   uint32_t                             ConstantURBEntryReadLength;
1239   uint32_t                             NumberofThreadsinGPGPUThreadGroup;
1240   bool                                 GlobalBarrierEnable;
1241   uint32_t                             SharedLocalMemorySize;
1242#define Encodes0K                                0
1243#define Encodes1K                                1
1244#define Encodes2K                                2
1245#define Encodes4K                                3
1246#define Encodes8K                                4
1247#define Encodes16K                               5
1248#define Encodes32K                               6
1249#define Encodes64K                               7
1250   bool                                 BarrierEnable;
1251   uint32_t                             RoundingMode;
1252#define RTNE                                     0
1253#define RU                                       1
1254#define RD                                       2
1255#define RTZ                                      3
1256   uint32_t                             CrossThreadConstantDataReadLength;
1257};
1258
1259static inline __attribute__((always_inline)) void
1260GFX11_INTERFACE_DESCRIPTOR_DATA_pack(__attribute__((unused)) __gen_user_data *data,
1261                                     __attribute__((unused)) void * restrict dst,
1262                                     __attribute__((unused)) const struct GFX11_INTERFACE_DESCRIPTOR_DATA * restrict values)
1263{
1264   uint32_t * restrict dw = (uint32_t * restrict) dst;
1265
1266   const uint64_t v0 =
1267      __gen_offset(values->KernelStartPointer, 6, 47);
1268   dw[0] = v0;
1269   dw[1] = v0 >> 32;
1270
1271   dw[2] =
1272      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
1273      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
1274      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
1275      __gen_uint(values->FloatingPointMode, 16, 16) |
1276      __gen_uint(values->ThreadPriority, 17, 17) |
1277      __gen_uint(values->SingleProgramFlow, 18, 18) |
1278      __gen_uint(values->DenormMode, 19, 19);
1279
1280   dw[3] =
1281      __gen_uint(values->SamplerCount, 2, 4) |
1282      __gen_offset(values->SamplerStatePointer, 5, 31);
1283
1284   dw[4] =
1285      __gen_uint(values->BindingTableEntryCount, 0, 4) |
1286      __gen_offset(values->BindingTablePointer, 5, 15);
1287
1288   dw[5] =
1289      __gen_uint(values->ConstantURBEntryReadOffset, 0, 15) |
1290      __gen_uint(values->ConstantURBEntryReadLength, 16, 31);
1291
1292   dw[6] =
1293      __gen_uint(values->NumberofThreadsinGPGPUThreadGroup, 0, 9) |
1294      __gen_uint(values->GlobalBarrierEnable, 15, 15) |
1295      __gen_uint(values->SharedLocalMemorySize, 16, 20) |
1296      __gen_uint(values->BarrierEnable, 21, 21) |
1297      __gen_uint(values->RoundingMode, 22, 23);
1298
1299   dw[7] =
1300      __gen_uint(values->CrossThreadConstantDataReadLength, 0, 7);
1301}
1302
1303#define GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_length      4
1304struct GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY {
1305   float                                Table0XFilterCoefficientn0;
1306   float                                Table0YFilterCoefficientn0;
1307   float                                Table0XFilterCoefficientn1;
1308   float                                Table0YFilterCoefficientn1;
1309   float                                Table0XFilterCoefficientn2;
1310   float                                Table0YFilterCoefficientn2;
1311   float                                Table0XFilterCoefficientn3;
1312   float                                Table0YFilterCoefficientn3;
1313   float                                Table0XFilterCoefficientn4;
1314   float                                Table0YFilterCoefficientn4;
1315   float                                Table0XFilterCoefficientn5;
1316   float                                Table0YFilterCoefficientn5;
1317   float                                Table0XFilterCoefficientn6;
1318   float                                Table0YFilterCoefficientn6;
1319   float                                Table0XFilterCoefficientn7;
1320   float                                Table0YFilterCoefficientn7;
1321};
1322
1323static inline __attribute__((always_inline)) void
1324GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(__attribute__((unused)) __gen_user_data *data,
1325                                          __attribute__((unused)) void * restrict dst,
1326                                          __attribute__((unused)) const struct GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY * restrict values)
1327{
1328   uint32_t * restrict dw = (uint32_t * restrict) dst;
1329
1330   dw[0] =
1331      __gen_sfixed(values->Table0XFilterCoefficientn0, 0, 7, 6) |
1332      __gen_sfixed(values->Table0YFilterCoefficientn0, 8, 15, 6) |
1333      __gen_sfixed(values->Table0XFilterCoefficientn1, 16, 23, 6) |
1334      __gen_sfixed(values->Table0YFilterCoefficientn1, 24, 31, 6);
1335
1336   dw[1] =
1337      __gen_sfixed(values->Table0XFilterCoefficientn2, 0, 7, 6) |
1338      __gen_sfixed(values->Table0YFilterCoefficientn2, 8, 15, 6) |
1339      __gen_sfixed(values->Table0XFilterCoefficientn3, 16, 23, 6) |
1340      __gen_sfixed(values->Table0YFilterCoefficientn3, 24, 31, 6);
1341
1342   dw[2] =
1343      __gen_sfixed(values->Table0XFilterCoefficientn4, 0, 7, 6) |
1344      __gen_sfixed(values->Table0YFilterCoefficientn4, 8, 15, 6) |
1345      __gen_sfixed(values->Table0XFilterCoefficientn5, 16, 23, 6) |
1346      __gen_sfixed(values->Table0YFilterCoefficientn5, 24, 31, 6);
1347
1348   dw[3] =
1349      __gen_sfixed(values->Table0XFilterCoefficientn6, 0, 7, 6) |
1350      __gen_sfixed(values->Table0YFilterCoefficientn6, 8, 15, 6) |
1351      __gen_sfixed(values->Table0XFilterCoefficientn7, 16, 23, 6) |
1352      __gen_sfixed(values->Table0YFilterCoefficientn7, 24, 31, 6);
1353}
1354
1355#define GFX11_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION_length      2
1356struct GFX11_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION {
1357   uint32_t                             FirstMBBitOffset;
1358   bool                                 LastMB;
1359   bool                                 LastPicSlice;
1360   uint32_t                             SliceConcealmentType;
1361   uint32_t                             SliceConcealmentOverride;
1362   uint32_t                             MBCount;
1363   uint32_t                             SliceVerticalPosition;
1364   uint32_t                             SliceHorizontalPosition;
1365   uint32_t                             NextSliceHorizontalPosition;
1366   uint32_t                             NextSliceVerticalPosition;
1367   uint32_t                             QuantizerScaleCode;
1368};
1369
1370static inline __attribute__((always_inline)) void
1371GFX11_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION_pack(__attribute__((unused)) __gen_user_data *data,
1372                                                        __attribute__((unused)) void * restrict dst,
1373                                                        __attribute__((unused)) const struct GFX11_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION * restrict values)
1374{
1375   uint32_t * restrict dw = (uint32_t * restrict) dst;
1376
1377   dw[0] =
1378      __gen_uint(values->FirstMBBitOffset, 0, 2) |
1379      __gen_uint(values->LastMB, 3, 3) |
1380      __gen_uint(values->LastPicSlice, 5, 5) |
1381      __gen_uint(values->SliceConcealmentType, 6, 6) |
1382      __gen_uint(values->SliceConcealmentOverride, 7, 7) |
1383      __gen_uint(values->MBCount, 8, 15) |
1384      __gen_uint(values->SliceVerticalPosition, 16, 23) |
1385      __gen_uint(values->SliceHorizontalPosition, 24, 31);
1386
1387   dw[1] =
1388      __gen_uint(values->NextSliceHorizontalPosition, 0, 7) |
1389      __gen_uint(values->NextSliceVerticalPosition, 8, 16) |
1390      __gen_uint(values->QuantizerScaleCode, 24, 28);
1391}
1392
1393#define GFX11_MI_MATH_ALU_INSTRUCTION_length      1
1394struct GFX11_MI_MATH_ALU_INSTRUCTION {
1395   uint32_t                             Operand2;
1396#define MI_ALU_REG0                              0
1397#define MI_ALU_REG1                              1
1398#define MI_ALU_REG2                              2
1399#define MI_ALU_REG3                              3
1400#define MI_ALU_REG4                              4
1401#define MI_ALU_REG5                              5
1402#define MI_ALU_REG6                              6
1403#define MI_ALU_REG7                              7
1404#define MI_ALU_REG8                              8
1405#define MI_ALU_REG9                              9
1406#define MI_ALU_REG10                             10
1407#define MI_ALU_REG11                             11
1408#define MI_ALU_REG12                             12
1409#define MI_ALU_REG13                             13
1410#define MI_ALU_REG14                             14
1411#define MI_ALU_REG15                             15
1412#define MI_ALU_SRCA                              32
1413#define MI_ALU_SRCB                              33
1414#define MI_ALU_ACCU                              49
1415#define MI_ALU_ZF                                50
1416#define MI_ALU_CF                                51
1417   uint32_t                             Operand1;
1418#define MI_ALU_REG0                              0
1419#define MI_ALU_REG1                              1
1420#define MI_ALU_REG2                              2
1421#define MI_ALU_REG3                              3
1422#define MI_ALU_REG4                              4
1423#define MI_ALU_REG5                              5
1424#define MI_ALU_REG6                              6
1425#define MI_ALU_REG7                              7
1426#define MI_ALU_REG8                              8
1427#define MI_ALU_REG9                              9
1428#define MI_ALU_REG10                             10
1429#define MI_ALU_REG11                             11
1430#define MI_ALU_REG12                             12
1431#define MI_ALU_REG13                             13
1432#define MI_ALU_REG14                             14
1433#define MI_ALU_REG15                             15
1434#define MI_ALU_SRCA                              32
1435#define MI_ALU_SRCB                              33
1436#define MI_ALU_ACCU                              49
1437#define MI_ALU_ZF                                50
1438#define MI_ALU_CF                                51
1439   uint32_t                             ALUOpcode;
1440#define MI_ALU_NOOP                              0
1441#define MI_ALU_LOAD                              128
1442#define MI_ALU_LOADINV                           1152
1443#define MI_ALU_LOAD0                             129
1444#define MI_ALU_LOAD1                             1153
1445#define MI_ALU_ADD                               256
1446#define MI_ALU_SUB                               257
1447#define MI_ALU_AND                               258
1448#define MI_ALU_OR                                259
1449#define MI_ALU_XOR                               260
1450#define MI_ALU_STORE                             384
1451#define MI_ALU_STOREINV                          1408
1452};
1453
1454static inline __attribute__((always_inline)) void
1455GFX11_MI_MATH_ALU_INSTRUCTION_pack(__attribute__((unused)) __gen_user_data *data,
1456                                   __attribute__((unused)) void * restrict dst,
1457                                   __attribute__((unused)) const struct GFX11_MI_MATH_ALU_INSTRUCTION * restrict values)
1458{
1459   uint32_t * restrict dw = (uint32_t * restrict) dst;
1460
1461   dw[0] =
1462      __gen_uint(values->Operand2, 0, 9) |
1463      __gen_uint(values->Operand1, 10, 19) |
1464      __gen_uint(values->ALUOpcode, 20, 31);
1465}
1466
1467#define GFX11_PALETTE_ENTRY_length             1
1468struct GFX11_PALETTE_ENTRY {
1469   uint32_t                             Blue;
1470   uint32_t                             Green;
1471   uint32_t                             Red;
1472   uint32_t                             Alpha;
1473};
1474
1475static inline __attribute__((always_inline)) void
1476GFX11_PALETTE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
1477                         __attribute__((unused)) void * restrict dst,
1478                         __attribute__((unused)) const struct GFX11_PALETTE_ENTRY * restrict values)
1479{
1480   uint32_t * restrict dw = (uint32_t * restrict) dst;
1481
1482   dw[0] =
1483      __gen_uint(values->Blue, 0, 7) |
1484      __gen_uint(values->Green, 8, 15) |
1485      __gen_uint(values->Red, 16, 23) |
1486      __gen_uint(values->Alpha, 24, 31);
1487}
1488
1489#define GFX11_RENDER_SURFACE_STATE_length     16
1490struct GFX11_RENDER_SURFACE_STATE {
1491   bool                                 CubeFaceEnablePositiveZ;
1492   bool                                 CubeFaceEnableNegativeZ;
1493   bool                                 CubeFaceEnablePositiveY;
1494   bool                                 CubeFaceEnableNegativeY;
1495   bool                                 CubeFaceEnablePositiveX;
1496   bool                                 CubeFaceEnableNegativeX;
1497   uint32_t                             MediaBoundaryPixelMode;
1498#define NORMAL_MODE                              0
1499#define PROGRESSIVE_FRAME                        2
1500#define INTERLACED_FRAME                         3
1501   uint32_t                             RenderCacheReadWriteMode;
1502#define WriteOnlyCache                           0
1503#define ReadWriteCache                           1
1504   bool                                 SamplerL2BypassModeDisable;
1505   uint32_t                             VerticalLineStrideOffset;
1506   uint32_t                             VerticalLineStride;
1507   uint32_t                             TileMode;
1508#define LINEAR                                   0
1509#define WMAJOR                                   1
1510#define XMAJOR                                   2
1511#define YMAJOR                                   3
1512   uint32_t                             SurfaceHorizontalAlignment;
1513#define HALIGN_4                                 1
1514#define HALIGN_8                                 2
1515#define HALIGN_16                                3
1516   uint32_t                             SurfaceVerticalAlignment;
1517#define VALIGN_4                                 1
1518#define VALIGN_8                                 2
1519#define VALIGN_16                                3
1520   uint32_t                             SurfaceFormat;
1521   bool                                 SurfaceArray;
1522   uint32_t                             SurfaceType;
1523#define SURFTYPE_1D                              0
1524#define SURFTYPE_2D                              1
1525#define SURFTYPE_3D                              2
1526#define SURFTYPE_CUBE                            3
1527#define SURFTYPE_BUFFER                          4
1528#define SURFTYPE_STRBUF                          5
1529#define SURFTYPE_NULL                            7
1530   uint32_t                             SurfaceQPitch;
1531   float                                BaseMipLevel;
1532   uint32_t                             MOCS;
1533   bool                                 EnableUnormPathInColorPipe;
1534   uint32_t                             Width;
1535   uint32_t                             Height;
1536   uint32_t                             SurfacePitch;
1537   uint32_t                             TileAddressMappingMode;
1538#define Gfx9                                     0
1539#define Gfx10                                    1
1540   uint32_t                             Depth;
1541   uint32_t                             MultisamplePositionPaletteIndex;
1542   uint32_t                             NumberofMultisamples;
1543#define MULTISAMPLECOUNT_1                       0
1544#define MULTISAMPLECOUNT_2                       1
1545#define MULTISAMPLECOUNT_4                       2
1546#define MULTISAMPLECOUNT_8                       3
1547#define MULTISAMPLECOUNT_16                      4
1548   uint32_t                             MultisampledSurfaceStorageFormat;
1549#define MSFMT_MSS                                0
1550#define MSFMT_DEPTH_STENCIL                      1
1551   uint32_t                             RenderTargetViewExtent;
1552   uint32_t                             MinimumArrayElement;
1553   uint32_t                             RenderTargetAndSampleUnormRotation;
1554#define _0DEG                                    0
1555#define _90DEG                                   1
1556#define _180DEG                                  2
1557#define _270DEG                                  3
1558   uint32_t                             MIPCountLOD;
1559   uint32_t                             SurfaceMinLOD;
1560   uint32_t                             MipTailStartLOD;
1561   uint32_t                             CoherencyType;
1562#define GPUcoherent                              0
1563#define IAcoherent                               1
1564   uint32_t                             TiledResourceMode;
1565#define NONE                                     0
1566#define _4KB                                     1
1567#define _64KB                                    2
1568#define TILEYF                                   1
1569#define TILEYS                                   2
1570   bool                                 EWADisableForCube;
1571   uint32_t                             YOffset;
1572   uint32_t                             XOffset;
1573   uint32_t                             AuxiliarySurfaceMode;
1574#define AUX_NONE                                 0
1575#define AUX_CCS_D                                1
1576#define AUX_APPEND                               2
1577#define AUX_HIZ                                  3
1578#define AUX_CCS_E                                5
1579   uint32_t                             YOffsetforUorUVPlane;
1580   uint32_t                             AuxiliarySurfacePitch;
1581   uint32_t                             AuxiliarySurfaceQPitch;
1582   uint32_t                             XOffsetforUorUVPlane;
1583   bool                                 SeparateUVPlaneEnable;
1584   float                                ResourceMinLOD;
1585   enum GFX11_ShaderChannelSelect       ShaderChannelSelectAlpha;
1586   enum GFX11_ShaderChannelSelect       ShaderChannelSelectBlue;
1587   enum GFX11_ShaderChannelSelect       ShaderChannelSelectGreen;
1588   enum GFX11_ShaderChannelSelect       ShaderChannelSelectRed;
1589   bool                                 MemoryCompressionEnable;
1590   uint32_t                             MemoryCompressionMode;
1591#define Horizontal                               0
1592#define Vertical                                 1
1593   __gen_address_type                   SurfaceBaseAddress;
1594   uint32_t                             QuiltWidth;
1595   uint32_t                             QuiltHeight;
1596   bool                                 ClearValueAddressEnable;
1597   __gen_address_type                   AuxiliarySurfaceBaseAddress;
1598   uint32_t                             AuxiliaryTableIndexforMediaCompressedSurface;
1599   uint32_t                             YOffsetforVPlane;
1600   uint32_t                             XOffsetforVPlane;
1601   int32_t                              RedClearColor;
1602   uint32_t                             ClearColorConversionEnable;
1603   __gen_address_type                   ClearValueAddress;
1604   int32_t                              GreenClearColor;
1605   int32_t                              BlueClearColor;
1606   int32_t                              AlphaClearColor;
1607};
1608
1609static inline __attribute__((always_inline)) void
1610GFX11_RENDER_SURFACE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
1611                                __attribute__((unused)) void * restrict dst,
1612                                __attribute__((unused)) const struct GFX11_RENDER_SURFACE_STATE * restrict values)
1613{
1614   uint32_t * restrict dw = (uint32_t * restrict) dst;
1615
1616   dw[0] =
1617      __gen_uint(values->CubeFaceEnablePositiveZ, 0, 0) |
1618      __gen_uint(values->CubeFaceEnableNegativeZ, 1, 1) |
1619      __gen_uint(values->CubeFaceEnablePositiveY, 2, 2) |
1620      __gen_uint(values->CubeFaceEnableNegativeY, 3, 3) |
1621      __gen_uint(values->CubeFaceEnablePositiveX, 4, 4) |
1622      __gen_uint(values->CubeFaceEnableNegativeX, 5, 5) |
1623      __gen_uint(values->MediaBoundaryPixelMode, 6, 7) |
1624      __gen_uint(values->RenderCacheReadWriteMode, 8, 8) |
1625      __gen_uint(values->SamplerL2BypassModeDisable, 9, 9) |
1626      __gen_uint(values->VerticalLineStrideOffset, 10, 10) |
1627      __gen_uint(values->VerticalLineStride, 11, 11) |
1628      __gen_uint(values->TileMode, 12, 13) |
1629      __gen_uint(values->SurfaceHorizontalAlignment, 14, 15) |
1630      __gen_uint(values->SurfaceVerticalAlignment, 16, 17) |
1631      __gen_uint(values->SurfaceFormat, 18, 27) |
1632      __gen_uint(values->SurfaceArray, 28, 28) |
1633      __gen_uint(values->SurfaceType, 29, 31);
1634
1635   dw[1] =
1636      __gen_uint(values->SurfaceQPitch, 0, 14) |
1637      __gen_ufixed(values->BaseMipLevel, 19, 23, 1) |
1638      __gen_uint(values->MOCS, 24, 30) |
1639      __gen_uint(values->EnableUnormPathInColorPipe, 31, 31);
1640
1641   dw[2] =
1642      __gen_uint(values->Width, 0, 13) |
1643      __gen_uint(values->Height, 16, 29);
1644
1645   dw[3] =
1646      __gen_uint(values->SurfacePitch, 0, 17) |
1647      __gen_uint(values->TileAddressMappingMode, 20, 20) |
1648      __gen_uint(values->Depth, 21, 31);
1649
1650   dw[4] =
1651      __gen_uint(values->MultisamplePositionPaletteIndex, 0, 2) |
1652      __gen_uint(values->NumberofMultisamples, 3, 5) |
1653      __gen_uint(values->MultisampledSurfaceStorageFormat, 6, 6) |
1654      __gen_uint(values->RenderTargetViewExtent, 7, 17) |
1655      __gen_uint(values->MinimumArrayElement, 18, 28) |
1656      __gen_uint(values->RenderTargetAndSampleUnormRotation, 29, 30);
1657
1658   dw[5] =
1659      __gen_uint(values->MIPCountLOD, 0, 3) |
1660      __gen_uint(values->SurfaceMinLOD, 4, 7) |
1661      __gen_uint(values->MipTailStartLOD, 8, 11) |
1662      __gen_uint(values->CoherencyType, 14, 14) |
1663      __gen_uint(values->TiledResourceMode, 18, 19) |
1664      __gen_uint(values->EWADisableForCube, 20, 20) |
1665      __gen_uint(values->YOffset, 21, 23) |
1666      __gen_uint(values->XOffset, 25, 31);
1667
1668   dw[6] =
1669      __gen_uint(values->AuxiliarySurfaceMode, 0, 2) |
1670      __gen_uint(values->YOffsetforUorUVPlane, 0, 13) |
1671      __gen_uint(values->AuxiliarySurfacePitch, 3, 11) |
1672      __gen_uint(values->AuxiliarySurfaceQPitch, 16, 30) |
1673      __gen_uint(values->XOffsetforUorUVPlane, 16, 29) |
1674      __gen_uint(values->SeparateUVPlaneEnable, 31, 31);
1675
1676   dw[7] =
1677      __gen_ufixed(values->ResourceMinLOD, 0, 11, 8) |
1678      __gen_uint(values->ShaderChannelSelectAlpha, 16, 18) |
1679      __gen_uint(values->ShaderChannelSelectBlue, 19, 21) |
1680      __gen_uint(values->ShaderChannelSelectGreen, 22, 24) |
1681      __gen_uint(values->ShaderChannelSelectRed, 25, 27) |
1682      __gen_uint(values->MemoryCompressionEnable, 30, 30) |
1683      __gen_uint(values->MemoryCompressionMode, 31, 31);
1684
1685   const uint64_t v8_address =
1686      __gen_address(data, &dw[8], values->SurfaceBaseAddress, 0, 0, 63);
1687   dw[8] = v8_address;
1688   dw[9] = v8_address >> 32;
1689
1690   const uint64_t v10 =
1691      __gen_uint(values->QuiltWidth, 0, 4) |
1692      __gen_uint(values->QuiltHeight, 5, 9) |
1693      __gen_uint(values->ClearValueAddressEnable, 10, 10) |
1694      __gen_uint(values->AuxiliaryTableIndexforMediaCompressedSurface, 21, 31) |
1695      __gen_uint(values->YOffsetforVPlane, 32, 45) |
1696      __gen_uint(values->XOffsetforVPlane, 48, 61);
1697   const uint64_t v10_address =
1698      __gen_address(data, &dw[10], values->AuxiliarySurfaceBaseAddress, v10, 12, 63);
1699   dw[10] = v10_address;
1700   dw[11] = (v10_address >> 32) | (v10 >> 32);
1701
1702   const uint64_t v12 =
1703      __gen_sint(values->RedClearColor, 0, 31) |
1704      __gen_uint(values->ClearColorConversionEnable, 5, 5) |
1705      __gen_sint(values->GreenClearColor, 32, 63);
1706   const uint64_t v12_address =
1707      __gen_address(data, &dw[12], values->ClearValueAddress, v12, 6, 47);
1708   dw[12] = v12_address;
1709   dw[13] = (v12_address >> 32) | (v12 >> 32);
1710
1711   dw[14] =
1712      __gen_sint(values->BlueClearColor, 0, 31);
1713
1714   dw[15] =
1715      __gen_sint(values->AlphaClearColor, 0, 31);
1716}
1717
1718#define GFX11_ROUNDINGPRECISIONTABLE_3_BITS_length      1
1719struct GFX11_ROUNDINGPRECISIONTABLE_3_BITS {
1720   uint32_t                             RoundingPrecision;
1721#define _116                                     0
1722#define _216                                     1
1723#define _316                                     2
1724#define _416                                     3
1725#define _516                                     4
1726#define _616                                     5
1727#define _716                                     6
1728#define _816                                     7
1729};
1730
1731static inline __attribute__((always_inline)) void
1732GFX11_ROUNDINGPRECISIONTABLE_3_BITS_pack(__attribute__((unused)) __gen_user_data *data,
1733                                         __attribute__((unused)) void * restrict dst,
1734                                         __attribute__((unused)) const struct GFX11_ROUNDINGPRECISIONTABLE_3_BITS * restrict values)
1735{
1736   uint32_t * restrict dw = (uint32_t * restrict) dst;
1737
1738   dw[0] =
1739      __gen_uint(values->RoundingPrecision, 0, 2);
1740}
1741
1742#define GFX11_SAMPLER_BORDER_COLOR_STATE_length      4
1743struct GFX11_SAMPLER_BORDER_COLOR_STATE {
1744   float                                BorderColorFloatRed;
1745   uint32_t                             BorderColor32bitRed;
1746   float                                BorderColorFloatGreen;
1747   uint32_t                             BorderColor32bitGreen;
1748   float                                BorderColorFloatBlue;
1749   uint32_t                             BorderColor32bitBlue;
1750   float                                BorderColorFloatAlpha;
1751   uint32_t                             BorderColor32bitAlpha;
1752};
1753
1754static inline __attribute__((always_inline)) void
1755GFX11_SAMPLER_BORDER_COLOR_STATE_pack(__attribute__((unused)) __gen_user_data *data,
1756                                      __attribute__((unused)) void * restrict dst,
1757                                      __attribute__((unused)) const struct GFX11_SAMPLER_BORDER_COLOR_STATE * restrict values)
1758{
1759   uint32_t * restrict dw = (uint32_t * restrict) dst;
1760
1761   dw[0] =
1762      __gen_float(values->BorderColorFloatRed) |
1763      __gen_uint(values->BorderColor32bitRed, 0, 31);
1764
1765   dw[1] =
1766      __gen_float(values->BorderColorFloatGreen) |
1767      __gen_uint(values->BorderColor32bitGreen, 0, 31);
1768
1769   dw[2] =
1770      __gen_float(values->BorderColorFloatBlue) |
1771      __gen_uint(values->BorderColor32bitBlue, 0, 31);
1772
1773   dw[3] =
1774      __gen_float(values->BorderColorFloatAlpha) |
1775      __gen_uint(values->BorderColor32bitAlpha, 0, 31);
1776}
1777
1778#define GFX11_SAMPLER_INDIRECT_STATE_BORDER_COLOR_length      4
1779struct GFX11_SAMPLER_INDIRECT_STATE_BORDER_COLOR {
1780   int32_t                              BorderColorRedAsS31;
1781   uint32_t                             BorderColorRedAsU32;
1782   float                                BorderColorRedAsFloat;
1783   uint32_t                             BorderColorRedAsU8;
1784   uint32_t                             BorderColorGreenAsU8;
1785   uint32_t                             BorderColorBlueAsU8;
1786   uint32_t                             BorderColorAlphaAsU8;
1787   int32_t                              BorderColorGreenAsS31;
1788   uint32_t                             BorderColorGreenAsU32;
1789   float                                BorderColorGreenAsFloat;
1790   int32_t                              BorderColorBlueAsS31;
1791   uint32_t                             BorderColorBlueAsU32;
1792   float                                BorderColorBlueAsFloat;
1793   int32_t                              BorderColorAlphaAsS31;
1794   uint32_t                             BorderColorAlphaAsU32;
1795   float                                BorderColorAlphaAsFloat;
1796};
1797
1798static inline __attribute__((always_inline)) void
1799GFX11_SAMPLER_INDIRECT_STATE_BORDER_COLOR_pack(__attribute__((unused)) __gen_user_data *data,
1800                                               __attribute__((unused)) void * restrict dst,
1801                                               __attribute__((unused)) const struct GFX11_SAMPLER_INDIRECT_STATE_BORDER_COLOR * restrict values)
1802{
1803   uint32_t * restrict dw = (uint32_t * restrict) dst;
1804
1805   dw[0] =
1806      __gen_sint(values->BorderColorRedAsS31, 0, 31) |
1807      __gen_uint(values->BorderColorRedAsU32, 0, 31) |
1808      __gen_float(values->BorderColorRedAsFloat) |
1809      __gen_uint(values->BorderColorRedAsU8, 0, 7) |
1810      __gen_uint(values->BorderColorGreenAsU8, 8, 15) |
1811      __gen_uint(values->BorderColorBlueAsU8, 16, 23) |
1812      __gen_uint(values->BorderColorAlphaAsU8, 24, 31);
1813
1814   dw[1] =
1815      __gen_sint(values->BorderColorGreenAsS31, 0, 31) |
1816      __gen_uint(values->BorderColorGreenAsU32, 0, 31) |
1817      __gen_float(values->BorderColorGreenAsFloat);
1818
1819   dw[2] =
1820      __gen_sint(values->BorderColorBlueAsS31, 0, 31) |
1821      __gen_uint(values->BorderColorBlueAsU32, 0, 31) |
1822      __gen_float(values->BorderColorBlueAsFloat);
1823
1824   dw[3] =
1825      __gen_sint(values->BorderColorAlphaAsS31, 0, 31) |
1826      __gen_uint(values->BorderColorAlphaAsU32, 0, 31) |
1827      __gen_float(values->BorderColorAlphaAsFloat);
1828}
1829
1830#define GFX11_SAMPLER_STATE_length             4
1831struct GFX11_SAMPLER_STATE {
1832   uint32_t                             AnisotropicAlgorithm;
1833#define LEGACY                                   0
1834#define EWAApproximation                         1
1835   float                                TextureLODBias;
1836   uint32_t                             MinModeFilter;
1837#define MAPFILTER_NEAREST                        0
1838#define MAPFILTER_LINEAR                         1
1839#define MAPFILTER_ANISOTROPIC                    2
1840#define MAPFILTER_MONO                           6
1841   uint32_t                             MagModeFilter;
1842#define MAPFILTER_NEAREST                        0
1843#define MAPFILTER_LINEAR                         1
1844#define MAPFILTER_ANISOTROPIC                    2
1845#define MAPFILTER_MONO                           6
1846   uint32_t                             MipModeFilter;
1847#define MIPFILTER_NONE                           0
1848#define MIPFILTER_NEAREST                        1
1849#define MIPFILTER_LINEAR                         3
1850   uint32_t                             CoarseLODQualityMode;
1851   uint32_t                             LODPreClampMode;
1852#define CLAMP_MODE_NONE                          0
1853#define CLAMP_MODE_OGL                           2
1854   uint32_t                             TextureBorderColorMode;
1855#define DX10OGL                                  0
1856#define DX9                                      1
1857   bool                                 CPSLODCompensationEnable;
1858   bool                                 SamplerDisable;
1859   uint32_t                             CubeSurfaceControlMode;
1860#define PROGRAMMED                               0
1861#define OVERRIDE                                 1
1862   uint32_t                             ShadowFunction;
1863#define PREFILTEROP_ALWAYS                       0
1864#define PREFILTEROP_NEVER                        1
1865#define PREFILTEROP_LESS                         2
1866#define PREFILTEROP_EQUAL                        3
1867#define PREFILTEROP_LEQUAL                       4
1868#define PREFILTEROP_GREATER                      5
1869#define PREFILTEROP_NOTEQUAL                     6
1870#define PREFILTEROP_GEQUAL                       7
1871   uint32_t                             ChromaKeyMode;
1872#define KEYFILTER_KILL_ON_ANY_MATCH              0
1873#define KEYFILTER_REPLACE_BLACK                  1
1874   uint32_t                             ChromaKeyIndex;
1875   bool                                 ChromaKeyEnable;
1876   float                                MaxLOD;
1877   float                                MinLOD;
1878   uint32_t                             LODClampMagnificationMode;
1879#define MIPNONE                                  0
1880#define MIPFILTER                                1
1881   uint32_t                             SRGBDECODE;
1882#define DECODE_EXT                               0
1883#define SKIP_DECODE_EXT                          1
1884   uint32_t                             ReturnFilterWeightforNullTexels;
1885   uint32_t                             ReturnFilterWeightforBorderTexels;
1886   bool                                 Forcegather4Behavior;
1887   uint64_t                             BorderColorPointer;
1888   enum GFX11_TextureCoordinateMode     TCZAddressControlMode;
1889   enum GFX11_TextureCoordinateMode     TCYAddressControlMode;
1890   enum GFX11_TextureCoordinateMode     TCXAddressControlMode;
1891   bool                                 ReductionTypeEnable;
1892   bool                                 NonnormalizedCoordinateEnable;
1893   uint32_t                             TrilinearFilterQuality;
1894#define FULL                                     0
1895#define HIGH                                     1
1896#define MED                                      2
1897#define LOW                                      3
1898   bool                                 RAddressMinFilterRoundingEnable;
1899   bool                                 RAddressMagFilterRoundingEnable;
1900   bool                                 VAddressMinFilterRoundingEnable;
1901   bool                                 VAddressMagFilterRoundingEnable;
1902   bool                                 UAddressMinFilterRoundingEnable;
1903   bool                                 UAddressMagFilterRoundingEnable;
1904   uint32_t                             MaximumAnisotropy;
1905#define RATIO21                                  0
1906#define RATIO41                                  1
1907#define RATIO61                                  2
1908#define RATIO81                                  3
1909#define RATIO101                                 4
1910#define RATIO121                                 5
1911#define RATIO141                                 6
1912#define RATIO161                                 7
1913   uint32_t                             ReductionType;
1914#define STD_FILTER                               0
1915#define COMPARISON                               1
1916#define MINIMUM                                  2
1917#define MAXIMUM                                  3
1918};
1919
1920static inline __attribute__((always_inline)) void
1921GFX11_SAMPLER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
1922                         __attribute__((unused)) void * restrict dst,
1923                         __attribute__((unused)) const struct GFX11_SAMPLER_STATE * restrict values)
1924{
1925   uint32_t * restrict dw = (uint32_t * restrict) dst;
1926
1927   dw[0] =
1928      __gen_uint(values->AnisotropicAlgorithm, 0, 0) |
1929      __gen_sfixed(values->TextureLODBias, 1, 13, 8) |
1930      __gen_uint(values->MinModeFilter, 14, 16) |
1931      __gen_uint(values->MagModeFilter, 17, 19) |
1932      __gen_uint(values->MipModeFilter, 20, 21) |
1933      __gen_uint(values->CoarseLODQualityMode, 22, 26) |
1934      __gen_uint(values->LODPreClampMode, 27, 28) |
1935      __gen_uint(values->TextureBorderColorMode, 29, 29) |
1936      __gen_uint(values->CPSLODCompensationEnable, 30, 30) |
1937      __gen_uint(values->SamplerDisable, 31, 31);
1938
1939   dw[1] =
1940      __gen_uint(values->CubeSurfaceControlMode, 0, 0) |
1941      __gen_uint(values->ShadowFunction, 1, 3) |
1942      __gen_uint(values->ChromaKeyMode, 4, 4) |
1943      __gen_uint(values->ChromaKeyIndex, 5, 6) |
1944      __gen_uint(values->ChromaKeyEnable, 7, 7) |
1945      __gen_ufixed(values->MaxLOD, 8, 19, 8) |
1946      __gen_ufixed(values->MinLOD, 20, 31, 8);
1947
1948   dw[2] =
1949      __gen_uint(values->LODClampMagnificationMode, 0, 0) |
1950      __gen_uint(values->SRGBDECODE, 1, 1) |
1951      __gen_uint(values->ReturnFilterWeightforNullTexels, 2, 2) |
1952      __gen_uint(values->ReturnFilterWeightforBorderTexels, 3, 3) |
1953      __gen_uint(values->Forcegather4Behavior, 5, 5) |
1954      __gen_offset(values->BorderColorPointer, 6, 23);
1955
1956   dw[3] =
1957      __gen_uint(values->TCZAddressControlMode, 0, 2) |
1958      __gen_uint(values->TCYAddressControlMode, 3, 5) |
1959      __gen_uint(values->TCXAddressControlMode, 6, 8) |
1960      __gen_uint(values->ReductionTypeEnable, 9, 9) |
1961      __gen_uint(values->NonnormalizedCoordinateEnable, 10, 10) |
1962      __gen_uint(values->TrilinearFilterQuality, 11, 12) |
1963      __gen_uint(values->RAddressMinFilterRoundingEnable, 13, 13) |
1964      __gen_uint(values->RAddressMagFilterRoundingEnable, 14, 14) |
1965      __gen_uint(values->VAddressMinFilterRoundingEnable, 15, 15) |
1966      __gen_uint(values->VAddressMagFilterRoundingEnable, 16, 16) |
1967      __gen_uint(values->UAddressMinFilterRoundingEnable, 17, 17) |
1968      __gen_uint(values->UAddressMagFilterRoundingEnable, 18, 18) |
1969      __gen_uint(values->MaximumAnisotropy, 19, 21) |
1970      __gen_uint(values->ReductionType, 22, 23);
1971}
1972
1973#define GFX11_SAMPLER_STATE_8X8_AVS_COEFFICIENTS_length      8
1974struct GFX11_SAMPLER_STATE_8X8_AVS_COEFFICIENTS {
1975   float                                Table0FilterCoefficient[4];
1976   float                                Table1FilterCoefficient0[4];
1977   float                                Table1FilterCoefficient1[4];
1978};
1979
1980static inline __attribute__((always_inline)) void
1981GFX11_SAMPLER_STATE_8X8_AVS_COEFFICIENTS_pack(__attribute__((unused)) __gen_user_data *data,
1982                                              __attribute__((unused)) void * restrict dst,
1983                                              __attribute__((unused)) const struct GFX11_SAMPLER_STATE_8X8_AVS_COEFFICIENTS * restrict values)
1984{
1985   uint32_t * restrict dw = (uint32_t * restrict) dst;
1986
1987   dw[0] =
1988      __gen_sfixed(values->Table0FilterCoefficient[0], 0, 7, 6) |
1989      __gen_sfixed(values->Table0FilterCoefficient[1], 8, 15, 6) |
1990      __gen_sfixed(values->Table0FilterCoefficient[2], 16, 23, 6) |
1991      __gen_sfixed(values->Table0FilterCoefficient[3], 24, 31, 6) |
1992      __gen_sfixed(values->Table1FilterCoefficient0[0], 0, 7, 6) |
1993      __gen_sfixed(values->Table1FilterCoefficient1[0], 8, 15, 6);
1994
1995   dw[1] =
1996      __gen_sfixed(values->Table1FilterCoefficient0[1], 0, 7, 6) |
1997      __gen_sfixed(values->Table1FilterCoefficient1[1], 8, 15, 6);
1998
1999   dw[2] =
2000      __gen_sfixed(values->Table1FilterCoefficient0[2], 0, 7, 6) |
2001      __gen_sfixed(values->Table1FilterCoefficient1[2], 8, 15, 6);
2002
2003   dw[3] =
2004      __gen_sfixed(values->Table1FilterCoefficient0[3], 0, 7, 6) |
2005      __gen_sfixed(values->Table1FilterCoefficient1[3], 8, 15, 6);
2006
2007   dw[4] = 0;
2008
2009   dw[5] = 0;
2010
2011   dw[6] = 0;
2012
2013   dw[7] = 0;
2014}
2015
2016#define GFX11_SCISSOR_RECT_length              2
2017struct GFX11_SCISSOR_RECT {
2018   uint32_t                             ScissorRectangleXMin;
2019   uint32_t                             ScissorRectangleYMin;
2020   uint32_t                             ScissorRectangleXMax;
2021   uint32_t                             ScissorRectangleYMax;
2022};
2023
2024static inline __attribute__((always_inline)) void
2025GFX11_SCISSOR_RECT_pack(__attribute__((unused)) __gen_user_data *data,
2026                        __attribute__((unused)) void * restrict dst,
2027                        __attribute__((unused)) const struct GFX11_SCISSOR_RECT * restrict values)
2028{
2029   uint32_t * restrict dw = (uint32_t * restrict) dst;
2030
2031   dw[0] =
2032      __gen_uint(values->ScissorRectangleXMin, 0, 15) |
2033      __gen_uint(values->ScissorRectangleYMin, 16, 31);
2034
2035   dw[1] =
2036      __gen_uint(values->ScissorRectangleXMax, 0, 15) |
2037      __gen_uint(values->ScissorRectangleYMax, 16, 31);
2038}
2039
2040#define GFX11_SFC_AVS_CHROMA_COEFF_TABLE_BODY_length     64
2041struct GFX11_SFC_AVS_CHROMA_COEFF_TABLE_BODY {
2042   float                                Table1XFilterCoefficientn2;
2043   float                                Table1YFilterCoefficientn2;
2044   float                                Table1XFilterCoefficientn3;
2045   float                                Table1YFilterCoefficientn3;
2046   float                                Table1XFilterCoefficientn4;
2047   float                                Table1YFilterCoefficientn4;
2048   float                                Table1XFilterCoefficientn5;
2049   float                                Table1YFilterCoefficientn5;
2050   struct GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY FilterCoefficients[31];
2051};
2052
2053static inline __attribute__((always_inline)) void
2054GFX11_SFC_AVS_CHROMA_COEFF_TABLE_BODY_pack(__attribute__((unused)) __gen_user_data *data,
2055                                           __attribute__((unused)) void * restrict dst,
2056                                           __attribute__((unused)) const struct GFX11_SFC_AVS_CHROMA_COEFF_TABLE_BODY * restrict values)
2057{
2058   uint32_t * restrict dw = (uint32_t * restrict) dst;
2059
2060   dw[0] =
2061      __gen_sfixed(values->Table1XFilterCoefficientn2, 0, 7, 6) |
2062      __gen_sfixed(values->Table1YFilterCoefficientn2, 8, 15, 6) |
2063      __gen_sfixed(values->Table1XFilterCoefficientn3, 16, 23, 6) |
2064      __gen_sfixed(values->Table1YFilterCoefficientn3, 24, 31, 6);
2065
2066   dw[1] =
2067      __gen_sfixed(values->Table1XFilterCoefficientn4, 0, 7, 6) |
2068      __gen_sfixed(values->Table1YFilterCoefficientn4, 8, 15, 6) |
2069      __gen_sfixed(values->Table1XFilterCoefficientn5, 16, 23, 6) |
2070      __gen_sfixed(values->Table1YFilterCoefficientn5, 24, 31, 6);
2071
2072   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[2], &values->FilterCoefficients[0]);
2073
2074   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[4], &values->FilterCoefficients[1]);
2075
2076   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[6], &values->FilterCoefficients[2]);
2077
2078   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[8], &values->FilterCoefficients[3]);
2079
2080   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[10], &values->FilterCoefficients[4]);
2081
2082   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[12], &values->FilterCoefficients[5]);
2083
2084   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[14], &values->FilterCoefficients[6]);
2085
2086   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[16], &values->FilterCoefficients[7]);
2087
2088   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[18], &values->FilterCoefficients[8]);
2089
2090   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[20], &values->FilterCoefficients[9]);
2091
2092   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[22], &values->FilterCoefficients[10]);
2093
2094   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[24], &values->FilterCoefficients[11]);
2095
2096   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[26], &values->FilterCoefficients[12]);
2097
2098   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[28], &values->FilterCoefficients[13]);
2099
2100   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[30], &values->FilterCoefficients[14]);
2101
2102   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[32], &values->FilterCoefficients[15]);
2103
2104   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[34], &values->FilterCoefficients[16]);
2105
2106   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[36], &values->FilterCoefficients[17]);
2107
2108   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[38], &values->FilterCoefficients[18]);
2109
2110   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[40], &values->FilterCoefficients[19]);
2111
2112   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[42], &values->FilterCoefficients[20]);
2113
2114   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[44], &values->FilterCoefficients[21]);
2115
2116   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[46], &values->FilterCoefficients[22]);
2117
2118   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[48], &values->FilterCoefficients[23]);
2119
2120   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[50], &values->FilterCoefficients[24]);
2121
2122   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[52], &values->FilterCoefficients[25]);
2123
2124   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[54], &values->FilterCoefficients[26]);
2125
2126   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[56], &values->FilterCoefficients[27]);
2127
2128   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[58], &values->FilterCoefficients[28]);
2129
2130   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[60], &values->FilterCoefficients[29]);
2131
2132   GFX11_CHROMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[62], &values->FilterCoefficients[30]);
2133}
2134
2135#define GFX11_SFC_AVS_LUMA_COEFF_TABLE_BODY_length    128
2136struct GFX11_SFC_AVS_LUMA_COEFF_TABLE_BODY {
2137   float                                Table0XFilterCoefficientn0;
2138   float                                Table0YFilterCoefficientn0;
2139   float                                Table0XFilterCoefficientn1;
2140   float                                Table0YFilterCoefficientn1;
2141   float                                Table0XFilterCoefficientn2;
2142   float                                Table0YFilterCoefficientn2;
2143   float                                Table0XFilterCoefficientn3;
2144   float                                Table0YFilterCoefficientn3;
2145   float                                Table0XFilterCoefficientn4;
2146   float                                Table0YFilterCoefficientn4;
2147   float                                Table0XFilterCoefficientn5;
2148   float                                Table0YFilterCoefficientn5;
2149   float                                Table0XFilterCoefficientn6;
2150   float                                Table0YFilterCoefficientn6;
2151   float                                Table0XFilterCoefficientn7;
2152   float                                Table0YFilterCoefficientn7;
2153   struct GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY FilterCoefficients[31];
2154};
2155
2156static inline __attribute__((always_inline)) void
2157GFX11_SFC_AVS_LUMA_COEFF_TABLE_BODY_pack(__attribute__((unused)) __gen_user_data *data,
2158                                         __attribute__((unused)) void * restrict dst,
2159                                         __attribute__((unused)) const struct GFX11_SFC_AVS_LUMA_COEFF_TABLE_BODY * restrict values)
2160{
2161   uint32_t * restrict dw = (uint32_t * restrict) dst;
2162
2163   dw[0] =
2164      __gen_sfixed(values->Table0XFilterCoefficientn0, 0, 7, 6) |
2165      __gen_sfixed(values->Table0YFilterCoefficientn0, 8, 15, 6) |
2166      __gen_sfixed(values->Table0XFilterCoefficientn1, 16, 23, 6) |
2167      __gen_sfixed(values->Table0YFilterCoefficientn1, 24, 31, 6);
2168
2169   dw[1] =
2170      __gen_sfixed(values->Table0XFilterCoefficientn2, 0, 7, 6) |
2171      __gen_sfixed(values->Table0YFilterCoefficientn2, 8, 15, 6) |
2172      __gen_sfixed(values->Table0XFilterCoefficientn3, 16, 23, 6) |
2173      __gen_sfixed(values->Table0YFilterCoefficientn3, 24, 31, 6);
2174
2175   dw[2] =
2176      __gen_sfixed(values->Table0XFilterCoefficientn4, 0, 7, 6) |
2177      __gen_sfixed(values->Table0YFilterCoefficientn4, 8, 15, 6) |
2178      __gen_sfixed(values->Table0XFilterCoefficientn5, 16, 23, 6) |
2179      __gen_sfixed(values->Table0YFilterCoefficientn5, 24, 31, 6);
2180
2181   dw[3] =
2182      __gen_sfixed(values->Table0XFilterCoefficientn6, 0, 7, 6) |
2183      __gen_sfixed(values->Table0YFilterCoefficientn6, 8, 15, 6) |
2184      __gen_sfixed(values->Table0XFilterCoefficientn7, 16, 23, 6) |
2185      __gen_sfixed(values->Table0YFilterCoefficientn7, 24, 31, 6);
2186
2187   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[4], &values->FilterCoefficients[0]);
2188
2189   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[8], &values->FilterCoefficients[1]);
2190
2191   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[12], &values->FilterCoefficients[2]);
2192
2193   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[16], &values->FilterCoefficients[3]);
2194
2195   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[20], &values->FilterCoefficients[4]);
2196
2197   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[24], &values->FilterCoefficients[5]);
2198
2199   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[28], &values->FilterCoefficients[6]);
2200
2201   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[32], &values->FilterCoefficients[7]);
2202
2203   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[36], &values->FilterCoefficients[8]);
2204
2205   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[40], &values->FilterCoefficients[9]);
2206
2207   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[44], &values->FilterCoefficients[10]);
2208
2209   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[48], &values->FilterCoefficients[11]);
2210
2211   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[52], &values->FilterCoefficients[12]);
2212
2213   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[56], &values->FilterCoefficients[13]);
2214
2215   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[60], &values->FilterCoefficients[14]);
2216
2217   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[64], &values->FilterCoefficients[15]);
2218
2219   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[68], &values->FilterCoefficients[16]);
2220
2221   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[72], &values->FilterCoefficients[17]);
2222
2223   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[76], &values->FilterCoefficients[18]);
2224
2225   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[80], &values->FilterCoefficients[19]);
2226
2227   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[84], &values->FilterCoefficients[20]);
2228
2229   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[88], &values->FilterCoefficients[21]);
2230
2231   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[92], &values->FilterCoefficients[22]);
2232
2233   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[96], &values->FilterCoefficients[23]);
2234
2235   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[100], &values->FilterCoefficients[24]);
2236
2237   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[104], &values->FilterCoefficients[25]);
2238
2239   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[108], &values->FilterCoefficients[26]);
2240
2241   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[112], &values->FilterCoefficients[27]);
2242
2243   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[116], &values->FilterCoefficients[28]);
2244
2245   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[120], &values->FilterCoefficients[29]);
2246
2247   GFX11_LUMA_FILTER_COEFFICIENTS_ARRAY_pack(data, &dw[124], &values->FilterCoefficients[30]);
2248}
2249
2250#define GFX11_SFC_AVS_STATE_BODY_length        3
2251struct GFX11_SFC_AVS_STATE_BODY {
2252   uint32_t                             TransitionAreawith8Pixels;
2253   uint32_t                             TransitionAreawith4Pixels;
2254   uint32_t                             SharpnessLevel;
2255   uint32_t                             MaxDerivative8Pixels;
2256   uint32_t                             MaxDerivative4Pixels;
2257   uint32_t                             InputVerticalSiting;
2258#define _18                                      1
2259#define _28                                      2
2260#define _38                                      3
2261#define _48                                      4
2262#define _58                                      5
2263#define _68                                      6
2264#define _78                                      7
2265#define _88                                      8
2266};
2267
2268static inline __attribute__((always_inline)) void
2269GFX11_SFC_AVS_STATE_BODY_pack(__attribute__((unused)) __gen_user_data *data,
2270                              __attribute__((unused)) void * restrict dst,
2271                              __attribute__((unused)) const struct GFX11_SFC_AVS_STATE_BODY * restrict values)
2272{
2273   uint32_t * restrict dw = (uint32_t * restrict) dst;
2274
2275   dw[0] =
2276      __gen_uint(values->TransitionAreawith8Pixels, 0, 2) |
2277      __gen_uint(values->TransitionAreawith4Pixels, 4, 6) |
2278      __gen_uint(values->SharpnessLevel, 24, 31);
2279
2280   dw[1] =
2281      __gen_uint(values->MaxDerivative8Pixels, 0, 7) |
2282      __gen_uint(values->MaxDerivative4Pixels, 16, 23);
2283
2284   dw[2] =
2285      __gen_uint(values->InputVerticalSiting, 0, 3);
2286}
2287
2288#define GFX11_SFC_IEF_STATE_BODY_length       23
2289struct GFX11_SFC_IEF_STATE_BODY {
2290   uint32_t                             GainFactor;
2291   uint32_t                             WeakEdgeThreshold;
2292   uint32_t                             StrongEdgeThreshold;
2293   float                                R3xCoefficient;
2294   float                                R3cCoefficient;
2295   uint32_t                             GlobalNoiseEstimation;
2296   uint32_t                             NonEdgeWeight;
2297   uint32_t                             RegularWeight;
2298   uint32_t                             StrongEdgeWeight;
2299   float                                R5xCoefficient;
2300   float                                R5cxCoefficient;
2301   float                                R5cCoefficient;
2302   float                                STDSinalpha;
2303   float                                STDCosalpha;
2304   uint32_t                             Sat_Max;
2305   uint32_t                             Hue_Max;
2306   float                                S3U;
2307   uint32_t                             DiamondMargin;
2308   bool                                 VY_STD_Enable;
2309   uint32_t                             U_Mid;
2310   uint32_t                             V_Mid;
2311   int32_t                              Diamond_dv;
2312   uint32_t                             Diamond_Th;
2313   float                                Diamond_alpha;
2314   uint32_t                             HS_margin;
2315   int32_t                              Diamond_du;
2316   uint32_t                             SkinDetailFactor;
2317#define DetailRevealed                           0
2318#define NotDetailRevealed                        1
2319   uint32_t                             Y_point_1;
2320   uint32_t                             Y_point_2;
2321   uint32_t                             Y_point_3;
2322   uint32_t                             Y_point_4;
2323   float                                INV_Margin_VYL;
2324   float                                INV_Margin_VYU;
2325   uint32_t                             P0L;
2326   uint32_t                             P1L;
2327   uint32_t                             P2L;
2328   uint32_t                             P3L;
2329   uint32_t                             B0L;
2330   uint32_t                             B1L;
2331   uint32_t                             B2L;
2332   uint32_t                             B3L;
2333   float                                S0L;
2334   float                                Y_Slope_2;
2335   float                                S1L;
2336   float                                S2L;
2337   float                                S3L;
2338   uint32_t                             P0U;
2339   uint32_t                             P1U;
2340   float                                Y_Slope1;
2341   uint32_t                             P2U;
2342   uint32_t                             P3U;
2343   uint32_t                             B0U;
2344   uint32_t                             B1U;
2345   uint32_t                             B2U;
2346   uint32_t                             B3U;
2347   float                                S0U;
2348   float                                S1U;
2349   float                                S2U;
2350   bool                                 TransformEnable;
2351   bool                                 YUVChannelSwap;
2352   float                                C0;
2353   float                                C1;
2354   float                                C2;
2355   float                                C3;
2356   float                                C4;
2357   float                                C5;
2358   float                                C6;
2359   float                                C7;
2360   float                                C8;
2361   float                                OffsetIn1;
2362   float                                OffsetOut1;
2363   float                                OffsetIn2;
2364   float                                OffsetOut2;
2365   float                                OffsetIn3;
2366   float                                OffsetOut3;
2367};
2368
2369static inline __attribute__((always_inline)) void
2370GFX11_SFC_IEF_STATE_BODY_pack(__attribute__((unused)) __gen_user_data *data,
2371                              __attribute__((unused)) void * restrict dst,
2372                              __attribute__((unused)) const struct GFX11_SFC_IEF_STATE_BODY * restrict values)
2373{
2374   uint32_t * restrict dw = (uint32_t * restrict) dst;
2375
2376   dw[0] =
2377      __gen_uint(values->GainFactor, 0, 5) |
2378      __gen_uint(values->WeakEdgeThreshold, 6, 11) |
2379      __gen_uint(values->StrongEdgeThreshold, 12, 17) |
2380      __gen_ufixed(values->R3xCoefficient, 18, 22, 5) |
2381      __gen_ufixed(values->R3cCoefficient, 23, 27, 5);
2382
2383   dw[1] =
2384      __gen_uint(values->GlobalNoiseEstimation, 0, 7) |
2385      __gen_uint(values->NonEdgeWeight, 8, 10) |
2386      __gen_uint(values->RegularWeight, 11, 13) |
2387      __gen_uint(values->StrongEdgeWeight, 14, 16) |
2388      __gen_ufixed(values->R5xCoefficient, 17, 21, 5) |
2389      __gen_ufixed(values->R5cxCoefficient, 22, 26, 5) |
2390      __gen_ufixed(values->R5cCoefficient, 27, 31, 5);
2391
2392   dw[2] =
2393      __gen_sfixed(values->STDSinalpha, 0, 7, 7) |
2394      __gen_sfixed(values->STDCosalpha, 8, 15, 7) |
2395      __gen_uint(values->Sat_Max, 16, 21) |
2396      __gen_uint(values->Hue_Max, 22, 27);
2397
2398   dw[3] =
2399      __gen_sfixed(values->S3U, 0, 10, 8) |
2400      __gen_uint(values->DiamondMargin, 12, 14) |
2401      __gen_uint(values->VY_STD_Enable, 15, 15) |
2402      __gen_uint(values->U_Mid, 16, 23) |
2403      __gen_uint(values->V_Mid, 24, 31);
2404
2405   dw[4] =
2406      __gen_sint(values->Diamond_dv, 0, 6) |
2407      __gen_uint(values->Diamond_Th, 7, 12) |
2408      __gen_ufixed(values->Diamond_alpha, 13, 20, 6) |
2409      __gen_uint(values->HS_margin, 21, 23) |
2410      __gen_sint(values->Diamond_du, 24, 30) |
2411      __gen_uint(values->SkinDetailFactor, 31, 31);
2412
2413   dw[5] =
2414      __gen_uint(values->Y_point_1, 0, 7) |
2415      __gen_uint(values->Y_point_2, 8, 15) |
2416      __gen_uint(values->Y_point_3, 16, 23) |
2417      __gen_uint(values->Y_point_4, 24, 31);
2418
2419   dw[6] =
2420      __gen_ufixed(values->INV_Margin_VYL, 0, 15, 16);
2421
2422   dw[7] =
2423      __gen_ufixed(values->INV_Margin_VYU, 0, 15, 16) |
2424      __gen_uint(values->P0L, 16, 23) |
2425      __gen_uint(values->P1L, 24, 31);
2426
2427   dw[8] =
2428      __gen_uint(values->P2L, 0, 7) |
2429      __gen_uint(values->P3L, 8, 15) |
2430      __gen_uint(values->B0L, 16, 23) |
2431      __gen_uint(values->B1L, 24, 31);
2432
2433   dw[9] =
2434      __gen_uint(values->B2L, 0, 7) |
2435      __gen_uint(values->B3L, 8, 15) |
2436      __gen_sfixed(values->S0L, 16, 26, 8) |
2437      __gen_ufixed(values->Y_Slope_2, 27, 31, 3);
2438
2439   dw[10] =
2440      __gen_sfixed(values->S1L, 0, 10, 8) |
2441      __gen_sfixed(values->S2L, 11, 21, 8);
2442
2443   dw[11] =
2444      __gen_sfixed(values->S3L, 0, 10, 8) |
2445      __gen_uint(values->P0U, 11, 18) |
2446      __gen_uint(values->P1U, 19, 26) |
2447      __gen_ufixed(values->Y_Slope1, 27, 31, 3);
2448
2449   dw[12] =
2450      __gen_uint(values->P2U, 0, 7) |
2451      __gen_uint(values->P3U, 8, 15) |
2452      __gen_uint(values->B0U, 16, 23) |
2453      __gen_uint(values->B1U, 24, 31);
2454
2455   dw[13] =
2456      __gen_uint(values->B2U, 0, 7) |
2457      __gen_uint(values->B3U, 8, 15) |
2458      __gen_sfixed(values->S0U, 16, 26, 8);
2459
2460   dw[14] =
2461      __gen_sfixed(values->S1U, 0, 10, 8) |
2462      __gen_sfixed(values->S2U, 11, 21, 8);
2463
2464   dw[15] =
2465      __gen_uint(values->TransformEnable, 0, 0) |
2466      __gen_uint(values->YUVChannelSwap, 1, 1) |
2467      __gen_sfixed(values->C0, 3, 15, 10) |
2468      __gen_sfixed(values->C1, 16, 28, 10);
2469
2470   dw[16] =
2471      __gen_sfixed(values->C2, 0, 12, 10) |
2472      __gen_sfixed(values->C3, 13, 25, 10);
2473
2474   dw[17] =
2475      __gen_sfixed(values->C4, 0, 12, 10) |
2476      __gen_sfixed(values->C5, 13, 25, 10);
2477
2478   dw[18] =
2479      __gen_sfixed(values->C6, 0, 12, 10) |
2480      __gen_sfixed(values->C7, 13, 25, 10);
2481
2482   dw[19] =
2483      __gen_sfixed(values->C8, 0, 12, 10);
2484
2485   dw[20] =
2486      __gen_sfixed(values->OffsetIn1, 0, 10, 8) |
2487      __gen_sfixed(values->OffsetOut1, 11, 21, 8);
2488
2489   dw[21] =
2490      __gen_sfixed(values->OffsetIn2, 0, 10, 8) |
2491      __gen_sfixed(values->OffsetOut2, 11, 21, 8);
2492
2493   dw[22] =
2494      __gen_sfixed(values->OffsetIn3, 0, 10, 8) |
2495      __gen_sfixed(values->OffsetOut3, 11, 21, 8);
2496}
2497
2498#define GFX11_SFC_LOCK_BODY_length             1
2499struct GFX11_SFC_LOCK_BODY {
2500   uint32_t                             VESFCPipeSelect;
2501   bool                                 PreScaledOutputSurfaceOutputEnable;
2502};
2503
2504static inline __attribute__((always_inline)) void
2505GFX11_SFC_LOCK_BODY_pack(__attribute__((unused)) __gen_user_data *data,
2506                         __attribute__((unused)) void * restrict dst,
2507                         __attribute__((unused)) const struct GFX11_SFC_LOCK_BODY * restrict values)
2508{
2509   uint32_t * restrict dw = (uint32_t * restrict) dst;
2510
2511   dw[0] =
2512      __gen_uint(values->VESFCPipeSelect, 0, 0) |
2513      __gen_uint(values->PreScaledOutputSurfaceOutputEnable, 1, 1);
2514}
2515
2516#define GFX11_SF_CLIP_VIEWPORT_length         16
2517struct GFX11_SF_CLIP_VIEWPORT {
2518   float                                ViewportMatrixElementm00;
2519   float                                ViewportMatrixElementm11;
2520   float                                ViewportMatrixElementm22;
2521   float                                ViewportMatrixElementm30;
2522   float                                ViewportMatrixElementm31;
2523   float                                ViewportMatrixElementm32;
2524   float                                XMinClipGuardband;
2525   float                                XMaxClipGuardband;
2526   float                                YMinClipGuardband;
2527   float                                YMaxClipGuardband;
2528   float                                XMinViewPort;
2529   float                                XMaxViewPort;
2530   float                                YMinViewPort;
2531   float                                YMaxViewPort;
2532};
2533
2534static inline __attribute__((always_inline)) void
2535GFX11_SF_CLIP_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
2536                            __attribute__((unused)) void * restrict dst,
2537                            __attribute__((unused)) const struct GFX11_SF_CLIP_VIEWPORT * restrict values)
2538{
2539   uint32_t * restrict dw = (uint32_t * restrict) dst;
2540
2541   dw[0] =
2542      __gen_float(values->ViewportMatrixElementm00);
2543
2544   dw[1] =
2545      __gen_float(values->ViewportMatrixElementm11);
2546
2547   dw[2] =
2548      __gen_float(values->ViewportMatrixElementm22);
2549
2550   dw[3] =
2551      __gen_float(values->ViewportMatrixElementm30);
2552
2553   dw[4] =
2554      __gen_float(values->ViewportMatrixElementm31);
2555
2556   dw[5] =
2557      __gen_float(values->ViewportMatrixElementm32);
2558
2559   dw[6] = 0;
2560
2561   dw[7] = 0;
2562
2563   dw[8] =
2564      __gen_float(values->XMinClipGuardband);
2565
2566   dw[9] =
2567      __gen_float(values->XMaxClipGuardband);
2568
2569   dw[10] =
2570      __gen_float(values->YMinClipGuardband);
2571
2572   dw[11] =
2573      __gen_float(values->YMaxClipGuardband);
2574
2575   dw[12] =
2576      __gen_float(values->XMinViewPort);
2577
2578   dw[13] =
2579      __gen_float(values->XMaxViewPort);
2580
2581   dw[14] =
2582      __gen_float(values->YMinViewPort);
2583
2584   dw[15] =
2585      __gen_float(values->YMaxViewPort);
2586}
2587
2588#define GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL_length      1
2589struct GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL {
2590   uint32_t                             SourceAttribute;
2591   uint32_t                             SwizzleSelect;
2592#define INPUTATTR                                0
2593#define INPUTATTR_FACING                         1
2594#define INPUTATTR_W                              2
2595#define INPUTATTR_FACING_W                       3
2596   uint32_t                             ConstantSource;
2597#define CONST_0000                               0
2598#define CONST_0001_FLOAT                         1
2599#define CONST_1111_FLOAT                         2
2600#define PRIM_ID                                  3
2601   uint32_t                             SwizzleControlMode;
2602   bool                                 ComponentOverrideX;
2603   bool                                 ComponentOverrideY;
2604   bool                                 ComponentOverrideZ;
2605   bool                                 ComponentOverrideW;
2606};
2607
2608static inline __attribute__((always_inline)) void
2609GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(__attribute__((unused)) __gen_user_data *data,
2610                                      __attribute__((unused)) void * restrict dst,
2611                                      __attribute__((unused)) const struct GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL * restrict values)
2612{
2613   uint32_t * restrict dw = (uint32_t * restrict) dst;
2614
2615   dw[0] =
2616      __gen_uint(values->SourceAttribute, 0, 4) |
2617      __gen_uint(values->SwizzleSelect, 6, 7) |
2618      __gen_uint(values->ConstantSource, 9, 10) |
2619      __gen_uint(values->SwizzleControlMode, 11, 11) |
2620      __gen_uint(values->ComponentOverrideX, 12, 12) |
2621      __gen_uint(values->ComponentOverrideY, 13, 13) |
2622      __gen_uint(values->ComponentOverrideZ, 14, 14) |
2623      __gen_uint(values->ComponentOverrideW, 15, 15);
2624}
2625
2626#define GFX11_SLICE_HASH_TABLE_length         32
2627struct GFX11_SLICE_HASH_TABLE {
2628   uint32_t                             Entry[16][16];
2629};
2630
2631static inline __attribute__((always_inline)) void
2632GFX11_SLICE_HASH_TABLE_pack(__attribute__((unused)) __gen_user_data *data,
2633                            __attribute__((unused)) void * restrict dst,
2634                            __attribute__((unused)) const struct GFX11_SLICE_HASH_TABLE * restrict values)
2635{
2636   uint32_t * restrict dw = (uint32_t * restrict) dst;
2637
2638   dw[0] =
2639      __gen_uint(values->Entry[0][0], 0, 3) |
2640      __gen_uint(values->Entry[0][1], 4, 7) |
2641      __gen_uint(values->Entry[0][2], 8, 11) |
2642      __gen_uint(values->Entry[0][3], 12, 15) |
2643      __gen_uint(values->Entry[0][4], 16, 19) |
2644      __gen_uint(values->Entry[0][5], 20, 23) |
2645      __gen_uint(values->Entry[0][6], 24, 27) |
2646      __gen_uint(values->Entry[0][7], 28, 31);
2647
2648   dw[1] =
2649      __gen_uint(values->Entry[0][8], 0, 3) |
2650      __gen_uint(values->Entry[0][9], 4, 7) |
2651      __gen_uint(values->Entry[0][10], 8, 11) |
2652      __gen_uint(values->Entry[0][11], 12, 15) |
2653      __gen_uint(values->Entry[0][12], 16, 19) |
2654      __gen_uint(values->Entry[0][13], 20, 23) |
2655      __gen_uint(values->Entry[0][14], 24, 27) |
2656      __gen_uint(values->Entry[0][15], 28, 31);
2657
2658   dw[2] =
2659      __gen_uint(values->Entry[1][0], 0, 3) |
2660      __gen_uint(values->Entry[1][1], 4, 7) |
2661      __gen_uint(values->Entry[1][2], 8, 11) |
2662      __gen_uint(values->Entry[1][3], 12, 15) |
2663      __gen_uint(values->Entry[1][4], 16, 19) |
2664      __gen_uint(values->Entry[1][5], 20, 23) |
2665      __gen_uint(values->Entry[1][6], 24, 27) |
2666      __gen_uint(values->Entry[1][7], 28, 31);
2667
2668   dw[3] =
2669      __gen_uint(values->Entry[1][8], 0, 3) |
2670      __gen_uint(values->Entry[1][9], 4, 7) |
2671      __gen_uint(values->Entry[1][10], 8, 11) |
2672      __gen_uint(values->Entry[1][11], 12, 15) |
2673      __gen_uint(values->Entry[1][12], 16, 19) |
2674      __gen_uint(values->Entry[1][13], 20, 23) |
2675      __gen_uint(values->Entry[1][14], 24, 27) |
2676      __gen_uint(values->Entry[1][15], 28, 31);
2677
2678   dw[4] =
2679      __gen_uint(values->Entry[2][0], 0, 3) |
2680      __gen_uint(values->Entry[2][1], 4, 7) |
2681      __gen_uint(values->Entry[2][2], 8, 11) |
2682      __gen_uint(values->Entry[2][3], 12, 15) |
2683      __gen_uint(values->Entry[2][4], 16, 19) |
2684      __gen_uint(values->Entry[2][5], 20, 23) |
2685      __gen_uint(values->Entry[2][6], 24, 27) |
2686      __gen_uint(values->Entry[2][7], 28, 31);
2687
2688   dw[5] =
2689      __gen_uint(values->Entry[2][8], 0, 3) |
2690      __gen_uint(values->Entry[2][9], 4, 7) |
2691      __gen_uint(values->Entry[2][10], 8, 11) |
2692      __gen_uint(values->Entry[2][11], 12, 15) |
2693      __gen_uint(values->Entry[2][12], 16, 19) |
2694      __gen_uint(values->Entry[2][13], 20, 23) |
2695      __gen_uint(values->Entry[2][14], 24, 27) |
2696      __gen_uint(values->Entry[2][15], 28, 31);
2697
2698   dw[6] =
2699      __gen_uint(values->Entry[3][0], 0, 3) |
2700      __gen_uint(values->Entry[3][1], 4, 7) |
2701      __gen_uint(values->Entry[3][2], 8, 11) |
2702      __gen_uint(values->Entry[3][3], 12, 15) |
2703      __gen_uint(values->Entry[3][4], 16, 19) |
2704      __gen_uint(values->Entry[3][5], 20, 23) |
2705      __gen_uint(values->Entry[3][6], 24, 27) |
2706      __gen_uint(values->Entry[3][7], 28, 31);
2707
2708   dw[7] =
2709      __gen_uint(values->Entry[3][8], 0, 3) |
2710      __gen_uint(values->Entry[3][9], 4, 7) |
2711      __gen_uint(values->Entry[3][10], 8, 11) |
2712      __gen_uint(values->Entry[3][11], 12, 15) |
2713      __gen_uint(values->Entry[3][12], 16, 19) |
2714      __gen_uint(values->Entry[3][13], 20, 23) |
2715      __gen_uint(values->Entry[3][14], 24, 27) |
2716      __gen_uint(values->Entry[3][15], 28, 31);
2717
2718   dw[8] =
2719      __gen_uint(values->Entry[4][0], 0, 3) |
2720      __gen_uint(values->Entry[4][1], 4, 7) |
2721      __gen_uint(values->Entry[4][2], 8, 11) |
2722      __gen_uint(values->Entry[4][3], 12, 15) |
2723      __gen_uint(values->Entry[4][4], 16, 19) |
2724      __gen_uint(values->Entry[4][5], 20, 23) |
2725      __gen_uint(values->Entry[4][6], 24, 27) |
2726      __gen_uint(values->Entry[4][7], 28, 31);
2727
2728   dw[9] =
2729      __gen_uint(values->Entry[4][8], 0, 3) |
2730      __gen_uint(values->Entry[4][9], 4, 7) |
2731      __gen_uint(values->Entry[4][10], 8, 11) |
2732      __gen_uint(values->Entry[4][11], 12, 15) |
2733      __gen_uint(values->Entry[4][12], 16, 19) |
2734      __gen_uint(values->Entry[4][13], 20, 23) |
2735      __gen_uint(values->Entry[4][14], 24, 27) |
2736      __gen_uint(values->Entry[4][15], 28, 31);
2737
2738   dw[10] =
2739      __gen_uint(values->Entry[5][0], 0, 3) |
2740      __gen_uint(values->Entry[5][1], 4, 7) |
2741      __gen_uint(values->Entry[5][2], 8, 11) |
2742      __gen_uint(values->Entry[5][3], 12, 15) |
2743      __gen_uint(values->Entry[5][4], 16, 19) |
2744      __gen_uint(values->Entry[5][5], 20, 23) |
2745      __gen_uint(values->Entry[5][6], 24, 27) |
2746      __gen_uint(values->Entry[5][7], 28, 31);
2747
2748   dw[11] =
2749      __gen_uint(values->Entry[5][8], 0, 3) |
2750      __gen_uint(values->Entry[5][9], 4, 7) |
2751      __gen_uint(values->Entry[5][10], 8, 11) |
2752      __gen_uint(values->Entry[5][11], 12, 15) |
2753      __gen_uint(values->Entry[5][12], 16, 19) |
2754      __gen_uint(values->Entry[5][13], 20, 23) |
2755      __gen_uint(values->Entry[5][14], 24, 27) |
2756      __gen_uint(values->Entry[5][15], 28, 31);
2757
2758   dw[12] =
2759      __gen_uint(values->Entry[6][0], 0, 3) |
2760      __gen_uint(values->Entry[6][1], 4, 7) |
2761      __gen_uint(values->Entry[6][2], 8, 11) |
2762      __gen_uint(values->Entry[6][3], 12, 15) |
2763      __gen_uint(values->Entry[6][4], 16, 19) |
2764      __gen_uint(values->Entry[6][5], 20, 23) |
2765      __gen_uint(values->Entry[6][6], 24, 27) |
2766      __gen_uint(values->Entry[6][7], 28, 31);
2767
2768   dw[13] =
2769      __gen_uint(values->Entry[6][8], 0, 3) |
2770      __gen_uint(values->Entry[6][9], 4, 7) |
2771      __gen_uint(values->Entry[6][10], 8, 11) |
2772      __gen_uint(values->Entry[6][11], 12, 15) |
2773      __gen_uint(values->Entry[6][12], 16, 19) |
2774      __gen_uint(values->Entry[6][13], 20, 23) |
2775      __gen_uint(values->Entry[6][14], 24, 27) |
2776      __gen_uint(values->Entry[6][15], 28, 31);
2777
2778   dw[14] =
2779      __gen_uint(values->Entry[7][0], 0, 3) |
2780      __gen_uint(values->Entry[7][1], 4, 7) |
2781      __gen_uint(values->Entry[7][2], 8, 11) |
2782      __gen_uint(values->Entry[7][3], 12, 15) |
2783      __gen_uint(values->Entry[7][4], 16, 19) |
2784      __gen_uint(values->Entry[7][5], 20, 23) |
2785      __gen_uint(values->Entry[7][6], 24, 27) |
2786      __gen_uint(values->Entry[7][7], 28, 31);
2787
2788   dw[15] =
2789      __gen_uint(values->Entry[7][8], 0, 3) |
2790      __gen_uint(values->Entry[7][9], 4, 7) |
2791      __gen_uint(values->Entry[7][10], 8, 11) |
2792      __gen_uint(values->Entry[7][11], 12, 15) |
2793      __gen_uint(values->Entry[7][12], 16, 19) |
2794      __gen_uint(values->Entry[7][13], 20, 23) |
2795      __gen_uint(values->Entry[7][14], 24, 27) |
2796      __gen_uint(values->Entry[7][15], 28, 31);
2797
2798   dw[16] =
2799      __gen_uint(values->Entry[8][0], 0, 3) |
2800      __gen_uint(values->Entry[8][1], 4, 7) |
2801      __gen_uint(values->Entry[8][2], 8, 11) |
2802      __gen_uint(values->Entry[8][3], 12, 15) |
2803      __gen_uint(values->Entry[8][4], 16, 19) |
2804      __gen_uint(values->Entry[8][5], 20, 23) |
2805      __gen_uint(values->Entry[8][6], 24, 27) |
2806      __gen_uint(values->Entry[8][7], 28, 31);
2807
2808   dw[17] =
2809      __gen_uint(values->Entry[8][8], 0, 3) |
2810      __gen_uint(values->Entry[8][9], 4, 7) |
2811      __gen_uint(values->Entry[8][10], 8, 11) |
2812      __gen_uint(values->Entry[8][11], 12, 15) |
2813      __gen_uint(values->Entry[8][12], 16, 19) |
2814      __gen_uint(values->Entry[8][13], 20, 23) |
2815      __gen_uint(values->Entry[8][14], 24, 27) |
2816      __gen_uint(values->Entry[8][15], 28, 31);
2817
2818   dw[18] =
2819      __gen_uint(values->Entry[9][0], 0, 3) |
2820      __gen_uint(values->Entry[9][1], 4, 7) |
2821      __gen_uint(values->Entry[9][2], 8, 11) |
2822      __gen_uint(values->Entry[9][3], 12, 15) |
2823      __gen_uint(values->Entry[9][4], 16, 19) |
2824      __gen_uint(values->Entry[9][5], 20, 23) |
2825      __gen_uint(values->Entry[9][6], 24, 27) |
2826      __gen_uint(values->Entry[9][7], 28, 31);
2827
2828   dw[19] =
2829      __gen_uint(values->Entry[9][8], 0, 3) |
2830      __gen_uint(values->Entry[9][9], 4, 7) |
2831      __gen_uint(values->Entry[9][10], 8, 11) |
2832      __gen_uint(values->Entry[9][11], 12, 15) |
2833      __gen_uint(values->Entry[9][12], 16, 19) |
2834      __gen_uint(values->Entry[9][13], 20, 23) |
2835      __gen_uint(values->Entry[9][14], 24, 27) |
2836      __gen_uint(values->Entry[9][15], 28, 31);
2837
2838   dw[20] =
2839      __gen_uint(values->Entry[10][0], 0, 3) |
2840      __gen_uint(values->Entry[10][1], 4, 7) |
2841      __gen_uint(values->Entry[10][2], 8, 11) |
2842      __gen_uint(values->Entry[10][3], 12, 15) |
2843      __gen_uint(values->Entry[10][4], 16, 19) |
2844      __gen_uint(values->Entry[10][5], 20, 23) |
2845      __gen_uint(values->Entry[10][6], 24, 27) |
2846      __gen_uint(values->Entry[10][7], 28, 31);
2847
2848   dw[21] =
2849      __gen_uint(values->Entry[10][8], 0, 3) |
2850      __gen_uint(values->Entry[10][9], 4, 7) |
2851      __gen_uint(values->Entry[10][10], 8, 11) |
2852      __gen_uint(values->Entry[10][11], 12, 15) |
2853      __gen_uint(values->Entry[10][12], 16, 19) |
2854      __gen_uint(values->Entry[10][13], 20, 23) |
2855      __gen_uint(values->Entry[10][14], 24, 27) |
2856      __gen_uint(values->Entry[10][15], 28, 31);
2857
2858   dw[22] =
2859      __gen_uint(values->Entry[11][0], 0, 3) |
2860      __gen_uint(values->Entry[11][1], 4, 7) |
2861      __gen_uint(values->Entry[11][2], 8, 11) |
2862      __gen_uint(values->Entry[11][3], 12, 15) |
2863      __gen_uint(values->Entry[11][4], 16, 19) |
2864      __gen_uint(values->Entry[11][5], 20, 23) |
2865      __gen_uint(values->Entry[11][6], 24, 27) |
2866      __gen_uint(values->Entry[11][7], 28, 31);
2867
2868   dw[23] =
2869      __gen_uint(values->Entry[11][8], 0, 3) |
2870      __gen_uint(values->Entry[11][9], 4, 7) |
2871      __gen_uint(values->Entry[11][10], 8, 11) |
2872      __gen_uint(values->Entry[11][11], 12, 15) |
2873      __gen_uint(values->Entry[11][12], 16, 19) |
2874      __gen_uint(values->Entry[11][13], 20, 23) |
2875      __gen_uint(values->Entry[11][14], 24, 27) |
2876      __gen_uint(values->Entry[11][15], 28, 31);
2877
2878   dw[24] =
2879      __gen_uint(values->Entry[12][0], 0, 3) |
2880      __gen_uint(values->Entry[12][1], 4, 7) |
2881      __gen_uint(values->Entry[12][2], 8, 11) |
2882      __gen_uint(values->Entry[12][3], 12, 15) |
2883      __gen_uint(values->Entry[12][4], 16, 19) |
2884      __gen_uint(values->Entry[12][5], 20, 23) |
2885      __gen_uint(values->Entry[12][6], 24, 27) |
2886      __gen_uint(values->Entry[12][7], 28, 31);
2887
2888   dw[25] =
2889      __gen_uint(values->Entry[12][8], 0, 3) |
2890      __gen_uint(values->Entry[12][9], 4, 7) |
2891      __gen_uint(values->Entry[12][10], 8, 11) |
2892      __gen_uint(values->Entry[12][11], 12, 15) |
2893      __gen_uint(values->Entry[12][12], 16, 19) |
2894      __gen_uint(values->Entry[12][13], 20, 23) |
2895      __gen_uint(values->Entry[12][14], 24, 27) |
2896      __gen_uint(values->Entry[12][15], 28, 31);
2897
2898   dw[26] =
2899      __gen_uint(values->Entry[13][0], 0, 3) |
2900      __gen_uint(values->Entry[13][1], 4, 7) |
2901      __gen_uint(values->Entry[13][2], 8, 11) |
2902      __gen_uint(values->Entry[13][3], 12, 15) |
2903      __gen_uint(values->Entry[13][4], 16, 19) |
2904      __gen_uint(values->Entry[13][5], 20, 23) |
2905      __gen_uint(values->Entry[13][6], 24, 27) |
2906      __gen_uint(values->Entry[13][7], 28, 31);
2907
2908   dw[27] =
2909      __gen_uint(values->Entry[13][8], 0, 3) |
2910      __gen_uint(values->Entry[13][9], 4, 7) |
2911      __gen_uint(values->Entry[13][10], 8, 11) |
2912      __gen_uint(values->Entry[13][11], 12, 15) |
2913      __gen_uint(values->Entry[13][12], 16, 19) |
2914      __gen_uint(values->Entry[13][13], 20, 23) |
2915      __gen_uint(values->Entry[13][14], 24, 27) |
2916      __gen_uint(values->Entry[13][15], 28, 31);
2917
2918   dw[28] =
2919      __gen_uint(values->Entry[14][0], 0, 3) |
2920      __gen_uint(values->Entry[14][1], 4, 7) |
2921      __gen_uint(values->Entry[14][2], 8, 11) |
2922      __gen_uint(values->Entry[14][3], 12, 15) |
2923      __gen_uint(values->Entry[14][4], 16, 19) |
2924      __gen_uint(values->Entry[14][5], 20, 23) |
2925      __gen_uint(values->Entry[14][6], 24, 27) |
2926      __gen_uint(values->Entry[14][7], 28, 31);
2927
2928   dw[29] =
2929      __gen_uint(values->Entry[14][8], 0, 3) |
2930      __gen_uint(values->Entry[14][9], 4, 7) |
2931      __gen_uint(values->Entry[14][10], 8, 11) |
2932      __gen_uint(values->Entry[14][11], 12, 15) |
2933      __gen_uint(values->Entry[14][12], 16, 19) |
2934      __gen_uint(values->Entry[14][13], 20, 23) |
2935      __gen_uint(values->Entry[14][14], 24, 27) |
2936      __gen_uint(values->Entry[14][15], 28, 31);
2937
2938   dw[30] =
2939      __gen_uint(values->Entry[15][0], 0, 3) |
2940      __gen_uint(values->Entry[15][1], 4, 7) |
2941      __gen_uint(values->Entry[15][2], 8, 11) |
2942      __gen_uint(values->Entry[15][3], 12, 15) |
2943      __gen_uint(values->Entry[15][4], 16, 19) |
2944      __gen_uint(values->Entry[15][5], 20, 23) |
2945      __gen_uint(values->Entry[15][6], 24, 27) |
2946      __gen_uint(values->Entry[15][7], 28, 31);
2947
2948   dw[31] =
2949      __gen_uint(values->Entry[15][8], 0, 3) |
2950      __gen_uint(values->Entry[15][9], 4, 7) |
2951      __gen_uint(values->Entry[15][10], 8, 11) |
2952      __gen_uint(values->Entry[15][11], 12, 15) |
2953      __gen_uint(values->Entry[15][12], 16, 19) |
2954      __gen_uint(values->Entry[15][13], 20, 23) |
2955      __gen_uint(values->Entry[15][14], 24, 27) |
2956      __gen_uint(values->Entry[15][15], 28, 31);
2957}
2958
2959#define GFX11_SO_DECL_length                   1
2960struct GFX11_SO_DECL {
2961   uint32_t                             ComponentMask;
2962   uint32_t                             RegisterIndex;
2963   bool                                 HoleFlag;
2964   uint32_t                             OutputBufferSlot;
2965};
2966
2967static inline __attribute__((always_inline)) void
2968GFX11_SO_DECL_pack(__attribute__((unused)) __gen_user_data *data,
2969                   __attribute__((unused)) void * restrict dst,
2970                   __attribute__((unused)) const struct GFX11_SO_DECL * restrict values)
2971{
2972   uint32_t * restrict dw = (uint32_t * restrict) dst;
2973
2974   dw[0] =
2975      __gen_uint(values->ComponentMask, 0, 3) |
2976      __gen_uint(values->RegisterIndex, 4, 9) |
2977      __gen_uint(values->HoleFlag, 11, 11) |
2978      __gen_uint(values->OutputBufferSlot, 12, 13);
2979}
2980
2981#define GFX11_SO_DECL_ENTRY_length             2
2982struct GFX11_SO_DECL_ENTRY {
2983   struct GFX11_SO_DECL                 Stream0Decl;
2984   struct GFX11_SO_DECL                 Stream1Decl;
2985   struct GFX11_SO_DECL                 Stream2Decl;
2986   struct GFX11_SO_DECL                 Stream3Decl;
2987};
2988
2989static inline __attribute__((always_inline)) void
2990GFX11_SO_DECL_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
2991                         __attribute__((unused)) void * restrict dst,
2992                         __attribute__((unused)) const struct GFX11_SO_DECL_ENTRY * restrict values)
2993{
2994   uint32_t * restrict dw = (uint32_t * restrict) dst;
2995
2996   uint32_t v0_0;
2997   GFX11_SO_DECL_pack(data, &v0_0, &values->Stream0Decl);
2998
2999   uint32_t v0_1;
3000   GFX11_SO_DECL_pack(data, &v0_1, &values->Stream1Decl);
3001
3002   dw[0] =
3003      __gen_uint(v0_0, 0, 15) |
3004      __gen_uint(v0_1, 16, 31);
3005
3006   uint32_t v1_0;
3007   GFX11_SO_DECL_pack(data, &v1_0, &values->Stream2Decl);
3008
3009   uint32_t v1_1;
3010   GFX11_SO_DECL_pack(data, &v1_1, &values->Stream3Decl);
3011
3012   dw[1] =
3013      __gen_uint(v1_0, 0, 15) |
3014      __gen_uint(v1_1, 16, 31);
3015}
3016
3017#define GFX11_VDENC_SURFACE_CONTROL_BITS_length      1
3018struct GFX11_VDENC_SURFACE_CONTROL_BITS {
3019   uint32_t                             MOCS;
3020   uint32_t                             ArbitrationPriorityControl;
3021#define Highestpriority                          0
3022#define Secondhighestpriority                    1
3023#define Thirdhighestpriority                     2
3024#define Lowestpriority                           3
3025   bool                                 MemoryCompressionEnable;
3026   uint32_t                             MemoryCompressionMode;
3027   uint32_t                             CacheSelect;
3028   uint32_t                             TiledResourceMode;
3029#define TRMODE_NONE                              0
3030#define TRMODE_TILEYF                            1
3031#define TRMODE_TILEYS                            2
3032};
3033
3034static inline __attribute__((always_inline)) void
3035GFX11_VDENC_SURFACE_CONTROL_BITS_pack(__attribute__((unused)) __gen_user_data *data,
3036                                      __attribute__((unused)) void * restrict dst,
3037                                      __attribute__((unused)) const struct GFX11_VDENC_SURFACE_CONTROL_BITS * restrict values)
3038{
3039   uint32_t * restrict dw = (uint32_t * restrict) dst;
3040
3041   dw[0] =
3042      __gen_uint(values->MOCS, 1, 6) |
3043      __gen_uint(values->ArbitrationPriorityControl, 7, 8) |
3044      __gen_uint(values->MemoryCompressionEnable, 9, 9) |
3045      __gen_uint(values->MemoryCompressionMode, 10, 10) |
3046      __gen_uint(values->CacheSelect, 12, 12) |
3047      __gen_uint(values->TiledResourceMode, 13, 14);
3048}
3049
3050#define GFX11_VDENC_PICTURE_length             3
3051struct GFX11_VDENC_PICTURE {
3052   __gen_address_type                   Address;
3053   struct GFX11_VDENC_SURFACE_CONTROL_BITS PictureFields;
3054};
3055
3056static inline __attribute__((always_inline)) void
3057GFX11_VDENC_PICTURE_pack(__attribute__((unused)) __gen_user_data *data,
3058                         __attribute__((unused)) void * restrict dst,
3059                         __attribute__((unused)) const struct GFX11_VDENC_PICTURE * restrict values)
3060{
3061   uint32_t * restrict dw = (uint32_t * restrict) dst;
3062
3063   const uint64_t v0_address =
3064      __gen_address(data, &dw[0], values->Address, 0, 0, 63);
3065   dw[0] = v0_address;
3066   dw[1] = v0_address >> 32;
3067
3068   GFX11_VDENC_SURFACE_CONTROL_BITS_pack(data, &dw[2], &values->PictureFields);
3069}
3070
3071#define GFX11_VDENC_SURFACE_STATE_FIELDS_length      4
3072struct GFX11_VDENC_SURFACE_STATE_FIELDS {
3073   float                                CrVCbUPixelOffsetVDirection;
3074   bool                                 SurfaceFormatByteSwizzle;
3075   uint32_t                             Colorspaceselection;
3076   uint32_t                             Width;
3077   uint32_t                             Height;
3078   uint32_t                             TileWalk;
3079#define TW_XMAJOR                                0
3080#define TW_YMAJOR                                1
3081   uint32_t                             TiledSurface;
3082   bool                                 HalfPitchforChroma;
3083   uint32_t                             SurfacePitch;
3084   uint32_t                             ChromaDownsampleFilterControl;
3085   uint32_t                             Format;
3086   uint32_t                             SurfaceFormat;
3087#define VDENC_YUV422                             0
3088#define VDENC_RGBA4444                           1
3089#define VDENC_YUV444                             2
3090#define VDENC_Y8_UNORM                           3
3091#define VDENC_PLANAR_420_8                       4
3092   uint32_t                             YOffsetforUCb;
3093   uint32_t                             XOffsetforUCb;
3094   uint32_t                             YOffsetforVCr;
3095   uint32_t                             XOffsetforVCr;
3096};
3097
3098static inline __attribute__((always_inline)) void
3099GFX11_VDENC_SURFACE_STATE_FIELDS_pack(__attribute__((unused)) __gen_user_data *data,
3100                                      __attribute__((unused)) void * restrict dst,
3101                                      __attribute__((unused)) const struct GFX11_VDENC_SURFACE_STATE_FIELDS * restrict values)
3102{
3103   uint32_t * restrict dw = (uint32_t * restrict) dst;
3104
3105   dw[0] =
3106      __gen_ufixed(values->CrVCbUPixelOffsetVDirection, 0, 1, 2) |
3107      __gen_uint(values->SurfaceFormatByteSwizzle, 2, 2) |
3108      __gen_uint(values->Colorspaceselection, 3, 3) |
3109      __gen_uint(values->Width, 4, 17) |
3110      __gen_uint(values->Height, 18, 31);
3111
3112   dw[1] =
3113      __gen_uint(values->TileWalk, 0, 0) |
3114      __gen_uint(values->TiledSurface, 1, 1) |
3115      __gen_uint(values->HalfPitchforChroma, 2, 2) |
3116      __gen_uint(values->SurfacePitch, 3, 19) |
3117      __gen_uint(values->ChromaDownsampleFilterControl, 20, 22) |
3118      __gen_uint(values->Format, 27, 31) |
3119      __gen_uint(values->SurfaceFormat, 28, 31);
3120
3121   dw[2] =
3122      __gen_uint(values->YOffsetforUCb, 0, 14) |
3123      __gen_uint(values->XOffsetforUCb, 16, 30);
3124
3125   dw[3] =
3126      __gen_uint(values->YOffsetforVCr, 0, 15) |
3127      __gen_uint(values->XOffsetforVCr, 16, 28);
3128}
3129
3130#define GFX11_VERTEX_BUFFER_STATE_length       4
3131struct GFX11_VERTEX_BUFFER_STATE {
3132   uint32_t                             BufferPitch;
3133   bool                                 NullVertexBuffer;
3134   bool                                 AddressModifyEnable;
3135   uint32_t                             MOCS;
3136   uint32_t                             VertexBufferIndex;
3137   __gen_address_type                   BufferStartingAddress;
3138   uint32_t                             BufferSize;
3139};
3140
3141static inline __attribute__((always_inline)) void
3142GFX11_VERTEX_BUFFER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
3143                               __attribute__((unused)) void * restrict dst,
3144                               __attribute__((unused)) const struct GFX11_VERTEX_BUFFER_STATE * restrict values)
3145{
3146   uint32_t * restrict dw = (uint32_t * restrict) dst;
3147
3148   dw[0] =
3149      __gen_uint(values->BufferPitch, 0, 11) |
3150      __gen_uint(values->NullVertexBuffer, 13, 13) |
3151      __gen_uint(values->AddressModifyEnable, 14, 14) |
3152      __gen_uint(values->MOCS, 16, 22) |
3153      __gen_uint(values->VertexBufferIndex, 26, 31);
3154
3155   const uint64_t v1_address =
3156      __gen_address(data, &dw[1], values->BufferStartingAddress, 0, 0, 63);
3157   dw[1] = v1_address;
3158   dw[2] = v1_address >> 32;
3159
3160   dw[3] =
3161      __gen_uint(values->BufferSize, 0, 31);
3162}
3163
3164#define GFX11_VERTEX_ELEMENT_STATE_length      2
3165struct GFX11_VERTEX_ELEMENT_STATE {
3166   uint32_t                             SourceElementOffset;
3167   bool                                 EdgeFlagEnable;
3168   uint32_t                             SourceElementFormat;
3169   bool                                 Valid;
3170   uint32_t                             VertexBufferIndex;
3171   enum GFX11_3D_Vertex_Component_Control Component3Control;
3172   enum GFX11_3D_Vertex_Component_Control Component2Control;
3173   enum GFX11_3D_Vertex_Component_Control Component1Control;
3174   enum GFX11_3D_Vertex_Component_Control Component0Control;
3175};
3176
3177static inline __attribute__((always_inline)) void
3178GFX11_VERTEX_ELEMENT_STATE_pack(__attribute__((unused)) __gen_user_data *data,
3179                                __attribute__((unused)) void * restrict dst,
3180                                __attribute__((unused)) const struct GFX11_VERTEX_ELEMENT_STATE * restrict values)
3181{
3182   uint32_t * restrict dw = (uint32_t * restrict) dst;
3183
3184   dw[0] =
3185      __gen_uint(values->SourceElementOffset, 0, 11) |
3186      __gen_uint(values->EdgeFlagEnable, 15, 15) |
3187      __gen_uint(values->SourceElementFormat, 16, 24) |
3188      __gen_uint(values->Valid, 25, 25) |
3189      __gen_uint(values->VertexBufferIndex, 26, 31);
3190
3191   dw[1] =
3192      __gen_uint(values->Component3Control, 16, 18) |
3193      __gen_uint(values->Component2Control, 20, 22) |
3194      __gen_uint(values->Component1Control, 24, 26) |
3195      __gen_uint(values->Component0Control, 28, 30);
3196}
3197
3198#define GFX11_3DPRIMITIVE_length               7
3199#define GFX11_3DPRIMITIVE_length_bias          2
3200#define GFX11_3DPRIMITIVE_header                \
3201   .DWordLength                         =      5,  \
3202   ._3DCommandSubOpcode                 =      0,  \
3203   ._3DCommandOpcode                    =      3,  \
3204   .CommandSubType                      =      3,  \
3205   .CommandType                         =      3
3206
3207struct GFX11_3DPRIMITIVE {
3208   uint32_t                             DWordLength;
3209   bool                                 PredicateEnable;
3210   bool                                 UAVCoherencyRequired;
3211   bool                                 IndirectParameterEnable;
3212   uint32_t                             ExtendedParametersPresent;
3213   uint32_t                             _3DCommandSubOpcode;
3214   uint32_t                             _3DCommandOpcode;
3215   uint32_t                             CommandSubType;
3216   uint32_t                             CommandType;
3217   enum GFX11_3D_Prim_Topo_Type         PrimitiveTopologyType;
3218   uint32_t                             VertexAccessType;
3219#define SEQUENTIAL                               0
3220#define RANDOM                                   1
3221   bool                                 EndOffsetEnable;
3222   uint32_t                             VertexCountPerInstance;
3223   uint32_t                             StartVertexLocation;
3224   uint32_t                             InstanceCount;
3225   uint32_t                             StartInstanceLocation;
3226   int32_t                              BaseVertexLocation;
3227   uint32_t                             ExtendedParameter0;
3228   uint32_t                             ExtendedParameter1;
3229   uint32_t                             ExtendedParameter2;
3230};
3231
3232static inline __attribute__((always_inline)) void
3233GFX11_3DPRIMITIVE_pack(__attribute__((unused)) __gen_user_data *data,
3234                       __attribute__((unused)) void * restrict dst,
3235                       __attribute__((unused)) const struct GFX11_3DPRIMITIVE * restrict values)
3236{
3237   uint32_t * restrict dw = (uint32_t * restrict) dst;
3238
3239   dw[0] =
3240      __gen_uint(values->DWordLength, 0, 7) |
3241      __gen_uint(values->PredicateEnable, 8, 8) |
3242      __gen_uint(values->UAVCoherencyRequired, 9, 9) |
3243      __gen_uint(values->IndirectParameterEnable, 10, 10) |
3244      __gen_uint(values->ExtendedParametersPresent, 11, 11) |
3245      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3246      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3247      __gen_uint(values->CommandSubType, 27, 28) |
3248      __gen_uint(values->CommandType, 29, 31);
3249
3250   dw[1] =
3251      __gen_uint(values->PrimitiveTopologyType, 0, 5) |
3252      __gen_uint(values->VertexAccessType, 8, 8) |
3253      __gen_uint(values->EndOffsetEnable, 9, 9);
3254
3255   dw[2] =
3256      __gen_uint(values->VertexCountPerInstance, 0, 31);
3257
3258   dw[3] =
3259      __gen_uint(values->StartVertexLocation, 0, 31);
3260
3261   dw[4] =
3262      __gen_uint(values->InstanceCount, 0, 31);
3263
3264   dw[5] =
3265      __gen_uint(values->StartInstanceLocation, 0, 31);
3266
3267   dw[6] =
3268      __gen_sint(values->BaseVertexLocation, 0, 31);
3269}
3270
3271#define GFX11_3DSTATE_3D_MODE_length           2
3272#define GFX11_3DSTATE_3D_MODE_length_bias      2
3273#define GFX11_3DSTATE_3D_MODE_header            \
3274   .DWordLength                         =      0,  \
3275   ._3DCommandSubOpcode                 =     30,  \
3276   ._3DCommandOpcode                    =      1,  \
3277   .CommandSubType                      =      3,  \
3278   .CommandType                         =      3
3279
3280struct GFX11_3DSTATE_3D_MODE {
3281   uint32_t                             DWordLength;
3282   uint32_t                             _3DCommandSubOpcode;
3283   uint32_t                             _3DCommandOpcode;
3284   uint32_t                             CommandSubType;
3285   uint32_t                             CommandType;
3286   uint32_t                             CrossSliceHashingMode;
3287#define NormalMode                               0
3288#define Disable                                  1
3289#define hashing32x32                             3
3290   uint32_t                             SubsliceHashingMode;
3291#define hashing8x8                               0
3292#define hashing16x4                              1
3293#define hashing8x4                               2
3294#define hashing16x16                             3
3295   bool                                 SliceHashingTableEnable;
3296};
3297
3298static inline __attribute__((always_inline)) void
3299GFX11_3DSTATE_3D_MODE_pack(__attribute__((unused)) __gen_user_data *data,
3300                           __attribute__((unused)) void * restrict dst,
3301                           __attribute__((unused)) const struct GFX11_3DSTATE_3D_MODE * restrict values)
3302{
3303   uint32_t * restrict dw = (uint32_t * restrict) dst;
3304
3305   dw[0] =
3306      __gen_uint(values->DWordLength, 0, 7) |
3307      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3308      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3309      __gen_uint(values->CommandSubType, 27, 28) |
3310      __gen_uint(values->CommandType, 29, 31);
3311
3312   dw[1] =
3313      __gen_uint(values->CrossSliceHashingMode, 0, 1) |
3314      __gen_uint(values->SubsliceHashingMode, 2, 3) |
3315      __gen_uint(values->SliceHashingTableEnable, 6, 6) |
3316      __gen_mbo(16, 31);
3317}
3318
3319#define GFX11_3DSTATE_AA_LINE_PARAMETERS_length      3
3320#define GFX11_3DSTATE_AA_LINE_PARAMETERS_length_bias      2
3321#define GFX11_3DSTATE_AA_LINE_PARAMETERS_header \
3322   .DWordLength                         =      1,  \
3323   ._3DCommandSubOpcode                 =     10,  \
3324   ._3DCommandOpcode                    =      1,  \
3325   .CommandSubType                      =      3,  \
3326   .CommandType                         =      3
3327
3328struct GFX11_3DSTATE_AA_LINE_PARAMETERS {
3329   uint32_t                             DWordLength;
3330   uint32_t                             _3DCommandSubOpcode;
3331   uint32_t                             _3DCommandOpcode;
3332   uint32_t                             CommandSubType;
3333   uint32_t                             CommandType;
3334   float                                AACoverageSlope;
3335   float                                AAPointCoverageSlope;
3336   float                                AACoverageBias;
3337   float                                AAPointCoverageBias;
3338   float                                AACoverageEndCapSlope;
3339   float                                AAPointCoverageEndCapSlope;
3340   float                                AACoverageEndCapBias;
3341   float                                AAPointCoverageEndCapBias;
3342};
3343
3344static inline __attribute__((always_inline)) void
3345GFX11_3DSTATE_AA_LINE_PARAMETERS_pack(__attribute__((unused)) __gen_user_data *data,
3346                                      __attribute__((unused)) void * restrict dst,
3347                                      __attribute__((unused)) const struct GFX11_3DSTATE_AA_LINE_PARAMETERS * restrict values)
3348{
3349   uint32_t * restrict dw = (uint32_t * restrict) dst;
3350
3351   dw[0] =
3352      __gen_uint(values->DWordLength, 0, 7) |
3353      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3354      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3355      __gen_uint(values->CommandSubType, 27, 28) |
3356      __gen_uint(values->CommandType, 29, 31);
3357
3358   dw[1] =
3359      __gen_ufixed(values->AACoverageSlope, 0, 7, 8) |
3360      __gen_ufixed(values->AAPointCoverageSlope, 8, 15, 8) |
3361      __gen_ufixed(values->AACoverageBias, 16, 23, 8) |
3362      __gen_ufixed(values->AAPointCoverageBias, 24, 31, 8);
3363
3364   dw[2] =
3365      __gen_ufixed(values->AACoverageEndCapSlope, 0, 7, 8) |
3366      __gen_ufixed(values->AAPointCoverageEndCapSlope, 8, 15, 8) |
3367      __gen_ufixed(values->AACoverageEndCapBias, 16, 23, 8) |
3368      __gen_ufixed(values->AAPointCoverageEndCapBias, 24, 31, 8);
3369}
3370
3371#define GFX11_3DSTATE_BINDING_TABLE_EDIT_DS_length_bias      2
3372#define GFX11_3DSTATE_BINDING_TABLE_EDIT_DS_header\
3373   .DWordLength                         =      0,  \
3374   ._3DCommandSubOpcode                 =     70,  \
3375   ._3DCommandOpcode                    =      0,  \
3376   .CommandSubType                      =      3,  \
3377   .CommandType                         =      3
3378
3379struct GFX11_3DSTATE_BINDING_TABLE_EDIT_DS {
3380   uint32_t                             DWordLength;
3381   uint32_t                             _3DCommandSubOpcode;
3382   uint32_t                             _3DCommandOpcode;
3383   uint32_t                             CommandSubType;
3384   uint32_t                             CommandType;
3385   uint32_t                             BindingTableEditTarget;
3386#define AllCores                                 3
3387#define Core1                                    2
3388#define Core0                                    1
3389   uint32_t                             BindingTableBlockClear;
3390   /* variable length fields follow */
3391};
3392
3393static inline __attribute__((always_inline)) void
3394GFX11_3DSTATE_BINDING_TABLE_EDIT_DS_pack(__attribute__((unused)) __gen_user_data *data,
3395                                         __attribute__((unused)) void * restrict dst,
3396                                         __attribute__((unused)) const struct GFX11_3DSTATE_BINDING_TABLE_EDIT_DS * restrict values)
3397{
3398   uint32_t * restrict dw = (uint32_t * restrict) dst;
3399
3400   dw[0] =
3401      __gen_uint(values->DWordLength, 0, 8) |
3402      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3403      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3404      __gen_uint(values->CommandSubType, 27, 28) |
3405      __gen_uint(values->CommandType, 29, 31);
3406
3407   dw[1] =
3408      __gen_uint(values->BindingTableEditTarget, 0, 1) |
3409      __gen_uint(values->BindingTableBlockClear, 16, 31);
3410}
3411
3412#define GFX11_3DSTATE_BINDING_TABLE_EDIT_GS_length_bias      2
3413#define GFX11_3DSTATE_BINDING_TABLE_EDIT_GS_header\
3414   .DWordLength                         =      0,  \
3415   ._3DCommandSubOpcode                 =     68,  \
3416   ._3DCommandOpcode                    =      0,  \
3417   .CommandSubType                      =      3,  \
3418   .CommandType                         =      3
3419
3420struct GFX11_3DSTATE_BINDING_TABLE_EDIT_GS {
3421   uint32_t                             DWordLength;
3422   uint32_t                             _3DCommandSubOpcode;
3423   uint32_t                             _3DCommandOpcode;
3424   uint32_t                             CommandSubType;
3425   uint32_t                             CommandType;
3426   uint32_t                             BindingTableEditTarget;
3427#define AllCores                                 3
3428#define Core1                                    2
3429#define Core0                                    1
3430   uint32_t                             BindingTableBlockClear;
3431   /* variable length fields follow */
3432};
3433
3434static inline __attribute__((always_inline)) void
3435GFX11_3DSTATE_BINDING_TABLE_EDIT_GS_pack(__attribute__((unused)) __gen_user_data *data,
3436                                         __attribute__((unused)) void * restrict dst,
3437                                         __attribute__((unused)) const struct GFX11_3DSTATE_BINDING_TABLE_EDIT_GS * restrict values)
3438{
3439   uint32_t * restrict dw = (uint32_t * restrict) dst;
3440
3441   dw[0] =
3442      __gen_uint(values->DWordLength, 0, 8) |
3443      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3444      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3445      __gen_uint(values->CommandSubType, 27, 28) |
3446      __gen_uint(values->CommandType, 29, 31);
3447
3448   dw[1] =
3449      __gen_uint(values->BindingTableEditTarget, 0, 1) |
3450      __gen_uint(values->BindingTableBlockClear, 16, 31);
3451}
3452
3453#define GFX11_3DSTATE_BINDING_TABLE_EDIT_HS_length_bias      2
3454#define GFX11_3DSTATE_BINDING_TABLE_EDIT_HS_header\
3455   .DWordLength                         =      0,  \
3456   ._3DCommandSubOpcode                 =     69,  \
3457   ._3DCommandOpcode                    =      0,  \
3458   .CommandSubType                      =      3,  \
3459   .CommandType                         =      3
3460
3461struct GFX11_3DSTATE_BINDING_TABLE_EDIT_HS {
3462   uint32_t                             DWordLength;
3463   uint32_t                             _3DCommandSubOpcode;
3464   uint32_t                             _3DCommandOpcode;
3465   uint32_t                             CommandSubType;
3466   uint32_t                             CommandType;
3467   uint32_t                             BindingTableEditTarget;
3468#define AllCores                                 3
3469#define Core1                                    2
3470#define Core0                                    1
3471   uint32_t                             BindingTableBlockClear;
3472   /* variable length fields follow */
3473};
3474
3475static inline __attribute__((always_inline)) void
3476GFX11_3DSTATE_BINDING_TABLE_EDIT_HS_pack(__attribute__((unused)) __gen_user_data *data,
3477                                         __attribute__((unused)) void * restrict dst,
3478                                         __attribute__((unused)) const struct GFX11_3DSTATE_BINDING_TABLE_EDIT_HS * restrict values)
3479{
3480   uint32_t * restrict dw = (uint32_t * restrict) dst;
3481
3482   dw[0] =
3483      __gen_uint(values->DWordLength, 0, 8) |
3484      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3485      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3486      __gen_uint(values->CommandSubType, 27, 28) |
3487      __gen_uint(values->CommandType, 29, 31);
3488
3489   dw[1] =
3490      __gen_uint(values->BindingTableEditTarget, 0, 1) |
3491      __gen_uint(values->BindingTableBlockClear, 16, 31);
3492}
3493
3494#define GFX11_3DSTATE_BINDING_TABLE_EDIT_PS_length_bias      2
3495#define GFX11_3DSTATE_BINDING_TABLE_EDIT_PS_header\
3496   .DWordLength                         =      0,  \
3497   ._3DCommandSubOpcode                 =     71,  \
3498   ._3DCommandOpcode                    =      0,  \
3499   .CommandSubType                      =      3,  \
3500   .CommandType                         =      3
3501
3502struct GFX11_3DSTATE_BINDING_TABLE_EDIT_PS {
3503   uint32_t                             DWordLength;
3504   uint32_t                             _3DCommandSubOpcode;
3505   uint32_t                             _3DCommandOpcode;
3506   uint32_t                             CommandSubType;
3507   uint32_t                             CommandType;
3508   uint32_t                             BindingTableEditTarget;
3509#define AllCores                                 3
3510#define Core1                                    2
3511#define Core0                                    1
3512   uint32_t                             BindingTableBlockClear;
3513   /* variable length fields follow */
3514};
3515
3516static inline __attribute__((always_inline)) void
3517GFX11_3DSTATE_BINDING_TABLE_EDIT_PS_pack(__attribute__((unused)) __gen_user_data *data,
3518                                         __attribute__((unused)) void * restrict dst,
3519                                         __attribute__((unused)) const struct GFX11_3DSTATE_BINDING_TABLE_EDIT_PS * restrict values)
3520{
3521   uint32_t * restrict dw = (uint32_t * restrict) dst;
3522
3523   dw[0] =
3524      __gen_uint(values->DWordLength, 0, 8) |
3525      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3526      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3527      __gen_uint(values->CommandSubType, 27, 28) |
3528      __gen_uint(values->CommandType, 29, 31);
3529
3530   dw[1] =
3531      __gen_uint(values->BindingTableEditTarget, 0, 1) |
3532      __gen_uint(values->BindingTableBlockClear, 16, 31);
3533}
3534
3535#define GFX11_3DSTATE_BINDING_TABLE_EDIT_VS_length_bias      2
3536#define GFX11_3DSTATE_BINDING_TABLE_EDIT_VS_header\
3537   .DWordLength                         =      0,  \
3538   ._3DCommandSubOpcode                 =     67,  \
3539   ._3DCommandOpcode                    =      0,  \
3540   .CommandSubType                      =      3,  \
3541   .CommandType                         =      3
3542
3543struct GFX11_3DSTATE_BINDING_TABLE_EDIT_VS {
3544   uint32_t                             DWordLength;
3545   uint32_t                             _3DCommandSubOpcode;
3546   uint32_t                             _3DCommandOpcode;
3547   uint32_t                             CommandSubType;
3548   uint32_t                             CommandType;
3549   uint32_t                             BindingTableEditTarget;
3550#define AllCores                                 3
3551#define Core1                                    2
3552#define Core0                                    1
3553   uint32_t                             BindingTableBlockClear;
3554   /* variable length fields follow */
3555};
3556
3557static inline __attribute__((always_inline)) void
3558GFX11_3DSTATE_BINDING_TABLE_EDIT_VS_pack(__attribute__((unused)) __gen_user_data *data,
3559                                         __attribute__((unused)) void * restrict dst,
3560                                         __attribute__((unused)) const struct GFX11_3DSTATE_BINDING_TABLE_EDIT_VS * restrict values)
3561{
3562   uint32_t * restrict dw = (uint32_t * restrict) dst;
3563
3564   dw[0] =
3565      __gen_uint(values->DWordLength, 0, 8) |
3566      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3567      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3568      __gen_uint(values->CommandSubType, 27, 28) |
3569      __gen_uint(values->CommandType, 29, 31);
3570
3571   dw[1] =
3572      __gen_uint(values->BindingTableEditTarget, 0, 1) |
3573      __gen_uint(values->BindingTableBlockClear, 16, 31);
3574}
3575
3576#define GFX11_3DSTATE_BINDING_TABLE_POINTERS_DS_length      2
3577#define GFX11_3DSTATE_BINDING_TABLE_POINTERS_DS_length_bias      2
3578#define GFX11_3DSTATE_BINDING_TABLE_POINTERS_DS_header\
3579   .DWordLength                         =      0,  \
3580   ._3DCommandSubOpcode                 =     40,  \
3581   ._3DCommandOpcode                    =      0,  \
3582   .CommandSubType                      =      3,  \
3583   .CommandType                         =      3
3584
3585struct GFX11_3DSTATE_BINDING_TABLE_POINTERS_DS {
3586   uint32_t                             DWordLength;
3587   uint32_t                             _3DCommandSubOpcode;
3588   uint32_t                             _3DCommandOpcode;
3589   uint32_t                             CommandSubType;
3590   uint32_t                             CommandType;
3591   uint64_t                             PointertoDSBindingTable;
3592};
3593
3594static inline __attribute__((always_inline)) void
3595GFX11_3DSTATE_BINDING_TABLE_POINTERS_DS_pack(__attribute__((unused)) __gen_user_data *data,
3596                                             __attribute__((unused)) void * restrict dst,
3597                                             __attribute__((unused)) const struct GFX11_3DSTATE_BINDING_TABLE_POINTERS_DS * restrict values)
3598{
3599   uint32_t * restrict dw = (uint32_t * restrict) dst;
3600
3601   dw[0] =
3602      __gen_uint(values->DWordLength, 0, 7) |
3603      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3604      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3605      __gen_uint(values->CommandSubType, 27, 28) |
3606      __gen_uint(values->CommandType, 29, 31);
3607
3608   dw[1] =
3609      __gen_offset(values->PointertoDSBindingTable, 5, 15);
3610}
3611
3612#define GFX11_3DSTATE_BINDING_TABLE_POINTERS_GS_length      2
3613#define GFX11_3DSTATE_BINDING_TABLE_POINTERS_GS_length_bias      2
3614#define GFX11_3DSTATE_BINDING_TABLE_POINTERS_GS_header\
3615   .DWordLength                         =      0,  \
3616   ._3DCommandSubOpcode                 =     41,  \
3617   ._3DCommandOpcode                    =      0,  \
3618   .CommandSubType                      =      3,  \
3619   .CommandType                         =      3
3620
3621struct GFX11_3DSTATE_BINDING_TABLE_POINTERS_GS {
3622   uint32_t                             DWordLength;
3623   uint32_t                             _3DCommandSubOpcode;
3624   uint32_t                             _3DCommandOpcode;
3625   uint32_t                             CommandSubType;
3626   uint32_t                             CommandType;
3627   uint64_t                             PointertoGSBindingTable;
3628};
3629
3630static inline __attribute__((always_inline)) void
3631GFX11_3DSTATE_BINDING_TABLE_POINTERS_GS_pack(__attribute__((unused)) __gen_user_data *data,
3632                                             __attribute__((unused)) void * restrict dst,
3633                                             __attribute__((unused)) const struct GFX11_3DSTATE_BINDING_TABLE_POINTERS_GS * restrict values)
3634{
3635   uint32_t * restrict dw = (uint32_t * restrict) dst;
3636
3637   dw[0] =
3638      __gen_uint(values->DWordLength, 0, 7) |
3639      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3640      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3641      __gen_uint(values->CommandSubType, 27, 28) |
3642      __gen_uint(values->CommandType, 29, 31);
3643
3644   dw[1] =
3645      __gen_offset(values->PointertoGSBindingTable, 5, 15);
3646}
3647
3648#define GFX11_3DSTATE_BINDING_TABLE_POINTERS_HS_length      2
3649#define GFX11_3DSTATE_BINDING_TABLE_POINTERS_HS_length_bias      2
3650#define GFX11_3DSTATE_BINDING_TABLE_POINTERS_HS_header\
3651   .DWordLength                         =      0,  \
3652   ._3DCommandSubOpcode                 =     39,  \
3653   ._3DCommandOpcode                    =      0,  \
3654   .CommandSubType                      =      3,  \
3655   .CommandType                         =      3
3656
3657struct GFX11_3DSTATE_BINDING_TABLE_POINTERS_HS {
3658   uint32_t                             DWordLength;
3659   uint32_t                             _3DCommandSubOpcode;
3660   uint32_t                             _3DCommandOpcode;
3661   uint32_t                             CommandSubType;
3662   uint32_t                             CommandType;
3663   uint64_t                             PointertoHSBindingTable;
3664};
3665
3666static inline __attribute__((always_inline)) void
3667GFX11_3DSTATE_BINDING_TABLE_POINTERS_HS_pack(__attribute__((unused)) __gen_user_data *data,
3668                                             __attribute__((unused)) void * restrict dst,
3669                                             __attribute__((unused)) const struct GFX11_3DSTATE_BINDING_TABLE_POINTERS_HS * restrict values)
3670{
3671   uint32_t * restrict dw = (uint32_t * restrict) dst;
3672
3673   dw[0] =
3674      __gen_uint(values->DWordLength, 0, 7) |
3675      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3676      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3677      __gen_uint(values->CommandSubType, 27, 28) |
3678      __gen_uint(values->CommandType, 29, 31);
3679
3680   dw[1] =
3681      __gen_offset(values->PointertoHSBindingTable, 5, 15);
3682}
3683
3684#define GFX11_3DSTATE_BINDING_TABLE_POINTERS_PS_length      2
3685#define GFX11_3DSTATE_BINDING_TABLE_POINTERS_PS_length_bias      2
3686#define GFX11_3DSTATE_BINDING_TABLE_POINTERS_PS_header\
3687   .DWordLength                         =      0,  \
3688   ._3DCommandSubOpcode                 =     42,  \
3689   ._3DCommandOpcode                    =      0,  \
3690   .CommandSubType                      =      3,  \
3691   .CommandType                         =      3
3692
3693struct GFX11_3DSTATE_BINDING_TABLE_POINTERS_PS {
3694   uint32_t                             DWordLength;
3695   uint32_t                             _3DCommandSubOpcode;
3696   uint32_t                             _3DCommandOpcode;
3697   uint32_t                             CommandSubType;
3698   uint32_t                             CommandType;
3699   uint64_t                             PointertoPSBindingTable;
3700};
3701
3702static inline __attribute__((always_inline)) void
3703GFX11_3DSTATE_BINDING_TABLE_POINTERS_PS_pack(__attribute__((unused)) __gen_user_data *data,
3704                                             __attribute__((unused)) void * restrict dst,
3705                                             __attribute__((unused)) const struct GFX11_3DSTATE_BINDING_TABLE_POINTERS_PS * restrict values)
3706{
3707   uint32_t * restrict dw = (uint32_t * restrict) dst;
3708
3709   dw[0] =
3710      __gen_uint(values->DWordLength, 0, 7) |
3711      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3712      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3713      __gen_uint(values->CommandSubType, 27, 28) |
3714      __gen_uint(values->CommandType, 29, 31);
3715
3716   dw[1] =
3717      __gen_offset(values->PointertoPSBindingTable, 5, 15);
3718}
3719
3720#define GFX11_3DSTATE_BINDING_TABLE_POINTERS_VS_length      2
3721#define GFX11_3DSTATE_BINDING_TABLE_POINTERS_VS_length_bias      2
3722#define GFX11_3DSTATE_BINDING_TABLE_POINTERS_VS_header\
3723   .DWordLength                         =      0,  \
3724   ._3DCommandSubOpcode                 =     38,  \
3725   ._3DCommandOpcode                    =      0,  \
3726   .CommandSubType                      =      3,  \
3727   .CommandType                         =      3
3728
3729struct GFX11_3DSTATE_BINDING_TABLE_POINTERS_VS {
3730   uint32_t                             DWordLength;
3731   uint32_t                             _3DCommandSubOpcode;
3732   uint32_t                             _3DCommandOpcode;
3733   uint32_t                             CommandSubType;
3734   uint32_t                             CommandType;
3735   uint64_t                             PointertoVSBindingTable;
3736};
3737
3738static inline __attribute__((always_inline)) void
3739GFX11_3DSTATE_BINDING_TABLE_POINTERS_VS_pack(__attribute__((unused)) __gen_user_data *data,
3740                                             __attribute__((unused)) void * restrict dst,
3741                                             __attribute__((unused)) const struct GFX11_3DSTATE_BINDING_TABLE_POINTERS_VS * restrict values)
3742{
3743   uint32_t * restrict dw = (uint32_t * restrict) dst;
3744
3745   dw[0] =
3746      __gen_uint(values->DWordLength, 0, 7) |
3747      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3748      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3749      __gen_uint(values->CommandSubType, 27, 28) |
3750      __gen_uint(values->CommandType, 29, 31);
3751
3752   dw[1] =
3753      __gen_offset(values->PointertoVSBindingTable, 5, 15);
3754}
3755
3756#define GFX11_3DSTATE_BINDING_TABLE_POOL_ALLOC_length      4
3757#define GFX11_3DSTATE_BINDING_TABLE_POOL_ALLOC_length_bias      2
3758#define GFX11_3DSTATE_BINDING_TABLE_POOL_ALLOC_header\
3759   .DWordLength                         =      2,  \
3760   ._3DCommandSubOpcode                 =     25,  \
3761   ._3DCommandOpcode                    =      1,  \
3762   .CommandSubType                      =      3,  \
3763   .CommandType                         =      3
3764
3765struct GFX11_3DSTATE_BINDING_TABLE_POOL_ALLOC {
3766   uint32_t                             DWordLength;
3767   uint32_t                             _3DCommandSubOpcode;
3768   uint32_t                             _3DCommandOpcode;
3769   uint32_t                             CommandSubType;
3770   uint32_t                             CommandType;
3771   uint32_t                             MOCS;
3772   bool                                 BindingTablePoolEnable;
3773   __gen_address_type                   BindingTablePoolBaseAddress;
3774   uint32_t                             BindingTablePoolBufferSize;
3775#define NoValidData                              0
3776};
3777
3778static inline __attribute__((always_inline)) void
3779GFX11_3DSTATE_BINDING_TABLE_POOL_ALLOC_pack(__attribute__((unused)) __gen_user_data *data,
3780                                            __attribute__((unused)) void * restrict dst,
3781                                            __attribute__((unused)) const struct GFX11_3DSTATE_BINDING_TABLE_POOL_ALLOC * restrict values)
3782{
3783   uint32_t * restrict dw = (uint32_t * restrict) dst;
3784
3785   dw[0] =
3786      __gen_uint(values->DWordLength, 0, 7) |
3787      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3788      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3789      __gen_uint(values->CommandSubType, 27, 28) |
3790      __gen_uint(values->CommandType, 29, 31);
3791
3792   const uint64_t v1 =
3793      __gen_uint(values->MOCS, 0, 6) |
3794      __gen_uint(values->BindingTablePoolEnable, 11, 11);
3795   const uint64_t v1_address =
3796      __gen_address(data, &dw[1], values->BindingTablePoolBaseAddress, v1, 12, 63);
3797   dw[1] = v1_address;
3798   dw[2] = (v1_address >> 32) | (v1 >> 32);
3799
3800   dw[3] =
3801      __gen_uint(values->BindingTablePoolBufferSize, 12, 31);
3802}
3803
3804#define GFX11_3DSTATE_BLEND_STATE_POINTERS_length      2
3805#define GFX11_3DSTATE_BLEND_STATE_POINTERS_length_bias      2
3806#define GFX11_3DSTATE_BLEND_STATE_POINTERS_header\
3807   .DWordLength                         =      0,  \
3808   ._3DCommandSubOpcode                 =     36,  \
3809   ._3DCommandOpcode                    =      0,  \
3810   .CommandSubType                      =      3,  \
3811   .CommandType                         =      3
3812
3813struct GFX11_3DSTATE_BLEND_STATE_POINTERS {
3814   uint32_t                             DWordLength;
3815   uint32_t                             _3DCommandSubOpcode;
3816   uint32_t                             _3DCommandOpcode;
3817   uint32_t                             CommandSubType;
3818   uint32_t                             CommandType;
3819   bool                                 BlendStatePointerValid;
3820   uint64_t                             BlendStatePointer;
3821};
3822
3823static inline __attribute__((always_inline)) void
3824GFX11_3DSTATE_BLEND_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
3825                                        __attribute__((unused)) void * restrict dst,
3826                                        __attribute__((unused)) const struct GFX11_3DSTATE_BLEND_STATE_POINTERS * restrict values)
3827{
3828   uint32_t * restrict dw = (uint32_t * restrict) dst;
3829
3830   dw[0] =
3831      __gen_uint(values->DWordLength, 0, 7) |
3832      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3833      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3834      __gen_uint(values->CommandSubType, 27, 28) |
3835      __gen_uint(values->CommandType, 29, 31);
3836
3837   dw[1] =
3838      __gen_uint(values->BlendStatePointerValid, 0, 0) |
3839      __gen_offset(values->BlendStatePointer, 6, 31);
3840}
3841
3842#define GFX11_3DSTATE_CC_STATE_POINTERS_length      2
3843#define GFX11_3DSTATE_CC_STATE_POINTERS_length_bias      2
3844#define GFX11_3DSTATE_CC_STATE_POINTERS_header  \
3845   .DWordLength                         =      0,  \
3846   ._3DCommandSubOpcode                 =     14,  \
3847   ._3DCommandOpcode                    =      0,  \
3848   .CommandSubType                      =      3,  \
3849   .CommandType                         =      3
3850
3851struct GFX11_3DSTATE_CC_STATE_POINTERS {
3852   uint32_t                             DWordLength;
3853   uint32_t                             _3DCommandSubOpcode;
3854   uint32_t                             _3DCommandOpcode;
3855   uint32_t                             CommandSubType;
3856   uint32_t                             CommandType;
3857   bool                                 ColorCalcStatePointerValid;
3858   uint64_t                             ColorCalcStatePointer;
3859};
3860
3861static inline __attribute__((always_inline)) void
3862GFX11_3DSTATE_CC_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
3863                                     __attribute__((unused)) void * restrict dst,
3864                                     __attribute__((unused)) const struct GFX11_3DSTATE_CC_STATE_POINTERS * restrict values)
3865{
3866   uint32_t * restrict dw = (uint32_t * restrict) dst;
3867
3868   dw[0] =
3869      __gen_uint(values->DWordLength, 0, 7) |
3870      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3871      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3872      __gen_uint(values->CommandSubType, 27, 28) |
3873      __gen_uint(values->CommandType, 29, 31);
3874
3875   dw[1] =
3876      __gen_uint(values->ColorCalcStatePointerValid, 0, 0) |
3877      __gen_offset(values->ColorCalcStatePointer, 6, 31);
3878}
3879
3880#define GFX11_3DSTATE_CHROMA_KEY_length        4
3881#define GFX11_3DSTATE_CHROMA_KEY_length_bias      2
3882#define GFX11_3DSTATE_CHROMA_KEY_header         \
3883   .DWordLength                         =      2,  \
3884   ._3DCommandSubOpcode                 =      4,  \
3885   ._3DCommandOpcode                    =      1,  \
3886   .CommandSubType                      =      3,  \
3887   .CommandType                         =      3
3888
3889struct GFX11_3DSTATE_CHROMA_KEY {
3890   uint32_t                             DWordLength;
3891   uint32_t                             _3DCommandSubOpcode;
3892   uint32_t                             _3DCommandOpcode;
3893   uint32_t                             CommandSubType;
3894   uint32_t                             CommandType;
3895   uint32_t                             ChromaKeyTableIndex;
3896   uint32_t                             ChromaKeyLowValue;
3897   uint32_t                             ChromaKeyHighValue;
3898};
3899
3900static inline __attribute__((always_inline)) void
3901GFX11_3DSTATE_CHROMA_KEY_pack(__attribute__((unused)) __gen_user_data *data,
3902                              __attribute__((unused)) void * restrict dst,
3903                              __attribute__((unused)) const struct GFX11_3DSTATE_CHROMA_KEY * restrict values)
3904{
3905   uint32_t * restrict dw = (uint32_t * restrict) dst;
3906
3907   dw[0] =
3908      __gen_uint(values->DWordLength, 0, 7) |
3909      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3910      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3911      __gen_uint(values->CommandSubType, 27, 28) |
3912      __gen_uint(values->CommandType, 29, 31);
3913
3914   dw[1] =
3915      __gen_uint(values->ChromaKeyTableIndex, 30, 31);
3916
3917   dw[2] =
3918      __gen_uint(values->ChromaKeyLowValue, 0, 31);
3919
3920   dw[3] =
3921      __gen_uint(values->ChromaKeyHighValue, 0, 31);
3922}
3923
3924#define GFX11_3DSTATE_CLEAR_PARAMS_length      3
3925#define GFX11_3DSTATE_CLEAR_PARAMS_length_bias      2
3926#define GFX11_3DSTATE_CLEAR_PARAMS_header       \
3927   .DWordLength                         =      1,  \
3928   ._3DCommandSubOpcode                 =      4,  \
3929   ._3DCommandOpcode                    =      0,  \
3930   .CommandSubType                      =      3,  \
3931   .CommandType                         =      3
3932
3933struct GFX11_3DSTATE_CLEAR_PARAMS {
3934   uint32_t                             DWordLength;
3935   uint32_t                             _3DCommandSubOpcode;
3936   uint32_t                             _3DCommandOpcode;
3937   uint32_t                             CommandSubType;
3938   uint32_t                             CommandType;
3939   float                                DepthClearValue;
3940   bool                                 DepthClearValueValid;
3941};
3942
3943static inline __attribute__((always_inline)) void
3944GFX11_3DSTATE_CLEAR_PARAMS_pack(__attribute__((unused)) __gen_user_data *data,
3945                                __attribute__((unused)) void * restrict dst,
3946                                __attribute__((unused)) const struct GFX11_3DSTATE_CLEAR_PARAMS * restrict values)
3947{
3948   uint32_t * restrict dw = (uint32_t * restrict) dst;
3949
3950   dw[0] =
3951      __gen_uint(values->DWordLength, 0, 7) |
3952      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3953      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3954      __gen_uint(values->CommandSubType, 27, 28) |
3955      __gen_uint(values->CommandType, 29, 31);
3956
3957   dw[1] =
3958      __gen_float(values->DepthClearValue);
3959
3960   dw[2] =
3961      __gen_uint(values->DepthClearValueValid, 0, 0);
3962}
3963
3964#define GFX11_3DSTATE_CLIP_length              4
3965#define GFX11_3DSTATE_CLIP_length_bias         2
3966#define GFX11_3DSTATE_CLIP_header               \
3967   .DWordLength                         =      2,  \
3968   ._3DCommandSubOpcode                 =     18,  \
3969   ._3DCommandOpcode                    =      0,  \
3970   .CommandSubType                      =      3,  \
3971   .CommandType                         =      3
3972
3973struct GFX11_3DSTATE_CLIP {
3974   uint32_t                             DWordLength;
3975   uint32_t                             _3DCommandSubOpcode;
3976   uint32_t                             _3DCommandOpcode;
3977   uint32_t                             CommandSubType;
3978   uint32_t                             CommandType;
3979   uint32_t                             UserClipDistanceCullTestEnableBitmask;
3980   bool                                 StatisticsEnable;
3981   bool                                 ForceClipMode;
3982   bool                                 ForceUserClipDistanceClipTestEnableBitmask;
3983   bool                                 EarlyCullEnable;
3984   uint32_t                             VertexSubPixelPrecisionSelect;
3985#define _8Bit                                    0
3986#define _4Bit                                    1
3987   bool                                 ForceUserClipDistanceCullTestEnableBitmask;
3988   uint32_t                             TriangleFanProvokingVertexSelect;
3989   uint32_t                             LineStripListProvokingVertexSelect;
3990   uint32_t                             TriangleStripListProvokingVertexSelect;
3991   bool                                 NonPerspectiveBarycentricEnable;
3992   bool                                 PerspectiveDivideDisable;
3993   uint32_t                             ClipMode;
3994#define CLIPMODE_NORMAL                          0
3995#define CLIPMODE_REJECT_ALL                      3
3996#define CLIPMODE_ACCEPT_ALL                      4
3997   uint32_t                             UserClipDistanceClipTestEnableBitmask;
3998   bool                                 GuardbandClipTestEnable;
3999   bool                                 ViewportXYClipTestEnable;
4000   uint32_t                             APIMode;
4001#define APIMODE_OGL                              0
4002#define APIMODE_D3D                              1
4003   bool                                 ClipEnable;
4004   uint32_t                             MaximumVPIndex;
4005   bool                                 ForceZeroRTAIndexEnable;
4006   float                                MaximumPointWidth;
4007   float                                MinimumPointWidth;
4008};
4009
4010static inline __attribute__((always_inline)) void
4011GFX11_3DSTATE_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
4012                        __attribute__((unused)) void * restrict dst,
4013                        __attribute__((unused)) const struct GFX11_3DSTATE_CLIP * restrict values)
4014{
4015   uint32_t * restrict dw = (uint32_t * restrict) dst;
4016
4017   dw[0] =
4018      __gen_uint(values->DWordLength, 0, 7) |
4019      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4020      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4021      __gen_uint(values->CommandSubType, 27, 28) |
4022      __gen_uint(values->CommandType, 29, 31);
4023
4024   dw[1] =
4025      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
4026      __gen_uint(values->StatisticsEnable, 10, 10) |
4027      __gen_uint(values->ForceClipMode, 16, 16) |
4028      __gen_uint(values->ForceUserClipDistanceClipTestEnableBitmask, 17, 17) |
4029      __gen_uint(values->EarlyCullEnable, 18, 18) |
4030      __gen_uint(values->VertexSubPixelPrecisionSelect, 19, 19) |
4031      __gen_uint(values->ForceUserClipDistanceCullTestEnableBitmask, 20, 20);
4032
4033   dw[2] =
4034      __gen_uint(values->TriangleFanProvokingVertexSelect, 0, 1) |
4035      __gen_uint(values->LineStripListProvokingVertexSelect, 2, 3) |
4036      __gen_uint(values->TriangleStripListProvokingVertexSelect, 4, 5) |
4037      __gen_uint(values->NonPerspectiveBarycentricEnable, 8, 8) |
4038      __gen_uint(values->PerspectiveDivideDisable, 9, 9) |
4039      __gen_uint(values->ClipMode, 13, 15) |
4040      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 16, 23) |
4041      __gen_uint(values->GuardbandClipTestEnable, 26, 26) |
4042      __gen_uint(values->ViewportXYClipTestEnable, 28, 28) |
4043      __gen_uint(values->APIMode, 30, 30) |
4044      __gen_uint(values->ClipEnable, 31, 31);
4045
4046   dw[3] =
4047      __gen_uint(values->MaximumVPIndex, 0, 3) |
4048      __gen_uint(values->ForceZeroRTAIndexEnable, 5, 5) |
4049      __gen_ufixed(values->MaximumPointWidth, 6, 16, 3) |
4050      __gen_ufixed(values->MinimumPointWidth, 17, 27, 3);
4051}
4052
4053#define GFX11_3DSTATE_CONSTANT_DS_length      11
4054#define GFX11_3DSTATE_CONSTANT_DS_length_bias      2
4055#define GFX11_3DSTATE_CONSTANT_DS_header        \
4056   .DWordLength                         =      9,  \
4057   ._3DCommandSubOpcode                 =     26,  \
4058   ._3DCommandOpcode                    =      0,  \
4059   .CommandSubType                      =      3,  \
4060   .CommandType                         =      3
4061
4062struct GFX11_3DSTATE_CONSTANT_DS {
4063   uint32_t                             DWordLength;
4064   uint32_t                             MOCS;
4065   uint32_t                             _3DCommandSubOpcode;
4066   uint32_t                             _3DCommandOpcode;
4067   uint32_t                             CommandSubType;
4068   uint32_t                             CommandType;
4069   struct GFX11_3DSTATE_CONSTANT_BODY   ConstantBody;
4070};
4071
4072static inline __attribute__((always_inline)) void
4073GFX11_3DSTATE_CONSTANT_DS_pack(__attribute__((unused)) __gen_user_data *data,
4074                               __attribute__((unused)) void * restrict dst,
4075                               __attribute__((unused)) const struct GFX11_3DSTATE_CONSTANT_DS * restrict values)
4076{
4077   uint32_t * restrict dw = (uint32_t * restrict) dst;
4078
4079   dw[0] =
4080      __gen_uint(values->DWordLength, 0, 7) |
4081      __gen_uint(values->MOCS, 8, 14) |
4082      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4083      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4084      __gen_uint(values->CommandSubType, 27, 28) |
4085      __gen_uint(values->CommandType, 29, 31);
4086
4087   GFX11_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
4088}
4089
4090#define GFX11_3DSTATE_CONSTANT_GS_length      11
4091#define GFX11_3DSTATE_CONSTANT_GS_length_bias      2
4092#define GFX11_3DSTATE_CONSTANT_GS_header        \
4093   .DWordLength                         =      9,  \
4094   ._3DCommandSubOpcode                 =     22,  \
4095   ._3DCommandOpcode                    =      0,  \
4096   .CommandSubType                      =      3,  \
4097   .CommandType                         =      3
4098
4099struct GFX11_3DSTATE_CONSTANT_GS {
4100   uint32_t                             DWordLength;
4101   uint32_t                             MOCS;
4102   uint32_t                             _3DCommandSubOpcode;
4103   uint32_t                             _3DCommandOpcode;
4104   uint32_t                             CommandSubType;
4105   uint32_t                             CommandType;
4106   struct GFX11_3DSTATE_CONSTANT_BODY   ConstantBody;
4107};
4108
4109static inline __attribute__((always_inline)) void
4110GFX11_3DSTATE_CONSTANT_GS_pack(__attribute__((unused)) __gen_user_data *data,
4111                               __attribute__((unused)) void * restrict dst,
4112                               __attribute__((unused)) const struct GFX11_3DSTATE_CONSTANT_GS * restrict values)
4113{
4114   uint32_t * restrict dw = (uint32_t * restrict) dst;
4115
4116   dw[0] =
4117      __gen_uint(values->DWordLength, 0, 7) |
4118      __gen_uint(values->MOCS, 8, 14) |
4119      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4120      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4121      __gen_uint(values->CommandSubType, 27, 28) |
4122      __gen_uint(values->CommandType, 29, 31);
4123
4124   GFX11_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
4125}
4126
4127#define GFX11_3DSTATE_CONSTANT_HS_length      11
4128#define GFX11_3DSTATE_CONSTANT_HS_length_bias      2
4129#define GFX11_3DSTATE_CONSTANT_HS_header        \
4130   .DWordLength                         =      9,  \
4131   ._3DCommandSubOpcode                 =     25,  \
4132   ._3DCommandOpcode                    =      0,  \
4133   .CommandSubType                      =      3,  \
4134   .CommandType                         =      3
4135
4136struct GFX11_3DSTATE_CONSTANT_HS {
4137   uint32_t                             DWordLength;
4138   uint32_t                             MOCS;
4139   uint32_t                             _3DCommandSubOpcode;
4140   uint32_t                             _3DCommandOpcode;
4141   uint32_t                             CommandSubType;
4142   uint32_t                             CommandType;
4143   struct GFX11_3DSTATE_CONSTANT_BODY   ConstantBody;
4144};
4145
4146static inline __attribute__((always_inline)) void
4147GFX11_3DSTATE_CONSTANT_HS_pack(__attribute__((unused)) __gen_user_data *data,
4148                               __attribute__((unused)) void * restrict dst,
4149                               __attribute__((unused)) const struct GFX11_3DSTATE_CONSTANT_HS * restrict values)
4150{
4151   uint32_t * restrict dw = (uint32_t * restrict) dst;
4152
4153   dw[0] =
4154      __gen_uint(values->DWordLength, 0, 7) |
4155      __gen_uint(values->MOCS, 8, 14) |
4156      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4157      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4158      __gen_uint(values->CommandSubType, 27, 28) |
4159      __gen_uint(values->CommandType, 29, 31);
4160
4161   GFX11_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
4162}
4163
4164#define GFX11_3DSTATE_CONSTANT_PS_length      11
4165#define GFX11_3DSTATE_CONSTANT_PS_length_bias      2
4166#define GFX11_3DSTATE_CONSTANT_PS_header        \
4167   .DWordLength                         =      9,  \
4168   ._3DCommandSubOpcode                 =     23,  \
4169   ._3DCommandOpcode                    =      0,  \
4170   .CommandSubType                      =      3,  \
4171   .CommandType                         =      3
4172
4173struct GFX11_3DSTATE_CONSTANT_PS {
4174   uint32_t                             DWordLength;
4175   uint32_t                             MOCS;
4176   uint32_t                             DisableGatheratSetShaderHint;
4177   uint32_t                             _3DCommandSubOpcode;
4178   uint32_t                             _3DCommandOpcode;
4179   uint32_t                             CommandSubType;
4180   uint32_t                             CommandType;
4181   struct GFX11_3DSTATE_CONSTANT_BODY   ConstantBody;
4182};
4183
4184static inline __attribute__((always_inline)) void
4185GFX11_3DSTATE_CONSTANT_PS_pack(__attribute__((unused)) __gen_user_data *data,
4186                               __attribute__((unused)) void * restrict dst,
4187                               __attribute__((unused)) const struct GFX11_3DSTATE_CONSTANT_PS * restrict values)
4188{
4189   uint32_t * restrict dw = (uint32_t * restrict) dst;
4190
4191   dw[0] =
4192      __gen_uint(values->DWordLength, 0, 7) |
4193      __gen_uint(values->MOCS, 8, 14) |
4194      __gen_uint(values->DisableGatheratSetShaderHint, 15, 15) |
4195      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4196      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4197      __gen_uint(values->CommandSubType, 27, 28) |
4198      __gen_uint(values->CommandType, 29, 31);
4199
4200   GFX11_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
4201}
4202
4203#define GFX11_3DSTATE_CONSTANT_VS_length      11
4204#define GFX11_3DSTATE_CONSTANT_VS_length_bias      2
4205#define GFX11_3DSTATE_CONSTANT_VS_header        \
4206   .DWordLength                         =      9,  \
4207   ._3DCommandSubOpcode                 =     21,  \
4208   ._3DCommandOpcode                    =      0,  \
4209   .CommandSubType                      =      3,  \
4210   .CommandType                         =      3
4211
4212struct GFX11_3DSTATE_CONSTANT_VS {
4213   uint32_t                             DWordLength;
4214   uint32_t                             MOCS;
4215   uint32_t                             _3DCommandSubOpcode;
4216   uint32_t                             _3DCommandOpcode;
4217   uint32_t                             CommandSubType;
4218   uint32_t                             CommandType;
4219   struct GFX11_3DSTATE_CONSTANT_BODY   ConstantBody;
4220};
4221
4222static inline __attribute__((always_inline)) void
4223GFX11_3DSTATE_CONSTANT_VS_pack(__attribute__((unused)) __gen_user_data *data,
4224                               __attribute__((unused)) void * restrict dst,
4225                               __attribute__((unused)) const struct GFX11_3DSTATE_CONSTANT_VS * restrict values)
4226{
4227   uint32_t * restrict dw = (uint32_t * restrict) dst;
4228
4229   dw[0] =
4230      __gen_uint(values->DWordLength, 0, 7) |
4231      __gen_uint(values->MOCS, 8, 14) |
4232      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4233      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4234      __gen_uint(values->CommandSubType, 27, 28) |
4235      __gen_uint(values->CommandType, 29, 31);
4236
4237   GFX11_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
4238}
4239
4240#define GFX11_3DSTATE_CPS_length               9
4241#define GFX11_3DSTATE_CPS_length_bias          2
4242#define GFX11_3DSTATE_CPS_header                \
4243   .DWordLength                         =      7,  \
4244   ._3DCommandSubOpcode                 =     34,  \
4245   ._3DCommandOpcode                    =      0,  \
4246   .CommandSubType                      =      3,  \
4247   .CommandType                         =      3
4248
4249struct GFX11_3DSTATE_CPS {
4250   uint32_t                             DWordLength;
4251   uint32_t                             _3DCommandSubOpcode;
4252   uint32_t                             _3DCommandOpcode;
4253   uint32_t                             CommandSubType;
4254   uint32_t                             CommandType;
4255   float                                MinCPSizeX;
4256   bool                                 StatisticsEnable;
4257   uint32_t                             CoarsePixelShadingMode;
4258#define CPS_MODE_NONE                            0
4259#define CPS_MODE_CONSTANT                        1
4260#define CPS_MODE_RADIAL                          2
4261   uint32_t                             ScaleAxis;
4262#define Xaxis                                    0
4263#define Yaxis                                    1
4264   float                                MinCPSizeY;
4265   float                                MaxCPSizeX;
4266   float                                MaxCPSizeY;
4267   int32_t                              YFocal;
4268   int32_t                              XFocal;
4269   float                                My;
4270   float                                Mx;
4271   float                                Rmin;
4272   float                                Aspect;
4273};
4274
4275static inline __attribute__((always_inline)) void
4276GFX11_3DSTATE_CPS_pack(__attribute__((unused)) __gen_user_data *data,
4277                       __attribute__((unused)) void * restrict dst,
4278                       __attribute__((unused)) const struct GFX11_3DSTATE_CPS * restrict values)
4279{
4280   uint32_t * restrict dw = (uint32_t * restrict) dst;
4281
4282   dw[0] =
4283      __gen_uint(values->DWordLength, 0, 7) |
4284      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4285      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4286      __gen_uint(values->CommandSubType, 27, 28) |
4287      __gen_uint(values->CommandType, 29, 31);
4288
4289   dw[1] =
4290      __gen_sfixed(values->MinCPSizeX, 0, 10, 7) |
4291      __gen_uint(values->StatisticsEnable, 11, 11) |
4292      __gen_uint(values->CoarsePixelShadingMode, 12, 13) |
4293      __gen_uint(values->ScaleAxis, 14, 14) |
4294      __gen_sfixed(values->MinCPSizeY, 16, 26, 7);
4295
4296   dw[2] =
4297      __gen_sfixed(values->MaxCPSizeX, 0, 10, 7) |
4298      __gen_sfixed(values->MaxCPSizeY, 16, 26, 7);
4299
4300   dw[3] =
4301      __gen_sint(values->YFocal, 0, 15);
4302
4303   dw[4] =
4304      __gen_sint(values->XFocal, 0, 15);
4305
4306   dw[5] =
4307      __gen_float(values->My);
4308
4309   dw[6] =
4310      __gen_float(values->Mx);
4311
4312   dw[7] =
4313      __gen_float(values->Rmin);
4314
4315   dw[8] =
4316      __gen_float(values->Aspect);
4317}
4318
4319#define GFX11_3DSTATE_DEPTH_BUFFER_length      8
4320#define GFX11_3DSTATE_DEPTH_BUFFER_length_bias      2
4321#define GFX11_3DSTATE_DEPTH_BUFFER_header       \
4322   .DWordLength                         =      6,  \
4323   ._3DCommandSubOpcode                 =      5,  \
4324   ._3DCommandOpcode                    =      0,  \
4325   .CommandSubType                      =      3,  \
4326   .CommandType                         =      3
4327
4328struct GFX11_3DSTATE_DEPTH_BUFFER {
4329   uint32_t                             DWordLength;
4330   uint32_t                             _3DCommandSubOpcode;
4331   uint32_t                             _3DCommandOpcode;
4332   uint32_t                             CommandSubType;
4333   uint32_t                             CommandType;
4334   uint32_t                             SurfacePitch;
4335   uint32_t                             SurfaceFormat;
4336#define D32_FLOAT                                1
4337#define D24_UNORM_X8_UINT                        3
4338#define D16_UNORM                                5
4339   bool                                 HierarchicalDepthBufferEnable;
4340   bool                                 StencilWriteEnable;
4341   bool                                 DepthWriteEnable;
4342   uint32_t                             SurfaceType;
4343#define SURFTYPE_2D                              1
4344#define SURFTYPE_CUBE                            3
4345#define SURFTYPE_NULL                            7
4346   __gen_address_type                   SurfaceBaseAddress;
4347   uint32_t                             LOD;
4348   uint32_t                             Width;
4349   uint32_t                             Height;
4350   uint32_t                             MOCS;
4351   uint32_t                             MinimumArrayElement;
4352   uint32_t                             Depth;
4353   uint32_t                             MipTailStartLOD;
4354   uint32_t                             TiledResourceMode;
4355#define NONE                                     0
4356#define TILEYF                                   1
4357#define TILEYS                                   2
4358   uint32_t                             SurfaceQPitch;
4359   uint32_t                             RenderTargetViewExtent;
4360};
4361
4362static inline __attribute__((always_inline)) void
4363GFX11_3DSTATE_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
4364                                __attribute__((unused)) void * restrict dst,
4365                                __attribute__((unused)) const struct GFX11_3DSTATE_DEPTH_BUFFER * restrict values)
4366{
4367   uint32_t * restrict dw = (uint32_t * restrict) dst;
4368
4369   dw[0] =
4370      __gen_uint(values->DWordLength, 0, 7) |
4371      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4372      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4373      __gen_uint(values->CommandSubType, 27, 28) |
4374      __gen_uint(values->CommandType, 29, 31);
4375
4376   dw[1] =
4377      __gen_uint(values->SurfacePitch, 0, 17) |
4378      __gen_uint(values->SurfaceFormat, 18, 20) |
4379      __gen_uint(values->HierarchicalDepthBufferEnable, 22, 22) |
4380      __gen_uint(values->StencilWriteEnable, 27, 27) |
4381      __gen_uint(values->DepthWriteEnable, 28, 28) |
4382      __gen_uint(values->SurfaceType, 29, 31);
4383
4384   const uint64_t v2_address =
4385      __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 0, 63);
4386   dw[2] = v2_address;
4387   dw[3] = v2_address >> 32;
4388
4389   dw[4] =
4390      __gen_uint(values->LOD, 0, 3) |
4391      __gen_uint(values->Width, 4, 17) |
4392      __gen_uint(values->Height, 18, 31);
4393
4394   dw[5] =
4395      __gen_uint(values->MOCS, 0, 6) |
4396      __gen_uint(values->MinimumArrayElement, 10, 20) |
4397      __gen_uint(values->Depth, 21, 31);
4398
4399   dw[6] =
4400      __gen_uint(values->MipTailStartLOD, 26, 29) |
4401      __gen_uint(values->TiledResourceMode, 30, 31);
4402
4403   dw[7] =
4404      __gen_uint(values->SurfaceQPitch, 0, 14) |
4405      __gen_uint(values->RenderTargetViewExtent, 21, 31);
4406}
4407
4408#define GFX11_3DSTATE_DRAWING_RECTANGLE_length      4
4409#define GFX11_3DSTATE_DRAWING_RECTANGLE_length_bias      2
4410#define GFX11_3DSTATE_DRAWING_RECTANGLE_header  \
4411   .DWordLength                         =      2,  \
4412   ._3DCommandSubOpcode                 =      0,  \
4413   ._3DCommandOpcode                    =      1,  \
4414   .CommandSubType                      =      3,  \
4415   .CommandType                         =      3
4416
4417struct GFX11_3DSTATE_DRAWING_RECTANGLE {
4418   uint32_t                             DWordLength;
4419   uint32_t                             CoreModeSelect;
4420#define Legacy                                   0
4421#define Core0Enabled                             1
4422#define Core1Enabled                             2
4423   uint32_t                             _3DCommandSubOpcode;
4424   uint32_t                             _3DCommandOpcode;
4425   uint32_t                             CommandSubType;
4426   uint32_t                             CommandType;
4427   uint32_t                             ClippedDrawingRectangleXMin;
4428   uint32_t                             ClippedDrawingRectangleYMin;
4429   uint32_t                             ClippedDrawingRectangleXMax;
4430   uint32_t                             ClippedDrawingRectangleYMax;
4431   int32_t                              DrawingRectangleOriginX;
4432   int32_t                              DrawingRectangleOriginY;
4433};
4434
4435static inline __attribute__((always_inline)) void
4436GFX11_3DSTATE_DRAWING_RECTANGLE_pack(__attribute__((unused)) __gen_user_data *data,
4437                                     __attribute__((unused)) void * restrict dst,
4438                                     __attribute__((unused)) const struct GFX11_3DSTATE_DRAWING_RECTANGLE * restrict values)
4439{
4440   uint32_t * restrict dw = (uint32_t * restrict) dst;
4441
4442   dw[0] =
4443      __gen_uint(values->DWordLength, 0, 7) |
4444      __gen_uint(values->CoreModeSelect, 14, 15) |
4445      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4446      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4447      __gen_uint(values->CommandSubType, 27, 28) |
4448      __gen_uint(values->CommandType, 29, 31);
4449
4450   dw[1] =
4451      __gen_uint(values->ClippedDrawingRectangleXMin, 0, 15) |
4452      __gen_uint(values->ClippedDrawingRectangleYMin, 16, 31);
4453
4454   dw[2] =
4455      __gen_uint(values->ClippedDrawingRectangleXMax, 0, 15) |
4456      __gen_uint(values->ClippedDrawingRectangleYMax, 16, 31);
4457
4458   dw[3] =
4459      __gen_sint(values->DrawingRectangleOriginX, 0, 15) |
4460      __gen_sint(values->DrawingRectangleOriginY, 16, 31);
4461}
4462
4463#define GFX11_3DSTATE_DS_length               11
4464#define GFX11_3DSTATE_DS_length_bias           2
4465#define GFX11_3DSTATE_DS_header                 \
4466   .DWordLength                         =      9,  \
4467   ._3DCommandSubOpcode                 =     29,  \
4468   ._3DCommandOpcode                    =      0,  \
4469   .CommandSubType                      =      3,  \
4470   .CommandType                         =      3
4471
4472struct GFX11_3DSTATE_DS {
4473   uint32_t                             DWordLength;
4474   uint32_t                             _3DCommandSubOpcode;
4475   uint32_t                             _3DCommandOpcode;
4476   uint32_t                             CommandSubType;
4477   uint32_t                             CommandType;
4478   uint64_t                             KernelStartPointer;
4479   bool                                 SoftwareExceptionEnable;
4480   bool                                 IllegalOpcodeExceptionEnable;
4481   bool                                 AccessesUAV;
4482   uint32_t                             FloatingPointMode;
4483#define IEEE754                                  0
4484#define Alternate                                1
4485   uint32_t                             ThreadDispatchPriority;
4486#define High                                     1
4487   uint32_t                             BindingTableEntryCount;
4488   uint32_t                             SamplerCount;
4489#define NoSamplers                               0
4490#define _14Samplers                              1
4491#define _58Samplers                              2
4492#define _912Samplers                             3
4493#define _1316Samplers                            4
4494   bool                                 VectorMaskEnable;
4495   uint32_t                             PerThreadScratchSpace;
4496   __gen_address_type                   ScratchSpaceBasePointer;
4497   uint32_t                             PatchURBEntryReadOffset;
4498   uint32_t                             PatchURBEntryReadLength;
4499   uint32_t                             DispatchGRFStartRegisterForURBData;
4500   bool                                 Enable;
4501   bool                                 CacheDisable;
4502   bool                                 ComputeWCoordinateEnable;
4503   uint32_t                             DispatchMode;
4504#define DISPATCH_MODE_SIMD8_SINGLE_PATCH         1
4505#define DISPATCH_MODE_SIMD8_SINGLE_OR_DUAL_PATCH 2
4506   bool                                 StatisticsEnable;
4507   uint32_t                             MaximumNumberofThreads;
4508   uint32_t                             UserClipDistanceCullTestEnableBitmask;
4509   uint32_t                             UserClipDistanceClipTestEnableBitmask;
4510   uint32_t                             VertexURBEntryOutputLength;
4511   uint32_t                             VertexURBEntryOutputReadOffset;
4512   uint64_t                             DUAL_PATCHKernelStartPointer;
4513};
4514
4515static inline __attribute__((always_inline)) void
4516GFX11_3DSTATE_DS_pack(__attribute__((unused)) __gen_user_data *data,
4517                      __attribute__((unused)) void * restrict dst,
4518                      __attribute__((unused)) const struct GFX11_3DSTATE_DS * restrict values)
4519{
4520   uint32_t * restrict dw = (uint32_t * restrict) dst;
4521
4522   dw[0] =
4523      __gen_uint(values->DWordLength, 0, 7) |
4524      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4525      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4526      __gen_uint(values->CommandSubType, 27, 28) |
4527      __gen_uint(values->CommandType, 29, 31);
4528
4529   const uint64_t v1 =
4530      __gen_offset(values->KernelStartPointer, 6, 63);
4531   dw[1] = v1;
4532   dw[2] = v1 >> 32;
4533
4534   dw[3] =
4535      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
4536      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
4537      __gen_uint(values->AccessesUAV, 14, 14) |
4538      __gen_uint(values->FloatingPointMode, 16, 16) |
4539      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
4540      __gen_uint(values->BindingTableEntryCount, 18, 25) |
4541      __gen_uint(values->SamplerCount, 27, 29) |
4542      __gen_uint(values->VectorMaskEnable, 30, 30);
4543
4544   const uint64_t v4 =
4545      __gen_uint(values->PerThreadScratchSpace, 0, 3);
4546   const uint64_t v4_address =
4547      __gen_address(data, &dw[4], values->ScratchSpaceBasePointer, v4, 10, 63);
4548   dw[4] = v4_address;
4549   dw[5] = (v4_address >> 32) | (v4 >> 32);
4550
4551   dw[6] =
4552      __gen_uint(values->PatchURBEntryReadOffset, 4, 9) |
4553      __gen_uint(values->PatchURBEntryReadLength, 11, 17) |
4554      __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
4555
4556   dw[7] =
4557      __gen_uint(values->Enable, 0, 0) |
4558      __gen_uint(values->CacheDisable, 1, 1) |
4559      __gen_uint(values->ComputeWCoordinateEnable, 2, 2) |
4560      __gen_uint(values->DispatchMode, 3, 4) |
4561      __gen_uint(values->StatisticsEnable, 10, 10) |
4562      __gen_uint(values->MaximumNumberofThreads, 21, 30);
4563
4564   dw[8] =
4565      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
4566      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 8, 15) |
4567      __gen_uint(values->VertexURBEntryOutputLength, 16, 20) |
4568      __gen_uint(values->VertexURBEntryOutputReadOffset, 21, 26);
4569
4570   const uint64_t v9 =
4571      __gen_offset(values->DUAL_PATCHKernelStartPointer, 6, 63);
4572   dw[9] = v9;
4573   dw[10] = v9 >> 32;
4574}
4575
4576#define GFX11_3DSTATE_GATHER_CONSTANT_DS_length_bias      2
4577#define GFX11_3DSTATE_GATHER_CONSTANT_DS_header \
4578   .DWordLength                         =      1,  \
4579   ._3DCommandSubOpcode                 =     55,  \
4580   ._3DCommandOpcode                    =      0,  \
4581   .CommandSubType                      =      3,  \
4582   .CommandType                         =      3
4583
4584struct GFX11_3DSTATE_GATHER_CONSTANT_DS {
4585   uint32_t                             DWordLength;
4586   uint32_t                             _3DCommandSubOpcode;
4587   uint32_t                             _3DCommandOpcode;
4588   uint32_t                             CommandSubType;
4589   uint32_t                             CommandType;
4590   uint32_t                             UpdateGatherTableOnly;
4591#define CommitGather                             0
4592#define NonCommitGather                          1
4593   uint32_t                             ConstantBufferBindingTableBlock;
4594   uint32_t                             ConstantBufferValid;
4595   uint32_t                             OnDieTable;
4596#define Load                                     0
4597#define Read                                     1
4598   bool                                 ConstantBufferDx9GenerateStall;
4599   uint64_t                             GatherBufferOffset;
4600   /* variable length fields follow */
4601};
4602
4603static inline __attribute__((always_inline)) void
4604GFX11_3DSTATE_GATHER_CONSTANT_DS_pack(__attribute__((unused)) __gen_user_data *data,
4605                                      __attribute__((unused)) void * restrict dst,
4606                                      __attribute__((unused)) const struct GFX11_3DSTATE_GATHER_CONSTANT_DS * restrict values)
4607{
4608   uint32_t * restrict dw = (uint32_t * restrict) dst;
4609
4610   dw[0] =
4611      __gen_uint(values->DWordLength, 0, 7) |
4612      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4613      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4614      __gen_uint(values->CommandSubType, 27, 28) |
4615      __gen_uint(values->CommandType, 29, 31);
4616
4617   dw[1] =
4618      __gen_uint(values->UpdateGatherTableOnly, 1, 1) |
4619      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
4620      __gen_uint(values->ConstantBufferValid, 16, 31);
4621
4622   dw[2] =
4623      __gen_uint(values->OnDieTable, 3, 3) |
4624      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
4625      __gen_offset(values->GatherBufferOffset, 6, 22);
4626}
4627
4628#define GFX11_3DSTATE_GATHER_CONSTANT_GS_length_bias      2
4629#define GFX11_3DSTATE_GATHER_CONSTANT_GS_header \
4630   .DWordLength                         =      1,  \
4631   ._3DCommandSubOpcode                 =     53,  \
4632   ._3DCommandOpcode                    =      0,  \
4633   .CommandSubType                      =      3,  \
4634   .CommandType                         =      3
4635
4636struct GFX11_3DSTATE_GATHER_CONSTANT_GS {
4637   uint32_t                             DWordLength;
4638   uint32_t                             _3DCommandSubOpcode;
4639   uint32_t                             _3DCommandOpcode;
4640   uint32_t                             CommandSubType;
4641   uint32_t                             CommandType;
4642   uint32_t                             UpdateGatherTableOnly;
4643#define CommitGather                             0
4644#define NonCommitGather                          1
4645   uint32_t                             ConstantBufferBindingTableBlock;
4646   uint32_t                             ConstantBufferValid;
4647   uint32_t                             OnDieTable;
4648#define Load                                     0
4649#define Read                                     1
4650   bool                                 ConstantBufferDx9GenerateStall;
4651   uint64_t                             GatherBufferOffset;
4652   /* variable length fields follow */
4653};
4654
4655static inline __attribute__((always_inline)) void
4656GFX11_3DSTATE_GATHER_CONSTANT_GS_pack(__attribute__((unused)) __gen_user_data *data,
4657                                      __attribute__((unused)) void * restrict dst,
4658                                      __attribute__((unused)) const struct GFX11_3DSTATE_GATHER_CONSTANT_GS * restrict values)
4659{
4660   uint32_t * restrict dw = (uint32_t * restrict) dst;
4661
4662   dw[0] =
4663      __gen_uint(values->DWordLength, 0, 7) |
4664      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4665      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4666      __gen_uint(values->CommandSubType, 27, 28) |
4667      __gen_uint(values->CommandType, 29, 31);
4668
4669   dw[1] =
4670      __gen_uint(values->UpdateGatherTableOnly, 1, 1) |
4671      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
4672      __gen_uint(values->ConstantBufferValid, 16, 31);
4673
4674   dw[2] =
4675      __gen_uint(values->OnDieTable, 3, 3) |
4676      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
4677      __gen_offset(values->GatherBufferOffset, 6, 22);
4678}
4679
4680#define GFX11_3DSTATE_GATHER_CONSTANT_HS_length_bias      2
4681#define GFX11_3DSTATE_GATHER_CONSTANT_HS_header \
4682   .DWordLength                         =      1,  \
4683   ._3DCommandSubOpcode                 =     54,  \
4684   ._3DCommandOpcode                    =      0,  \
4685   .CommandSubType                      =      3,  \
4686   .CommandType                         =      3
4687
4688struct GFX11_3DSTATE_GATHER_CONSTANT_HS {
4689   uint32_t                             DWordLength;
4690   uint32_t                             _3DCommandSubOpcode;
4691   uint32_t                             _3DCommandOpcode;
4692   uint32_t                             CommandSubType;
4693   uint32_t                             CommandType;
4694   uint32_t                             UpdateGatherTableOnly;
4695#define CommitGather                             0
4696#define NonCommitGather                          1
4697   uint32_t                             ConstantBufferBindingTableBlock;
4698   uint32_t                             ConstantBufferValid;
4699   uint32_t                             OnDieTable;
4700#define Load                                     0
4701#define Read                                     1
4702   bool                                 ConstantBufferDx9GenerateStall;
4703   uint64_t                             GatherBufferOffset;
4704   /* variable length fields follow */
4705};
4706
4707static inline __attribute__((always_inline)) void
4708GFX11_3DSTATE_GATHER_CONSTANT_HS_pack(__attribute__((unused)) __gen_user_data *data,
4709                                      __attribute__((unused)) void * restrict dst,
4710                                      __attribute__((unused)) const struct GFX11_3DSTATE_GATHER_CONSTANT_HS * restrict values)
4711{
4712   uint32_t * restrict dw = (uint32_t * restrict) dst;
4713
4714   dw[0] =
4715      __gen_uint(values->DWordLength, 0, 7) |
4716      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4717      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4718      __gen_uint(values->CommandSubType, 27, 28) |
4719      __gen_uint(values->CommandType, 29, 31);
4720
4721   dw[1] =
4722      __gen_uint(values->UpdateGatherTableOnly, 1, 1) |
4723      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
4724      __gen_uint(values->ConstantBufferValid, 16, 31);
4725
4726   dw[2] =
4727      __gen_uint(values->OnDieTable, 3, 3) |
4728      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
4729      __gen_offset(values->GatherBufferOffset, 6, 22);
4730}
4731
4732#define GFX11_3DSTATE_GATHER_CONSTANT_PS_length_bias      2
4733#define GFX11_3DSTATE_GATHER_CONSTANT_PS_header \
4734   .DWordLength                         =      1,  \
4735   ._3DCommandSubOpcode                 =     56,  \
4736   ._3DCommandOpcode                    =      0,  \
4737   .CommandSubType                      =      3,  \
4738   .CommandType                         =      3
4739
4740struct GFX11_3DSTATE_GATHER_CONSTANT_PS {
4741   uint32_t                             DWordLength;
4742   uint32_t                             _3DCommandSubOpcode;
4743   uint32_t                             _3DCommandOpcode;
4744   uint32_t                             CommandSubType;
4745   uint32_t                             CommandType;
4746   bool                                 DX9OnDieRegisterReadEnable;
4747   uint32_t                             UpdateGatherTableOnly;
4748#define CommitGather                             0
4749#define NonCommitGather                          1
4750   uint32_t                             ConstantBufferBindingTableBlock;
4751   uint32_t                             ConstantBufferValid;
4752   uint32_t                             OnDieTable;
4753#define Load                                     0
4754#define Read                                     1
4755   bool                                 ConstantBufferDx9Enable;
4756   bool                                 ConstantBufferDx9GenerateStall;
4757   uint64_t                             GatherBufferOffset;
4758   /* variable length fields follow */
4759};
4760
4761static inline __attribute__((always_inline)) void
4762GFX11_3DSTATE_GATHER_CONSTANT_PS_pack(__attribute__((unused)) __gen_user_data *data,
4763                                      __attribute__((unused)) void * restrict dst,
4764                                      __attribute__((unused)) const struct GFX11_3DSTATE_GATHER_CONSTANT_PS * restrict values)
4765{
4766   uint32_t * restrict dw = (uint32_t * restrict) dst;
4767
4768   dw[0] =
4769      __gen_uint(values->DWordLength, 0, 7) |
4770      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4771      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4772      __gen_uint(values->CommandSubType, 27, 28) |
4773      __gen_uint(values->CommandType, 29, 31);
4774
4775   dw[1] =
4776      __gen_uint(values->DX9OnDieRegisterReadEnable, 0, 0) |
4777      __gen_uint(values->UpdateGatherTableOnly, 1, 1) |
4778      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
4779      __gen_uint(values->ConstantBufferValid, 16, 31);
4780
4781   dw[2] =
4782      __gen_uint(values->OnDieTable, 3, 3) |
4783      __gen_uint(values->ConstantBufferDx9Enable, 4, 4) |
4784      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
4785      __gen_offset(values->GatherBufferOffset, 6, 22);
4786}
4787
4788#define GFX11_3DSTATE_GATHER_CONSTANT_VS_length_bias      2
4789#define GFX11_3DSTATE_GATHER_CONSTANT_VS_header \
4790   .DWordLength                         =      0,  \
4791   ._3DCommandSubOpcode                 =     52,  \
4792   ._3DCommandOpcode                    =      0,  \
4793   .CommandSubType                      =      3,  \
4794   .CommandType                         =      3
4795
4796struct GFX11_3DSTATE_GATHER_CONSTANT_VS {
4797   uint32_t                             DWordLength;
4798   uint32_t                             _3DCommandSubOpcode;
4799   uint32_t                             _3DCommandOpcode;
4800   uint32_t                             CommandSubType;
4801   uint32_t                             CommandType;
4802   bool                                 DX9OnDieRegisterReadEnable;
4803   uint32_t                             UpdateGatherTableOnly;
4804#define CommitGather                             0
4805#define NonCommitGather                          1
4806   uint32_t                             ConstantBufferBindingTableBlock;
4807   uint32_t                             ConstantBufferValid;
4808   uint32_t                             OnDieTable;
4809#define Load                                     0
4810#define Read                                     1
4811   bool                                 ConstantBufferDx9Enable;
4812   bool                                 ConstantBufferDx9GenerateStall;
4813   uint64_t                             GatherBufferOffset;
4814   /* variable length fields follow */
4815};
4816
4817static inline __attribute__((always_inline)) void
4818GFX11_3DSTATE_GATHER_CONSTANT_VS_pack(__attribute__((unused)) __gen_user_data *data,
4819                                      __attribute__((unused)) void * restrict dst,
4820                                      __attribute__((unused)) const struct GFX11_3DSTATE_GATHER_CONSTANT_VS * restrict values)
4821{
4822   uint32_t * restrict dw = (uint32_t * restrict) dst;
4823
4824   dw[0] =
4825      __gen_uint(values->DWordLength, 0, 7) |
4826      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4827      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4828      __gen_uint(values->CommandSubType, 27, 28) |
4829      __gen_uint(values->CommandType, 29, 31);
4830
4831   dw[1] =
4832      __gen_uint(values->DX9OnDieRegisterReadEnable, 0, 0) |
4833      __gen_uint(values->UpdateGatherTableOnly, 1, 1) |
4834      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
4835      __gen_uint(values->ConstantBufferValid, 16, 31);
4836
4837   dw[2] =
4838      __gen_uint(values->OnDieTable, 3, 3) |
4839      __gen_uint(values->ConstantBufferDx9Enable, 4, 4) |
4840      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
4841      __gen_offset(values->GatherBufferOffset, 6, 22);
4842}
4843
4844#define GFX11_3DSTATE_GATHER_POOL_ALLOC_length      4
4845#define GFX11_3DSTATE_GATHER_POOL_ALLOC_length_bias      2
4846#define GFX11_3DSTATE_GATHER_POOL_ALLOC_header  \
4847   .DWordLength                         =      2,  \
4848   ._3DCommandSubOpcode                 =     26,  \
4849   ._3DCommandOpcode                    =      1,  \
4850   .CommandSubType                      =      3,  \
4851   .CommandType                         =      3
4852
4853struct GFX11_3DSTATE_GATHER_POOL_ALLOC {
4854   uint32_t                             DWordLength;
4855   uint32_t                             _3DCommandSubOpcode;
4856   uint32_t                             _3DCommandOpcode;
4857   uint32_t                             CommandSubType;
4858   uint32_t                             CommandType;
4859   uint32_t                             MOCS;
4860   bool                                 GatherPoolEnable;
4861   __gen_address_type                   GatherPoolBaseAddress;
4862   uint32_t                             GatherPoolBufferSize;
4863};
4864
4865static inline __attribute__((always_inline)) void
4866GFX11_3DSTATE_GATHER_POOL_ALLOC_pack(__attribute__((unused)) __gen_user_data *data,
4867                                     __attribute__((unused)) void * restrict dst,
4868                                     __attribute__((unused)) const struct GFX11_3DSTATE_GATHER_POOL_ALLOC * restrict values)
4869{
4870   uint32_t * restrict dw = (uint32_t * restrict) dst;
4871
4872   dw[0] =
4873      __gen_uint(values->DWordLength, 0, 7) |
4874      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4875      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4876      __gen_uint(values->CommandSubType, 27, 28) |
4877      __gen_uint(values->CommandType, 29, 31);
4878
4879   const uint64_t v1 =
4880      __gen_uint(values->MOCS, 0, 6) |
4881      __gen_uint(values->GatherPoolEnable, 11, 11);
4882   const uint64_t v1_address =
4883      __gen_address(data, &dw[1], values->GatherPoolBaseAddress, v1, 12, 63);
4884   dw[1] = v1_address;
4885   dw[2] = (v1_address >> 32) | (v1 >> 32);
4886
4887   dw[3] =
4888      __gen_uint(values->GatherPoolBufferSize, 12, 31);
4889}
4890
4891#define GFX11_3DSTATE_GS_length               10
4892#define GFX11_3DSTATE_GS_length_bias           2
4893#define GFX11_3DSTATE_GS_header                 \
4894   .DWordLength                         =      8,  \
4895   ._3DCommandSubOpcode                 =     17,  \
4896   ._3DCommandOpcode                    =      0,  \
4897   .CommandSubType                      =      3,  \
4898   .CommandType                         =      3
4899
4900struct GFX11_3DSTATE_GS {
4901   uint32_t                             DWordLength;
4902   uint32_t                             _3DCommandSubOpcode;
4903   uint32_t                             _3DCommandOpcode;
4904   uint32_t                             CommandSubType;
4905   uint32_t                             CommandType;
4906   uint64_t                             KernelStartPointer;
4907   uint32_t                             ExpectedVertexCount;
4908   bool                                 SoftwareExceptionEnable;
4909   bool                                 MaskStackExceptionEnable;
4910   bool                                 AccessesUAV;
4911   bool                                 IllegalOpcodeExceptionEnable;
4912   uint32_t                             FloatingPointMode;
4913#define IEEE754                                  0
4914#define Alternate                                1
4915   uint32_t                             ThreadDispatchPriority;
4916#define High                                     1
4917   uint32_t                             BindingTableEntryCount;
4918   uint32_t                             SamplerCount;
4919#define NoSamplers                               0
4920#define _14Samplers                              1
4921#define _58Samplers                              2
4922#define _912Samplers                             3
4923#define _1316Samplers                            4
4924   bool                                 VectorMaskEnable;
4925   bool                                 SingleProgramFlow;
4926   uint32_t                             PerThreadScratchSpace;
4927   __gen_address_type                   ScratchSpaceBasePointer;
4928   uint32_t                             DispatchGRFStartRegisterForURBData;
4929   uint32_t                             VertexURBEntryReadOffset;
4930   bool                                 IncludeVertexHandles;
4931   uint32_t                             VertexURBEntryReadLength;
4932   enum GFX11_3D_Prim_Topo_Type         OutputTopology;
4933   uint32_t                             OutputVertexSize;
4934   uint32_t                             DispatchGRFStartRegisterForURBData54;
4935   bool                                 Enable;
4936   bool                                 DiscardAdjacency;
4937   uint32_t                             ReorderMode;
4938#define LEADING                                  0
4939#define TRAILING                                 1
4940   uint32_t                             Hint;
4941   bool                                 IncludePrimitiveID;
4942   uint32_t                             InvocationsIncrementValue;
4943   bool                                 StatisticsEnable;
4944   uint32_t                             DispatchMode;
4945#define DISPATCH_MODE_SIMD8                      3
4946   uint32_t                             DefaultStreamId;
4947   uint32_t                             InstanceControl;
4948   uint32_t                             ControlDataHeaderSize;
4949   uint32_t                             MaximumNumberofThreads;
4950   uint32_t                             StaticOutputVertexCount;
4951   bool                                 StaticOutput;
4952   uint32_t                             ControlDataFormat;
4953#define CUT                                      0
4954#define SID                                      1
4955   uint32_t                             UserClipDistanceCullTestEnableBitmask;
4956   uint32_t                             UserClipDistanceClipTestEnableBitmask;
4957   uint32_t                             VertexURBEntryOutputLength;
4958   uint32_t                             VertexURBEntryOutputReadOffset;
4959};
4960
4961static inline __attribute__((always_inline)) void
4962GFX11_3DSTATE_GS_pack(__attribute__((unused)) __gen_user_data *data,
4963                      __attribute__((unused)) void * restrict dst,
4964                      __attribute__((unused)) const struct GFX11_3DSTATE_GS * restrict values)
4965{
4966   uint32_t * restrict dw = (uint32_t * restrict) dst;
4967
4968   dw[0] =
4969      __gen_uint(values->DWordLength, 0, 7) |
4970      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4971      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4972      __gen_uint(values->CommandSubType, 27, 28) |
4973      __gen_uint(values->CommandType, 29, 31);
4974
4975   const uint64_t v1 =
4976      __gen_offset(values->KernelStartPointer, 6, 63);
4977   dw[1] = v1;
4978   dw[2] = v1 >> 32;
4979
4980   dw[3] =
4981      __gen_uint(values->ExpectedVertexCount, 0, 5) |
4982      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
4983      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
4984      __gen_uint(values->AccessesUAV, 12, 12) |
4985      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
4986      __gen_uint(values->FloatingPointMode, 16, 16) |
4987      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
4988      __gen_uint(values->BindingTableEntryCount, 18, 25) |
4989      __gen_uint(values->SamplerCount, 27, 29) |
4990      __gen_uint(values->VectorMaskEnable, 30, 30) |
4991      __gen_uint(values->SingleProgramFlow, 31, 31);
4992
4993   const uint64_t v4 =
4994      __gen_uint(values->PerThreadScratchSpace, 0, 3);
4995   const uint64_t v4_address =
4996      __gen_address(data, &dw[4], values->ScratchSpaceBasePointer, v4, 10, 63);
4997   dw[4] = v4_address;
4998   dw[5] = (v4_address >> 32) | (v4 >> 32);
4999
5000   dw[6] =
5001      __gen_uint(values->DispatchGRFStartRegisterForURBData, 0, 3) |
5002      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
5003      __gen_uint(values->IncludeVertexHandles, 10, 10) |
5004      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
5005      __gen_uint(values->OutputTopology, 17, 22) |
5006      __gen_uint(values->OutputVertexSize, 23, 28) |
5007      __gen_uint(values->DispatchGRFStartRegisterForURBData54, 29, 30);
5008
5009   dw[7] =
5010      __gen_uint(values->Enable, 0, 0) |
5011      __gen_uint(values->DiscardAdjacency, 1, 1) |
5012      __gen_uint(values->ReorderMode, 2, 2) |
5013      __gen_uint(values->Hint, 3, 3) |
5014      __gen_uint(values->IncludePrimitiveID, 4, 4) |
5015      __gen_uint(values->InvocationsIncrementValue, 5, 9) |
5016      __gen_uint(values->StatisticsEnable, 10, 10) |
5017      __gen_uint(values->DispatchMode, 11, 12) |
5018      __gen_uint(values->DefaultStreamId, 13, 14) |
5019      __gen_uint(values->InstanceControl, 15, 19) |
5020      __gen_uint(values->ControlDataHeaderSize, 20, 23);
5021
5022   dw[8] =
5023      __gen_uint(values->MaximumNumberofThreads, 0, 8) |
5024      __gen_uint(values->StaticOutputVertexCount, 16, 26) |
5025      __gen_uint(values->StaticOutput, 30, 30) |
5026      __gen_uint(values->ControlDataFormat, 31, 31);
5027
5028   dw[9] =
5029      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
5030      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 8, 15) |
5031      __gen_uint(values->VertexURBEntryOutputLength, 16, 20) |
5032      __gen_uint(values->VertexURBEntryOutputReadOffset, 21, 26);
5033}
5034
5035#define GFX11_3DSTATE_HIER_DEPTH_BUFFER_length      5
5036#define GFX11_3DSTATE_HIER_DEPTH_BUFFER_length_bias      2
5037#define GFX11_3DSTATE_HIER_DEPTH_BUFFER_header  \
5038   .DWordLength                         =      3,  \
5039   ._3DCommandSubOpcode                 =      7,  \
5040   ._3DCommandOpcode                    =      0,  \
5041   .CommandSubType                      =      3,  \
5042   .CommandType                         =      3
5043
5044struct GFX11_3DSTATE_HIER_DEPTH_BUFFER {
5045   uint32_t                             DWordLength;
5046   uint32_t                             _3DCommandSubOpcode;
5047   uint32_t                             _3DCommandOpcode;
5048   uint32_t                             CommandSubType;
5049   uint32_t                             CommandType;
5050   uint32_t                             SurfacePitch;
5051   uint32_t                             TiledResourceMode;
5052#define NONE                                     0
5053#define TILEYF                                   1
5054#define TILEYS                                   2
5055   uint32_t                             MOCS;
5056   __gen_address_type                   SurfaceBaseAddress;
5057   uint32_t                             SurfaceQPitch;
5058};
5059
5060static inline __attribute__((always_inline)) void
5061GFX11_3DSTATE_HIER_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
5062                                     __attribute__((unused)) void * restrict dst,
5063                                     __attribute__((unused)) const struct GFX11_3DSTATE_HIER_DEPTH_BUFFER * restrict values)
5064{
5065   uint32_t * restrict dw = (uint32_t * restrict) dst;
5066
5067   dw[0] =
5068      __gen_uint(values->DWordLength, 0, 7) |
5069      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5070      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5071      __gen_uint(values->CommandSubType, 27, 28) |
5072      __gen_uint(values->CommandType, 29, 31);
5073
5074   dw[1] =
5075      __gen_uint(values->SurfacePitch, 0, 16) |
5076      __gen_uint(values->TiledResourceMode, 23, 24) |
5077      __gen_uint(values->MOCS, 25, 31);
5078
5079   const uint64_t v2_address =
5080      __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 0, 63);
5081   dw[2] = v2_address;
5082   dw[3] = v2_address >> 32;
5083
5084   dw[4] =
5085      __gen_uint(values->SurfaceQPitch, 0, 14);
5086}
5087
5088#define GFX11_3DSTATE_HS_length                9
5089#define GFX11_3DSTATE_HS_length_bias           2
5090#define GFX11_3DSTATE_HS_header                 \
5091   .DWordLength                         =      7,  \
5092   ._3DCommandSubOpcode                 =     27,  \
5093   ._3DCommandOpcode                    =      0,  \
5094   .CommandSubType                      =      3,  \
5095   .CommandType                         =      3
5096
5097struct GFX11_3DSTATE_HS {
5098   uint32_t                             DWordLength;
5099   uint32_t                             _3DCommandSubOpcode;
5100   uint32_t                             _3DCommandOpcode;
5101   uint32_t                             CommandSubType;
5102   uint32_t                             CommandType;
5103   bool                                 SoftwareExceptionEnable;
5104   bool                                 IllegalOpcodeExceptionEnable;
5105   uint32_t                             FloatingPointMode;
5106#define IEEE754                                  0
5107#define alternate                                1
5108   uint32_t                             ThreadDispatchPriority;
5109#define High                                     1
5110   uint32_t                             BindingTableEntryCount;
5111   uint32_t                             SamplerCount;
5112#define NoSamplers                               0
5113#define _14Samplers                              1
5114#define _58Samplers                              2
5115#define _912Samplers                             3
5116#define _1316Samplers                            4
5117   uint32_t                             InstanceCount;
5118   uint32_t                             MaximumNumberofThreads;
5119   bool                                 StatisticsEnable;
5120   bool                                 Enable;
5121   uint64_t                             KernelStartPointer;
5122   uint32_t                             PerThreadScratchSpace;
5123   __gen_address_type                   ScratchSpaceBasePointer;
5124   bool                                 IncludePrimitiveID;
5125   uint32_t                             VertexURBEntryReadOffset;
5126   uint32_t                             VertexURBEntryReadLength;
5127   uint32_t                             DispatchMode;
5128#define DISPATCH_MODE_SINGLE_PATCH               0
5129#define DISPATCH_MODE__8_PATCH                   2
5130   uint32_t                             DispatchGRFStartRegisterForURBData;
5131   bool                                 IncludeVertexHandles;
5132   bool                                 AccessesUAV;
5133   bool                                 VectorMaskEnable;
5134   bool                                 SingleProgramFlow;
5135   uint32_t                             DispatchGRFStartRegisterForURBData5;
5136};
5137
5138static inline __attribute__((always_inline)) void
5139GFX11_3DSTATE_HS_pack(__attribute__((unused)) __gen_user_data *data,
5140                      __attribute__((unused)) void * restrict dst,
5141                      __attribute__((unused)) const struct GFX11_3DSTATE_HS * restrict values)
5142{
5143   uint32_t * restrict dw = (uint32_t * restrict) dst;
5144
5145   dw[0] =
5146      __gen_uint(values->DWordLength, 0, 7) |
5147      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5148      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5149      __gen_uint(values->CommandSubType, 27, 28) |
5150      __gen_uint(values->CommandType, 29, 31);
5151
5152   dw[1] =
5153      __gen_uint(values->SoftwareExceptionEnable, 12, 12) |
5154      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
5155      __gen_uint(values->FloatingPointMode, 16, 16) |
5156      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
5157      __gen_uint(values->BindingTableEntryCount, 18, 25) |
5158      __gen_uint(values->SamplerCount, 27, 29);
5159
5160   dw[2] =
5161      __gen_uint(values->InstanceCount, 0, 3) |
5162      __gen_uint(values->MaximumNumberofThreads, 8, 16) |
5163      __gen_uint(values->StatisticsEnable, 29, 29) |
5164      __gen_uint(values->Enable, 31, 31);
5165
5166   const uint64_t v3 =
5167      __gen_offset(values->KernelStartPointer, 6, 63);
5168   dw[3] = v3;
5169   dw[4] = v3 >> 32;
5170
5171   const uint64_t v5 =
5172      __gen_uint(values->PerThreadScratchSpace, 0, 3);
5173   const uint64_t v5_address =
5174      __gen_address(data, &dw[5], values->ScratchSpaceBasePointer, v5, 10, 63);
5175   dw[5] = v5_address;
5176   dw[6] = (v5_address >> 32) | (v5 >> 32);
5177
5178   dw[7] =
5179      __gen_uint(values->IncludePrimitiveID, 0, 0) |
5180      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
5181      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
5182      __gen_uint(values->DispatchMode, 17, 18) |
5183      __gen_uint(values->DispatchGRFStartRegisterForURBData, 19, 23) |
5184      __gen_uint(values->IncludeVertexHandles, 24, 24) |
5185      __gen_uint(values->AccessesUAV, 25, 25) |
5186      __gen_uint(values->VectorMaskEnable, 26, 26) |
5187      __gen_uint(values->SingleProgramFlow, 27, 27) |
5188      __gen_uint(values->DispatchGRFStartRegisterForURBData5, 28, 28);
5189
5190   dw[8] = 0;
5191}
5192
5193#define GFX11_3DSTATE_INDEX_BUFFER_length      5
5194#define GFX11_3DSTATE_INDEX_BUFFER_length_bias      2
5195#define GFX11_3DSTATE_INDEX_BUFFER_header       \
5196   .DWordLength                         =      3,  \
5197   ._3DCommandSubOpcode                 =     10,  \
5198   ._3DCommandOpcode                    =      0,  \
5199   .CommandSubType                      =      3,  \
5200   .CommandType                         =      3
5201
5202struct GFX11_3DSTATE_INDEX_BUFFER {
5203   uint32_t                             DWordLength;
5204   uint32_t                             _3DCommandSubOpcode;
5205   uint32_t                             _3DCommandOpcode;
5206   uint32_t                             CommandSubType;
5207   uint32_t                             CommandType;
5208   uint32_t                             MOCS;
5209   uint32_t                             IndexFormat;
5210#define INDEX_BYTE                               0
5211#define INDEX_WORD                               1
5212#define INDEX_DWORD                              2
5213   __gen_address_type                   BufferStartingAddress;
5214   uint32_t                             BufferSize;
5215};
5216
5217static inline __attribute__((always_inline)) void
5218GFX11_3DSTATE_INDEX_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
5219                                __attribute__((unused)) void * restrict dst,
5220                                __attribute__((unused)) const struct GFX11_3DSTATE_INDEX_BUFFER * restrict values)
5221{
5222   uint32_t * restrict dw = (uint32_t * restrict) dst;
5223
5224   dw[0] =
5225      __gen_uint(values->DWordLength, 0, 7) |
5226      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5227      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5228      __gen_uint(values->CommandSubType, 27, 28) |
5229      __gen_uint(values->CommandType, 29, 31);
5230
5231   dw[1] =
5232      __gen_uint(values->MOCS, 0, 6) |
5233      __gen_uint(values->IndexFormat, 8, 9);
5234
5235   const uint64_t v2_address =
5236      __gen_address(data, &dw[2], values->BufferStartingAddress, 0, 0, 63);
5237   dw[2] = v2_address;
5238   dw[3] = v2_address >> 32;
5239
5240   dw[4] =
5241      __gen_uint(values->BufferSize, 0, 31);
5242}
5243
5244#define GFX11_3DSTATE_LINE_STIPPLE_length      3
5245#define GFX11_3DSTATE_LINE_STIPPLE_length_bias      2
5246#define GFX11_3DSTATE_LINE_STIPPLE_header       \
5247   .DWordLength                         =      1,  \
5248   ._3DCommandSubOpcode                 =      8,  \
5249   ._3DCommandOpcode                    =      1,  \
5250   .CommandSubType                      =      3,  \
5251   .CommandType                         =      3
5252
5253struct GFX11_3DSTATE_LINE_STIPPLE {
5254   uint32_t                             DWordLength;
5255   uint32_t                             _3DCommandSubOpcode;
5256   uint32_t                             _3DCommandOpcode;
5257   uint32_t                             CommandSubType;
5258   uint32_t                             CommandType;
5259   uint32_t                             LineStipplePattern;
5260   uint32_t                             CurrentStippleIndex;
5261   uint32_t                             CurrentRepeatCounter;
5262   bool                                 ModifyEnableCurrentRepeatCounterCurrentStippleIndex;
5263   uint32_t                             LineStippleRepeatCount;
5264   float                                LineStippleInverseRepeatCount;
5265};
5266
5267static inline __attribute__((always_inline)) void
5268GFX11_3DSTATE_LINE_STIPPLE_pack(__attribute__((unused)) __gen_user_data *data,
5269                                __attribute__((unused)) void * restrict dst,
5270                                __attribute__((unused)) const struct GFX11_3DSTATE_LINE_STIPPLE * restrict values)
5271{
5272   uint32_t * restrict dw = (uint32_t * restrict) dst;
5273
5274   dw[0] =
5275      __gen_uint(values->DWordLength, 0, 7) |
5276      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5277      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5278      __gen_uint(values->CommandSubType, 27, 28) |
5279      __gen_uint(values->CommandType, 29, 31);
5280
5281   dw[1] =
5282      __gen_uint(values->LineStipplePattern, 0, 15) |
5283      __gen_uint(values->CurrentStippleIndex, 16, 19) |
5284      __gen_uint(values->CurrentRepeatCounter, 21, 29) |
5285      __gen_uint(values->ModifyEnableCurrentRepeatCounterCurrentStippleIndex, 31, 31);
5286
5287   dw[2] =
5288      __gen_uint(values->LineStippleRepeatCount, 0, 8) |
5289      __gen_ufixed(values->LineStippleInverseRepeatCount, 15, 31, 16);
5290}
5291
5292#define GFX11_3DSTATE_MONOFILTER_SIZE_length      2
5293#define GFX11_3DSTATE_MONOFILTER_SIZE_length_bias      2
5294#define GFX11_3DSTATE_MONOFILTER_SIZE_header    \
5295   .DWordLength                         =      0,  \
5296   ._3DCommandSubOpcode                 =     17,  \
5297   ._3DCommandOpcode                    =      1,  \
5298   .CommandSubType                      =      3,  \
5299   .CommandType                         =      3
5300
5301struct GFX11_3DSTATE_MONOFILTER_SIZE {
5302   uint32_t                             DWordLength;
5303   uint32_t                             _3DCommandSubOpcode;
5304   uint32_t                             _3DCommandOpcode;
5305   uint32_t                             CommandSubType;
5306   uint32_t                             CommandType;
5307   uint32_t                             MonochromeFilterHeight;
5308   uint32_t                             MonochromeFilterWidth;
5309};
5310
5311static inline __attribute__((always_inline)) void
5312GFX11_3DSTATE_MONOFILTER_SIZE_pack(__attribute__((unused)) __gen_user_data *data,
5313                                   __attribute__((unused)) void * restrict dst,
5314                                   __attribute__((unused)) const struct GFX11_3DSTATE_MONOFILTER_SIZE * restrict values)
5315{
5316   uint32_t * restrict dw = (uint32_t * restrict) dst;
5317
5318   dw[0] =
5319      __gen_uint(values->DWordLength, 0, 7) |
5320      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5321      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5322      __gen_uint(values->CommandSubType, 27, 28) |
5323      __gen_uint(values->CommandType, 29, 31);
5324
5325   dw[1] =
5326      __gen_uint(values->MonochromeFilterHeight, 0, 2) |
5327      __gen_uint(values->MonochromeFilterWidth, 3, 5);
5328}
5329
5330#define GFX11_3DSTATE_MULTISAMPLE_length       2
5331#define GFX11_3DSTATE_MULTISAMPLE_length_bias      2
5332#define GFX11_3DSTATE_MULTISAMPLE_header        \
5333   .DWordLength                         =      0,  \
5334   ._3DCommandSubOpcode                 =     13,  \
5335   ._3DCommandOpcode                    =      0,  \
5336   .CommandSubType                      =      3,  \
5337   .CommandType                         =      3
5338
5339struct GFX11_3DSTATE_MULTISAMPLE {
5340   uint32_t                             DWordLength;
5341   uint32_t                             _3DCommandSubOpcode;
5342   uint32_t                             _3DCommandOpcode;
5343   uint32_t                             CommandSubType;
5344   uint32_t                             CommandType;
5345   uint32_t                             NumberofMultisamples;
5346   uint32_t                             PixelLocation;
5347#define CENTER                                   0
5348#define UL_CORNER                                1
5349   bool                                 PixelPositionOffsetEnable;
5350};
5351
5352static inline __attribute__((always_inline)) void
5353GFX11_3DSTATE_MULTISAMPLE_pack(__attribute__((unused)) __gen_user_data *data,
5354                               __attribute__((unused)) void * restrict dst,
5355                               __attribute__((unused)) const struct GFX11_3DSTATE_MULTISAMPLE * restrict values)
5356{
5357   uint32_t * restrict dw = (uint32_t * restrict) dst;
5358
5359   dw[0] =
5360      __gen_uint(values->DWordLength, 0, 7) |
5361      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5362      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5363      __gen_uint(values->CommandSubType, 27, 28) |
5364      __gen_uint(values->CommandType, 29, 31);
5365
5366   dw[1] =
5367      __gen_uint(values->NumberofMultisamples, 1, 3) |
5368      __gen_uint(values->PixelLocation, 4, 4) |
5369      __gen_uint(values->PixelPositionOffsetEnable, 5, 5);
5370}
5371
5372#define GFX11_3DSTATE_POLY_STIPPLE_OFFSET_length      2
5373#define GFX11_3DSTATE_POLY_STIPPLE_OFFSET_length_bias      2
5374#define GFX11_3DSTATE_POLY_STIPPLE_OFFSET_header\
5375   .DWordLength                         =      0,  \
5376   ._3DCommandSubOpcode                 =      6,  \
5377   ._3DCommandOpcode                    =      1,  \
5378   .CommandSubType                      =      3,  \
5379   .CommandType                         =      3
5380
5381struct GFX11_3DSTATE_POLY_STIPPLE_OFFSET {
5382   uint32_t                             DWordLength;
5383   uint32_t                             _3DCommandSubOpcode;
5384   uint32_t                             _3DCommandOpcode;
5385   uint32_t                             CommandSubType;
5386   uint32_t                             CommandType;
5387   uint32_t                             PolygonStippleYOffset;
5388   uint32_t                             PolygonStippleXOffset;
5389};
5390
5391static inline __attribute__((always_inline)) void
5392GFX11_3DSTATE_POLY_STIPPLE_OFFSET_pack(__attribute__((unused)) __gen_user_data *data,
5393                                       __attribute__((unused)) void * restrict dst,
5394                                       __attribute__((unused)) const struct GFX11_3DSTATE_POLY_STIPPLE_OFFSET * restrict values)
5395{
5396   uint32_t * restrict dw = (uint32_t * restrict) dst;
5397
5398   dw[0] =
5399      __gen_uint(values->DWordLength, 0, 7) |
5400      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5401      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5402      __gen_uint(values->CommandSubType, 27, 28) |
5403      __gen_uint(values->CommandType, 29, 31);
5404
5405   dw[1] =
5406      __gen_uint(values->PolygonStippleYOffset, 0, 4) |
5407      __gen_uint(values->PolygonStippleXOffset, 8, 12);
5408}
5409
5410#define GFX11_3DSTATE_POLY_STIPPLE_PATTERN_length     33
5411#define GFX11_3DSTATE_POLY_STIPPLE_PATTERN_length_bias      2
5412#define GFX11_3DSTATE_POLY_STIPPLE_PATTERN_header\
5413   .DWordLength                         =     31,  \
5414   ._3DCommandSubOpcode                 =      7,  \
5415   ._3DCommandOpcode                    =      1,  \
5416   .CommandSubType                      =      3,  \
5417   .CommandType                         =      3
5418
5419struct GFX11_3DSTATE_POLY_STIPPLE_PATTERN {
5420   uint32_t                             DWordLength;
5421   uint32_t                             _3DCommandSubOpcode;
5422   uint32_t                             _3DCommandOpcode;
5423   uint32_t                             CommandSubType;
5424   uint32_t                             CommandType;
5425   uint32_t                             PatternRow[32];
5426};
5427
5428static inline __attribute__((always_inline)) void
5429GFX11_3DSTATE_POLY_STIPPLE_PATTERN_pack(__attribute__((unused)) __gen_user_data *data,
5430                                        __attribute__((unused)) void * restrict dst,
5431                                        __attribute__((unused)) const struct GFX11_3DSTATE_POLY_STIPPLE_PATTERN * restrict values)
5432{
5433   uint32_t * restrict dw = (uint32_t * restrict) dst;
5434
5435   dw[0] =
5436      __gen_uint(values->DWordLength, 0, 7) |
5437      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5438      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5439      __gen_uint(values->CommandSubType, 27, 28) |
5440      __gen_uint(values->CommandType, 29, 31);
5441
5442   dw[1] =
5443      __gen_uint(values->PatternRow[0], 0, 31);
5444
5445   dw[2] =
5446      __gen_uint(values->PatternRow[1], 0, 31);
5447
5448   dw[3] =
5449      __gen_uint(values->PatternRow[2], 0, 31);
5450
5451   dw[4] =
5452      __gen_uint(values->PatternRow[3], 0, 31);
5453
5454   dw[5] =
5455      __gen_uint(values->PatternRow[4], 0, 31);
5456
5457   dw[6] =
5458      __gen_uint(values->PatternRow[5], 0, 31);
5459
5460   dw[7] =
5461      __gen_uint(values->PatternRow[6], 0, 31);
5462
5463   dw[8] =
5464      __gen_uint(values->PatternRow[7], 0, 31);
5465
5466   dw[9] =
5467      __gen_uint(values->PatternRow[8], 0, 31);
5468
5469   dw[10] =
5470      __gen_uint(values->PatternRow[9], 0, 31);
5471
5472   dw[11] =
5473      __gen_uint(values->PatternRow[10], 0, 31);
5474
5475   dw[12] =
5476      __gen_uint(values->PatternRow[11], 0, 31);
5477
5478   dw[13] =
5479      __gen_uint(values->PatternRow[12], 0, 31);
5480
5481   dw[14] =
5482      __gen_uint(values->PatternRow[13], 0, 31);
5483
5484   dw[15] =
5485      __gen_uint(values->PatternRow[14], 0, 31);
5486
5487   dw[16] =
5488      __gen_uint(values->PatternRow[15], 0, 31);
5489
5490   dw[17] =
5491      __gen_uint(values->PatternRow[16], 0, 31);
5492
5493   dw[18] =
5494      __gen_uint(values->PatternRow[17], 0, 31);
5495
5496   dw[19] =
5497      __gen_uint(values->PatternRow[18], 0, 31);
5498
5499   dw[20] =
5500      __gen_uint(values->PatternRow[19], 0, 31);
5501
5502   dw[21] =
5503      __gen_uint(values->PatternRow[20], 0, 31);
5504
5505   dw[22] =
5506      __gen_uint(values->PatternRow[21], 0, 31);
5507
5508   dw[23] =
5509      __gen_uint(values->PatternRow[22], 0, 31);
5510
5511   dw[24] =
5512      __gen_uint(values->PatternRow[23], 0, 31);
5513
5514   dw[25] =
5515      __gen_uint(values->PatternRow[24], 0, 31);
5516
5517   dw[26] =
5518      __gen_uint(values->PatternRow[25], 0, 31);
5519
5520   dw[27] =
5521      __gen_uint(values->PatternRow[26], 0, 31);
5522
5523   dw[28] =
5524      __gen_uint(values->PatternRow[27], 0, 31);
5525
5526   dw[29] =
5527      __gen_uint(values->PatternRow[28], 0, 31);
5528
5529   dw[30] =
5530      __gen_uint(values->PatternRow[29], 0, 31);
5531
5532   dw[31] =
5533      __gen_uint(values->PatternRow[30], 0, 31);
5534
5535   dw[32] =
5536      __gen_uint(values->PatternRow[31], 0, 31);
5537}
5538
5539#define GFX11_3DSTATE_PS_length               12
5540#define GFX11_3DSTATE_PS_length_bias           2
5541#define GFX11_3DSTATE_PS_header                 \
5542   .DWordLength                         =     10,  \
5543   ._3DCommandSubOpcode                 =     32,  \
5544   ._3DCommandOpcode                    =      0,  \
5545   .CommandSubType                      =      3,  \
5546   .CommandType                         =      3
5547
5548struct GFX11_3DSTATE_PS {
5549   uint32_t                             DWordLength;
5550   uint32_t                             _3DCommandSubOpcode;
5551   uint32_t                             _3DCommandOpcode;
5552   uint32_t                             CommandSubType;
5553   uint32_t                             CommandType;
5554   uint64_t                             KernelStartPointer0;
5555   bool                                 SoftwareExceptionEnable;
5556   bool                                 MaskStackExceptionEnable;
5557   bool                                 IllegalOpcodeExceptionEnable;
5558   uint32_t                             RoundingMode;
5559#define RTNE                                     0
5560#define RU                                       1
5561#define RD                                       2
5562#define RTZ                                      3
5563   uint32_t                             FloatingPointMode;
5564#define IEEE754                                  0
5565#define Alternate                                1
5566   uint32_t                             ThreadDispatchPriority;
5567#define High                                     1
5568   uint32_t                             BindingTableEntryCount;
5569   uint32_t                             SinglePrecisionDenormalMode;
5570#define FlushedtoZero                            0
5571#define Retained                                 1
5572   uint32_t                             SamplerCount;
5573#define NoSamplers                               0
5574#define _14Samplers                              1
5575#define _58Samplers                              2
5576#define _912Samplers                             3
5577#define _1316Samplers                            4
5578   bool                                 VectorMaskEnable;
5579   bool                                 SingleProgramFlow;
5580   uint32_t                             PerThreadScratchSpace;
5581   __gen_address_type                   ScratchSpaceBasePointer;
5582   bool                                 _8PixelDispatchEnable;
5583   bool                                 _16PixelDispatchEnable;
5584   bool                                 _32PixelDispatchEnable;
5585   uint32_t                             PositionXYOffsetSelect;
5586#define POSOFFSET_NONE                           0
5587#define POSOFFSET_CENTROID                       2
5588#define POSOFFSET_SAMPLE                         3
5589   uint32_t                             RenderTargetResolveType;
5590#define RESOLVE_DISABLED                         0
5591#define RESOLVE_PARTIAL                          1
5592#define FAST_CLEAR_0                             2
5593#define RESOLVE_FULL                             3
5594   bool                                 RenderTargetFastClearEnable;
5595   bool                                 PushConstantEnable;
5596   uint32_t                             MaximumNumberofThreadsPerPSD;
5597   uint32_t                             DispatchGRFStartRegisterForConstantSetupData2;
5598   uint32_t                             DispatchGRFStartRegisterForConstantSetupData1;
5599   uint32_t                             DispatchGRFStartRegisterForConstantSetupData0;
5600   uint64_t                             KernelStartPointer1;
5601   uint64_t                             KernelStartPointer2;
5602};
5603
5604static inline __attribute__((always_inline)) void
5605GFX11_3DSTATE_PS_pack(__attribute__((unused)) __gen_user_data *data,
5606                      __attribute__((unused)) void * restrict dst,
5607                      __attribute__((unused)) const struct GFX11_3DSTATE_PS * restrict values)
5608{
5609   uint32_t * restrict dw = (uint32_t * restrict) dst;
5610
5611   dw[0] =
5612      __gen_uint(values->DWordLength, 0, 7) |
5613      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5614      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5615      __gen_uint(values->CommandSubType, 27, 28) |
5616      __gen_uint(values->CommandType, 29, 31);
5617
5618   const uint64_t v1 =
5619      __gen_offset(values->KernelStartPointer0, 6, 63);
5620   dw[1] = v1;
5621   dw[2] = v1 >> 32;
5622
5623   dw[3] =
5624      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
5625      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
5626      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
5627      __gen_uint(values->RoundingMode, 14, 15) |
5628      __gen_uint(values->FloatingPointMode, 16, 16) |
5629      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
5630      __gen_uint(values->BindingTableEntryCount, 18, 25) |
5631      __gen_uint(values->SinglePrecisionDenormalMode, 26, 26) |
5632      __gen_uint(values->SamplerCount, 27, 29) |
5633      __gen_uint(values->VectorMaskEnable, 30, 30) |
5634      __gen_uint(values->SingleProgramFlow, 31, 31);
5635
5636   const uint64_t v4 =
5637      __gen_uint(values->PerThreadScratchSpace, 0, 3);
5638   const uint64_t v4_address =
5639      __gen_address(data, &dw[4], values->ScratchSpaceBasePointer, v4, 10, 63);
5640   dw[4] = v4_address;
5641   dw[5] = (v4_address >> 32) | (v4 >> 32);
5642
5643   dw[6] =
5644      __gen_uint(values->_8PixelDispatchEnable, 0, 0) |
5645      __gen_uint(values->_16PixelDispatchEnable, 1, 1) |
5646      __gen_uint(values->_32PixelDispatchEnable, 2, 2) |
5647      __gen_uint(values->PositionXYOffsetSelect, 3, 4) |
5648      __gen_uint(values->RenderTargetResolveType, 6, 7) |
5649      __gen_uint(values->RenderTargetFastClearEnable, 8, 8) |
5650      __gen_uint(values->PushConstantEnable, 11, 11) |
5651      __gen_uint(values->MaximumNumberofThreadsPerPSD, 23, 31);
5652
5653   dw[7] =
5654      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData2, 0, 6) |
5655      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData1, 8, 14) |
5656      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData0, 16, 22);
5657
5658   const uint64_t v8 =
5659      __gen_offset(values->KernelStartPointer1, 6, 63);
5660   dw[8] = v8;
5661   dw[9] = v8 >> 32;
5662
5663   const uint64_t v10 =
5664      __gen_offset(values->KernelStartPointer2, 6, 63);
5665   dw[10] = v10;
5666   dw[11] = v10 >> 32;
5667}
5668
5669#define GFX11_3DSTATE_PS_BLEND_length          2
5670#define GFX11_3DSTATE_PS_BLEND_length_bias      2
5671#define GFX11_3DSTATE_PS_BLEND_header           \
5672   .DWordLength                         =      0,  \
5673   ._3DCommandSubOpcode                 =     77,  \
5674   ._3DCommandOpcode                    =      0,  \
5675   .CommandSubType                      =      3,  \
5676   .CommandType                         =      3
5677
5678struct GFX11_3DSTATE_PS_BLEND {
5679   uint32_t                             DWordLength;
5680   uint32_t                             _3DCommandSubOpcode;
5681   uint32_t                             _3DCommandOpcode;
5682   uint32_t                             CommandSubType;
5683   uint32_t                             CommandType;
5684   bool                                 IndependentAlphaBlendEnable;
5685   bool                                 AlphaTestEnable;
5686   enum GFX11_3D_Color_Buffer_Blend_Factor DestinationBlendFactor;
5687   enum GFX11_3D_Color_Buffer_Blend_Factor SourceBlendFactor;
5688   enum GFX11_3D_Color_Buffer_Blend_Factor DestinationAlphaBlendFactor;
5689   enum GFX11_3D_Color_Buffer_Blend_Factor SourceAlphaBlendFactor;
5690   bool                                 ColorBufferBlendEnable;
5691   bool                                 HasWriteableRT;
5692   bool                                 AlphaToCoverageEnable;
5693};
5694
5695static inline __attribute__((always_inline)) void
5696GFX11_3DSTATE_PS_BLEND_pack(__attribute__((unused)) __gen_user_data *data,
5697                            __attribute__((unused)) void * restrict dst,
5698                            __attribute__((unused)) const struct GFX11_3DSTATE_PS_BLEND * restrict values)
5699{
5700   uint32_t * restrict dw = (uint32_t * restrict) dst;
5701
5702   dw[0] =
5703      __gen_uint(values->DWordLength, 0, 7) |
5704      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5705      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5706      __gen_uint(values->CommandSubType, 27, 28) |
5707      __gen_uint(values->CommandType, 29, 31);
5708
5709   dw[1] =
5710      __gen_uint(values->IndependentAlphaBlendEnable, 7, 7) |
5711      __gen_uint(values->AlphaTestEnable, 8, 8) |
5712      __gen_uint(values->DestinationBlendFactor, 9, 13) |
5713      __gen_uint(values->SourceBlendFactor, 14, 18) |
5714      __gen_uint(values->DestinationAlphaBlendFactor, 19, 23) |
5715      __gen_uint(values->SourceAlphaBlendFactor, 24, 28) |
5716      __gen_uint(values->ColorBufferBlendEnable, 29, 29) |
5717      __gen_uint(values->HasWriteableRT, 30, 30) |
5718      __gen_uint(values->AlphaToCoverageEnable, 31, 31);
5719}
5720
5721#define GFX11_3DSTATE_PS_EXTRA_length          2
5722#define GFX11_3DSTATE_PS_EXTRA_length_bias      2
5723#define GFX11_3DSTATE_PS_EXTRA_header           \
5724   .DWordLength                         =      0,  \
5725   ._3DCommandSubOpcode                 =     79,  \
5726   ._3DCommandOpcode                    =      0,  \
5727   .CommandSubType                      =      3,  \
5728   .CommandType                         =      3
5729
5730struct GFX11_3DSTATE_PS_EXTRA {
5731   uint32_t                             DWordLength;
5732   uint32_t                             _3DCommandSubOpcode;
5733   uint32_t                             _3DCommandOpcode;
5734   uint32_t                             CommandSubType;
5735   uint32_t                             CommandType;
5736   uint32_t                             InputCoverageMaskState;
5737#define ICMS_NONE                                0
5738#define ICMS_NORMAL                              1
5739#define ICMS_INNER_CONSERVATIVE                  2
5740#define ICMS_DEPTH_COVERAGE                      3
5741   bool                                 PixelShaderHasUAV;
5742   bool                                 PixelShaderPullsBary;
5743   bool                                 PixelShaderIsPerCoarsePixel;
5744   bool                                 PixelShaderComputesStencil;
5745   bool                                 PixelShaderIsPerSample;
5746   bool                                 PixelShaderDisablesAlphaToCoverage;
5747   bool                                 AttributeEnable;
5748   bool                                 SimplePSHint;
5749   bool                                 PixelShaderRequiresSubpixelSampleOffsets;
5750   bool                                 PixelShaderRequiresNonPerspectiveBaryPlaneCoefficients;
5751   bool                                 PixelShaderRequiresPerspectiveBaryPlaneCoefficients;
5752   bool                                 PixelShaderRequiresSourceDepthandorWPlaneCoefficients;
5753   bool                                 PixelShaderRequiresRequestedCoarsePixelShadingSize;
5754   bool                                 PixelShaderUsesSourceW;
5755   bool                                 PixelShaderUsesSourceDepth;
5756   bool                                 ForceComputedDepth;
5757   uint32_t                             PixelShaderComputedDepthMode;
5758#define PSCDEPTH_OFF                             0
5759#define PSCDEPTH_ON                              1
5760#define PSCDEPTH_ON_GE                           2
5761#define PSCDEPTH_ON_LE                           3
5762   bool                                 PixelShaderKillsPixel;
5763   bool                                 oMaskPresenttoRenderTarget;
5764   bool                                 PixelShaderDoesnotwritetoRT;
5765   bool                                 PixelShaderValid;
5766};
5767
5768static inline __attribute__((always_inline)) void
5769GFX11_3DSTATE_PS_EXTRA_pack(__attribute__((unused)) __gen_user_data *data,
5770                            __attribute__((unused)) void * restrict dst,
5771                            __attribute__((unused)) const struct GFX11_3DSTATE_PS_EXTRA * restrict values)
5772{
5773   uint32_t * restrict dw = (uint32_t * restrict) dst;
5774
5775   dw[0] =
5776      __gen_uint(values->DWordLength, 0, 7) |
5777      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5778      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5779      __gen_uint(values->CommandSubType, 27, 28) |
5780      __gen_uint(values->CommandType, 29, 31);
5781
5782   dw[1] =
5783      __gen_uint(values->InputCoverageMaskState, 0, 1) |
5784      __gen_uint(values->PixelShaderHasUAV, 2, 2) |
5785      __gen_uint(values->PixelShaderPullsBary, 3, 3) |
5786      __gen_uint(values->PixelShaderIsPerCoarsePixel, 4, 4) |
5787      __gen_uint(values->PixelShaderComputesStencil, 5, 5) |
5788      __gen_uint(values->PixelShaderIsPerSample, 6, 6) |
5789      __gen_uint(values->PixelShaderDisablesAlphaToCoverage, 7, 7) |
5790      __gen_uint(values->AttributeEnable, 8, 8) |
5791      __gen_uint(values->SimplePSHint, 9, 9) |
5792      __gen_uint(values->PixelShaderRequiresSubpixelSampleOffsets, 18, 18) |
5793      __gen_uint(values->PixelShaderRequiresNonPerspectiveBaryPlaneCoefficients, 19, 19) |
5794      __gen_uint(values->PixelShaderRequiresPerspectiveBaryPlaneCoefficients, 20, 20) |
5795      __gen_uint(values->PixelShaderRequiresSourceDepthandorWPlaneCoefficients, 21, 21) |
5796      __gen_uint(values->PixelShaderRequiresRequestedCoarsePixelShadingSize, 22, 22) |
5797      __gen_uint(values->PixelShaderUsesSourceW, 23, 23) |
5798      __gen_uint(values->PixelShaderUsesSourceDepth, 24, 24) |
5799      __gen_uint(values->ForceComputedDepth, 25, 25) |
5800      __gen_uint(values->PixelShaderComputedDepthMode, 26, 27) |
5801      __gen_uint(values->PixelShaderKillsPixel, 28, 28) |
5802      __gen_uint(values->oMaskPresenttoRenderTarget, 29, 29) |
5803      __gen_uint(values->PixelShaderDoesnotwritetoRT, 30, 30) |
5804      __gen_uint(values->PixelShaderValid, 31, 31);
5805}
5806
5807#define GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_DS_length      2
5808#define GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_DS_length_bias      2
5809#define GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_DS_header\
5810   .DWordLength                         =      0,  \
5811   ._3DCommandSubOpcode                 =     20,  \
5812   ._3DCommandOpcode                    =      1,  \
5813   .CommandSubType                      =      3,  \
5814   .CommandType                         =      3
5815
5816struct GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_DS {
5817   uint32_t                             DWordLength;
5818   uint32_t                             _3DCommandSubOpcode;
5819   uint32_t                             _3DCommandOpcode;
5820   uint32_t                             CommandSubType;
5821   uint32_t                             CommandType;
5822   uint32_t                             ConstantBufferSize;
5823   uint32_t                             ConstantBufferOffset;
5824};
5825
5826static inline __attribute__((always_inline)) void
5827GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_DS_pack(__attribute__((unused)) __gen_user_data *data,
5828                                          __attribute__((unused)) void * restrict dst,
5829                                          __attribute__((unused)) const struct GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_DS * restrict values)
5830{
5831   uint32_t * restrict dw = (uint32_t * restrict) dst;
5832
5833   dw[0] =
5834      __gen_uint(values->DWordLength, 0, 7) |
5835      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5836      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5837      __gen_uint(values->CommandSubType, 27, 28) |
5838      __gen_uint(values->CommandType, 29, 31);
5839
5840   dw[1] =
5841      __gen_uint(values->ConstantBufferSize, 0, 5) |
5842      __gen_uint(values->ConstantBufferOffset, 16, 20);
5843}
5844
5845#define GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_GS_length      2
5846#define GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_GS_length_bias      2
5847#define GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_GS_header\
5848   .DWordLength                         =      0,  \
5849   ._3DCommandSubOpcode                 =     21,  \
5850   ._3DCommandOpcode                    =      1,  \
5851   .CommandSubType                      =      3,  \
5852   .CommandType                         =      3
5853
5854struct GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_GS {
5855   uint32_t                             DWordLength;
5856   uint32_t                             _3DCommandSubOpcode;
5857   uint32_t                             _3DCommandOpcode;
5858   uint32_t                             CommandSubType;
5859   uint32_t                             CommandType;
5860   uint32_t                             ConstantBufferSize;
5861   uint32_t                             ConstantBufferOffset;
5862};
5863
5864static inline __attribute__((always_inline)) void
5865GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_GS_pack(__attribute__((unused)) __gen_user_data *data,
5866                                          __attribute__((unused)) void * restrict dst,
5867                                          __attribute__((unused)) const struct GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_GS * restrict values)
5868{
5869   uint32_t * restrict dw = (uint32_t * restrict) dst;
5870
5871   dw[0] =
5872      __gen_uint(values->DWordLength, 0, 7) |
5873      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5874      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5875      __gen_uint(values->CommandSubType, 27, 28) |
5876      __gen_uint(values->CommandType, 29, 31);
5877
5878   dw[1] =
5879      __gen_uint(values->ConstantBufferSize, 0, 5) |
5880      __gen_uint(values->ConstantBufferOffset, 16, 20);
5881}
5882
5883#define GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_HS_length      2
5884#define GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_HS_length_bias      2
5885#define GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_HS_header\
5886   .DWordLength                         =      0,  \
5887   ._3DCommandSubOpcode                 =     19,  \
5888   ._3DCommandOpcode                    =      1,  \
5889   .CommandSubType                      =      3,  \
5890   .CommandType                         =      3
5891
5892struct GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_HS {
5893   uint32_t                             DWordLength;
5894   uint32_t                             _3DCommandSubOpcode;
5895   uint32_t                             _3DCommandOpcode;
5896   uint32_t                             CommandSubType;
5897   uint32_t                             CommandType;
5898   uint32_t                             ConstantBufferSize;
5899   uint32_t                             ConstantBufferOffset;
5900};
5901
5902static inline __attribute__((always_inline)) void
5903GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_HS_pack(__attribute__((unused)) __gen_user_data *data,
5904                                          __attribute__((unused)) void * restrict dst,
5905                                          __attribute__((unused)) const struct GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_HS * restrict values)
5906{
5907   uint32_t * restrict dw = (uint32_t * restrict) dst;
5908
5909   dw[0] =
5910      __gen_uint(values->DWordLength, 0, 7) |
5911      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5912      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5913      __gen_uint(values->CommandSubType, 27, 28) |
5914      __gen_uint(values->CommandType, 29, 31);
5915
5916   dw[1] =
5917      __gen_uint(values->ConstantBufferSize, 0, 5) |
5918      __gen_uint(values->ConstantBufferOffset, 16, 20);
5919}
5920
5921#define GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_PS_length      2
5922#define GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_PS_length_bias      2
5923#define GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_PS_header\
5924   .DWordLength                         =      0,  \
5925   ._3DCommandSubOpcode                 =     22,  \
5926   ._3DCommandOpcode                    =      1,  \
5927   .CommandSubType                      =      3,  \
5928   .CommandType                         =      3
5929
5930struct GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_PS {
5931   uint32_t                             DWordLength;
5932   uint32_t                             _3DCommandSubOpcode;
5933   uint32_t                             _3DCommandOpcode;
5934   uint32_t                             CommandSubType;
5935   uint32_t                             CommandType;
5936   uint32_t                             ConstantBufferSize;
5937   uint32_t                             ConstantBufferOffset;
5938};
5939
5940static inline __attribute__((always_inline)) void
5941GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_PS_pack(__attribute__((unused)) __gen_user_data *data,
5942                                          __attribute__((unused)) void * restrict dst,
5943                                          __attribute__((unused)) const struct GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_PS * restrict values)
5944{
5945   uint32_t * restrict dw = (uint32_t * restrict) dst;
5946
5947   dw[0] =
5948      __gen_uint(values->DWordLength, 0, 7) |
5949      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5950      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5951      __gen_uint(values->CommandSubType, 27, 28) |
5952      __gen_uint(values->CommandType, 29, 31);
5953
5954   dw[1] =
5955      __gen_uint(values->ConstantBufferSize, 0, 5) |
5956      __gen_uint(values->ConstantBufferOffset, 16, 20);
5957}
5958
5959#define GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_VS_length      2
5960#define GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_VS_length_bias      2
5961#define GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_VS_header\
5962   .DWordLength                         =      0,  \
5963   ._3DCommandSubOpcode                 =     18,  \
5964   ._3DCommandOpcode                    =      1,  \
5965   .CommandSubType                      =      3,  \
5966   .CommandType                         =      3
5967
5968struct GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_VS {
5969   uint32_t                             DWordLength;
5970   uint32_t                             _3DCommandSubOpcode;
5971   uint32_t                             _3DCommandOpcode;
5972   uint32_t                             CommandSubType;
5973   uint32_t                             CommandType;
5974   uint32_t                             ConstantBufferSize;
5975   uint32_t                             ConstantBufferOffset;
5976};
5977
5978static inline __attribute__((always_inline)) void
5979GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_VS_pack(__attribute__((unused)) __gen_user_data *data,
5980                                          __attribute__((unused)) void * restrict dst,
5981                                          __attribute__((unused)) const struct GFX11_3DSTATE_PUSH_CONSTANT_ALLOC_VS * restrict values)
5982{
5983   uint32_t * restrict dw = (uint32_t * restrict) dst;
5984
5985   dw[0] =
5986      __gen_uint(values->DWordLength, 0, 7) |
5987      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
5988      __gen_uint(values->_3DCommandOpcode, 24, 26) |
5989      __gen_uint(values->CommandSubType, 27, 28) |
5990      __gen_uint(values->CommandType, 29, 31);
5991
5992   dw[1] =
5993      __gen_uint(values->ConstantBufferSize, 0, 5) |
5994      __gen_uint(values->ConstantBufferOffset, 16, 20);
5995}
5996
5997#define GFX11_3DSTATE_RASTER_length            5
5998#define GFX11_3DSTATE_RASTER_length_bias       2
5999#define GFX11_3DSTATE_RASTER_header             \
6000   .DWordLength                         =      3,  \
6001   ._3DCommandSubOpcode                 =     80,  \
6002   ._3DCommandOpcode                    =      0,  \
6003   .CommandSubType                      =      3,  \
6004   .CommandType                         =      3
6005
6006struct GFX11_3DSTATE_RASTER {
6007   uint32_t                             DWordLength;
6008   uint32_t                             _3DCommandSubOpcode;
6009   uint32_t                             _3DCommandOpcode;
6010   uint32_t                             CommandSubType;
6011   uint32_t                             CommandType;
6012   bool                                 ViewportZNearClipTestEnable;
6013   bool                                 ScissorRectangleEnable;
6014   bool                                 AntialiasingEnable;
6015   uint32_t                             BackFaceFillMode;
6016#define FILL_MODE_SOLID                          0
6017#define FILL_MODE_WIREFRAME                      1
6018#define FILL_MODE_POINT                          2
6019   uint32_t                             FrontFaceFillMode;
6020#define FILL_MODE_SOLID                          0
6021#define FILL_MODE_WIREFRAME                      1
6022#define FILL_MODE_POINT                          2
6023   bool                                 GlobalDepthOffsetEnablePoint;
6024   bool                                 GlobalDepthOffsetEnableWireframe;
6025   bool                                 GlobalDepthOffsetEnableSolid;
6026   uint32_t                             DXMultisampleRasterizationMode;
6027#define MSRASTMODE_OFF_PIXEL                     0
6028#define MSRASTMODE_OFF_PATTERN                   1
6029#define MSRASTMODE_ON_PIXEL                      2
6030#define MSRASTMODE_ON_PATTERN                    3
6031   bool                                 DXMultisampleRasterizationEnable;
6032   bool                                 SmoothPointEnable;
6033   uint32_t                             ForceMultisampling;
6034   uint32_t                             CullMode;
6035#define CULLMODE_BOTH                            0
6036#define CULLMODE_NONE                            1
6037#define CULLMODE_FRONT                           2
6038#define CULLMODE_BACK                            3
6039   uint32_t                             ForcedSampleCount;
6040#define FSC_NUMRASTSAMPLES_0                     0
6041#define FSC_NUMRASTSAMPLES_1                     1
6042#define FSC_NUMRASTSAMPLES_2                     2
6043#define FSC_NUMRASTSAMPLES_4                     3
6044#define FSC_NUMRASTSAMPLES_8                     4
6045#define FSC_NUMRASTSAMPLES_16                    5
6046   uint32_t                             FrontWinding;
6047#define Clockwise                                0
6048#define CounterClockwise                         1
6049   uint32_t                             APIMode;
6050#define DX9OGL                                   0
6051#define DX100                                    1
6052#define DX101                                    2
6053   bool                                 ConservativeRasterizationEnable;
6054   bool                                 ViewportZFarClipTestEnable;
6055   float                                GlobalDepthOffsetConstant;
6056   float                                GlobalDepthOffsetScale;
6057   float                                GlobalDepthOffsetClamp;
6058};
6059
6060static inline __attribute__((always_inline)) void
6061GFX11_3DSTATE_RASTER_pack(__attribute__((unused)) __gen_user_data *data,
6062                          __attribute__((unused)) void * restrict dst,
6063                          __attribute__((unused)) const struct GFX11_3DSTATE_RASTER * restrict values)
6064{
6065   uint32_t * restrict dw = (uint32_t * restrict) dst;
6066
6067   dw[0] =
6068      __gen_uint(values->DWordLength, 0, 7) |
6069      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6070      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6071      __gen_uint(values->CommandSubType, 27, 28) |
6072      __gen_uint(values->CommandType, 29, 31);
6073
6074   dw[1] =
6075      __gen_uint(values->ViewportZNearClipTestEnable, 0, 0) |
6076      __gen_uint(values->ScissorRectangleEnable, 1, 1) |
6077      __gen_uint(values->AntialiasingEnable, 2, 2) |
6078      __gen_uint(values->BackFaceFillMode, 3, 4) |
6079      __gen_uint(values->FrontFaceFillMode, 5, 6) |
6080      __gen_uint(values->GlobalDepthOffsetEnablePoint, 7, 7) |
6081      __gen_uint(values->GlobalDepthOffsetEnableWireframe, 8, 8) |
6082      __gen_uint(values->GlobalDepthOffsetEnableSolid, 9, 9) |
6083      __gen_uint(values->DXMultisampleRasterizationMode, 10, 11) |
6084      __gen_uint(values->DXMultisampleRasterizationEnable, 12, 12) |
6085      __gen_uint(values->SmoothPointEnable, 13, 13) |
6086      __gen_uint(values->ForceMultisampling, 14, 14) |
6087      __gen_uint(values->CullMode, 16, 17) |
6088      __gen_uint(values->ForcedSampleCount, 18, 20) |
6089      __gen_uint(values->FrontWinding, 21, 21) |
6090      __gen_uint(values->APIMode, 22, 23) |
6091      __gen_uint(values->ConservativeRasterizationEnable, 24, 24) |
6092      __gen_uint(values->ViewportZFarClipTestEnable, 26, 26);
6093
6094   dw[2] =
6095      __gen_float(values->GlobalDepthOffsetConstant);
6096
6097   dw[3] =
6098      __gen_float(values->GlobalDepthOffsetScale);
6099
6100   dw[4] =
6101      __gen_float(values->GlobalDepthOffsetClamp);
6102}
6103
6104#define GFX11_3DSTATE_RS_CONSTANT_POINTER_length      4
6105#define GFX11_3DSTATE_RS_CONSTANT_POINTER_length_bias      2
6106#define GFX11_3DSTATE_RS_CONSTANT_POINTER_header\
6107   .DWordLength                         =      2,  \
6108   ._3DCommandSubOpcode                 =     84,  \
6109   ._3DCommandOpcode                    =      0,  \
6110   .CommandSubType                      =      3,  \
6111   .CommandType                         =      3
6112
6113struct GFX11_3DSTATE_RS_CONSTANT_POINTER {
6114   uint32_t                             DWordLength;
6115   uint32_t                             _3DCommandSubOpcode;
6116   uint32_t                             _3DCommandOpcode;
6117   uint32_t                             CommandSubType;
6118   uint32_t                             CommandType;
6119   uint32_t                             OperationLoadorStore;
6120#define RS_Store                                 0
6121#define RS_Load                                  1
6122   uint32_t                             ShaderSelect;
6123#define VS                                       0
6124#define PS                                       4
6125   __gen_address_type                   GlobalConstantBufferAddress;
6126   __gen_address_type                   GlobalConstantBufferAddressHigh;
6127};
6128
6129static inline __attribute__((always_inline)) void
6130GFX11_3DSTATE_RS_CONSTANT_POINTER_pack(__attribute__((unused)) __gen_user_data *data,
6131                                       __attribute__((unused)) void * restrict dst,
6132                                       __attribute__((unused)) const struct GFX11_3DSTATE_RS_CONSTANT_POINTER * restrict values)
6133{
6134   uint32_t * restrict dw = (uint32_t * restrict) dst;
6135
6136   dw[0] =
6137      __gen_uint(values->DWordLength, 0, 7) |
6138      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6139      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6140      __gen_uint(values->CommandSubType, 27, 28) |
6141      __gen_uint(values->CommandType, 29, 31);
6142
6143   dw[1] =
6144      __gen_uint(values->OperationLoadorStore, 12, 12) |
6145      __gen_uint(values->ShaderSelect, 28, 30);
6146
6147   dw[2] = __gen_address(data, &dw[2], values->GlobalConstantBufferAddress, 0, 6, 31);
6148
6149   dw[3] = __gen_address(data, &dw[3], values->GlobalConstantBufferAddressHigh, 0, 0, 31);
6150}
6151
6152#define GFX11_3DSTATE_SAMPLER_PALETTE_LOAD0_length_bias      2
6153#define GFX11_3DSTATE_SAMPLER_PALETTE_LOAD0_header\
6154   ._3DCommandSubOpcode                 =      2,  \
6155   ._3DCommandOpcode                    =      1,  \
6156   .CommandSubType                      =      3,  \
6157   .CommandType                         =      3
6158
6159struct GFX11_3DSTATE_SAMPLER_PALETTE_LOAD0 {
6160   uint32_t                             DWordLength;
6161   uint32_t                             _3DCommandSubOpcode;
6162   uint32_t                             _3DCommandOpcode;
6163   uint32_t                             CommandSubType;
6164   uint32_t                             CommandType;
6165   /* variable length fields follow */
6166};
6167
6168static inline __attribute__((always_inline)) void
6169GFX11_3DSTATE_SAMPLER_PALETTE_LOAD0_pack(__attribute__((unused)) __gen_user_data *data,
6170                                         __attribute__((unused)) void * restrict dst,
6171                                         __attribute__((unused)) const struct GFX11_3DSTATE_SAMPLER_PALETTE_LOAD0 * restrict values)
6172{
6173   uint32_t * restrict dw = (uint32_t * restrict) dst;
6174
6175   dw[0] =
6176      __gen_uint(values->DWordLength, 0, 7) |
6177      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6178      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6179      __gen_uint(values->CommandSubType, 27, 28) |
6180      __gen_uint(values->CommandType, 29, 31);
6181}
6182
6183#define GFX11_3DSTATE_SAMPLER_PALETTE_LOAD1_length_bias      2
6184#define GFX11_3DSTATE_SAMPLER_PALETTE_LOAD1_header\
6185   .DWordLength                         =      0,  \
6186   ._3DCommandSubOpcode                 =     12,  \
6187   ._3DCommandOpcode                    =      1,  \
6188   .CommandSubType                      =      3,  \
6189   .CommandType                         =      3
6190
6191struct GFX11_3DSTATE_SAMPLER_PALETTE_LOAD1 {
6192   uint32_t                             DWordLength;
6193   uint32_t                             _3DCommandSubOpcode;
6194   uint32_t                             _3DCommandOpcode;
6195   uint32_t                             CommandSubType;
6196   uint32_t                             CommandType;
6197   /* variable length fields follow */
6198};
6199
6200static inline __attribute__((always_inline)) void
6201GFX11_3DSTATE_SAMPLER_PALETTE_LOAD1_pack(__attribute__((unused)) __gen_user_data *data,
6202                                         __attribute__((unused)) void * restrict dst,
6203                                         __attribute__((unused)) const struct GFX11_3DSTATE_SAMPLER_PALETTE_LOAD1 * restrict values)
6204{
6205   uint32_t * restrict dw = (uint32_t * restrict) dst;
6206
6207   dw[0] =
6208      __gen_uint(values->DWordLength, 0, 7) |
6209      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6210      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6211      __gen_uint(values->CommandSubType, 27, 28) |
6212      __gen_uint(values->CommandType, 29, 31);
6213}
6214
6215#define GFX11_3DSTATE_SAMPLER_STATE_POINTERS_DS_length      2
6216#define GFX11_3DSTATE_SAMPLER_STATE_POINTERS_DS_length_bias      2
6217#define GFX11_3DSTATE_SAMPLER_STATE_POINTERS_DS_header\
6218   .DWordLength                         =      0,  \
6219   ._3DCommandSubOpcode                 =     45,  \
6220   ._3DCommandOpcode                    =      0,  \
6221   .CommandSubType                      =      3,  \
6222   .CommandType                         =      3
6223
6224struct GFX11_3DSTATE_SAMPLER_STATE_POINTERS_DS {
6225   uint32_t                             DWordLength;
6226   uint32_t                             _3DCommandSubOpcode;
6227   uint32_t                             _3DCommandOpcode;
6228   uint32_t                             CommandSubType;
6229   uint32_t                             CommandType;
6230   uint64_t                             PointertoDSSamplerState;
6231};
6232
6233static inline __attribute__((always_inline)) void
6234GFX11_3DSTATE_SAMPLER_STATE_POINTERS_DS_pack(__attribute__((unused)) __gen_user_data *data,
6235                                             __attribute__((unused)) void * restrict dst,
6236                                             __attribute__((unused)) const struct GFX11_3DSTATE_SAMPLER_STATE_POINTERS_DS * restrict values)
6237{
6238   uint32_t * restrict dw = (uint32_t * restrict) dst;
6239
6240   dw[0] =
6241      __gen_uint(values->DWordLength, 0, 7) |
6242      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6243      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6244      __gen_uint(values->CommandSubType, 27, 28) |
6245      __gen_uint(values->CommandType, 29, 31);
6246
6247   dw[1] =
6248      __gen_offset(values->PointertoDSSamplerState, 5, 31);
6249}
6250
6251#define GFX11_3DSTATE_SAMPLER_STATE_POINTERS_GS_length      2
6252#define GFX11_3DSTATE_SAMPLER_STATE_POINTERS_GS_length_bias      2
6253#define GFX11_3DSTATE_SAMPLER_STATE_POINTERS_GS_header\
6254   .DWordLength                         =      0,  \
6255   ._3DCommandSubOpcode                 =     46,  \
6256   ._3DCommandOpcode                    =      0,  \
6257   .CommandSubType                      =      3,  \
6258   .CommandType                         =      3
6259
6260struct GFX11_3DSTATE_SAMPLER_STATE_POINTERS_GS {
6261   uint32_t                             DWordLength;
6262   uint32_t                             _3DCommandSubOpcode;
6263   uint32_t                             _3DCommandOpcode;
6264   uint32_t                             CommandSubType;
6265   uint32_t                             CommandType;
6266   uint64_t                             PointertoGSSamplerState;
6267};
6268
6269static inline __attribute__((always_inline)) void
6270GFX11_3DSTATE_SAMPLER_STATE_POINTERS_GS_pack(__attribute__((unused)) __gen_user_data *data,
6271                                             __attribute__((unused)) void * restrict dst,
6272                                             __attribute__((unused)) const struct GFX11_3DSTATE_SAMPLER_STATE_POINTERS_GS * restrict values)
6273{
6274   uint32_t * restrict dw = (uint32_t * restrict) dst;
6275
6276   dw[0] =
6277      __gen_uint(values->DWordLength, 0, 7) |
6278      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6279      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6280      __gen_uint(values->CommandSubType, 27, 28) |
6281      __gen_uint(values->CommandType, 29, 31);
6282
6283   dw[1] =
6284      __gen_offset(values->PointertoGSSamplerState, 5, 31);
6285}
6286
6287#define GFX11_3DSTATE_SAMPLER_STATE_POINTERS_HS_length      2
6288#define GFX11_3DSTATE_SAMPLER_STATE_POINTERS_HS_length_bias      2
6289#define GFX11_3DSTATE_SAMPLER_STATE_POINTERS_HS_header\
6290   .DWordLength                         =      0,  \
6291   ._3DCommandSubOpcode                 =     44,  \
6292   ._3DCommandOpcode                    =      0,  \
6293   .CommandSubType                      =      3,  \
6294   .CommandType                         =      3
6295
6296struct GFX11_3DSTATE_SAMPLER_STATE_POINTERS_HS {
6297   uint32_t                             DWordLength;
6298   uint32_t                             _3DCommandSubOpcode;
6299   uint32_t                             _3DCommandOpcode;
6300   uint32_t                             CommandSubType;
6301   uint32_t                             CommandType;
6302   uint64_t                             PointertoHSSamplerState;
6303};
6304
6305static inline __attribute__((always_inline)) void
6306GFX11_3DSTATE_SAMPLER_STATE_POINTERS_HS_pack(__attribute__((unused)) __gen_user_data *data,
6307                                             __attribute__((unused)) void * restrict dst,
6308                                             __attribute__((unused)) const struct GFX11_3DSTATE_SAMPLER_STATE_POINTERS_HS * restrict values)
6309{
6310   uint32_t * restrict dw = (uint32_t * restrict) dst;
6311
6312   dw[0] =
6313      __gen_uint(values->DWordLength, 0, 7) |
6314      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6315      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6316      __gen_uint(values->CommandSubType, 27, 28) |
6317      __gen_uint(values->CommandType, 29, 31);
6318
6319   dw[1] =
6320      __gen_offset(values->PointertoHSSamplerState, 5, 31);
6321}
6322
6323#define GFX11_3DSTATE_SAMPLER_STATE_POINTERS_PS_length      2
6324#define GFX11_3DSTATE_SAMPLER_STATE_POINTERS_PS_length_bias      2
6325#define GFX11_3DSTATE_SAMPLER_STATE_POINTERS_PS_header\
6326   .DWordLength                         =      0,  \
6327   ._3DCommandSubOpcode                 =     47,  \
6328   ._3DCommandOpcode                    =      0,  \
6329   .CommandSubType                      =      3,  \
6330   .CommandType                         =      3
6331
6332struct GFX11_3DSTATE_SAMPLER_STATE_POINTERS_PS {
6333   uint32_t                             DWordLength;
6334   uint32_t                             _3DCommandSubOpcode;
6335   uint32_t                             _3DCommandOpcode;
6336   uint32_t                             CommandSubType;
6337   uint32_t                             CommandType;
6338   uint64_t                             PointertoPSSamplerState;
6339};
6340
6341static inline __attribute__((always_inline)) void
6342GFX11_3DSTATE_SAMPLER_STATE_POINTERS_PS_pack(__attribute__((unused)) __gen_user_data *data,
6343                                             __attribute__((unused)) void * restrict dst,
6344                                             __attribute__((unused)) const struct GFX11_3DSTATE_SAMPLER_STATE_POINTERS_PS * restrict values)
6345{
6346   uint32_t * restrict dw = (uint32_t * restrict) dst;
6347
6348   dw[0] =
6349      __gen_uint(values->DWordLength, 0, 7) |
6350      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6351      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6352      __gen_uint(values->CommandSubType, 27, 28) |
6353      __gen_uint(values->CommandType, 29, 31);
6354
6355   dw[1] =
6356      __gen_offset(values->PointertoPSSamplerState, 5, 31);
6357}
6358
6359#define GFX11_3DSTATE_SAMPLER_STATE_POINTERS_VS_length      2
6360#define GFX11_3DSTATE_SAMPLER_STATE_POINTERS_VS_length_bias      2
6361#define GFX11_3DSTATE_SAMPLER_STATE_POINTERS_VS_header\
6362   .DWordLength                         =      0,  \
6363   ._3DCommandSubOpcode                 =     43,  \
6364   ._3DCommandOpcode                    =      0,  \
6365   .CommandSubType                      =      3,  \
6366   .CommandType                         =      3
6367
6368struct GFX11_3DSTATE_SAMPLER_STATE_POINTERS_VS {
6369   uint32_t                             DWordLength;
6370   uint32_t                             _3DCommandSubOpcode;
6371   uint32_t                             _3DCommandOpcode;
6372   uint32_t                             CommandSubType;
6373   uint32_t                             CommandType;
6374   uint64_t                             PointertoVSSamplerState;
6375};
6376
6377static inline __attribute__((always_inline)) void
6378GFX11_3DSTATE_SAMPLER_STATE_POINTERS_VS_pack(__attribute__((unused)) __gen_user_data *data,
6379                                             __attribute__((unused)) void * restrict dst,
6380                                             __attribute__((unused)) const struct GFX11_3DSTATE_SAMPLER_STATE_POINTERS_VS * restrict values)
6381{
6382   uint32_t * restrict dw = (uint32_t * restrict) dst;
6383
6384   dw[0] =
6385      __gen_uint(values->DWordLength, 0, 7) |
6386      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6387      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6388      __gen_uint(values->CommandSubType, 27, 28) |
6389      __gen_uint(values->CommandType, 29, 31);
6390
6391   dw[1] =
6392      __gen_offset(values->PointertoVSSamplerState, 5, 31);
6393}
6394
6395#define GFX11_3DSTATE_SAMPLE_MASK_length       2
6396#define GFX11_3DSTATE_SAMPLE_MASK_length_bias      2
6397#define GFX11_3DSTATE_SAMPLE_MASK_header        \
6398   .DWordLength                         =      0,  \
6399   ._3DCommandSubOpcode                 =     24,  \
6400   ._3DCommandOpcode                    =      0,  \
6401   .CommandSubType                      =      3,  \
6402   .CommandType                         =      3
6403
6404struct GFX11_3DSTATE_SAMPLE_MASK {
6405   uint32_t                             DWordLength;
6406   uint32_t                             _3DCommandSubOpcode;
6407   uint32_t                             _3DCommandOpcode;
6408   uint32_t                             CommandSubType;
6409   uint32_t                             CommandType;
6410   uint32_t                             SampleMask;
6411};
6412
6413static inline __attribute__((always_inline)) void
6414GFX11_3DSTATE_SAMPLE_MASK_pack(__attribute__((unused)) __gen_user_data *data,
6415                               __attribute__((unused)) void * restrict dst,
6416                               __attribute__((unused)) const struct GFX11_3DSTATE_SAMPLE_MASK * restrict values)
6417{
6418   uint32_t * restrict dw = (uint32_t * restrict) dst;
6419
6420   dw[0] =
6421      __gen_uint(values->DWordLength, 0, 7) |
6422      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6423      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6424      __gen_uint(values->CommandSubType, 27, 28) |
6425      __gen_uint(values->CommandType, 29, 31);
6426
6427   dw[1] =
6428      __gen_uint(values->SampleMask, 0, 15);
6429}
6430
6431#define GFX11_3DSTATE_SAMPLE_PATTERN_length      9
6432#define GFX11_3DSTATE_SAMPLE_PATTERN_length_bias      2
6433#define GFX11_3DSTATE_SAMPLE_PATTERN_header     \
6434   .DWordLength                         =      7,  \
6435   ._3DCommandSubOpcode                 =     28,  \
6436   ._3DCommandOpcode                    =      1,  \
6437   .CommandSubType                      =      3,  \
6438   .CommandType                         =      3
6439
6440struct GFX11_3DSTATE_SAMPLE_PATTERN {
6441   uint32_t                             DWordLength;
6442   uint32_t                             _3DCommandSubOpcode;
6443   uint32_t                             _3DCommandOpcode;
6444   uint32_t                             CommandSubType;
6445   uint32_t                             CommandType;
6446   float                                _16xSample0YOffset;
6447   float                                _16xSample0XOffset;
6448   float                                _16xSample1YOffset;
6449   float                                _16xSample1XOffset;
6450   float                                _16xSample2YOffset;
6451   float                                _16xSample2XOffset;
6452   float                                _16xSample3YOffset;
6453   float                                _16xSample3XOffset;
6454   float                                _16xSample4YOffset;
6455   float                                _16xSample4XOffset;
6456   float                                _16xSample5YOffset;
6457   float                                _16xSample5XOffset;
6458   float                                _16xSample6YOffset;
6459   float                                _16xSample6XOffset;
6460   float                                _16xSample7YOffset;
6461   float                                _16xSample7XOffset;
6462   float                                _16xSample8YOffset;
6463   float                                _16xSample8XOffset;
6464   float                                _16xSample9YOffset;
6465   float                                _16xSample9XOffset;
6466   float                                _16xSample10YOffset;
6467   float                                _16xSample10XOffset;
6468   float                                _16xSample11YOffset;
6469   float                                _16xSample11XOffset;
6470   float                                _16xSample12YOffset;
6471   float                                _16xSample12XOffset;
6472   float                                _16xSample13YOffset;
6473   float                                _16xSample13XOffset;
6474   float                                _16xSample14YOffset;
6475   float                                _16xSample14XOffset;
6476   float                                _16xSample15YOffset;
6477   float                                _16xSample15XOffset;
6478   float                                _8xSample4YOffset;
6479   float                                _8xSample4XOffset;
6480   float                                _8xSample5YOffset;
6481   float                                _8xSample5XOffset;
6482   float                                _8xSample6YOffset;
6483   float                                _8xSample6XOffset;
6484   float                                _8xSample7YOffset;
6485   float                                _8xSample7XOffset;
6486   float                                _8xSample0YOffset;
6487   float                                _8xSample0XOffset;
6488   float                                _8xSample1YOffset;
6489   float                                _8xSample1XOffset;
6490   float                                _8xSample2YOffset;
6491   float                                _8xSample2XOffset;
6492   float                                _8xSample3YOffset;
6493   float                                _8xSample3XOffset;
6494   float                                _4xSample0YOffset;
6495   float                                _4xSample0XOffset;
6496   float                                _4xSample1YOffset;
6497   float                                _4xSample1XOffset;
6498   float                                _4xSample2YOffset;
6499   float                                _4xSample2XOffset;
6500   float                                _4xSample3YOffset;
6501   float                                _4xSample3XOffset;
6502   float                                _2xSample0YOffset;
6503   float                                _2xSample0XOffset;
6504   float                                _2xSample1YOffset;
6505   float                                _2xSample1XOffset;
6506   float                                _1xSample0YOffset;
6507   float                                _1xSample0XOffset;
6508};
6509
6510static inline __attribute__((always_inline)) void
6511GFX11_3DSTATE_SAMPLE_PATTERN_pack(__attribute__((unused)) __gen_user_data *data,
6512                                  __attribute__((unused)) void * restrict dst,
6513                                  __attribute__((unused)) const struct GFX11_3DSTATE_SAMPLE_PATTERN * restrict values)
6514{
6515   uint32_t * restrict dw = (uint32_t * restrict) dst;
6516
6517   dw[0] =
6518      __gen_uint(values->DWordLength, 0, 7) |
6519      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6520      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6521      __gen_uint(values->CommandSubType, 27, 28) |
6522      __gen_uint(values->CommandType, 29, 31);
6523
6524   dw[1] =
6525      __gen_ufixed(values->_16xSample0YOffset, 0, 3, 4) |
6526      __gen_ufixed(values->_16xSample0XOffset, 4, 7, 4) |
6527      __gen_ufixed(values->_16xSample1YOffset, 8, 11, 4) |
6528      __gen_ufixed(values->_16xSample1XOffset, 12, 15, 4) |
6529      __gen_ufixed(values->_16xSample2YOffset, 16, 19, 4) |
6530      __gen_ufixed(values->_16xSample2XOffset, 20, 23, 4) |
6531      __gen_ufixed(values->_16xSample3YOffset, 24, 27, 4) |
6532      __gen_ufixed(values->_16xSample3XOffset, 28, 31, 4);
6533
6534   dw[2] =
6535      __gen_ufixed(values->_16xSample4YOffset, 0, 3, 4) |
6536      __gen_ufixed(values->_16xSample4XOffset, 4, 7, 4) |
6537      __gen_ufixed(values->_16xSample5YOffset, 8, 11, 4) |
6538      __gen_ufixed(values->_16xSample5XOffset, 12, 15, 4) |
6539      __gen_ufixed(values->_16xSample6YOffset, 16, 19, 4) |
6540      __gen_ufixed(values->_16xSample6XOffset, 20, 23, 4) |
6541      __gen_ufixed(values->_16xSample7YOffset, 24, 27, 4) |
6542      __gen_ufixed(values->_16xSample7XOffset, 28, 31, 4);
6543
6544   dw[3] =
6545      __gen_ufixed(values->_16xSample8YOffset, 0, 3, 4) |
6546      __gen_ufixed(values->_16xSample8XOffset, 4, 7, 4) |
6547      __gen_ufixed(values->_16xSample9YOffset, 8, 11, 4) |
6548      __gen_ufixed(values->_16xSample9XOffset, 12, 15, 4) |
6549      __gen_ufixed(values->_16xSample10YOffset, 16, 19, 4) |
6550      __gen_ufixed(values->_16xSample10XOffset, 20, 23, 4) |
6551      __gen_ufixed(values->_16xSample11YOffset, 24, 27, 4) |
6552      __gen_ufixed(values->_16xSample11XOffset, 28, 31, 4);
6553
6554   dw[4] =
6555      __gen_ufixed(values->_16xSample12YOffset, 0, 3, 4) |
6556      __gen_ufixed(values->_16xSample12XOffset, 4, 7, 4) |
6557      __gen_ufixed(values->_16xSample13YOffset, 8, 11, 4) |
6558      __gen_ufixed(values->_16xSample13XOffset, 12, 15, 4) |
6559      __gen_ufixed(values->_16xSample14YOffset, 16, 19, 4) |
6560      __gen_ufixed(values->_16xSample14XOffset, 20, 23, 4) |
6561      __gen_ufixed(values->_16xSample15YOffset, 24, 27, 4) |
6562      __gen_ufixed(values->_16xSample15XOffset, 28, 31, 4);
6563
6564   dw[5] =
6565      __gen_ufixed(values->_8xSample4YOffset, 0, 3, 4) |
6566      __gen_ufixed(values->_8xSample4XOffset, 4, 7, 4) |
6567      __gen_ufixed(values->_8xSample5YOffset, 8, 11, 4) |
6568      __gen_ufixed(values->_8xSample5XOffset, 12, 15, 4) |
6569      __gen_ufixed(values->_8xSample6YOffset, 16, 19, 4) |
6570      __gen_ufixed(values->_8xSample6XOffset, 20, 23, 4) |
6571      __gen_ufixed(values->_8xSample7YOffset, 24, 27, 4) |
6572      __gen_ufixed(values->_8xSample7XOffset, 28, 31, 4);
6573
6574   dw[6] =
6575      __gen_ufixed(values->_8xSample0YOffset, 0, 3, 4) |
6576      __gen_ufixed(values->_8xSample0XOffset, 4, 7, 4) |
6577      __gen_ufixed(values->_8xSample1YOffset, 8, 11, 4) |
6578      __gen_ufixed(values->_8xSample1XOffset, 12, 15, 4) |
6579      __gen_ufixed(values->_8xSample2YOffset, 16, 19, 4) |
6580      __gen_ufixed(values->_8xSample2XOffset, 20, 23, 4) |
6581      __gen_ufixed(values->_8xSample3YOffset, 24, 27, 4) |
6582      __gen_ufixed(values->_8xSample3XOffset, 28, 31, 4);
6583
6584   dw[7] =
6585      __gen_ufixed(values->_4xSample0YOffset, 0, 3, 4) |
6586      __gen_ufixed(values->_4xSample0XOffset, 4, 7, 4) |
6587      __gen_ufixed(values->_4xSample1YOffset, 8, 11, 4) |
6588      __gen_ufixed(values->_4xSample1XOffset, 12, 15, 4) |
6589      __gen_ufixed(values->_4xSample2YOffset, 16, 19, 4) |
6590      __gen_ufixed(values->_4xSample2XOffset, 20, 23, 4) |
6591      __gen_ufixed(values->_4xSample3YOffset, 24, 27, 4) |
6592      __gen_ufixed(values->_4xSample3XOffset, 28, 31, 4);
6593
6594   dw[8] =
6595      __gen_ufixed(values->_2xSample0YOffset, 0, 3, 4) |
6596      __gen_ufixed(values->_2xSample0XOffset, 4, 7, 4) |
6597      __gen_ufixed(values->_2xSample1YOffset, 8, 11, 4) |
6598      __gen_ufixed(values->_2xSample1XOffset, 12, 15, 4) |
6599      __gen_ufixed(values->_1xSample0YOffset, 16, 19, 4) |
6600      __gen_ufixed(values->_1xSample0XOffset, 20, 23, 4);
6601}
6602
6603#define GFX11_3DSTATE_SBE_length               6
6604#define GFX11_3DSTATE_SBE_length_bias          2
6605#define GFX11_3DSTATE_SBE_header                \
6606   .DWordLength                         =      4,  \
6607   ._3DCommandSubOpcode                 =     31,  \
6608   ._3DCommandOpcode                    =      0,  \
6609   .CommandSubType                      =      3,  \
6610   .CommandType                         =      3
6611
6612struct GFX11_3DSTATE_SBE {
6613   uint32_t                             DWordLength;
6614   uint32_t                             _3DCommandSubOpcode;
6615   uint32_t                             _3DCommandOpcode;
6616   uint32_t                             CommandSubType;
6617   uint32_t                             CommandType;
6618   uint32_t                             PrimitiveIDOverrideAttributeSelect;
6619   uint32_t                             VertexURBEntryReadOffset;
6620   uint32_t                             VertexURBEntryReadLength;
6621   bool                                 PrimitiveIDOverrideComponentX;
6622   bool                                 PrimitiveIDOverrideComponentY;
6623   bool                                 PrimitiveIDOverrideComponentZ;
6624   bool                                 PrimitiveIDOverrideComponentW;
6625   uint32_t                             PointSpriteTextureCoordinateOrigin;
6626#define UPPERLEFT                                0
6627#define LOWERLEFT                                1
6628   bool                                 AttributeSwizzleEnable;
6629   uint32_t                             NumberofSFOutputAttributes;
6630   bool                                 ForceVertexURBEntryReadOffset;
6631   bool                                 ForceVertexURBEntryReadLength;
6632   uint32_t                             PointSpriteTextureCoordinateEnable;
6633   uint32_t                             ConstantInterpolationEnable;
6634   uint32_t                             AttributeActiveComponentFormat[32];
6635#define ACTIVE_COMPONENT_DISABLED                0
6636#define ACTIVE_COMPONENT_XY                      1
6637#define ACTIVE_COMPONENT_XYZ                     2
6638#define ACTIVE_COMPONENT_XYZW                    3
6639};
6640
6641static inline __attribute__((always_inline)) void
6642GFX11_3DSTATE_SBE_pack(__attribute__((unused)) __gen_user_data *data,
6643                       __attribute__((unused)) void * restrict dst,
6644                       __attribute__((unused)) const struct GFX11_3DSTATE_SBE * restrict values)
6645{
6646   uint32_t * restrict dw = (uint32_t * restrict) dst;
6647
6648   dw[0] =
6649      __gen_uint(values->DWordLength, 0, 7) |
6650      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6651      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6652      __gen_uint(values->CommandSubType, 27, 28) |
6653      __gen_uint(values->CommandType, 29, 31);
6654
6655   dw[1] =
6656      __gen_uint(values->PrimitiveIDOverrideAttributeSelect, 0, 4) |
6657      __gen_uint(values->VertexURBEntryReadOffset, 5, 10) |
6658      __gen_uint(values->VertexURBEntryReadLength, 11, 15) |
6659      __gen_uint(values->PrimitiveIDOverrideComponentX, 16, 16) |
6660      __gen_uint(values->PrimitiveIDOverrideComponentY, 17, 17) |
6661      __gen_uint(values->PrimitiveIDOverrideComponentZ, 18, 18) |
6662      __gen_uint(values->PrimitiveIDOverrideComponentW, 19, 19) |
6663      __gen_uint(values->PointSpriteTextureCoordinateOrigin, 20, 20) |
6664      __gen_uint(values->AttributeSwizzleEnable, 21, 21) |
6665      __gen_uint(values->NumberofSFOutputAttributes, 22, 27) |
6666      __gen_uint(values->ForceVertexURBEntryReadOffset, 28, 28) |
6667      __gen_uint(values->ForceVertexURBEntryReadLength, 29, 29);
6668
6669   dw[2] =
6670      __gen_uint(values->PointSpriteTextureCoordinateEnable, 0, 31);
6671
6672   dw[3] =
6673      __gen_uint(values->ConstantInterpolationEnable, 0, 31);
6674
6675   dw[4] =
6676      __gen_uint(values->AttributeActiveComponentFormat[0], 0, 1) |
6677      __gen_uint(values->AttributeActiveComponentFormat[1], 2, 3) |
6678      __gen_uint(values->AttributeActiveComponentFormat[2], 4, 5) |
6679      __gen_uint(values->AttributeActiveComponentFormat[3], 6, 7) |
6680      __gen_uint(values->AttributeActiveComponentFormat[4], 8, 9) |
6681      __gen_uint(values->AttributeActiveComponentFormat[5], 10, 11) |
6682      __gen_uint(values->AttributeActiveComponentFormat[6], 12, 13) |
6683      __gen_uint(values->AttributeActiveComponentFormat[7], 14, 15) |
6684      __gen_uint(values->AttributeActiveComponentFormat[8], 16, 17) |
6685      __gen_uint(values->AttributeActiveComponentFormat[9], 18, 19) |
6686      __gen_uint(values->AttributeActiveComponentFormat[10], 20, 21) |
6687      __gen_uint(values->AttributeActiveComponentFormat[11], 22, 23) |
6688      __gen_uint(values->AttributeActiveComponentFormat[12], 24, 25) |
6689      __gen_uint(values->AttributeActiveComponentFormat[13], 26, 27) |
6690      __gen_uint(values->AttributeActiveComponentFormat[14], 28, 29) |
6691      __gen_uint(values->AttributeActiveComponentFormat[15], 30, 31);
6692
6693   dw[5] =
6694      __gen_uint(values->AttributeActiveComponentFormat[16], 0, 1) |
6695      __gen_uint(values->AttributeActiveComponentFormat[17], 2, 3) |
6696      __gen_uint(values->AttributeActiveComponentFormat[18], 4, 5) |
6697      __gen_uint(values->AttributeActiveComponentFormat[19], 6, 7) |
6698      __gen_uint(values->AttributeActiveComponentFormat[20], 8, 9) |
6699      __gen_uint(values->AttributeActiveComponentFormat[21], 10, 11) |
6700      __gen_uint(values->AttributeActiveComponentFormat[22], 12, 13) |
6701      __gen_uint(values->AttributeActiveComponentFormat[23], 14, 15) |
6702      __gen_uint(values->AttributeActiveComponentFormat[24], 16, 17) |
6703      __gen_uint(values->AttributeActiveComponentFormat[25], 18, 19) |
6704      __gen_uint(values->AttributeActiveComponentFormat[26], 20, 21) |
6705      __gen_uint(values->AttributeActiveComponentFormat[27], 22, 23) |
6706      __gen_uint(values->AttributeActiveComponentFormat[28], 24, 25) |
6707      __gen_uint(values->AttributeActiveComponentFormat[29], 26, 27) |
6708      __gen_uint(values->AttributeActiveComponentFormat[30], 28, 29) |
6709      __gen_uint(values->AttributeActiveComponentFormat[31], 30, 31);
6710}
6711
6712#define GFX11_3DSTATE_SBE_SWIZ_length         11
6713#define GFX11_3DSTATE_SBE_SWIZ_length_bias      2
6714#define GFX11_3DSTATE_SBE_SWIZ_header           \
6715   .DWordLength                         =      9,  \
6716   ._3DCommandSubOpcode                 =     81,  \
6717   ._3DCommandOpcode                    =      0,  \
6718   .CommandSubType                      =      3,  \
6719   .CommandType                         =      3
6720
6721struct GFX11_3DSTATE_SBE_SWIZ {
6722   uint32_t                             DWordLength;
6723   uint32_t                             _3DCommandSubOpcode;
6724   uint32_t                             _3DCommandOpcode;
6725   uint32_t                             CommandSubType;
6726   uint32_t                             CommandType;
6727   struct GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL Attribute[16];
6728   uint32_t                             AttributeWrapShortestEnables[16];
6729};
6730
6731static inline __attribute__((always_inline)) void
6732GFX11_3DSTATE_SBE_SWIZ_pack(__attribute__((unused)) __gen_user_data *data,
6733                            __attribute__((unused)) void * restrict dst,
6734                            __attribute__((unused)) const struct GFX11_3DSTATE_SBE_SWIZ * restrict values)
6735{
6736   uint32_t * restrict dw = (uint32_t * restrict) dst;
6737
6738   dw[0] =
6739      __gen_uint(values->DWordLength, 0, 7) |
6740      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6741      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6742      __gen_uint(values->CommandSubType, 27, 28) |
6743      __gen_uint(values->CommandType, 29, 31);
6744
6745   uint32_t v1_0;
6746   GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v1_0, &values->Attribute[0]);
6747
6748   uint32_t v1_1;
6749   GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v1_1, &values->Attribute[1]);
6750
6751   dw[1] =
6752      __gen_uint(v1_0, 0, 15) |
6753      __gen_uint(v1_1, 16, 31);
6754
6755   uint32_t v2_0;
6756   GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v2_0, &values->Attribute[2]);
6757
6758   uint32_t v2_1;
6759   GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v2_1, &values->Attribute[3]);
6760
6761   dw[2] =
6762      __gen_uint(v2_0, 0, 15) |
6763      __gen_uint(v2_1, 16, 31);
6764
6765   uint32_t v3_0;
6766   GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v3_0, &values->Attribute[4]);
6767
6768   uint32_t v3_1;
6769   GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v3_1, &values->Attribute[5]);
6770
6771   dw[3] =
6772      __gen_uint(v3_0, 0, 15) |
6773      __gen_uint(v3_1, 16, 31);
6774
6775   uint32_t v4_0;
6776   GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v4_0, &values->Attribute[6]);
6777
6778   uint32_t v4_1;
6779   GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v4_1, &values->Attribute[7]);
6780
6781   dw[4] =
6782      __gen_uint(v4_0, 0, 15) |
6783      __gen_uint(v4_1, 16, 31);
6784
6785   uint32_t v5_0;
6786   GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v5_0, &values->Attribute[8]);
6787
6788   uint32_t v5_1;
6789   GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v5_1, &values->Attribute[9]);
6790
6791   dw[5] =
6792      __gen_uint(v5_0, 0, 15) |
6793      __gen_uint(v5_1, 16, 31);
6794
6795   uint32_t v6_0;
6796   GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v6_0, &values->Attribute[10]);
6797
6798   uint32_t v6_1;
6799   GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v6_1, &values->Attribute[11]);
6800
6801   dw[6] =
6802      __gen_uint(v6_0, 0, 15) |
6803      __gen_uint(v6_1, 16, 31);
6804
6805   uint32_t v7_0;
6806   GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v7_0, &values->Attribute[12]);
6807
6808   uint32_t v7_1;
6809   GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v7_1, &values->Attribute[13]);
6810
6811   dw[7] =
6812      __gen_uint(v7_0, 0, 15) |
6813      __gen_uint(v7_1, 16, 31);
6814
6815   uint32_t v8_0;
6816   GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_0, &values->Attribute[14]);
6817
6818   uint32_t v8_1;
6819   GFX11_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_1, &values->Attribute[15]);
6820
6821   dw[8] =
6822      __gen_uint(v8_0, 0, 15) |
6823      __gen_uint(v8_1, 16, 31);
6824
6825   dw[9] =
6826      __gen_uint(values->AttributeWrapShortestEnables[0], 0, 3) |
6827      __gen_uint(values->AttributeWrapShortestEnables[1], 4, 7) |
6828      __gen_uint(values->AttributeWrapShortestEnables[2], 8, 11) |
6829      __gen_uint(values->AttributeWrapShortestEnables[3], 12, 15) |
6830      __gen_uint(values->AttributeWrapShortestEnables[4], 16, 19) |
6831      __gen_uint(values->AttributeWrapShortestEnables[5], 20, 23) |
6832      __gen_uint(values->AttributeWrapShortestEnables[6], 24, 27) |
6833      __gen_uint(values->AttributeWrapShortestEnables[7], 28, 31);
6834
6835   dw[10] =
6836      __gen_uint(values->AttributeWrapShortestEnables[8], 0, 3) |
6837      __gen_uint(values->AttributeWrapShortestEnables[9], 4, 7) |
6838      __gen_uint(values->AttributeWrapShortestEnables[10], 8, 11) |
6839      __gen_uint(values->AttributeWrapShortestEnables[11], 12, 15) |
6840      __gen_uint(values->AttributeWrapShortestEnables[12], 16, 19) |
6841      __gen_uint(values->AttributeWrapShortestEnables[13], 20, 23) |
6842      __gen_uint(values->AttributeWrapShortestEnables[14], 24, 27) |
6843      __gen_uint(values->AttributeWrapShortestEnables[15], 28, 31);
6844}
6845
6846#define GFX11_3DSTATE_SCISSOR_STATE_POINTERS_length      2
6847#define GFX11_3DSTATE_SCISSOR_STATE_POINTERS_length_bias      2
6848#define GFX11_3DSTATE_SCISSOR_STATE_POINTERS_header\
6849   .DWordLength                         =      0,  \
6850   ._3DCommandSubOpcode                 =     15,  \
6851   ._3DCommandOpcode                    =      0,  \
6852   .CommandSubType                      =      3,  \
6853   .CommandType                         =      3
6854
6855struct GFX11_3DSTATE_SCISSOR_STATE_POINTERS {
6856   uint32_t                             DWordLength;
6857   uint32_t                             _3DCommandSubOpcode;
6858   uint32_t                             _3DCommandOpcode;
6859   uint32_t                             CommandSubType;
6860   uint32_t                             CommandType;
6861   uint64_t                             ScissorRectPointer;
6862};
6863
6864static inline __attribute__((always_inline)) void
6865GFX11_3DSTATE_SCISSOR_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
6866                                          __attribute__((unused)) void * restrict dst,
6867                                          __attribute__((unused)) const struct GFX11_3DSTATE_SCISSOR_STATE_POINTERS * restrict values)
6868{
6869   uint32_t * restrict dw = (uint32_t * restrict) dst;
6870
6871   dw[0] =
6872      __gen_uint(values->DWordLength, 0, 7) |
6873      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6874      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6875      __gen_uint(values->CommandSubType, 27, 28) |
6876      __gen_uint(values->CommandType, 29, 31);
6877
6878   dw[1] =
6879      __gen_offset(values->ScissorRectPointer, 5, 31);
6880}
6881
6882#define GFX11_3DSTATE_SF_length                4
6883#define GFX11_3DSTATE_SF_length_bias           2
6884#define GFX11_3DSTATE_SF_header                 \
6885   .DWordLength                         =      2,  \
6886   ._3DCommandSubOpcode                 =     19,  \
6887   ._3DCommandOpcode                    =      0,  \
6888   .CommandSubType                      =      3,  \
6889   .CommandType                         =      3
6890
6891struct GFX11_3DSTATE_SF {
6892   uint32_t                             DWordLength;
6893   uint32_t                             _3DCommandSubOpcode;
6894   uint32_t                             _3DCommandOpcode;
6895   uint32_t                             CommandSubType;
6896   uint32_t                             CommandType;
6897   bool                                 ViewportTransformEnable;
6898   bool                                 StatisticsEnable;
6899   bool                                 LegacyGlobalDepthBiasEnable;
6900   float                                LineWidth;
6901   uint32_t                             LineEndCapAntialiasingRegionWidth;
6902#define _05pixels                                0
6903#define _10pixels                                1
6904#define _20pixels                                2
6905#define _40pixels                                3
6906   float                                PointWidth;
6907   uint32_t                             PointWidthSource;
6908#define Vertex                                   0
6909#define State                                    1
6910   uint32_t                             VertexSubPixelPrecisionSelect;
6911#define _8Bit                                    0
6912#define _4Bit                                    1
6913   bool                                 SmoothPointEnable;
6914   uint32_t                             AALineDistanceMode;
6915#define AALINEDISTANCE_TRUE                      1
6916   uint32_t                             TriangleFanProvokingVertexSelect;
6917   uint32_t                             LineStripListProvokingVertexSelect;
6918   uint32_t                             TriangleStripListProvokingVertexSelect;
6919   bool                                 LastPixelEnable;
6920};
6921
6922static inline __attribute__((always_inline)) void
6923GFX11_3DSTATE_SF_pack(__attribute__((unused)) __gen_user_data *data,
6924                      __attribute__((unused)) void * restrict dst,
6925                      __attribute__((unused)) const struct GFX11_3DSTATE_SF * restrict values)
6926{
6927   uint32_t * restrict dw = (uint32_t * restrict) dst;
6928
6929   dw[0] =
6930      __gen_uint(values->DWordLength, 0, 7) |
6931      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6932      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6933      __gen_uint(values->CommandSubType, 27, 28) |
6934      __gen_uint(values->CommandType, 29, 31);
6935
6936   dw[1] =
6937      __gen_uint(values->ViewportTransformEnable, 1, 1) |
6938      __gen_uint(values->StatisticsEnable, 10, 10) |
6939      __gen_uint(values->LegacyGlobalDepthBiasEnable, 11, 11) |
6940      __gen_ufixed(values->LineWidth, 12, 29, 7);
6941
6942   dw[2] =
6943      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 16, 17);
6944
6945   dw[3] =
6946      __gen_ufixed(values->PointWidth, 0, 10, 3) |
6947      __gen_uint(values->PointWidthSource, 11, 11) |
6948      __gen_uint(values->VertexSubPixelPrecisionSelect, 12, 12) |
6949      __gen_uint(values->SmoothPointEnable, 13, 13) |
6950      __gen_uint(values->AALineDistanceMode, 14, 14) |
6951      __gen_uint(values->TriangleFanProvokingVertexSelect, 25, 26) |
6952      __gen_uint(values->LineStripListProvokingVertexSelect, 27, 28) |
6953      __gen_uint(values->TriangleStripListProvokingVertexSelect, 29, 30) |
6954      __gen_uint(values->LastPixelEnable, 31, 31);
6955}
6956
6957#define GFX11_3DSTATE_SLICE_TABLE_STATE_POINTERS_length      2
6958#define GFX11_3DSTATE_SLICE_TABLE_STATE_POINTERS_length_bias      2
6959#define GFX11_3DSTATE_SLICE_TABLE_STATE_POINTERS_header\
6960   .DWordLength                         =      0,  \
6961   ._3DCommandSubOpcode                 =     32,  \
6962   ._3DCommandOpcode                    =      1,  \
6963   .CommandSubType                      =      3,  \
6964   .CommandType                         =      3
6965
6966struct GFX11_3DSTATE_SLICE_TABLE_STATE_POINTERS {
6967   uint32_t                             DWordLength;
6968   uint32_t                             _3DCommandSubOpcode;
6969   uint32_t                             _3DCommandOpcode;
6970   uint32_t                             CommandSubType;
6971   uint32_t                             CommandType;
6972   bool                                 SliceHashStatePointerValid;
6973   uint64_t                             SliceHashTableStatePointer;
6974};
6975
6976static inline __attribute__((always_inline)) void
6977GFX11_3DSTATE_SLICE_TABLE_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
6978                                              __attribute__((unused)) void * restrict dst,
6979                                              __attribute__((unused)) const struct GFX11_3DSTATE_SLICE_TABLE_STATE_POINTERS * restrict values)
6980{
6981   uint32_t * restrict dw = (uint32_t * restrict) dst;
6982
6983   dw[0] =
6984      __gen_uint(values->DWordLength, 0, 7) |
6985      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6986      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6987      __gen_uint(values->CommandSubType, 27, 28) |
6988      __gen_uint(values->CommandType, 29, 31);
6989
6990   dw[1] =
6991      __gen_uint(values->SliceHashStatePointerValid, 0, 0) |
6992      __gen_offset(values->SliceHashTableStatePointer, 6, 31);
6993}
6994
6995#define GFX11_3DSTATE_SO_BUFFER_length         8
6996#define GFX11_3DSTATE_SO_BUFFER_length_bias      2
6997#define GFX11_3DSTATE_SO_BUFFER_header          \
6998   .DWordLength                         =      6,  \
6999   ._3DCommandSubOpcode                 =     24,  \
7000   ._3DCommandOpcode                    =      1,  \
7001   .CommandSubType                      =      3,  \
7002   .CommandType                         =      3
7003
7004struct GFX11_3DSTATE_SO_BUFFER {
7005   uint32_t                             DWordLength;
7006   uint32_t                             _3DCommandSubOpcode;
7007   uint32_t                             _3DCommandOpcode;
7008   uint32_t                             CommandSubType;
7009   uint32_t                             CommandType;
7010   bool                                 StreamOutputBufferOffsetAddressEnable;
7011   bool                                 StreamOffsetWriteEnable;
7012   uint32_t                             MOCS;
7013   uint32_t                             SOBufferIndex;
7014   bool                                 SOBufferEnable;
7015   __gen_address_type                   SurfaceBaseAddress;
7016   uint32_t                             SurfaceSize;
7017   __gen_address_type                   StreamOutputBufferOffsetAddress;
7018   uint32_t                             StreamOffset;
7019};
7020
7021static inline __attribute__((always_inline)) void
7022GFX11_3DSTATE_SO_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
7023                             __attribute__((unused)) void * restrict dst,
7024                             __attribute__((unused)) const struct GFX11_3DSTATE_SO_BUFFER * restrict values)
7025{
7026   uint32_t * restrict dw = (uint32_t * restrict) dst;
7027
7028   dw[0] =
7029      __gen_uint(values->DWordLength, 0, 7) |
7030      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7031      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7032      __gen_uint(values->CommandSubType, 27, 28) |
7033      __gen_uint(values->CommandType, 29, 31);
7034
7035   dw[1] =
7036      __gen_uint(values->StreamOutputBufferOffsetAddressEnable, 20, 20) |
7037      __gen_uint(values->StreamOffsetWriteEnable, 21, 21) |
7038      __gen_uint(values->MOCS, 22, 28) |
7039      __gen_uint(values->SOBufferIndex, 29, 30) |
7040      __gen_uint(values->SOBufferEnable, 31, 31);
7041
7042   const uint64_t v2_address =
7043      __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 2, 47);
7044   dw[2] = v2_address;
7045   dw[3] = v2_address >> 32;
7046
7047   dw[4] =
7048      __gen_uint(values->SurfaceSize, 0, 29);
7049
7050   const uint64_t v5_address =
7051      __gen_address(data, &dw[5], values->StreamOutputBufferOffsetAddress, 0, 2, 47);
7052   dw[5] = v5_address;
7053   dw[6] = v5_address >> 32;
7054
7055   dw[7] =
7056      __gen_uint(values->StreamOffset, 0, 31);
7057}
7058
7059#define GFX11_3DSTATE_SO_DECL_LIST_length_bias      2
7060#define GFX11_3DSTATE_SO_DECL_LIST_header       \
7061   ._3DCommandSubOpcode                 =     23,  \
7062   ._3DCommandOpcode                    =      1,  \
7063   .CommandSubType                      =      3,  \
7064   .CommandType                         =      3
7065
7066struct GFX11_3DSTATE_SO_DECL_LIST {
7067   uint32_t                             DWordLength;
7068   uint32_t                             _3DCommandSubOpcode;
7069   uint32_t                             _3DCommandOpcode;
7070   uint32_t                             CommandSubType;
7071   uint32_t                             CommandType;
7072   uint32_t                             StreamtoBufferSelects0;
7073   uint32_t                             StreamtoBufferSelects1;
7074   uint32_t                             StreamtoBufferSelects2;
7075   uint32_t                             StreamtoBufferSelects3;
7076   uint32_t                             NumEntries0;
7077   uint32_t                             NumEntries1;
7078   uint32_t                             NumEntries2;
7079   uint32_t                             NumEntries3;
7080   /* variable length fields follow */
7081};
7082
7083static inline __attribute__((always_inline)) void
7084GFX11_3DSTATE_SO_DECL_LIST_pack(__attribute__((unused)) __gen_user_data *data,
7085                                __attribute__((unused)) void * restrict dst,
7086                                __attribute__((unused)) const struct GFX11_3DSTATE_SO_DECL_LIST * restrict values)
7087{
7088   uint32_t * restrict dw = (uint32_t * restrict) dst;
7089
7090   dw[0] =
7091      __gen_uint(values->DWordLength, 0, 8) |
7092      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7093      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7094      __gen_uint(values->CommandSubType, 27, 28) |
7095      __gen_uint(values->CommandType, 29, 31);
7096
7097   dw[1] =
7098      __gen_uint(values->StreamtoBufferSelects0, 0, 3) |
7099      __gen_uint(values->StreamtoBufferSelects1, 4, 7) |
7100      __gen_uint(values->StreamtoBufferSelects2, 8, 11) |
7101      __gen_uint(values->StreamtoBufferSelects3, 12, 15);
7102
7103   dw[2] =
7104      __gen_uint(values->NumEntries0, 0, 7) |
7105      __gen_uint(values->NumEntries1, 8, 15) |
7106      __gen_uint(values->NumEntries2, 16, 23) |
7107      __gen_uint(values->NumEntries3, 24, 31);
7108}
7109
7110#define GFX11_3DSTATE_STENCIL_BUFFER_length      5
7111#define GFX11_3DSTATE_STENCIL_BUFFER_length_bias      2
7112#define GFX11_3DSTATE_STENCIL_BUFFER_header     \
7113   .DWordLength                         =      3,  \
7114   ._3DCommandSubOpcode                 =      6,  \
7115   ._3DCommandOpcode                    =      0,  \
7116   .CommandSubType                      =      3,  \
7117   .CommandType                         =      3
7118
7119struct GFX11_3DSTATE_STENCIL_BUFFER {
7120   uint32_t                             DWordLength;
7121   uint32_t                             _3DCommandSubOpcode;
7122   uint32_t                             _3DCommandOpcode;
7123   uint32_t                             CommandSubType;
7124   uint32_t                             CommandType;
7125   uint32_t                             SurfacePitch;
7126   uint32_t                             MOCS;
7127   bool                                 StencilBufferEnable;
7128   __gen_address_type                   SurfaceBaseAddress;
7129   uint32_t                             SurfaceQPitch;
7130};
7131
7132static inline __attribute__((always_inline)) void
7133GFX11_3DSTATE_STENCIL_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
7134                                  __attribute__((unused)) void * restrict dst,
7135                                  __attribute__((unused)) const struct GFX11_3DSTATE_STENCIL_BUFFER * restrict values)
7136{
7137   uint32_t * restrict dw = (uint32_t * restrict) dst;
7138
7139   dw[0] =
7140      __gen_uint(values->DWordLength, 0, 7) |
7141      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7142      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7143      __gen_uint(values->CommandSubType, 27, 28) |
7144      __gen_uint(values->CommandType, 29, 31);
7145
7146   dw[1] =
7147      __gen_uint(values->SurfacePitch, 0, 16) |
7148      __gen_uint(values->MOCS, 22, 28) |
7149      __gen_uint(values->StencilBufferEnable, 31, 31);
7150
7151   const uint64_t v2_address =
7152      __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 0, 63);
7153   dw[2] = v2_address;
7154   dw[3] = v2_address >> 32;
7155
7156   dw[4] =
7157      __gen_uint(values->SurfaceQPitch, 0, 14);
7158}
7159
7160#define GFX11_3DSTATE_STREAMOUT_length         5
7161#define GFX11_3DSTATE_STREAMOUT_length_bias      2
7162#define GFX11_3DSTATE_STREAMOUT_header          \
7163   .DWordLength                         =      3,  \
7164   ._3DCommandSubOpcode                 =     30,  \
7165   ._3DCommandOpcode                    =      0,  \
7166   .CommandSubType                      =      3,  \
7167   .CommandType                         =      3
7168
7169struct GFX11_3DSTATE_STREAMOUT {
7170   uint32_t                             DWordLength;
7171   uint32_t                             _3DCommandSubOpcode;
7172   uint32_t                             _3DCommandOpcode;
7173   uint32_t                             CommandSubType;
7174   uint32_t                             CommandType;
7175   uint32_t                             ForceRendering;
7176#define Resreved                                 1
7177#define Force_Off                                2
7178#define Force_on                                 3
7179   bool                                 SOStatisticsEnable;
7180   uint32_t                             ReorderMode;
7181#define LEADING                                  0
7182#define TRAILING                                 1
7183   uint32_t                             RenderStreamSelect;
7184   bool                                 RenderingDisable;
7185   bool                                 SOFunctionEnable;
7186   uint32_t                             Stream0VertexReadLength;
7187   uint32_t                             Stream0VertexReadOffset;
7188   uint32_t                             Stream1VertexReadLength;
7189   uint32_t                             Stream1VertexReadOffset;
7190   uint32_t                             Stream2VertexReadLength;
7191   uint32_t                             Stream2VertexReadOffset;
7192   uint32_t                             Stream3VertexReadLength;
7193   uint32_t                             Stream3VertexReadOffset;
7194   uint32_t                             Buffer0SurfacePitch;
7195   uint32_t                             Buffer1SurfacePitch;
7196   uint32_t                             Buffer2SurfacePitch;
7197   uint32_t                             Buffer3SurfacePitch;
7198};
7199
7200static inline __attribute__((always_inline)) void
7201GFX11_3DSTATE_STREAMOUT_pack(__attribute__((unused)) __gen_user_data *data,
7202                             __attribute__((unused)) void * restrict dst,
7203                             __attribute__((unused)) const struct GFX11_3DSTATE_STREAMOUT * restrict values)
7204{
7205   uint32_t * restrict dw = (uint32_t * restrict) dst;
7206
7207   dw[0] =
7208      __gen_uint(values->DWordLength, 0, 7) |
7209      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7210      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7211      __gen_uint(values->CommandSubType, 27, 28) |
7212      __gen_uint(values->CommandType, 29, 31);
7213
7214   dw[1] =
7215      __gen_uint(values->ForceRendering, 23, 24) |
7216      __gen_uint(values->SOStatisticsEnable, 25, 25) |
7217      __gen_uint(values->ReorderMode, 26, 26) |
7218      __gen_uint(values->RenderStreamSelect, 27, 28) |
7219      __gen_uint(values->RenderingDisable, 30, 30) |
7220      __gen_uint(values->SOFunctionEnable, 31, 31);
7221
7222   dw[2] =
7223      __gen_uint(values->Stream0VertexReadLength, 0, 4) |
7224      __gen_uint(values->Stream0VertexReadOffset, 5, 5) |
7225      __gen_uint(values->Stream1VertexReadLength, 8, 12) |
7226      __gen_uint(values->Stream1VertexReadOffset, 13, 13) |
7227      __gen_uint(values->Stream2VertexReadLength, 16, 20) |
7228      __gen_uint(values->Stream2VertexReadOffset, 21, 21) |
7229      __gen_uint(values->Stream3VertexReadLength, 24, 28) |
7230      __gen_uint(values->Stream3VertexReadOffset, 29, 29);
7231
7232   dw[3] =
7233      __gen_uint(values->Buffer0SurfacePitch, 0, 11) |
7234      __gen_uint(values->Buffer1SurfacePitch, 16, 27);
7235
7236   dw[4] =
7237      __gen_uint(values->Buffer2SurfacePitch, 0, 11) |
7238      __gen_uint(values->Buffer3SurfacePitch, 16, 27);
7239}
7240
7241#define GFX11_3DSTATE_TE_length                4
7242#define GFX11_3DSTATE_TE_length_bias           2
7243#define GFX11_3DSTATE_TE_header                 \
7244   .DWordLength                         =      2,  \
7245   ._3DCommandSubOpcode                 =     28,  \
7246   ._3DCommandOpcode                    =      0,  \
7247   .CommandSubType                      =      3,  \
7248   .CommandType                         =      3
7249
7250struct GFX11_3DSTATE_TE {
7251   uint32_t                             DWordLength;
7252   uint32_t                             _3DCommandSubOpcode;
7253   uint32_t                             _3DCommandOpcode;
7254   uint32_t                             CommandSubType;
7255   uint32_t                             CommandType;
7256   bool                                 TEEnable;
7257   uint32_t                             TEMode;
7258#define HW_TESS                                  0
7259   uint32_t                             TEDomain;
7260#define QUAD                                     0
7261#define TRI                                      1
7262#define ISOLINE                                  2
7263   uint32_t                             OutputTopology;
7264#define OUTPUT_POINT                             0
7265#define OUTPUT_LINE                              1
7266#define OUTPUT_TRI_CW                            2
7267#define OUTPUT_TRI_CCW                           3
7268   uint32_t                             Partitioning;
7269#define INTEGER                                  0
7270#define ODD_FRACTIONAL                           1
7271#define EVEN_FRACTIONAL                          2
7272   float                                MaximumTessellationFactorOdd;
7273   float                                MaximumTessellationFactorNotOdd;
7274};
7275
7276static inline __attribute__((always_inline)) void
7277GFX11_3DSTATE_TE_pack(__attribute__((unused)) __gen_user_data *data,
7278                      __attribute__((unused)) void * restrict dst,
7279                      __attribute__((unused)) const struct GFX11_3DSTATE_TE * restrict values)
7280{
7281   uint32_t * restrict dw = (uint32_t * restrict) dst;
7282
7283   dw[0] =
7284      __gen_uint(values->DWordLength, 0, 7) |
7285      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7286      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7287      __gen_uint(values->CommandSubType, 27, 28) |
7288      __gen_uint(values->CommandType, 29, 31);
7289
7290   dw[1] =
7291      __gen_uint(values->TEEnable, 0, 0) |
7292      __gen_uint(values->TEMode, 1, 2) |
7293      __gen_uint(values->TEDomain, 4, 5) |
7294      __gen_uint(values->OutputTopology, 8, 9) |
7295      __gen_uint(values->Partitioning, 12, 13);
7296
7297   dw[2] =
7298      __gen_float(values->MaximumTessellationFactorOdd);
7299
7300   dw[3] =
7301      __gen_float(values->MaximumTessellationFactorNotOdd);
7302}
7303
7304#define GFX11_3DSTATE_URB_CLEAR_length         2
7305#define GFX11_3DSTATE_URB_CLEAR_length_bias      2
7306#define GFX11_3DSTATE_URB_CLEAR_header          \
7307   .DWordLength                         =      0,  \
7308   ._3DCommandSubOpcode                 =     29,  \
7309   ._3DCommandOpcode                    =      1,  \
7310   .CommandSubType                      =      3,  \
7311   .CommandType                         =      3
7312
7313struct GFX11_3DSTATE_URB_CLEAR {
7314   uint32_t                             DWordLength;
7315   uint32_t                             _3DCommandSubOpcode;
7316   uint32_t                             _3DCommandOpcode;
7317   uint32_t                             CommandSubType;
7318   uint32_t                             CommandType;
7319   uint64_t                             URBAddress;
7320   uint32_t                             URBClearLength;
7321};
7322
7323static inline __attribute__((always_inline)) void
7324GFX11_3DSTATE_URB_CLEAR_pack(__attribute__((unused)) __gen_user_data *data,
7325                             __attribute__((unused)) void * restrict dst,
7326                             __attribute__((unused)) const struct GFX11_3DSTATE_URB_CLEAR * restrict values)
7327{
7328   uint32_t * restrict dw = (uint32_t * restrict) dst;
7329
7330   dw[0] =
7331      __gen_uint(values->DWordLength, 0, 7) |
7332      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7333      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7334      __gen_uint(values->CommandSubType, 27, 28) |
7335      __gen_uint(values->CommandType, 29, 31);
7336
7337   dw[1] =
7338      __gen_offset(values->URBAddress, 0, 14) |
7339      __gen_uint(values->URBClearLength, 16, 29);
7340}
7341
7342#define GFX11_3DSTATE_URB_DS_length            2
7343#define GFX11_3DSTATE_URB_DS_length_bias       2
7344#define GFX11_3DSTATE_URB_DS_header             \
7345   .DWordLength                         =      0,  \
7346   ._3DCommandSubOpcode                 =     50,  \
7347   ._3DCommandOpcode                    =      0,  \
7348   .CommandSubType                      =      3,  \
7349   .CommandType                         =      3
7350
7351struct GFX11_3DSTATE_URB_DS {
7352   uint32_t                             DWordLength;
7353   uint32_t                             _3DCommandSubOpcode;
7354   uint32_t                             _3DCommandOpcode;
7355   uint32_t                             CommandSubType;
7356   uint32_t                             CommandType;
7357   uint32_t                             DSNumberofURBEntries;
7358   uint32_t                             DSURBEntryAllocationSize;
7359   uint32_t                             DSURBStartingAddress;
7360};
7361
7362static inline __attribute__((always_inline)) void
7363GFX11_3DSTATE_URB_DS_pack(__attribute__((unused)) __gen_user_data *data,
7364                          __attribute__((unused)) void * restrict dst,
7365                          __attribute__((unused)) const struct GFX11_3DSTATE_URB_DS * restrict values)
7366{
7367   uint32_t * restrict dw = (uint32_t * restrict) dst;
7368
7369   dw[0] =
7370      __gen_uint(values->DWordLength, 0, 7) |
7371      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7372      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7373      __gen_uint(values->CommandSubType, 27, 28) |
7374      __gen_uint(values->CommandType, 29, 31);
7375
7376   dw[1] =
7377      __gen_uint(values->DSNumberofURBEntries, 0, 15) |
7378      __gen_uint(values->DSURBEntryAllocationSize, 16, 24) |
7379      __gen_uint(values->DSURBStartingAddress, 25, 31);
7380}
7381
7382#define GFX11_3DSTATE_URB_GS_length            2
7383#define GFX11_3DSTATE_URB_GS_length_bias       2
7384#define GFX11_3DSTATE_URB_GS_header             \
7385   .DWordLength                         =      0,  \
7386   ._3DCommandSubOpcode                 =     51,  \
7387   ._3DCommandOpcode                    =      0,  \
7388   .CommandSubType                      =      3,  \
7389   .CommandType                         =      3
7390
7391struct GFX11_3DSTATE_URB_GS {
7392   uint32_t                             DWordLength;
7393   uint32_t                             _3DCommandSubOpcode;
7394   uint32_t                             _3DCommandOpcode;
7395   uint32_t                             CommandSubType;
7396   uint32_t                             CommandType;
7397   uint32_t                             GSNumberofURBEntries;
7398   uint32_t                             GSURBEntryAllocationSize;
7399   uint32_t                             GSURBStartingAddress;
7400};
7401
7402static inline __attribute__((always_inline)) void
7403GFX11_3DSTATE_URB_GS_pack(__attribute__((unused)) __gen_user_data *data,
7404                          __attribute__((unused)) void * restrict dst,
7405                          __attribute__((unused)) const struct GFX11_3DSTATE_URB_GS * restrict values)
7406{
7407   uint32_t * restrict dw = (uint32_t * restrict) dst;
7408
7409   dw[0] =
7410      __gen_uint(values->DWordLength, 0, 7) |
7411      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7412      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7413      __gen_uint(values->CommandSubType, 27, 28) |
7414      __gen_uint(values->CommandType, 29, 31);
7415
7416   dw[1] =
7417      __gen_uint(values->GSNumberofURBEntries, 0, 15) |
7418      __gen_uint(values->GSURBEntryAllocationSize, 16, 24) |
7419      __gen_uint(values->GSURBStartingAddress, 25, 31);
7420}
7421
7422#define GFX11_3DSTATE_URB_HS_length            2
7423#define GFX11_3DSTATE_URB_HS_length_bias       2
7424#define GFX11_3DSTATE_URB_HS_header             \
7425   .DWordLength                         =      0,  \
7426   ._3DCommandSubOpcode                 =     49,  \
7427   ._3DCommandOpcode                    =      0,  \
7428   .CommandSubType                      =      3,  \
7429   .CommandType                         =      3
7430
7431struct GFX11_3DSTATE_URB_HS {
7432   uint32_t                             DWordLength;
7433   uint32_t                             _3DCommandSubOpcode;
7434   uint32_t                             _3DCommandOpcode;
7435   uint32_t                             CommandSubType;
7436   uint32_t                             CommandType;
7437   uint32_t                             HSNumberofURBEntries;
7438   uint32_t                             HSURBEntryAllocationSize;
7439   uint32_t                             HSURBStartingAddress;
7440};
7441
7442static inline __attribute__((always_inline)) void
7443GFX11_3DSTATE_URB_HS_pack(__attribute__((unused)) __gen_user_data *data,
7444                          __attribute__((unused)) void * restrict dst,
7445                          __attribute__((unused)) const struct GFX11_3DSTATE_URB_HS * restrict values)
7446{
7447   uint32_t * restrict dw = (uint32_t * restrict) dst;
7448
7449   dw[0] =
7450      __gen_uint(values->DWordLength, 0, 7) |
7451      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7452      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7453      __gen_uint(values->CommandSubType, 27, 28) |
7454      __gen_uint(values->CommandType, 29, 31);
7455
7456   dw[1] =
7457      __gen_uint(values->HSNumberofURBEntries, 0, 15) |
7458      __gen_uint(values->HSURBEntryAllocationSize, 16, 24) |
7459      __gen_uint(values->HSURBStartingAddress, 25, 31);
7460}
7461
7462#define GFX11_3DSTATE_URB_VS_length            2
7463#define GFX11_3DSTATE_URB_VS_length_bias       2
7464#define GFX11_3DSTATE_URB_VS_header             \
7465   .DWordLength                         =      0,  \
7466   ._3DCommandSubOpcode                 =     48,  \
7467   ._3DCommandOpcode                    =      0,  \
7468   .CommandSubType                      =      3,  \
7469   .CommandType                         =      3
7470
7471struct GFX11_3DSTATE_URB_VS {
7472   uint32_t                             DWordLength;
7473   uint32_t                             _3DCommandSubOpcode;
7474   uint32_t                             _3DCommandOpcode;
7475   uint32_t                             CommandSubType;
7476   uint32_t                             CommandType;
7477   uint32_t                             VSNumberofURBEntries;
7478   uint32_t                             VSURBEntryAllocationSize;
7479   uint32_t                             VSURBStartingAddress;
7480};
7481
7482static inline __attribute__((always_inline)) void
7483GFX11_3DSTATE_URB_VS_pack(__attribute__((unused)) __gen_user_data *data,
7484                          __attribute__((unused)) void * restrict dst,
7485                          __attribute__((unused)) const struct GFX11_3DSTATE_URB_VS * restrict values)
7486{
7487   uint32_t * restrict dw = (uint32_t * restrict) dst;
7488
7489   dw[0] =
7490      __gen_uint(values->DWordLength, 0, 7) |
7491      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7492      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7493      __gen_uint(values->CommandSubType, 27, 28) |
7494      __gen_uint(values->CommandType, 29, 31);
7495
7496   dw[1] =
7497      __gen_uint(values->VSNumberofURBEntries, 0, 15) |
7498      __gen_uint(values->VSURBEntryAllocationSize, 16, 24) |
7499      __gen_uint(values->VSURBStartingAddress, 25, 31);
7500}
7501
7502#define GFX11_3DSTATE_VERTEX_BUFFERS_length_bias      2
7503#define GFX11_3DSTATE_VERTEX_BUFFERS_header     \
7504   .DWordLength                         =      3,  \
7505   ._3DCommandSubOpcode                 =      8,  \
7506   ._3DCommandOpcode                    =      0,  \
7507   .CommandSubType                      =      3,  \
7508   .CommandType                         =      3
7509
7510struct GFX11_3DSTATE_VERTEX_BUFFERS {
7511   uint32_t                             DWordLength;
7512   uint32_t                             _3DCommandSubOpcode;
7513   uint32_t                             _3DCommandOpcode;
7514   uint32_t                             CommandSubType;
7515   uint32_t                             CommandType;
7516   /* variable length fields follow */
7517};
7518
7519static inline __attribute__((always_inline)) void
7520GFX11_3DSTATE_VERTEX_BUFFERS_pack(__attribute__((unused)) __gen_user_data *data,
7521                                  __attribute__((unused)) void * restrict dst,
7522                                  __attribute__((unused)) const struct GFX11_3DSTATE_VERTEX_BUFFERS * restrict values)
7523{
7524   uint32_t * restrict dw = (uint32_t * restrict) dst;
7525
7526   dw[0] =
7527      __gen_uint(values->DWordLength, 0, 7) |
7528      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7529      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7530      __gen_uint(values->CommandSubType, 27, 28) |
7531      __gen_uint(values->CommandType, 29, 31);
7532}
7533
7534#define GFX11_3DSTATE_VERTEX_ELEMENTS_length_bias      2
7535#define GFX11_3DSTATE_VERTEX_ELEMENTS_header    \
7536   .DWordLength                         =      1,  \
7537   ._3DCommandSubOpcode                 =      9,  \
7538   ._3DCommandOpcode                    =      0,  \
7539   .CommandSubType                      =      3,  \
7540   .CommandType                         =      3
7541
7542struct GFX11_3DSTATE_VERTEX_ELEMENTS {
7543   uint32_t                             DWordLength;
7544   uint32_t                             _3DCommandSubOpcode;
7545   uint32_t                             _3DCommandOpcode;
7546   uint32_t                             CommandSubType;
7547   uint32_t                             CommandType;
7548   /* variable length fields follow */
7549};
7550
7551static inline __attribute__((always_inline)) void
7552GFX11_3DSTATE_VERTEX_ELEMENTS_pack(__attribute__((unused)) __gen_user_data *data,
7553                                   __attribute__((unused)) void * restrict dst,
7554                                   __attribute__((unused)) const struct GFX11_3DSTATE_VERTEX_ELEMENTS * restrict values)
7555{
7556   uint32_t * restrict dw = (uint32_t * restrict) dst;
7557
7558   dw[0] =
7559      __gen_uint(values->DWordLength, 0, 7) |
7560      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7561      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7562      __gen_uint(values->CommandSubType, 27, 28) |
7563      __gen_uint(values->CommandType, 29, 31);
7564}
7565
7566#define GFX11_3DSTATE_VF_length                2
7567#define GFX11_3DSTATE_VF_length_bias           2
7568#define GFX11_3DSTATE_VF_header                 \
7569   .DWordLength                         =      0,  \
7570   ._3DCommandSubOpcode                 =     12,  \
7571   ._3DCommandOpcode                    =      0,  \
7572   .CommandSubType                      =      3,  \
7573   .CommandType                         =      3
7574
7575struct GFX11_3DSTATE_VF {
7576   uint32_t                             DWordLength;
7577   bool                                 IndexedDrawCutIndexEnable;
7578   bool                                 ComponentPackingEnable;
7579   bool                                 SequentialDrawCutIndexEnable;
7580   bool                                 VertexIDOffsetEnable;
7581   uint32_t                             _3DCommandSubOpcode;
7582   uint32_t                             _3DCommandOpcode;
7583   uint32_t                             CommandSubType;
7584   uint32_t                             CommandType;
7585   uint32_t                             CutIndex;
7586};
7587
7588static inline __attribute__((always_inline)) void
7589GFX11_3DSTATE_VF_pack(__attribute__((unused)) __gen_user_data *data,
7590                      __attribute__((unused)) void * restrict dst,
7591                      __attribute__((unused)) const struct GFX11_3DSTATE_VF * restrict values)
7592{
7593   uint32_t * restrict dw = (uint32_t * restrict) dst;
7594
7595   dw[0] =
7596      __gen_uint(values->DWordLength, 0, 7) |
7597      __gen_uint(values->IndexedDrawCutIndexEnable, 8, 8) |
7598      __gen_uint(values->ComponentPackingEnable, 9, 9) |
7599      __gen_uint(values->SequentialDrawCutIndexEnable, 10, 10) |
7600      __gen_uint(values->VertexIDOffsetEnable, 11, 11) |
7601      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7602      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7603      __gen_uint(values->CommandSubType, 27, 28) |
7604      __gen_uint(values->CommandType, 29, 31);
7605
7606   dw[1] =
7607      __gen_uint(values->CutIndex, 0, 31);
7608}
7609
7610#define GFX11_3DSTATE_VF_COMPONENT_PACKING_length      5
7611#define GFX11_3DSTATE_VF_COMPONENT_PACKING_length_bias      2
7612#define GFX11_3DSTATE_VF_COMPONENT_PACKING_header\
7613   .DWordLength                         =      3,  \
7614   ._3DCommandSubOpcode                 =     85,  \
7615   ._3DCommandOpcode                    =      0,  \
7616   .CommandSubType                      =      3,  \
7617   .CommandType                         =      3
7618
7619struct GFX11_3DSTATE_VF_COMPONENT_PACKING {
7620   uint32_t                             DWordLength;
7621   uint32_t                             _3DCommandSubOpcode;
7622   uint32_t                             _3DCommandOpcode;
7623   uint32_t                             CommandSubType;
7624   uint32_t                             CommandType;
7625   uint32_t                             VertexElement00Enables;
7626   uint32_t                             VertexElement01Enables;
7627   uint32_t                             VertexElement02Enables;
7628   uint32_t                             VertexElement03Enables;
7629   uint32_t                             VertexElement04Enables;
7630   uint32_t                             VertexElement05Enables;
7631   uint32_t                             VertexElement06Enables;
7632   uint32_t                             VertexElement07Enables;
7633   uint32_t                             VertexElement08Enables;
7634   uint32_t                             VertexElement09Enables;
7635   uint32_t                             VertexElement10Enables;
7636   uint32_t                             VertexElement11Enables;
7637   uint32_t                             VertexElement12Enables;
7638   uint32_t                             VertexElement13Enables;
7639   uint32_t                             VertexElement14Enables;
7640   uint32_t                             VertexElement15Enables;
7641   uint32_t                             VertexElement16Enables;
7642   uint32_t                             VertexElement17Enables;
7643   uint32_t                             VertexElement18Enables;
7644   uint32_t                             VertexElement19Enables;
7645   uint32_t                             VertexElement20Enables;
7646   uint32_t                             VertexElement21Enables;
7647   uint32_t                             VertexElement22Enables;
7648   uint32_t                             VertexElement23Enables;
7649   uint32_t                             VertexElement24Enables;
7650   uint32_t                             VertexElement25Enables;
7651   uint32_t                             VertexElement26Enables;
7652   uint32_t                             VertexElement27Enables;
7653   uint32_t                             VertexElement28Enables;
7654   uint32_t                             VertexElement29Enables;
7655   uint32_t                             VertexElement30Enables;
7656   uint32_t                             VertexElement31Enables;
7657};
7658
7659static inline __attribute__((always_inline)) void
7660GFX11_3DSTATE_VF_COMPONENT_PACKING_pack(__attribute__((unused)) __gen_user_data *data,
7661                                        __attribute__((unused)) void * restrict dst,
7662                                        __attribute__((unused)) const struct GFX11_3DSTATE_VF_COMPONENT_PACKING * restrict values)
7663{
7664   uint32_t * restrict dw = (uint32_t * restrict) dst;
7665
7666   dw[0] =
7667      __gen_uint(values->DWordLength, 0, 7) |
7668      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7669      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7670      __gen_uint(values->CommandSubType, 27, 28) |
7671      __gen_uint(values->CommandType, 29, 31);
7672
7673   dw[1] =
7674      __gen_uint(values->VertexElement00Enables, 0, 3) |
7675      __gen_uint(values->VertexElement01Enables, 4, 7) |
7676      __gen_uint(values->VertexElement02Enables, 8, 11) |
7677      __gen_uint(values->VertexElement03Enables, 12, 15) |
7678      __gen_uint(values->VertexElement04Enables, 16, 19) |
7679      __gen_uint(values->VertexElement05Enables, 20, 23) |
7680      __gen_uint(values->VertexElement06Enables, 24, 27) |
7681      __gen_uint(values->VertexElement07Enables, 28, 31);
7682
7683   dw[2] =
7684      __gen_uint(values->VertexElement08Enables, 0, 3) |
7685      __gen_uint(values->VertexElement09Enables, 4, 7) |
7686      __gen_uint(values->VertexElement10Enables, 8, 11) |
7687      __gen_uint(values->VertexElement11Enables, 12, 15) |
7688      __gen_uint(values->VertexElement12Enables, 16, 19) |
7689      __gen_uint(values->VertexElement13Enables, 20, 23) |
7690      __gen_uint(values->VertexElement14Enables, 24, 27) |
7691      __gen_uint(values->VertexElement15Enables, 28, 31);
7692
7693   dw[3] =
7694      __gen_uint(values->VertexElement16Enables, 0, 3) |
7695      __gen_uint(values->VertexElement17Enables, 4, 7) |
7696      __gen_uint(values->VertexElement18Enables, 8, 11) |
7697      __gen_uint(values->VertexElement19Enables, 12, 15) |
7698      __gen_uint(values->VertexElement20Enables, 16, 19) |
7699      __gen_uint(values->VertexElement21Enables, 20, 23) |
7700      __gen_uint(values->VertexElement22Enables, 24, 27) |
7701      __gen_uint(values->VertexElement23Enables, 28, 31);
7702
7703   dw[4] =
7704      __gen_uint(values->VertexElement24Enables, 0, 3) |
7705      __gen_uint(values->VertexElement25Enables, 4, 7) |
7706      __gen_uint(values->VertexElement26Enables, 8, 11) |
7707      __gen_uint(values->VertexElement27Enables, 12, 15) |
7708      __gen_uint(values->VertexElement28Enables, 16, 19) |
7709      __gen_uint(values->VertexElement29Enables, 20, 23) |
7710      __gen_uint(values->VertexElement30Enables, 24, 27) |
7711      __gen_uint(values->VertexElement31Enables, 28, 31);
7712}
7713
7714#define GFX11_3DSTATE_VF_INSTANCING_length      3
7715#define GFX11_3DSTATE_VF_INSTANCING_length_bias      2
7716#define GFX11_3DSTATE_VF_INSTANCING_header      \
7717   .DWordLength                         =      1,  \
7718   ._3DCommandSubOpcode                 =     73,  \
7719   ._3DCommandOpcode                    =      0,  \
7720   .CommandSubType                      =      3,  \
7721   .CommandType                         =      3
7722
7723struct GFX11_3DSTATE_VF_INSTANCING {
7724   uint32_t                             DWordLength;
7725   uint32_t                             _3DCommandSubOpcode;
7726   uint32_t                             _3DCommandOpcode;
7727   uint32_t                             CommandSubType;
7728   uint32_t                             CommandType;
7729   uint32_t                             VertexElementIndex;
7730   bool                                 InstancingEnable;
7731   uint32_t                             InstanceDataStepRate;
7732};
7733
7734static inline __attribute__((always_inline)) void
7735GFX11_3DSTATE_VF_INSTANCING_pack(__attribute__((unused)) __gen_user_data *data,
7736                                 __attribute__((unused)) void * restrict dst,
7737                                 __attribute__((unused)) const struct GFX11_3DSTATE_VF_INSTANCING * restrict values)
7738{
7739   uint32_t * restrict dw = (uint32_t * restrict) dst;
7740
7741   dw[0] =
7742      __gen_uint(values->DWordLength, 0, 7) |
7743      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7744      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7745      __gen_uint(values->CommandSubType, 27, 28) |
7746      __gen_uint(values->CommandType, 29, 31);
7747
7748   dw[1] =
7749      __gen_uint(values->VertexElementIndex, 0, 5) |
7750      __gen_uint(values->InstancingEnable, 8, 8);
7751
7752   dw[2] =
7753      __gen_uint(values->InstanceDataStepRate, 0, 31);
7754}
7755
7756#define GFX11_3DSTATE_VF_SGVS_length           2
7757#define GFX11_3DSTATE_VF_SGVS_length_bias      2
7758#define GFX11_3DSTATE_VF_SGVS_header            \
7759   .DWordLength                         =      0,  \
7760   ._3DCommandSubOpcode                 =     74,  \
7761   ._3DCommandOpcode                    =      0,  \
7762   .CommandSubType                      =      3,  \
7763   .CommandType                         =      3
7764
7765struct GFX11_3DSTATE_VF_SGVS {
7766   uint32_t                             DWordLength;
7767   uint32_t                             _3DCommandSubOpcode;
7768   uint32_t                             _3DCommandOpcode;
7769   uint32_t                             CommandSubType;
7770   uint32_t                             CommandType;
7771   uint32_t                             VertexIDElementOffset;
7772   uint32_t                             VertexIDComponentNumber;
7773#define COMP_0                                   0
7774#define COMP_1                                   1
7775#define COMP_2                                   2
7776#define COMP_3                                   3
7777   bool                                 VertexIDEnable;
7778   uint32_t                             InstanceIDElementOffset;
7779   uint32_t                             InstanceIDComponentNumber;
7780#define COMP_0                                   0
7781#define COMP_1                                   1
7782#define COMP_2                                   2
7783#define COMP_3                                   3
7784   bool                                 InstanceIDEnable;
7785};
7786
7787static inline __attribute__((always_inline)) void
7788GFX11_3DSTATE_VF_SGVS_pack(__attribute__((unused)) __gen_user_data *data,
7789                           __attribute__((unused)) void * restrict dst,
7790                           __attribute__((unused)) const struct GFX11_3DSTATE_VF_SGVS * restrict values)
7791{
7792   uint32_t * restrict dw = (uint32_t * restrict) dst;
7793
7794   dw[0] =
7795      __gen_uint(values->DWordLength, 0, 7) |
7796      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7797      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7798      __gen_uint(values->CommandSubType, 27, 28) |
7799      __gen_uint(values->CommandType, 29, 31);
7800
7801   dw[1] =
7802      __gen_uint(values->VertexIDElementOffset, 0, 5) |
7803      __gen_uint(values->VertexIDComponentNumber, 13, 14) |
7804      __gen_uint(values->VertexIDEnable, 15, 15) |
7805      __gen_uint(values->InstanceIDElementOffset, 16, 21) |
7806      __gen_uint(values->InstanceIDComponentNumber, 29, 30) |
7807      __gen_uint(values->InstanceIDEnable, 31, 31);
7808}
7809
7810#define GFX11_3DSTATE_VF_SGVS_2_length         3
7811#define GFX11_3DSTATE_VF_SGVS_2_length_bias      2
7812#define GFX11_3DSTATE_VF_SGVS_2_header          \
7813   .DWordLength                         =      1,  \
7814   ._3DCommandSubOpcode                 =     86,  \
7815   ._3DCommandOpcode                    =      0,  \
7816   .CommandSubType                      =      3,  \
7817   .CommandType                         =      3
7818
7819struct GFX11_3DSTATE_VF_SGVS_2 {
7820   uint32_t                             DWordLength;
7821   uint32_t                             _3DCommandSubOpcode;
7822   uint32_t                             _3DCommandOpcode;
7823   uint32_t                             CommandSubType;
7824   uint32_t                             CommandType;
7825   uint32_t                             XP0ElementOffset;
7826   uint32_t                             XP0SourceSelect;
7827#define VERTEX_LOCATION                          1
7828#define XP0_PARAMETER                            0
7829   uint32_t                             XP0ComponentNumber;
7830#define COMP_0                                   0
7831#define COMP_1                                   1
7832#define COMP_2                                   2
7833#define COMP_3                                   3
7834   uint32_t                             XP0Enable;
7835   uint32_t                             XP1ElementOffset;
7836   uint32_t                             XP1SourceSelect;
7837#define StartingInstanceLocation                 1
7838#define XP1_PARAMETER                            0
7839   uint32_t                             XP1ComponentNumber;
7840#define COMP_0                                   0
7841#define COMP_1                                   1
7842#define COMP_2                                   2
7843#define COMP_3                                   3
7844   uint32_t                             XP1Enable;
7845   uint32_t                             XP2ElementOffset;
7846   uint32_t                             XP2ComponentNumber;
7847#define COMP_0                                   0
7848#define COMP_1                                   1
7849#define COMP_2                                   2
7850#define COMP_3                                   3
7851   uint32_t                             XP2Enable;
7852};
7853
7854static inline __attribute__((always_inline)) void
7855GFX11_3DSTATE_VF_SGVS_2_pack(__attribute__((unused)) __gen_user_data *data,
7856                             __attribute__((unused)) void * restrict dst,
7857                             __attribute__((unused)) const struct GFX11_3DSTATE_VF_SGVS_2 * restrict values)
7858{
7859   uint32_t * restrict dw = (uint32_t * restrict) dst;
7860
7861   dw[0] =
7862      __gen_uint(values->DWordLength, 0, 7) |
7863      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7864      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7865      __gen_uint(values->CommandSubType, 27, 28) |
7866      __gen_uint(values->CommandType, 29, 31);
7867
7868   dw[1] =
7869      __gen_uint(values->XP0ElementOffset, 0, 5) |
7870      __gen_uint(values->XP0SourceSelect, 12, 12) |
7871      __gen_uint(values->XP0ComponentNumber, 13, 14) |
7872      __gen_uint(values->XP0Enable, 15, 15) |
7873      __gen_uint(values->XP1ElementOffset, 16, 21) |
7874      __gen_uint(values->XP1SourceSelect, 28, 28) |
7875      __gen_uint(values->XP1ComponentNumber, 29, 30) |
7876      __gen_uint(values->XP1Enable, 31, 31);
7877
7878   dw[2] =
7879      __gen_uint(values->XP2ElementOffset, 0, 5) |
7880      __gen_uint(values->XP2ComponentNumber, 13, 14) |
7881      __gen_uint(values->XP2Enable, 15, 15);
7882}
7883
7884#define GFX11_3DSTATE_VF_STATISTICS_length      1
7885#define GFX11_3DSTATE_VF_STATISTICS_length_bias      1
7886#define GFX11_3DSTATE_VF_STATISTICS_header      \
7887   ._3DCommandSubOpcode                 =     11,  \
7888   ._3DCommandOpcode                    =      0,  \
7889   .CommandSubType                      =      1,  \
7890   .CommandType                         =      3
7891
7892struct GFX11_3DSTATE_VF_STATISTICS {
7893   bool                                 StatisticsEnable;
7894   uint32_t                             _3DCommandSubOpcode;
7895   uint32_t                             _3DCommandOpcode;
7896   uint32_t                             CommandSubType;
7897   uint32_t                             CommandType;
7898};
7899
7900static inline __attribute__((always_inline)) void
7901GFX11_3DSTATE_VF_STATISTICS_pack(__attribute__((unused)) __gen_user_data *data,
7902                                 __attribute__((unused)) void * restrict dst,
7903                                 __attribute__((unused)) const struct GFX11_3DSTATE_VF_STATISTICS * restrict values)
7904{
7905   uint32_t * restrict dw = (uint32_t * restrict) dst;
7906
7907   dw[0] =
7908      __gen_uint(values->StatisticsEnable, 0, 0) |
7909      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7910      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7911      __gen_uint(values->CommandSubType, 27, 28) |
7912      __gen_uint(values->CommandType, 29, 31);
7913}
7914
7915#define GFX11_3DSTATE_VF_TOPOLOGY_length       2
7916#define GFX11_3DSTATE_VF_TOPOLOGY_length_bias      2
7917#define GFX11_3DSTATE_VF_TOPOLOGY_header        \
7918   .DWordLength                         =      0,  \
7919   ._3DCommandSubOpcode                 =     75,  \
7920   ._3DCommandOpcode                    =      0,  \
7921   .CommandSubType                      =      3,  \
7922   .CommandType                         =      3
7923
7924struct GFX11_3DSTATE_VF_TOPOLOGY {
7925   uint32_t                             DWordLength;
7926   uint32_t                             _3DCommandSubOpcode;
7927   uint32_t                             _3DCommandOpcode;
7928   uint32_t                             CommandSubType;
7929   uint32_t                             CommandType;
7930   enum GFX11_3D_Prim_Topo_Type         PrimitiveTopologyType;
7931};
7932
7933static inline __attribute__((always_inline)) void
7934GFX11_3DSTATE_VF_TOPOLOGY_pack(__attribute__((unused)) __gen_user_data *data,
7935                               __attribute__((unused)) void * restrict dst,
7936                               __attribute__((unused)) const struct GFX11_3DSTATE_VF_TOPOLOGY * restrict values)
7937{
7938   uint32_t * restrict dw = (uint32_t * restrict) dst;
7939
7940   dw[0] =
7941      __gen_uint(values->DWordLength, 0, 7) |
7942      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7943      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7944      __gen_uint(values->CommandSubType, 27, 28) |
7945      __gen_uint(values->CommandType, 29, 31);
7946
7947   dw[1] =
7948      __gen_uint(values->PrimitiveTopologyType, 0, 5);
7949}
7950
7951#define GFX11_3DSTATE_VIEWPORT_STATE_POINTERS_CC_length      2
7952#define GFX11_3DSTATE_VIEWPORT_STATE_POINTERS_CC_length_bias      2
7953#define GFX11_3DSTATE_VIEWPORT_STATE_POINTERS_CC_header\
7954   .DWordLength                         =      0,  \
7955   ._3DCommandSubOpcode                 =     35,  \
7956   ._3DCommandOpcode                    =      0,  \
7957   .CommandSubType                      =      3,  \
7958   .CommandType                         =      3
7959
7960struct GFX11_3DSTATE_VIEWPORT_STATE_POINTERS_CC {
7961   uint32_t                             DWordLength;
7962   uint32_t                             _3DCommandSubOpcode;
7963   uint32_t                             _3DCommandOpcode;
7964   uint32_t                             CommandSubType;
7965   uint32_t                             CommandType;
7966   uint64_t                             CCViewportPointer;
7967};
7968
7969static inline __attribute__((always_inline)) void
7970GFX11_3DSTATE_VIEWPORT_STATE_POINTERS_CC_pack(__attribute__((unused)) __gen_user_data *data,
7971                                              __attribute__((unused)) void * restrict dst,
7972                                              __attribute__((unused)) const struct GFX11_3DSTATE_VIEWPORT_STATE_POINTERS_CC * restrict values)
7973{
7974   uint32_t * restrict dw = (uint32_t * restrict) dst;
7975
7976   dw[0] =
7977      __gen_uint(values->DWordLength, 0, 7) |
7978      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
7979      __gen_uint(values->_3DCommandOpcode, 24, 26) |
7980      __gen_uint(values->CommandSubType, 27, 28) |
7981      __gen_uint(values->CommandType, 29, 31);
7982
7983   dw[1] =
7984      __gen_offset(values->CCViewportPointer, 5, 31);
7985}
7986
7987#define GFX11_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_length      2
7988#define GFX11_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_length_bias      2
7989#define GFX11_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_header\
7990   .DWordLength                         =      0,  \
7991   ._3DCommandSubOpcode                 =     33,  \
7992   ._3DCommandOpcode                    =      0,  \
7993   .CommandSubType                      =      3,  \
7994   .CommandType                         =      3
7995
7996struct GFX11_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP {
7997   uint32_t                             DWordLength;
7998   uint32_t                             _3DCommandSubOpcode;
7999   uint32_t                             _3DCommandOpcode;
8000   uint32_t                             CommandSubType;
8001   uint32_t                             CommandType;
8002   uint64_t                             SFClipViewportPointer;
8003};
8004
8005static inline __attribute__((always_inline)) void
8006GFX11_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
8007                                                   __attribute__((unused)) void * restrict dst,
8008                                                   __attribute__((unused)) const struct GFX11_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP * restrict values)
8009{
8010   uint32_t * restrict dw = (uint32_t * restrict) dst;
8011
8012   dw[0] =
8013      __gen_uint(values->DWordLength, 0, 7) |
8014      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
8015      __gen_uint(values->_3DCommandOpcode, 24, 26) |
8016      __gen_uint(values->CommandSubType, 27, 28) |
8017      __gen_uint(values->CommandType, 29, 31);
8018
8019   dw[1] =
8020      __gen_offset(values->SFClipViewportPointer, 6, 31);
8021}
8022
8023#define GFX11_3DSTATE_VS_length                9
8024#define GFX11_3DSTATE_VS_length_bias           2
8025#define GFX11_3DSTATE_VS_header                 \
8026   .DWordLength                         =      7,  \
8027   ._3DCommandSubOpcode                 =     16,  \
8028   ._3DCommandOpcode                    =      0,  \
8029   .CommandSubType                      =      3,  \
8030   .CommandType                         =      3
8031
8032struct GFX11_3DSTATE_VS {
8033   uint32_t                             DWordLength;
8034   uint32_t                             _3DCommandSubOpcode;
8035   uint32_t                             _3DCommandOpcode;
8036   uint32_t                             CommandSubType;
8037   uint32_t                             CommandType;
8038   uint64_t                             KernelStartPointer;
8039   bool                                 SoftwareExceptionEnable;
8040   bool                                 AccessesUAV;
8041   bool                                 IllegalOpcodeExceptionEnable;
8042   uint32_t                             FloatingPointMode;
8043#define IEEE754                                  0
8044#define Alternate                                1
8045   uint32_t                             ThreadDispatchPriority;
8046#define High                                     1
8047   uint32_t                             BindingTableEntryCount;
8048   uint32_t                             SamplerCount;
8049#define NoSamplers                               0
8050#define _14Samplers                              1
8051#define _58Samplers                              2
8052#define _912Samplers                             3
8053#define _1316Samplers                            4
8054   bool                                 VectorMaskEnable;
8055   uint32_t                             PerThreadScratchSpace;
8056   __gen_address_type                   ScratchSpaceBasePointer;
8057   uint32_t                             VertexURBEntryReadOffset;
8058   uint32_t                             VertexURBEntryReadLength;
8059   uint32_t                             DispatchGRFStartRegisterForURBData;
8060   bool                                 Enable;
8061   bool                                 VertexCacheDisable;
8062   bool                                 SIMD8DispatchEnable;
8063   bool                                 SIMD8SingleInstanceDispatchEnable;
8064   bool                                 StatisticsEnable;
8065   uint32_t                             MaximumNumberofThreads;
8066   uint32_t                             UserClipDistanceCullTestEnableBitmask;
8067   uint32_t                             UserClipDistanceClipTestEnableBitmask;
8068   uint32_t                             VertexURBEntryOutputLength;
8069   uint32_t                             VertexURBEntryOutputReadOffset;
8070};
8071
8072static inline __attribute__((always_inline)) void
8073GFX11_3DSTATE_VS_pack(__attribute__((unused)) __gen_user_data *data,
8074                      __attribute__((unused)) void * restrict dst,
8075                      __attribute__((unused)) const struct GFX11_3DSTATE_VS * restrict values)
8076{
8077   uint32_t * restrict dw = (uint32_t * restrict) dst;
8078
8079   dw[0] =
8080      __gen_uint(values->DWordLength, 0, 7) |
8081      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
8082      __gen_uint(values->_3DCommandOpcode, 24, 26) |
8083      __gen_uint(values->CommandSubType, 27, 28) |
8084      __gen_uint(values->CommandType, 29, 31);
8085
8086   const uint64_t v1 =
8087      __gen_offset(values->KernelStartPointer, 6, 63);
8088   dw[1] = v1;
8089   dw[2] = v1 >> 32;
8090
8091   dw[3] =
8092      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
8093      __gen_uint(values->AccessesUAV, 12, 12) |
8094      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
8095      __gen_uint(values->FloatingPointMode, 16, 16) |
8096      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
8097      __gen_uint(values->BindingTableEntryCount, 18, 25) |
8098      __gen_uint(values->SamplerCount, 27, 29) |
8099      __gen_uint(values->VectorMaskEnable, 30, 30);
8100
8101   const uint64_t v4 =
8102      __gen_uint(values->PerThreadScratchSpace, 0, 3);
8103   const uint64_t v4_address =
8104      __gen_address(data, &dw[4], values->ScratchSpaceBasePointer, v4, 10, 63);
8105   dw[4] = v4_address;
8106   dw[5] = (v4_address >> 32) | (v4 >> 32);
8107
8108   dw[6] =
8109      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
8110      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
8111      __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
8112
8113   dw[7] =
8114      __gen_uint(values->Enable, 0, 0) |
8115      __gen_uint(values->VertexCacheDisable, 1, 1) |
8116      __gen_uint(values->SIMD8DispatchEnable, 2, 2) |
8117      __gen_uint(values->SIMD8SingleInstanceDispatchEnable, 9, 9) |
8118      __gen_uint(values->StatisticsEnable, 10, 10) |
8119      __gen_uint(values->MaximumNumberofThreads, 22, 31);
8120
8121   dw[8] =
8122      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
8123      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 8, 15) |
8124      __gen_uint(values->VertexURBEntryOutputLength, 16, 20) |
8125      __gen_uint(values->VertexURBEntryOutputReadOffset, 21, 26);
8126}
8127
8128#define GFX11_3DSTATE_WM_length                2
8129#define GFX11_3DSTATE_WM_length_bias           2
8130#define GFX11_3DSTATE_WM_header                 \
8131   .DWordLength                         =      0,  \
8132   ._3DCommandSubOpcode                 =     20,  \
8133   ._3DCommandOpcode                    =      0,  \
8134   .CommandSubType                      =      3,  \
8135   .CommandType                         =      3
8136
8137struct GFX11_3DSTATE_WM {
8138   uint32_t                             DWordLength;
8139   uint32_t                             _3DCommandSubOpcode;
8140   uint32_t                             _3DCommandOpcode;
8141   uint32_t                             CommandSubType;
8142   uint32_t                             CommandType;
8143   uint32_t                             ForceKillPixelEnable;
8144#define ForceOff                                 1
8145#define ForceON                                  2
8146   uint32_t                             PointRasterizationRule;
8147#define RASTRULE_UPPER_LEFT                      0
8148#define RASTRULE_UPPER_RIGHT                     1
8149   bool                                 LineStippleEnable;
8150   bool                                 PolygonStippleEnable;
8151   uint32_t                             LineAntialiasingRegionWidth;
8152#define _05pixels                                0
8153#define _10pixels                                1
8154#define _20pixels                                2
8155#define _40pixels                                3
8156   uint32_t                             LineEndCapAntialiasingRegionWidth;
8157#define _05pixels                                0
8158#define _10pixels                                1
8159#define _20pixels                                2
8160#define _40pixels                                3
8161   uint32_t                             BarycentricInterpolationMode;
8162#define BIM_PERSPECTIVE_PIXEL                    1
8163#define BIM_PERSPECTIVE_CENTROID                 2
8164#define BIM_PERSPECTIVE_SAMPLE                   4
8165#define BIM_LINEAR_PIXEL                         8
8166#define BIM_LINEAR_CENTROID                      16
8167#define BIM_LINEAR_SAMPLE                        32
8168   uint32_t                             PositionZWInterpolationMode;
8169#define INTERP_PIXEL                             0
8170#define INTERP_CENTROID                          2
8171#define INTERP_SAMPLE                            3
8172   uint32_t                             ForceThreadDispatchEnable;
8173#define ForceOff                                 1
8174#define ForceON                                  2
8175   uint32_t                             EarlyDepthStencilControl;
8176#define EDSC_NORMAL                              0
8177#define EDSC_PSEXEC                              1
8178#define EDSC_PREPS                               2
8179   bool                                 LegacyDiamondLineRasterization;
8180   bool                                 LegacyHierarchicalDepthBufferResolveEnable;
8181   bool                                 LegacyDepthBufferResolveEnable;
8182   bool                                 LegacyDepthBufferClearEnable;
8183   bool                                 StatisticsEnable;
8184};
8185
8186static inline __attribute__((always_inline)) void
8187GFX11_3DSTATE_WM_pack(__attribute__((unused)) __gen_user_data *data,
8188                      __attribute__((unused)) void * restrict dst,
8189                      __attribute__((unused)) const struct GFX11_3DSTATE_WM * restrict values)
8190{
8191   uint32_t * restrict dw = (uint32_t * restrict) dst;
8192
8193   dw[0] =
8194      __gen_uint(values->DWordLength, 0, 7) |
8195      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
8196      __gen_uint(values->_3DCommandOpcode, 24, 26) |
8197      __gen_uint(values->CommandSubType, 27, 28) |
8198      __gen_uint(values->CommandType, 29, 31);
8199
8200   dw[1] =
8201      __gen_uint(values->ForceKillPixelEnable, 0, 1) |
8202      __gen_uint(values->PointRasterizationRule, 2, 2) |
8203      __gen_uint(values->LineStippleEnable, 3, 3) |
8204      __gen_uint(values->PolygonStippleEnable, 4, 4) |
8205      __gen_uint(values->LineAntialiasingRegionWidth, 6, 7) |
8206      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 8, 9) |
8207      __gen_uint(values->BarycentricInterpolationMode, 11, 16) |
8208      __gen_uint(values->PositionZWInterpolationMode, 17, 18) |
8209      __gen_uint(values->ForceThreadDispatchEnable, 19, 20) |
8210      __gen_uint(values->EarlyDepthStencilControl, 21, 22) |
8211      __gen_uint(values->LegacyDiamondLineRasterization, 26, 26) |
8212      __gen_uint(values->LegacyHierarchicalDepthBufferResolveEnable, 27, 27) |
8213      __gen_uint(values->LegacyDepthBufferResolveEnable, 28, 28) |
8214      __gen_uint(values->LegacyDepthBufferClearEnable, 30, 30) |
8215      __gen_uint(values->StatisticsEnable, 31, 31);
8216}
8217
8218#define GFX11_3DSTATE_WM_CHROMAKEY_length      2
8219#define GFX11_3DSTATE_WM_CHROMAKEY_length_bias      2
8220#define GFX11_3DSTATE_WM_CHROMAKEY_header       \
8221   .DWordLength                         =      0,  \
8222   ._3DCommandSubOpcode                 =     76,  \
8223   ._3DCommandOpcode                    =      0,  \
8224   .CommandSubType                      =      3,  \
8225   .CommandType                         =      3
8226
8227struct GFX11_3DSTATE_WM_CHROMAKEY {
8228   uint32_t                             DWordLength;
8229   uint32_t                             _3DCommandSubOpcode;
8230   uint32_t                             _3DCommandOpcode;
8231   uint32_t                             CommandSubType;
8232   uint32_t                             CommandType;
8233   bool                                 ChromaKeyKillEnable;
8234};
8235
8236static inline __attribute__((always_inline)) void
8237GFX11_3DSTATE_WM_CHROMAKEY_pack(__attribute__((unused)) __gen_user_data *data,
8238                                __attribute__((unused)) void * restrict dst,
8239                                __attribute__((unused)) const struct GFX11_3DSTATE_WM_CHROMAKEY * restrict values)
8240{
8241   uint32_t * restrict dw = (uint32_t * restrict) dst;
8242
8243   dw[0] =
8244      __gen_uint(values->DWordLength, 0, 7) |
8245      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
8246      __gen_uint(values->_3DCommandOpcode, 24, 26) |
8247      __gen_uint(values->CommandSubType, 27, 28) |
8248      __gen_uint(values->CommandType, 29, 31);
8249
8250   dw[1] =
8251      __gen_uint(values->ChromaKeyKillEnable, 31, 31);
8252}
8253
8254#define GFX11_3DSTATE_WM_DEPTH_STENCIL_length      4
8255#define GFX11_3DSTATE_WM_DEPTH_STENCIL_length_bias      2
8256#define GFX11_3DSTATE_WM_DEPTH_STENCIL_header   \
8257   .DWordLength                         =      2,  \
8258   ._3DCommandSubOpcode                 =     78,  \
8259   ._3DCommandOpcode                    =      0,  \
8260   .CommandSubType                      =      3,  \
8261   .CommandType                         =      3
8262
8263struct GFX11_3DSTATE_WM_DEPTH_STENCIL {
8264   uint32_t                             DWordLength;
8265   uint32_t                             _3DCommandSubOpcode;
8266   uint32_t                             _3DCommandOpcode;
8267   uint32_t                             CommandSubType;
8268   uint32_t                             CommandType;
8269   bool                                 DepthBufferWriteEnable;
8270   bool                                 DepthTestEnable;
8271   bool                                 StencilBufferWriteEnable;
8272   bool                                 StencilTestEnable;
8273   bool                                 DoubleSidedStencilEnable;
8274   enum GFX11_3D_Compare_Function       DepthTestFunction;
8275   enum GFX11_3D_Compare_Function       StencilTestFunction;
8276   enum GFX11_3D_Stencil_Operation      BackfaceStencilPassDepthPassOp;
8277   enum GFX11_3D_Stencil_Operation      BackfaceStencilPassDepthFailOp;
8278   enum GFX11_3D_Stencil_Operation      BackfaceStencilFailOp;
8279   enum GFX11_3D_Compare_Function       BackfaceStencilTestFunction;
8280   enum GFX11_3D_Stencil_Operation      StencilPassDepthPassOp;
8281   enum GFX11_3D_Stencil_Operation      StencilPassDepthFailOp;
8282   enum GFX11_3D_Stencil_Operation      StencilFailOp;
8283   uint32_t                             BackfaceStencilWriteMask;
8284   uint32_t                             BackfaceStencilTestMask;
8285   uint32_t                             StencilWriteMask;
8286   uint32_t                             StencilTestMask;
8287   uint32_t                             BackfaceStencilReferenceValue;
8288   uint32_t                             StencilReferenceValue;
8289};
8290
8291static inline __attribute__((always_inline)) void
8292GFX11_3DSTATE_WM_DEPTH_STENCIL_pack(__attribute__((unused)) __gen_user_data *data,
8293                                    __attribute__((unused)) void * restrict dst,
8294                                    __attribute__((unused)) const struct GFX11_3DSTATE_WM_DEPTH_STENCIL * restrict values)
8295{
8296   uint32_t * restrict dw = (uint32_t * restrict) dst;
8297
8298   dw[0] =
8299      __gen_uint(values->DWordLength, 0, 7) |
8300      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
8301      __gen_uint(values->_3DCommandOpcode, 24, 26) |
8302      __gen_uint(values->CommandSubType, 27, 28) |
8303      __gen_uint(values->CommandType, 29, 31);
8304
8305   dw[1] =
8306      __gen_uint(values->DepthBufferWriteEnable, 0, 0) |
8307      __gen_uint(values->DepthTestEnable, 1, 1) |
8308      __gen_uint(values->StencilBufferWriteEnable, 2, 2) |
8309      __gen_uint(values->StencilTestEnable, 3, 3) |
8310      __gen_uint(values->DoubleSidedStencilEnable, 4, 4) |
8311      __gen_uint(values->DepthTestFunction, 5, 7) |
8312      __gen_uint(values->StencilTestFunction, 8, 10) |
8313      __gen_uint(values->BackfaceStencilPassDepthPassOp, 11, 13) |
8314      __gen_uint(values->BackfaceStencilPassDepthFailOp, 14, 16) |
8315      __gen_uint(values->BackfaceStencilFailOp, 17, 19) |
8316      __gen_uint(values->BackfaceStencilTestFunction, 20, 22) |
8317      __gen_uint(values->StencilPassDepthPassOp, 23, 25) |
8318      __gen_uint(values->StencilPassDepthFailOp, 26, 28) |
8319      __gen_uint(values->StencilFailOp, 29, 31);
8320
8321   dw[2] =
8322      __gen_uint(values->BackfaceStencilWriteMask, 0, 7) |
8323      __gen_uint(values->BackfaceStencilTestMask, 8, 15) |
8324      __gen_uint(values->StencilWriteMask, 16, 23) |
8325      __gen_uint(values->StencilTestMask, 24, 31);
8326
8327   dw[3] =
8328      __gen_uint(values->BackfaceStencilReferenceValue, 0, 7) |
8329      __gen_uint(values->StencilReferenceValue, 8, 15);
8330}
8331
8332#define GFX11_3DSTATE_WM_HZ_OP_length          5
8333#define GFX11_3DSTATE_WM_HZ_OP_length_bias      2
8334#define GFX11_3DSTATE_WM_HZ_OP_header           \
8335   .DWordLength                         =      3,  \
8336   ._3DCommandSubOpcode                 =     82,  \
8337   ._3DCommandOpcode                    =      0,  \
8338   .CommandSubType                      =      3,  \
8339   .CommandType                         =      3
8340
8341struct GFX11_3DSTATE_WM_HZ_OP {
8342   uint32_t                             DWordLength;
8343   uint32_t                             _3DCommandSubOpcode;
8344   uint32_t                             _3DCommandOpcode;
8345   uint32_t                             CommandSubType;
8346   uint32_t                             CommandType;
8347   uint32_t                             NumberofMultisamples;
8348   uint32_t                             StencilClearValue;
8349   bool                                 FullSurfaceDepthandStencilClear;
8350   bool                                 PixelPositionOffsetEnable;
8351   bool                                 HierarchicalDepthBufferResolveEnable;
8352   bool                                 DepthBufferResolveEnable;
8353   bool                                 ScissorRectangleEnable;
8354   bool                                 DepthBufferClearEnable;
8355   bool                                 StencilBufferClearEnable;
8356   uint32_t                             ClearRectangleXMin;
8357   uint32_t                             ClearRectangleYMin;
8358   uint32_t                             ClearRectangleXMax;
8359   uint32_t                             ClearRectangleYMax;
8360   uint32_t                             SampleMask;
8361};
8362
8363static inline __attribute__((always_inline)) void
8364GFX11_3DSTATE_WM_HZ_OP_pack(__attribute__((unused)) __gen_user_data *data,
8365                            __attribute__((unused)) void * restrict dst,
8366                            __attribute__((unused)) const struct GFX11_3DSTATE_WM_HZ_OP * restrict values)
8367{
8368   uint32_t * restrict dw = (uint32_t * restrict) dst;
8369
8370   dw[0] =
8371      __gen_uint(values->DWordLength, 0, 7) |
8372      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
8373      __gen_uint(values->_3DCommandOpcode, 24, 26) |
8374      __gen_uint(values->CommandSubType, 27, 28) |
8375      __gen_uint(values->CommandType, 29, 31);
8376
8377   dw[1] =
8378      __gen_uint(values->NumberofMultisamples, 13, 15) |
8379      __gen_uint(values->StencilClearValue, 16, 23) |
8380      __gen_uint(values->FullSurfaceDepthandStencilClear, 25, 25) |
8381      __gen_uint(values->PixelPositionOffsetEnable, 26, 26) |
8382      __gen_uint(values->HierarchicalDepthBufferResolveEnable, 27, 27) |
8383      __gen_uint(values->DepthBufferResolveEnable, 28, 28) |
8384      __gen_uint(values->ScissorRectangleEnable, 29, 29) |
8385      __gen_uint(values->DepthBufferClearEnable, 30, 30) |
8386      __gen_uint(values->StencilBufferClearEnable, 31, 31);
8387
8388   dw[2] =
8389      __gen_uint(values->ClearRectangleXMin, 0, 15) |
8390      __gen_uint(values->ClearRectangleYMin, 16, 31);
8391
8392   dw[3] =
8393      __gen_uint(values->ClearRectangleXMax, 0, 15) |
8394      __gen_uint(values->ClearRectangleYMax, 16, 31);
8395
8396   dw[4] =
8397      __gen_uint(values->SampleMask, 0, 15);
8398}
8399
8400#define GFX11_GPGPU_WALKER_length             15
8401#define GFX11_GPGPU_WALKER_length_bias         2
8402#define GFX11_GPGPU_WALKER_header               \
8403   .DWordLength                         =     13,  \
8404   .SubOpcode                           =      5,  \
8405   .MediaCommandOpcode                  =      1,  \
8406   .Pipeline                            =      2,  \
8407   .CommandType                         =      3
8408
8409struct GFX11_GPGPU_WALKER {
8410   uint32_t                             DWordLength;
8411   bool                                 PredicateEnable;
8412   bool                                 IndirectParameterEnable;
8413   uint32_t                             SubOpcode;
8414   uint32_t                             MediaCommandOpcode;
8415   uint32_t                             Pipeline;
8416   uint32_t                             CommandType;
8417   uint32_t                             InterfaceDescriptorOffset;
8418   uint32_t                             IndirectDataLength;
8419   uint64_t                             IndirectDataStartAddress;
8420   uint32_t                             ThreadWidthCounterMaximum;
8421   uint32_t                             ThreadHeightCounterMaximum;
8422   uint32_t                             ThreadDepthCounterMaximum;
8423   uint32_t                             SIMDSize;
8424#define SIMD8                                    0
8425#define SIMD16                                   1
8426#define SIMD32                                   2
8427   uint32_t                             ThreadGroupIDStartingX;
8428   uint32_t                             ThreadGroupIDXDimension;
8429   uint32_t                             ThreadGroupIDStartingY;
8430   uint32_t                             ThreadGroupIDYDimension;
8431   uint32_t                             ThreadGroupIDStartingResumeZ;
8432   uint32_t                             ThreadGroupIDZDimension;
8433   uint32_t                             RightExecutionMask;
8434   uint32_t                             BottomExecutionMask;
8435};
8436
8437static inline __attribute__((always_inline)) void
8438GFX11_GPGPU_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
8439                        __attribute__((unused)) void * restrict dst,
8440                        __attribute__((unused)) const struct GFX11_GPGPU_WALKER * restrict values)
8441{
8442   uint32_t * restrict dw = (uint32_t * restrict) dst;
8443
8444   dw[0] =
8445      __gen_uint(values->DWordLength, 0, 7) |
8446      __gen_uint(values->PredicateEnable, 8, 8) |
8447      __gen_uint(values->IndirectParameterEnable, 10, 10) |
8448      __gen_uint(values->SubOpcode, 16, 23) |
8449      __gen_uint(values->MediaCommandOpcode, 24, 26) |
8450      __gen_uint(values->Pipeline, 27, 28) |
8451      __gen_uint(values->CommandType, 29, 31);
8452
8453   dw[1] =
8454      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
8455
8456   dw[2] =
8457      __gen_uint(values->IndirectDataLength, 0, 16);
8458
8459   dw[3] =
8460      __gen_offset(values->IndirectDataStartAddress, 6, 31);
8461
8462   dw[4] =
8463      __gen_uint(values->ThreadWidthCounterMaximum, 0, 5) |
8464      __gen_uint(values->ThreadHeightCounterMaximum, 8, 13) |
8465      __gen_uint(values->ThreadDepthCounterMaximum, 16, 21) |
8466      __gen_uint(values->SIMDSize, 30, 31);
8467
8468   dw[5] =
8469      __gen_uint(values->ThreadGroupIDStartingX, 0, 31);
8470
8471   dw[6] = 0;
8472
8473   dw[7] =
8474      __gen_uint(values->ThreadGroupIDXDimension, 0, 31);
8475
8476   dw[8] =
8477      __gen_uint(values->ThreadGroupIDStartingY, 0, 31);
8478
8479   dw[9] = 0;
8480
8481   dw[10] =
8482      __gen_uint(values->ThreadGroupIDYDimension, 0, 31);
8483
8484   dw[11] =
8485      __gen_uint(values->ThreadGroupIDStartingResumeZ, 0, 31);
8486
8487   dw[12] =
8488      __gen_uint(values->ThreadGroupIDZDimension, 0, 31);
8489
8490   dw[13] =
8491      __gen_uint(values->RightExecutionMask, 0, 31);
8492
8493   dw[14] =
8494      __gen_uint(values->BottomExecutionMask, 0, 31);
8495}
8496
8497#define GFX11_MEDIA_CURBE_LOAD_length          4
8498#define GFX11_MEDIA_CURBE_LOAD_length_bias      2
8499#define GFX11_MEDIA_CURBE_LOAD_header           \
8500   .DWordLength                         =      2,  \
8501   .SubOpcode                           =      1,  \
8502   .MediaCommandOpcode                  =      0,  \
8503   .Pipeline                            =      2,  \
8504   .CommandType                         =      3
8505
8506struct GFX11_MEDIA_CURBE_LOAD {
8507   uint32_t                             DWordLength;
8508   uint32_t                             SubOpcode;
8509   uint32_t                             MediaCommandOpcode;
8510   uint32_t                             Pipeline;
8511   uint32_t                             CommandType;
8512   uint32_t                             CURBETotalDataLength;
8513   uint32_t                             CURBEDataStartAddress;
8514};
8515
8516static inline __attribute__((always_inline)) void
8517GFX11_MEDIA_CURBE_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
8518                            __attribute__((unused)) void * restrict dst,
8519                            __attribute__((unused)) const struct GFX11_MEDIA_CURBE_LOAD * restrict values)
8520{
8521   uint32_t * restrict dw = (uint32_t * restrict) dst;
8522
8523   dw[0] =
8524      __gen_uint(values->DWordLength, 0, 15) |
8525      __gen_uint(values->SubOpcode, 16, 23) |
8526      __gen_uint(values->MediaCommandOpcode, 24, 26) |
8527      __gen_uint(values->Pipeline, 27, 28) |
8528      __gen_uint(values->CommandType, 29, 31);
8529
8530   dw[1] = 0;
8531
8532   dw[2] =
8533      __gen_uint(values->CURBETotalDataLength, 0, 16);
8534
8535   dw[3] =
8536      __gen_uint(values->CURBEDataStartAddress, 0, 31);
8537}
8538
8539#define GFX11_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length      4
8540#define GFX11_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length_bias      2
8541#define GFX11_MEDIA_INTERFACE_DESCRIPTOR_LOAD_header\
8542   .DWordLength                         =      2,  \
8543   .SubOpcode                           =      2,  \
8544   .MediaCommandOpcode                  =      0,  \
8545   .Pipeline                            =      2,  \
8546   .CommandType                         =      3
8547
8548struct GFX11_MEDIA_INTERFACE_DESCRIPTOR_LOAD {
8549   uint32_t                             DWordLength;
8550   uint32_t                             SubOpcode;
8551   uint32_t                             MediaCommandOpcode;
8552   uint32_t                             Pipeline;
8553   uint32_t                             CommandType;
8554   uint32_t                             InterfaceDescriptorTotalLength;
8555   uint64_t                             InterfaceDescriptorDataStartAddress;
8556};
8557
8558static inline __attribute__((always_inline)) void
8559GFX11_MEDIA_INTERFACE_DESCRIPTOR_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
8560                                           __attribute__((unused)) void * restrict dst,
8561                                           __attribute__((unused)) const struct GFX11_MEDIA_INTERFACE_DESCRIPTOR_LOAD * restrict values)
8562{
8563   uint32_t * restrict dw = (uint32_t * restrict) dst;
8564
8565   dw[0] =
8566      __gen_uint(values->DWordLength, 0, 15) |
8567      __gen_uint(values->SubOpcode, 16, 23) |
8568      __gen_uint(values->MediaCommandOpcode, 24, 26) |
8569      __gen_uint(values->Pipeline, 27, 28) |
8570      __gen_uint(values->CommandType, 29, 31);
8571
8572   dw[1] = 0;
8573
8574   dw[2] =
8575      __gen_uint(values->InterfaceDescriptorTotalLength, 0, 16);
8576
8577   dw[3] =
8578      __gen_offset(values->InterfaceDescriptorDataStartAddress, 0, 31);
8579}
8580
8581#define GFX11_MEDIA_OBJECT_length_bias         2
8582#define GFX11_MEDIA_OBJECT_header               \
8583   .DWordLength                         =      4,  \
8584   .MediaCommandSubOpcode               =      0,  \
8585   .MediaCommandOpcode                  =      1,  \
8586   .MediaCommandPipeline                =      2,  \
8587   .CommandType                         =      3
8588
8589struct GFX11_MEDIA_OBJECT {
8590   uint32_t                             DWordLength;
8591   uint32_t                             MediaCommandSubOpcode;
8592   uint32_t                             MediaCommandOpcode;
8593   uint32_t                             MediaCommandPipeline;
8594   uint32_t                             CommandType;
8595   uint32_t                             InterfaceDescriptorOffset;
8596   uint32_t                             IndirectDataLength;
8597   uint32_t                             SubSliceDestinationSelect;
8598#define Subslice3                                3
8599#define SubSlice2                                2
8600#define SubSlice1                                1
8601#define SubSlice0                                0
8602   uint32_t                             SliceDestinationSelect;
8603#define Slice0                                   0
8604#define Slice1                                   1
8605#define Slice2                                   2
8606   uint32_t                             ForceDestination;
8607   uint32_t                             ThreadSynchronization;
8608#define Nothreadsynchronization                  0
8609#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
8610   uint32_t                             SliceDestinationSelectMSBs;
8611   bool                                 ChildrenPresent;
8612   __gen_address_type                   IndirectDataStartAddress;
8613   uint32_t                             XPosition;
8614   uint32_t                             YPosition;
8615   uint32_t                             BlockColor;
8616   /* variable length fields follow */
8617};
8618
8619static inline __attribute__((always_inline)) void
8620GFX11_MEDIA_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
8621                        __attribute__((unused)) void * restrict dst,
8622                        __attribute__((unused)) const struct GFX11_MEDIA_OBJECT * restrict values)
8623{
8624   uint32_t * restrict dw = (uint32_t * restrict) dst;
8625
8626   dw[0] =
8627      __gen_uint(values->DWordLength, 0, 14) |
8628      __gen_uint(values->MediaCommandSubOpcode, 16, 23) |
8629      __gen_uint(values->MediaCommandOpcode, 24, 26) |
8630      __gen_uint(values->MediaCommandPipeline, 27, 28) |
8631      __gen_uint(values->CommandType, 29, 31);
8632
8633   dw[1] =
8634      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
8635
8636   dw[2] =
8637      __gen_uint(values->IndirectDataLength, 0, 16) |
8638      __gen_uint(values->SubSliceDestinationSelect, 17, 18) |
8639      __gen_uint(values->SliceDestinationSelect, 19, 20) |
8640      __gen_uint(values->ForceDestination, 22, 22) |
8641      __gen_uint(values->ThreadSynchronization, 24, 24) |
8642      __gen_uint(values->SliceDestinationSelectMSBs, 25, 26) |
8643      __gen_uint(values->ChildrenPresent, 31, 31);
8644
8645   dw[3] = __gen_address(data, &dw[3], values->IndirectDataStartAddress, 0, 0, 31);
8646
8647   dw[4] =
8648      __gen_uint(values->XPosition, 0, 8) |
8649      __gen_uint(values->YPosition, 16, 24);
8650
8651   dw[5] =
8652      __gen_uint(values->BlockColor, 16, 23);
8653}
8654
8655#define GFX11_MEDIA_OBJECT_GRPID_length_bias      2
8656#define GFX11_MEDIA_OBJECT_GRPID_header         \
8657   .DWordLength                         =      5,  \
8658   .MediaCommandSubOpcode               =      6,  \
8659   .MediaCommandOpcode                  =      1,  \
8660   .MediaCommandPipeline                =      2,  \
8661   .CommandType                         =      3
8662
8663struct GFX11_MEDIA_OBJECT_GRPID {
8664   uint32_t                             DWordLength;
8665   uint32_t                             MediaCommandSubOpcode;
8666   uint32_t                             MediaCommandOpcode;
8667   uint32_t                             MediaCommandPipeline;
8668   uint32_t                             CommandType;
8669   uint32_t                             InterfaceDescriptorOffset;
8670   uint32_t                             IndirectDataLength;
8671   uint32_t                             EndofThreadGroup;
8672   __gen_address_type                   IndirectDataStartAddress;
8673   uint32_t                             XPosition;
8674   uint32_t                             YPosition;
8675   uint32_t                             BlockColor;
8676   uint32_t                             GroupID;
8677   /* variable length fields follow */
8678};
8679
8680static inline __attribute__((always_inline)) void
8681GFX11_MEDIA_OBJECT_GRPID_pack(__attribute__((unused)) __gen_user_data *data,
8682                              __attribute__((unused)) void * restrict dst,
8683                              __attribute__((unused)) const struct GFX11_MEDIA_OBJECT_GRPID * restrict values)
8684{
8685   uint32_t * restrict dw = (uint32_t * restrict) dst;
8686
8687   dw[0] =
8688      __gen_uint(values->DWordLength, 0, 15) |
8689      __gen_uint(values->MediaCommandSubOpcode, 16, 23) |
8690      __gen_uint(values->MediaCommandOpcode, 24, 26) |
8691      __gen_uint(values->MediaCommandPipeline, 27, 28) |
8692      __gen_uint(values->CommandType, 29, 31);
8693
8694   dw[1] =
8695      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
8696
8697   dw[2] =
8698      __gen_uint(values->IndirectDataLength, 0, 16) |
8699      __gen_uint(values->EndofThreadGroup, 23, 23);
8700
8701   dw[3] = __gen_address(data, &dw[3], values->IndirectDataStartAddress, 0, 0, 31);
8702
8703   dw[4] =
8704      __gen_uint(values->XPosition, 0, 8) |
8705      __gen_uint(values->YPosition, 16, 24);
8706
8707   dw[5] =
8708      __gen_uint(values->BlockColor, 16, 23);
8709
8710   dw[6] =
8711      __gen_uint(values->GroupID, 0, 31);
8712}
8713
8714#define GFX11_MEDIA_OBJECT_PRT_length         16
8715#define GFX11_MEDIA_OBJECT_PRT_length_bias      2
8716#define GFX11_MEDIA_OBJECT_PRT_header           \
8717   .DWordLength                         =     14,  \
8718   .SubOpcode                           =      2,  \
8719   .MediaCommandOpcode                  =      1,  \
8720   .Pipeline                            =      2,  \
8721   .CommandType                         =      3
8722
8723struct GFX11_MEDIA_OBJECT_PRT {
8724   uint32_t                             DWordLength;
8725   uint32_t                             SubOpcode;
8726   uint32_t                             MediaCommandOpcode;
8727   uint32_t                             Pipeline;
8728   uint32_t                             CommandType;
8729   uint32_t                             InterfaceDescriptorOffset;
8730   uint32_t                             PRT_FenceType;
8731#define Rootthreadqueue                          0
8732#define VFEstateflush                            1
8733   bool                                 PRT_FenceNeeded;
8734   bool                                 ChildrenPresent;
8735   uint32_t                             InlineData[12];
8736};
8737
8738static inline __attribute__((always_inline)) void
8739GFX11_MEDIA_OBJECT_PRT_pack(__attribute__((unused)) __gen_user_data *data,
8740                            __attribute__((unused)) void * restrict dst,
8741                            __attribute__((unused)) const struct GFX11_MEDIA_OBJECT_PRT * restrict values)
8742{
8743   uint32_t * restrict dw = (uint32_t * restrict) dst;
8744
8745   dw[0] =
8746      __gen_uint(values->DWordLength, 0, 14) |
8747      __gen_uint(values->SubOpcode, 16, 23) |
8748      __gen_uint(values->MediaCommandOpcode, 24, 26) |
8749      __gen_uint(values->Pipeline, 27, 28) |
8750      __gen_uint(values->CommandType, 29, 31);
8751
8752   dw[1] =
8753      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
8754
8755   dw[2] =
8756      __gen_uint(values->PRT_FenceType, 22, 22) |
8757      __gen_uint(values->PRT_FenceNeeded, 23, 23) |
8758      __gen_uint(values->ChildrenPresent, 31, 31);
8759
8760   dw[3] = 0;
8761
8762   dw[4] =
8763      __gen_uint(values->InlineData[0], 0, 31);
8764
8765   dw[5] =
8766      __gen_uint(values->InlineData[1], 0, 31);
8767
8768   dw[6] =
8769      __gen_uint(values->InlineData[2], 0, 31);
8770
8771   dw[7] =
8772      __gen_uint(values->InlineData[3], 0, 31);
8773
8774   dw[8] =
8775      __gen_uint(values->InlineData[4], 0, 31);
8776
8777   dw[9] =
8778      __gen_uint(values->InlineData[5], 0, 31);
8779
8780   dw[10] =
8781      __gen_uint(values->InlineData[6], 0, 31);
8782
8783   dw[11] =
8784      __gen_uint(values->InlineData[7], 0, 31);
8785
8786   dw[12] =
8787      __gen_uint(values->InlineData[8], 0, 31);
8788
8789   dw[13] =
8790      __gen_uint(values->InlineData[9], 0, 31);
8791
8792   dw[14] =
8793      __gen_uint(values->InlineData[10], 0, 31);
8794
8795   dw[15] =
8796      __gen_uint(values->InlineData[11], 0, 31);
8797}
8798
8799#define GFX11_MEDIA_OBJECT_WALKER_length_bias      2
8800#define GFX11_MEDIA_OBJECT_WALKER_header        \
8801   .DWordLength                         =     15,  \
8802   .SubOpcode                           =      3,  \
8803   .MediaCommandOpcode                  =      1,  \
8804   .Pipeline                            =      2,  \
8805   .CommandType                         =      3
8806
8807struct GFX11_MEDIA_OBJECT_WALKER {
8808   uint32_t                             DWordLength;
8809   uint32_t                             SubOpcode;
8810   uint32_t                             MediaCommandOpcode;
8811   uint32_t                             Pipeline;
8812   uint32_t                             CommandType;
8813   uint32_t                             InterfaceDescriptorOffset;
8814   uint32_t                             IndirectDataLength;
8815   uint32_t                             MaskedDispatch;
8816   uint32_t                             ThreadSynchronization;
8817#define Nothreadsynchronization                  0
8818#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
8819   uint32_t                             IndirectDataStartAddress;
8820   uint32_t                             GroupIDLoopSelect;
8821#define No_Groups                                0
8822#define Color_Groups                             1
8823#define InnerLocal_Groups                        2
8824#define MidLocal_Groups                          3
8825#define OuterLocal_Groups                        4
8826#define InnerGlobal_Groups                       5
8827   int32_t                              MidLoopUnitX;
8828   int32_t                              LocalMidLoopUnitY;
8829   uint32_t                             MiddleLoopExtraSteps;
8830   uint32_t                             ColorCountMinusOne;
8831   uint32_t                             LocalLoopExecCount;
8832   uint32_t                             GlobalLoopExecCount;
8833   uint32_t                             BlockResolutionX;
8834   uint32_t                             BlockResolutionY;
8835   uint32_t                             LocalStartX;
8836   uint32_t                             LocalStartY;
8837   int32_t                              LocalOuterLoopStrideX;
8838   int32_t                              LocalOuterLoopStrideY;
8839   int32_t                              LocalInnerLoopUnitX;
8840   int32_t                              LocalInnerLoopUnitY;
8841   uint32_t                             GlobalResolutionX;
8842   uint32_t                             GlobalResolutionY;
8843   int32_t                              GlobalStartX;
8844   int32_t                              GlobalStartY;
8845   int32_t                              GlobalOuterLoopStrideX;
8846   int32_t                              GlobalOuterLoopStrideY;
8847   int32_t                              GlobalInnerLoopUnitX;
8848   int32_t                              GlobalInnerLoopUnitY;
8849   /* variable length fields follow */
8850};
8851
8852static inline __attribute__((always_inline)) void
8853GFX11_MEDIA_OBJECT_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
8854                               __attribute__((unused)) void * restrict dst,
8855                               __attribute__((unused)) const struct GFX11_MEDIA_OBJECT_WALKER * restrict values)
8856{
8857   uint32_t * restrict dw = (uint32_t * restrict) dst;
8858
8859   dw[0] =
8860      __gen_uint(values->DWordLength, 0, 14) |
8861      __gen_uint(values->SubOpcode, 16, 23) |
8862      __gen_uint(values->MediaCommandOpcode, 24, 26) |
8863      __gen_uint(values->Pipeline, 27, 28) |
8864      __gen_uint(values->CommandType, 29, 31);
8865
8866   dw[1] =
8867      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
8868
8869   dw[2] =
8870      __gen_uint(values->IndirectDataLength, 0, 16) |
8871      __gen_uint(values->MaskedDispatch, 22, 23) |
8872      __gen_uint(values->ThreadSynchronization, 24, 24);
8873
8874   dw[3] =
8875      __gen_uint(values->IndirectDataStartAddress, 0, 31);
8876
8877   dw[4] = 0;
8878
8879   dw[5] =
8880      __gen_uint(values->GroupIDLoopSelect, 8, 31);
8881
8882   dw[6] =
8883      __gen_sint(values->MidLoopUnitX, 8, 9) |
8884      __gen_sint(values->LocalMidLoopUnitY, 12, 13) |
8885      __gen_uint(values->MiddleLoopExtraSteps, 16, 20) |
8886      __gen_uint(values->ColorCountMinusOne, 24, 31);
8887
8888   dw[7] =
8889      __gen_uint(values->LocalLoopExecCount, 0, 11) |
8890      __gen_uint(values->GlobalLoopExecCount, 16, 27);
8891
8892   dw[8] =
8893      __gen_uint(values->BlockResolutionX, 0, 10) |
8894      __gen_uint(values->BlockResolutionY, 16, 26);
8895
8896   dw[9] =
8897      __gen_uint(values->LocalStartX, 0, 10) |
8898      __gen_uint(values->LocalStartY, 16, 26);
8899
8900   dw[10] = 0;
8901
8902   dw[11] =
8903      __gen_sint(values->LocalOuterLoopStrideX, 0, 11) |
8904      __gen_sint(values->LocalOuterLoopStrideY, 16, 27);
8905
8906   dw[12] =
8907      __gen_sint(values->LocalInnerLoopUnitX, 0, 11) |
8908      __gen_sint(values->LocalInnerLoopUnitY, 16, 27);
8909
8910   dw[13] =
8911      __gen_uint(values->GlobalResolutionX, 0, 10) |
8912      __gen_uint(values->GlobalResolutionY, 16, 26);
8913
8914   dw[14] =
8915      __gen_sint(values->GlobalStartX, 0, 11) |
8916      __gen_sint(values->GlobalStartY, 16, 27);
8917
8918   dw[15] =
8919      __gen_sint(values->GlobalOuterLoopStrideX, 0, 11) |
8920      __gen_sint(values->GlobalOuterLoopStrideY, 16, 27);
8921
8922   dw[16] =
8923      __gen_sint(values->GlobalInnerLoopUnitX, 0, 11) |
8924      __gen_sint(values->GlobalInnerLoopUnitY, 16, 27);
8925}
8926
8927#define GFX11_MEDIA_STATE_FLUSH_length         2
8928#define GFX11_MEDIA_STATE_FLUSH_length_bias      2
8929#define GFX11_MEDIA_STATE_FLUSH_header          \
8930   .DWordLength                         =      0,  \
8931   .SubOpcode                           =      4,  \
8932   .MediaCommandOpcode                  =      0,  \
8933   .Pipeline                            =      2,  \
8934   .CommandType                         =      3
8935
8936struct GFX11_MEDIA_STATE_FLUSH {
8937   uint32_t                             DWordLength;
8938   uint32_t                             SubOpcode;
8939   uint32_t                             MediaCommandOpcode;
8940   uint32_t                             Pipeline;
8941   uint32_t                             CommandType;
8942   uint32_t                             InterfaceDescriptorOffset;
8943   bool                                 FlushtoGO;
8944};
8945
8946static inline __attribute__((always_inline)) void
8947GFX11_MEDIA_STATE_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
8948                             __attribute__((unused)) void * restrict dst,
8949                             __attribute__((unused)) const struct GFX11_MEDIA_STATE_FLUSH * restrict values)
8950{
8951   uint32_t * restrict dw = (uint32_t * restrict) dst;
8952
8953   dw[0] =
8954      __gen_uint(values->DWordLength, 0, 15) |
8955      __gen_uint(values->SubOpcode, 16, 23) |
8956      __gen_uint(values->MediaCommandOpcode, 24, 26) |
8957      __gen_uint(values->Pipeline, 27, 28) |
8958      __gen_uint(values->CommandType, 29, 31);
8959
8960   dw[1] =
8961      __gen_uint(values->InterfaceDescriptorOffset, 0, 5) |
8962      __gen_uint(values->FlushtoGO, 7, 7);
8963}
8964
8965#define GFX11_MEDIA_VFE_STATE_length           9
8966#define GFX11_MEDIA_VFE_STATE_length_bias      2
8967#define GFX11_MEDIA_VFE_STATE_header            \
8968   .DWordLength                         =      7,  \
8969   .SubOpcode                           =      0,  \
8970   .MediaCommandOpcode                  =      0,  \
8971   .Pipeline                            =      2,  \
8972   .CommandType                         =      3
8973
8974struct GFX11_MEDIA_VFE_STATE {
8975   uint32_t                             DWordLength;
8976   uint32_t                             SubOpcode;
8977   uint32_t                             MediaCommandOpcode;
8978   uint32_t                             Pipeline;
8979   uint32_t                             CommandType;
8980   uint32_t                             PerThreadScratchSpace;
8981   uint32_t                             StackSize;
8982   __gen_address_type                   ScratchSpaceBasePointer;
8983   uint32_t                             DispatchLoadBalance;
8984#define ColorLSB                                 1
8985#define LeastLoaded                              0
8986   uint32_t                             NumberofURBEntries;
8987   uint32_t                             MaximumNumberofThreads;
8988   uint32_t                             MaximumNumberofDualSubslices;
8989   uint32_t                             CURBEAllocationSize;
8990   uint32_t                             URBEntryAllocationSize;
8991};
8992
8993static inline __attribute__((always_inline)) void
8994GFX11_MEDIA_VFE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
8995                           __attribute__((unused)) void * restrict dst,
8996                           __attribute__((unused)) const struct GFX11_MEDIA_VFE_STATE * restrict values)
8997{
8998   uint32_t * restrict dw = (uint32_t * restrict) dst;
8999
9000   dw[0] =
9001      __gen_uint(values->DWordLength, 0, 15) |
9002      __gen_uint(values->SubOpcode, 16, 23) |
9003      __gen_uint(values->MediaCommandOpcode, 24, 26) |
9004      __gen_uint(values->Pipeline, 27, 28) |
9005      __gen_uint(values->CommandType, 29, 31);
9006
9007   const uint64_t v1 =
9008      __gen_uint(values->PerThreadScratchSpace, 0, 3) |
9009      __gen_uint(values->StackSize, 4, 7);
9010   const uint64_t v1_address =
9011      __gen_address(data, &dw[1], values->ScratchSpaceBasePointer, v1, 10, 47);
9012   dw[1] = v1_address;
9013   dw[2] = (v1_address >> 32) | (v1 >> 32);
9014
9015   dw[3] =
9016      __gen_uint(values->DispatchLoadBalance, 2, 2) |
9017      __gen_uint(values->NumberofURBEntries, 8, 15) |
9018      __gen_uint(values->MaximumNumberofThreads, 16, 31);
9019
9020   dw[4] =
9021      __gen_uint(values->MaximumNumberofDualSubslices, 0, 7);
9022
9023   dw[5] =
9024      __gen_uint(values->CURBEAllocationSize, 0, 15) |
9025      __gen_uint(values->URBEntryAllocationSize, 16, 31);
9026
9027   dw[6] = 0;
9028
9029   dw[7] = 0;
9030
9031   dw[8] = 0;
9032}
9033
9034#define GFX11_MI_ARB_CHECK_length              1
9035#define GFX11_MI_ARB_CHECK_length_bias         1
9036#define GFX11_MI_ARB_CHECK_header               \
9037   .MICommandOpcode                     =      5,  \
9038   .CommandType                         =      0
9039
9040struct GFX11_MI_ARB_CHECK {
9041   uint32_t                             MICommandOpcode;
9042   uint32_t                             CommandType;
9043};
9044
9045static inline __attribute__((always_inline)) void
9046GFX11_MI_ARB_CHECK_pack(__attribute__((unused)) __gen_user_data *data,
9047                        __attribute__((unused)) void * restrict dst,
9048                        __attribute__((unused)) const struct GFX11_MI_ARB_CHECK * restrict values)
9049{
9050   uint32_t * restrict dw = (uint32_t * restrict) dst;
9051
9052   dw[0] =
9053      __gen_uint(values->MICommandOpcode, 23, 28) |
9054      __gen_uint(values->CommandType, 29, 31);
9055}
9056
9057#define GFX11_MI_ARB_ON_OFF_length             1
9058#define GFX11_MI_ARB_ON_OFF_length_bias        1
9059#define GFX11_MI_ARB_ON_OFF_header              \
9060   .ArbitrationEnable                   =      1,  \
9061   .MICommandOpcode                     =      8,  \
9062   .CommandType                         =      0
9063
9064struct GFX11_MI_ARB_ON_OFF {
9065   bool                                 ArbitrationEnable;
9066   bool                                 AllowLiteRestore;
9067   uint32_t                             MICommandOpcode;
9068   uint32_t                             CommandType;
9069};
9070
9071static inline __attribute__((always_inline)) void
9072GFX11_MI_ARB_ON_OFF_pack(__attribute__((unused)) __gen_user_data *data,
9073                         __attribute__((unused)) void * restrict dst,
9074                         __attribute__((unused)) const struct GFX11_MI_ARB_ON_OFF * restrict values)
9075{
9076   uint32_t * restrict dw = (uint32_t * restrict) dst;
9077
9078   dw[0] =
9079      __gen_uint(values->ArbitrationEnable, 0, 0) |
9080      __gen_uint(values->AllowLiteRestore, 1, 1) |
9081      __gen_uint(values->MICommandOpcode, 23, 28) |
9082      __gen_uint(values->CommandType, 29, 31);
9083}
9084
9085#define GFX11_MI_ATOMIC_length                 3
9086#define GFX11_MI_ATOMIC_length_bias            2
9087#define GFX11_MI_ATOMIC_header                  \
9088   .DWordLength                         =      1,  \
9089   .MICommandOpcode                     =     47,  \
9090   .CommandType                         =      0
9091
9092struct GFX11_MI_ATOMIC {
9093   uint32_t                             DWordLength;
9094   enum GFX11_Atomic_OPCODE             ATOMICOPCODE;
9095   bool                                 ReturnDataControl;
9096   bool                                 CSSTALL;
9097   bool                                 InlineData;
9098   uint32_t                             DataSize;
9099#define MI_ATOMIC_DWORD                          0
9100#define MI_ATOMIC_QWORD                          1
9101#define MI_ATOMIC_OCTWORD                        2
9102#define MI_ATOMIC_RESERVED                       3
9103   bool                                 PostSyncOperation;
9104   uint32_t                             MemoryType;
9105#define PerProcessGraphicsAddress                0
9106#define GlobalGraphicsAddress                    1
9107   uint32_t                             MICommandOpcode;
9108   uint32_t                             CommandType;
9109   __gen_address_type                   MemoryAddress;
9110   uint32_t                             Operand1DataDword0;
9111   uint32_t                             Operand2DataDword0;
9112   uint32_t                             Operand1DataDword1;
9113   uint32_t                             Operand2DataDword1;
9114   uint32_t                             Operand1DataDword2;
9115   uint32_t                             Operand2DataDword2;
9116   uint32_t                             Operand1DataDword3;
9117   uint32_t                             Operand2DataDword3;
9118};
9119
9120static inline __attribute__((always_inline)) void
9121GFX11_MI_ATOMIC_pack(__attribute__((unused)) __gen_user_data *data,
9122                     __attribute__((unused)) void * restrict dst,
9123                     __attribute__((unused)) const struct GFX11_MI_ATOMIC * restrict values)
9124{
9125   uint32_t * restrict dw = (uint32_t * restrict) dst;
9126
9127   dw[0] =
9128      __gen_uint(values->DWordLength, 0, 7) |
9129      __gen_uint(values->ATOMICOPCODE, 8, 15) |
9130      __gen_uint(values->ReturnDataControl, 16, 16) |
9131      __gen_uint(values->CSSTALL, 17, 17) |
9132      __gen_uint(values->InlineData, 18, 18) |
9133      __gen_uint(values->DataSize, 19, 20) |
9134      __gen_uint(values->PostSyncOperation, 21, 21) |
9135      __gen_uint(values->MemoryType, 22, 22) |
9136      __gen_uint(values->MICommandOpcode, 23, 28) |
9137      __gen_uint(values->CommandType, 29, 31);
9138
9139   const uint64_t v1_address =
9140      __gen_address(data, &dw[1], values->MemoryAddress, 0, 2, 47);
9141   dw[1] = v1_address;
9142   dw[2] = v1_address >> 32;
9143}
9144
9145#define GFX11_MI_BATCH_BUFFER_END_length       1
9146#define GFX11_MI_BATCH_BUFFER_END_length_bias      1
9147#define GFX11_MI_BATCH_BUFFER_END_header        \
9148   .MICommandOpcode                     =     10,  \
9149   .CommandType                         =      0
9150
9151struct GFX11_MI_BATCH_BUFFER_END {
9152   bool                                 EndContext;
9153   uint32_t                             MICommandOpcode;
9154   uint32_t                             CommandType;
9155};
9156
9157static inline __attribute__((always_inline)) void
9158GFX11_MI_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
9159                               __attribute__((unused)) void * restrict dst,
9160                               __attribute__((unused)) const struct GFX11_MI_BATCH_BUFFER_END * restrict values)
9161{
9162   uint32_t * restrict dw = (uint32_t * restrict) dst;
9163
9164   dw[0] =
9165      __gen_uint(values->EndContext, 0, 0) |
9166      __gen_uint(values->MICommandOpcode, 23, 28) |
9167      __gen_uint(values->CommandType, 29, 31);
9168}
9169
9170#define GFX11_MI_BATCH_BUFFER_START_length      3
9171#define GFX11_MI_BATCH_BUFFER_START_length_bias      2
9172#define GFX11_MI_BATCH_BUFFER_START_header      \
9173   .DWordLength                         =      1,  \
9174   .MICommandOpcode                     =     49,  \
9175   .CommandType                         =      0
9176
9177struct GFX11_MI_BATCH_BUFFER_START {
9178   uint32_t                             DWordLength;
9179   uint32_t                             AddressSpaceIndicator;
9180#define ASI_GGTT                                 0
9181#define ASI_PPGTT                                1
9182   bool                                 ResourceStreamerEnable;
9183   bool                                 PredicationEnable;
9184   uint32_t                             SecondLevelBatchBuffer;
9185#define Firstlevelbatch                          0
9186#define Secondlevelbatch                         1
9187   uint32_t                             MICommandOpcode;
9188   uint32_t                             CommandType;
9189   __gen_address_type                   BatchBufferStartAddress;
9190};
9191
9192static inline __attribute__((always_inline)) void
9193GFX11_MI_BATCH_BUFFER_START_pack(__attribute__((unused)) __gen_user_data *data,
9194                                 __attribute__((unused)) void * restrict dst,
9195                                 __attribute__((unused)) const struct GFX11_MI_BATCH_BUFFER_START * restrict values)
9196{
9197   uint32_t * restrict dw = (uint32_t * restrict) dst;
9198
9199   dw[0] =
9200      __gen_uint(values->DWordLength, 0, 7) |
9201      __gen_uint(values->AddressSpaceIndicator, 8, 8) |
9202      __gen_uint(values->ResourceStreamerEnable, 10, 10) |
9203      __gen_uint(values->PredicationEnable, 15, 15) |
9204      __gen_uint(values->SecondLevelBatchBuffer, 22, 22) |
9205      __gen_uint(values->MICommandOpcode, 23, 28) |
9206      __gen_uint(values->CommandType, 29, 31);
9207
9208   const uint64_t v1_address =
9209      __gen_address(data, &dw[1], values->BatchBufferStartAddress, 0, 2, 63);
9210   dw[1] = v1_address;
9211   dw[2] = v1_address >> 32;
9212}
9213
9214#define GFX11_MI_CLFLUSH_length_bias           2
9215#define GFX11_MI_CLFLUSH_header                 \
9216   .DWordLength                         =      1,  \
9217   .MICommandOpcode                     =     39,  \
9218   .CommandType                         =      0
9219
9220struct GFX11_MI_CLFLUSH {
9221   uint32_t                             DWordLength;
9222   bool                                 UseGlobalGTT;
9223   uint32_t                             MICommandOpcode;
9224   uint32_t                             CommandType;
9225   uint32_t                             StartingCachelineOffset;
9226   __gen_address_type                   PageBaseAddress;
9227   /* variable length fields follow */
9228};
9229
9230static inline __attribute__((always_inline)) void
9231GFX11_MI_CLFLUSH_pack(__attribute__((unused)) __gen_user_data *data,
9232                      __attribute__((unused)) void * restrict dst,
9233                      __attribute__((unused)) const struct GFX11_MI_CLFLUSH * restrict values)
9234{
9235   uint32_t * restrict dw = (uint32_t * restrict) dst;
9236
9237   dw[0] =
9238      __gen_uint(values->DWordLength, 0, 9) |
9239      __gen_uint(values->UseGlobalGTT, 22, 22) |
9240      __gen_uint(values->MICommandOpcode, 23, 28) |
9241      __gen_uint(values->CommandType, 29, 31);
9242
9243   const uint64_t v1 =
9244      __gen_uint(values->StartingCachelineOffset, 6, 11);
9245   const uint64_t v1_address =
9246      __gen_address(data, &dw[1], values->PageBaseAddress, v1, 12, 47);
9247   dw[1] = v1_address;
9248   dw[2] = (v1_address >> 32) | (v1 >> 32);
9249}
9250
9251#define GFX11_MI_CONDITIONAL_BATCH_BUFFER_END_length      4
9252#define GFX11_MI_CONDITIONAL_BATCH_BUFFER_END_length_bias      2
9253#define GFX11_MI_CONDITIONAL_BATCH_BUFFER_END_header\
9254   .DWordLength                         =      2,  \
9255   .CompareSemaphore                    =      0,  \
9256   .MICommandOpcode                     =     54,  \
9257   .CommandType                         =      0
9258
9259struct GFX11_MI_CONDITIONAL_BATCH_BUFFER_END {
9260   uint32_t                             DWordLength;
9261   uint32_t                             CompareMaskMode;
9262#define CompareMaskModeDisabled                  0
9263#define CompareMaskModeEnabled                   1
9264   uint32_t                             CompareSemaphore;
9265   bool                                 UseGlobalGTT;
9266   uint32_t                             MICommandOpcode;
9267   uint32_t                             CommandType;
9268   uint32_t                             CompareDataDword;
9269   __gen_address_type                   CompareAddress;
9270};
9271
9272static inline __attribute__((always_inline)) void
9273GFX11_MI_CONDITIONAL_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
9274                                           __attribute__((unused)) void * restrict dst,
9275                                           __attribute__((unused)) const struct GFX11_MI_CONDITIONAL_BATCH_BUFFER_END * restrict values)
9276{
9277   uint32_t * restrict dw = (uint32_t * restrict) dst;
9278
9279   dw[0] =
9280      __gen_uint(values->DWordLength, 0, 7) |
9281      __gen_uint(values->CompareMaskMode, 19, 19) |
9282      __gen_uint(values->CompareSemaphore, 21, 21) |
9283      __gen_uint(values->UseGlobalGTT, 22, 22) |
9284      __gen_uint(values->MICommandOpcode, 23, 28) |
9285      __gen_uint(values->CommandType, 29, 31);
9286
9287   dw[1] =
9288      __gen_uint(values->CompareDataDword, 0, 31);
9289
9290   const uint64_t v2_address =
9291      __gen_address(data, &dw[2], values->CompareAddress, 0, 3, 63);
9292   dw[2] = v2_address;
9293   dw[3] = v2_address >> 32;
9294}
9295
9296#define GFX11_MI_COPY_MEM_MEM_length           5
9297#define GFX11_MI_COPY_MEM_MEM_length_bias      2
9298#define GFX11_MI_COPY_MEM_MEM_header            \
9299   .DWordLength                         =      3,  \
9300   .MICommandOpcode                     =     46,  \
9301   .CommandType                         =      0
9302
9303struct GFX11_MI_COPY_MEM_MEM {
9304   uint32_t                             DWordLength;
9305   bool                                 UseGlobalGTTDestination;
9306   bool                                 UseGlobalGTTSource;
9307   uint32_t                             MICommandOpcode;
9308   uint32_t                             CommandType;
9309   __gen_address_type                   DestinationMemoryAddress;
9310   __gen_address_type                   SourceMemoryAddress;
9311};
9312
9313static inline __attribute__((always_inline)) void
9314GFX11_MI_COPY_MEM_MEM_pack(__attribute__((unused)) __gen_user_data *data,
9315                           __attribute__((unused)) void * restrict dst,
9316                           __attribute__((unused)) const struct GFX11_MI_COPY_MEM_MEM * restrict values)
9317{
9318   uint32_t * restrict dw = (uint32_t * restrict) dst;
9319
9320   dw[0] =
9321      __gen_uint(values->DWordLength, 0, 7) |
9322      __gen_uint(values->UseGlobalGTTDestination, 21, 21) |
9323      __gen_uint(values->UseGlobalGTTSource, 22, 22) |
9324      __gen_uint(values->MICommandOpcode, 23, 28) |
9325      __gen_uint(values->CommandType, 29, 31);
9326
9327   const uint64_t v1_address =
9328      __gen_address(data, &dw[1], values->DestinationMemoryAddress, 0, 2, 63);
9329   dw[1] = v1_address;
9330   dw[2] = v1_address >> 32;
9331
9332   const uint64_t v3_address =
9333      __gen_address(data, &dw[3], values->SourceMemoryAddress, 0, 2, 63);
9334   dw[3] = v3_address;
9335   dw[4] = v3_address >> 32;
9336}
9337
9338#define GFX11_MI_DISPLAY_FLIP_length           3
9339#define GFX11_MI_DISPLAY_FLIP_length_bias      2
9340#define GFX11_MI_DISPLAY_FLIP_header            \
9341   .DWordLength                         =      1,  \
9342   .MICommandOpcode                     =     20,  \
9343   .CommandType                         =      0
9344
9345struct GFX11_MI_DISPLAY_FLIP {
9346   uint32_t                             DWordLength;
9347   uint32_t                             DisplayPlaneSelect;
9348#define DisplayPlane1                            0
9349#define DisplayPlane2                            1
9350#define DisplayPlane3                            2
9351#define DisplayPlane4                            4
9352#define DisplayPlane5                            5
9353#define DisplayPlane6                            6
9354#define DisplayPlane7                            7
9355#define DisplayPlane8                            8
9356#define DisplayPlane9                            9
9357#define DisplayPlane10                           10
9358#define DisplayPlane11                           11
9359#define DisplayPlane12                           12
9360#define DisplayPlane13                           13
9361#define DisplayPlane14                           14
9362#define DisplayPlane15                           15
9363#define DisplayPlane16                           16
9364#define DisplayPlane17                           17
9365#define DisplayPlane18                           18
9366#define DisplayPlane19                           19
9367#define DisplayPlane20                           20
9368#define DisplayPlane21                           21
9369#define DisplayPlane22                           22
9370#define DisplayPlane23                           23
9371#define DisplayPlane24                           24
9372#define DisplayPlane25                           25
9373#define DisplayPlane26                           26
9374#define DisplayPlane27                           27
9375#define DisplayPlane28                           28
9376#define DisplayPlane29                           29
9377#define DisplayPlane30                           30
9378#define DisplayPlane31                           31
9379#define DisplayPlane32                           32
9380   bool                                 AsyncFlipIndicator;
9381   uint32_t                             MICommandOpcode;
9382   uint32_t                             CommandType;
9383   uint32_t                             TileParameter;
9384   uint32_t                             DisplayBufferPitch;
9385   bool                                 Stereoscopic3DMode;
9386   uint32_t                             FlipType;
9387#define SyncFlip                                 0
9388#define AsyncFlip                                1
9389#define Stereo3DFlip                             2
9390   uint32_t                             VRRMasterFlip;
9391   __gen_address_type                   DisplayBufferBaseAddress;
9392   __gen_address_type                   LeftEyeDisplayBufferBaseAddress;
9393};
9394
9395static inline __attribute__((always_inline)) void
9396GFX11_MI_DISPLAY_FLIP_pack(__attribute__((unused)) __gen_user_data *data,
9397                           __attribute__((unused)) void * restrict dst,
9398                           __attribute__((unused)) const struct GFX11_MI_DISPLAY_FLIP * restrict values)
9399{
9400   uint32_t * restrict dw = (uint32_t * restrict) dst;
9401
9402   dw[0] =
9403      __gen_uint(values->DWordLength, 0, 7) |
9404      __gen_uint(values->DisplayPlaneSelect, 8, 13) |
9405      __gen_uint(values->AsyncFlipIndicator, 22, 22) |
9406      __gen_uint(values->MICommandOpcode, 23, 28) |
9407      __gen_uint(values->CommandType, 29, 31);
9408
9409   dw[1] =
9410      __gen_uint(values->TileParameter, 0, 2) |
9411      __gen_uint(values->DisplayBufferPitch, 6, 15) |
9412      __gen_uint(values->Stereoscopic3DMode, 31, 31);
9413
9414   const uint32_t v2 =
9415      __gen_uint(values->FlipType, 0, 1) |
9416      __gen_uint(values->VRRMasterFlip, 11, 11);
9417   dw[2] = __gen_address(data, &dw[2], values->DisplayBufferBaseAddress, v2, 12, 31);
9418}
9419
9420#define GFX11_MI_FORCE_WAKEUP_length           2
9421#define GFX11_MI_FORCE_WAKEUP_length_bias      2
9422#define GFX11_MI_FORCE_WAKEUP_header            \
9423   .DWordLength                         =      0,  \
9424   .MICommandOpcode                     =     29,  \
9425   .CommandType                         =      0
9426
9427struct GFX11_MI_FORCE_WAKEUP {
9428   uint32_t                             DWordLength;
9429   uint32_t                             MICommandOpcode;
9430   uint32_t                             CommandType;
9431   uint32_t                             ForceMediaSlice0Awake;
9432   uint32_t                             ForceRenderAwake;
9433   uint32_t                             ForceMediaSlice1Awake;
9434   uint32_t                             ForceMediaSlice2Awake;
9435   uint32_t                             ForceMediaSlice3Awake;
9436   uint32_t                             MaskBits;
9437};
9438
9439static inline __attribute__((always_inline)) void
9440GFX11_MI_FORCE_WAKEUP_pack(__attribute__((unused)) __gen_user_data *data,
9441                           __attribute__((unused)) void * restrict dst,
9442                           __attribute__((unused)) const struct GFX11_MI_FORCE_WAKEUP * restrict values)
9443{
9444   uint32_t * restrict dw = (uint32_t * restrict) dst;
9445
9446   dw[0] =
9447      __gen_uint(values->DWordLength, 0, 7) |
9448      __gen_uint(values->MICommandOpcode, 23, 28) |
9449      __gen_uint(values->CommandType, 29, 31);
9450
9451   dw[1] =
9452      __gen_uint(values->ForceMediaSlice0Awake, 0, 0) |
9453      __gen_uint(values->ForceRenderAwake, 1, 1) |
9454      __gen_uint(values->ForceMediaSlice1Awake, 2, 2) |
9455      __gen_uint(values->ForceMediaSlice2Awake, 3, 3) |
9456      __gen_uint(values->ForceMediaSlice3Awake, 4, 4) |
9457      __gen_uint(values->MaskBits, 16, 31);
9458}
9459
9460#define GFX11_MI_LOAD_REGISTER_IMM_length      3
9461#define GFX11_MI_LOAD_REGISTER_IMM_length_bias      2
9462#define GFX11_MI_LOAD_REGISTER_IMM_header       \
9463   .DWordLength                         =      1,  \
9464   .MICommandOpcode                     =     34,  \
9465   .CommandType                         =      0
9466
9467struct GFX11_MI_LOAD_REGISTER_IMM {
9468   uint32_t                             DWordLength;
9469   uint32_t                             ByteWriteDisables;
9470   uint32_t                             AddCSMMIOStartOffset;
9471   uint32_t                             MICommandOpcode;
9472   uint32_t                             CommandType;
9473   uint64_t                             RegisterOffset;
9474   uint32_t                             DataDWord;
9475   /* variable length fields follow */
9476};
9477
9478static inline __attribute__((always_inline)) void
9479GFX11_MI_LOAD_REGISTER_IMM_pack(__attribute__((unused)) __gen_user_data *data,
9480                                __attribute__((unused)) void * restrict dst,
9481                                __attribute__((unused)) const struct GFX11_MI_LOAD_REGISTER_IMM * restrict values)
9482{
9483   uint32_t * restrict dw = (uint32_t * restrict) dst;
9484
9485   dw[0] =
9486      __gen_uint(values->DWordLength, 0, 7) |
9487      __gen_uint(values->ByteWriteDisables, 8, 11) |
9488      __gen_uint(values->AddCSMMIOStartOffset, 19, 19) |
9489      __gen_uint(values->MICommandOpcode, 23, 28) |
9490      __gen_uint(values->CommandType, 29, 31);
9491
9492   dw[1] =
9493      __gen_offset(values->RegisterOffset, 2, 22);
9494
9495   dw[2] =
9496      __gen_uint(values->DataDWord, 0, 31);
9497}
9498
9499#define GFX11_MI_LOAD_REGISTER_MEM_length      4
9500#define GFX11_MI_LOAD_REGISTER_MEM_length_bias      2
9501#define GFX11_MI_LOAD_REGISTER_MEM_header       \
9502   .DWordLength                         =      2,  \
9503   .MICommandOpcode                     =     41,  \
9504   .CommandType                         =      0
9505
9506struct GFX11_MI_LOAD_REGISTER_MEM {
9507   uint32_t                             DWordLength;
9508   uint32_t                             AddCSMMIOStartOffset;
9509   uint32_t                             AddLoopVariable;
9510   bool                                 AsyncModeEnable;
9511   bool                                 UseGlobalGTT;
9512   uint32_t                             MICommandOpcode;
9513   uint32_t                             CommandType;
9514   uint64_t                             RegisterAddress;
9515   __gen_address_type                   MemoryAddress;
9516};
9517
9518static inline __attribute__((always_inline)) void
9519GFX11_MI_LOAD_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
9520                                __attribute__((unused)) void * restrict dst,
9521                                __attribute__((unused)) const struct GFX11_MI_LOAD_REGISTER_MEM * restrict values)
9522{
9523   uint32_t * restrict dw = (uint32_t * restrict) dst;
9524
9525   dw[0] =
9526      __gen_uint(values->DWordLength, 0, 7) |
9527      __gen_uint(values->AddCSMMIOStartOffset, 19, 19) |
9528      __gen_uint(values->AddLoopVariable, 20, 20) |
9529      __gen_uint(values->AsyncModeEnable, 21, 21) |
9530      __gen_uint(values->UseGlobalGTT, 22, 22) |
9531      __gen_uint(values->MICommandOpcode, 23, 28) |
9532      __gen_uint(values->CommandType, 29, 31);
9533
9534   dw[1] =
9535      __gen_offset(values->RegisterAddress, 2, 22);
9536
9537   const uint64_t v2_address =
9538      __gen_address(data, &dw[2], values->MemoryAddress, 0, 2, 63);
9539   dw[2] = v2_address;
9540   dw[3] = v2_address >> 32;
9541}
9542
9543#define GFX11_MI_LOAD_REGISTER_REG_length      3
9544#define GFX11_MI_LOAD_REGISTER_REG_length_bias      2
9545#define GFX11_MI_LOAD_REGISTER_REG_header       \
9546   .DWordLength                         =      1,  \
9547   .MICommandOpcode                     =     42,  \
9548   .CommandType                         =      0
9549
9550struct GFX11_MI_LOAD_REGISTER_REG {
9551   uint32_t                             DWordLength;
9552   uint32_t                             AddCSMMIOStartOffsetSource;
9553   uint32_t                             AddCSMMIOStartOffsetDestination;
9554   uint32_t                             MICommandOpcode;
9555   uint32_t                             CommandType;
9556   uint64_t                             SourceRegisterAddress;
9557   uint64_t                             DestinationRegisterAddress;
9558};
9559
9560static inline __attribute__((always_inline)) void
9561GFX11_MI_LOAD_REGISTER_REG_pack(__attribute__((unused)) __gen_user_data *data,
9562                                __attribute__((unused)) void * restrict dst,
9563                                __attribute__((unused)) const struct GFX11_MI_LOAD_REGISTER_REG * restrict values)
9564{
9565   uint32_t * restrict dw = (uint32_t * restrict) dst;
9566
9567   dw[0] =
9568      __gen_uint(values->DWordLength, 0, 7) |
9569      __gen_uint(values->AddCSMMIOStartOffsetSource, 18, 18) |
9570      __gen_uint(values->AddCSMMIOStartOffsetDestination, 19, 19) |
9571      __gen_uint(values->MICommandOpcode, 23, 28) |
9572      __gen_uint(values->CommandType, 29, 31);
9573
9574   dw[1] =
9575      __gen_offset(values->SourceRegisterAddress, 2, 22);
9576
9577   dw[2] =
9578      __gen_offset(values->DestinationRegisterAddress, 2, 22);
9579}
9580
9581#define GFX11_MI_LOAD_SCAN_LINES_EXCL_length      2
9582#define GFX11_MI_LOAD_SCAN_LINES_EXCL_length_bias      2
9583#define GFX11_MI_LOAD_SCAN_LINES_EXCL_header    \
9584   .DWordLength                         =      0,  \
9585   .MICommandOpcode                     =     19,  \
9586   .CommandType                         =      0
9587
9588struct GFX11_MI_LOAD_SCAN_LINES_EXCL {
9589   uint32_t                             DWordLength;
9590   uint32_t                             DisplayPlaneSelect;
9591#define DisplayPlaneA                            0
9592#define DisplayPlaneB                            1
9593#define DisplayPlaneC                            4
9594#define DisplayPlaneD                            5
9595   uint32_t                             MICommandOpcode;
9596   uint32_t                             CommandType;
9597   uint32_t                             EndScanLineNumber;
9598   uint32_t                             StartScanLineNumber;
9599};
9600
9601static inline __attribute__((always_inline)) void
9602GFX11_MI_LOAD_SCAN_LINES_EXCL_pack(__attribute__((unused)) __gen_user_data *data,
9603                                   __attribute__((unused)) void * restrict dst,
9604                                   __attribute__((unused)) const struct GFX11_MI_LOAD_SCAN_LINES_EXCL * restrict values)
9605{
9606   uint32_t * restrict dw = (uint32_t * restrict) dst;
9607
9608   dw[0] =
9609      __gen_uint(values->DWordLength, 0, 5) |
9610      __gen_uint(values->DisplayPlaneSelect, 19, 21) |
9611      __gen_uint(values->MICommandOpcode, 23, 28) |
9612      __gen_uint(values->CommandType, 29, 31);
9613
9614   dw[1] =
9615      __gen_uint(values->EndScanLineNumber, 0, 12) |
9616      __gen_uint(values->StartScanLineNumber, 16, 28);
9617}
9618
9619#define GFX11_MI_LOAD_SCAN_LINES_INCL_length      2
9620#define GFX11_MI_LOAD_SCAN_LINES_INCL_length_bias      2
9621#define GFX11_MI_LOAD_SCAN_LINES_INCL_header    \
9622   .DWordLength                         =      0,  \
9623   .MICommandOpcode                     =     18,  \
9624   .CommandType                         =      0
9625
9626struct GFX11_MI_LOAD_SCAN_LINES_INCL {
9627   uint32_t                             DWordLength;
9628   uint32_t                             ScanLineEventDoneForward;
9629   uint32_t                             DisplayPlaneSelect;
9630#define DisplayPlane1A                           0
9631#define DisplayPlane1B                           1
9632#define DisplayPlane1C                           4
9633#define DisplayPlane1D                           5
9634   uint32_t                             MICommandOpcode;
9635   uint32_t                             CommandType;
9636   uint32_t                             EndScanLineNumber;
9637   uint32_t                             StartScanLineNumber;
9638};
9639
9640static inline __attribute__((always_inline)) void
9641GFX11_MI_LOAD_SCAN_LINES_INCL_pack(__attribute__((unused)) __gen_user_data *data,
9642                                   __attribute__((unused)) void * restrict dst,
9643                                   __attribute__((unused)) const struct GFX11_MI_LOAD_SCAN_LINES_INCL * restrict values)
9644{
9645   uint32_t * restrict dw = (uint32_t * restrict) dst;
9646
9647   dw[0] =
9648      __gen_uint(values->DWordLength, 0, 5) |
9649      __gen_uint(values->ScanLineEventDoneForward, 17, 18) |
9650      __gen_uint(values->DisplayPlaneSelect, 19, 21) |
9651      __gen_uint(values->MICommandOpcode, 23, 28) |
9652      __gen_uint(values->CommandType, 29, 31);
9653
9654   dw[1] =
9655      __gen_uint(values->EndScanLineNumber, 0, 12) |
9656      __gen_uint(values->StartScanLineNumber, 16, 28);
9657}
9658
9659#define GFX11_MI_MATH_length_bias              2
9660#define GFX11_MI_MATH_header                    \
9661   .DWordLength                         =      0,  \
9662   .MICommandOpcode                     =     26,  \
9663   .CommandType                         =      0
9664
9665struct GFX11_MI_MATH {
9666   uint32_t                             DWordLength;
9667   uint32_t                             MICommandOpcode;
9668   uint32_t                             CommandType;
9669   /* variable length fields follow */
9670};
9671
9672static inline __attribute__((always_inline)) void
9673GFX11_MI_MATH_pack(__attribute__((unused)) __gen_user_data *data,
9674                   __attribute__((unused)) void * restrict dst,
9675                   __attribute__((unused)) const struct GFX11_MI_MATH * restrict values)
9676{
9677   uint32_t * restrict dw = (uint32_t * restrict) dst;
9678
9679   dw[0] =
9680      __gen_uint(values->DWordLength, 0, 7) |
9681      __gen_uint(values->MICommandOpcode, 23, 28) |
9682      __gen_uint(values->CommandType, 29, 31);
9683}
9684
9685#define GFX11_MI_NOOP_length                   1
9686#define GFX11_MI_NOOP_length_bias              1
9687#define GFX11_MI_NOOP_header                    \
9688   .MICommandOpcode                     =      0,  \
9689   .CommandType                         =      0
9690
9691struct GFX11_MI_NOOP {
9692   uint32_t                             IdentificationNumber;
9693   bool                                 IdentificationNumberRegisterWriteEnable;
9694   uint32_t                             MICommandOpcode;
9695   uint32_t                             CommandType;
9696};
9697
9698static inline __attribute__((always_inline)) void
9699GFX11_MI_NOOP_pack(__attribute__((unused)) __gen_user_data *data,
9700                   __attribute__((unused)) void * restrict dst,
9701                   __attribute__((unused)) const struct GFX11_MI_NOOP * restrict values)
9702{
9703   uint32_t * restrict dw = (uint32_t * restrict) dst;
9704
9705   dw[0] =
9706      __gen_uint(values->IdentificationNumber, 0, 21) |
9707      __gen_uint(values->IdentificationNumberRegisterWriteEnable, 22, 22) |
9708      __gen_uint(values->MICommandOpcode, 23, 28) |
9709      __gen_uint(values->CommandType, 29, 31);
9710}
9711
9712#define GFX11_MI_PREDICATE_length              1
9713#define GFX11_MI_PREDICATE_length_bias         1
9714#define GFX11_MI_PREDICATE_header               \
9715   .MICommandOpcode                     =     12,  \
9716   .CommandType                         =      0
9717
9718struct GFX11_MI_PREDICATE {
9719   uint32_t                             CompareOperation;
9720#define COMPARE_TRUE                             0
9721#define COMPARE_FALSE                            1
9722#define COMPARE_SRCS_EQUAL                       2
9723#define COMPARE_DELTAS_EQUAL                     3
9724   uint32_t                             CombineOperation;
9725#define COMBINE_SET                              0
9726#define COMBINE_AND                              1
9727#define COMBINE_OR                               2
9728#define COMBINE_XOR                              3
9729   uint32_t                             LoadOperation;
9730#define LOAD_KEEP                                0
9731#define LOAD_LOAD                                2
9732#define LOAD_LOADINV                             3
9733   uint32_t                             MICommandOpcode;
9734   uint32_t                             CommandType;
9735};
9736
9737static inline __attribute__((always_inline)) void
9738GFX11_MI_PREDICATE_pack(__attribute__((unused)) __gen_user_data *data,
9739                        __attribute__((unused)) void * restrict dst,
9740                        __attribute__((unused)) const struct GFX11_MI_PREDICATE * restrict values)
9741{
9742   uint32_t * restrict dw = (uint32_t * restrict) dst;
9743
9744   dw[0] =
9745      __gen_uint(values->CompareOperation, 0, 1) |
9746      __gen_uint(values->CombineOperation, 3, 4) |
9747      __gen_uint(values->LoadOperation, 6, 7) |
9748      __gen_uint(values->MICommandOpcode, 23, 28) |
9749      __gen_uint(values->CommandType, 29, 31);
9750}
9751
9752#define GFX11_MI_REPORT_HEAD_length            1
9753#define GFX11_MI_REPORT_HEAD_length_bias       1
9754#define GFX11_MI_REPORT_HEAD_header             \
9755   .MICommandOpcode                     =      7,  \
9756   .CommandType                         =      0
9757
9758struct GFX11_MI_REPORT_HEAD {
9759   uint32_t                             MICommandOpcode;
9760   uint32_t                             CommandType;
9761};
9762
9763static inline __attribute__((always_inline)) void
9764GFX11_MI_REPORT_HEAD_pack(__attribute__((unused)) __gen_user_data *data,
9765                          __attribute__((unused)) void * restrict dst,
9766                          __attribute__((unused)) const struct GFX11_MI_REPORT_HEAD * restrict values)
9767{
9768   uint32_t * restrict dw = (uint32_t * restrict) dst;
9769
9770   dw[0] =
9771      __gen_uint(values->MICommandOpcode, 23, 28) |
9772      __gen_uint(values->CommandType, 29, 31);
9773}
9774
9775#define GFX11_MI_REPORT_PERF_COUNT_length      4
9776#define GFX11_MI_REPORT_PERF_COUNT_length_bias      2
9777#define GFX11_MI_REPORT_PERF_COUNT_header       \
9778   .DWordLength                         =      2,  \
9779   .MICommandOpcode                     =     40,  \
9780   .CommandType                         =      0
9781
9782struct GFX11_MI_REPORT_PERF_COUNT {
9783   uint32_t                             DWordLength;
9784   uint32_t                             MICommandOpcode;
9785   uint32_t                             CommandType;
9786   bool                                 UseGlobalGTT;
9787   uint32_t                             CoreModeEnable;
9788   __gen_address_type                   MemoryAddress;
9789   uint32_t                             ReportID;
9790};
9791
9792static inline __attribute__((always_inline)) void
9793GFX11_MI_REPORT_PERF_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
9794                                __attribute__((unused)) void * restrict dst,
9795                                __attribute__((unused)) const struct GFX11_MI_REPORT_PERF_COUNT * restrict values)
9796{
9797   uint32_t * restrict dw = (uint32_t * restrict) dst;
9798
9799   dw[0] =
9800      __gen_uint(values->DWordLength, 0, 5) |
9801      __gen_uint(values->MICommandOpcode, 23, 28) |
9802      __gen_uint(values->CommandType, 29, 31);
9803
9804   const uint64_t v1 =
9805      __gen_uint(values->UseGlobalGTT, 0, 0) |
9806      __gen_uint(values->CoreModeEnable, 4, 4);
9807   const uint64_t v1_address =
9808      __gen_address(data, &dw[1], values->MemoryAddress, v1, 6, 63);
9809   dw[1] = v1_address;
9810   dw[2] = (v1_address >> 32) | (v1 >> 32);
9811
9812   dw[3] =
9813      __gen_uint(values->ReportID, 0, 31);
9814}
9815
9816#define GFX11_MI_RS_CONTEXT_length             1
9817#define GFX11_MI_RS_CONTEXT_length_bias        1
9818#define GFX11_MI_RS_CONTEXT_header              \
9819   .MICommandOpcode                     =     15,  \
9820   .CommandType                         =      0
9821
9822struct GFX11_MI_RS_CONTEXT {
9823   uint32_t                             ResourceStreamerSave;
9824#define RS_Restore                               0
9825#define RS_Save                                  1
9826   uint32_t                             MICommandOpcode;
9827   uint32_t                             CommandType;
9828};
9829
9830static inline __attribute__((always_inline)) void
9831GFX11_MI_RS_CONTEXT_pack(__attribute__((unused)) __gen_user_data *data,
9832                         __attribute__((unused)) void * restrict dst,
9833                         __attribute__((unused)) const struct GFX11_MI_RS_CONTEXT * restrict values)
9834{
9835   uint32_t * restrict dw = (uint32_t * restrict) dst;
9836
9837   dw[0] =
9838      __gen_uint(values->ResourceStreamerSave, 0, 0) |
9839      __gen_uint(values->MICommandOpcode, 23, 28) |
9840      __gen_uint(values->CommandType, 29, 31);
9841}
9842
9843#define GFX11_MI_RS_CONTROL_length             1
9844#define GFX11_MI_RS_CONTROL_length_bias        1
9845#define GFX11_MI_RS_CONTROL_header              \
9846   .MICommandOpcode                     =      6,  \
9847   .CommandType                         =      0
9848
9849struct GFX11_MI_RS_CONTROL {
9850   uint32_t                             ResourceStreamerControl;
9851#define RS_Stop                                  0
9852#define RS_Start                                 1
9853   uint32_t                             MICommandOpcode;
9854   uint32_t                             CommandType;
9855};
9856
9857static inline __attribute__((always_inline)) void
9858GFX11_MI_RS_CONTROL_pack(__attribute__((unused)) __gen_user_data *data,
9859                         __attribute__((unused)) void * restrict dst,
9860                         __attribute__((unused)) const struct GFX11_MI_RS_CONTROL * restrict values)
9861{
9862   uint32_t * restrict dw = (uint32_t * restrict) dst;
9863
9864   dw[0] =
9865      __gen_uint(values->ResourceStreamerControl, 0, 0) |
9866      __gen_uint(values->MICommandOpcode, 23, 28) |
9867      __gen_uint(values->CommandType, 29, 31);
9868}
9869
9870#define GFX11_MI_RS_STORE_DATA_IMM_length      4
9871#define GFX11_MI_RS_STORE_DATA_IMM_length_bias      2
9872#define GFX11_MI_RS_STORE_DATA_IMM_header       \
9873   .DWordLength                         =      2,  \
9874   .MICommandOpcode                     =     43,  \
9875   .CommandType                         =      0
9876
9877struct GFX11_MI_RS_STORE_DATA_IMM {
9878   uint32_t                             DWordLength;
9879   uint32_t                             MICommandOpcode;
9880   uint32_t                             CommandType;
9881   uint32_t                             CoreModeEnable;
9882   __gen_address_type                   DestinationAddress;
9883   uint32_t                             DataDWord0;
9884};
9885
9886static inline __attribute__((always_inline)) void
9887GFX11_MI_RS_STORE_DATA_IMM_pack(__attribute__((unused)) __gen_user_data *data,
9888                                __attribute__((unused)) void * restrict dst,
9889                                __attribute__((unused)) const struct GFX11_MI_RS_STORE_DATA_IMM * restrict values)
9890{
9891   uint32_t * restrict dw = (uint32_t * restrict) dst;
9892
9893   dw[0] =
9894      __gen_uint(values->DWordLength, 0, 7) |
9895      __gen_uint(values->MICommandOpcode, 23, 28) |
9896      __gen_uint(values->CommandType, 29, 31);
9897
9898   const uint64_t v1 =
9899      __gen_uint(values->CoreModeEnable, 0, 0);
9900   const uint64_t v1_address =
9901      __gen_address(data, &dw[1], values->DestinationAddress, v1, 2, 63);
9902   dw[1] = v1_address;
9903   dw[2] = (v1_address >> 32) | (v1 >> 32);
9904
9905   dw[3] =
9906      __gen_uint(values->DataDWord0, 0, 31);
9907}
9908
9909#define GFX11_MI_SEMAPHORE_SIGNAL_length       2
9910#define GFX11_MI_SEMAPHORE_SIGNAL_length_bias      2
9911#define GFX11_MI_SEMAPHORE_SIGNAL_header        \
9912   .DWordLength                         =      0,  \
9913   .MICommandOpcode                     =     27,  \
9914   .CommandType                         =      0
9915
9916struct GFX11_MI_SEMAPHORE_SIGNAL {
9917   uint32_t                             DWordLength;
9918   uint32_t                             TargetEngineSelect;
9919#define RCS                                      0
9920#define VCS0                                     1
9921#define BCS                                      2
9922#define VECS                                     3
9923#define VCS1                                     4
9924#define VCS2                                     6
9925#define VCS3                                     7
9926#define VCS4                                     8
9927#define VCS5                                     9
9928#define VCS6                                     10
9929#define VCS7                                     11
9930#define VECS1                                    12
9931#define VECS2                                    13
9932#define VECS3                                    14
9933   bool                                 PostSyncOperation;
9934   uint32_t                             MICommandOpcode;
9935   uint32_t                             CommandType;
9936   uint32_t                             TargetContextID;
9937};
9938
9939static inline __attribute__((always_inline)) void
9940GFX11_MI_SEMAPHORE_SIGNAL_pack(__attribute__((unused)) __gen_user_data *data,
9941                               __attribute__((unused)) void * restrict dst,
9942                               __attribute__((unused)) const struct GFX11_MI_SEMAPHORE_SIGNAL * restrict values)
9943{
9944   uint32_t * restrict dw = (uint32_t * restrict) dst;
9945
9946   dw[0] =
9947      __gen_uint(values->DWordLength, 0, 7) |
9948      __gen_uint(values->TargetEngineSelect, 15, 18) |
9949      __gen_uint(values->PostSyncOperation, 21, 21) |
9950      __gen_uint(values->MICommandOpcode, 23, 28) |
9951      __gen_uint(values->CommandType, 29, 31);
9952
9953   dw[1] =
9954      __gen_uint(values->TargetContextID, 0, 31);
9955}
9956
9957#define GFX11_MI_SEMAPHORE_WAIT_length         4
9958#define GFX11_MI_SEMAPHORE_WAIT_length_bias      2
9959#define GFX11_MI_SEMAPHORE_WAIT_header          \
9960   .DWordLength                         =      2,  \
9961   .MICommandOpcode                     =     28,  \
9962   .CommandType                         =      0
9963
9964struct GFX11_MI_SEMAPHORE_WAIT {
9965   uint32_t                             DWordLength;
9966   uint32_t                             CompareOperation;
9967#define COMPARE_SAD_GREATER_THAN_SDD             0
9968#define COMPARE_SAD_GREATER_THAN_OR_EQUAL_SDD    1
9969#define COMPARE_SAD_LESS_THAN_SDD                2
9970#define COMPARE_SAD_LESS_THAN_OR_EQUAL_SDD       3
9971#define COMPARE_SAD_EQUAL_SDD                    4
9972#define COMPARE_SAD_NOT_EQUAL_SDD                5
9973   uint32_t                             WaitMode;
9974#define PollingMode                              1
9975#define SignalMode                               0
9976   bool                                 RegisterPollMode;
9977   uint32_t                             MemoryType;
9978#define PerProcessGraphicsAddress                0
9979#define GlobalGraphicsAddress                    1
9980   uint32_t                             MICommandOpcode;
9981   uint32_t                             CommandType;
9982   uint32_t                             SemaphoreDataDword;
9983   __gen_address_type                   SemaphoreAddress;
9984};
9985
9986static inline __attribute__((always_inline)) void
9987GFX11_MI_SEMAPHORE_WAIT_pack(__attribute__((unused)) __gen_user_data *data,
9988                             __attribute__((unused)) void * restrict dst,
9989                             __attribute__((unused)) const struct GFX11_MI_SEMAPHORE_WAIT * restrict values)
9990{
9991   uint32_t * restrict dw = (uint32_t * restrict) dst;
9992
9993   dw[0] =
9994      __gen_uint(values->DWordLength, 0, 7) |
9995      __gen_uint(values->CompareOperation, 12, 14) |
9996      __gen_uint(values->WaitMode, 15, 15) |
9997      __gen_uint(values->RegisterPollMode, 16, 16) |
9998      __gen_uint(values->MemoryType, 22, 22) |
9999      __gen_uint(values->MICommandOpcode, 23, 28) |
10000      __gen_uint(values->CommandType, 29, 31);
10001
10002   dw[1] =
10003      __gen_uint(values->SemaphoreDataDword, 0, 31);
10004
10005   const uint64_t v2_address =
10006      __gen_address(data, &dw[2], values->SemaphoreAddress, 0, 2, 63);
10007   dw[2] = v2_address;
10008   dw[3] = v2_address >> 32;
10009}
10010
10011#define GFX11_MI_SET_CONTEXT_length            2
10012#define GFX11_MI_SET_CONTEXT_length_bias       2
10013#define GFX11_MI_SET_CONTEXT_header             \
10014   .DWordLength                         =      0,  \
10015   .MICommandOpcode                     =     24,  \
10016   .CommandType                         =      0
10017
10018struct GFX11_MI_SET_CONTEXT {
10019   uint32_t                             DWordLength;
10020   uint32_t                             MICommandOpcode;
10021   uint32_t                             CommandType;
10022   uint32_t                             RestoreInhibit;
10023   uint32_t                             ForceRestore;
10024   bool                                 ResourceStreamerStateRestoreEnable;
10025   bool                                 ResourceStreamerStateSaveEnable;
10026   bool                                 CoreModeEnable;
10027   uint32_t                             ReservedMustbe1;
10028   __gen_address_type                   LogicalContextAddress;
10029};
10030
10031static inline __attribute__((always_inline)) void
10032GFX11_MI_SET_CONTEXT_pack(__attribute__((unused)) __gen_user_data *data,
10033                          __attribute__((unused)) void * restrict dst,
10034                          __attribute__((unused)) const struct GFX11_MI_SET_CONTEXT * restrict values)
10035{
10036   uint32_t * restrict dw = (uint32_t * restrict) dst;
10037
10038   dw[0] =
10039      __gen_uint(values->DWordLength, 0, 7) |
10040      __gen_uint(values->MICommandOpcode, 23, 28) |
10041      __gen_uint(values->CommandType, 29, 31);
10042
10043   const uint32_t v1 =
10044      __gen_uint(values->RestoreInhibit, 0, 0) |
10045      __gen_uint(values->ForceRestore, 1, 1) |
10046      __gen_uint(values->ResourceStreamerStateRestoreEnable, 2, 2) |
10047      __gen_uint(values->ResourceStreamerStateSaveEnable, 3, 3) |
10048      __gen_uint(values->CoreModeEnable, 4, 4) |
10049      __gen_uint(values->ReservedMustbe1, 8, 8);
10050   dw[1] = __gen_address(data, &dw[1], values->LogicalContextAddress, v1, 12, 31);
10051}
10052
10053#define GFX11_MI_SET_PREDICATE_length          1
10054#define GFX11_MI_SET_PREDICATE_length_bias      1
10055#define GFX11_MI_SET_PREDICATE_header           \
10056   .MICommandOpcode                     =      1,  \
10057   .CommandType                         =      0
10058
10059struct GFX11_MI_SET_PREDICATE {
10060   uint32_t                             PREDICATEENABLE;
10061#define NOOPNever                                0
10062#define NOOPonResult2clear                       1
10063#define NOOPonResult2set                         2
10064#define NOOPonResultclear                        3
10065#define NOOPonResultset                          4
10066#define NOOPAlways                               15
10067   uint32_t                             MICommandOpcode;
10068   uint32_t                             CommandType;
10069};
10070
10071static inline __attribute__((always_inline)) void
10072GFX11_MI_SET_PREDICATE_pack(__attribute__((unused)) __gen_user_data *data,
10073                            __attribute__((unused)) void * restrict dst,
10074                            __attribute__((unused)) const struct GFX11_MI_SET_PREDICATE * restrict values)
10075{
10076   uint32_t * restrict dw = (uint32_t * restrict) dst;
10077
10078   dw[0] =
10079      __gen_uint(values->PREDICATEENABLE, 0, 3) |
10080      __gen_uint(values->MICommandOpcode, 23, 28) |
10081      __gen_uint(values->CommandType, 29, 31);
10082}
10083
10084#define GFX11_MI_STORE_DATA_IMM_length         4
10085#define GFX11_MI_STORE_DATA_IMM_length_bias      2
10086#define GFX11_MI_STORE_DATA_IMM_header          \
10087   .DWordLength                         =      2,  \
10088   .MICommandOpcode                     =     32,  \
10089   .CommandType                         =      0
10090
10091struct GFX11_MI_STORE_DATA_IMM {
10092   uint32_t                             DWordLength;
10093   uint32_t                             StoreQword;
10094   bool                                 UseGlobalGTT;
10095   uint32_t                             MICommandOpcode;
10096   uint32_t                             CommandType;
10097   uint32_t                             CoreModeEnable;
10098   __gen_address_type                   Address;
10099   uint64_t                             ImmediateData;
10100};
10101
10102static inline __attribute__((always_inline)) void
10103GFX11_MI_STORE_DATA_IMM_pack(__attribute__((unused)) __gen_user_data *data,
10104                             __attribute__((unused)) void * restrict dst,
10105                             __attribute__((unused)) const struct GFX11_MI_STORE_DATA_IMM * restrict values)
10106{
10107   uint32_t * restrict dw = (uint32_t * restrict) dst;
10108
10109   dw[0] =
10110      __gen_uint(values->DWordLength, 0, 9) |
10111      __gen_uint(values->StoreQword, 21, 21) |
10112      __gen_uint(values->UseGlobalGTT, 22, 22) |
10113      __gen_uint(values->MICommandOpcode, 23, 28) |
10114      __gen_uint(values->CommandType, 29, 31);
10115
10116   const uint64_t v1 =
10117      __gen_uint(values->CoreModeEnable, 0, 0);
10118   const uint64_t v1_address =
10119      __gen_address(data, &dw[1], values->Address, v1, 2, 47);
10120   dw[1] = v1_address;
10121   dw[2] = (v1_address >> 32) | (v1 >> 32);
10122
10123   const uint64_t v3 =
10124      __gen_uint(values->ImmediateData, 0, 63);
10125   dw[3] = v3;
10126   dw[4] = v3 >> 32;
10127}
10128
10129#define GFX11_MI_STORE_DATA_INDEX_length       3
10130#define GFX11_MI_STORE_DATA_INDEX_length_bias      2
10131#define GFX11_MI_STORE_DATA_INDEX_header        \
10132   .DWordLength                         =      1,  \
10133   .MICommandOpcode                     =     33,  \
10134   .CommandType                         =      0
10135
10136struct GFX11_MI_STORE_DATA_INDEX {
10137   uint32_t                             DWordLength;
10138   uint32_t                             UsePerProcessHardwareStatusPage;
10139   uint32_t                             MICommandOpcode;
10140   uint32_t                             CommandType;
10141   uint32_t                             Offset;
10142   uint32_t                             DataDWord0;
10143   uint32_t                             DataDWord1;
10144};
10145
10146static inline __attribute__((always_inline)) void
10147GFX11_MI_STORE_DATA_INDEX_pack(__attribute__((unused)) __gen_user_data *data,
10148                               __attribute__((unused)) void * restrict dst,
10149                               __attribute__((unused)) const struct GFX11_MI_STORE_DATA_INDEX * restrict values)
10150{
10151   uint32_t * restrict dw = (uint32_t * restrict) dst;
10152
10153   dw[0] =
10154      __gen_uint(values->DWordLength, 0, 7) |
10155      __gen_uint(values->UsePerProcessHardwareStatusPage, 21, 21) |
10156      __gen_uint(values->MICommandOpcode, 23, 28) |
10157      __gen_uint(values->CommandType, 29, 31);
10158
10159   dw[1] =
10160      __gen_uint(values->Offset, 2, 11);
10161
10162   dw[2] =
10163      __gen_uint(values->DataDWord0, 0, 31);
10164}
10165
10166#define GFX11_MI_STORE_REGISTER_MEM_length      4
10167#define GFX11_MI_STORE_REGISTER_MEM_length_bias      2
10168#define GFX11_MI_STORE_REGISTER_MEM_header      \
10169   .DWordLength                         =      2,  \
10170   .MICommandOpcode                     =     36,  \
10171   .CommandType                         =      0
10172
10173struct GFX11_MI_STORE_REGISTER_MEM {
10174   uint32_t                             DWordLength;
10175   uint32_t                             AddCSMMIOStartOffset;
10176   bool                                 PredicateEnable;
10177   bool                                 UseGlobalGTT;
10178   uint32_t                             MICommandOpcode;
10179   uint32_t                             CommandType;
10180   uint64_t                             RegisterAddress;
10181   __gen_address_type                   MemoryAddress;
10182};
10183
10184static inline __attribute__((always_inline)) void
10185GFX11_MI_STORE_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
10186                                 __attribute__((unused)) void * restrict dst,
10187                                 __attribute__((unused)) const struct GFX11_MI_STORE_REGISTER_MEM * restrict values)
10188{
10189   uint32_t * restrict dw = (uint32_t * restrict) dst;
10190
10191   dw[0] =
10192      __gen_uint(values->DWordLength, 0, 7) |
10193      __gen_uint(values->AddCSMMIOStartOffset, 19, 19) |
10194      __gen_uint(values->PredicateEnable, 21, 21) |
10195      __gen_uint(values->UseGlobalGTT, 22, 22) |
10196      __gen_uint(values->MICommandOpcode, 23, 28) |
10197      __gen_uint(values->CommandType, 29, 31);
10198
10199   dw[1] =
10200      __gen_offset(values->RegisterAddress, 2, 22);
10201
10202   const uint64_t v2_address =
10203      __gen_address(data, &dw[2], values->MemoryAddress, 0, 2, 63);
10204   dw[2] = v2_address;
10205   dw[3] = v2_address >> 32;
10206}
10207
10208#define GFX11_MI_SUSPEND_FLUSH_length          1
10209#define GFX11_MI_SUSPEND_FLUSH_length_bias      1
10210#define GFX11_MI_SUSPEND_FLUSH_header           \
10211   .MICommandOpcode                     =     11,  \
10212   .CommandType                         =      0
10213
10214struct GFX11_MI_SUSPEND_FLUSH {
10215   bool                                 SuspendFlush;
10216   uint32_t                             MICommandOpcode;
10217   uint32_t                             CommandType;
10218};
10219
10220static inline __attribute__((always_inline)) void
10221GFX11_MI_SUSPEND_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
10222                            __attribute__((unused)) void * restrict dst,
10223                            __attribute__((unused)) const struct GFX11_MI_SUSPEND_FLUSH * restrict values)
10224{
10225   uint32_t * restrict dw = (uint32_t * restrict) dst;
10226
10227   dw[0] =
10228      __gen_uint(values->SuspendFlush, 0, 0) |
10229      __gen_uint(values->MICommandOpcode, 23, 28) |
10230      __gen_uint(values->CommandType, 29, 31);
10231}
10232
10233#define GFX11_MI_TOPOLOGY_FILTER_length        1
10234#define GFX11_MI_TOPOLOGY_FILTER_length_bias      1
10235#define GFX11_MI_TOPOLOGY_FILTER_header         \
10236   .MICommandOpcode                     =     13,  \
10237   .CommandType                         =      0
10238
10239struct GFX11_MI_TOPOLOGY_FILTER {
10240   enum GFX11_3D_Prim_Topo_Type         TopologyFilterValue;
10241   uint32_t                             MICommandOpcode;
10242   uint32_t                             CommandType;
10243};
10244
10245static inline __attribute__((always_inline)) void
10246GFX11_MI_TOPOLOGY_FILTER_pack(__attribute__((unused)) __gen_user_data *data,
10247                              __attribute__((unused)) void * restrict dst,
10248                              __attribute__((unused)) const struct GFX11_MI_TOPOLOGY_FILTER * restrict values)
10249{
10250   uint32_t * restrict dw = (uint32_t * restrict) dst;
10251
10252   dw[0] =
10253      __gen_uint(values->TopologyFilterValue, 0, 5) |
10254      __gen_uint(values->MICommandOpcode, 23, 28) |
10255      __gen_uint(values->CommandType, 29, 31);
10256}
10257
10258#define GFX11_MI_USER_INTERRUPT_length         1
10259#define GFX11_MI_USER_INTERRUPT_length_bias      1
10260#define GFX11_MI_USER_INTERRUPT_header          \
10261   .MICommandOpcode                     =      2,  \
10262   .CommandType                         =      0
10263
10264struct GFX11_MI_USER_INTERRUPT {
10265   uint32_t                             MICommandOpcode;
10266   uint32_t                             CommandType;
10267};
10268
10269static inline __attribute__((always_inline)) void
10270GFX11_MI_USER_INTERRUPT_pack(__attribute__((unused)) __gen_user_data *data,
10271                             __attribute__((unused)) void * restrict dst,
10272                             __attribute__((unused)) const struct GFX11_MI_USER_INTERRUPT * restrict values)
10273{
10274   uint32_t * restrict dw = (uint32_t * restrict) dst;
10275
10276   dw[0] =
10277      __gen_uint(values->MICommandOpcode, 23, 28) |
10278      __gen_uint(values->CommandType, 29, 31);
10279}
10280
10281#define GFX11_MI_WAIT_FOR_EVENT_length         1
10282#define GFX11_MI_WAIT_FOR_EVENT_length_bias      1
10283#define GFX11_MI_WAIT_FOR_EVENT_header          \
10284   .MICommandOpcode                     =      3,  \
10285   .CommandType                         =      0
10286
10287struct GFX11_MI_WAIT_FOR_EVENT {
10288   bool                                 DisplayPlnae1AScanLineWaitEnable;
10289   bool                                 DisplayPlane1FlipPendingWaitEnable;
10290   bool                                 DisplayPlane4FlipPendingWaitEnable;
10291   bool                                 DisplayPlane1AVerticalBlankWaitEnable;
10292   bool                                 DisplayPlane7FlipPendingWaitEnable;
10293   bool                                 DisplayPlane8FlipPendingWaitEnable;
10294   bool                                 DisplayPlane1BScanLineWaitEnable;
10295   bool                                 DisplayPlane2FlipPendingWaitEnable;
10296   bool                                 DisplayPlane5FlipPendingWaitEnable;
10297   bool                                 DisplayPlane1BVerticalBlankWaitEnable;
10298   bool                                 DisplayPlane1CScanLineWaitEnable;
10299   bool                                 DisplayPlane3FlipPendingWaitEnable;
10300   bool                                 DisplayPlane9FlipPendingWaitEnable;
10301   bool                                 DisplayPlane10FlipPendingWaitEnable;
10302   bool                                 DisplayPlane11FlipPendingWaitEnable;
10303   bool                                 DisplayPlane12FlipPendingWaitEnable;
10304   bool                                 DisplayPlane6FlipPendingWaitEnable;
10305   bool                                 DisplayPlane1CVerticalBlankWaitEnable;
10306   uint32_t                             MICommandOpcode;
10307   uint32_t                             CommandType;
10308};
10309
10310static inline __attribute__((always_inline)) void
10311GFX11_MI_WAIT_FOR_EVENT_pack(__attribute__((unused)) __gen_user_data *data,
10312                             __attribute__((unused)) void * restrict dst,
10313                             __attribute__((unused)) const struct GFX11_MI_WAIT_FOR_EVENT * restrict values)
10314{
10315   uint32_t * restrict dw = (uint32_t * restrict) dst;
10316
10317   dw[0] =
10318      __gen_uint(values->DisplayPlnae1AScanLineWaitEnable, 0, 0) |
10319      __gen_uint(values->DisplayPlane1FlipPendingWaitEnable, 1, 1) |
10320      __gen_uint(values->DisplayPlane4FlipPendingWaitEnable, 2, 2) |
10321      __gen_uint(values->DisplayPlane1AVerticalBlankWaitEnable, 3, 3) |
10322      __gen_uint(values->DisplayPlane7FlipPendingWaitEnable, 6, 6) |
10323      __gen_uint(values->DisplayPlane8FlipPendingWaitEnable, 7, 7) |
10324      __gen_uint(values->DisplayPlane1BScanLineWaitEnable, 8, 8) |
10325      __gen_uint(values->DisplayPlane2FlipPendingWaitEnable, 9, 9) |
10326      __gen_uint(values->DisplayPlane5FlipPendingWaitEnable, 10, 10) |
10327      __gen_uint(values->DisplayPlane1BVerticalBlankWaitEnable, 11, 11) |
10328      __gen_uint(values->DisplayPlane1CScanLineWaitEnable, 14, 14) |
10329      __gen_uint(values->DisplayPlane3FlipPendingWaitEnable, 15, 15) |
10330      __gen_uint(values->DisplayPlane9FlipPendingWaitEnable, 16, 16) |
10331      __gen_uint(values->DisplayPlane10FlipPendingWaitEnable, 17, 17) |
10332      __gen_uint(values->DisplayPlane11FlipPendingWaitEnable, 18, 18) |
10333      __gen_uint(values->DisplayPlane12FlipPendingWaitEnable, 19, 19) |
10334      __gen_uint(values->DisplayPlane6FlipPendingWaitEnable, 20, 20) |
10335      __gen_uint(values->DisplayPlane1CVerticalBlankWaitEnable, 21, 21) |
10336      __gen_uint(values->MICommandOpcode, 23, 28) |
10337      __gen_uint(values->CommandType, 29, 31);
10338}
10339
10340#define GFX11_MI_WAIT_FOR_EVENT_2_length       1
10341#define GFX11_MI_WAIT_FOR_EVENT_2_length_bias      1
10342#define GFX11_MI_WAIT_FOR_EVENT_2_header        \
10343   .MICommandOpcode                     =      4,  \
10344   .CommandType                         =      0
10345
10346struct GFX11_MI_WAIT_FOR_EVENT_2 {
10347   uint32_t                             DisplayPlaneFlipPendingWaitEnable;
10348   uint32_t                             DisplayPipeVerticalBlankWaitEnable;
10349   uint32_t                             DisplayPipeScanLineWaitEnable;
10350   uint32_t                             MICommandOpcode;
10351   uint32_t                             CommandType;
10352};
10353
10354static inline __attribute__((always_inline)) void
10355GFX11_MI_WAIT_FOR_EVENT_2_pack(__attribute__((unused)) __gen_user_data *data,
10356                               __attribute__((unused)) void * restrict dst,
10357                               __attribute__((unused)) const struct GFX11_MI_WAIT_FOR_EVENT_2 * restrict values)
10358{
10359   uint32_t * restrict dw = (uint32_t * restrict) dst;
10360
10361   dw[0] =
10362      __gen_uint(values->DisplayPlaneFlipPendingWaitEnable, 0, 5) |
10363      __gen_uint(values->DisplayPipeVerticalBlankWaitEnable, 8, 10) |
10364      __gen_uint(values->DisplayPipeScanLineWaitEnable, 12, 14) |
10365      __gen_uint(values->MICommandOpcode, 23, 28) |
10366      __gen_uint(values->CommandType, 29, 31);
10367}
10368
10369#define GFX11_PIPELINE_SELECT_length           1
10370#define GFX11_PIPELINE_SELECT_length_bias      1
10371#define GFX11_PIPELINE_SELECT_header            \
10372   ._3DCommandSubOpcode                 =      4,  \
10373   ._3DCommandOpcode                    =      1,  \
10374   .CommandSubType                      =      1,  \
10375   .CommandType                         =      3
10376
10377struct GFX11_PIPELINE_SELECT {
10378   uint32_t                             PipelineSelection;
10379#define _3D                                      0
10380#define Media                                    1
10381#define GPGPU                                    2
10382   bool                                 MediaSamplerDOPClockGateEnable;
10383   bool                                 ForceMediaAwake;
10384   uint32_t                             MaskBits;
10385   uint32_t                             _3DCommandSubOpcode;
10386   uint32_t                             _3DCommandOpcode;
10387   uint32_t                             CommandSubType;
10388   uint32_t                             CommandType;
10389};
10390
10391static inline __attribute__((always_inline)) void
10392GFX11_PIPELINE_SELECT_pack(__attribute__((unused)) __gen_user_data *data,
10393                           __attribute__((unused)) void * restrict dst,
10394                           __attribute__((unused)) const struct GFX11_PIPELINE_SELECT * restrict values)
10395{
10396   uint32_t * restrict dw = (uint32_t * restrict) dst;
10397
10398   dw[0] =
10399      __gen_uint(values->PipelineSelection, 0, 1) |
10400      __gen_uint(values->MediaSamplerDOPClockGateEnable, 4, 4) |
10401      __gen_uint(values->ForceMediaAwake, 5, 5) |
10402      __gen_uint(values->MaskBits, 8, 15) |
10403      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
10404      __gen_uint(values->_3DCommandOpcode, 24, 26) |
10405      __gen_uint(values->CommandSubType, 27, 28) |
10406      __gen_uint(values->CommandType, 29, 31);
10407}
10408
10409#define GFX11_PIPE_CONTROL_length              6
10410#define GFX11_PIPE_CONTROL_length_bias         2
10411#define GFX11_PIPE_CONTROL_header               \
10412   .DWordLength                         =      4,  \
10413   ._3DCommandSubOpcode                 =      0,  \
10414   ._3DCommandOpcode                    =      2,  \
10415   .CommandSubType                      =      3,  \
10416   .CommandType                         =      3
10417
10418struct GFX11_PIPE_CONTROL {
10419   uint32_t                             DWordLength;
10420   bool                                 HDCPipelineFlushEnable;
10421   uint32_t                             _3DCommandSubOpcode;
10422   uint32_t                             _3DCommandOpcode;
10423   uint32_t                             CommandSubType;
10424   uint32_t                             CommandType;
10425   bool                                 DepthCacheFlushEnable;
10426   bool                                 StallAtPixelScoreboard;
10427   bool                                 StateCacheInvalidationEnable;
10428   bool                                 ConstantCacheInvalidationEnable;
10429   bool                                 VFCacheInvalidationEnable;
10430   bool                                 DCFlushEnable;
10431   bool                                 PipeControlFlushEnable;
10432   bool                                 NotifyEnable;
10433   bool                                 IndirectStatePointersDisable;
10434   bool                                 TextureCacheInvalidationEnable;
10435   bool                                 InstructionCacheInvalidateEnable;
10436   bool                                 RenderTargetCacheFlushEnable;
10437   bool                                 DepthStallEnable;
10438   uint32_t                             PostSyncOperation;
10439#define NoWrite                                  0
10440#define WriteImmediateData                       1
10441#define WritePSDepthCount                        2
10442#define WriteTimestamp                           3
10443   bool                                 GenericMediaStateClear;
10444   bool                                 PSDSyncEnable;
10445   bool                                 TLBInvalidate;
10446   bool                                 GlobalSnapshotCountReset;
10447   bool                                 CommandStreamerStallEnable;
10448   uint32_t                             StoreDataIndex;
10449   uint32_t                             LRIPostSyncOperation;
10450#define NoLRIOperation                           0
10451#define MMIOWriteImmediateData                   1
10452   uint32_t                             DestinationAddressType;
10453#define DAT_PPGTT                                0
10454#define DAT_GGTT                                 1
10455   bool                                 FlushLLC;
10456   bool                                 CommandCacheInvalidateEnable;
10457   __gen_address_type                   Address;
10458   uint64_t                             ImmediateData;
10459};
10460
10461static inline __attribute__((always_inline)) void
10462GFX11_PIPE_CONTROL_pack(__attribute__((unused)) __gen_user_data *data,
10463                        __attribute__((unused)) void * restrict dst,
10464                        __attribute__((unused)) const struct GFX11_PIPE_CONTROL * restrict values)
10465{
10466   uint32_t * restrict dw = (uint32_t * restrict) dst;
10467
10468   dw[0] =
10469      __gen_uint(values->DWordLength, 0, 7) |
10470      __gen_uint(values->HDCPipelineFlushEnable, 9, 9) |
10471      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
10472      __gen_uint(values->_3DCommandOpcode, 24, 26) |
10473      __gen_uint(values->CommandSubType, 27, 28) |
10474      __gen_uint(values->CommandType, 29, 31);
10475
10476   dw[1] =
10477      __gen_uint(values->DepthCacheFlushEnable, 0, 0) |
10478      __gen_uint(values->StallAtPixelScoreboard, 1, 1) |
10479      __gen_uint(values->StateCacheInvalidationEnable, 2, 2) |
10480      __gen_uint(values->ConstantCacheInvalidationEnable, 3, 3) |
10481      __gen_uint(values->VFCacheInvalidationEnable, 4, 4) |
10482      __gen_uint(values->DCFlushEnable, 5, 5) |
10483      __gen_uint(values->PipeControlFlushEnable, 7, 7) |
10484      __gen_uint(values->NotifyEnable, 8, 8) |
10485      __gen_uint(values->IndirectStatePointersDisable, 9, 9) |
10486      __gen_uint(values->TextureCacheInvalidationEnable, 10, 10) |
10487      __gen_uint(values->InstructionCacheInvalidateEnable, 11, 11) |
10488      __gen_uint(values->RenderTargetCacheFlushEnable, 12, 12) |
10489      __gen_uint(values->DepthStallEnable, 13, 13) |
10490      __gen_uint(values->PostSyncOperation, 14, 15) |
10491      __gen_uint(values->GenericMediaStateClear, 16, 16) |
10492      __gen_uint(values->PSDSyncEnable, 17, 17) |
10493      __gen_uint(values->TLBInvalidate, 18, 18) |
10494      __gen_uint(values->GlobalSnapshotCountReset, 19, 19) |
10495      __gen_uint(values->CommandStreamerStallEnable, 20, 20) |
10496      __gen_uint(values->StoreDataIndex, 21, 21) |
10497      __gen_uint(values->LRIPostSyncOperation, 23, 23) |
10498      __gen_uint(values->DestinationAddressType, 24, 24) |
10499      __gen_uint(values->FlushLLC, 26, 26) |
10500      __gen_uint(values->CommandCacheInvalidateEnable, 29, 29);
10501
10502   const uint64_t v2_address =
10503      __gen_address(data, &dw[2], values->Address, 0, 2, 47);
10504   dw[2] = v2_address;
10505   dw[3] = v2_address >> 32;
10506
10507   const uint64_t v4 =
10508      __gen_uint(values->ImmediateData, 0, 63);
10509   dw[4] = v4;
10510   dw[5] = v4 >> 32;
10511}
10512
10513#define GFX11_STATE_BASE_ADDRESS_length       22
10514#define GFX11_STATE_BASE_ADDRESS_length_bias      2
10515#define GFX11_STATE_BASE_ADDRESS_header         \
10516   .DWordLength                         =     20,  \
10517   ._3DCommandSubOpcode                 =      1,  \
10518   ._3DCommandOpcode                    =      1,  \
10519   .CommandSubType                      =      0,  \
10520   .CommandType                         =      3
10521
10522struct GFX11_STATE_BASE_ADDRESS {
10523   uint32_t                             DWordLength;
10524   uint32_t                             _3DCommandSubOpcode;
10525   uint32_t                             _3DCommandOpcode;
10526   uint32_t                             CommandSubType;
10527   uint32_t                             CommandType;
10528   bool                                 GeneralStateBaseAddressModifyEnable;
10529   uint32_t                             GeneralStateMOCS;
10530   __gen_address_type                   GeneralStateBaseAddress;
10531   uint32_t                             StatelessDataPortAccessMOCS;
10532   bool                                 SurfaceStateBaseAddressModifyEnable;
10533   uint32_t                             SurfaceStateMOCS;
10534   __gen_address_type                   SurfaceStateBaseAddress;
10535   bool                                 DynamicStateBaseAddressModifyEnable;
10536   uint32_t                             DynamicStateMOCS;
10537   __gen_address_type                   DynamicStateBaseAddress;
10538   bool                                 IndirectObjectBaseAddressModifyEnable;
10539   uint32_t                             IndirectObjectMOCS;
10540   __gen_address_type                   IndirectObjectBaseAddress;
10541   bool                                 InstructionBaseAddressModifyEnable;
10542   uint32_t                             InstructionMOCS;
10543   __gen_address_type                   InstructionBaseAddress;
10544   bool                                 GeneralStateBufferSizeModifyEnable;
10545   uint32_t                             GeneralStateBufferSize;
10546   bool                                 DynamicStateBufferSizeModifyEnable;
10547   uint32_t                             DynamicStateBufferSize;
10548   bool                                 IndirectObjectBufferSizeModifyEnable;
10549   uint32_t                             IndirectObjectBufferSize;
10550   bool                                 InstructionBuffersizeModifyEnable;
10551   uint32_t                             InstructionBufferSize;
10552   bool                                 BindlessSurfaceStateBaseAddressModifyEnable;
10553   uint32_t                             BindlessSurfaceStateMOCS;
10554   __gen_address_type                   BindlessSurfaceStateBaseAddress;
10555   uint32_t                             BindlessSurfaceStateSize;
10556   bool                                 BindlessSamplerStateBaseAddressModifyEnable;
10557   uint32_t                             BindlessSamplerStateMOCS;
10558   __gen_address_type                   BindlessSamplerStateBaseAddress;
10559   uint32_t                             BindlessSamplerStateBufferSize;
10560};
10561
10562static inline __attribute__((always_inline)) void
10563GFX11_STATE_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
10564                              __attribute__((unused)) void * restrict dst,
10565                              __attribute__((unused)) const struct GFX11_STATE_BASE_ADDRESS * restrict values)
10566{
10567   uint32_t * restrict dw = (uint32_t * restrict) dst;
10568
10569   dw[0] =
10570      __gen_uint(values->DWordLength, 0, 7) |
10571      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
10572      __gen_uint(values->_3DCommandOpcode, 24, 26) |
10573      __gen_uint(values->CommandSubType, 27, 28) |
10574      __gen_uint(values->CommandType, 29, 31);
10575
10576   const uint64_t v1 =
10577      __gen_uint(values->GeneralStateBaseAddressModifyEnable, 0, 0) |
10578      __gen_uint(values->GeneralStateMOCS, 4, 10);
10579   const uint64_t v1_address =
10580      __gen_address(data, &dw[1], values->GeneralStateBaseAddress, v1, 12, 63);
10581   dw[1] = v1_address;
10582   dw[2] = (v1_address >> 32) | (v1 >> 32);
10583
10584   dw[3] =
10585      __gen_uint(values->StatelessDataPortAccessMOCS, 16, 22);
10586
10587   const uint64_t v4 =
10588      __gen_uint(values->SurfaceStateBaseAddressModifyEnable, 0, 0) |
10589      __gen_uint(values->SurfaceStateMOCS, 4, 10);
10590   const uint64_t v4_address =
10591      __gen_address(data, &dw[4], values->SurfaceStateBaseAddress, v4, 12, 63);
10592   dw[4] = v4_address;
10593   dw[5] = (v4_address >> 32) | (v4 >> 32);
10594
10595   const uint64_t v6 =
10596      __gen_uint(values->DynamicStateBaseAddressModifyEnable, 0, 0) |
10597      __gen_uint(values->DynamicStateMOCS, 4, 10);
10598   const uint64_t v6_address =
10599      __gen_address(data, &dw[6], values->DynamicStateBaseAddress, v6, 12, 63);
10600   dw[6] = v6_address;
10601   dw[7] = (v6_address >> 32) | (v6 >> 32);
10602
10603   const uint64_t v8 =
10604      __gen_uint(values->IndirectObjectBaseAddressModifyEnable, 0, 0) |
10605      __gen_uint(values->IndirectObjectMOCS, 4, 10);
10606   const uint64_t v8_address =
10607      __gen_address(data, &dw[8], values->IndirectObjectBaseAddress, v8, 12, 63);
10608   dw[8] = v8_address;
10609   dw[9] = (v8_address >> 32) | (v8 >> 32);
10610
10611   const uint64_t v10 =
10612      __gen_uint(values->InstructionBaseAddressModifyEnable, 0, 0) |
10613      __gen_uint(values->InstructionMOCS, 4, 10);
10614   const uint64_t v10_address =
10615      __gen_address(data, &dw[10], values->InstructionBaseAddress, v10, 12, 63);
10616   dw[10] = v10_address;
10617   dw[11] = (v10_address >> 32) | (v10 >> 32);
10618
10619   dw[12] =
10620      __gen_uint(values->GeneralStateBufferSizeModifyEnable, 0, 0) |
10621      __gen_uint(values->GeneralStateBufferSize, 12, 31);
10622
10623   dw[13] =
10624      __gen_uint(values->DynamicStateBufferSizeModifyEnable, 0, 0) |
10625      __gen_uint(values->DynamicStateBufferSize, 12, 31);
10626
10627   dw[14] =
10628      __gen_uint(values->IndirectObjectBufferSizeModifyEnable, 0, 0) |
10629      __gen_uint(values->IndirectObjectBufferSize, 12, 31);
10630
10631   dw[15] =
10632      __gen_uint(values->InstructionBuffersizeModifyEnable, 0, 0) |
10633      __gen_uint(values->InstructionBufferSize, 12, 31);
10634
10635   const uint64_t v16 =
10636      __gen_uint(values->BindlessSurfaceStateBaseAddressModifyEnable, 0, 0) |
10637      __gen_uint(values->BindlessSurfaceStateMOCS, 4, 10);
10638   const uint64_t v16_address =
10639      __gen_address(data, &dw[16], values->BindlessSurfaceStateBaseAddress, v16, 12, 63);
10640   dw[16] = v16_address;
10641   dw[17] = (v16_address >> 32) | (v16 >> 32);
10642
10643   dw[18] =
10644      __gen_uint(values->BindlessSurfaceStateSize, 12, 31);
10645
10646   const uint64_t v19 =
10647      __gen_uint(values->BindlessSamplerStateBaseAddressModifyEnable, 0, 0) |
10648      __gen_uint(values->BindlessSamplerStateMOCS, 4, 10);
10649   const uint64_t v19_address =
10650      __gen_address(data, &dw[19], values->BindlessSamplerStateBaseAddress, v19, 12, 63);
10651   dw[19] = v19_address;
10652   dw[20] = (v19_address >> 32) | (v19 >> 32);
10653
10654   dw[21] =
10655      __gen_uint(values->BindlessSamplerStateBufferSize, 12, 31);
10656}
10657
10658#define GFX11_STATE_SIP_length                 3
10659#define GFX11_STATE_SIP_length_bias            2
10660#define GFX11_STATE_SIP_header                  \
10661   .DWordLength                         =      1,  \
10662   ._3DCommandSubOpcode                 =      2,  \
10663   ._3DCommandOpcode                    =      1,  \
10664   .CommandSubType                      =      0,  \
10665   .CommandType                         =      3
10666
10667struct GFX11_STATE_SIP {
10668   uint32_t                             DWordLength;
10669   uint32_t                             _3DCommandSubOpcode;
10670   uint32_t                             _3DCommandOpcode;
10671   uint32_t                             CommandSubType;
10672   uint32_t                             CommandType;
10673   uint64_t                             SystemInstructionPointer;
10674};
10675
10676static inline __attribute__((always_inline)) void
10677GFX11_STATE_SIP_pack(__attribute__((unused)) __gen_user_data *data,
10678                     __attribute__((unused)) void * restrict dst,
10679                     __attribute__((unused)) const struct GFX11_STATE_SIP * restrict values)
10680{
10681   uint32_t * restrict dw = (uint32_t * restrict) dst;
10682
10683   dw[0] =
10684      __gen_uint(values->DWordLength, 0, 7) |
10685      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
10686      __gen_uint(values->_3DCommandOpcode, 24, 26) |
10687      __gen_uint(values->CommandSubType, 27, 28) |
10688      __gen_uint(values->CommandType, 29, 31);
10689
10690   const uint64_t v1 =
10691      __gen_offset(values->SystemInstructionPointer, 4, 63);
10692   dw[1] = v1;
10693   dw[2] = v1 >> 32;
10694}
10695
10696#define GFX11_3D_CHICKEN3_num             0x2090
10697#define GFX11_3D_CHICKEN3_length               1
10698struct GFX11_3D_CHICKEN3 {
10699   bool                                 AALineQualityFix;
10700   bool                                 AALineQualityFixMask;
10701};
10702
10703static inline __attribute__((always_inline)) void
10704GFX11_3D_CHICKEN3_pack(__attribute__((unused)) __gen_user_data *data,
10705                       __attribute__((unused)) void * restrict dst,
10706                       __attribute__((unused)) const struct GFX11_3D_CHICKEN3 * restrict values)
10707{
10708   uint32_t * restrict dw = (uint32_t * restrict) dst;
10709
10710   dw[0] =
10711      __gen_uint(values->AALineQualityFix, 5, 5) |
10712      __gen_uint(values->AALineQualityFixMask, 21, 21);
10713}
10714
10715#define GFX11_BCS_INSTDONE_num            0x2206c
10716#define GFX11_BCS_INSTDONE_length              1
10717struct GFX11_BCS_INSTDONE {
10718   bool                                 RingEnable;
10719   bool                                 BlitterIDLE;
10720   bool                                 GABIDLE;
10721   bool                                 BCSDone;
10722};
10723
10724static inline __attribute__((always_inline)) void
10725GFX11_BCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
10726                        __attribute__((unused)) void * restrict dst,
10727                        __attribute__((unused)) const struct GFX11_BCS_INSTDONE * restrict values)
10728{
10729   uint32_t * restrict dw = (uint32_t * restrict) dst;
10730
10731   dw[0] =
10732      __gen_uint(values->RingEnable, 0, 0) |
10733      __gen_uint(values->BlitterIDLE, 1, 1) |
10734      __gen_uint(values->GABIDLE, 2, 2) |
10735      __gen_uint(values->BCSDone, 3, 3);
10736}
10737
10738#define GFX11_CACHE_MODE_0_num            0x7000
10739#define GFX11_CACHE_MODE_0_length              1
10740struct GFX11_CACHE_MODE_0 {
10741   bool                                 DisableBytesharingfor3DTYFLOD1surfacesfor3264128bpp;
10742   bool                                 Disableclockgatinginthepixelbackend;
10743   bool                                 HierarchicalZDisable;
10744   bool                                 RCCEvictionPolicy;
10745   bool                                 STCPMAOptimizationDisable;
10746   bool                                 STCReadHitWonlyOptimizationDisable;
10747   bool                                 DepthRelatedCachePipelinedFlushDisable;
10748   bool                                 SamplerL2TLBPrefetchEnable;
10749   bool                                 RCZPMANotPromotedAllocationstalloptimizationDisableduetochangeindepthparameters;
10750   uint32_t                             MSAACompressionPlaneNumberThresholdforeLLC;
10751   bool                                 DisableRepackingforCompression;
10752   bool                                 DisableBytesharingfor3DTYFLOD1surfacesfor3264128bppMask;
10753   bool                                 DisableclockgatinginthepixelbackendMask;
10754   bool                                 HierarchicalZDisableMask;
10755   bool                                 RCCEvictionPolicyMask;
10756   bool                                 STCPMAOptimizationDisableMask;
10757   bool                                 STCReadHitWonlyOptimizationDisableMask;
10758   bool                                 DepthRelatedCachePipelinedFlushDisableMask;
10759   bool                                 SamplerL2TLBPrefetchEnableMask;
10760   bool                                 RCZPMANotPromotedAllocationstalloptimizationDisableduetochangeindepthparametersMask;
10761   uint32_t                             MSAACompressionPlaneNumberThresholdforeLLCMask;
10762   bool                                 DisableRepackingforCompressionMask;
10763};
10764
10765static inline __attribute__((always_inline)) void
10766GFX11_CACHE_MODE_0_pack(__attribute__((unused)) __gen_user_data *data,
10767                        __attribute__((unused)) void * restrict dst,
10768                        __attribute__((unused)) const struct GFX11_CACHE_MODE_0 * restrict values)
10769{
10770   uint32_t * restrict dw = (uint32_t * restrict) dst;
10771
10772   dw[0] =
10773      __gen_uint(values->DisableBytesharingfor3DTYFLOD1surfacesfor3264128bpp, 0, 0) |
10774      __gen_uint(values->Disableclockgatinginthepixelbackend, 1, 1) |
10775      __gen_uint(values->HierarchicalZDisable, 3, 3) |
10776      __gen_uint(values->RCCEvictionPolicy, 4, 4) |
10777      __gen_uint(values->STCPMAOptimizationDisable, 5, 5) |
10778      __gen_uint(values->STCReadHitWonlyOptimizationDisable, 6, 6) |
10779      __gen_uint(values->DepthRelatedCachePipelinedFlushDisable, 8, 8) |
10780      __gen_uint(values->SamplerL2TLBPrefetchEnable, 9, 9) |
10781      __gen_uint(values->RCZPMANotPromotedAllocationstalloptimizationDisableduetochangeindepthparameters, 10, 10) |
10782      __gen_uint(values->MSAACompressionPlaneNumberThresholdforeLLC, 12, 14) |
10783      __gen_uint(values->DisableRepackingforCompression, 15, 15) |
10784      __gen_uint(values->DisableBytesharingfor3DTYFLOD1surfacesfor3264128bppMask, 16, 16) |
10785      __gen_uint(values->DisableclockgatinginthepixelbackendMask, 17, 17) |
10786      __gen_uint(values->HierarchicalZDisableMask, 19, 19) |
10787      __gen_uint(values->RCCEvictionPolicyMask, 20, 20) |
10788      __gen_uint(values->STCPMAOptimizationDisableMask, 21, 21) |
10789      __gen_uint(values->STCReadHitWonlyOptimizationDisableMask, 22, 22) |
10790      __gen_uint(values->DepthRelatedCachePipelinedFlushDisableMask, 24, 24) |
10791      __gen_uint(values->SamplerL2TLBPrefetchEnableMask, 25, 25) |
10792      __gen_uint(values->RCZPMANotPromotedAllocationstalloptimizationDisableduetochangeindepthparametersMask, 26, 26) |
10793      __gen_uint(values->MSAACompressionPlaneNumberThresholdforeLLCMask, 28, 30) |
10794      __gen_uint(values->DisableRepackingforCompressionMask, 31, 31);
10795}
10796
10797#define GFX11_CACHE_MODE_1_num            0x7004
10798#define GFX11_CACHE_MODE_1_length              1
10799struct GFX11_CACHE_MODE_1 {
10800   bool                                 PartialResolveDisableInVC;
10801   bool                                 RCZPMAPromoted2NotPromotedAllocationstalloptimizationDisable;
10802   bool                                 MCSCacheDisable;
10803   bool                                 MSCRAWHazardAvoidanceBit;
10804   uint32_t                             NPEarlyZFailsDisable;
10805   bool                                 BlendOptimizationFixDisable;
10806   bool                                 ColorCompressionDisable;
10807   bool                                 PartialResolveDisableInVCMask;
10808   bool                                 RCZPMAPromoted2NotPromotedAllocationstalloptimizationDisableMask;
10809   bool                                 MCSCacheDisableMask;
10810   bool                                 MSCRAWHazardAvoidanceBitMask;
10811   bool                                 NPEarlyZFailsDisableMask;
10812   bool                                 BlendOptimizationFixDisableMask;
10813   bool                                 ColorCompressionDisableMask;
10814};
10815
10816static inline __attribute__((always_inline)) void
10817GFX11_CACHE_MODE_1_pack(__attribute__((unused)) __gen_user_data *data,
10818                        __attribute__((unused)) void * restrict dst,
10819                        __attribute__((unused)) const struct GFX11_CACHE_MODE_1 * restrict values)
10820{
10821   uint32_t * restrict dw = (uint32_t * restrict) dst;
10822
10823   dw[0] =
10824      __gen_uint(values->PartialResolveDisableInVC, 1, 1) |
10825      __gen_uint(values->RCZPMAPromoted2NotPromotedAllocationstalloptimizationDisable, 3, 3) |
10826      __gen_uint(values->MCSCacheDisable, 5, 5) |
10827      __gen_uint(values->MSCRAWHazardAvoidanceBit, 9, 9) |
10828      __gen_uint(values->NPEarlyZFailsDisable, 13, 13) |
10829      __gen_uint(values->BlendOptimizationFixDisable, 14, 14) |
10830      __gen_uint(values->ColorCompressionDisable, 15, 15) |
10831      __gen_uint(values->PartialResolveDisableInVCMask, 17, 17) |
10832      __gen_uint(values->RCZPMAPromoted2NotPromotedAllocationstalloptimizationDisableMask, 19, 19) |
10833      __gen_uint(values->MCSCacheDisableMask, 21, 21) |
10834      __gen_uint(values->MSCRAWHazardAvoidanceBitMask, 25, 25) |
10835      __gen_uint(values->NPEarlyZFailsDisableMask, 29, 29) |
10836      __gen_uint(values->BlendOptimizationFixDisableMask, 30, 30) |
10837      __gen_uint(values->ColorCompressionDisableMask, 31, 31);
10838}
10839
10840#define GFX11_GT_MODE_num                 0x7008
10841#define GFX11_GT_MODE_length                   1
10842struct GFX11_GT_MODE {
10843   uint32_t                             BindingTableAlignment;
10844#define BTP_15_5                                 0
10845#define BTP_18_8                                 1
10846   bool                                 BindingTableAlignmentMask;
10847};
10848
10849static inline __attribute__((always_inline)) void
10850GFX11_GT_MODE_pack(__attribute__((unused)) __gen_user_data *data,
10851                   __attribute__((unused)) void * restrict dst,
10852                   __attribute__((unused)) const struct GFX11_GT_MODE * restrict values)
10853{
10854   uint32_t * restrict dw = (uint32_t * restrict) dst;
10855
10856   dw[0] =
10857      __gen_uint(values->BindingTableAlignment, 10, 10) |
10858      __gen_uint(values->BindingTableAlignmentMask, 26, 26);
10859}
10860
10861#define GFX11_CACHE_MODE_SS_num           0xe420
10862#define GFX11_CACHE_MODE_SS_length             1
10863struct GFX11_CACHE_MODE_SS {
10864   bool                                 InstructionLevel1CacheDisable;
10865   bool                                 InstructionLevel1CacheandInFlightQueueDisable;
10866   bool                                 FloatBlendOptimizationEnable;
10867   bool                                 PerSampleBlendOptDisable;
10868   bool                                 InstructionLevel1CacheDisableMask;
10869   bool                                 InstructionLevel1CacheandInFlightQueueDisableMask;
10870   bool                                 FloatBlendOptimizationEnableMask;
10871   bool                                 PerSampleBlendOptDisableMask;
10872};
10873
10874static inline __attribute__((always_inline)) void
10875GFX11_CACHE_MODE_SS_pack(__attribute__((unused)) __gen_user_data *data,
10876                         __attribute__((unused)) void * restrict dst,
10877                         __attribute__((unused)) const struct GFX11_CACHE_MODE_SS * restrict values)
10878{
10879   uint32_t * restrict dw = (uint32_t * restrict) dst;
10880
10881   dw[0] =
10882      __gen_uint(values->InstructionLevel1CacheDisable, 0, 0) |
10883      __gen_uint(values->InstructionLevel1CacheandInFlightQueueDisable, 1, 1) |
10884      __gen_uint(values->FloatBlendOptimizationEnable, 4, 4) |
10885      __gen_uint(values->PerSampleBlendOptDisable, 11, 11) |
10886      __gen_uint(values->InstructionLevel1CacheDisableMask, 16, 16) |
10887      __gen_uint(values->InstructionLevel1CacheandInFlightQueueDisableMask, 17, 17) |
10888      __gen_uint(values->FloatBlendOptimizationEnableMask, 20, 20) |
10889      __gen_uint(values->PerSampleBlendOptDisableMask, 27, 27);
10890}
10891
10892#define GFX11_CL_INVOCATION_COUNT_num     0x2338
10893#define GFX11_CL_INVOCATION_COUNT_length       2
10894struct GFX11_CL_INVOCATION_COUNT {
10895   uint64_t                             CLInvocationCountReport;
10896};
10897
10898static inline __attribute__((always_inline)) void
10899GFX11_CL_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
10900                               __attribute__((unused)) void * restrict dst,
10901                               __attribute__((unused)) const struct GFX11_CL_INVOCATION_COUNT * restrict values)
10902{
10903   uint32_t * restrict dw = (uint32_t * restrict) dst;
10904
10905   const uint64_t v0 =
10906      __gen_uint(values->CLInvocationCountReport, 0, 63);
10907   dw[0] = v0;
10908   dw[1] = v0 >> 32;
10909}
10910
10911#define GFX11_CL_PRIMITIVES_COUNT_num     0x2340
10912#define GFX11_CL_PRIMITIVES_COUNT_length       2
10913struct GFX11_CL_PRIMITIVES_COUNT {
10914   uint64_t                             CLPrimitivesCountReport;
10915};
10916
10917static inline __attribute__((always_inline)) void
10918GFX11_CL_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
10919                               __attribute__((unused)) void * restrict dst,
10920                               __attribute__((unused)) const struct GFX11_CL_PRIMITIVES_COUNT * restrict values)
10921{
10922   uint32_t * restrict dw = (uint32_t * restrict) dst;
10923
10924   const uint64_t v0 =
10925      __gen_uint(values->CLPrimitivesCountReport, 0, 63);
10926   dw[0] = v0;
10927   dw[1] = v0 >> 32;
10928}
10929
10930#define GFX11_COMMON_SLICE_CHICKEN3_num   0x7304
10931#define GFX11_COMMON_SLICE_CHICKEN3_length      1
10932struct GFX11_COMMON_SLICE_CHICKEN3 {
10933   uint32_t                             PSThreadPanicDispatch;
10934   uint32_t                             PSThreadPanicDispatchMask;
10935};
10936
10937static inline __attribute__((always_inline)) void
10938GFX11_COMMON_SLICE_CHICKEN3_pack(__attribute__((unused)) __gen_user_data *data,
10939                                 __attribute__((unused)) void * restrict dst,
10940                                 __attribute__((unused)) const struct GFX11_COMMON_SLICE_CHICKEN3 * restrict values)
10941{
10942   uint32_t * restrict dw = (uint32_t * restrict) dst;
10943
10944   dw[0] =
10945      __gen_uint(values->PSThreadPanicDispatch, 6, 7) |
10946      __gen_uint(values->PSThreadPanicDispatchMask, 22, 23);
10947}
10948
10949#define GFX11_COMMON_SLICE_CHICKEN4_num   0x7300
10950#define GFX11_COMMON_SLICE_CHICKEN4_length      1
10951struct GFX11_COMMON_SLICE_CHICKEN4 {
10952   bool                                 EnableHardwareFilteringinWM;
10953   bool                                 EnableHardwareFilteringinWMMask;
10954};
10955
10956static inline __attribute__((always_inline)) void
10957GFX11_COMMON_SLICE_CHICKEN4_pack(__attribute__((unused)) __gen_user_data *data,
10958                                 __attribute__((unused)) void * restrict dst,
10959                                 __attribute__((unused)) const struct GFX11_COMMON_SLICE_CHICKEN4 * restrict values)
10960{
10961   uint32_t * restrict dw = (uint32_t * restrict) dst;
10962
10963   dw[0] =
10964      __gen_uint(values->EnableHardwareFilteringinWM, 5, 5) |
10965      __gen_uint(values->EnableHardwareFilteringinWMMask, 21, 21);
10966}
10967
10968#define GFX11_CS_CHICKEN1_num             0x2580
10969#define GFX11_CS_CHICKEN1_length               1
10970struct GFX11_CS_CHICKEN1 {
10971   uint32_t                             ReplayMode;
10972#define MidcmdbufferPreemption                   0
10973#define ObjectLevelPreemption                    1
10974   bool                                 ReplayModeMask;
10975};
10976
10977static inline __attribute__((always_inline)) void
10978GFX11_CS_CHICKEN1_pack(__attribute__((unused)) __gen_user_data *data,
10979                       __attribute__((unused)) void * restrict dst,
10980                       __attribute__((unused)) const struct GFX11_CS_CHICKEN1 * restrict values)
10981{
10982   uint32_t * restrict dw = (uint32_t * restrict) dst;
10983
10984   dw[0] =
10985      __gen_uint(values->ReplayMode, 0, 0) |
10986      __gen_uint(values->ReplayModeMask, 16, 16);
10987}
10988
10989#define GFX11_CS_DEBUG_MODE2_num          0x20d8
10990#define GFX11_CS_DEBUG_MODE2_length            1
10991struct GFX11_CS_DEBUG_MODE2 {
10992   bool                                 _3DRenderingInstructionDisable;
10993   bool                                 MediaInstructionDisable;
10994   bool                                 CONSTANT_BUFFERAddressOffsetDisable;
10995   bool                                 _3DRenderingInstructionDisableMask;
10996   bool                                 MediaInstructionDisableMask;
10997   bool                                 CONSTANT_BUFFERAddressOffsetDisableMask;
10998};
10999
11000static inline __attribute__((always_inline)) void
11001GFX11_CS_DEBUG_MODE2_pack(__attribute__((unused)) __gen_user_data *data,
11002                          __attribute__((unused)) void * restrict dst,
11003                          __attribute__((unused)) const struct GFX11_CS_DEBUG_MODE2 * restrict values)
11004{
11005   uint32_t * restrict dw = (uint32_t * restrict) dst;
11006
11007   dw[0] =
11008      __gen_uint(values->_3DRenderingInstructionDisable, 0, 0) |
11009      __gen_uint(values->MediaInstructionDisable, 1, 1) |
11010      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisable, 4, 4) |
11011      __gen_uint(values->_3DRenderingInstructionDisableMask, 16, 16) |
11012      __gen_uint(values->MediaInstructionDisableMask, 17, 17) |
11013      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisableMask, 20, 20);
11014}
11015
11016#define GFX11_CS_INVOCATION_COUNT_num     0x2290
11017#define GFX11_CS_INVOCATION_COUNT_length       2
11018struct GFX11_CS_INVOCATION_COUNT {
11019   uint64_t                             CSInvocationCountReport;
11020};
11021
11022static inline __attribute__((always_inline)) void
11023GFX11_CS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
11024                               __attribute__((unused)) void * restrict dst,
11025                               __attribute__((unused)) const struct GFX11_CS_INVOCATION_COUNT * restrict values)
11026{
11027   uint32_t * restrict dw = (uint32_t * restrict) dst;
11028
11029   const uint64_t v0 =
11030      __gen_uint(values->CSInvocationCountReport, 0, 63);
11031   dw[0] = v0;
11032   dw[1] = v0 >> 32;
11033}
11034
11035#define GFX11_DS_INVOCATION_COUNT_num     0x2308
11036#define GFX11_DS_INVOCATION_COUNT_length       2
11037struct GFX11_DS_INVOCATION_COUNT {
11038   uint64_t                             DSInvocationCountReport;
11039};
11040
11041static inline __attribute__((always_inline)) void
11042GFX11_DS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
11043                               __attribute__((unused)) void * restrict dst,
11044                               __attribute__((unused)) const struct GFX11_DS_INVOCATION_COUNT * restrict values)
11045{
11046   uint32_t * restrict dw = (uint32_t * restrict) dst;
11047
11048   const uint64_t v0 =
11049      __gen_uint(values->DSInvocationCountReport, 0, 63);
11050   dw[0] = v0;
11051   dw[1] = v0 >> 32;
11052}
11053
11054#define GFX11_GS_INVOCATION_COUNT_num     0x2328
11055#define GFX11_GS_INVOCATION_COUNT_length       2
11056struct GFX11_GS_INVOCATION_COUNT {
11057   uint64_t                             GSInvocationCountReport;
11058};
11059
11060static inline __attribute__((always_inline)) void
11061GFX11_GS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
11062                               __attribute__((unused)) void * restrict dst,
11063                               __attribute__((unused)) const struct GFX11_GS_INVOCATION_COUNT * restrict values)
11064{
11065   uint32_t * restrict dw = (uint32_t * restrict) dst;
11066
11067   const uint64_t v0 =
11068      __gen_uint(values->GSInvocationCountReport, 0, 63);
11069   dw[0] = v0;
11070   dw[1] = v0 >> 32;
11071}
11072
11073#define GFX11_GS_PRIMITIVES_COUNT_num     0x2330
11074#define GFX11_GS_PRIMITIVES_COUNT_length       2
11075struct GFX11_GS_PRIMITIVES_COUNT {
11076   uint64_t                             GSPrimitivesCountReport;
11077};
11078
11079static inline __attribute__((always_inline)) void
11080GFX11_GS_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
11081                               __attribute__((unused)) void * restrict dst,
11082                               __attribute__((unused)) const struct GFX11_GS_PRIMITIVES_COUNT * restrict values)
11083{
11084   uint32_t * restrict dw = (uint32_t * restrict) dst;
11085
11086   const uint64_t v0 =
11087      __gen_uint(values->GSPrimitivesCountReport, 0, 63);
11088   dw[0] = v0;
11089   dw[1] = v0 >> 32;
11090}
11091
11092#define GFX11_HALF_SLICE_CHICKEN7_num     0xe194
11093#define GFX11_HALF_SLICE_CHICKEN7_length       1
11094struct GFX11_HALF_SLICE_CHICKEN7 {
11095   bool                                 EnabledTexelOffsetPrecisionFix;
11096   bool                                 EnabledTexelOffsetPrecisionFixMask;
11097};
11098
11099static inline __attribute__((always_inline)) void
11100GFX11_HALF_SLICE_CHICKEN7_pack(__attribute__((unused)) __gen_user_data *data,
11101                               __attribute__((unused)) void * restrict dst,
11102                               __attribute__((unused)) const struct GFX11_HALF_SLICE_CHICKEN7 * restrict values)
11103{
11104   uint32_t * restrict dw = (uint32_t * restrict) dst;
11105
11106   dw[0] =
11107      __gen_uint(values->EnabledTexelOffsetPrecisionFix, 1, 1) |
11108      __gen_uint(values->EnabledTexelOffsetPrecisionFixMask, 17, 17);
11109}
11110
11111#define GFX11_HS_INVOCATION_COUNT_num     0x2300
11112#define GFX11_HS_INVOCATION_COUNT_length       2
11113struct GFX11_HS_INVOCATION_COUNT {
11114   uint64_t                             HSInvocationCountReport;
11115};
11116
11117static inline __attribute__((always_inline)) void
11118GFX11_HS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
11119                               __attribute__((unused)) void * restrict dst,
11120                               __attribute__((unused)) const struct GFX11_HS_INVOCATION_COUNT * restrict values)
11121{
11122   uint32_t * restrict dw = (uint32_t * restrict) dst;
11123
11124   const uint64_t v0 =
11125      __gen_uint(values->HSInvocationCountReport, 0, 63);
11126   dw[0] = v0;
11127   dw[1] = v0 >> 32;
11128}
11129
11130#define GFX11_IA_PRIMITIVES_COUNT_num     0x2318
11131#define GFX11_IA_PRIMITIVES_COUNT_length       2
11132struct GFX11_IA_PRIMITIVES_COUNT {
11133   uint64_t                             IAPrimitivesCountReport;
11134};
11135
11136static inline __attribute__((always_inline)) void
11137GFX11_IA_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
11138                               __attribute__((unused)) void * restrict dst,
11139                               __attribute__((unused)) const struct GFX11_IA_PRIMITIVES_COUNT * restrict values)
11140{
11141   uint32_t * restrict dw = (uint32_t * restrict) dst;
11142
11143   const uint64_t v0 =
11144      __gen_uint(values->IAPrimitivesCountReport, 0, 63);
11145   dw[0] = v0;
11146   dw[1] = v0 >> 32;
11147}
11148
11149#define GFX11_IA_VERTICES_COUNT_num       0x2310
11150#define GFX11_IA_VERTICES_COUNT_length         2
11151struct GFX11_IA_VERTICES_COUNT {
11152   uint64_t                             IAVerticesCountReport;
11153};
11154
11155static inline __attribute__((always_inline)) void
11156GFX11_IA_VERTICES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
11157                             __attribute__((unused)) void * restrict dst,
11158                             __attribute__((unused)) const struct GFX11_IA_VERTICES_COUNT * restrict values)
11159{
11160   uint32_t * restrict dw = (uint32_t * restrict) dst;
11161
11162   const uint64_t v0 =
11163      __gen_uint(values->IAVerticesCountReport, 0, 63);
11164   dw[0] = v0;
11165   dw[1] = v0 >> 32;
11166}
11167
11168#define GFX11_INSTDONE_1_num              0x206c
11169#define GFX11_INSTDONE_1_length                1
11170struct GFX11_INSTDONE_1 {
11171   bool                                 PRB0RingEnable;
11172   bool                                 VFGDone;
11173   bool                                 VSDone;
11174   bool                                 HSDone;
11175   bool                                 TEDone;
11176   bool                                 DSDone;
11177   bool                                 GSDone;
11178   bool                                 SOLDone;
11179   bool                                 CLDone;
11180   bool                                 SFDone;
11181   bool                                 TDG1Done;
11182   bool                                 TDG0Done;
11183   bool                                 URBMDone;
11184   bool                                 SVGDone;
11185   bool                                 GAFSDone;
11186   bool                                 VFEDone;
11187   bool                                 TSG0Done;
11188   bool                                 GAFMDone;
11189   bool                                 GAMDone;
11190   bool                                 RSDone;
11191   bool                                 CSDone;
11192   bool                                 SDEDone;
11193   bool                                 RCCFBCCSDone;
11194   bool                                 TSG1Done;
11195};
11196
11197static inline __attribute__((always_inline)) void
11198GFX11_INSTDONE_1_pack(__attribute__((unused)) __gen_user_data *data,
11199                      __attribute__((unused)) void * restrict dst,
11200                      __attribute__((unused)) const struct GFX11_INSTDONE_1 * restrict values)
11201{
11202   uint32_t * restrict dw = (uint32_t * restrict) dst;
11203
11204   dw[0] =
11205      __gen_uint(values->PRB0RingEnable, 0, 0) |
11206      __gen_uint(values->VFGDone, 1, 1) |
11207      __gen_uint(values->VSDone, 2, 2) |
11208      __gen_uint(values->HSDone, 3, 3) |
11209      __gen_uint(values->TEDone, 4, 4) |
11210      __gen_uint(values->DSDone, 5, 5) |
11211      __gen_uint(values->GSDone, 6, 6) |
11212      __gen_uint(values->SOLDone, 7, 7) |
11213      __gen_uint(values->CLDone, 8, 8) |
11214      __gen_uint(values->SFDone, 9, 9) |
11215      __gen_uint(values->TDG1Done, 11, 11) |
11216      __gen_uint(values->TDG0Done, 12, 12) |
11217      __gen_uint(values->URBMDone, 13, 13) |
11218      __gen_uint(values->SVGDone, 14, 14) |
11219      __gen_uint(values->GAFSDone, 15, 15) |
11220      __gen_uint(values->VFEDone, 16, 16) |
11221      __gen_uint(values->TSG0Done, 17, 17) |
11222      __gen_uint(values->GAFMDone, 18, 18) |
11223      __gen_uint(values->GAMDone, 19, 19) |
11224      __gen_uint(values->RSDone, 20, 20) |
11225      __gen_uint(values->CSDone, 21, 21) |
11226      __gen_uint(values->SDEDone, 22, 22) |
11227      __gen_uint(values->RCCFBCCSDone, 23, 23) |
11228      __gen_uint(values->TSG1Done, 24, 24);
11229}
11230
11231#define GFX11_L3CNTLREG_num               0x7034
11232#define GFX11_L3CNTLREG_length                 1
11233struct GFX11_L3CNTLREG {
11234   uint32_t                             URBAllocation;
11235   bool                                 ErrorDetectionBehaviorControl;
11236   bool                                 UseFullWays;
11237   uint32_t                             ROAllocation;
11238   uint32_t                             DCAllocation;
11239   uint32_t                             AllAllocation;
11240};
11241
11242static inline __attribute__((always_inline)) void
11243GFX11_L3CNTLREG_pack(__attribute__((unused)) __gen_user_data *data,
11244                     __attribute__((unused)) void * restrict dst,
11245                     __attribute__((unused)) const struct GFX11_L3CNTLREG * restrict values)
11246{
11247   uint32_t * restrict dw = (uint32_t * restrict) dst;
11248
11249   dw[0] =
11250      __gen_uint(values->URBAllocation, 1, 7) |
11251      __gen_uint(values->ErrorDetectionBehaviorControl, 9, 9) |
11252      __gen_uint(values->UseFullWays, 10, 10) |
11253      __gen_uint(values->ROAllocation, 11, 17) |
11254      __gen_uint(values->DCAllocation, 18, 24) |
11255      __gen_uint(values->AllAllocation, 25, 31);
11256}
11257
11258#define GFX11_PERFCNT1_num                0x91b8
11259#define GFX11_PERFCNT1_length                  2
11260struct GFX11_PERFCNT1 {
11261   uint64_t                             Value;
11262   uint32_t                             EventSelection;
11263   bool                                 CounterClear;
11264   bool                                 EdgeDetect;
11265   bool                                 OverflowEnable;
11266   bool                                 CounterEnable;
11267};
11268
11269static inline __attribute__((always_inline)) void
11270GFX11_PERFCNT1_pack(__attribute__((unused)) __gen_user_data *data,
11271                    __attribute__((unused)) void * restrict dst,
11272                    __attribute__((unused)) const struct GFX11_PERFCNT1 * restrict values)
11273{
11274   uint32_t * restrict dw = (uint32_t * restrict) dst;
11275
11276   const uint64_t v0 =
11277      __gen_uint(values->Value, 0, 43) |
11278      __gen_uint(values->EventSelection, 52, 59) |
11279      __gen_uint(values->CounterClear, 60, 60) |
11280      __gen_uint(values->EdgeDetect, 61, 61) |
11281      __gen_uint(values->OverflowEnable, 62, 62) |
11282      __gen_uint(values->CounterEnable, 63, 63);
11283   dw[0] = v0;
11284   dw[1] = v0 >> 32;
11285}
11286
11287#define GFX11_PERFCNT2_num                0x91c0
11288#define GFX11_PERFCNT2_length                  2
11289struct GFX11_PERFCNT2 {
11290   uint64_t                             Value;
11291   uint32_t                             EventSelection;
11292   bool                                 CounterClear;
11293   bool                                 EdgeDetect;
11294   bool                                 OverflowEnable;
11295   bool                                 CounterEnable;
11296};
11297
11298static inline __attribute__((always_inline)) void
11299GFX11_PERFCNT2_pack(__attribute__((unused)) __gen_user_data *data,
11300                    __attribute__((unused)) void * restrict dst,
11301                    __attribute__((unused)) const struct GFX11_PERFCNT2 * restrict values)
11302{
11303   uint32_t * restrict dw = (uint32_t * restrict) dst;
11304
11305   const uint64_t v0 =
11306      __gen_uint(values->Value, 0, 43) |
11307      __gen_uint(values->EventSelection, 52, 59) |
11308      __gen_uint(values->CounterClear, 60, 60) |
11309      __gen_uint(values->EdgeDetect, 61, 61) |
11310      __gen_uint(values->OverflowEnable, 62, 62) |
11311      __gen_uint(values->CounterEnable, 63, 63);
11312   dw[0] = v0;
11313   dw[1] = v0 >> 32;
11314}
11315
11316#define GFX11_PS_INVOCATION_COUNT_num     0x2348
11317#define GFX11_PS_INVOCATION_COUNT_length       2
11318struct GFX11_PS_INVOCATION_COUNT {
11319   uint64_t                             PSInvocationCountReport;
11320};
11321
11322static inline __attribute__((always_inline)) void
11323GFX11_PS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
11324                               __attribute__((unused)) void * restrict dst,
11325                               __attribute__((unused)) const struct GFX11_PS_INVOCATION_COUNT * restrict values)
11326{
11327   uint32_t * restrict dw = (uint32_t * restrict) dst;
11328
11329   const uint64_t v0 =
11330      __gen_uint(values->PSInvocationCountReport, 0, 63);
11331   dw[0] = v0;
11332   dw[1] = v0 >> 32;
11333}
11334
11335#define GFX11_ROW_INSTDONE_num            0xe164
11336#define GFX11_ROW_INSTDONE_length              1
11337struct GFX11_ROW_INSTDONE {
11338   bool                                 BCDone;
11339   bool                                 PSDDone;
11340   bool                                 DAPRDone;
11341   bool                                 TDLDone;
11342   bool                                 ICDone;
11343   bool                                 MA0Done;
11344   bool                                 EU00DoneSS0;
11345   bool                                 EU01DoneSS0;
11346   bool                                 EU02DoneSS0;
11347   bool                                 EU03DoneSS0;
11348   bool                                 EU10DoneSS0;
11349   bool                                 EU11DoneSS0;
11350   bool                                 EU12DoneSS0;
11351   bool                                 EU13DoneSS0;
11352   bool                                 MA1DoneSS0;
11353};
11354
11355static inline __attribute__((always_inline)) void
11356GFX11_ROW_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
11357                        __attribute__((unused)) void * restrict dst,
11358                        __attribute__((unused)) const struct GFX11_ROW_INSTDONE * restrict values)
11359{
11360   uint32_t * restrict dw = (uint32_t * restrict) dst;
11361
11362   dw[0] =
11363      __gen_uint(values->BCDone, 0, 0) |
11364      __gen_uint(values->PSDDone, 1, 1) |
11365      __gen_uint(values->DAPRDone, 3, 3) |
11366      __gen_uint(values->TDLDone, 6, 6) |
11367      __gen_uint(values->ICDone, 12, 12) |
11368      __gen_uint(values->MA0Done, 15, 15) |
11369      __gen_uint(values->EU00DoneSS0, 16, 16) |
11370      __gen_uint(values->EU01DoneSS0, 17, 17) |
11371      __gen_uint(values->EU02DoneSS0, 18, 18) |
11372      __gen_uint(values->EU03DoneSS0, 19, 19) |
11373      __gen_uint(values->EU10DoneSS0, 21, 21) |
11374      __gen_uint(values->EU11DoneSS0, 22, 22) |
11375      __gen_uint(values->EU12DoneSS0, 23, 23) |
11376      __gen_uint(values->EU13DoneSS0, 24, 24) |
11377      __gen_uint(values->MA1DoneSS0, 26, 26);
11378}
11379
11380#define GFX11_RPSTAT0_num                 0xa01c
11381#define GFX11_RPSTAT0_length                   1
11382struct GFX11_RPSTAT0 {
11383   uint32_t                             PreviousGTFrequency;
11384   uint32_t                             CurrentGTFrequency;
11385};
11386
11387static inline __attribute__((always_inline)) void
11388GFX11_RPSTAT0_pack(__attribute__((unused)) __gen_user_data *data,
11389                   __attribute__((unused)) void * restrict dst,
11390                   __attribute__((unused)) const struct GFX11_RPSTAT0 * restrict values)
11391{
11392   uint32_t * restrict dw = (uint32_t * restrict) dst;
11393
11394   dw[0] =
11395      __gen_uint(values->PreviousGTFrequency, 0, 8) |
11396      __gen_uint(values->CurrentGTFrequency, 23, 31);
11397}
11398
11399#define GFX11_SAMPLER_INSTDONE_num        0xe160
11400#define GFX11_SAMPLER_INSTDONE_length          1
11401struct GFX11_SAMPLER_INSTDONE {
11402   bool                                 IMEDone;
11403   bool                                 PL0Done;
11404   bool                                 SO0Done;
11405   bool                                 DG0Done;
11406   bool                                 FT0Done;
11407   bool                                 DM0Done;
11408   bool                                 SCDone;
11409   bool                                 FL0Done;
11410   bool                                 QCDone;
11411   bool                                 SVSMDone;
11412   bool                                 SI0Done;
11413   bool                                 MT0Done;
11414   bool                                 AVSDone;
11415   bool                                 IEFDone;
11416   bool                                 CREDone;
11417   bool                                 SVSM_ARB_SIFM;
11418   bool                                 SVSMARB2;
11419   bool                                 SVSMARB1;
11420   bool                                 SVSMAdapter;
11421   bool                                 BDMDone;
11422};
11423
11424static inline __attribute__((always_inline)) void
11425GFX11_SAMPLER_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
11426                            __attribute__((unused)) void * restrict dst,
11427                            __attribute__((unused)) const struct GFX11_SAMPLER_INSTDONE * restrict values)
11428{
11429   uint32_t * restrict dw = (uint32_t * restrict) dst;
11430
11431   dw[0] =
11432      __gen_uint(values->IMEDone, 0, 0) |
11433      __gen_uint(values->PL0Done, 1, 1) |
11434      __gen_uint(values->SO0Done, 2, 2) |
11435      __gen_uint(values->DG0Done, 3, 3) |
11436      __gen_uint(values->FT0Done, 4, 4) |
11437      __gen_uint(values->DM0Done, 5, 5) |
11438      __gen_uint(values->SCDone, 6, 6) |
11439      __gen_uint(values->FL0Done, 7, 7) |
11440      __gen_uint(values->QCDone, 8, 8) |
11441      __gen_uint(values->SVSMDone, 9, 9) |
11442      __gen_uint(values->SI0Done, 10, 10) |
11443      __gen_uint(values->MT0Done, 11, 11) |
11444      __gen_uint(values->AVSDone, 12, 12) |
11445      __gen_uint(values->IEFDone, 13, 13) |
11446      __gen_uint(values->CREDone, 14, 14) |
11447      __gen_uint(values->SVSM_ARB_SIFM, 15, 15) |
11448      __gen_uint(values->SVSMARB2, 16, 16) |
11449      __gen_uint(values->SVSMARB1, 17, 17) |
11450      __gen_uint(values->SVSMAdapter, 18, 18) |
11451      __gen_uint(values->BDMDone, 19, 19);
11452}
11453
11454#define GFX11_SAMPLER_MODE_num            0xe18c
11455#define GFX11_SAMPLER_MODE_length              1
11456struct GFX11_SAMPLER_MODE {
11457   bool                                 HeaderlessMessageforPreemptableContexts;
11458   bool                                 HeaderlessMessageforPreemptableContextsMask;
11459};
11460
11461static inline __attribute__((always_inline)) void
11462GFX11_SAMPLER_MODE_pack(__attribute__((unused)) __gen_user_data *data,
11463                        __attribute__((unused)) void * restrict dst,
11464                        __attribute__((unused)) const struct GFX11_SAMPLER_MODE * restrict values)
11465{
11466   uint32_t * restrict dw = (uint32_t * restrict) dst;
11467
11468   dw[0] =
11469      __gen_uint(values->HeaderlessMessageforPreemptableContexts, 5, 5) |
11470      __gen_uint(values->HeaderlessMessageforPreemptableContextsMask, 21, 21);
11471}
11472
11473#define GFX11_SC_INSTDONE_num             0x7100
11474#define GFX11_SC_INSTDONE_length               1
11475struct GFX11_SC_INSTDONE {
11476   bool                                 SVLDone;
11477   bool                                 WMFEDone;
11478   bool                                 WMBEDone;
11479   bool                                 HIZDone;
11480   bool                                 STCDone;
11481   bool                                 IZDone;
11482   bool                                 SBEDone;
11483   bool                                 RCZDone;
11484   bool                                 RCCDone;
11485   bool                                 RCPBEDone;
11486   bool                                 RCPFEDone;
11487   bool                                 DAPBDone;
11488   bool                                 DAPRBEDone;
11489   bool                                 SARBDone;
11490   bool                                 DC0Done;
11491   bool                                 DC1Done;
11492   bool                                 DC2Done;
11493   bool                                 DC3Done;
11494   bool                                 GW0Done;
11495   bool                                 GW1Done;
11496   bool                                 GW2Done;
11497   bool                                 GW3Done;
11498   bool                                 TDCDone;
11499   bool                                 SFBEDone;
11500};
11501
11502static inline __attribute__((always_inline)) void
11503GFX11_SC_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
11504                       __attribute__((unused)) void * restrict dst,
11505                       __attribute__((unused)) const struct GFX11_SC_INSTDONE * restrict values)
11506{
11507   uint32_t * restrict dw = (uint32_t * restrict) dst;
11508
11509   dw[0] =
11510      __gen_uint(values->SVLDone, 0, 0) |
11511      __gen_uint(values->WMFEDone, 1, 1) |
11512      __gen_uint(values->WMBEDone, 2, 2) |
11513      __gen_uint(values->HIZDone, 3, 3) |
11514      __gen_uint(values->STCDone, 4, 4) |
11515      __gen_uint(values->IZDone, 5, 5) |
11516      __gen_uint(values->SBEDone, 6, 6) |
11517      __gen_uint(values->RCZDone, 8, 8) |
11518      __gen_uint(values->RCCDone, 9, 9) |
11519      __gen_uint(values->RCPBEDone, 10, 10) |
11520      __gen_uint(values->RCPFEDone, 11, 11) |
11521      __gen_uint(values->DAPBDone, 12, 12) |
11522      __gen_uint(values->DAPRBEDone, 13, 13) |
11523      __gen_uint(values->SARBDone, 15, 15) |
11524      __gen_uint(values->DC0Done, 16, 16) |
11525      __gen_uint(values->DC1Done, 17, 17) |
11526      __gen_uint(values->DC2Done, 18, 18) |
11527      __gen_uint(values->DC3Done, 19, 19) |
11528      __gen_uint(values->GW0Done, 20, 20) |
11529      __gen_uint(values->GW1Done, 21, 21) |
11530      __gen_uint(values->GW2Done, 22, 22) |
11531      __gen_uint(values->GW3Done, 23, 23) |
11532      __gen_uint(values->TDCDone, 24, 24) |
11533      __gen_uint(values->SFBEDone, 25, 25);
11534}
11535
11536#define GFX11_SLICE_COMMON_ECO_CHICKEN1_num 0x731c
11537#define GFX11_SLICE_COMMON_ECO_CHICKEN1_length      1
11538struct GFX11_SLICE_COMMON_ECO_CHICKEN1 {
11539   bool                                 StateCacheRedirectToCSSectionEnable;
11540   bool                                 StateCacheRedirectToCSSectionEnableMask;
11541};
11542
11543static inline __attribute__((always_inline)) void
11544GFX11_SLICE_COMMON_ECO_CHICKEN1_pack(__attribute__((unused)) __gen_user_data *data,
11545                                     __attribute__((unused)) void * restrict dst,
11546                                     __attribute__((unused)) const struct GFX11_SLICE_COMMON_ECO_CHICKEN1 * restrict values)
11547{
11548   uint32_t * restrict dw = (uint32_t * restrict) dst;
11549
11550   dw[0] =
11551      __gen_uint(values->StateCacheRedirectToCSSectionEnable, 11, 11) |
11552      __gen_uint(values->StateCacheRedirectToCSSectionEnableMask, 27, 27);
11553}
11554
11555#define GFX11_SO_NUM_PRIMS_WRITTEN0_num   0x5200
11556#define GFX11_SO_NUM_PRIMS_WRITTEN0_length      2
11557struct GFX11_SO_NUM_PRIMS_WRITTEN0 {
11558   uint64_t                             NumPrimsWrittenCount;
11559};
11560
11561static inline __attribute__((always_inline)) void
11562GFX11_SO_NUM_PRIMS_WRITTEN0_pack(__attribute__((unused)) __gen_user_data *data,
11563                                 __attribute__((unused)) void * restrict dst,
11564                                 __attribute__((unused)) const struct GFX11_SO_NUM_PRIMS_WRITTEN0 * restrict values)
11565{
11566   uint32_t * restrict dw = (uint32_t * restrict) dst;
11567
11568   const uint64_t v0 =
11569      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
11570   dw[0] = v0;
11571   dw[1] = v0 >> 32;
11572}
11573
11574#define GFX11_SO_NUM_PRIMS_WRITTEN1_num   0x5208
11575#define GFX11_SO_NUM_PRIMS_WRITTEN1_length      2
11576struct GFX11_SO_NUM_PRIMS_WRITTEN1 {
11577   uint64_t                             NumPrimsWrittenCount;
11578};
11579
11580static inline __attribute__((always_inline)) void
11581GFX11_SO_NUM_PRIMS_WRITTEN1_pack(__attribute__((unused)) __gen_user_data *data,
11582                                 __attribute__((unused)) void * restrict dst,
11583                                 __attribute__((unused)) const struct GFX11_SO_NUM_PRIMS_WRITTEN1 * restrict values)
11584{
11585   uint32_t * restrict dw = (uint32_t * restrict) dst;
11586
11587   const uint64_t v0 =
11588      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
11589   dw[0] = v0;
11590   dw[1] = v0 >> 32;
11591}
11592
11593#define GFX11_SO_NUM_PRIMS_WRITTEN2_num   0x5210
11594#define GFX11_SO_NUM_PRIMS_WRITTEN2_length      2
11595struct GFX11_SO_NUM_PRIMS_WRITTEN2 {
11596   uint64_t                             NumPrimsWrittenCount;
11597};
11598
11599static inline __attribute__((always_inline)) void
11600GFX11_SO_NUM_PRIMS_WRITTEN2_pack(__attribute__((unused)) __gen_user_data *data,
11601                                 __attribute__((unused)) void * restrict dst,
11602                                 __attribute__((unused)) const struct GFX11_SO_NUM_PRIMS_WRITTEN2 * restrict values)
11603{
11604   uint32_t * restrict dw = (uint32_t * restrict) dst;
11605
11606   const uint64_t v0 =
11607      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
11608   dw[0] = v0;
11609   dw[1] = v0 >> 32;
11610}
11611
11612#define GFX11_SO_NUM_PRIMS_WRITTEN3_num   0x5218
11613#define GFX11_SO_NUM_PRIMS_WRITTEN3_length      2
11614struct GFX11_SO_NUM_PRIMS_WRITTEN3 {
11615   uint64_t                             NumPrimsWrittenCount;
11616};
11617
11618static inline __attribute__((always_inline)) void
11619GFX11_SO_NUM_PRIMS_WRITTEN3_pack(__attribute__((unused)) __gen_user_data *data,
11620                                 __attribute__((unused)) void * restrict dst,
11621                                 __attribute__((unused)) const struct GFX11_SO_NUM_PRIMS_WRITTEN3 * restrict values)
11622{
11623   uint32_t * restrict dw = (uint32_t * restrict) dst;
11624
11625   const uint64_t v0 =
11626      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
11627   dw[0] = v0;
11628   dw[1] = v0 >> 32;
11629}
11630
11631#define GFX11_SO_PRIM_STORAGE_NEEDED0_num 0x5240
11632#define GFX11_SO_PRIM_STORAGE_NEEDED0_length      2
11633struct GFX11_SO_PRIM_STORAGE_NEEDED0 {
11634   uint64_t                             PrimStorageNeededCount;
11635};
11636
11637static inline __attribute__((always_inline)) void
11638GFX11_SO_PRIM_STORAGE_NEEDED0_pack(__attribute__((unused)) __gen_user_data *data,
11639                                   __attribute__((unused)) void * restrict dst,
11640                                   __attribute__((unused)) const struct GFX11_SO_PRIM_STORAGE_NEEDED0 * restrict values)
11641{
11642   uint32_t * restrict dw = (uint32_t * restrict) dst;
11643
11644   const uint64_t v0 =
11645      __gen_uint(values->PrimStorageNeededCount, 0, 63);
11646   dw[0] = v0;
11647   dw[1] = v0 >> 32;
11648}
11649
11650#define GFX11_SO_PRIM_STORAGE_NEEDED1_num 0x5248
11651#define GFX11_SO_PRIM_STORAGE_NEEDED1_length      2
11652struct GFX11_SO_PRIM_STORAGE_NEEDED1 {
11653   uint64_t                             PrimStorageNeededCount;
11654};
11655
11656static inline __attribute__((always_inline)) void
11657GFX11_SO_PRIM_STORAGE_NEEDED1_pack(__attribute__((unused)) __gen_user_data *data,
11658                                   __attribute__((unused)) void * restrict dst,
11659                                   __attribute__((unused)) const struct GFX11_SO_PRIM_STORAGE_NEEDED1 * restrict values)
11660{
11661   uint32_t * restrict dw = (uint32_t * restrict) dst;
11662
11663   const uint64_t v0 =
11664      __gen_uint(values->PrimStorageNeededCount, 0, 63);
11665   dw[0] = v0;
11666   dw[1] = v0 >> 32;
11667}
11668
11669#define GFX11_SO_PRIM_STORAGE_NEEDED2_num 0x5250
11670#define GFX11_SO_PRIM_STORAGE_NEEDED2_length      2
11671struct GFX11_SO_PRIM_STORAGE_NEEDED2 {
11672   uint64_t                             PrimStorageNeededCount;
11673};
11674
11675static inline __attribute__((always_inline)) void
11676GFX11_SO_PRIM_STORAGE_NEEDED2_pack(__attribute__((unused)) __gen_user_data *data,
11677                                   __attribute__((unused)) void * restrict dst,
11678                                   __attribute__((unused)) const struct GFX11_SO_PRIM_STORAGE_NEEDED2 * restrict values)
11679{
11680   uint32_t * restrict dw = (uint32_t * restrict) dst;
11681
11682   const uint64_t v0 =
11683      __gen_uint(values->PrimStorageNeededCount, 0, 63);
11684   dw[0] = v0;
11685   dw[1] = v0 >> 32;
11686}
11687
11688#define GFX11_SO_PRIM_STORAGE_NEEDED3_num 0x5258
11689#define GFX11_SO_PRIM_STORAGE_NEEDED3_length      2
11690struct GFX11_SO_PRIM_STORAGE_NEEDED3 {
11691   uint64_t                             PrimStorageNeededCount;
11692};
11693
11694static inline __attribute__((always_inline)) void
11695GFX11_SO_PRIM_STORAGE_NEEDED3_pack(__attribute__((unused)) __gen_user_data *data,
11696                                   __attribute__((unused)) void * restrict dst,
11697                                   __attribute__((unused)) const struct GFX11_SO_PRIM_STORAGE_NEEDED3 * restrict values)
11698{
11699   uint32_t * restrict dw = (uint32_t * restrict) dst;
11700
11701   const uint64_t v0 =
11702      __gen_uint(values->PrimStorageNeededCount, 0, 63);
11703   dw[0] = v0;
11704   dw[1] = v0 >> 32;
11705}
11706
11707#define GFX11_SO_WRITE_OFFSET0_num        0x5280
11708#define GFX11_SO_WRITE_OFFSET0_length          1
11709struct GFX11_SO_WRITE_OFFSET0 {
11710   uint64_t                             WriteOffset;
11711};
11712
11713static inline __attribute__((always_inline)) void
11714GFX11_SO_WRITE_OFFSET0_pack(__attribute__((unused)) __gen_user_data *data,
11715                            __attribute__((unused)) void * restrict dst,
11716                            __attribute__((unused)) const struct GFX11_SO_WRITE_OFFSET0 * restrict values)
11717{
11718   uint32_t * restrict dw = (uint32_t * restrict) dst;
11719
11720   dw[0] =
11721      __gen_offset(values->WriteOffset, 2, 31);
11722}
11723
11724#define GFX11_SO_WRITE_OFFSET1_num        0x5284
11725#define GFX11_SO_WRITE_OFFSET1_length          1
11726struct GFX11_SO_WRITE_OFFSET1 {
11727   uint64_t                             WriteOffset;
11728};
11729
11730static inline __attribute__((always_inline)) void
11731GFX11_SO_WRITE_OFFSET1_pack(__attribute__((unused)) __gen_user_data *data,
11732                            __attribute__((unused)) void * restrict dst,
11733                            __attribute__((unused)) const struct GFX11_SO_WRITE_OFFSET1 * restrict values)
11734{
11735   uint32_t * restrict dw = (uint32_t * restrict) dst;
11736
11737   dw[0] =
11738      __gen_offset(values->WriteOffset, 2, 31);
11739}
11740
11741#define GFX11_SO_WRITE_OFFSET2_num        0x5288
11742#define GFX11_SO_WRITE_OFFSET2_length          1
11743struct GFX11_SO_WRITE_OFFSET2 {
11744   uint64_t                             WriteOffset;
11745};
11746
11747static inline __attribute__((always_inline)) void
11748GFX11_SO_WRITE_OFFSET2_pack(__attribute__((unused)) __gen_user_data *data,
11749                            __attribute__((unused)) void * restrict dst,
11750                            __attribute__((unused)) const struct GFX11_SO_WRITE_OFFSET2 * restrict values)
11751{
11752   uint32_t * restrict dw = (uint32_t * restrict) dst;
11753
11754   dw[0] =
11755      __gen_offset(values->WriteOffset, 2, 31);
11756}
11757
11758#define GFX11_SO_WRITE_OFFSET3_num        0x528c
11759#define GFX11_SO_WRITE_OFFSET3_length          1
11760struct GFX11_SO_WRITE_OFFSET3 {
11761   uint64_t                             WriteOffset;
11762};
11763
11764static inline __attribute__((always_inline)) void
11765GFX11_SO_WRITE_OFFSET3_pack(__attribute__((unused)) __gen_user_data *data,
11766                            __attribute__((unused)) void * restrict dst,
11767                            __attribute__((unused)) const struct GFX11_SO_WRITE_OFFSET3 * restrict values)
11768{
11769   uint32_t * restrict dw = (uint32_t * restrict) dst;
11770
11771   dw[0] =
11772      __gen_offset(values->WriteOffset, 2, 31);
11773}
11774
11775#define GFX11_TCCNTLREG_num               0xb0a4
11776#define GFX11_TCCNTLREG_length                 1
11777struct GFX11_TCCNTLREG {
11778   bool                                 URBPartialWriteMergingEnable;
11779   bool                                 ColorZPartialWriteMergingEnable;
11780   bool                                 L3DataPartialWriteMergingEnable;
11781   bool                                 TCDisable;
11782};
11783
11784static inline __attribute__((always_inline)) void
11785GFX11_TCCNTLREG_pack(__attribute__((unused)) __gen_user_data *data,
11786                     __attribute__((unused)) void * restrict dst,
11787                     __attribute__((unused)) const struct GFX11_TCCNTLREG * restrict values)
11788{
11789   uint32_t * restrict dw = (uint32_t * restrict) dst;
11790
11791   dw[0] =
11792      __gen_uint(values->URBPartialWriteMergingEnable, 0, 0) |
11793      __gen_uint(values->ColorZPartialWriteMergingEnable, 1, 1) |
11794      __gen_uint(values->L3DataPartialWriteMergingEnable, 2, 2) |
11795      __gen_uint(values->TCDisable, 3, 3);
11796}
11797
11798#define GFX11_VCS_INSTDONE_num            0x1206c
11799#define GFX11_VCS_INSTDONE_length              1
11800struct GFX11_VCS_INSTDONE {
11801   bool                                 RingEnable;
11802   bool                                 USBDone;
11803   bool                                 QRCDone;
11804   bool                                 SECDone;
11805   bool                                 MPCDone;
11806   bool                                 VFTDone;
11807   bool                                 BSPDone;
11808   bool                                 VLFDone;
11809   bool                                 VOPDone;
11810   bool                                 VMCDone;
11811   bool                                 VIPDone;
11812   bool                                 VITDone;
11813   bool                                 VDSDone;
11814   bool                                 VMXDone;
11815   bool                                 VCPDone;
11816   bool                                 VCDDone;
11817   bool                                 VADDone;
11818   bool                                 VMDDone;
11819   bool                                 VISDone;
11820   bool                                 VACDone;
11821   bool                                 VAMDone;
11822   bool                                 JPGDone;
11823   bool                                 VBPDone;
11824   bool                                 VHRDone;
11825   bool                                 VCIDone;
11826   bool                                 VINDone;
11827   bool                                 VPRDone;
11828   bool                                 VTQDone;
11829   bool                                 Reserved;
11830   bool                                 VCSDone;
11831   bool                                 GACDone;
11832};
11833
11834static inline __attribute__((always_inline)) void
11835GFX11_VCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
11836                        __attribute__((unused)) void * restrict dst,
11837                        __attribute__((unused)) const struct GFX11_VCS_INSTDONE * restrict values)
11838{
11839   uint32_t * restrict dw = (uint32_t * restrict) dst;
11840
11841   dw[0] =
11842      __gen_uint(values->RingEnable, 0, 0) |
11843      __gen_uint(values->USBDone, 1, 1) |
11844      __gen_uint(values->QRCDone, 2, 2) |
11845      __gen_uint(values->SECDone, 3, 3) |
11846      __gen_uint(values->MPCDone, 4, 4) |
11847      __gen_uint(values->VFTDone, 5, 5) |
11848      __gen_uint(values->BSPDone, 6, 6) |
11849      __gen_uint(values->VLFDone, 7, 7) |
11850      __gen_uint(values->VOPDone, 8, 8) |
11851      __gen_uint(values->VMCDone, 9, 9) |
11852      __gen_uint(values->VIPDone, 10, 10) |
11853      __gen_uint(values->VITDone, 11, 11) |
11854      __gen_uint(values->VDSDone, 12, 12) |
11855      __gen_uint(values->VMXDone, 13, 13) |
11856      __gen_uint(values->VCPDone, 14, 14) |
11857      __gen_uint(values->VCDDone, 15, 15) |
11858      __gen_uint(values->VADDone, 16, 16) |
11859      __gen_uint(values->VMDDone, 17, 17) |
11860      __gen_uint(values->VISDone, 18, 18) |
11861      __gen_uint(values->VACDone, 19, 19) |
11862      __gen_uint(values->VAMDone, 20, 20) |
11863      __gen_uint(values->JPGDone, 21, 21) |
11864      __gen_uint(values->VBPDone, 22, 22) |
11865      __gen_uint(values->VHRDone, 23, 23) |
11866      __gen_uint(values->VCIDone, 24, 24) |
11867      __gen_uint(values->VINDone, 26, 26) |
11868      __gen_uint(values->VPRDone, 27, 27) |
11869      __gen_uint(values->VTQDone, 28, 28) |
11870      __gen_uint(values->Reserved, 29, 29) |
11871      __gen_uint(values->VCSDone, 30, 30) |
11872      __gen_uint(values->GACDone, 31, 31);
11873}
11874
11875#define GFX11_VS_INVOCATION_COUNT_num     0x2320
11876#define GFX11_VS_INVOCATION_COUNT_length       2
11877struct GFX11_VS_INVOCATION_COUNT {
11878   uint64_t                             VSInvocationCountReport;
11879};
11880
11881static inline __attribute__((always_inline)) void
11882GFX11_VS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
11883                               __attribute__((unused)) void * restrict dst,
11884                               __attribute__((unused)) const struct GFX11_VS_INVOCATION_COUNT * restrict values)
11885{
11886   uint32_t * restrict dw = (uint32_t * restrict) dst;
11887
11888   const uint64_t v0 =
11889      __gen_uint(values->VSInvocationCountReport, 0, 63);
11890   dw[0] = v0;
11891   dw[1] = v0 >> 32;
11892}
11893
11894#endif /* GFX11_PACK_H */
11895