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