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