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 IVB.
     26  *
     27  * This file has been generated, do not hand edit.
     28  */
     29 
     30 #ifndef GEN7_PACK_H
     31 #define GEN7_PACK_H
     32 
     33 #include <stdio.h>
     34 #include <stdint.h>
     35 #include <stdbool.h>
     36 #include <assert.h>
     37 #include <math.h>
     38 
     39 #ifndef __gen_validate_value
     40 #define __gen_validate_value(x)
     41 #endif
     42 
     43 #ifndef __gen_field_functions
     44 #define __gen_field_functions
     45 
     46 #ifdef NDEBUG
     47 #define NDEBUG_UNUSED __attribute__((unused))
     48 #else
     49 #define NDEBUG_UNUSED
     50 #endif
     51 
     52 union __gen_value {
     53    float f;
     54    uint32_t dw;
     55 };
     56 
     57 static 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 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 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 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 uint32_t
    113 __gen_float(float v)
    114 {
    115    __gen_validate_value(v);
    116    return ((union __gen_value) { .f = (v) }).dw;
    117 }
    118 
    119 static inline uint64_t
    120 __gen_sfixed(float v, uint32_t start, uint32_t end, uint32_t fract_bits)
    121 {
    122    __gen_validate_value(v);
    123 
    124    const float factor = (1 << fract_bits);
    125 
    126 #ifndef NDEBUG
    127    const float max = ((1 << (end - start)) - 1) / factor;
    128    const float min = -(1 << (end - start)) / factor;
    129    assert(min <= v && v <= max);
    130 #endif
    131 
    132    const int64_t int_val = llroundf(v * factor);
    133    const uint64_t mask = ~0ull >> (64 - (end - start + 1));
    134 
    135    return (int_val & mask) << start;
    136 }
    137 
    138 static inline uint64_t
    139 __gen_ufixed(float v, uint32_t start, NDEBUG_UNUSED uint32_t end, uint32_t fract_bits)
    140 {
    141    __gen_validate_value(v);
    142 
    143    const float factor = (1 << fract_bits);
    144 
    145 #ifndef NDEBUG
    146    const float max = ((1 << (end - start + 1)) - 1) / factor;
    147    const float min = 0.0f;
    148    assert(min <= v && v <= max);
    149 #endif
    150 
    151    const uint64_t uint_val = llroundf(v * factor);
    152 
    153    return uint_val << start;
    154 }
    155 
    156 #ifndef __gen_address_type
    157 #error #define __gen_address_type before including this file
    158 #endif
    159 
    160 #ifndef __gen_user_data
    161 #error #define __gen_combine_address before including this file
    162 #endif
    163 
    164 #undef NDEBUG_UNUSED
    165 
    166 #endif
    167 
    168 
    169 enum GEN7_3D_Color_Buffer_Blend_Factor {
    170    BLENDFACTOR_ONE                      =      1,
    171    BLENDFACTOR_SRC_COLOR                =      2,
    172    BLENDFACTOR_SRC_ALPHA                =      3,
    173    BLENDFACTOR_DST_ALPHA                =      4,
    174    BLENDFACTOR_DST_COLOR                =      5,
    175    BLENDFACTOR_SRC_ALPHA_SATURATE       =      6,
    176    BLENDFACTOR_CONST_COLOR              =      7,
    177    BLENDFACTOR_CONST_ALPHA              =      8,
    178    BLENDFACTOR_SRC1_COLOR               =      9,
    179    BLENDFACTOR_SRC1_ALPHA               =     10,
    180    BLENDFACTOR_ZERO                     =     17,
    181    BLENDFACTOR_INV_SRC_COLOR            =     18,
    182    BLENDFACTOR_INV_SRC_ALPHA            =     19,
    183    BLENDFACTOR_INV_DST_ALPHA            =     20,
    184    BLENDFACTOR_INV_DST_COLOR            =     21,
    185    BLENDFACTOR_INV_CONST_COLOR          =     23,
    186    BLENDFACTOR_INV_CONST_ALPHA          =     24,
    187    BLENDFACTOR_INV_SRC1_COLOR           =     25,
    188    BLENDFACTOR_INV_SRC1_ALPHA           =     26,
    189 };
    190 
    191 enum GEN7_3D_Color_Buffer_Blend_Function {
    192    BLENDFUNCTION_ADD                    =      0,
    193    BLENDFUNCTION_SUBTRACT               =      1,
    194    BLENDFUNCTION_REVERSE_SUBTRACT       =      2,
    195    BLENDFUNCTION_MIN                    =      3,
    196    BLENDFUNCTION_MAX                    =      4,
    197 };
    198 
    199 enum GEN7_3D_Compare_Function {
    200    COMPAREFUNCTION_ALWAYS               =      0,
    201    COMPAREFUNCTION_NEVER                =      1,
    202    COMPAREFUNCTION_LESS                 =      2,
    203    COMPAREFUNCTION_EQUAL                =      3,
    204    COMPAREFUNCTION_LEQUAL               =      4,
    205    COMPAREFUNCTION_GREATER              =      5,
    206    COMPAREFUNCTION_NOTEQUAL             =      6,
    207    COMPAREFUNCTION_GEQUAL               =      7,
    208 };
    209 
    210 enum GEN7_3D_Logic_Op_Function {
    211    LOGICOP_CLEAR                        =      0,
    212    LOGICOP_NOR                          =      1,
    213    LOGICOP_AND_INVERTED                 =      2,
    214    LOGICOP_COPY_INVERTED                =      3,
    215    LOGICOP_AND_REVERSE                  =      4,
    216    LOGICOP_INVERT                       =      5,
    217    LOGICOP_XOR                          =      6,
    218    LOGICOP_NAND                         =      7,
    219    LOGICOP_AND                          =      8,
    220    LOGICOP_EQUIV                        =      9,
    221    LOGICOP_NOOP                         =     10,
    222    LOGICOP_OR_INVERTED                  =     11,
    223    LOGICOP_COPY                         =     12,
    224    LOGICOP_OR_REVERSE                   =     13,
    225    LOGICOP_OR                           =     14,
    226    LOGICOP_SET                          =     15,
    227 };
    228 
    229 enum GEN7_3D_Prim_Topo_Type {
    230    _3DPRIM_POINTLIST                    =      1,
    231    _3DPRIM_LINELIST                     =      2,
    232    _3DPRIM_LINESTRIP                    =      3,
    233    _3DPRIM_TRILIST                      =      4,
    234    _3DPRIM_TRISTRIP                     =      5,
    235    _3DPRIM_TRIFAN                       =      6,
    236    _3DPRIM_QUADLIST                     =      7,
    237    _3DPRIM_QUADSTRIP                    =      8,
    238    _3DPRIM_LINELIST_ADJ                 =      9,
    239    _3DPRIM_LINESTRIP_ADJ                =     10,
    240    _3DPRIM_TRILIST_ADJ                  =     11,
    241    _3DPRIM_TRISTRIP_ADJ                 =     12,
    242    _3DPRIM_TRISTRIP_REVERSE             =     13,
    243    _3DPRIM_POLYGON                      =     14,
    244    _3DPRIM_RECTLIST                     =     15,
    245    _3DPRIM_LINELOOP                     =     16,
    246    _3DPRIM_POINTLIST_BF                 =     17,
    247    _3DPRIM_LINESTRIP_CONT               =     18,
    248    _3DPRIM_LINESTRIP_BF                 =     19,
    249    _3DPRIM_LINESTRIP_CONT_BF            =     20,
    250    _3DPRIM_TRIFAN_NOSTIPPLE             =     22,
    251    _3DPRIM_PATCHLIST_1                  =     32,
    252    _3DPRIM_PATCHLIST_2                  =     33,
    253    _3DPRIM_PATCHLIST_3                  =     34,
    254    _3DPRIM_PATCHLIST_4                  =     35,
    255    _3DPRIM_PATCHLIST_5                  =     36,
    256    _3DPRIM_PATCHLIST_6                  =     37,
    257    _3DPRIM_PATCHLIST_7                  =     38,
    258    _3DPRIM_PATCHLIST_8                  =     39,
    259    _3DPRIM_PATCHLIST_9                  =     40,
    260    _3DPRIM_PATCHLIST_10                 =     41,
    261    _3DPRIM_PATCHLIST_11                 =     42,
    262    _3DPRIM_PATCHLIST_12                 =     43,
    263    _3DPRIM_PATCHLIST_13                 =     44,
    264    _3DPRIM_PATCHLIST_14                 =     45,
    265    _3DPRIM_PATCHLIST_15                 =     46,
    266    _3DPRIM_PATCHLIST_16                 =     47,
    267    _3DPRIM_PATCHLIST_17                 =     48,
    268    _3DPRIM_PATCHLIST_18                 =     49,
    269    _3DPRIM_PATCHLIST_19                 =     50,
    270    _3DPRIM_PATCHLIST_20                 =     51,
    271    _3DPRIM_PATCHLIST_21                 =     52,
    272    _3DPRIM_PATCHLIST_22                 =     53,
    273    _3DPRIM_PATCHLIST_23                 =     54,
    274    _3DPRIM_PATCHLIST_24                 =     55,
    275    _3DPRIM_PATCHLIST_25                 =     56,
    276    _3DPRIM_PATCHLIST_26                 =     57,
    277    _3DPRIM_PATCHLIST_27                 =     58,
    278    _3DPRIM_PATCHLIST_28                 =     59,
    279    _3DPRIM_PATCHLIST_29                 =     60,
    280    _3DPRIM_PATCHLIST_30                 =     61,
    281    _3DPRIM_PATCHLIST_31                 =     62,
    282    _3DPRIM_PATCHLIST_32                 =     63,
    283 };
    284 
    285 enum GEN7_3D_Stencil_Operation {
    286    STENCILOP_KEEP                       =      0,
    287    STENCILOP_ZERO                       =      1,
    288    STENCILOP_REPLACE                    =      2,
    289    STENCILOP_INCRSAT                    =      3,
    290    STENCILOP_DECRSAT                    =      4,
    291    STENCILOP_INCR                       =      5,
    292    STENCILOP_DECR                       =      6,
    293    STENCILOP_INVERT                     =      7,
    294 };
    295 
    296 enum GEN7_3D_Vertex_Component_Control {
    297    VFCOMP_NOSTORE                       =      0,
    298    VFCOMP_STORE_SRC                     =      1,
    299    VFCOMP_STORE_0                       =      2,
    300    VFCOMP_STORE_1_FP                    =      3,
    301    VFCOMP_STORE_1_INT                   =      4,
    302    VFCOMP_STORE_VID                     =      5,
    303    VFCOMP_STORE_IID                     =      6,
    304    VFCOMP_STORE_PID                     =      7,
    305 };
    306 
    307 enum GEN7_TextureCoordinateMode {
    308    TCM_WRAP                             =      0,
    309    TCM_MIRROR                           =      1,
    310    TCM_CLAMP                            =      2,
    311    TCM_CUBE                             =      3,
    312    TCM_CLAMP_BORDER                     =      4,
    313    TCM_MIRROR_ONCE                      =      5,
    314 };
    315 
    316 #define GEN7_3DSTATE_CONSTANT_BODY_length      6
    317 struct GEN7_3DSTATE_CONSTANT_BODY {
    318    uint32_t                             ReadLength[4];
    319    uint32_t                             MOCS;
    320    __gen_address_type                   Buffer[4];
    321 };
    322 
    323 static inline void
    324 GEN7_3DSTATE_CONSTANT_BODY_pack(__attribute__((unused)) __gen_user_data *data,
    325                                 __attribute__((unused)) void * restrict dst,
    326                                 __attribute__((unused)) const struct GEN7_3DSTATE_CONSTANT_BODY * restrict values)
    327 {
    328    uint32_t * restrict dw = (uint32_t * restrict) dst;
    329 
    330    dw[0] =
    331       __gen_uint(values->ReadLength[0], 0, 15) |
    332       __gen_uint(values->ReadLength[1], 16, 31);
    333 
    334    dw[1] =
    335       __gen_uint(values->ReadLength[2], 0, 15) |
    336       __gen_uint(values->ReadLength[3], 16, 31);
    337 
    338    const uint32_t v2 =
    339       __gen_uint(values->MOCS, 0, 4);
    340    dw[2] = __gen_combine_address(data, &dw[2], values->Buffer[0], v2);
    341 
    342    dw[3] = __gen_combine_address(data, &dw[3], values->Buffer[1], 0);
    343 
    344    dw[4] = __gen_combine_address(data, &dw[4], values->Buffer[2], 0);
    345 
    346    dw[5] = __gen_combine_address(data, &dw[5], values->Buffer[3], 0);
    347 }
    348 
    349 #define GEN7_BINDING_TABLE_STATE_length        1
    350 struct GEN7_BINDING_TABLE_STATE {
    351    uint64_t                             SurfaceStatePointer;
    352 };
    353 
    354 static inline void
    355 GEN7_BINDING_TABLE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
    356                               __attribute__((unused)) void * restrict dst,
    357                               __attribute__((unused)) const struct GEN7_BINDING_TABLE_STATE * restrict values)
    358 {
    359    uint32_t * restrict dw = (uint32_t * restrict) dst;
    360 
    361    dw[0] =
    362       __gen_offset(values->SurfaceStatePointer, 5, 31);
    363 }
    364 
    365 #define GEN7_BLEND_STATE_ENTRY_length          2
    366 struct GEN7_BLEND_STATE_ENTRY {
    367    enum GEN7_3D_Color_Buffer_Blend_Factor DestinationBlendFactor;
    368    enum GEN7_3D_Color_Buffer_Blend_Factor SourceBlendFactor;
    369    enum GEN7_3D_Color_Buffer_Blend_Function ColorBlendFunction;
    370    enum GEN7_3D_Color_Buffer_Blend_Factor DestinationAlphaBlendFactor;
    371    enum GEN7_3D_Color_Buffer_Blend_Factor SourceAlphaBlendFactor;
    372    enum GEN7_3D_Color_Buffer_Blend_Function AlphaBlendFunction;
    373    bool                                 IndependentAlphaBlendEnable;
    374    bool                                 ColorBufferBlendEnable;
    375    bool                                 PostBlendColorClampEnable;
    376    bool                                 PreBlendColorClampEnable;
    377    uint32_t                             ColorClampRange;
    378 #define COLORCLAMP_UNORM                         0
    379 #define COLORCLAMP_SNORM                         1
    380 #define COLORCLAMP_RTFORMAT                      2
    381    uint32_t                             YDitherOffset;
    382    uint32_t                             XDitherOffset;
    383    bool                                 ColorDitherEnable;
    384    enum GEN7_3D_Compare_Function        AlphaTestFunction;
    385    bool                                 AlphaTestEnable;
    386    enum GEN7_3D_Logic_Op_Function       LogicOpFunction;
    387    bool                                 LogicOpEnable;
    388    bool                                 WriteDisableBlue;
    389    bool                                 WriteDisableGreen;
    390    bool                                 WriteDisableRed;
    391    bool                                 WriteDisableAlpha;
    392    bool                                 AlphaToCoverageDitherEnable;
    393    bool                                 AlphaToOneEnable;
    394    bool                                 AlphaToCoverageEnable;
    395 };
    396 
    397 static inline void
    398 GEN7_BLEND_STATE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
    399                             __attribute__((unused)) void * restrict dst,
    400                             __attribute__((unused)) const struct GEN7_BLEND_STATE_ENTRY * restrict values)
    401 {
    402    uint32_t * restrict dw = (uint32_t * restrict) dst;
    403 
    404    dw[0] =
    405       __gen_uint(values->DestinationBlendFactor, 0, 4) |
    406       __gen_uint(values->SourceBlendFactor, 5, 9) |
    407       __gen_uint(values->ColorBlendFunction, 11, 13) |
    408       __gen_uint(values->DestinationAlphaBlendFactor, 15, 19) |
    409       __gen_uint(values->SourceAlphaBlendFactor, 20, 24) |
    410       __gen_uint(values->AlphaBlendFunction, 26, 28) |
    411       __gen_uint(values->IndependentAlphaBlendEnable, 30, 30) |
    412       __gen_uint(values->ColorBufferBlendEnable, 31, 31);
    413 
    414    dw[1] =
    415       __gen_uint(values->PostBlendColorClampEnable, 0, 0) |
    416       __gen_uint(values->PreBlendColorClampEnable, 1, 1) |
    417       __gen_uint(values->ColorClampRange, 2, 3) |
    418       __gen_uint(values->YDitherOffset, 8, 9) |
    419       __gen_uint(values->XDitherOffset, 10, 11) |
    420       __gen_uint(values->ColorDitherEnable, 12, 12) |
    421       __gen_uint(values->AlphaTestFunction, 13, 15) |
    422       __gen_uint(values->AlphaTestEnable, 16, 16) |
    423       __gen_uint(values->LogicOpFunction, 18, 21) |
    424       __gen_uint(values->LogicOpEnable, 22, 22) |
    425       __gen_uint(values->WriteDisableBlue, 24, 24) |
    426       __gen_uint(values->WriteDisableGreen, 25, 25) |
    427       __gen_uint(values->WriteDisableRed, 26, 26) |
    428       __gen_uint(values->WriteDisableAlpha, 27, 27) |
    429       __gen_uint(values->AlphaToCoverageDitherEnable, 29, 29) |
    430       __gen_uint(values->AlphaToOneEnable, 30, 30) |
    431       __gen_uint(values->AlphaToCoverageEnable, 31, 31);
    432 }
    433 
    434 #define GEN7_BLEND_STATE_length                0
    435 struct GEN7_BLEND_STATE {
    436    /* variable length fields follow */
    437 };
    438 
    439 static inline void
    440 GEN7_BLEND_STATE_pack(__attribute__((unused)) __gen_user_data *data,
    441                       __attribute__((unused)) void * restrict dst,
    442                       __attribute__((unused)) const struct GEN7_BLEND_STATE * restrict values)
    443 {
    444 }
    445 
    446 #define GEN7_CC_VIEWPORT_length                2
    447 struct GEN7_CC_VIEWPORT {
    448    float                                MinimumDepth;
    449    float                                MaximumDepth;
    450 };
    451 
    452 static inline void
    453 GEN7_CC_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
    454                       __attribute__((unused)) void * restrict dst,
    455                       __attribute__((unused)) const struct GEN7_CC_VIEWPORT * restrict values)
    456 {
    457    uint32_t * restrict dw = (uint32_t * restrict) dst;
    458 
    459    dw[0] =
    460       __gen_float(values->MinimumDepth);
    461 
    462    dw[1] =
    463       __gen_float(values->MaximumDepth);
    464 }
    465 
    466 #define GEN7_COLOR_CALC_STATE_length           6
    467 struct GEN7_COLOR_CALC_STATE {
    468    uint32_t                             AlphaTestFormat;
    469 #define ALPHATEST_UNORM8                         0
    470 #define ALPHATEST_FLOAT32                        1
    471    bool                                 RoundDisableFunctionDisable;
    472    uint32_t                             BackfaceStencilReferenceValue;
    473    uint32_t                             StencilReferenceValue;
    474    uint32_t                             AlphaReferenceValueAsUNORM8;
    475    float                                AlphaReferenceValueAsFLOAT32;
    476    float                                BlendConstantColorRed;
    477    float                                BlendConstantColorGreen;
    478    float                                BlendConstantColorBlue;
    479    float                                BlendConstantColorAlpha;
    480 };
    481 
    482 static inline void
    483 GEN7_COLOR_CALC_STATE_pack(__attribute__((unused)) __gen_user_data *data,
    484                            __attribute__((unused)) void * restrict dst,
    485                            __attribute__((unused)) const struct GEN7_COLOR_CALC_STATE * restrict values)
    486 {
    487    uint32_t * restrict dw = (uint32_t * restrict) dst;
    488 
    489    dw[0] =
    490       __gen_uint(values->AlphaTestFormat, 0, 0) |
    491       __gen_uint(values->RoundDisableFunctionDisable, 15, 15) |
    492       __gen_uint(values->BackfaceStencilReferenceValue, 16, 23) |
    493       __gen_uint(values->StencilReferenceValue, 24, 31);
    494 
    495    dw[1] =
    496       __gen_uint(values->AlphaReferenceValueAsUNORM8, 0, 31) |
    497       __gen_float(values->AlphaReferenceValueAsFLOAT32);
    498 
    499    dw[2] =
    500       __gen_float(values->BlendConstantColorRed);
    501 
    502    dw[3] =
    503       __gen_float(values->BlendConstantColorGreen);
    504 
    505    dw[4] =
    506       __gen_float(values->BlendConstantColorBlue);
    507 
    508    dw[5] =
    509       __gen_float(values->BlendConstantColorAlpha);
    510 }
    511 
    512 #define GEN7_DEPTH_STENCIL_STATE_length        3
    513 struct GEN7_DEPTH_STENCIL_STATE {
    514    enum GEN7_3D_Stencil_Operation       BackfaceStencilPassDepthPassOp;
    515    enum GEN7_3D_Stencil_Operation       BackfaceStencilPassDepthFailOp;
    516    enum GEN7_3D_Stencil_Operation       BackfaceStencilFailOp;
    517    enum GEN7_3D_Compare_Function        BackfaceStencilTestFunction;
    518    bool                                 DoubleSidedStencilEnable;
    519    bool                                 StencilBufferWriteEnable;
    520    enum GEN7_3D_Stencil_Operation       StencilPassDepthPassOp;
    521    enum GEN7_3D_Stencil_Operation       StencilPassDepthFailOp;
    522    enum GEN7_3D_Stencil_Operation       StencilFailOp;
    523    enum GEN7_3D_Compare_Function        StencilTestFunction;
    524    bool                                 StencilTestEnable;
    525    uint32_t                             BackfaceStencilWriteMask;
    526    uint32_t                             BackfaceStencilTestMask;
    527    uint32_t                             StencilWriteMask;
    528    uint32_t                             StencilTestMask;
    529    bool                                 DepthBufferWriteEnable;
    530    enum GEN7_3D_Compare_Function        DepthTestFunction;
    531    bool                                 DepthTestEnable;
    532 };
    533 
    534 static inline void
    535 GEN7_DEPTH_STENCIL_STATE_pack(__attribute__((unused)) __gen_user_data *data,
    536                               __attribute__((unused)) void * restrict dst,
    537                               __attribute__((unused)) const struct GEN7_DEPTH_STENCIL_STATE * restrict values)
    538 {
    539    uint32_t * restrict dw = (uint32_t * restrict) dst;
    540 
    541    dw[0] =
    542       __gen_uint(values->BackfaceStencilPassDepthPassOp, 3, 5) |
    543       __gen_uint(values->BackfaceStencilPassDepthFailOp, 6, 8) |
    544       __gen_uint(values->BackfaceStencilFailOp, 9, 11) |
    545       __gen_uint(values->BackfaceStencilTestFunction, 12, 14) |
    546       __gen_uint(values->DoubleSidedStencilEnable, 15, 15) |
    547       __gen_uint(values->StencilBufferWriteEnable, 18, 18) |
    548       __gen_uint(values->StencilPassDepthPassOp, 19, 21) |
    549       __gen_uint(values->StencilPassDepthFailOp, 22, 24) |
    550       __gen_uint(values->StencilFailOp, 25, 27) |
    551       __gen_uint(values->StencilTestFunction, 28, 30) |
    552       __gen_uint(values->StencilTestEnable, 31, 31);
    553 
    554    dw[1] =
    555       __gen_uint(values->BackfaceStencilWriteMask, 0, 7) |
    556       __gen_uint(values->BackfaceStencilTestMask, 8, 15) |
    557       __gen_uint(values->StencilWriteMask, 16, 23) |
    558       __gen_uint(values->StencilTestMask, 24, 31);
    559 
    560    dw[2] =
    561       __gen_uint(values->DepthBufferWriteEnable, 26, 26) |
    562       __gen_uint(values->DepthTestFunction, 27, 29) |
    563       __gen_uint(values->DepthTestEnable, 31, 31);
    564 }
    565 
    566 #define GEN7_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT_length      2
    567 struct GEN7_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT {
    568    bool                                 MBErrorConcealmentPSliceWeightPredictionDisable;
    569    bool                                 MBErrorConcealmentPSliceMotionVectorsOverrideDisable;
    570    bool                                 MBErrorConcealmentPSliceReferenceIndexOverrideDisable;
    571    bool                                 MBErrorConcealmentBSpatialWeightPredictionDisable;
    572    bool                                 MBErrorConcealmentBSpatialMotionVectorsOverrideDisable;
    573    bool                                 MBErrorConcealmentBSpatialReferenceIndexOverrideDisable;
    574    uint32_t                             MBErrorConcealmentBSpatialPredictionMode;
    575    bool                                 MBHeaderErrorHandling;
    576    bool                                 EntropyErrorHandling;
    577    bool                                 MPRErrorHandling;
    578    bool                                 BSDPrematureCompleteErrorHandling;
    579    uint32_t                             ConcealmentPictureID;
    580    bool                                 MBErrorConcealmentBTemporalWeightPredictionDisable;
    581    bool                                 MBErrorConcealmentBTemporalMotionVectorsOverrideEnable;
    582    bool                                 MBErrorConcealmentBTemporalReferenceIndexOverrideEnable;
    583    uint32_t                             MBErrorConcealmentBTemporalPredictionMode;
    584    bool                                 InitCurrentMBNumber;
    585    uint32_t                             ConcealmentMethod;
    586    uint32_t                             FirstMBBitOffset;
    587    bool                                 LastSlice;
    588    bool                                 EmulationPreventionBytePresent;
    589    bool                                 FixPrevMBSkipped;
    590    uint32_t                             FirstMBByteOffsetofSliceDataorSliceHeader;
    591 };
    592 
    593 static inline void
    594 GEN7_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
    595                                                          __attribute__((unused)) void * restrict dst,
    596                                                          __attribute__((unused)) const struct GEN7_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT * restrict values)
    597 {
    598    uint32_t * restrict dw = (uint32_t * restrict) dst;
    599 
    600    dw[0] =
    601       __gen_uint(values->MBErrorConcealmentPSliceWeightPredictionDisable, 0, 0) |
    602       __gen_uint(values->MBErrorConcealmentPSliceMotionVectorsOverrideDisable, 1, 1) |
    603       __gen_uint(values->MBErrorConcealmentPSliceReferenceIndexOverrideDisable, 2, 2) |
    604       __gen_uint(values->MBErrorConcealmentBSpatialWeightPredictionDisable, 3, 3) |
    605       __gen_uint(values->MBErrorConcealmentBSpatialMotionVectorsOverrideDisable, 4, 4) |
    606       __gen_uint(values->MBErrorConcealmentBSpatialReferenceIndexOverrideDisable, 5, 5) |
    607       __gen_uint(values->MBErrorConcealmentBSpatialPredictionMode, 6, 7) |
    608       __gen_uint(values->MBHeaderErrorHandling, 8, 8) |
    609       __gen_uint(values->EntropyErrorHandling, 10, 10) |
    610       __gen_uint(values->MPRErrorHandling, 12, 12) |
    611       __gen_uint(values->BSDPrematureCompleteErrorHandling, 14, 14) |
    612       __gen_uint(values->ConcealmentPictureID, 16, 21) |
    613       __gen_uint(values->MBErrorConcealmentBTemporalWeightPredictionDisable, 24, 24) |
    614       __gen_uint(values->MBErrorConcealmentBTemporalMotionVectorsOverrideEnable, 25, 25) |
    615       __gen_uint(values->MBErrorConcealmentBTemporalReferenceIndexOverrideEnable, 26, 26) |
    616       __gen_uint(values->MBErrorConcealmentBTemporalPredictionMode, 27, 28) |
    617       __gen_uint(values->InitCurrentMBNumber, 30, 30) |
    618       __gen_uint(values->ConcealmentMethod, 31, 31);
    619 
    620    dw[1] =
    621       __gen_uint(values->FirstMBBitOffset, 0, 2) |
    622       __gen_uint(values->LastSlice, 3, 3) |
    623       __gen_uint(values->EmulationPreventionBytePresent, 4, 4) |
    624       __gen_uint(values->FixPrevMBSkipped, 7, 7) |
    625       __gen_uint(values->FirstMBByteOffsetofSliceDataorSliceHeader, 16, 31);
    626 }
    627 
    628 #define GEN7_INTERFACE_DESCRIPTOR_DATA_length      8
    629 struct GEN7_INTERFACE_DESCRIPTOR_DATA {
    630    uint64_t                             KernelStartPointer;
    631    bool                                 SoftwareExceptionEnable;
    632    bool                                 MaskStackExceptionEnable;
    633    bool                                 IllegalOpcodeExceptionEnable;
    634    uint32_t                             FloatingPointMode;
    635 #define IEEE754                                  0
    636 #define Alternate                                1
    637    uint32_t                             ThreadPriority;
    638 #define NormalPriority                           0
    639 #define HighPriority                             1
    640    bool                                 SingleProgramFlow;
    641    uint32_t                             SamplerCount;
    642 #define Nosamplersused                           0
    643 #define Between1and4samplersused                 1
    644 #define Between5and8samplersused                 2
    645 #define Between9and12samplersused                3
    646 #define Between13and16samplersused               4
    647    uint64_t                             SamplerStatePointer;
    648    uint32_t                             BindingTableEntryCount;
    649    uint64_t                             BindingTablePointer;
    650    uint32_t                             ConstantURBEntryReadOffset;
    651    uint32_t                             ConstantURBEntryReadLength;
    652    uint32_t                             NumberofThreadsinGPGPUThreadGroup;
    653    uint32_t                             SharedLocalMemorySize;
    654    bool                                 BarrierEnable;
    655    uint32_t                             RoundingMode;
    656 #define RTNE                                     0
    657 #define RU                                       1
    658 #define RD                                       2
    659 #define RTZ                                      3
    660 };
    661 
    662 static inline void
    663 GEN7_INTERFACE_DESCRIPTOR_DATA_pack(__attribute__((unused)) __gen_user_data *data,
    664                                     __attribute__((unused)) void * restrict dst,
    665                                     __attribute__((unused)) const struct GEN7_INTERFACE_DESCRIPTOR_DATA * restrict values)
    666 {
    667    uint32_t * restrict dw = (uint32_t * restrict) dst;
    668 
    669    dw[0] =
    670       __gen_offset(values->KernelStartPointer, 6, 31);
    671 
    672    dw[1] =
    673       __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
    674       __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
    675       __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
    676       __gen_uint(values->FloatingPointMode, 16, 16) |
    677       __gen_uint(values->ThreadPriority, 17, 17) |
    678       __gen_uint(values->SingleProgramFlow, 18, 18);
    679 
    680    dw[2] =
    681       __gen_uint(values->SamplerCount, 2, 4) |
    682       __gen_offset(values->SamplerStatePointer, 5, 31);
    683 
    684    dw[3] =
    685       __gen_uint(values->BindingTableEntryCount, 0, 4) |
    686       __gen_offset(values->BindingTablePointer, 5, 15);
    687 
    688    dw[4] =
    689       __gen_uint(values->ConstantURBEntryReadOffset, 0, 15) |
    690       __gen_uint(values->ConstantURBEntryReadLength, 16, 31);
    691 
    692    dw[5] =
    693       __gen_uint(values->NumberofThreadsinGPGPUThreadGroup, 0, 7) |
    694       __gen_uint(values->SharedLocalMemorySize, 16, 20) |
    695       __gen_uint(values->BarrierEnable, 21, 21) |
    696       __gen_uint(values->RoundingMode, 22, 23);
    697 
    698    dw[6] = 0;
    699 
    700    dw[7] = 0;
    701 }
    702 
    703 #define GEN7_MEMORY_OBJECT_CONTROL_STATE_length      1
    704 struct GEN7_MEMORY_OBJECT_CONTROL_STATE {
    705    uint32_t                             L3CacheabilityControlL3CC;
    706    uint32_t                             LLCCacheabilityControlLLCCC;
    707    uint32_t                             GraphicsDataTypeGFDT;
    708 };
    709 
    710 static inline void
    711 GEN7_MEMORY_OBJECT_CONTROL_STATE_pack(__attribute__((unused)) __gen_user_data *data,
    712                                       __attribute__((unused)) void * restrict dst,
    713                                       __attribute__((unused)) const struct GEN7_MEMORY_OBJECT_CONTROL_STATE * restrict values)
    714 {
    715    uint32_t * restrict dw = (uint32_t * restrict) dst;
    716 
    717    dw[0] =
    718       __gen_uint(values->L3CacheabilityControlL3CC, 0, 0) |
    719       __gen_uint(values->LLCCacheabilityControlLLCCC, 1, 1) |
    720       __gen_uint(values->GraphicsDataTypeGFDT, 2, 2);
    721 }
    722 
    723 #define GEN7_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION_length      2
    724 struct GEN7_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION {
    725    uint32_t                             FirstMBBitOffset;
    726    bool                                 LastMB;
    727    bool                                 LastPicSlice;
    728    uint32_t                             MBCount;
    729    uint32_t                             SliceVerticalPosition;
    730    uint32_t                             SliceHorizontalPosition;
    731    uint32_t                             QuantizerScaleCode;
    732 };
    733 
    734 static inline void
    735 GEN7_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION_pack(__attribute__((unused)) __gen_user_data *data,
    736                                                        __attribute__((unused)) void * restrict dst,
    737                                                        __attribute__((unused)) const struct GEN7_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION * restrict values)
    738 {
    739    uint32_t * restrict dw = (uint32_t * restrict) dst;
    740 
    741    dw[0] =
    742       __gen_uint(values->FirstMBBitOffset, 0, 2) |
    743       __gen_uint(values->LastMB, 3, 3) |
    744       __gen_uint(values->LastPicSlice, 5, 5) |
    745       __gen_uint(values->MBCount, 8, 14) |
    746       __gen_uint(values->SliceVerticalPosition, 16, 22) |
    747       __gen_uint(values->SliceHorizontalPosition, 24, 30);
    748 
    749    dw[1] =
    750       __gen_uint(values->QuantizerScaleCode, 24, 28);
    751 }
    752 
    753 #define GEN7_PALETTE_ENTRY_length              1
    754 struct GEN7_PALETTE_ENTRY {
    755    uint32_t                             Blue;
    756    uint32_t                             Green;
    757    uint32_t                             Red;
    758    uint32_t                             Alpha;
    759 };
    760 
    761 static inline void
    762 GEN7_PALETTE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
    763                         __attribute__((unused)) void * restrict dst,
    764                         __attribute__((unused)) const struct GEN7_PALETTE_ENTRY * restrict values)
    765 {
    766    uint32_t * restrict dw = (uint32_t * restrict) dst;
    767 
    768    dw[0] =
    769       __gen_uint(values->Blue, 0, 7) |
    770       __gen_uint(values->Green, 8, 15) |
    771       __gen_uint(values->Red, 16, 23) |
    772       __gen_uint(values->Alpha, 24, 31);
    773 }
    774 
    775 #define GEN7_RENDER_SURFACE_STATE_length       8
    776 struct GEN7_RENDER_SURFACE_STATE {
    777    bool                                 CubeFaceEnablePositiveZ;
    778    bool                                 CubeFaceEnableNegativeZ;
    779    bool                                 CubeFaceEnablePositiveY;
    780    bool                                 CubeFaceEnableNegativeY;
    781    bool                                 CubeFaceEnablePositiveX;
    782    bool                                 CubeFaceEnableNegativeX;
    783    uint32_t                             MediaBoundaryPixelMode;
    784 #define NORMAL_MODE                              0
    785 #define PROGRESSIVE_FRAME                        2
    786 #define INTERLACED_FRAME                         3
    787    uint32_t                             RenderCacheReadWriteMode;
    788    uint32_t                             SurfaceArraySpacing;
    789 #define ARYSPC_FULL                              0
    790 #define ARYSPC_LOD0                              1
    791    uint32_t                             VerticalLineStrideOffset;
    792    uint32_t                             VerticalLineStride;
    793    uint32_t                             TileWalk;
    794 #define TILEWALK_XMAJOR                          0
    795 #define TILEWALK_YMAJOR                          1
    796    bool                                 TiledSurface;
    797    uint32_t                             SurfaceHorizontalAlignment;
    798 #define HALIGN_4                                 0
    799 #define HALIGN_8                                 1
    800    uint32_t                             SurfaceVerticalAlignment;
    801 #define VALIGN_2                                 0
    802 #define VALIGN_4                                 1
    803    uint32_t                             SurfaceFormat;
    804    bool                                 SurfaceArray;
    805    uint32_t                             SurfaceType;
    806 #define SURFTYPE_1D                              0
    807 #define SURFTYPE_2D                              1
    808 #define SURFTYPE_3D                              2
    809 #define SURFTYPE_CUBE                            3
    810 #define SURFTYPE_BUFFER                          4
    811 #define SURFTYPE_STRBUF                          5
    812 #define SURFTYPE_NULL                            7
    813    __gen_address_type                   SurfaceBaseAddress;
    814    uint32_t                             Width;
    815    uint32_t                             Height;
    816    uint32_t                             SurfacePitch;
    817    uint32_t                             Depth;
    818    uint32_t                             MultisamplePositionPaletteIndex;
    819    uint32_t                             StrbufMinimumArrayElement;
    820    uint32_t                             NumberofMultisamples;
    821 #define MULTISAMPLECOUNT_1                       0
    822 #define MULTISAMPLECOUNT_4                       2
    823 #define MULTISAMPLECOUNT_8                       3
    824    uint32_t                             MultisampledSurfaceStorageFormat;
    825 #define MSFMT_MSS                                0
    826 #define MSFMT_DEPTH_STENCIL                      1
    827    uint32_t                             RenderTargetViewExtent;
    828    uint32_t                             MinimumArrayElement;
    829    uint32_t                             RenderTargetRotation;
    830 #define RTROTATE_0DEG                            0
    831 #define RTROTATE_90DEG                           1
    832 #define RTROTATE_270DEG                          3
    833    uint32_t                             MIPCountLOD;
    834    uint32_t                             SurfaceMinLOD;
    835    uint32_t                             MOCS;
    836    uint32_t                             YOffset;
    837    uint32_t                             XOffset;
    838    bool                                 MCSEnable;
    839    uint32_t                             YOffsetforUVPlane;
    840    bool                                 AppendCounterEnable;
    841    uint32_t                             AuxiliarySurfacePitch;
    842    __gen_address_type                   AppendCounterAddress;
    843    __gen_address_type                   AuxiliarySurfaceBaseAddress;
    844    uint32_t                             XOffsetforUVPlane;
    845    uint32_t                             ReservedMBZ;
    846    float                                ResourceMinLOD;
    847    uint32_t                             AlphaClearColor;
    848 #define CC_ZERO                                  0
    849 #define CC_ONE                                   1
    850    uint32_t                             BlueClearColor;
    851 #define CC_ZERO                                  0
    852 #define CC_ONE                                   1
    853    uint32_t                             GreenClearColor;
    854 #define CC_ZERO                                  0
    855 #define CC_ONE                                   1
    856    uint32_t                             RedClearColor;
    857 #define CC_ZERO                                  0
    858 #define CC_ONE                                   1
    859 };
    860 
    861 static inline void
    862 GEN7_RENDER_SURFACE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
    863                                __attribute__((unused)) void * restrict dst,
    864                                __attribute__((unused)) const struct GEN7_RENDER_SURFACE_STATE * restrict values)
    865 {
    866    uint32_t * restrict dw = (uint32_t * restrict) dst;
    867 
    868    dw[0] =
    869       __gen_uint(values->CubeFaceEnablePositiveZ, 0, 0) |
    870       __gen_uint(values->CubeFaceEnableNegativeZ, 1, 1) |
    871       __gen_uint(values->CubeFaceEnablePositiveY, 2, 2) |
    872       __gen_uint(values->CubeFaceEnableNegativeY, 3, 3) |
    873       __gen_uint(values->CubeFaceEnablePositiveX, 4, 4) |
    874       __gen_uint(values->CubeFaceEnableNegativeX, 5, 5) |
    875       __gen_uint(values->MediaBoundaryPixelMode, 6, 7) |
    876       __gen_uint(values->RenderCacheReadWriteMode, 8, 8) |
    877       __gen_uint(values->SurfaceArraySpacing, 10, 10) |
    878       __gen_uint(values->VerticalLineStrideOffset, 11, 11) |
    879       __gen_uint(values->VerticalLineStride, 12, 12) |
    880       __gen_uint(values->TileWalk, 13, 13) |
    881       __gen_uint(values->TiledSurface, 14, 14) |
    882       __gen_uint(values->SurfaceHorizontalAlignment, 15, 15) |
    883       __gen_uint(values->SurfaceVerticalAlignment, 16, 17) |
    884       __gen_uint(values->SurfaceFormat, 18, 26) |
    885       __gen_uint(values->SurfaceArray, 28, 28) |
    886       __gen_uint(values->SurfaceType, 29, 31);
    887 
    888    dw[1] = __gen_combine_address(data, &dw[1], values->SurfaceBaseAddress, 0);
    889 
    890    dw[2] =
    891       __gen_uint(values->Width, 0, 13) |
    892       __gen_uint(values->Height, 16, 29);
    893 
    894    dw[3] =
    895       __gen_uint(values->SurfacePitch, 0, 17) |
    896       __gen_uint(values->Depth, 21, 31);
    897 
    898    dw[4] =
    899       __gen_uint(values->MultisamplePositionPaletteIndex, 0, 2) |
    900       __gen_uint(values->StrbufMinimumArrayElement, 0, 26) |
    901       __gen_uint(values->NumberofMultisamples, 3, 5) |
    902       __gen_uint(values->MultisampledSurfaceStorageFormat, 6, 6) |
    903       __gen_uint(values->RenderTargetViewExtent, 7, 17) |
    904       __gen_uint(values->MinimumArrayElement, 18, 28) |
    905       __gen_uint(values->RenderTargetRotation, 29, 30);
    906 
    907    dw[5] =
    908       __gen_uint(values->MIPCountLOD, 0, 3) |
    909       __gen_uint(values->SurfaceMinLOD, 4, 7) |
    910       __gen_uint(values->MOCS, 16, 19) |
    911       __gen_uint(values->YOffset, 20, 23) |
    912       __gen_uint(values->XOffset, 25, 31);
    913 
    914    const uint32_t v6 =
    915       __gen_uint(values->MCSEnable, 0, 0) |
    916       __gen_uint(values->YOffsetforUVPlane, 0, 13) |
    917       __gen_uint(values->AppendCounterEnable, 1, 1) |
    918       __gen_uint(values->AuxiliarySurfacePitch, 3, 11) |
    919       __gen_uint(values->XOffsetforUVPlane, 16, 29) |
    920       __gen_uint(values->ReservedMBZ, 30, 31);
    921    dw[6] = __gen_combine_address(data, &dw[6], values->AuxiliarySurfaceBaseAddress, v6);
    922 
    923    dw[7] =
    924       __gen_ufixed(values->ResourceMinLOD, 0, 11, 8) |
    925       __gen_uint(values->AlphaClearColor, 28, 28) |
    926       __gen_uint(values->BlueClearColor, 29, 29) |
    927       __gen_uint(values->GreenClearColor, 30, 30) |
    928       __gen_uint(values->RedClearColor, 31, 31);
    929 }
    930 
    931 #define GEN7_SAMPLER_BORDER_COLOR_STATE_length      4
    932 struct GEN7_SAMPLER_BORDER_COLOR_STATE {
    933    uint32_t                             BorderColorUnormRed;
    934    float                                BorderColorFloatRed;
    935    uint32_t                             BorderColorUnormGreen;
    936    uint32_t                             BorderColorUnormBlue;
    937    uint32_t                             BorderColorUnormAlpha;
    938    float                                BorderColorFloatGreen;
    939    float                                BorderColorFloatBlue;
    940    float                                BorderColorFloatAlpha;
    941 };
    942 
    943 static inline void
    944 GEN7_SAMPLER_BORDER_COLOR_STATE_pack(__attribute__((unused)) __gen_user_data *data,
    945                                      __attribute__((unused)) void * restrict dst,
    946                                      __attribute__((unused)) const struct GEN7_SAMPLER_BORDER_COLOR_STATE * restrict values)
    947 {
    948    uint32_t * restrict dw = (uint32_t * restrict) dst;
    949 
    950    dw[0] =
    951       __gen_uint(values->BorderColorUnormRed, 0, 7) |
    952       __gen_float(values->BorderColorFloatRed) |
    953       __gen_uint(values->BorderColorUnormGreen, 8, 15) |
    954       __gen_uint(values->BorderColorUnormBlue, 16, 23) |
    955       __gen_uint(values->BorderColorUnormAlpha, 24, 31);
    956 
    957    dw[1] =
    958       __gen_float(values->BorderColorFloatGreen);
    959 
    960    dw[2] =
    961       __gen_float(values->BorderColorFloatBlue);
    962 
    963    dw[3] =
    964       __gen_float(values->BorderColorFloatAlpha);
    965 }
    966 
    967 #define GEN7_SAMPLER_STATE_length              4
    968 struct GEN7_SAMPLER_STATE {
    969    uint32_t                             AnisotropicAlgorithm;
    970 #define LEGACY                                   0
    971 #define EWAApproximation                         1
    972    float                                TextureLODBias;
    973    uint32_t                             MinModeFilter;
    974 #define MAPFILTER_NEAREST                        0
    975 #define MAPFILTER_LINEAR                         1
    976 #define MAPFILTER_ANISOTROPIC                    2
    977 #define MAPFILTER_MONO                           6
    978    uint32_t                             MagModeFilter;
    979 #define MAPFILTER_NEAREST                        0
    980 #define MAPFILTER_LINEAR                         1
    981 #define MAPFILTER_ANISOTROPIC                    2
    982 #define MAPFILTER_MONO                           6
    983    uint32_t                             MipModeFilter;
    984 #define MIPFILTER_NONE                           0
    985 #define MIPFILTER_NEAREST                        1
    986 #define MIPFILTER_LINEAR                         3
    987    float                                BaseMipLevel;
    988    uint32_t                             LODPreClampEnable;
    989 #define CLAMP_ENABLE_OGL                         1
    990    uint32_t                             TextureBorderColorMode;
    991 #define DX10OGL                                  0
    992 #define DX9                                      1
    993    bool                                 SamplerDisable;
    994    uint32_t                             CubeSurfaceControlMode;
    995 #define PROGRAMMED                               0
    996 #define OVERRIDE                                 1
    997    uint32_t                             ShadowFunction;
    998 #define PREFILTEROPALWAYS                        0
    999 #define PREFILTEROPNEVER                         1
   1000 #define PREFILTEROPLESS                          2
   1001 #define PREFILTEROPEQUAL                         3
   1002 #define PREFILTEROPLEQUAL                        4
   1003 #define PREFILTEROPGREATER                       5
   1004 #define PREFILTEROPNOTEQUAL                      6
   1005 #define PREFILTEROPGEQUAL                        7
   1006    float                                MaxLOD;
   1007    float                                MinLOD;
   1008    uint64_t                             BorderColorPointer;
   1009    enum GEN7_TextureCoordinateMode      TCZAddressControlMode;
   1010    enum GEN7_TextureCoordinateMode      TCYAddressControlMode;
   1011    enum GEN7_TextureCoordinateMode      TCXAddressControlMode;
   1012    bool                                 NonnormalizedCoordinateEnable;
   1013    uint32_t                             TrilinearFilterQuality;
   1014 #define FULL                                     0
   1015 #define MED                                      2
   1016 #define LOW                                      3
   1017    bool                                 RAddressMinFilterRoundingEnable;
   1018    bool                                 RAddressMagFilterRoundingEnable;
   1019    bool                                 VAddressMinFilterRoundingEnable;
   1020    bool                                 VAddressMagFilterRoundingEnable;
   1021    bool                                 UAddressMinFilterRoundingEnable;
   1022    bool                                 UAddressMagFilterRoundingEnable;
   1023    uint32_t                             MaximumAnisotropy;
   1024 #define RATIO21                                  0
   1025 #define RATIO41                                  1
   1026 #define RATIO61                                  2
   1027 #define RATIO81                                  3
   1028 #define RATIO101                                 4
   1029 #define RATIO121                                 5
   1030 #define RATIO141                                 6
   1031 #define RATIO161                                 7
   1032    uint32_t                             ChromaKeyMode;
   1033 #define KEYFILTER_KILL_ON_ANY_MATCH              0
   1034 #define KEYFILTER_REPLACE_BLACK                  1
   1035    uint32_t                             ChromaKeyIndex;
   1036    bool                                 ChromaKeyEnable;
   1037 };
   1038 
   1039 static inline void
   1040 GEN7_SAMPLER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
   1041                         __attribute__((unused)) void * restrict dst,
   1042                         __attribute__((unused)) const struct GEN7_SAMPLER_STATE * restrict values)
   1043 {
   1044    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1045 
   1046    dw[0] =
   1047       __gen_uint(values->AnisotropicAlgorithm, 0, 0) |
   1048       __gen_sfixed(values->TextureLODBias, 1, 13, 8) |
   1049       __gen_uint(values->MinModeFilter, 14, 16) |
   1050       __gen_uint(values->MagModeFilter, 17, 19) |
   1051       __gen_uint(values->MipModeFilter, 20, 21) |
   1052       __gen_ufixed(values->BaseMipLevel, 22, 26, 1) |
   1053       __gen_uint(values->LODPreClampEnable, 28, 28) |
   1054       __gen_uint(values->TextureBorderColorMode, 29, 29) |
   1055       __gen_uint(values->SamplerDisable, 31, 31);
   1056 
   1057    dw[1] =
   1058       __gen_uint(values->CubeSurfaceControlMode, 0, 0) |
   1059       __gen_uint(values->ShadowFunction, 1, 3) |
   1060       __gen_ufixed(values->MaxLOD, 8, 19, 8) |
   1061       __gen_ufixed(values->MinLOD, 20, 31, 8);
   1062 
   1063    dw[2] =
   1064       __gen_offset(values->BorderColorPointer, 5, 31);
   1065 
   1066    dw[3] =
   1067       __gen_uint(values->TCZAddressControlMode, 0, 2) |
   1068       __gen_uint(values->TCYAddressControlMode, 3, 5) |
   1069       __gen_uint(values->TCXAddressControlMode, 6, 8) |
   1070       __gen_uint(values->NonnormalizedCoordinateEnable, 10, 10) |
   1071       __gen_uint(values->TrilinearFilterQuality, 11, 12) |
   1072       __gen_uint(values->RAddressMinFilterRoundingEnable, 13, 13) |
   1073       __gen_uint(values->RAddressMagFilterRoundingEnable, 14, 14) |
   1074       __gen_uint(values->VAddressMinFilterRoundingEnable, 15, 15) |
   1075       __gen_uint(values->VAddressMagFilterRoundingEnable, 16, 16) |
   1076       __gen_uint(values->UAddressMinFilterRoundingEnable, 17, 17) |
   1077       __gen_uint(values->UAddressMagFilterRoundingEnable, 18, 18) |
   1078       __gen_uint(values->MaximumAnisotropy, 19, 21) |
   1079       __gen_uint(values->ChromaKeyMode, 22, 22) |
   1080       __gen_uint(values->ChromaKeyIndex, 23, 24) |
   1081       __gen_uint(values->ChromaKeyEnable, 25, 25);
   1082 }
   1083 
   1084 #define GEN7_SCISSOR_RECT_length               2
   1085 struct GEN7_SCISSOR_RECT {
   1086    uint32_t                             ScissorRectangleXMin;
   1087    uint32_t                             ScissorRectangleYMin;
   1088    uint32_t                             ScissorRectangleXMax;
   1089    uint32_t                             ScissorRectangleYMax;
   1090 };
   1091 
   1092 static inline void
   1093 GEN7_SCISSOR_RECT_pack(__attribute__((unused)) __gen_user_data *data,
   1094                        __attribute__((unused)) void * restrict dst,
   1095                        __attribute__((unused)) const struct GEN7_SCISSOR_RECT * restrict values)
   1096 {
   1097    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1098 
   1099    dw[0] =
   1100       __gen_uint(values->ScissorRectangleXMin, 0, 15) |
   1101       __gen_uint(values->ScissorRectangleYMin, 16, 31);
   1102 
   1103    dw[1] =
   1104       __gen_uint(values->ScissorRectangleXMax, 0, 15) |
   1105       __gen_uint(values->ScissorRectangleYMax, 16, 31);
   1106 }
   1107 
   1108 #define GEN7_SF_CLIP_VIEWPORT_length          16
   1109 struct GEN7_SF_CLIP_VIEWPORT {
   1110    float                                ViewportMatrixElementm00;
   1111    float                                ViewportMatrixElementm11;
   1112    float                                ViewportMatrixElementm22;
   1113    float                                ViewportMatrixElementm30;
   1114    float                                ViewportMatrixElementm31;
   1115    float                                ViewportMatrixElementm32;
   1116    float                                XMinClipGuardband;
   1117    float                                XMaxClipGuardband;
   1118    float                                YMinClipGuardband;
   1119    float                                YMaxClipGuardband;
   1120 };
   1121 
   1122 static inline void
   1123 GEN7_SF_CLIP_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
   1124                            __attribute__((unused)) void * restrict dst,
   1125                            __attribute__((unused)) const struct GEN7_SF_CLIP_VIEWPORT * restrict values)
   1126 {
   1127    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1128 
   1129    dw[0] =
   1130       __gen_float(values->ViewportMatrixElementm00);
   1131 
   1132    dw[1] =
   1133       __gen_float(values->ViewportMatrixElementm11);
   1134 
   1135    dw[2] =
   1136       __gen_float(values->ViewportMatrixElementm22);
   1137 
   1138    dw[3] =
   1139       __gen_float(values->ViewportMatrixElementm30);
   1140 
   1141    dw[4] =
   1142       __gen_float(values->ViewportMatrixElementm31);
   1143 
   1144    dw[5] =
   1145       __gen_float(values->ViewportMatrixElementm32);
   1146 
   1147    dw[6] = 0;
   1148 
   1149    dw[7] = 0;
   1150 
   1151    dw[8] =
   1152       __gen_float(values->XMinClipGuardband);
   1153 
   1154    dw[9] =
   1155       __gen_float(values->XMaxClipGuardband);
   1156 
   1157    dw[10] =
   1158       __gen_float(values->YMinClipGuardband);
   1159 
   1160    dw[11] =
   1161       __gen_float(values->YMaxClipGuardband);
   1162 
   1163    dw[12] = 0;
   1164 
   1165    dw[13] = 0;
   1166 
   1167    dw[14] = 0;
   1168 
   1169    dw[15] = 0;
   1170 }
   1171 
   1172 #define GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_length      1
   1173 struct GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL {
   1174    uint32_t                             SourceAttribute;
   1175    uint32_t                             SwizzleSelect;
   1176 #define INPUTATTR                                0
   1177 #define INPUTATTR_FACING                         1
   1178 #define INPUTATTR_W                              2
   1179 #define INPUTATTR_FACING_W                       3
   1180    uint32_t                             ConstantSource;
   1181 #define CONST_0000                               0
   1182 #define CONST_0001_FLOAT                         1
   1183 #define CONST_1111_FLOAT                         2
   1184 #define PRIM_ID                                  3
   1185    uint32_t                             SwizzleControlMode;
   1186    bool                                 ComponentOverrideX;
   1187    bool                                 ComponentOverrideY;
   1188    bool                                 ComponentOverrideZ;
   1189    bool                                 ComponentOverrideW;
   1190 };
   1191 
   1192 static inline void
   1193 GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(__attribute__((unused)) __gen_user_data *data,
   1194                                      __attribute__((unused)) void * restrict dst,
   1195                                      __attribute__((unused)) const struct GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL * restrict values)
   1196 {
   1197    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1198 
   1199    dw[0] =
   1200       __gen_uint(values->SourceAttribute, 0, 4) |
   1201       __gen_uint(values->SwizzleSelect, 6, 7) |
   1202       __gen_uint(values->ConstantSource, 9, 10) |
   1203       __gen_uint(values->SwizzleControlMode, 11, 11) |
   1204       __gen_uint(values->ComponentOverrideX, 12, 12) |
   1205       __gen_uint(values->ComponentOverrideY, 13, 13) |
   1206       __gen_uint(values->ComponentOverrideZ, 14, 14) |
   1207       __gen_uint(values->ComponentOverrideW, 15, 15);
   1208 }
   1209 
   1210 #define GEN7_SO_DECL_length                    1
   1211 struct GEN7_SO_DECL {
   1212    uint32_t                             ComponentMask;
   1213    uint32_t                             RegisterIndex;
   1214    uint32_t                             HoleFlag;
   1215    uint32_t                             OutputBufferSlot;
   1216 };
   1217 
   1218 static inline void
   1219 GEN7_SO_DECL_pack(__attribute__((unused)) __gen_user_data *data,
   1220                   __attribute__((unused)) void * restrict dst,
   1221                   __attribute__((unused)) const struct GEN7_SO_DECL * restrict values)
   1222 {
   1223    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1224 
   1225    dw[0] =
   1226       __gen_uint(values->ComponentMask, 0, 3) |
   1227       __gen_uint(values->RegisterIndex, 4, 9) |
   1228       __gen_uint(values->HoleFlag, 11, 11) |
   1229       __gen_uint(values->OutputBufferSlot, 12, 13);
   1230 }
   1231 
   1232 #define GEN7_SO_DECL_ENTRY_length              2
   1233 struct GEN7_SO_DECL_ENTRY {
   1234    struct GEN7_SO_DECL                  Stream0Decl;
   1235    struct GEN7_SO_DECL                  Stream1Decl;
   1236    struct GEN7_SO_DECL                  Stream2Decl;
   1237    struct GEN7_SO_DECL                  Stream3Decl;
   1238 };
   1239 
   1240 static inline void
   1241 GEN7_SO_DECL_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
   1242                         __attribute__((unused)) void * restrict dst,
   1243                         __attribute__((unused)) const struct GEN7_SO_DECL_ENTRY * restrict values)
   1244 {
   1245    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1246 
   1247    uint32_t v0_0;
   1248    GEN7_SO_DECL_pack(data, &v0_0, &values->Stream0Decl);
   1249 
   1250    uint32_t v0_1;
   1251    GEN7_SO_DECL_pack(data, &v0_1, &values->Stream1Decl);
   1252 
   1253    dw[0] =
   1254       __gen_uint(v0_0, 0, 15) |
   1255       __gen_uint(v0_1, 16, 31);
   1256 
   1257    uint32_t v1_0;
   1258    GEN7_SO_DECL_pack(data, &v1_0, &values->Stream2Decl);
   1259 
   1260    uint32_t v1_1;
   1261    GEN7_SO_DECL_pack(data, &v1_1, &values->Stream3Decl);
   1262 
   1263    dw[1] =
   1264       __gen_uint(v1_0, 0, 15) |
   1265       __gen_uint(v1_1, 16, 31);
   1266 }
   1267 
   1268 #define GEN7_VERTEX_BUFFER_STATE_length        4
   1269 struct GEN7_VERTEX_BUFFER_STATE {
   1270    uint32_t                             BufferPitch;
   1271    bool                                 VertexFetchInvalidate;
   1272    bool                                 NullVertexBuffer;
   1273    bool                                 AddressModifyEnable;
   1274    uint32_t                             MOCS;
   1275    uint32_t                             BufferAccessType;
   1276 #define VERTEXDATA                               0
   1277 #define INSTANCEDATA                             1
   1278    uint32_t                             VertexBufferIndex;
   1279    __gen_address_type                   BufferStartingAddress;
   1280    __gen_address_type                   EndAddress;
   1281    uint32_t                             InstanceDataStepRate;
   1282 };
   1283 
   1284 static inline void
   1285 GEN7_VERTEX_BUFFER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
   1286                               __attribute__((unused)) void * restrict dst,
   1287                               __attribute__((unused)) const struct GEN7_VERTEX_BUFFER_STATE * restrict values)
   1288 {
   1289    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1290 
   1291    dw[0] =
   1292       __gen_uint(values->BufferPitch, 0, 11) |
   1293       __gen_uint(values->VertexFetchInvalidate, 12, 12) |
   1294       __gen_uint(values->NullVertexBuffer, 13, 13) |
   1295       __gen_uint(values->AddressModifyEnable, 14, 14) |
   1296       __gen_uint(values->MOCS, 16, 19) |
   1297       __gen_uint(values->BufferAccessType, 20, 20) |
   1298       __gen_uint(values->VertexBufferIndex, 26, 31);
   1299 
   1300    dw[1] = __gen_combine_address(data, &dw[1], values->BufferStartingAddress, 0);
   1301 
   1302    dw[2] = __gen_combine_address(data, &dw[2], values->EndAddress, 0);
   1303 
   1304    dw[3] =
   1305       __gen_uint(values->InstanceDataStepRate, 0, 31);
   1306 }
   1307 
   1308 #define GEN7_VERTEX_ELEMENT_STATE_length       2
   1309 struct GEN7_VERTEX_ELEMENT_STATE {
   1310    uint32_t                             SourceElementOffset;
   1311    bool                                 EdgeFlagEnable;
   1312    uint32_t                             SourceElementFormat;
   1313    bool                                 Valid;
   1314    uint32_t                             VertexBufferIndex;
   1315    enum GEN7_3D_Vertex_Component_Control Component3Control;
   1316    enum GEN7_3D_Vertex_Component_Control Component2Control;
   1317    enum GEN7_3D_Vertex_Component_Control Component1Control;
   1318    enum GEN7_3D_Vertex_Component_Control Component0Control;
   1319 };
   1320 
   1321 static inline void
   1322 GEN7_VERTEX_ELEMENT_STATE_pack(__attribute__((unused)) __gen_user_data *data,
   1323                                __attribute__((unused)) void * restrict dst,
   1324                                __attribute__((unused)) const struct GEN7_VERTEX_ELEMENT_STATE * restrict values)
   1325 {
   1326    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1327 
   1328    dw[0] =
   1329       __gen_uint(values->SourceElementOffset, 0, 11) |
   1330       __gen_uint(values->EdgeFlagEnable, 15, 15) |
   1331       __gen_uint(values->SourceElementFormat, 16, 24) |
   1332       __gen_uint(values->Valid, 25, 25) |
   1333       __gen_uint(values->VertexBufferIndex, 26, 31);
   1334 
   1335    dw[1] =
   1336       __gen_uint(values->Component3Control, 16, 18) |
   1337       __gen_uint(values->Component2Control, 20, 22) |
   1338       __gen_uint(values->Component1Control, 24, 26) |
   1339       __gen_uint(values->Component0Control, 28, 30);
   1340 }
   1341 
   1342 #define GEN7_3DPRIMITIVE_length                7
   1343 #define GEN7_3DPRIMITIVE_length_bias           2
   1344 #define GEN7_3DPRIMITIVE_header                 \
   1345    .DWordLength                         =      5,  \
   1346    ._3DCommandSubOpcode                 =      0,  \
   1347    ._3DCommandOpcode                    =      3,  \
   1348    .CommandSubType                      =      3,  \
   1349    .CommandType                         =      3
   1350 
   1351 struct GEN7_3DPRIMITIVE {
   1352    uint32_t                             DWordLength;
   1353    bool                                 PredicateEnable;
   1354    bool                                 IndirectParameterEnable;
   1355    uint32_t                             _3DCommandSubOpcode;
   1356    uint32_t                             _3DCommandOpcode;
   1357    uint32_t                             CommandSubType;
   1358    uint32_t                             CommandType;
   1359    enum GEN7_3D_Prim_Topo_Type          PrimitiveTopologyType;
   1360    uint32_t                             VertexAccessType;
   1361 #define SEQUENTIAL                               0
   1362 #define RANDOM                                   1
   1363    bool                                 EndOffsetEnable;
   1364    uint32_t                             VertexCountPerInstance;
   1365    uint32_t                             StartVertexLocation;
   1366    uint32_t                             InstanceCount;
   1367    uint32_t                             StartInstanceLocation;
   1368    int32_t                              BaseVertexLocation;
   1369 };
   1370 
   1371 static inline void
   1372 GEN7_3DPRIMITIVE_pack(__attribute__((unused)) __gen_user_data *data,
   1373                       __attribute__((unused)) void * restrict dst,
   1374                       __attribute__((unused)) const struct GEN7_3DPRIMITIVE * restrict values)
   1375 {
   1376    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1377 
   1378    dw[0] =
   1379       __gen_uint(values->DWordLength, 0, 7) |
   1380       __gen_uint(values->PredicateEnable, 8, 8) |
   1381       __gen_uint(values->IndirectParameterEnable, 10, 10) |
   1382       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   1383       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   1384       __gen_uint(values->CommandSubType, 27, 28) |
   1385       __gen_uint(values->CommandType, 29, 31);
   1386 
   1387    dw[1] =
   1388       __gen_uint(values->PrimitiveTopologyType, 0, 5) |
   1389       __gen_uint(values->VertexAccessType, 8, 8) |
   1390       __gen_uint(values->EndOffsetEnable, 9, 9);
   1391 
   1392    dw[2] =
   1393       __gen_uint(values->VertexCountPerInstance, 0, 31);
   1394 
   1395    dw[3] =
   1396       __gen_uint(values->StartVertexLocation, 0, 31);
   1397 
   1398    dw[4] =
   1399       __gen_uint(values->InstanceCount, 0, 31);
   1400 
   1401    dw[5] =
   1402       __gen_uint(values->StartInstanceLocation, 0, 31);
   1403 
   1404    dw[6] =
   1405       __gen_sint(values->BaseVertexLocation, 0, 31);
   1406 }
   1407 
   1408 #define GEN7_3DSTATE_AA_LINE_PARAMETERS_length      3
   1409 #define GEN7_3DSTATE_AA_LINE_PARAMETERS_length_bias      2
   1410 #define GEN7_3DSTATE_AA_LINE_PARAMETERS_header  \
   1411    .DWordLength                         =      1,  \
   1412    ._3DCommandSubOpcode                 =     10,  \
   1413    ._3DCommandOpcode                    =      1,  \
   1414    .CommandSubType                      =      3,  \
   1415    .CommandType                         =      3
   1416 
   1417 struct GEN7_3DSTATE_AA_LINE_PARAMETERS {
   1418    uint32_t                             DWordLength;
   1419    uint32_t                             _3DCommandSubOpcode;
   1420    uint32_t                             _3DCommandOpcode;
   1421    uint32_t                             CommandSubType;
   1422    uint32_t                             CommandType;
   1423    float                                AACoverageSlope;
   1424    float                                AACoverageBias;
   1425    float                                AACoverageEndCapSlope;
   1426    float                                AACoverageEndCapBias;
   1427 };
   1428 
   1429 static inline void
   1430 GEN7_3DSTATE_AA_LINE_PARAMETERS_pack(__attribute__((unused)) __gen_user_data *data,
   1431                                      __attribute__((unused)) void * restrict dst,
   1432                                      __attribute__((unused)) const struct GEN7_3DSTATE_AA_LINE_PARAMETERS * restrict values)
   1433 {
   1434    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1435 
   1436    dw[0] =
   1437       __gen_uint(values->DWordLength, 0, 7) |
   1438       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   1439       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   1440       __gen_uint(values->CommandSubType, 27, 28) |
   1441       __gen_uint(values->CommandType, 29, 31);
   1442 
   1443    dw[1] =
   1444       __gen_ufixed(values->AACoverageSlope, 0, 7, 8) |
   1445       __gen_ufixed(values->AACoverageBias, 16, 23, 8);
   1446 
   1447    dw[2] =
   1448       __gen_ufixed(values->AACoverageEndCapSlope, 0, 7, 8) |
   1449       __gen_ufixed(values->AACoverageEndCapBias, 16, 23, 8);
   1450 }
   1451 
   1452 #define GEN7_3DSTATE_BINDING_TABLE_POINTERS_DS_length      2
   1453 #define GEN7_3DSTATE_BINDING_TABLE_POINTERS_DS_length_bias      2
   1454 #define GEN7_3DSTATE_BINDING_TABLE_POINTERS_DS_header\
   1455    .DWordLength                         =      0,  \
   1456    ._3DCommandSubOpcode                 =     40,  \
   1457    ._3DCommandOpcode                    =      0,  \
   1458    .CommandSubType                      =      3,  \
   1459    .CommandType                         =      3
   1460 
   1461 struct GEN7_3DSTATE_BINDING_TABLE_POINTERS_DS {
   1462    uint32_t                             DWordLength;
   1463    uint32_t                             _3DCommandSubOpcode;
   1464    uint32_t                             _3DCommandOpcode;
   1465    uint32_t                             CommandSubType;
   1466    uint32_t                             CommandType;
   1467    uint64_t                             PointertoDSBindingTable;
   1468 };
   1469 
   1470 static inline void
   1471 GEN7_3DSTATE_BINDING_TABLE_POINTERS_DS_pack(__attribute__((unused)) __gen_user_data *data,
   1472                                             __attribute__((unused)) void * restrict dst,
   1473                                             __attribute__((unused)) const struct GEN7_3DSTATE_BINDING_TABLE_POINTERS_DS * restrict values)
   1474 {
   1475    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1476 
   1477    dw[0] =
   1478       __gen_uint(values->DWordLength, 0, 7) |
   1479       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   1480       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   1481       __gen_uint(values->CommandSubType, 27, 28) |
   1482       __gen_uint(values->CommandType, 29, 31);
   1483 
   1484    dw[1] =
   1485       __gen_offset(values->PointertoDSBindingTable, 5, 15);
   1486 }
   1487 
   1488 #define GEN7_3DSTATE_BINDING_TABLE_POINTERS_GS_length      2
   1489 #define GEN7_3DSTATE_BINDING_TABLE_POINTERS_GS_length_bias      2
   1490 #define GEN7_3DSTATE_BINDING_TABLE_POINTERS_GS_header\
   1491    .DWordLength                         =      0,  \
   1492    ._3DCommandSubOpcode                 =     41,  \
   1493    ._3DCommandOpcode                    =      0,  \
   1494    .CommandSubType                      =      3,  \
   1495    .CommandType                         =      3
   1496 
   1497 struct GEN7_3DSTATE_BINDING_TABLE_POINTERS_GS {
   1498    uint32_t                             DWordLength;
   1499    uint32_t                             _3DCommandSubOpcode;
   1500    uint32_t                             _3DCommandOpcode;
   1501    uint32_t                             CommandSubType;
   1502    uint32_t                             CommandType;
   1503    uint64_t                             PointertoGSBindingTable;
   1504 };
   1505 
   1506 static inline void
   1507 GEN7_3DSTATE_BINDING_TABLE_POINTERS_GS_pack(__attribute__((unused)) __gen_user_data *data,
   1508                                             __attribute__((unused)) void * restrict dst,
   1509                                             __attribute__((unused)) const struct GEN7_3DSTATE_BINDING_TABLE_POINTERS_GS * restrict values)
   1510 {
   1511    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1512 
   1513    dw[0] =
   1514       __gen_uint(values->DWordLength, 0, 7) |
   1515       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   1516       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   1517       __gen_uint(values->CommandSubType, 27, 28) |
   1518       __gen_uint(values->CommandType, 29, 31);
   1519 
   1520    dw[1] =
   1521       __gen_offset(values->PointertoGSBindingTable, 5, 15);
   1522 }
   1523 
   1524 #define GEN7_3DSTATE_BINDING_TABLE_POINTERS_HS_length      2
   1525 #define GEN7_3DSTATE_BINDING_TABLE_POINTERS_HS_length_bias      2
   1526 #define GEN7_3DSTATE_BINDING_TABLE_POINTERS_HS_header\
   1527    .DWordLength                         =      0,  \
   1528    ._3DCommandSubOpcode                 =     39,  \
   1529    ._3DCommandOpcode                    =      0,  \
   1530    .CommandSubType                      =      3,  \
   1531    .CommandType                         =      3
   1532 
   1533 struct GEN7_3DSTATE_BINDING_TABLE_POINTERS_HS {
   1534    uint32_t                             DWordLength;
   1535    uint32_t                             _3DCommandSubOpcode;
   1536    uint32_t                             _3DCommandOpcode;
   1537    uint32_t                             CommandSubType;
   1538    uint32_t                             CommandType;
   1539    uint64_t                             PointertoHSBindingTable;
   1540 };
   1541 
   1542 static inline void
   1543 GEN7_3DSTATE_BINDING_TABLE_POINTERS_HS_pack(__attribute__((unused)) __gen_user_data *data,
   1544                                             __attribute__((unused)) void * restrict dst,
   1545                                             __attribute__((unused)) const struct GEN7_3DSTATE_BINDING_TABLE_POINTERS_HS * restrict values)
   1546 {
   1547    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1548 
   1549    dw[0] =
   1550       __gen_uint(values->DWordLength, 0, 7) |
   1551       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   1552       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   1553       __gen_uint(values->CommandSubType, 27, 28) |
   1554       __gen_uint(values->CommandType, 29, 31);
   1555 
   1556    dw[1] =
   1557       __gen_offset(values->PointertoHSBindingTable, 5, 15);
   1558 }
   1559 
   1560 #define GEN7_3DSTATE_BINDING_TABLE_POINTERS_PS_length      2
   1561 #define GEN7_3DSTATE_BINDING_TABLE_POINTERS_PS_length_bias      2
   1562 #define GEN7_3DSTATE_BINDING_TABLE_POINTERS_PS_header\
   1563    .DWordLength                         =      0,  \
   1564    ._3DCommandSubOpcode                 =     42,  \
   1565    ._3DCommandOpcode                    =      0,  \
   1566    .CommandSubType                      =      3,  \
   1567    .CommandType                         =      3
   1568 
   1569 struct GEN7_3DSTATE_BINDING_TABLE_POINTERS_PS {
   1570    uint32_t                             DWordLength;
   1571    uint32_t                             _3DCommandSubOpcode;
   1572    uint32_t                             _3DCommandOpcode;
   1573    uint32_t                             CommandSubType;
   1574    uint32_t                             CommandType;
   1575    uint64_t                             PointertoPSBindingTable;
   1576 };
   1577 
   1578 static inline void
   1579 GEN7_3DSTATE_BINDING_TABLE_POINTERS_PS_pack(__attribute__((unused)) __gen_user_data *data,
   1580                                             __attribute__((unused)) void * restrict dst,
   1581                                             __attribute__((unused)) const struct GEN7_3DSTATE_BINDING_TABLE_POINTERS_PS * restrict values)
   1582 {
   1583    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1584 
   1585    dw[0] =
   1586       __gen_uint(values->DWordLength, 0, 7) |
   1587       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   1588       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   1589       __gen_uint(values->CommandSubType, 27, 28) |
   1590       __gen_uint(values->CommandType, 29, 31);
   1591 
   1592    dw[1] =
   1593       __gen_offset(values->PointertoPSBindingTable, 5, 15);
   1594 }
   1595 
   1596 #define GEN7_3DSTATE_BINDING_TABLE_POINTERS_VS_length      2
   1597 #define GEN7_3DSTATE_BINDING_TABLE_POINTERS_VS_length_bias      2
   1598 #define GEN7_3DSTATE_BINDING_TABLE_POINTERS_VS_header\
   1599    .DWordLength                         =      0,  \
   1600    ._3DCommandSubOpcode                 =     38,  \
   1601    ._3DCommandOpcode                    =      0,  \
   1602    .CommandSubType                      =      3,  \
   1603    .CommandType                         =      3
   1604 
   1605 struct GEN7_3DSTATE_BINDING_TABLE_POINTERS_VS {
   1606    uint32_t                             DWordLength;
   1607    uint32_t                             _3DCommandSubOpcode;
   1608    uint32_t                             _3DCommandOpcode;
   1609    uint32_t                             CommandSubType;
   1610    uint32_t                             CommandType;
   1611    uint64_t                             PointertoVSBindingTable;
   1612 };
   1613 
   1614 static inline void
   1615 GEN7_3DSTATE_BINDING_TABLE_POINTERS_VS_pack(__attribute__((unused)) __gen_user_data *data,
   1616                                             __attribute__((unused)) void * restrict dst,
   1617                                             __attribute__((unused)) const struct GEN7_3DSTATE_BINDING_TABLE_POINTERS_VS * restrict values)
   1618 {
   1619    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1620 
   1621    dw[0] =
   1622       __gen_uint(values->DWordLength, 0, 7) |
   1623       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   1624       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   1625       __gen_uint(values->CommandSubType, 27, 28) |
   1626       __gen_uint(values->CommandType, 29, 31);
   1627 
   1628    dw[1] =
   1629       __gen_offset(values->PointertoVSBindingTable, 5, 15);
   1630 }
   1631 
   1632 #define GEN7_3DSTATE_BLEND_STATE_POINTERS_length      2
   1633 #define GEN7_3DSTATE_BLEND_STATE_POINTERS_length_bias      2
   1634 #define GEN7_3DSTATE_BLEND_STATE_POINTERS_header\
   1635    .DWordLength                         =      0,  \
   1636    ._3DCommandSubOpcode                 =     36,  \
   1637    ._3DCommandOpcode                    =      0,  \
   1638    .CommandSubType                      =      3,  \
   1639    .CommandType                         =      3
   1640 
   1641 struct GEN7_3DSTATE_BLEND_STATE_POINTERS {
   1642    uint32_t                             DWordLength;
   1643    uint32_t                             _3DCommandSubOpcode;
   1644    uint32_t                             _3DCommandOpcode;
   1645    uint32_t                             CommandSubType;
   1646    uint32_t                             CommandType;
   1647    uint64_t                             BlendStatePointer;
   1648 };
   1649 
   1650 static inline void
   1651 GEN7_3DSTATE_BLEND_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
   1652                                        __attribute__((unused)) void * restrict dst,
   1653                                        __attribute__((unused)) const struct GEN7_3DSTATE_BLEND_STATE_POINTERS * restrict values)
   1654 {
   1655    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1656 
   1657    dw[0] =
   1658       __gen_uint(values->DWordLength, 0, 7) |
   1659       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   1660       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   1661       __gen_uint(values->CommandSubType, 27, 28) |
   1662       __gen_uint(values->CommandType, 29, 31);
   1663 
   1664    dw[1] =
   1665       __gen_mbo(0, 0) |
   1666       __gen_offset(values->BlendStatePointer, 6, 31);
   1667 }
   1668 
   1669 #define GEN7_3DSTATE_CC_STATE_POINTERS_length      2
   1670 #define GEN7_3DSTATE_CC_STATE_POINTERS_length_bias      2
   1671 #define GEN7_3DSTATE_CC_STATE_POINTERS_header   \
   1672    .DWordLength                         =      0,  \
   1673    ._3DCommandSubOpcode                 =     14,  \
   1674    ._3DCommandOpcode                    =      0,  \
   1675    .CommandSubType                      =      3,  \
   1676    .CommandType                         =      3
   1677 
   1678 struct GEN7_3DSTATE_CC_STATE_POINTERS {
   1679    uint32_t                             DWordLength;
   1680    uint32_t                             _3DCommandSubOpcode;
   1681    uint32_t                             _3DCommandOpcode;
   1682    uint32_t                             CommandSubType;
   1683    uint32_t                             CommandType;
   1684    uint64_t                             ColorCalcStatePointer;
   1685 };
   1686 
   1687 static inline void
   1688 GEN7_3DSTATE_CC_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
   1689                                     __attribute__((unused)) void * restrict dst,
   1690                                     __attribute__((unused)) const struct GEN7_3DSTATE_CC_STATE_POINTERS * restrict values)
   1691 {
   1692    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1693 
   1694    dw[0] =
   1695       __gen_uint(values->DWordLength, 0, 7) |
   1696       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   1697       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   1698       __gen_uint(values->CommandSubType, 27, 28) |
   1699       __gen_uint(values->CommandType, 29, 31);
   1700 
   1701    dw[1] =
   1702       __gen_mbo(0, 0) |
   1703       __gen_offset(values->ColorCalcStatePointer, 6, 31);
   1704 }
   1705 
   1706 #define GEN7_3DSTATE_CHROMA_KEY_length         4
   1707 #define GEN7_3DSTATE_CHROMA_KEY_length_bias      2
   1708 #define GEN7_3DSTATE_CHROMA_KEY_header          \
   1709    .DWordLength                         =      2,  \
   1710    ._3DCommandSubOpcode                 =      4,  \
   1711    ._3DCommandOpcode                    =      1,  \
   1712    .CommandSubType                      =      3,  \
   1713    .CommandType                         =      3
   1714 
   1715 struct GEN7_3DSTATE_CHROMA_KEY {
   1716    uint32_t                             DWordLength;
   1717    uint32_t                             _3DCommandSubOpcode;
   1718    uint32_t                             _3DCommandOpcode;
   1719    uint32_t                             CommandSubType;
   1720    uint32_t                             CommandType;
   1721    uint32_t                             ChromaKeyTableIndex;
   1722    uint32_t                             ChromaKeyLowValue;
   1723    uint32_t                             ChromaKeyHighValue;
   1724 };
   1725 
   1726 static inline void
   1727 GEN7_3DSTATE_CHROMA_KEY_pack(__attribute__((unused)) __gen_user_data *data,
   1728                              __attribute__((unused)) void * restrict dst,
   1729                              __attribute__((unused)) const struct GEN7_3DSTATE_CHROMA_KEY * restrict values)
   1730 {
   1731    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1732 
   1733    dw[0] =
   1734       __gen_uint(values->DWordLength, 0, 7) |
   1735       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   1736       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   1737       __gen_uint(values->CommandSubType, 27, 28) |
   1738       __gen_uint(values->CommandType, 29, 31);
   1739 
   1740    dw[1] =
   1741       __gen_uint(values->ChromaKeyTableIndex, 30, 31);
   1742 
   1743    dw[2] =
   1744       __gen_uint(values->ChromaKeyLowValue, 0, 31);
   1745 
   1746    dw[3] =
   1747       __gen_uint(values->ChromaKeyHighValue, 0, 31);
   1748 }
   1749 
   1750 #define GEN7_3DSTATE_CLEAR_PARAMS_length       3
   1751 #define GEN7_3DSTATE_CLEAR_PARAMS_length_bias      2
   1752 #define GEN7_3DSTATE_CLEAR_PARAMS_header        \
   1753    .DWordLength                         =      1,  \
   1754    ._3DCommandSubOpcode                 =      4,  \
   1755    ._3DCommandOpcode                    =      0,  \
   1756    .CommandSubType                      =      3,  \
   1757    .CommandType                         =      3
   1758 
   1759 struct GEN7_3DSTATE_CLEAR_PARAMS {
   1760    uint32_t                             DWordLength;
   1761    uint32_t                             _3DCommandSubOpcode;
   1762    uint32_t                             _3DCommandOpcode;
   1763    uint32_t                             CommandSubType;
   1764    uint32_t                             CommandType;
   1765    uint32_t                             DepthClearValue;
   1766    bool                                 DepthClearValueValid;
   1767 };
   1768 
   1769 static inline void
   1770 GEN7_3DSTATE_CLEAR_PARAMS_pack(__attribute__((unused)) __gen_user_data *data,
   1771                                __attribute__((unused)) void * restrict dst,
   1772                                __attribute__((unused)) const struct GEN7_3DSTATE_CLEAR_PARAMS * restrict values)
   1773 {
   1774    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1775 
   1776    dw[0] =
   1777       __gen_uint(values->DWordLength, 0, 7) |
   1778       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   1779       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   1780       __gen_uint(values->CommandSubType, 27, 28) |
   1781       __gen_uint(values->CommandType, 29, 31);
   1782 
   1783    dw[1] =
   1784       __gen_uint(values->DepthClearValue, 0, 31);
   1785 
   1786    dw[2] =
   1787       __gen_uint(values->DepthClearValueValid, 0, 0);
   1788 }
   1789 
   1790 #define GEN7_3DSTATE_CLIP_length               4
   1791 #define GEN7_3DSTATE_CLIP_length_bias          2
   1792 #define GEN7_3DSTATE_CLIP_header                \
   1793    .DWordLength                         =      2,  \
   1794    ._3DCommandSubOpcode                 =     18,  \
   1795    ._3DCommandOpcode                    =      0,  \
   1796    .CommandSubType                      =      3,  \
   1797    .CommandType                         =      3
   1798 
   1799 struct GEN7_3DSTATE_CLIP {
   1800    uint32_t                             DWordLength;
   1801    uint32_t                             _3DCommandSubOpcode;
   1802    uint32_t                             _3DCommandOpcode;
   1803    uint32_t                             CommandSubType;
   1804    uint32_t                             CommandType;
   1805    uint32_t                             UserClipDistanceCullTestEnableBitmask;
   1806    bool                                 StatisticsEnable;
   1807    uint32_t                             CullMode;
   1808 #define CULLMODE_BOTH                            0
   1809 #define CULLMODE_NONE                            1
   1810 #define CULLMODE_FRONT                           2
   1811 #define CULLMODE_BACK                            3
   1812    bool                                 EarlyCullEnable;
   1813    uint32_t                             VertexSubPixelPrecisionSelect;
   1814    uint32_t                             FrontWinding;
   1815    uint32_t                             TriangleFanProvokingVertexSelect;
   1816 #define Vertex0                                  0
   1817 #define Vertex1                                  1
   1818 #define Vertex2                                  2
   1819    uint32_t                             LineStripListProvokingVertexSelect;
   1820 #define Vertex0                                  0
   1821 #define Vertex1                                  1
   1822    uint32_t                             TriangleStripListProvokingVertexSelect;
   1823 #define Vertex0                                  0
   1824 #define Vertex1                                  1
   1825 #define Vertex2                                  2
   1826    bool                                 NonPerspectiveBarycentricEnable;
   1827    bool                                 PerspectiveDivideDisable;
   1828    uint32_t                             ClipMode;
   1829 #define CLIPMODE_NORMAL                          0
   1830 #define CLIPMODE_REJECT_ALL                      3
   1831 #define CLIPMODE_ACCEPT_ALL                      4
   1832    uint32_t                             UserClipDistanceClipTestEnableBitmask;
   1833    bool                                 GuardbandClipTestEnable;
   1834    bool                                 ViewportZClipTestEnable;
   1835    bool                                 ViewportXYClipTestEnable;
   1836    uint32_t                             APIMode;
   1837 #define APIMODE_OGL                              0
   1838 #define APIMODE_D3D                              1
   1839    bool                                 ClipEnable;
   1840    uint32_t                             MaximumVPIndex;
   1841    bool                                 ForceZeroRTAIndexEnable;
   1842    float                                MaximumPointWidth;
   1843    float                                MinimumPointWidth;
   1844 };
   1845 
   1846 static inline void
   1847 GEN7_3DSTATE_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
   1848                        __attribute__((unused)) void * restrict dst,
   1849                        __attribute__((unused)) const struct GEN7_3DSTATE_CLIP * restrict values)
   1850 {
   1851    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1852 
   1853    dw[0] =
   1854       __gen_uint(values->DWordLength, 0, 7) |
   1855       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   1856       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   1857       __gen_uint(values->CommandSubType, 27, 28) |
   1858       __gen_uint(values->CommandType, 29, 31);
   1859 
   1860    dw[1] =
   1861       __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
   1862       __gen_uint(values->StatisticsEnable, 10, 10) |
   1863       __gen_uint(values->CullMode, 16, 17) |
   1864       __gen_uint(values->EarlyCullEnable, 18, 18) |
   1865       __gen_uint(values->VertexSubPixelPrecisionSelect, 19, 19) |
   1866       __gen_uint(values->FrontWinding, 20, 20);
   1867 
   1868    dw[2] =
   1869       __gen_uint(values->TriangleFanProvokingVertexSelect, 0, 1) |
   1870       __gen_uint(values->LineStripListProvokingVertexSelect, 2, 3) |
   1871       __gen_uint(values->TriangleStripListProvokingVertexSelect, 4, 5) |
   1872       __gen_uint(values->NonPerspectiveBarycentricEnable, 8, 8) |
   1873       __gen_uint(values->PerspectiveDivideDisable, 9, 9) |
   1874       __gen_uint(values->ClipMode, 13, 15) |
   1875       __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 16, 23) |
   1876       __gen_uint(values->GuardbandClipTestEnable, 26, 26) |
   1877       __gen_uint(values->ViewportZClipTestEnable, 27, 27) |
   1878       __gen_uint(values->ViewportXYClipTestEnable, 28, 28) |
   1879       __gen_uint(values->APIMode, 30, 30) |
   1880       __gen_uint(values->ClipEnable, 31, 31);
   1881 
   1882    dw[3] =
   1883       __gen_uint(values->MaximumVPIndex, 0, 3) |
   1884       __gen_uint(values->ForceZeroRTAIndexEnable, 5, 5) |
   1885       __gen_ufixed(values->MaximumPointWidth, 6, 16, 3) |
   1886       __gen_ufixed(values->MinimumPointWidth, 17, 27, 3);
   1887 }
   1888 
   1889 #define GEN7_3DSTATE_CONSTANT_DS_length        7
   1890 #define GEN7_3DSTATE_CONSTANT_DS_length_bias      2
   1891 #define GEN7_3DSTATE_CONSTANT_DS_header         \
   1892    .DWordLength                         =      5,  \
   1893    ._3DCommandSubOpcode                 =     26,  \
   1894    ._3DCommandOpcode                    =      0,  \
   1895    .CommandSubType                      =      3,  \
   1896    .CommandType                         =      3
   1897 
   1898 struct GEN7_3DSTATE_CONSTANT_DS {
   1899    uint32_t                             DWordLength;
   1900    uint32_t                             _3DCommandSubOpcode;
   1901    uint32_t                             _3DCommandOpcode;
   1902    uint32_t                             CommandSubType;
   1903    uint32_t                             CommandType;
   1904    struct GEN7_3DSTATE_CONSTANT_BODY    ConstantBody;
   1905 };
   1906 
   1907 static inline void
   1908 GEN7_3DSTATE_CONSTANT_DS_pack(__attribute__((unused)) __gen_user_data *data,
   1909                               __attribute__((unused)) void * restrict dst,
   1910                               __attribute__((unused)) const struct GEN7_3DSTATE_CONSTANT_DS * restrict values)
   1911 {
   1912    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1913 
   1914    dw[0] =
   1915       __gen_uint(values->DWordLength, 0, 7) |
   1916       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   1917       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   1918       __gen_uint(values->CommandSubType, 27, 28) |
   1919       __gen_uint(values->CommandType, 29, 31);
   1920 
   1921    GEN7_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
   1922 }
   1923 
   1924 #define GEN7_3DSTATE_CONSTANT_GS_length        7
   1925 #define GEN7_3DSTATE_CONSTANT_GS_length_bias      2
   1926 #define GEN7_3DSTATE_CONSTANT_GS_header         \
   1927    .DWordLength                         =      5,  \
   1928    ._3DCommandSubOpcode                 =     22,  \
   1929    ._3DCommandOpcode                    =      0,  \
   1930    .CommandSubType                      =      3,  \
   1931    .CommandType                         =      3
   1932 
   1933 struct GEN7_3DSTATE_CONSTANT_GS {
   1934    uint32_t                             DWordLength;
   1935    uint32_t                             _3DCommandSubOpcode;
   1936    uint32_t                             _3DCommandOpcode;
   1937    uint32_t                             CommandSubType;
   1938    uint32_t                             CommandType;
   1939    struct GEN7_3DSTATE_CONSTANT_BODY    ConstantBody;
   1940 };
   1941 
   1942 static inline void
   1943 GEN7_3DSTATE_CONSTANT_GS_pack(__attribute__((unused)) __gen_user_data *data,
   1944                               __attribute__((unused)) void * restrict dst,
   1945                               __attribute__((unused)) const struct GEN7_3DSTATE_CONSTANT_GS * restrict values)
   1946 {
   1947    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1948 
   1949    dw[0] =
   1950       __gen_uint(values->DWordLength, 0, 7) |
   1951       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   1952       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   1953       __gen_uint(values->CommandSubType, 27, 28) |
   1954       __gen_uint(values->CommandType, 29, 31);
   1955 
   1956    GEN7_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
   1957 }
   1958 
   1959 #define GEN7_3DSTATE_CONSTANT_HS_length        7
   1960 #define GEN7_3DSTATE_CONSTANT_HS_length_bias      2
   1961 #define GEN7_3DSTATE_CONSTANT_HS_header         \
   1962    .DWordLength                         =      5,  \
   1963    ._3DCommandSubOpcode                 =     25,  \
   1964    ._3DCommandOpcode                    =      0,  \
   1965    .CommandSubType                      =      3,  \
   1966    .CommandType                         =      3
   1967 
   1968 struct GEN7_3DSTATE_CONSTANT_HS {
   1969    uint32_t                             DWordLength;
   1970    uint32_t                             _3DCommandSubOpcode;
   1971    uint32_t                             _3DCommandOpcode;
   1972    uint32_t                             CommandSubType;
   1973    uint32_t                             CommandType;
   1974    struct GEN7_3DSTATE_CONSTANT_BODY    ConstantBody;
   1975 };
   1976 
   1977 static inline void
   1978 GEN7_3DSTATE_CONSTANT_HS_pack(__attribute__((unused)) __gen_user_data *data,
   1979                               __attribute__((unused)) void * restrict dst,
   1980                               __attribute__((unused)) const struct GEN7_3DSTATE_CONSTANT_HS * restrict values)
   1981 {
   1982    uint32_t * restrict dw = (uint32_t * restrict) dst;
   1983 
   1984    dw[0] =
   1985       __gen_uint(values->DWordLength, 0, 7) |
   1986       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   1987       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   1988       __gen_uint(values->CommandSubType, 27, 28) |
   1989       __gen_uint(values->CommandType, 29, 31);
   1990 
   1991    GEN7_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
   1992 }
   1993 
   1994 #define GEN7_3DSTATE_CONSTANT_PS_length        7
   1995 #define GEN7_3DSTATE_CONSTANT_PS_length_bias      2
   1996 #define GEN7_3DSTATE_CONSTANT_PS_header         \
   1997    .DWordLength                         =      5,  \
   1998    ._3DCommandSubOpcode                 =     23,  \
   1999    ._3DCommandOpcode                    =      0,  \
   2000    .CommandSubType                      =      3,  \
   2001    .CommandType                         =      3
   2002 
   2003 struct GEN7_3DSTATE_CONSTANT_PS {
   2004    uint32_t                             DWordLength;
   2005    uint32_t                             _3DCommandSubOpcode;
   2006    uint32_t                             _3DCommandOpcode;
   2007    uint32_t                             CommandSubType;
   2008    uint32_t                             CommandType;
   2009    struct GEN7_3DSTATE_CONSTANT_BODY    ConstantBody;
   2010 };
   2011 
   2012 static inline void
   2013 GEN7_3DSTATE_CONSTANT_PS_pack(__attribute__((unused)) __gen_user_data *data,
   2014                               __attribute__((unused)) void * restrict dst,
   2015                               __attribute__((unused)) const struct GEN7_3DSTATE_CONSTANT_PS * restrict values)
   2016 {
   2017    uint32_t * restrict dw = (uint32_t * restrict) dst;
   2018 
   2019    dw[0] =
   2020       __gen_uint(values->DWordLength, 0, 7) |
   2021       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   2022       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   2023       __gen_uint(values->CommandSubType, 27, 28) |
   2024       __gen_uint(values->CommandType, 29, 31);
   2025 
   2026    GEN7_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
   2027 }
   2028 
   2029 #define GEN7_3DSTATE_CONSTANT_VS_length        7
   2030 #define GEN7_3DSTATE_CONSTANT_VS_length_bias      2
   2031 #define GEN7_3DSTATE_CONSTANT_VS_header         \
   2032    .DWordLength                         =      5,  \
   2033    ._3DCommandSubOpcode                 =     21,  \
   2034    ._3DCommandOpcode                    =      0,  \
   2035    .CommandSubType                      =      3,  \
   2036    .CommandType                         =      3
   2037 
   2038 struct GEN7_3DSTATE_CONSTANT_VS {
   2039    uint32_t                             DWordLength;
   2040    uint32_t                             _3DCommandSubOpcode;
   2041    uint32_t                             _3DCommandOpcode;
   2042    uint32_t                             CommandSubType;
   2043    uint32_t                             CommandType;
   2044    struct GEN7_3DSTATE_CONSTANT_BODY    ConstantBody;
   2045 };
   2046 
   2047 static inline void
   2048 GEN7_3DSTATE_CONSTANT_VS_pack(__attribute__((unused)) __gen_user_data *data,
   2049                               __attribute__((unused)) void * restrict dst,
   2050                               __attribute__((unused)) const struct GEN7_3DSTATE_CONSTANT_VS * restrict values)
   2051 {
   2052    uint32_t * restrict dw = (uint32_t * restrict) dst;
   2053 
   2054    dw[0] =
   2055       __gen_uint(values->DWordLength, 0, 7) |
   2056       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   2057       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   2058       __gen_uint(values->CommandSubType, 27, 28) |
   2059       __gen_uint(values->CommandType, 29, 31);
   2060 
   2061    GEN7_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
   2062 }
   2063 
   2064 #define GEN7_3DSTATE_DEPTH_BUFFER_length       7
   2065 #define GEN7_3DSTATE_DEPTH_BUFFER_length_bias      2
   2066 #define GEN7_3DSTATE_DEPTH_BUFFER_header        \
   2067    .DWordLength                         =      5,  \
   2068    ._3DCommandSubOpcode                 =      5,  \
   2069    ._3DCommandOpcode                    =      0,  \
   2070    .CommandSubType                      =      3,  \
   2071    .CommandType                         =      3
   2072 
   2073 struct GEN7_3DSTATE_DEPTH_BUFFER {
   2074    uint32_t                             DWordLength;
   2075    uint32_t                             _3DCommandSubOpcode;
   2076    uint32_t                             _3DCommandOpcode;
   2077    uint32_t                             CommandSubType;
   2078    uint32_t                             CommandType;
   2079    uint32_t                             SurfacePitch;
   2080    uint32_t                             SurfaceFormat;
   2081 #define D32_FLOAT                                1
   2082 #define D24_UNORM_X8_UINT                        3
   2083 #define D16_UNORM                                5
   2084    bool                                 HierarchicalDepthBufferEnable;
   2085    bool                                 StencilWriteEnable;
   2086    bool                                 DepthWriteEnable;
   2087    uint32_t                             SurfaceType;
   2088 #define SURFTYPE_1D                              0
   2089 #define SURFTYPE_2D                              1
   2090 #define SURFTYPE_3D                              2
   2091 #define SURFTYPE_CUBE                            3
   2092 #define SURFTYPE_NULL                            7
   2093    __gen_address_type                   SurfaceBaseAddress;
   2094    uint32_t                             LOD;
   2095    uint32_t                             Width;
   2096    uint32_t                             Height;
   2097    uint32_t                             MOCS;
   2098    uint32_t                             MinimumArrayElement;
   2099    uint32_t                             Depth;
   2100 #define SURFTYPE_CUBEmustbezero                  0
   2101    int32_t                              DepthCoordinateOffsetX;
   2102    int32_t                              DepthCoordinateOffsetY;
   2103    uint32_t                             RenderTargetViewExtent;
   2104 };
   2105 
   2106 static inline void
   2107 GEN7_3DSTATE_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
   2108                                __attribute__((unused)) void * restrict dst,
   2109                                __attribute__((unused)) const struct GEN7_3DSTATE_DEPTH_BUFFER * restrict values)
   2110 {
   2111    uint32_t * restrict dw = (uint32_t * restrict) dst;
   2112 
   2113    dw[0] =
   2114       __gen_uint(values->DWordLength, 0, 7) |
   2115       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   2116       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   2117       __gen_uint(values->CommandSubType, 27, 28) |
   2118       __gen_uint(values->CommandType, 29, 31);
   2119 
   2120    dw[1] =
   2121       __gen_uint(values->SurfacePitch, 0, 17) |
   2122       __gen_uint(values->SurfaceFormat, 18, 20) |
   2123       __gen_uint(values->HierarchicalDepthBufferEnable, 22, 22) |
   2124       __gen_uint(values->StencilWriteEnable, 27, 27) |
   2125       __gen_uint(values->DepthWriteEnable, 28, 28) |
   2126       __gen_uint(values->SurfaceType, 29, 31);
   2127 
   2128    dw[2] = __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
   2129 
   2130    dw[3] =
   2131       __gen_uint(values->LOD, 0, 3) |
   2132       __gen_uint(values->Width, 4, 17) |
   2133       __gen_uint(values->Height, 18, 31);
   2134 
   2135    dw[4] =
   2136       __gen_uint(values->MOCS, 0, 3) |
   2137       __gen_uint(values->MinimumArrayElement, 10, 20) |
   2138       __gen_uint(values->Depth, 21, 31);
   2139 
   2140    dw[5] =
   2141       __gen_sint(values->DepthCoordinateOffsetX, 0, 15) |
   2142       __gen_sint(values->DepthCoordinateOffsetY, 16, 31);
   2143 
   2144    dw[6] =
   2145       __gen_uint(values->RenderTargetViewExtent, 21, 31);
   2146 }
   2147 
   2148 #define GEN7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS_length      2
   2149 #define GEN7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS_length_bias      2
   2150 #define GEN7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS_header\
   2151    .DWordLength                         =      0,  \
   2152    ._3DCommandSubOpcode                 =     37,  \
   2153    ._3DCommandOpcode                    =      0,  \
   2154    .CommandSubType                      =      3,  \
   2155    .CommandType                         =      3
   2156 
   2157 struct GEN7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS {
   2158    uint32_t                             DWordLength;
   2159    uint32_t                             _3DCommandSubOpcode;
   2160    uint32_t                             _3DCommandOpcode;
   2161    uint32_t                             CommandSubType;
   2162    uint32_t                             CommandType;
   2163    uint64_t                             PointertoDEPTH_STENCIL_STATE;
   2164 };
   2165 
   2166 static inline void
   2167 GEN7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
   2168                                                __attribute__((unused)) void * restrict dst,
   2169                                                __attribute__((unused)) const struct GEN7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS * restrict values)
   2170 {
   2171    uint32_t * restrict dw = (uint32_t * restrict) dst;
   2172 
   2173    dw[0] =
   2174       __gen_uint(values->DWordLength, 0, 7) |
   2175       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   2176       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   2177       __gen_uint(values->CommandSubType, 27, 28) |
   2178       __gen_uint(values->CommandType, 29, 31);
   2179 
   2180    dw[1] =
   2181       __gen_mbo(0, 0) |
   2182       __gen_offset(values->PointertoDEPTH_STENCIL_STATE, 6, 31);
   2183 }
   2184 
   2185 #define GEN7_3DSTATE_DRAWING_RECTANGLE_length      4
   2186 #define GEN7_3DSTATE_DRAWING_RECTANGLE_length_bias      2
   2187 #define GEN7_3DSTATE_DRAWING_RECTANGLE_header   \
   2188    .DWordLength                         =      2,  \
   2189    ._3DCommandSubOpcode                 =      0,  \
   2190    ._3DCommandOpcode                    =      1,  \
   2191    .CommandSubType                      =      3,  \
   2192    .CommandType                         =      3
   2193 
   2194 struct GEN7_3DSTATE_DRAWING_RECTANGLE {
   2195    uint32_t                             DWordLength;
   2196    uint32_t                             _3DCommandSubOpcode;
   2197    uint32_t                             _3DCommandOpcode;
   2198    uint32_t                             CommandSubType;
   2199    uint32_t                             CommandType;
   2200    uint32_t                             ClippedDrawingRectangleXMin;
   2201    uint32_t                             ClippedDrawingRectangleYMin;
   2202    uint32_t                             ClippedDrawingRectangleXMax;
   2203    uint32_t                             ClippedDrawingRectangleYMax;
   2204    int32_t                              DrawingRectangleOriginX;
   2205    int32_t                              DrawingRectangleOriginY;
   2206 };
   2207 
   2208 static inline void
   2209 GEN7_3DSTATE_DRAWING_RECTANGLE_pack(__attribute__((unused)) __gen_user_data *data,
   2210                                     __attribute__((unused)) void * restrict dst,
   2211                                     __attribute__((unused)) const struct GEN7_3DSTATE_DRAWING_RECTANGLE * restrict values)
   2212 {
   2213    uint32_t * restrict dw = (uint32_t * restrict) dst;
   2214 
   2215    dw[0] =
   2216       __gen_uint(values->DWordLength, 0, 7) |
   2217       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   2218       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   2219       __gen_uint(values->CommandSubType, 27, 28) |
   2220       __gen_uint(values->CommandType, 29, 31);
   2221 
   2222    dw[1] =
   2223       __gen_uint(values->ClippedDrawingRectangleXMin, 0, 15) |
   2224       __gen_uint(values->ClippedDrawingRectangleYMin, 16, 31);
   2225 
   2226    dw[2] =
   2227       __gen_uint(values->ClippedDrawingRectangleXMax, 0, 15) |
   2228       __gen_uint(values->ClippedDrawingRectangleYMax, 16, 31);
   2229 
   2230    dw[3] =
   2231       __gen_sint(values->DrawingRectangleOriginX, 0, 15) |
   2232       __gen_sint(values->DrawingRectangleOriginY, 16, 31);
   2233 }
   2234 
   2235 #define GEN7_3DSTATE_DS_length                 6
   2236 #define GEN7_3DSTATE_DS_length_bias            2
   2237 #define GEN7_3DSTATE_DS_header                  \
   2238    .DWordLength                         =      4,  \
   2239    ._3DCommandSubOpcode                 =     29,  \
   2240    ._3DCommandOpcode                    =      0,  \
   2241    .CommandSubType                      =      3,  \
   2242    .CommandType                         =      3
   2243 
   2244 struct GEN7_3DSTATE_DS {
   2245    uint32_t                             DWordLength;
   2246    uint32_t                             _3DCommandSubOpcode;
   2247    uint32_t                             _3DCommandOpcode;
   2248    uint32_t                             CommandSubType;
   2249    uint32_t                             CommandType;
   2250    uint64_t                             KernelStartPointer;
   2251    bool                                 SoftwareExceptionEnable;
   2252    bool                                 IllegalOpcodeExceptionEnable;
   2253    uint32_t                             FloatingPointMode;
   2254 #define IEEE754                                  0
   2255 #define Alternate                                1
   2256    uint32_t                             BindingTableEntryCount;
   2257    uint32_t                             SamplerCount;
   2258 #define NoSamplers                               0
   2259 #define _14Samplers                              1
   2260 #define _58Samplers                              2
   2261 #define _912Samplers                             3
   2262 #define _1316Samplers                            4
   2263    bool                                 VectorMaskEnable;
   2264    uint32_t                             SingleDomainPointDispatch;
   2265    uint32_t                             PerThreadScratchSpace;
   2266    __gen_address_type                   ScratchSpaceBasePointer;
   2267    uint32_t                             PatchURBEntryReadOffset;
   2268    uint32_t                             PatchURBEntryReadLength;
   2269    uint32_t                             DispatchGRFStartRegisterForURBData;
   2270    bool                                 Enable;
   2271    bool                                 DSCacheDisable;
   2272    bool                                 ComputeWCoordinateEnable;
   2273    bool                                 StatisticsEnable;
   2274    uint32_t                             MaximumNumberofThreads;
   2275 };
   2276 
   2277 static inline void
   2278 GEN7_3DSTATE_DS_pack(__attribute__((unused)) __gen_user_data *data,
   2279                      __attribute__((unused)) void * restrict dst,
   2280                      __attribute__((unused)) const struct GEN7_3DSTATE_DS * restrict values)
   2281 {
   2282    uint32_t * restrict dw = (uint32_t * restrict) dst;
   2283 
   2284    dw[0] =
   2285       __gen_uint(values->DWordLength, 0, 7) |
   2286       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   2287       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   2288       __gen_uint(values->CommandSubType, 27, 28) |
   2289       __gen_uint(values->CommandType, 29, 31);
   2290 
   2291    dw[1] =
   2292       __gen_offset(values->KernelStartPointer, 6, 31);
   2293 
   2294    dw[2] =
   2295       __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
   2296       __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
   2297       __gen_uint(values->FloatingPointMode, 16, 16) |
   2298       __gen_uint(values->BindingTableEntryCount, 18, 25) |
   2299       __gen_uint(values->SamplerCount, 27, 29) |
   2300       __gen_uint(values->VectorMaskEnable, 30, 30) |
   2301       __gen_uint(values->SingleDomainPointDispatch, 31, 31);
   2302 
   2303    const uint32_t v3 =
   2304       __gen_uint(values->PerThreadScratchSpace, 0, 3);
   2305    dw[3] = __gen_combine_address(data, &dw[3], values->ScratchSpaceBasePointer, v3);
   2306 
   2307    dw[4] =
   2308       __gen_uint(values->PatchURBEntryReadOffset, 4, 9) |
   2309       __gen_uint(values->PatchURBEntryReadLength, 11, 17) |
   2310       __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
   2311 
   2312    dw[5] =
   2313       __gen_uint(values->Enable, 0, 0) |
   2314       __gen_uint(values->DSCacheDisable, 1, 1) |
   2315       __gen_uint(values->ComputeWCoordinateEnable, 2, 2) |
   2316       __gen_uint(values->StatisticsEnable, 10, 10) |
   2317       __gen_uint(values->MaximumNumberofThreads, 25, 31);
   2318 }
   2319 
   2320 #define GEN7_3DSTATE_GS_length                 7
   2321 #define GEN7_3DSTATE_GS_length_bias            2
   2322 #define GEN7_3DSTATE_GS_header                  \
   2323    .DWordLength                         =      5,  \
   2324    ._3DCommandSubOpcode                 =     17,  \
   2325    ._3DCommandOpcode                    =      0,  \
   2326    .CommandSubType                      =      3,  \
   2327    .CommandType                         =      3
   2328 
   2329 struct GEN7_3DSTATE_GS {
   2330    uint32_t                             DWordLength;
   2331    uint32_t                             _3DCommandSubOpcode;
   2332    uint32_t                             _3DCommandOpcode;
   2333    uint32_t                             CommandSubType;
   2334    uint32_t                             CommandType;
   2335    uint64_t                             KernelStartPointer;
   2336    bool                                 SoftwareExceptionEnable;
   2337    bool                                 MaskStackExceptionEnable;
   2338    bool                                 IllegalOpcodeExceptionEnable;
   2339    uint32_t                             FloatingPointMode;
   2340 #define IEEE754                                  0
   2341 #define alternate                                1
   2342    uint32_t                             ThreadPriority;
   2343 #define NormalPriority                           0
   2344 #define HighPriority                             1
   2345    uint32_t                             BindingTableEntryCount;
   2346    uint32_t                             SamplerCount;
   2347 #define NoSamplers                               0
   2348 #define _14Samplers                              1
   2349 #define _58Samplers                              2
   2350 #define _912Samplers                             3
   2351 #define _1316Samplers                            4
   2352    bool                                 VectorMaskEnable;
   2353    bool                                 SingleProgramFlow;
   2354    uint32_t                             PerThreadScratchSpace;
   2355    __gen_address_type                   ScratchSpaceBasePointer;
   2356    uint32_t                             DispatchGRFStartRegisterForURBData;
   2357    uint32_t                             VertexURBEntryReadOffset;
   2358    bool                                 IncludeVertexHandles;
   2359    uint32_t                             VertexURBEntryReadLength;
   2360    enum GEN7_3D_Prim_Topo_Type          OutputTopology;
   2361    uint32_t                             OutputVertexSize;
   2362    bool                                 Enable;
   2363    bool                                 DiscardAdjacency;
   2364    uint32_t                             ReorderMode;
   2365 #define LEADING                                  0
   2366 #define TRAILING                                 1
   2367    uint32_t                             Hint;
   2368    bool                                 IncludePrimitiveID;
   2369    uint32_t                             GSInvocationsIncrementValue;
   2370    uint32_t                             StatisticsEnable;
   2371    uint32_t                             DispatchMode;
   2372 #define DISPATCH_MODE_SINGLE                     0
   2373 #define DISPATCH_MODE_DUAL_INSTANCE              1
   2374 #define DISPATCH_MODE_DUAL_OBJECT                2
   2375    uint32_t                             DefaultStreamID;
   2376    uint32_t                             InstanceControl;
   2377    uint32_t                             ControlDataHeaderSize;
   2378    uint32_t                             ControlDataFormat;
   2379 #define GSCTL_CUT                                0
   2380 #define GSCTL_SID                                1
   2381    uint32_t                             MaximumNumberofThreads;
   2382    uint64_t                             SemaphoreHandle;
   2383 };
   2384 
   2385 static inline void
   2386 GEN7_3DSTATE_GS_pack(__attribute__((unused)) __gen_user_data *data,
   2387                      __attribute__((unused)) void * restrict dst,
   2388                      __attribute__((unused)) const struct GEN7_3DSTATE_GS * restrict values)
   2389 {
   2390    uint32_t * restrict dw = (uint32_t * restrict) dst;
   2391 
   2392    dw[0] =
   2393       __gen_uint(values->DWordLength, 0, 7) |
   2394       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   2395       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   2396       __gen_uint(values->CommandSubType, 27, 28) |
   2397       __gen_uint(values->CommandType, 29, 31);
   2398 
   2399    dw[1] =
   2400       __gen_offset(values->KernelStartPointer, 6, 31);
   2401 
   2402    dw[2] =
   2403       __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
   2404       __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
   2405       __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
   2406       __gen_uint(values->FloatingPointMode, 16, 16) |
   2407       __gen_uint(values->ThreadPriority, 17, 17) |
   2408       __gen_uint(values->BindingTableEntryCount, 18, 25) |
   2409       __gen_uint(values->SamplerCount, 27, 29) |
   2410       __gen_uint(values->VectorMaskEnable, 30, 30) |
   2411       __gen_uint(values->SingleProgramFlow, 31, 31);
   2412 
   2413    const uint32_t v3 =
   2414       __gen_uint(values->PerThreadScratchSpace, 0, 3);
   2415    dw[3] = __gen_combine_address(data, &dw[3], values->ScratchSpaceBasePointer, v3);
   2416 
   2417    dw[4] =
   2418       __gen_uint(values->DispatchGRFStartRegisterForURBData, 0, 3) |
   2419       __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
   2420       __gen_uint(values->IncludeVertexHandles, 10, 10) |
   2421       __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
   2422       __gen_uint(values->OutputTopology, 17, 22) |
   2423       __gen_uint(values->OutputVertexSize, 23, 28);
   2424 
   2425    dw[5] =
   2426       __gen_uint(values->Enable, 0, 0) |
   2427       __gen_uint(values->DiscardAdjacency, 1, 1) |
   2428       __gen_uint(values->ReorderMode, 2, 2) |
   2429       __gen_uint(values->Hint, 3, 3) |
   2430       __gen_uint(values->IncludePrimitiveID, 4, 4) |
   2431       __gen_uint(values->GSInvocationsIncrementValue, 5, 9) |
   2432       __gen_uint(values->StatisticsEnable, 10, 10) |
   2433       __gen_uint(values->DispatchMode, 11, 12) |
   2434       __gen_uint(values->DefaultStreamID, 13, 14) |
   2435       __gen_uint(values->InstanceControl, 15, 19) |
   2436       __gen_uint(values->ControlDataHeaderSize, 20, 23) |
   2437       __gen_uint(values->ControlDataFormat, 24, 24) |
   2438       __gen_uint(values->MaximumNumberofThreads, 25, 31);
   2439 
   2440    dw[6] =
   2441       __gen_offset(values->SemaphoreHandle, 0, 11);
   2442 }
   2443 
   2444 #define GEN7_3DSTATE_HIER_DEPTH_BUFFER_length      3
   2445 #define GEN7_3DSTATE_HIER_DEPTH_BUFFER_length_bias      2
   2446 #define GEN7_3DSTATE_HIER_DEPTH_BUFFER_header   \
   2447    .DWordLength                         =      1,  \
   2448    ._3DCommandSubOpcode                 =      7,  \
   2449    ._3DCommandOpcode                    =      0,  \
   2450    .CommandSubType                      =      3,  \
   2451    .CommandType                         =      3
   2452 
   2453 struct GEN7_3DSTATE_HIER_DEPTH_BUFFER {
   2454    uint32_t                             DWordLength;
   2455    uint32_t                             _3DCommandSubOpcode;
   2456    uint32_t                             _3DCommandOpcode;
   2457    uint32_t                             CommandSubType;
   2458    uint32_t                             CommandType;
   2459    uint32_t                             SurfacePitch;
   2460    uint32_t                             MOCS;
   2461    __gen_address_type                   SurfaceBaseAddress;
   2462 };
   2463 
   2464 static inline void
   2465 GEN7_3DSTATE_HIER_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
   2466                                     __attribute__((unused)) void * restrict dst,
   2467                                     __attribute__((unused)) const struct GEN7_3DSTATE_HIER_DEPTH_BUFFER * restrict values)
   2468 {
   2469    uint32_t * restrict dw = (uint32_t * restrict) dst;
   2470 
   2471    dw[0] =
   2472       __gen_uint(values->DWordLength, 0, 7) |
   2473       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   2474       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   2475       __gen_uint(values->CommandSubType, 27, 28) |
   2476       __gen_uint(values->CommandType, 29, 31);
   2477 
   2478    dw[1] =
   2479       __gen_uint(values->SurfacePitch, 0, 16) |
   2480       __gen_uint(values->MOCS, 25, 28);
   2481 
   2482    dw[2] = __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
   2483 }
   2484 
   2485 #define GEN7_3DSTATE_HS_length                 7
   2486 #define GEN7_3DSTATE_HS_length_bias            2
   2487 #define GEN7_3DSTATE_HS_header                  \
   2488    .DWordLength                         =      5,  \
   2489    ._3DCommandSubOpcode                 =     27,  \
   2490    ._3DCommandOpcode                    =      0,  \
   2491    .CommandSubType                      =      3,  \
   2492    .CommandType                         =      3
   2493 
   2494 struct GEN7_3DSTATE_HS {
   2495    uint32_t                             DWordLength;
   2496    uint32_t                             _3DCommandSubOpcode;
   2497    uint32_t                             _3DCommandOpcode;
   2498    uint32_t                             CommandSubType;
   2499    uint32_t                             CommandType;
   2500    uint32_t                             MaximumNumberofThreads;
   2501    bool                                 SoftwareExceptionEnable;
   2502    bool                                 IllegalOpcodeExceptionEnable;
   2503    uint32_t                             FloatingPointMode;
   2504 #define IEEE754                                  0
   2505 #define alternate                                1
   2506    uint32_t                             BindingTableEntryCount;
   2507    uint32_t                             SamplerCount;
   2508 #define NoSamplers                               0
   2509 #define _14Samplers                              1
   2510 #define _58Samplers                              2
   2511 #define _912Samplers                             3
   2512 #define _1316Samplers                            4
   2513    uint32_t                             InstanceCount;
   2514    bool                                 StatisticsEnable;
   2515    bool                                 Enable;
   2516    uint64_t                             KernelStartPointer;
   2517    uint32_t                             PerThreadScratchSpace;
   2518    __gen_address_type                   ScratchSpaceBasePointer;
   2519    uint32_t                             VertexURBEntryReadOffset;
   2520    uint32_t                             VertexURBEntryReadLength;
   2521    uint32_t                             DispatchGRFStartRegisterForURBData;
   2522    bool                                 IncludeVertexHandles;
   2523    bool                                 VectorMaskEnable;
   2524    bool                                 SingleProgramFlow;
   2525    uint64_t                             SemaphoreHandle;
   2526 };
   2527 
   2528 static inline void
   2529 GEN7_3DSTATE_HS_pack(__attribute__((unused)) __gen_user_data *data,
   2530                      __attribute__((unused)) void * restrict dst,
   2531                      __attribute__((unused)) const struct GEN7_3DSTATE_HS * restrict values)
   2532 {
   2533    uint32_t * restrict dw = (uint32_t * restrict) dst;
   2534 
   2535    dw[0] =
   2536       __gen_uint(values->DWordLength, 0, 7) |
   2537       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   2538       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   2539       __gen_uint(values->CommandSubType, 27, 28) |
   2540       __gen_uint(values->CommandType, 29, 31);
   2541 
   2542    dw[1] =
   2543       __gen_uint(values->MaximumNumberofThreads, 0, 6) |
   2544       __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
   2545       __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
   2546       __gen_uint(values->FloatingPointMode, 16, 16) |
   2547       __gen_uint(values->BindingTableEntryCount, 18, 25) |
   2548       __gen_uint(values->SamplerCount, 27, 29);
   2549 
   2550    dw[2] =
   2551       __gen_uint(values->InstanceCount, 0, 3) |
   2552       __gen_uint(values->StatisticsEnable, 29, 29) |
   2553       __gen_uint(values->Enable, 31, 31);
   2554 
   2555    dw[3] =
   2556       __gen_offset(values->KernelStartPointer, 6, 31);
   2557 
   2558    const uint32_t v4 =
   2559       __gen_uint(values->PerThreadScratchSpace, 0, 3);
   2560    dw[4] = __gen_combine_address(data, &dw[4], values->ScratchSpaceBasePointer, v4);
   2561 
   2562    dw[5] =
   2563       __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
   2564       __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
   2565       __gen_uint(values->DispatchGRFStartRegisterForURBData, 19, 23) |
   2566       __gen_uint(values->IncludeVertexHandles, 24, 24) |
   2567       __gen_uint(values->VectorMaskEnable, 26, 26) |
   2568       __gen_uint(values->SingleProgramFlow, 27, 27);
   2569 
   2570    dw[6] =
   2571       __gen_offset(values->SemaphoreHandle, 0, 11);
   2572 }
   2573 
   2574 #define GEN7_3DSTATE_INDEX_BUFFER_length       3
   2575 #define GEN7_3DSTATE_INDEX_BUFFER_length_bias      2
   2576 #define GEN7_3DSTATE_INDEX_BUFFER_header        \
   2577    .DWordLength                         =      1,  \
   2578    ._3DCommandSubOpcode                 =     10,  \
   2579    ._3DCommandOpcode                    =      0,  \
   2580    .CommandSubType                      =      3,  \
   2581    .CommandType                         =      3
   2582 
   2583 struct GEN7_3DSTATE_INDEX_BUFFER {
   2584    uint32_t                             DWordLength;
   2585    uint32_t                             IndexFormat;
   2586 #define INDEX_BYTE                               0
   2587 #define INDEX_WORD                               1
   2588 #define INDEX_DWORD                              2
   2589    bool                                 CutIndexEnable;
   2590    uint32_t                             MOCS;
   2591    uint32_t                             _3DCommandSubOpcode;
   2592    uint32_t                             _3DCommandOpcode;
   2593    uint32_t                             CommandSubType;
   2594    uint32_t                             CommandType;
   2595    __gen_address_type                   BufferStartingAddress;
   2596    __gen_address_type                   BufferEndingAddress;
   2597 };
   2598 
   2599 static inline void
   2600 GEN7_3DSTATE_INDEX_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
   2601                                __attribute__((unused)) void * restrict dst,
   2602                                __attribute__((unused)) const struct GEN7_3DSTATE_INDEX_BUFFER * restrict values)
   2603 {
   2604    uint32_t * restrict dw = (uint32_t * restrict) dst;
   2605 
   2606    dw[0] =
   2607       __gen_uint(values->DWordLength, 0, 7) |
   2608       __gen_uint(values->IndexFormat, 8, 9) |
   2609       __gen_uint(values->CutIndexEnable, 10, 10) |
   2610       __gen_uint(values->MOCS, 12, 15) |
   2611       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   2612       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   2613       __gen_uint(values->CommandSubType, 27, 28) |
   2614       __gen_uint(values->CommandType, 29, 31);
   2615 
   2616    dw[1] = __gen_combine_address(data, &dw[1], values->BufferStartingAddress, 0);
   2617 
   2618    dw[2] = __gen_combine_address(data, &dw[2], values->BufferEndingAddress, 0);
   2619 }
   2620 
   2621 #define GEN7_3DSTATE_LINE_STIPPLE_length       3
   2622 #define GEN7_3DSTATE_LINE_STIPPLE_length_bias      2
   2623 #define GEN7_3DSTATE_LINE_STIPPLE_header        \
   2624    .DWordLength                         =      1,  \
   2625    ._3DCommandSubOpcode                 =      8,  \
   2626    ._3DCommandOpcode                    =      1,  \
   2627    .CommandSubType                      =      3,  \
   2628    .CommandType                         =      3
   2629 
   2630 struct GEN7_3DSTATE_LINE_STIPPLE {
   2631    uint32_t                             DWordLength;
   2632    uint32_t                             _3DCommandSubOpcode;
   2633    uint32_t                             _3DCommandOpcode;
   2634    uint32_t                             CommandSubType;
   2635    uint32_t                             CommandType;
   2636    uint32_t                             LineStipplePattern;
   2637    uint32_t                             CurrentStippleIndex;
   2638    uint32_t                             CurrentRepeatCounter;
   2639    bool                                 ModifyEnableCurrentRepeatCounterCurrentStippleIndex;
   2640    uint32_t                             LineStippleRepeatCount;
   2641    float                                LineStippleInverseRepeatCount;
   2642 };
   2643 
   2644 static inline void
   2645 GEN7_3DSTATE_LINE_STIPPLE_pack(__attribute__((unused)) __gen_user_data *data,
   2646                                __attribute__((unused)) void * restrict dst,
   2647                                __attribute__((unused)) const struct GEN7_3DSTATE_LINE_STIPPLE * restrict values)
   2648 {
   2649    uint32_t * restrict dw = (uint32_t * restrict) dst;
   2650 
   2651    dw[0] =
   2652       __gen_uint(values->DWordLength, 0, 7) |
   2653       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   2654       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   2655       __gen_uint(values->CommandSubType, 27, 28) |
   2656       __gen_uint(values->CommandType, 29, 31);
   2657 
   2658    dw[1] =
   2659       __gen_uint(values->LineStipplePattern, 0, 15) |
   2660       __gen_uint(values->CurrentStippleIndex, 16, 19) |
   2661       __gen_uint(values->CurrentRepeatCounter, 21, 29) |
   2662       __gen_uint(values->ModifyEnableCurrentRepeatCounterCurrentStippleIndex, 31, 31);
   2663 
   2664    dw[2] =
   2665       __gen_uint(values->LineStippleRepeatCount, 0, 8) |
   2666       __gen_ufixed(values->LineStippleInverseRepeatCount, 15, 31, 16);
   2667 }
   2668 
   2669 #define GEN7_3DSTATE_MONOFILTER_SIZE_length      2
   2670 #define GEN7_3DSTATE_MONOFILTER_SIZE_length_bias      2
   2671 #define GEN7_3DSTATE_MONOFILTER_SIZE_header     \
   2672    .DWordLength                         =      0,  \
   2673    ._3DCommandSubOpcode                 =     17,  \
   2674    ._3DCommandOpcode                    =      1,  \
   2675    .CommandSubType                      =      3,  \
   2676    .CommandType                         =      3
   2677 
   2678 struct GEN7_3DSTATE_MONOFILTER_SIZE {
   2679    uint32_t                             DWordLength;
   2680    uint32_t                             _3DCommandSubOpcode;
   2681    uint32_t                             _3DCommandOpcode;
   2682    uint32_t                             CommandSubType;
   2683    uint32_t                             CommandType;
   2684    uint32_t                             MonochromeFilterHeight;
   2685    uint32_t                             MonochromeFilterWidth;
   2686 };
   2687 
   2688 static inline void
   2689 GEN7_3DSTATE_MONOFILTER_SIZE_pack(__attribute__((unused)) __gen_user_data *data,
   2690                                   __attribute__((unused)) void * restrict dst,
   2691                                   __attribute__((unused)) const struct GEN7_3DSTATE_MONOFILTER_SIZE * restrict values)
   2692 {
   2693    uint32_t * restrict dw = (uint32_t * restrict) dst;
   2694 
   2695    dw[0] =
   2696       __gen_uint(values->DWordLength, 0, 7) |
   2697       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   2698       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   2699       __gen_uint(values->CommandSubType, 27, 28) |
   2700       __gen_uint(values->CommandType, 29, 31);
   2701 
   2702    dw[1] =
   2703       __gen_uint(values->MonochromeFilterHeight, 0, 2) |
   2704       __gen_uint(values->MonochromeFilterWidth, 3, 5);
   2705 }
   2706 
   2707 #define GEN7_3DSTATE_MULTISAMPLE_length        4
   2708 #define GEN7_3DSTATE_MULTISAMPLE_length_bias      2
   2709 #define GEN7_3DSTATE_MULTISAMPLE_header         \
   2710    .DWordLength                         =      2,  \
   2711    ._3DCommandSubOpcode                 =     13,  \
   2712    ._3DCommandOpcode                    =      1,  \
   2713    .CommandSubType                      =      3,  \
   2714    .CommandType                         =      3
   2715 
   2716 struct GEN7_3DSTATE_MULTISAMPLE {
   2717    uint32_t                             DWordLength;
   2718    uint32_t                             _3DCommandSubOpcode;
   2719    uint32_t                             _3DCommandOpcode;
   2720    uint32_t                             CommandSubType;
   2721    uint32_t                             CommandType;
   2722    uint32_t                             NumberofMultisamples;
   2723 #define NUMSAMPLES_1                             0
   2724 #define NUMSAMPLES_4                             2
   2725 #define NUMSAMPLES_8                             3
   2726    uint32_t                             PixelLocation;
   2727 #define CENTER                                   0
   2728 #define UL_CORNER                                1
   2729    float                                Sample0YOffset;
   2730    float                                Sample0XOffset;
   2731    float                                Sample1YOffset;
   2732    float                                Sample1XOffset;
   2733    float                                Sample2YOffset;
   2734    float                                Sample2XOffset;
   2735    float                                Sample3YOffset;
   2736    float                                Sample3XOffset;
   2737    float                                Sample4YOffset;
   2738    float                                Sample4XOffset;
   2739    float                                Sample5YOffset;
   2740    float                                Sample5XOffset;
   2741    float                                Sample6YOffset;
   2742    float                                Sample6XOffset;
   2743    float                                Sample7YOffset;
   2744    float                                Sample7XOffset;
   2745 };
   2746 
   2747 static inline void
   2748 GEN7_3DSTATE_MULTISAMPLE_pack(__attribute__((unused)) __gen_user_data *data,
   2749                               __attribute__((unused)) void * restrict dst,
   2750                               __attribute__((unused)) const struct GEN7_3DSTATE_MULTISAMPLE * restrict values)
   2751 {
   2752    uint32_t * restrict dw = (uint32_t * restrict) dst;
   2753 
   2754    dw[0] =
   2755       __gen_uint(values->DWordLength, 0, 7) |
   2756       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   2757       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   2758       __gen_uint(values->CommandSubType, 27, 28) |
   2759       __gen_uint(values->CommandType, 29, 31);
   2760 
   2761    dw[1] =
   2762       __gen_uint(values->NumberofMultisamples, 1, 3) |
   2763       __gen_uint(values->PixelLocation, 4, 4);
   2764 
   2765    dw[2] =
   2766       __gen_ufixed(values->Sample0YOffset, 0, 3, 4) |
   2767       __gen_ufixed(values->Sample0XOffset, 4, 7, 4) |
   2768       __gen_ufixed(values->Sample1YOffset, 8, 11, 4) |
   2769       __gen_ufixed(values->Sample1XOffset, 12, 15, 4) |
   2770       __gen_ufixed(values->Sample2YOffset, 16, 19, 4) |
   2771       __gen_ufixed(values->Sample2XOffset, 20, 23, 4) |
   2772       __gen_ufixed(values->Sample3YOffset, 24, 27, 4) |
   2773       __gen_ufixed(values->Sample3XOffset, 28, 31, 4);
   2774 
   2775    dw[3] =
   2776       __gen_ufixed(values->Sample4YOffset, 0, 3, 4) |
   2777       __gen_ufixed(values->Sample4XOffset, 4, 7, 4) |
   2778       __gen_ufixed(values->Sample5YOffset, 8, 11, 4) |
   2779       __gen_ufixed(values->Sample5XOffset, 12, 15, 4) |
   2780       __gen_ufixed(values->Sample6YOffset, 16, 19, 4) |
   2781       __gen_ufixed(values->Sample6XOffset, 20, 23, 4) |
   2782       __gen_ufixed(values->Sample7YOffset, 24, 27, 4) |
   2783       __gen_ufixed(values->Sample7XOffset, 28, 31, 4);
   2784 }
   2785 
   2786 #define GEN7_3DSTATE_POLY_STIPPLE_OFFSET_length      2
   2787 #define GEN7_3DSTATE_POLY_STIPPLE_OFFSET_length_bias      2
   2788 #define GEN7_3DSTATE_POLY_STIPPLE_OFFSET_header \
   2789    .DWordLength                         =      0,  \
   2790    ._3DCommandSubOpcode                 =      6,  \
   2791    ._3DCommandOpcode                    =      1,  \
   2792    .CommandSubType                      =      3,  \
   2793    .CommandType                         =      3
   2794 
   2795 struct GEN7_3DSTATE_POLY_STIPPLE_OFFSET {
   2796    uint32_t                             DWordLength;
   2797    uint32_t                             _3DCommandSubOpcode;
   2798    uint32_t                             _3DCommandOpcode;
   2799    uint32_t                             CommandSubType;
   2800    uint32_t                             CommandType;
   2801    uint32_t                             PolygonStippleYOffset;
   2802    uint32_t                             PolygonStippleXOffset;
   2803 };
   2804 
   2805 static inline void
   2806 GEN7_3DSTATE_POLY_STIPPLE_OFFSET_pack(__attribute__((unused)) __gen_user_data *data,
   2807                                       __attribute__((unused)) void * restrict dst,
   2808                                       __attribute__((unused)) const struct GEN7_3DSTATE_POLY_STIPPLE_OFFSET * restrict values)
   2809 {
   2810    uint32_t * restrict dw = (uint32_t * restrict) dst;
   2811 
   2812    dw[0] =
   2813       __gen_uint(values->DWordLength, 0, 7) |
   2814       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   2815       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   2816       __gen_uint(values->CommandSubType, 27, 28) |
   2817       __gen_uint(values->CommandType, 29, 31);
   2818 
   2819    dw[1] =
   2820       __gen_uint(values->PolygonStippleYOffset, 0, 4) |
   2821       __gen_uint(values->PolygonStippleXOffset, 8, 12);
   2822 }
   2823 
   2824 #define GEN7_3DSTATE_POLY_STIPPLE_PATTERN_length     33
   2825 #define GEN7_3DSTATE_POLY_STIPPLE_PATTERN_length_bias      2
   2826 #define GEN7_3DSTATE_POLY_STIPPLE_PATTERN_header\
   2827    .DWordLength                         =     31,  \
   2828    ._3DCommandSubOpcode                 =      7,  \
   2829    ._3DCommandOpcode                    =      1,  \
   2830    .CommandSubType                      =      3,  \
   2831    .CommandType                         =      3
   2832 
   2833 struct GEN7_3DSTATE_POLY_STIPPLE_PATTERN {
   2834    uint32_t                             DWordLength;
   2835    uint32_t                             _3DCommandSubOpcode;
   2836    uint32_t                             _3DCommandOpcode;
   2837    uint32_t                             CommandSubType;
   2838    uint32_t                             CommandType;
   2839    uint32_t                             PatternRow[32];
   2840 };
   2841 
   2842 static inline void
   2843 GEN7_3DSTATE_POLY_STIPPLE_PATTERN_pack(__attribute__((unused)) __gen_user_data *data,
   2844                                        __attribute__((unused)) void * restrict dst,
   2845                                        __attribute__((unused)) const struct GEN7_3DSTATE_POLY_STIPPLE_PATTERN * restrict values)
   2846 {
   2847    uint32_t * restrict dw = (uint32_t * restrict) dst;
   2848 
   2849    dw[0] =
   2850       __gen_uint(values->DWordLength, 0, 7) |
   2851       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   2852       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   2853       __gen_uint(values->CommandSubType, 27, 28) |
   2854       __gen_uint(values->CommandType, 29, 31);
   2855 
   2856    dw[1] =
   2857       __gen_uint(values->PatternRow[0], 0, 31);
   2858 
   2859    dw[2] =
   2860       __gen_uint(values->PatternRow[1], 0, 31);
   2861 
   2862    dw[3] =
   2863       __gen_uint(values->PatternRow[2], 0, 31);
   2864 
   2865    dw[4] =
   2866       __gen_uint(values->PatternRow[3], 0, 31);
   2867 
   2868    dw[5] =
   2869       __gen_uint(values->PatternRow[4], 0, 31);
   2870 
   2871    dw[6] =
   2872       __gen_uint(values->PatternRow[5], 0, 31);
   2873 
   2874    dw[7] =
   2875       __gen_uint(values->PatternRow[6], 0, 31);
   2876 
   2877    dw[8] =
   2878       __gen_uint(values->PatternRow[7], 0, 31);
   2879 
   2880    dw[9] =
   2881       __gen_uint(values->PatternRow[8], 0, 31);
   2882 
   2883    dw[10] =
   2884       __gen_uint(values->PatternRow[9], 0, 31);
   2885 
   2886    dw[11] =
   2887       __gen_uint(values->PatternRow[10], 0, 31);
   2888 
   2889    dw[12] =
   2890       __gen_uint(values->PatternRow[11], 0, 31);
   2891 
   2892    dw[13] =
   2893       __gen_uint(values->PatternRow[12], 0, 31);
   2894 
   2895    dw[14] =
   2896       __gen_uint(values->PatternRow[13], 0, 31);
   2897 
   2898    dw[15] =
   2899       __gen_uint(values->PatternRow[14], 0, 31);
   2900 
   2901    dw[16] =
   2902       __gen_uint(values->PatternRow[15], 0, 31);
   2903 
   2904    dw[17] =
   2905       __gen_uint(values->PatternRow[16], 0, 31);
   2906 
   2907    dw[18] =
   2908       __gen_uint(values->PatternRow[17], 0, 31);
   2909 
   2910    dw[19] =
   2911       __gen_uint(values->PatternRow[18], 0, 31);
   2912 
   2913    dw[20] =
   2914       __gen_uint(values->PatternRow[19], 0, 31);
   2915 
   2916    dw[21] =
   2917       __gen_uint(values->PatternRow[20], 0, 31);
   2918 
   2919    dw[22] =
   2920       __gen_uint(values->PatternRow[21], 0, 31);
   2921 
   2922    dw[23] =
   2923       __gen_uint(values->PatternRow[22], 0, 31);
   2924 
   2925    dw[24] =
   2926       __gen_uint(values->PatternRow[23], 0, 31);
   2927 
   2928    dw[25] =
   2929       __gen_uint(values->PatternRow[24], 0, 31);
   2930 
   2931    dw[26] =
   2932       __gen_uint(values->PatternRow[25], 0, 31);
   2933 
   2934    dw[27] =
   2935       __gen_uint(values->PatternRow[26], 0, 31);
   2936 
   2937    dw[28] =
   2938       __gen_uint(values->PatternRow[27], 0, 31);
   2939 
   2940    dw[29] =
   2941       __gen_uint(values->PatternRow[28], 0, 31);
   2942 
   2943    dw[30] =
   2944       __gen_uint(values->PatternRow[29], 0, 31);
   2945 
   2946    dw[31] =
   2947       __gen_uint(values->PatternRow[30], 0, 31);
   2948 
   2949    dw[32] =
   2950       __gen_uint(values->PatternRow[31], 0, 31);
   2951 }
   2952 
   2953 #define GEN7_3DSTATE_PS_length                 8
   2954 #define GEN7_3DSTATE_PS_length_bias            2
   2955 #define GEN7_3DSTATE_PS_header                  \
   2956    .DWordLength                         =      6,  \
   2957    ._3DCommandSubOpcode                 =     32,  \
   2958    ._3DCommandOpcode                    =      0,  \
   2959    .CommandSubType                      =      3,  \
   2960    .CommandType                         =      3
   2961 
   2962 struct GEN7_3DSTATE_PS {
   2963    uint32_t                             DWordLength;
   2964    uint32_t                             _3DCommandSubOpcode;
   2965    uint32_t                             _3DCommandOpcode;
   2966    uint32_t                             CommandSubType;
   2967    uint32_t                             CommandType;
   2968    uint64_t                             KernelStartPointer0;
   2969    bool                                 SoftwareExceptionEnable;
   2970    bool                                 MaskStackExceptionEnable;
   2971    bool                                 IllegalOpcodeExceptionEnable;
   2972    uint32_t                             RoundingMode;
   2973 #define RTNE                                     0
   2974 #define RU                                       1
   2975 #define RD                                       2
   2976 #define RTZ                                      3
   2977    uint32_t                             FloatingPointMode;
   2978 #define IEEE745                                  0
   2979 #define Alt                                      1
   2980    uint32_t                             BindingTableEntryCount;
   2981    uint32_t                             DenormalMode;
   2982 #define FTZ                                      0
   2983 #define RET                                      1
   2984    uint32_t                             SamplerCount;
   2985    bool                                 VectorMaskEnable;
   2986    bool                                 SingleProgramFlow;
   2987    uint32_t                             PerThreadScratchSpace;
   2988    __gen_address_type                   ScratchSpaceBasePointer;
   2989    bool                                 _8PixelDispatchEnable;
   2990    bool                                 _16PixelDispatchEnable;
   2991    bool                                 _32PixelDispatchEnable;
   2992    uint32_t                             PositionXYOffsetSelect;
   2993 #define POSOFFSET_NONE                           0
   2994 #define POSOFFSET_CENTROID                       2
   2995 #define POSOFFSET_SAMPLE                         3
   2996    bool                                 RenderTargetResolveEnable;
   2997    bool                                 DualSourceBlendEnable;
   2998    bool                                 RenderTargetFastClearEnable;
   2999    bool                                 oMaskPresenttoRenderTarget;
   3000    bool                                 AttributeEnable;
   3001    bool                                 PushConstantEnable;
   3002    uint32_t                             MaximumNumberofThreads;
   3003    uint32_t                             DispatchGRFStartRegisterForConstantSetupData2;
   3004    uint32_t                             DispatchGRFStartRegisterForConstantSetupData1;
   3005    uint32_t                             DispatchGRFStartRegisterForConstantSetupData0;
   3006    uint64_t                             KernelStartPointer1;
   3007    uint64_t                             KernelStartPointer2;
   3008 };
   3009 
   3010 static inline void
   3011 GEN7_3DSTATE_PS_pack(__attribute__((unused)) __gen_user_data *data,
   3012                      __attribute__((unused)) void * restrict dst,
   3013                      __attribute__((unused)) const struct GEN7_3DSTATE_PS * restrict values)
   3014 {
   3015    uint32_t * restrict dw = (uint32_t * restrict) dst;
   3016 
   3017    dw[0] =
   3018       __gen_uint(values->DWordLength, 0, 7) |
   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_offset(values->KernelStartPointer0, 6, 31);
   3026 
   3027    dw[2] =
   3028       __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
   3029       __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
   3030       __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
   3031       __gen_uint(values->RoundingMode, 14, 15) |
   3032       __gen_uint(values->FloatingPointMode, 16, 16) |
   3033       __gen_uint(values->BindingTableEntryCount, 18, 25) |
   3034       __gen_uint(values->DenormalMode, 26, 26) |
   3035       __gen_uint(values->SamplerCount, 27, 29) |
   3036       __gen_uint(values->VectorMaskEnable, 30, 30) |
   3037       __gen_uint(values->SingleProgramFlow, 31, 31);
   3038 
   3039    const uint32_t v3 =
   3040       __gen_uint(values->PerThreadScratchSpace, 0, 3);
   3041    dw[3] = __gen_combine_address(data, &dw[3], values->ScratchSpaceBasePointer, v3);
   3042 
   3043    dw[4] =
   3044       __gen_uint(values->_8PixelDispatchEnable, 0, 0) |
   3045       __gen_uint(values->_16PixelDispatchEnable, 1, 1) |
   3046       __gen_uint(values->_32PixelDispatchEnable, 2, 2) |
   3047       __gen_uint(values->PositionXYOffsetSelect, 3, 4) |
   3048       __gen_uint(values->RenderTargetResolveEnable, 6, 6) |
   3049       __gen_uint(values->DualSourceBlendEnable, 7, 7) |
   3050       __gen_uint(values->RenderTargetFastClearEnable, 8, 8) |
   3051       __gen_uint(values->oMaskPresenttoRenderTarget, 9, 9) |
   3052       __gen_uint(values->AttributeEnable, 10, 10) |
   3053       __gen_uint(values->PushConstantEnable, 11, 11) |
   3054       __gen_uint(values->MaximumNumberofThreads, 24, 31);
   3055 
   3056    dw[5] =
   3057       __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData2, 0, 6) |
   3058       __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData1, 8, 14) |
   3059       __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData0, 16, 22);
   3060 
   3061    dw[6] =
   3062       __gen_offset(values->KernelStartPointer1, 6, 31);
   3063 
   3064    dw[7] =
   3065       __gen_offset(values->KernelStartPointer2, 6, 31);
   3066 }
   3067 
   3068 #define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_DS_length      2
   3069 #define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_DS_length_bias      2
   3070 #define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_DS_header\
   3071    .DWordLength                         =      0,  \
   3072    ._3DCommandSubOpcode                 =     20,  \
   3073    ._3DCommandOpcode                    =      1,  \
   3074    .CommandSubType                      =      3,  \
   3075    .CommandType                         =      3
   3076 
   3077 struct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_DS {
   3078    uint32_t                             DWordLength;
   3079    uint32_t                             _3DCommandSubOpcode;
   3080    uint32_t                             _3DCommandOpcode;
   3081    uint32_t                             CommandSubType;
   3082    uint32_t                             CommandType;
   3083    uint32_t                             ConstantBufferSize;
   3084 #define _0KB                                     0
   3085    uint32_t                             ConstantBufferOffset;
   3086 #define _0KB                                     0
   3087 };
   3088 
   3089 static inline void
   3090 GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_DS_pack(__attribute__((unused)) __gen_user_data *data,
   3091                                          __attribute__((unused)) void * restrict dst,
   3092                                          __attribute__((unused)) const struct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_DS * restrict values)
   3093 {
   3094    uint32_t * restrict dw = (uint32_t * restrict) dst;
   3095 
   3096    dw[0] =
   3097       __gen_uint(values->DWordLength, 0, 7) |
   3098       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   3099       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   3100       __gen_uint(values->CommandSubType, 27, 28) |
   3101       __gen_uint(values->CommandType, 29, 31);
   3102 
   3103    dw[1] =
   3104       __gen_uint(values->ConstantBufferSize, 0, 4) |
   3105       __gen_uint(values->ConstantBufferOffset, 16, 19);
   3106 }
   3107 
   3108 #define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_GS_length      2
   3109 #define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_GS_length_bias      2
   3110 #define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_GS_header\
   3111    .DWordLength                         =      0,  \
   3112    ._3DCommandSubOpcode                 =     21,  \
   3113    ._3DCommandOpcode                    =      1,  \
   3114    .CommandSubType                      =      3,  \
   3115    .CommandType                         =      3
   3116 
   3117 struct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_GS {
   3118    uint32_t                             DWordLength;
   3119    uint32_t                             _3DCommandSubOpcode;
   3120    uint32_t                             _3DCommandOpcode;
   3121    uint32_t                             CommandSubType;
   3122    uint32_t                             CommandType;
   3123    uint32_t                             ConstantBufferSize;
   3124 #define _0KB                                     0
   3125    uint32_t                             ConstantBufferOffset;
   3126 #define _0KB                                     0
   3127 };
   3128 
   3129 static inline void
   3130 GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_GS_pack(__attribute__((unused)) __gen_user_data *data,
   3131                                          __attribute__((unused)) void * restrict dst,
   3132                                          __attribute__((unused)) const struct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_GS * restrict values)
   3133 {
   3134    uint32_t * restrict dw = (uint32_t * restrict) dst;
   3135 
   3136    dw[0] =
   3137       __gen_uint(values->DWordLength, 0, 7) |
   3138       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   3139       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   3140       __gen_uint(values->CommandSubType, 27, 28) |
   3141       __gen_uint(values->CommandType, 29, 31);
   3142 
   3143    dw[1] =
   3144       __gen_uint(values->ConstantBufferSize, 0, 4) |
   3145       __gen_uint(values->ConstantBufferOffset, 16, 19);
   3146 }
   3147 
   3148 #define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_HS_length      2
   3149 #define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_HS_length_bias      2
   3150 #define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_HS_header\
   3151    .DWordLength                         =      0,  \
   3152    ._3DCommandSubOpcode                 =     19,  \
   3153    ._3DCommandOpcode                    =      1,  \
   3154    .CommandSubType                      =      3,  \
   3155    .CommandType                         =      3
   3156 
   3157 struct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_HS {
   3158    uint32_t                             DWordLength;
   3159    uint32_t                             _3DCommandSubOpcode;
   3160    uint32_t                             _3DCommandOpcode;
   3161    uint32_t                             CommandSubType;
   3162    uint32_t                             CommandType;
   3163    uint32_t                             ConstantBufferSize;
   3164 #define _0KB                                     0
   3165    uint32_t                             ConstantBufferOffset;
   3166 #define _0KB                                     0
   3167 };
   3168 
   3169 static inline void
   3170 GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_HS_pack(__attribute__((unused)) __gen_user_data *data,
   3171                                          __attribute__((unused)) void * restrict dst,
   3172                                          __attribute__((unused)) const struct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_HS * restrict values)
   3173 {
   3174    uint32_t * restrict dw = (uint32_t * restrict) dst;
   3175 
   3176    dw[0] =
   3177       __gen_uint(values->DWordLength, 0, 7) |
   3178       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   3179       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   3180       __gen_uint(values->CommandSubType, 27, 28) |
   3181       __gen_uint(values->CommandType, 29, 31);
   3182 
   3183    dw[1] =
   3184       __gen_uint(values->ConstantBufferSize, 0, 4) |
   3185       __gen_uint(values->ConstantBufferOffset, 16, 19);
   3186 }
   3187 
   3188 #define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_PS_length      2
   3189 #define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_PS_length_bias      2
   3190 #define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_PS_header\
   3191    .DWordLength                         =      0,  \
   3192    ._3DCommandSubOpcode                 =     22,  \
   3193    ._3DCommandOpcode                    =      1,  \
   3194    .CommandSubType                      =      3,  \
   3195    .CommandType                         =      3
   3196 
   3197 struct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_PS {
   3198    uint32_t                             DWordLength;
   3199    uint32_t                             _3DCommandSubOpcode;
   3200    uint32_t                             _3DCommandOpcode;
   3201    uint32_t                             CommandSubType;
   3202    uint32_t                             CommandType;
   3203    uint32_t                             ConstantBufferSize;
   3204 #define _0KB                                     0
   3205    uint32_t                             ConstantBufferOffset;
   3206 #define _0KB                                     0
   3207 };
   3208 
   3209 static inline void
   3210 GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_PS_pack(__attribute__((unused)) __gen_user_data *data,
   3211                                          __attribute__((unused)) void * restrict dst,
   3212                                          __attribute__((unused)) const struct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_PS * restrict values)
   3213 {
   3214    uint32_t * restrict dw = (uint32_t * restrict) dst;
   3215 
   3216    dw[0] =
   3217       __gen_uint(values->DWordLength, 0, 7) |
   3218       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   3219       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   3220       __gen_uint(values->CommandSubType, 27, 28) |
   3221       __gen_uint(values->CommandType, 29, 31);
   3222 
   3223    dw[1] =
   3224       __gen_uint(values->ConstantBufferSize, 0, 4) |
   3225       __gen_uint(values->ConstantBufferOffset, 16, 19);
   3226 }
   3227 
   3228 #define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_VS_length      2
   3229 #define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_VS_length_bias      2
   3230 #define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_VS_header\
   3231    .DWordLength                         =      0,  \
   3232    ._3DCommandSubOpcode                 =     18,  \
   3233    ._3DCommandOpcode                    =      1,  \
   3234    .CommandSubType                      =      3,  \
   3235    .CommandType                         =      3
   3236 
   3237 struct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_VS {
   3238    uint32_t                             DWordLength;
   3239    uint32_t                             _3DCommandSubOpcode;
   3240    uint32_t                             _3DCommandOpcode;
   3241    uint32_t                             CommandSubType;
   3242    uint32_t                             CommandType;
   3243    uint32_t                             ConstantBufferSize;
   3244 #define _0KB                                     0
   3245    uint32_t                             ConstantBufferOffset;
   3246 #define _0KB                                     0
   3247 };
   3248 
   3249 static inline void
   3250 GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_VS_pack(__attribute__((unused)) __gen_user_data *data,
   3251                                          __attribute__((unused)) void * restrict dst,
   3252                                          __attribute__((unused)) const struct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_VS * restrict values)
   3253 {
   3254    uint32_t * restrict dw = (uint32_t * restrict) dst;
   3255 
   3256    dw[0] =
   3257       __gen_uint(values->DWordLength, 0, 7) |
   3258       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   3259       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   3260       __gen_uint(values->CommandSubType, 27, 28) |
   3261       __gen_uint(values->CommandType, 29, 31);
   3262 
   3263    dw[1] =
   3264       __gen_uint(values->ConstantBufferSize, 0, 4) |
   3265       __gen_uint(values->ConstantBufferOffset, 16, 19);
   3266 }
   3267 
   3268 #define GEN7_3DSTATE_SAMPLER_PALETTE_LOAD0_length_bias      2
   3269 #define GEN7_3DSTATE_SAMPLER_PALETTE_LOAD0_header\
   3270    ._3DCommandSubOpcode                 =      2,  \
   3271    ._3DCommandOpcode                    =      1,  \
   3272    .CommandSubType                      =      3,  \
   3273    .CommandType                         =      3
   3274 
   3275 struct GEN7_3DSTATE_SAMPLER_PALETTE_LOAD0 {
   3276    uint32_t                             DWordLength;
   3277    uint32_t                             _3DCommandSubOpcode;
   3278    uint32_t                             _3DCommandOpcode;
   3279    uint32_t                             CommandSubType;
   3280    uint32_t                             CommandType;
   3281    /* variable length fields follow */
   3282 };
   3283 
   3284 static inline void
   3285 GEN7_3DSTATE_SAMPLER_PALETTE_LOAD0_pack(__attribute__((unused)) __gen_user_data *data,
   3286                                         __attribute__((unused)) void * restrict dst,
   3287                                         __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_PALETTE_LOAD0 * restrict values)
   3288 {
   3289    uint32_t * restrict dw = (uint32_t * restrict) dst;
   3290 
   3291    dw[0] =
   3292       __gen_uint(values->DWordLength, 0, 7) |
   3293       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   3294       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   3295       __gen_uint(values->CommandSubType, 27, 28) |
   3296       __gen_uint(values->CommandType, 29, 31);
   3297 }
   3298 
   3299 #define GEN7_3DSTATE_SAMPLER_PALETTE_LOAD1_length_bias      2
   3300 #define GEN7_3DSTATE_SAMPLER_PALETTE_LOAD1_header\
   3301    .DWordLength                         =      0,  \
   3302    ._3DCommandSubOpcode                 =     12,  \
   3303    ._3DCommandOpcode                    =      1,  \
   3304    .CommandSubType                      =      3,  \
   3305    .CommandType                         =      3
   3306 
   3307 struct GEN7_3DSTATE_SAMPLER_PALETTE_LOAD1 {
   3308    uint32_t                             DWordLength;
   3309    uint32_t                             _3DCommandSubOpcode;
   3310    uint32_t                             _3DCommandOpcode;
   3311    uint32_t                             CommandSubType;
   3312    uint32_t                             CommandType;
   3313    /* variable length fields follow */
   3314 };
   3315 
   3316 static inline void
   3317 GEN7_3DSTATE_SAMPLER_PALETTE_LOAD1_pack(__attribute__((unused)) __gen_user_data *data,
   3318                                         __attribute__((unused)) void * restrict dst,
   3319                                         __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_PALETTE_LOAD1 * restrict values)
   3320 {
   3321    uint32_t * restrict dw = (uint32_t * restrict) dst;
   3322 
   3323    dw[0] =
   3324       __gen_uint(values->DWordLength, 0, 7) |
   3325       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   3326       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   3327       __gen_uint(values->CommandSubType, 27, 28) |
   3328       __gen_uint(values->CommandType, 29, 31);
   3329 }
   3330 
   3331 #define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_DS_length      2
   3332 #define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_DS_length_bias      2
   3333 #define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_DS_header\
   3334    .DWordLength                         =      0,  \
   3335    ._3DCommandSubOpcode                 =     45,  \
   3336    ._3DCommandOpcode                    =      0,  \
   3337    .CommandSubType                      =      3,  \
   3338    .CommandType                         =      3
   3339 
   3340 struct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_DS {
   3341    uint32_t                             DWordLength;
   3342    uint32_t                             _3DCommandSubOpcode;
   3343    uint32_t                             _3DCommandOpcode;
   3344    uint32_t                             CommandSubType;
   3345    uint32_t                             CommandType;
   3346    uint64_t                             PointertoDSSamplerState;
   3347 };
   3348 
   3349 static inline void
   3350 GEN7_3DSTATE_SAMPLER_STATE_POINTERS_DS_pack(__attribute__((unused)) __gen_user_data *data,
   3351                                             __attribute__((unused)) void * restrict dst,
   3352                                             __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_DS * restrict values)
   3353 {
   3354    uint32_t * restrict dw = (uint32_t * restrict) dst;
   3355 
   3356    dw[0] =
   3357       __gen_uint(values->DWordLength, 0, 7) |
   3358       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   3359       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   3360       __gen_uint(values->CommandSubType, 27, 28) |
   3361       __gen_uint(values->CommandType, 29, 31);
   3362 
   3363    dw[1] =
   3364       __gen_offset(values->PointertoDSSamplerState, 5, 31);
   3365 }
   3366 
   3367 #define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_GS_length      2
   3368 #define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_GS_length_bias      2
   3369 #define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_GS_header\
   3370    .DWordLength                         =      0,  \
   3371    ._3DCommandSubOpcode                 =     46,  \
   3372    ._3DCommandOpcode                    =      0,  \
   3373    .CommandSubType                      =      3,  \
   3374    .CommandType                         =      3
   3375 
   3376 struct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_GS {
   3377    uint32_t                             DWordLength;
   3378    uint32_t                             _3DCommandSubOpcode;
   3379    uint32_t                             _3DCommandOpcode;
   3380    uint32_t                             CommandSubType;
   3381    uint32_t                             CommandType;
   3382    uint64_t                             PointertoGSSamplerState;
   3383 };
   3384 
   3385 static inline void
   3386 GEN7_3DSTATE_SAMPLER_STATE_POINTERS_GS_pack(__attribute__((unused)) __gen_user_data *data,
   3387                                             __attribute__((unused)) void * restrict dst,
   3388                                             __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_GS * restrict values)
   3389 {
   3390    uint32_t * restrict dw = (uint32_t * restrict) dst;
   3391 
   3392    dw[0] =
   3393       __gen_uint(values->DWordLength, 0, 7) |
   3394       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   3395       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   3396       __gen_uint(values->CommandSubType, 27, 28) |
   3397       __gen_uint(values->CommandType, 29, 31);
   3398 
   3399    dw[1] =
   3400       __gen_offset(values->PointertoGSSamplerState, 5, 31);
   3401 }
   3402 
   3403 #define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_HS_length      2
   3404 #define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_HS_length_bias      2
   3405 #define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_HS_header\
   3406    .DWordLength                         =      0,  \
   3407    ._3DCommandSubOpcode                 =     44,  \
   3408    ._3DCommandOpcode                    =      0,  \
   3409    .CommandSubType                      =      3,  \
   3410    .CommandType                         =      3
   3411 
   3412 struct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_HS {
   3413    uint32_t                             DWordLength;
   3414    uint32_t                             _3DCommandSubOpcode;
   3415    uint32_t                             _3DCommandOpcode;
   3416    uint32_t                             CommandSubType;
   3417    uint32_t                             CommandType;
   3418    uint64_t                             PointertoHSSamplerState;
   3419 };
   3420 
   3421 static inline void
   3422 GEN7_3DSTATE_SAMPLER_STATE_POINTERS_HS_pack(__attribute__((unused)) __gen_user_data *data,
   3423                                             __attribute__((unused)) void * restrict dst,
   3424                                             __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_HS * restrict values)
   3425 {
   3426    uint32_t * restrict dw = (uint32_t * restrict) dst;
   3427 
   3428    dw[0] =
   3429       __gen_uint(values->DWordLength, 0, 7) |
   3430       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   3431       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   3432       __gen_uint(values->CommandSubType, 27, 28) |
   3433       __gen_uint(values->CommandType, 29, 31);
   3434 
   3435    dw[1] =
   3436       __gen_offset(values->PointertoHSSamplerState, 5, 31);
   3437 }
   3438 
   3439 #define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_PS_length      2
   3440 #define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_PS_length_bias      2
   3441 #define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_PS_header\
   3442    .DWordLength                         =      0,  \
   3443    ._3DCommandSubOpcode                 =     47,  \
   3444    ._3DCommandOpcode                    =      0,  \
   3445    .CommandSubType                      =      3,  \
   3446    .CommandType                         =      3
   3447 
   3448 struct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_PS {
   3449    uint32_t                             DWordLength;
   3450    uint32_t                             _3DCommandSubOpcode;
   3451    uint32_t                             _3DCommandOpcode;
   3452    uint32_t                             CommandSubType;
   3453    uint32_t                             CommandType;
   3454    uint64_t                             PointertoPSSamplerState;
   3455 };
   3456 
   3457 static inline void
   3458 GEN7_3DSTATE_SAMPLER_STATE_POINTERS_PS_pack(__attribute__((unused)) __gen_user_data *data,
   3459                                             __attribute__((unused)) void * restrict dst,
   3460                                             __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_PS * restrict values)
   3461 {
   3462    uint32_t * restrict dw = (uint32_t * restrict) dst;
   3463 
   3464    dw[0] =
   3465       __gen_uint(values->DWordLength, 0, 7) |
   3466       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   3467       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   3468       __gen_uint(values->CommandSubType, 27, 28) |
   3469       __gen_uint(values->CommandType, 29, 31);
   3470 
   3471    dw[1] =
   3472       __gen_offset(values->PointertoPSSamplerState, 5, 31);
   3473 }
   3474 
   3475 #define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_VS_length      2
   3476 #define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_VS_length_bias      2
   3477 #define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_VS_header\
   3478    .DWordLength                         =      0,  \
   3479    ._3DCommandSubOpcode                 =     43,  \
   3480    ._3DCommandOpcode                    =      0,  \
   3481    .CommandSubType                      =      3,  \
   3482    .CommandType                         =      3
   3483 
   3484 struct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_VS {
   3485    uint32_t                             DWordLength;
   3486    uint32_t                             _3DCommandSubOpcode;
   3487    uint32_t                             _3DCommandOpcode;
   3488    uint32_t                             CommandSubType;
   3489    uint32_t                             CommandType;
   3490    uint64_t                             PointertoVSSamplerState;
   3491 };
   3492 
   3493 static inline void
   3494 GEN7_3DSTATE_SAMPLER_STATE_POINTERS_VS_pack(__attribute__((unused)) __gen_user_data *data,
   3495                                             __attribute__((unused)) void * restrict dst,
   3496                                             __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_VS * restrict values)
   3497 {
   3498    uint32_t * restrict dw = (uint32_t * restrict) dst;
   3499 
   3500    dw[0] =
   3501       __gen_uint(values->DWordLength, 0, 7) |
   3502       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   3503       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   3504       __gen_uint(values->CommandSubType, 27, 28) |
   3505       __gen_uint(values->CommandType, 29, 31);
   3506 
   3507    dw[1] =
   3508       __gen_offset(values->PointertoVSSamplerState, 5, 31);
   3509 }
   3510 
   3511 #define GEN7_3DSTATE_SAMPLE_MASK_length        2
   3512 #define GEN7_3DSTATE_SAMPLE_MASK_length_bias      2
   3513 #define GEN7_3DSTATE_SAMPLE_MASK_header         \
   3514    .DWordLength                         =      0,  \
   3515    ._3DCommandSubOpcode                 =     24,  \
   3516    ._3DCommandOpcode                    =      0,  \
   3517    .CommandSubType                      =      3,  \
   3518    .CommandType                         =      3
   3519 
   3520 struct GEN7_3DSTATE_SAMPLE_MASK {
   3521    uint32_t                             DWordLength;
   3522    uint32_t                             _3DCommandSubOpcode;
   3523    uint32_t                             _3DCommandOpcode;
   3524    uint32_t                             CommandSubType;
   3525    uint32_t                             CommandType;
   3526    uint32_t                             SampleMask;
   3527 };
   3528 
   3529 static inline void
   3530 GEN7_3DSTATE_SAMPLE_MASK_pack(__attribute__((unused)) __gen_user_data *data,
   3531                               __attribute__((unused)) void * restrict dst,
   3532                               __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLE_MASK * restrict values)
   3533 {
   3534    uint32_t * restrict dw = (uint32_t * restrict) dst;
   3535 
   3536    dw[0] =
   3537       __gen_uint(values->DWordLength, 0, 7) |
   3538       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   3539       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   3540       __gen_uint(values->CommandSubType, 27, 28) |
   3541       __gen_uint(values->CommandType, 29, 31);
   3542 
   3543    dw[1] =
   3544       __gen_uint(values->SampleMask, 0, 7);
   3545 }
   3546 
   3547 #define GEN7_3DSTATE_SBE_length               14
   3548 #define GEN7_3DSTATE_SBE_length_bias           2
   3549 #define GEN7_3DSTATE_SBE_header                 \
   3550    .DWordLength                         =     12,  \
   3551    ._3DCommandSubOpcode                 =     31,  \
   3552    ._3DCommandOpcode                    =      0,  \
   3553    .CommandSubType                      =      3,  \
   3554    .CommandType                         =      3
   3555 
   3556 struct GEN7_3DSTATE_SBE {
   3557    uint32_t                             DWordLength;
   3558    uint32_t                             _3DCommandSubOpcode;
   3559    uint32_t                             _3DCommandOpcode;
   3560    uint32_t                             CommandSubType;
   3561    uint32_t                             CommandType;
   3562    uint32_t                             VertexURBEntryReadOffset;
   3563    uint32_t                             VertexURBEntryReadLength;
   3564    uint32_t                             PointSpriteTextureCoordinateOrigin;
   3565 #define UPPERLEFT                                0
   3566 #define LOWERLEFT                                1
   3567    bool                                 AttributeSwizzleEnable;
   3568    uint32_t                             NumberofSFOutputAttributes;
   3569    uint32_t                             AttributeSwizzleControlMode;
   3570 #define SWIZ_0_15                                0
   3571 #define SWIZ_16_31                               1
   3572    struct GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL Attribute[16];
   3573    uint32_t                             PointSpriteTextureCoordinateEnable;
   3574    uint32_t                             ConstantInterpolationEnable;
   3575    uint32_t                             Attribute0WrapShortestEnables;
   3576    uint32_t                             Attribute1WrapShortestEnables;
   3577    uint32_t                             Attribute2WrapShortestEnables;
   3578    uint32_t                             Attribute3WrapShortestEnables;
   3579    uint32_t                             Attribute4WrapShortestEnables;
   3580    uint32_t                             Attribute5WrapShortestEnables;
   3581    uint32_t                             Attribute6WrapShortestEnables;
   3582    uint32_t                             Attribute7WrapShortestEnables;
   3583    uint32_t                             Attribute8WrapShortestEnables;
   3584    uint32_t                             Attribute9WrapShortestEnables;
   3585    uint32_t                             Attribute10WrapShortestEnables;
   3586    uint32_t                             Attribute11WrapShortestEnables;
   3587    uint32_t                             Attribute12WrapShortestEnables;
   3588    uint32_t                             Attribute13WrapShortestEnables;
   3589    uint32_t                             Attribute14WrapShortestEnables;
   3590    uint32_t                             Attribute15WrapShortestEnables;
   3591 };
   3592 
   3593 static inline void
   3594 GEN7_3DSTATE_SBE_pack(__attribute__((unused)) __gen_user_data *data,
   3595                       __attribute__((unused)) void * restrict dst,
   3596                       __attribute__((unused)) const struct GEN7_3DSTATE_SBE * restrict values)
   3597 {
   3598    uint32_t * restrict dw = (uint32_t * restrict) dst;
   3599 
   3600    dw[0] =
   3601       __gen_uint(values->DWordLength, 0, 7) |
   3602       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   3603       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   3604       __gen_uint(values->CommandSubType, 27, 28) |
   3605       __gen_uint(values->CommandType, 29, 31);
   3606 
   3607    dw[1] =
   3608       __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
   3609       __gen_uint(values->VertexURBEntryReadLength, 11, 15) |
   3610       __gen_uint(values->PointSpriteTextureCoordinateOrigin, 20, 20) |
   3611       __gen_uint(values->AttributeSwizzleEnable, 21, 21) |
   3612       __gen_uint(values->NumberofSFOutputAttributes, 22, 27) |
   3613       __gen_uint(values->AttributeSwizzleControlMode, 28, 28);
   3614 
   3615    uint32_t v2_0;
   3616    GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v2_0, &values->Attribute[0]);
   3617 
   3618    uint32_t v2_1;
   3619    GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v2_1, &values->Attribute[1]);
   3620 
   3621    dw[2] =
   3622       __gen_uint(v2_0, 0, 15) |
   3623       __gen_uint(v2_1, 16, 31);
   3624 
   3625    uint32_t v3_0;
   3626    GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v3_0, &values->Attribute[2]);
   3627 
   3628    uint32_t v3_1;
   3629    GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v3_1, &values->Attribute[3]);
   3630 
   3631    dw[3] =
   3632       __gen_uint(v3_0, 0, 15) |
   3633       __gen_uint(v3_1, 16, 31);
   3634 
   3635    uint32_t v4_0;
   3636    GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v4_0, &values->Attribute[4]);
   3637 
   3638    uint32_t v4_1;
   3639    GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v4_1, &values->Attribute[5]);
   3640 
   3641    dw[4] =
   3642       __gen_uint(v4_0, 0, 15) |
   3643       __gen_uint(v4_1, 16, 31);
   3644 
   3645    uint32_t v5_0;
   3646    GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v5_0, &values->Attribute[6]);
   3647 
   3648    uint32_t v5_1;
   3649    GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v5_1, &values->Attribute[7]);
   3650 
   3651    dw[5] =
   3652       __gen_uint(v5_0, 0, 15) |
   3653       __gen_uint(v5_1, 16, 31);
   3654 
   3655    uint32_t v6_0;
   3656    GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v6_0, &values->Attribute[8]);
   3657 
   3658    uint32_t v6_1;
   3659    GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v6_1, &values->Attribute[9]);
   3660 
   3661    dw[6] =
   3662       __gen_uint(v6_0, 0, 15) |
   3663       __gen_uint(v6_1, 16, 31);
   3664 
   3665    uint32_t v7_0;
   3666    GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v7_0, &values->Attribute[10]);
   3667 
   3668    uint32_t v7_1;
   3669    GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v7_1, &values->Attribute[11]);
   3670 
   3671    dw[7] =
   3672       __gen_uint(v7_0, 0, 15) |
   3673       __gen_uint(v7_1, 16, 31);
   3674 
   3675    uint32_t v8_0;
   3676    GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_0, &values->Attribute[12]);
   3677 
   3678    uint32_t v8_1;
   3679    GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_1, &values->Attribute[13]);
   3680 
   3681    dw[8] =
   3682       __gen_uint(v8_0, 0, 15) |
   3683       __gen_uint(v8_1, 16, 31);
   3684 
   3685    uint32_t v9_0;
   3686    GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v9_0, &values->Attribute[14]);
   3687 
   3688    uint32_t v9_1;
   3689    GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v9_1, &values->Attribute[15]);
   3690 
   3691    dw[9] =
   3692       __gen_uint(v9_0, 0, 15) |
   3693       __gen_uint(v9_1, 16, 31);
   3694 
   3695    dw[10] =
   3696       __gen_uint(values->PointSpriteTextureCoordinateEnable, 0, 31);
   3697 
   3698    dw[11] =
   3699       __gen_uint(values->ConstantInterpolationEnable, 0, 31);
   3700 
   3701    dw[12] =
   3702       __gen_uint(values->Attribute0WrapShortestEnables, 0, 3) |
   3703       __gen_uint(values->Attribute1WrapShortestEnables, 4, 7) |
   3704       __gen_uint(values->Attribute2WrapShortestEnables, 8, 11) |
   3705       __gen_uint(values->Attribute3WrapShortestEnables, 12, 15) |
   3706       __gen_uint(values->Attribute4WrapShortestEnables, 16, 19) |
   3707       __gen_uint(values->Attribute5WrapShortestEnables, 20, 23) |
   3708       __gen_uint(values->Attribute6WrapShortestEnables, 24, 27) |
   3709       __gen_uint(values->Attribute7WrapShortestEnables, 28, 31);
   3710 
   3711    dw[13] =
   3712       __gen_uint(values->Attribute8WrapShortestEnables, 0, 3) |
   3713       __gen_uint(values->Attribute9WrapShortestEnables, 4, 7) |
   3714       __gen_uint(values->Attribute10WrapShortestEnables, 8, 11) |
   3715       __gen_uint(values->Attribute11WrapShortestEnables, 12, 15) |
   3716       __gen_uint(values->Attribute12WrapShortestEnables, 16, 19) |
   3717       __gen_uint(values->Attribute13WrapShortestEnables, 20, 23) |
   3718       __gen_uint(values->Attribute14WrapShortestEnables, 24, 27) |
   3719       __gen_uint(values->Attribute15WrapShortestEnables, 28, 31);
   3720 }
   3721 
   3722 #define GEN7_3DSTATE_SCISSOR_STATE_POINTERS_length      2
   3723 #define GEN7_3DSTATE_SCISSOR_STATE_POINTERS_length_bias      2
   3724 #define GEN7_3DSTATE_SCISSOR_STATE_POINTERS_header\
   3725    .DWordLength                         =      0,  \
   3726    ._3DCommandSubOpcode                 =     15,  \
   3727    ._3DCommandOpcode                    =      0,  \
   3728    .CommandSubType                      =      3,  \
   3729    .CommandType                         =      3
   3730 
   3731 struct GEN7_3DSTATE_SCISSOR_STATE_POINTERS {
   3732    uint32_t                             DWordLength;
   3733    uint32_t                             _3DCommandSubOpcode;
   3734    uint32_t                             _3DCommandOpcode;
   3735    uint32_t                             CommandSubType;
   3736    uint32_t                             CommandType;
   3737    uint64_t                             ScissorRectPointer;
   3738 };
   3739 
   3740 static inline void
   3741 GEN7_3DSTATE_SCISSOR_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
   3742                                          __attribute__((unused)) void * restrict dst,
   3743                                          __attribute__((unused)) const struct GEN7_3DSTATE_SCISSOR_STATE_POINTERS * restrict values)
   3744 {
   3745    uint32_t * restrict dw = (uint32_t * restrict) dst;
   3746 
   3747    dw[0] =
   3748       __gen_uint(values->DWordLength, 0, 7) |
   3749       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   3750       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   3751       __gen_uint(values->CommandSubType, 27, 28) |
   3752       __gen_uint(values->CommandType, 29, 31);
   3753 
   3754    dw[1] =
   3755       __gen_offset(values->ScissorRectPointer, 5, 31);
   3756 }
   3757 
   3758 #define GEN7_3DSTATE_SF_length                 7
   3759 #define GEN7_3DSTATE_SF_length_bias            2
   3760 #define GEN7_3DSTATE_SF_header                  \
   3761    .DWordLength                         =      5,  \
   3762    ._3DCommandSubOpcode                 =     19,  \
   3763    ._3DCommandOpcode                    =      0,  \
   3764    .CommandSubType                      =      3,  \
   3765    .CommandType                         =      3
   3766 
   3767 struct GEN7_3DSTATE_SF {
   3768    uint32_t                             DWordLength;
   3769    uint32_t                             _3DCommandSubOpcode;
   3770    uint32_t                             _3DCommandOpcode;
   3771    uint32_t                             CommandSubType;
   3772    uint32_t                             CommandType;
   3773    uint32_t                             FrontWinding;
   3774    bool                                 ViewportTransformEnable;
   3775    uint32_t                             BackFaceFillMode;
   3776 #define FILL_MODE_SOLID                          0
   3777 #define FILL_MODE_WIREFRAME                      1
   3778 #define FILL_MODE_POINT                          2
   3779    uint32_t                             FrontFaceFillMode;
   3780 #define FILL_MODE_SOLID                          0
   3781 #define FILL_MODE_WIREFRAME                      1
   3782 #define FILL_MODE_POINT                          2
   3783    bool                                 GlobalDepthOffsetEnablePoint;
   3784    bool                                 GlobalDepthOffsetEnableWireframe;
   3785    bool                                 GlobalDepthOffsetEnableSolid;
   3786    bool                                 StatisticsEnable;
   3787    bool                                 LegacyGlobalDepthBiasEnable;
   3788    uint32_t                             DepthBufferSurfaceFormat;
   3789 #define D32_FLOAT_S8X24_UINT                     0
   3790 #define D32_FLOAT                                1
   3791 #define D24_UNORM_S8_UINT                        2
   3792 #define D24_UNORM_X8_UINT                        3
   3793 #define D16_UNORM                                5
   3794    uint32_t                             MultisampleRasterizationMode;
   3795 #define MSRASTMODE_OFF_PIXEL                     0
   3796 #define MSRASTMODE_OFF_PATTERN                   1
   3797 #define MSRASTMODE_ON_PIXEL                      2
   3798 #define MSRASTMODE_ON_PATTERN                    3
   3799    bool                                 ScissorRectangleEnable;
   3800    uint32_t                             LineEndCapAntialiasingRegionWidth;
   3801 #define _05pixels                                0
   3802 #define _10pixels                                1
   3803 #define _20pixels                                2
   3804 #define _40pixels                                3
   3805    float                                LineWidth;
   3806    uint32_t                             CullMode;
   3807 #define CULLMODE_BOTH                            0
   3808 #define CULLMODE_NONE                            1
   3809 #define CULLMODE_FRONT                           2
   3810 #define CULLMODE_BACK                            3
   3811    bool                                 AntiAliasingEnable;
   3812    float                                PointWidth;
   3813    uint32_t                             PointWidthSource;
   3814 #define Vertex                                   0
   3815 #define State                                    1
   3816    uint32_t                             VertexSubPixelPrecisionSelect;
   3817 #define _8Bit                                    0
   3818 #define _4Bit                                    1
   3819    uint32_t                             AALineDistanceMode;
   3820 #define AALINEDISTANCE_TRUE                      1
   3821    uint32_t                             TriangleFanProvokingVertexSelect;
   3822 #define Vertex0                                  0
   3823 #define Vertex1                                  1
   3824 #define Vertex2                                  2
   3825    uint32_t                             LineStripListProvokingVertexSelect;
   3826    uint32_t                             TriangleStripListProvokingVertexSelect;
   3827 #define Vertex0                                  0
   3828 #define Vertex1                                  1
   3829 #define Vertex2                                  2
   3830    bool                                 LastPixelEnable;
   3831    float                                GlobalDepthOffsetConstant;
   3832    float                                GlobalDepthOffsetScale;
   3833    float                                GlobalDepthOffsetClamp;
   3834 };
   3835 
   3836 static inline void
   3837 GEN7_3DSTATE_SF_pack(__attribute__((unused)) __gen_user_data *data,
   3838                      __attribute__((unused)) void * restrict dst,
   3839                      __attribute__((unused)) const struct GEN7_3DSTATE_SF * restrict values)
   3840 {
   3841    uint32_t * restrict dw = (uint32_t * restrict) dst;
   3842 
   3843    dw[0] =
   3844       __gen_uint(values->DWordLength, 0, 7) |
   3845       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   3846       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   3847       __gen_uint(values->CommandSubType, 27, 28) |
   3848       __gen_uint(values->CommandType, 29, 31);
   3849 
   3850    dw[1] =
   3851       __gen_uint(values->FrontWinding, 0, 0) |
   3852       __gen_uint(values->ViewportTransformEnable, 1, 1) |
   3853       __gen_uint(values->BackFaceFillMode, 3, 4) |
   3854       __gen_uint(values->FrontFaceFillMode, 5, 6) |
   3855       __gen_uint(values->GlobalDepthOffsetEnablePoint, 7, 7) |
   3856       __gen_uint(values->GlobalDepthOffsetEnableWireframe, 8, 8) |
   3857       __gen_uint(values->GlobalDepthOffsetEnableSolid, 9, 9) |
   3858       __gen_uint(values->StatisticsEnable, 10, 10) |
   3859       __gen_uint(values->LegacyGlobalDepthBiasEnable, 11, 11) |
   3860       __gen_uint(values->DepthBufferSurfaceFormat, 12, 14);
   3861 
   3862    dw[2] =
   3863       __gen_uint(values->MultisampleRasterizationMode, 8, 9) |
   3864       __gen_uint(values->ScissorRectangleEnable, 11, 11) |
   3865       __gen_uint(values->LineEndCapAntialiasingRegionWidth, 16, 17) |
   3866       __gen_ufixed(values->LineWidth, 18, 27, 7) |
   3867       __gen_uint(values->CullMode, 29, 30) |
   3868       __gen_uint(values->AntiAliasingEnable, 31, 31);
   3869 
   3870    dw[3] =
   3871       __gen_ufixed(values->PointWidth, 0, 10, 3) |
   3872       __gen_uint(values->PointWidthSource, 11, 11) |
   3873       __gen_uint(values->VertexSubPixelPrecisionSelect, 12, 12) |
   3874       __gen_uint(values->AALineDistanceMode, 14, 14) |
   3875       __gen_uint(values->TriangleFanProvokingVertexSelect, 25, 26) |
   3876       __gen_uint(values->LineStripListProvokingVertexSelect, 27, 28) |
   3877       __gen_uint(values->TriangleStripListProvokingVertexSelect, 29, 30) |
   3878       __gen_uint(values->LastPixelEnable, 31, 31);
   3879 
   3880    dw[4] =
   3881       __gen_float(values->GlobalDepthOffsetConstant);
   3882 
   3883    dw[5] =
   3884       __gen_float(values->GlobalDepthOffsetScale);
   3885 
   3886    dw[6] =
   3887       __gen_float(values->GlobalDepthOffsetClamp);
   3888 }
   3889 
   3890 #define GEN7_3DSTATE_SO_BUFFER_length          4
   3891 #define GEN7_3DSTATE_SO_BUFFER_length_bias      2
   3892 #define GEN7_3DSTATE_SO_BUFFER_header           \
   3893    .DWordLength                         =      2,  \
   3894    ._3DCommandSubOpcode                 =     24,  \
   3895    ._3DCommandOpcode                    =      1,  \
   3896    .CommandSubType                      =      3,  \
   3897    .CommandType                         =      3
   3898 
   3899 struct GEN7_3DSTATE_SO_BUFFER {
   3900    uint32_t                             DWordLength;
   3901    uint32_t                             _3DCommandSubOpcode;
   3902    uint32_t                             _3DCommandOpcode;
   3903    uint32_t                             CommandSubType;
   3904    uint32_t                             CommandType;
   3905    uint32_t                             SurfacePitch;
   3906    uint32_t                             MOCS;
   3907    uint32_t                             SOBufferIndex;
   3908    __gen_address_type                   SurfaceBaseAddress;
   3909    __gen_address_type                   SurfaceEndAddress;
   3910 };
   3911 
   3912 static inline void
   3913 GEN7_3DSTATE_SO_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
   3914                             __attribute__((unused)) void * restrict dst,
   3915                             __attribute__((unused)) const struct GEN7_3DSTATE_SO_BUFFER * restrict values)
   3916 {
   3917    uint32_t * restrict dw = (uint32_t * restrict) dst;
   3918 
   3919    dw[0] =
   3920       __gen_uint(values->DWordLength, 0, 7) |
   3921       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   3922       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   3923       __gen_uint(values->CommandSubType, 27, 28) |
   3924       __gen_uint(values->CommandType, 29, 31);
   3925 
   3926    dw[1] =
   3927       __gen_uint(values->SurfacePitch, 0, 11) |
   3928       __gen_uint(values->MOCS, 25, 28) |
   3929       __gen_uint(values->SOBufferIndex, 29, 30);
   3930 
   3931    dw[2] = __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
   3932 
   3933    dw[3] = __gen_combine_address(data, &dw[3], values->SurfaceEndAddress, 0);
   3934 }
   3935 
   3936 #define GEN7_3DSTATE_SO_DECL_LIST_length_bias      2
   3937 #define GEN7_3DSTATE_SO_DECL_LIST_header        \
   3938    ._3DCommandSubOpcode                 =     23,  \
   3939    ._3DCommandOpcode                    =      1,  \
   3940    .CommandSubType                      =      3,  \
   3941    .CommandType                         =      3
   3942 
   3943 struct GEN7_3DSTATE_SO_DECL_LIST {
   3944    uint32_t                             DWordLength;
   3945    uint32_t                             _3DCommandSubOpcode;
   3946    uint32_t                             _3DCommandOpcode;
   3947    uint32_t                             CommandSubType;
   3948    uint32_t                             CommandType;
   3949    uint32_t                             StreamtoBufferSelects0;
   3950    uint32_t                             StreamtoBufferSelects1;
   3951    uint32_t                             StreamtoBufferSelects2;
   3952    uint32_t                             StreamtoBufferSelects3;
   3953    uint32_t                             NumEntries0;
   3954    uint32_t                             NumEntries1;
   3955    uint32_t                             NumEntries2;
   3956    uint32_t                             NumEntries3;
   3957    /* variable length fields follow */
   3958 };
   3959 
   3960 static inline void
   3961 GEN7_3DSTATE_SO_DECL_LIST_pack(__attribute__((unused)) __gen_user_data *data,
   3962                                __attribute__((unused)) void * restrict dst,
   3963                                __attribute__((unused)) const struct GEN7_3DSTATE_SO_DECL_LIST * restrict values)
   3964 {
   3965    uint32_t * restrict dw = (uint32_t * restrict) dst;
   3966 
   3967    dw[0] =
   3968       __gen_uint(values->DWordLength, 0, 8) |
   3969       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   3970       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   3971       __gen_uint(values->CommandSubType, 27, 28) |
   3972       __gen_uint(values->CommandType, 29, 31);
   3973 
   3974    dw[1] =
   3975       __gen_uint(values->StreamtoBufferSelects0, 0, 3) |
   3976       __gen_uint(values->StreamtoBufferSelects1, 4, 7) |
   3977       __gen_uint(values->StreamtoBufferSelects2, 8, 11) |
   3978       __gen_uint(values->StreamtoBufferSelects3, 12, 15);
   3979 
   3980    dw[2] =
   3981       __gen_uint(values->NumEntries0, 0, 7) |
   3982       __gen_uint(values->NumEntries1, 8, 15) |
   3983       __gen_uint(values->NumEntries2, 16, 23) |
   3984       __gen_uint(values->NumEntries3, 24, 31);
   3985 }
   3986 
   3987 #define GEN7_3DSTATE_STENCIL_BUFFER_length      3
   3988 #define GEN7_3DSTATE_STENCIL_BUFFER_length_bias      2
   3989 #define GEN7_3DSTATE_STENCIL_BUFFER_header      \
   3990    .DWordLength                         =      1,  \
   3991    ._3DCommandSubOpcode                 =      6,  \
   3992    ._3DCommandOpcode                    =      0,  \
   3993    .CommandSubType                      =      3,  \
   3994    .CommandType                         =      3
   3995 
   3996 struct GEN7_3DSTATE_STENCIL_BUFFER {
   3997    uint32_t                             DWordLength;
   3998    uint32_t                             _3DCommandSubOpcode;
   3999    uint32_t                             _3DCommandOpcode;
   4000    uint32_t                             CommandSubType;
   4001    uint32_t                             CommandType;
   4002    uint32_t                             SurfacePitch;
   4003    uint32_t                             MOCS;
   4004    __gen_address_type                   SurfaceBaseAddress;
   4005 };
   4006 
   4007 static inline void
   4008 GEN7_3DSTATE_STENCIL_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
   4009                                  __attribute__((unused)) void * restrict dst,
   4010                                  __attribute__((unused)) const struct GEN7_3DSTATE_STENCIL_BUFFER * restrict values)
   4011 {
   4012    uint32_t * restrict dw = (uint32_t * restrict) dst;
   4013 
   4014    dw[0] =
   4015       __gen_uint(values->DWordLength, 0, 7) |
   4016       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   4017       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   4018       __gen_uint(values->CommandSubType, 27, 28) |
   4019       __gen_uint(values->CommandType, 29, 31);
   4020 
   4021    dw[1] =
   4022       __gen_uint(values->SurfacePitch, 0, 16) |
   4023       __gen_uint(values->MOCS, 25, 28);
   4024 
   4025    dw[2] = __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
   4026 }
   4027 
   4028 #define GEN7_3DSTATE_STREAMOUT_length          3
   4029 #define GEN7_3DSTATE_STREAMOUT_length_bias      2
   4030 #define GEN7_3DSTATE_STREAMOUT_header           \
   4031    .DWordLength                         =      1,  \
   4032    ._3DCommandSubOpcode                 =     30,  \
   4033    ._3DCommandOpcode                    =      0,  \
   4034    .CommandSubType                      =      3,  \
   4035    .CommandType                         =      3
   4036 
   4037 struct GEN7_3DSTATE_STREAMOUT {
   4038    uint32_t                             DWordLength;
   4039    uint32_t                             _3DCommandSubOpcode;
   4040    uint32_t                             _3DCommandOpcode;
   4041    uint32_t                             CommandSubType;
   4042    uint32_t                             CommandType;
   4043    bool                                 SOBufferEnable0;
   4044    bool                                 SOBufferEnable1;
   4045    bool                                 SOBufferEnable2;
   4046    bool                                 SOBufferEnable3;
   4047    bool                                 SOStatisticsEnable;
   4048    uint32_t                             ReorderMode;
   4049 #define LEADING                                  0
   4050 #define TRAILING                                 1
   4051    uint32_t                             RenderStreamSelect;
   4052    bool                                 RenderingDisable;
   4053    bool                                 SOFunctionEnable;
   4054    uint32_t                             Stream0VertexReadLength;
   4055    uint32_t                             Stream0VertexReadOffset;
   4056    uint32_t                             Stream1VertexReadLength;
   4057    uint32_t                             Stream1VertexReadOffset;
   4058    uint32_t                             Stream2VertexReadLength;
   4059    uint32_t                             Stream2VertexReadOffset;
   4060    uint32_t                             Stream3VertexReadLength;
   4061    uint32_t                             Stream3VertexReadOffset;
   4062 };
   4063 
   4064 static inline void
   4065 GEN7_3DSTATE_STREAMOUT_pack(__attribute__((unused)) __gen_user_data *data,
   4066                             __attribute__((unused)) void * restrict dst,
   4067                             __attribute__((unused)) const struct GEN7_3DSTATE_STREAMOUT * restrict values)
   4068 {
   4069    uint32_t * restrict dw = (uint32_t * restrict) dst;
   4070 
   4071    dw[0] =
   4072       __gen_uint(values->DWordLength, 0, 7) |
   4073       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   4074       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   4075       __gen_uint(values->CommandSubType, 27, 28) |
   4076       __gen_uint(values->CommandType, 29, 31);
   4077 
   4078    dw[1] =
   4079       __gen_uint(values->SOBufferEnable0, 8, 8) |
   4080       __gen_uint(values->SOBufferEnable1, 9, 9) |
   4081       __gen_uint(values->SOBufferEnable2, 10, 10) |
   4082       __gen_uint(values->SOBufferEnable3, 11, 11) |
   4083       __gen_uint(values->SOStatisticsEnable, 25, 25) |
   4084       __gen_uint(values->ReorderMode, 26, 26) |
   4085       __gen_uint(values->RenderStreamSelect, 27, 28) |
   4086       __gen_uint(values->RenderingDisable, 30, 30) |
   4087       __gen_uint(values->SOFunctionEnable, 31, 31);
   4088 
   4089    dw[2] =
   4090       __gen_uint(values->Stream0VertexReadLength, 0, 4) |
   4091       __gen_uint(values->Stream0VertexReadOffset, 5, 5) |
   4092       __gen_uint(values->Stream1VertexReadLength, 8, 12) |
   4093       __gen_uint(values->Stream1VertexReadOffset, 13, 13) |
   4094       __gen_uint(values->Stream2VertexReadLength, 16, 20) |
   4095       __gen_uint(values->Stream2VertexReadOffset, 21, 21) |
   4096       __gen_uint(values->Stream3VertexReadLength, 24, 28) |
   4097       __gen_uint(values->Stream3VertexReadOffset, 29, 29);
   4098 }
   4099 
   4100 #define GEN7_3DSTATE_TE_length                 4
   4101 #define GEN7_3DSTATE_TE_length_bias            2
   4102 #define GEN7_3DSTATE_TE_header                  \
   4103    .DWordLength                         =      2,  \
   4104    ._3DCommandSubOpcode                 =     28,  \
   4105    ._3DCommandOpcode                    =      0,  \
   4106    .CommandSubType                      =      3,  \
   4107    .CommandType                         =      3
   4108 
   4109 struct GEN7_3DSTATE_TE {
   4110    uint32_t                             DWordLength;
   4111    uint32_t                             _3DCommandSubOpcode;
   4112    uint32_t                             _3DCommandOpcode;
   4113    uint32_t                             CommandSubType;
   4114    uint32_t                             CommandType;
   4115    bool                                 TEEnable;
   4116    uint32_t                             TEMode;
   4117 #define HW_TESS                                  0
   4118 #define SW_TESS                                  1
   4119    uint32_t                             TEDomain;
   4120 #define QUAD                                     0
   4121 #define TRI                                      1
   4122 #define ISOLINE                                  2
   4123    uint32_t                             OutputTopology;
   4124 #define OUTPUT_POINT                             0
   4125 #define OUTPUT_LINE                              1
   4126 #define OUTPUT_TRI_CW                            2
   4127 #define OUTPUT_TRI_CCW                           3
   4128    uint32_t                             Partitioning;
   4129 #define INTEGER                                  0
   4130 #define ODD_FRACTIONAL                           1
   4131 #define EVEN_FRACTIONAL                          2
   4132    float                                MaximumTessellationFactorOdd;
   4133    float                                MaximumTessellationFactorNotOdd;
   4134 };
   4135 
   4136 static inline void
   4137 GEN7_3DSTATE_TE_pack(__attribute__((unused)) __gen_user_data *data,
   4138                      __attribute__((unused)) void * restrict dst,
   4139                      __attribute__((unused)) const struct GEN7_3DSTATE_TE * restrict values)
   4140 {
   4141    uint32_t * restrict dw = (uint32_t * restrict) dst;
   4142 
   4143    dw[0] =
   4144       __gen_uint(values->DWordLength, 0, 7) |
   4145       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   4146       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   4147       __gen_uint(values->CommandSubType, 27, 28) |
   4148       __gen_uint(values->CommandType, 29, 31);
   4149 
   4150    dw[1] =
   4151       __gen_uint(values->TEEnable, 0, 0) |
   4152       __gen_uint(values->TEMode, 1, 2) |
   4153       __gen_uint(values->TEDomain, 4, 5) |
   4154       __gen_uint(values->OutputTopology, 8, 9) |
   4155       __gen_uint(values->Partitioning, 12, 13);
   4156 
   4157    dw[2] =
   4158       __gen_float(values->MaximumTessellationFactorOdd);
   4159 
   4160    dw[3] =
   4161       __gen_float(values->MaximumTessellationFactorNotOdd);
   4162 }
   4163 
   4164 #define GEN7_3DSTATE_URB_DS_length             2
   4165 #define GEN7_3DSTATE_URB_DS_length_bias        2
   4166 #define GEN7_3DSTATE_URB_DS_header              \
   4167    .DWordLength                         =      0,  \
   4168    ._3DCommandSubOpcode                 =     50,  \
   4169    ._3DCommandOpcode                    =      0,  \
   4170    .CommandSubType                      =      3,  \
   4171    .CommandType                         =      3
   4172 
   4173 struct GEN7_3DSTATE_URB_DS {
   4174    uint32_t                             DWordLength;
   4175    uint32_t                             _3DCommandSubOpcode;
   4176    uint32_t                             _3DCommandOpcode;
   4177    uint32_t                             CommandSubType;
   4178    uint32_t                             CommandType;
   4179    uint32_t                             DSNumberofURBEntries;
   4180    uint32_t                             DSURBEntryAllocationSize;
   4181    uint32_t                             DSURBStartingAddress;
   4182 };
   4183 
   4184 static inline void
   4185 GEN7_3DSTATE_URB_DS_pack(__attribute__((unused)) __gen_user_data *data,
   4186                          __attribute__((unused)) void * restrict dst,
   4187                          __attribute__((unused)) const struct GEN7_3DSTATE_URB_DS * restrict values)
   4188 {
   4189    uint32_t * restrict dw = (uint32_t * restrict) dst;
   4190 
   4191    dw[0] =
   4192       __gen_uint(values->DWordLength, 0, 7) |
   4193       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   4194       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   4195       __gen_uint(values->CommandSubType, 27, 28) |
   4196       __gen_uint(values->CommandType, 29, 31);
   4197 
   4198    dw[1] =
   4199       __gen_uint(values->DSNumberofURBEntries, 0, 15) |
   4200       __gen_uint(values->DSURBEntryAllocationSize, 16, 24) |
   4201       __gen_uint(values->DSURBStartingAddress, 25, 29);
   4202 }
   4203 
   4204 #define GEN7_3DSTATE_URB_GS_length             2
   4205 #define GEN7_3DSTATE_URB_GS_length_bias        2
   4206 #define GEN7_3DSTATE_URB_GS_header              \
   4207    .DWordLength                         =      0,  \
   4208    ._3DCommandSubOpcode                 =     51,  \
   4209    ._3DCommandOpcode                    =      0,  \
   4210    .CommandSubType                      =      3,  \
   4211    .CommandType                         =      3
   4212 
   4213 struct GEN7_3DSTATE_URB_GS {
   4214    uint32_t                             DWordLength;
   4215    uint32_t                             _3DCommandSubOpcode;
   4216    uint32_t                             _3DCommandOpcode;
   4217    uint32_t                             CommandSubType;
   4218    uint32_t                             CommandType;
   4219    uint32_t                             GSNumberofURBEntries;
   4220    uint32_t                             GSURBEntryAllocationSize;
   4221    uint32_t                             GSURBStartingAddress;
   4222 };
   4223 
   4224 static inline void
   4225 GEN7_3DSTATE_URB_GS_pack(__attribute__((unused)) __gen_user_data *data,
   4226                          __attribute__((unused)) void * restrict dst,
   4227                          __attribute__((unused)) const struct GEN7_3DSTATE_URB_GS * restrict values)
   4228 {
   4229    uint32_t * restrict dw = (uint32_t * restrict) dst;
   4230 
   4231    dw[0] =
   4232       __gen_uint(values->DWordLength, 0, 7) |
   4233       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   4234       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   4235       __gen_uint(values->CommandSubType, 27, 28) |
   4236       __gen_uint(values->CommandType, 29, 31);
   4237 
   4238    dw[1] =
   4239       __gen_uint(values->GSNumberofURBEntries, 0, 15) |
   4240       __gen_uint(values->GSURBEntryAllocationSize, 16, 24) |
   4241       __gen_uint(values->GSURBStartingAddress, 25, 29);
   4242 }
   4243 
   4244 #define GEN7_3DSTATE_URB_HS_length             2
   4245 #define GEN7_3DSTATE_URB_HS_length_bias        2
   4246 #define GEN7_3DSTATE_URB_HS_header              \
   4247    .DWordLength                         =      0,  \
   4248    ._3DCommandSubOpcode                 =     49,  \
   4249    ._3DCommandOpcode                    =      0,  \
   4250    .CommandSubType                      =      3,  \
   4251    .CommandType                         =      3
   4252 
   4253 struct GEN7_3DSTATE_URB_HS {
   4254    uint32_t                             DWordLength;
   4255    uint32_t                             _3DCommandSubOpcode;
   4256    uint32_t                             _3DCommandOpcode;
   4257    uint32_t                             CommandSubType;
   4258    uint32_t                             CommandType;
   4259    uint32_t                             HSNumberofURBEntries;
   4260    uint32_t                             HSURBEntryAllocationSize;
   4261    uint32_t                             HSURBStartingAddress;
   4262 };
   4263 
   4264 static inline void
   4265 GEN7_3DSTATE_URB_HS_pack(__attribute__((unused)) __gen_user_data *data,
   4266                          __attribute__((unused)) void * restrict dst,
   4267                          __attribute__((unused)) const struct GEN7_3DSTATE_URB_HS * restrict values)
   4268 {
   4269    uint32_t * restrict dw = (uint32_t * restrict) dst;
   4270 
   4271    dw[0] =
   4272       __gen_uint(values->DWordLength, 0, 7) |
   4273       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   4274       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   4275       __gen_uint(values->CommandSubType, 27, 28) |
   4276       __gen_uint(values->CommandType, 29, 31);
   4277 
   4278    dw[1] =
   4279       __gen_uint(values->HSNumberofURBEntries, 0, 15) |
   4280       __gen_uint(values->HSURBEntryAllocationSize, 16, 24) |
   4281       __gen_uint(values->HSURBStartingAddress, 25, 29);
   4282 }
   4283 
   4284 #define GEN7_3DSTATE_URB_VS_length             2
   4285 #define GEN7_3DSTATE_URB_VS_length_bias        2
   4286 #define GEN7_3DSTATE_URB_VS_header              \
   4287    .DWordLength                         =      0,  \
   4288    ._3DCommandSubOpcode                 =     48,  \
   4289    ._3DCommandOpcode                    =      0,  \
   4290    .CommandSubType                      =      3,  \
   4291    .CommandType                         =      3
   4292 
   4293 struct GEN7_3DSTATE_URB_VS {
   4294    uint32_t                             DWordLength;
   4295    uint32_t                             _3DCommandSubOpcode;
   4296    uint32_t                             _3DCommandOpcode;
   4297    uint32_t                             CommandSubType;
   4298    uint32_t                             CommandType;
   4299    uint32_t                             VSNumberofURBEntries;
   4300    uint32_t                             VSURBEntryAllocationSize;
   4301    uint32_t                             VSURBStartingAddress;
   4302 };
   4303 
   4304 static inline void
   4305 GEN7_3DSTATE_URB_VS_pack(__attribute__((unused)) __gen_user_data *data,
   4306                          __attribute__((unused)) void * restrict dst,
   4307                          __attribute__((unused)) const struct GEN7_3DSTATE_URB_VS * restrict values)
   4308 {
   4309    uint32_t * restrict dw = (uint32_t * restrict) dst;
   4310 
   4311    dw[0] =
   4312       __gen_uint(values->DWordLength, 0, 7) |
   4313       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   4314       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   4315       __gen_uint(values->CommandSubType, 27, 28) |
   4316       __gen_uint(values->CommandType, 29, 31);
   4317 
   4318    dw[1] =
   4319       __gen_uint(values->VSNumberofURBEntries, 0, 15) |
   4320       __gen_uint(values->VSURBEntryAllocationSize, 16, 24) |
   4321       __gen_uint(values->VSURBStartingAddress, 25, 29);
   4322 }
   4323 
   4324 #define GEN7_3DSTATE_VERTEX_BUFFERS_length_bias      2
   4325 #define GEN7_3DSTATE_VERTEX_BUFFERS_header      \
   4326    .DWordLength                         =      3,  \
   4327    ._3DCommandSubOpcode                 =      8,  \
   4328    ._3DCommandOpcode                    =      0,  \
   4329    .CommandSubType                      =      3,  \
   4330    .CommandType                         =      3
   4331 
   4332 struct GEN7_3DSTATE_VERTEX_BUFFERS {
   4333    uint32_t                             DWordLength;
   4334    uint32_t                             _3DCommandSubOpcode;
   4335    uint32_t                             _3DCommandOpcode;
   4336    uint32_t                             CommandSubType;
   4337    uint32_t                             CommandType;
   4338    /* variable length fields follow */
   4339 };
   4340 
   4341 static inline void
   4342 GEN7_3DSTATE_VERTEX_BUFFERS_pack(__attribute__((unused)) __gen_user_data *data,
   4343                                  __attribute__((unused)) void * restrict dst,
   4344                                  __attribute__((unused)) const struct GEN7_3DSTATE_VERTEX_BUFFERS * restrict values)
   4345 {
   4346    uint32_t * restrict dw = (uint32_t * restrict) dst;
   4347 
   4348    dw[0] =
   4349       __gen_uint(values->DWordLength, 0, 7) |
   4350       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   4351       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   4352       __gen_uint(values->CommandSubType, 27, 28) |
   4353       __gen_uint(values->CommandType, 29, 31);
   4354 }
   4355 
   4356 #define GEN7_3DSTATE_VERTEX_ELEMENTS_length_bias      2
   4357 #define GEN7_3DSTATE_VERTEX_ELEMENTS_header     \
   4358    .DWordLength                         =      1,  \
   4359    ._3DCommandSubOpcode                 =      9,  \
   4360    ._3DCommandOpcode                    =      0,  \
   4361    .CommandSubType                      =      3,  \
   4362    .CommandType                         =      3
   4363 
   4364 struct GEN7_3DSTATE_VERTEX_ELEMENTS {
   4365    uint32_t                             DWordLength;
   4366    uint32_t                             _3DCommandSubOpcode;
   4367    uint32_t                             _3DCommandOpcode;
   4368    uint32_t                             CommandSubType;
   4369    uint32_t                             CommandType;
   4370    /* variable length fields follow */
   4371 };
   4372 
   4373 static inline void
   4374 GEN7_3DSTATE_VERTEX_ELEMENTS_pack(__attribute__((unused)) __gen_user_data *data,
   4375                                   __attribute__((unused)) void * restrict dst,
   4376                                   __attribute__((unused)) const struct GEN7_3DSTATE_VERTEX_ELEMENTS * restrict values)
   4377 {
   4378    uint32_t * restrict dw = (uint32_t * restrict) dst;
   4379 
   4380    dw[0] =
   4381       __gen_uint(values->DWordLength, 0, 7) |
   4382       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   4383       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   4384       __gen_uint(values->CommandSubType, 27, 28) |
   4385       __gen_uint(values->CommandType, 29, 31);
   4386 }
   4387 
   4388 #define GEN7_3DSTATE_VF_STATISTICS_length      1
   4389 #define GEN7_3DSTATE_VF_STATISTICS_length_bias      1
   4390 #define GEN7_3DSTATE_VF_STATISTICS_header       \
   4391    ._3DCommandSubOpcode                 =     11,  \
   4392    ._3DCommandOpcode                    =      0,  \
   4393    .CommandSubType                      =      1,  \
   4394    .CommandType                         =      3
   4395 
   4396 struct GEN7_3DSTATE_VF_STATISTICS {
   4397    bool                                 StatisticsEnable;
   4398    uint32_t                             _3DCommandSubOpcode;
   4399    uint32_t                             _3DCommandOpcode;
   4400    uint32_t                             CommandSubType;
   4401    uint32_t                             CommandType;
   4402 };
   4403 
   4404 static inline void
   4405 GEN7_3DSTATE_VF_STATISTICS_pack(__attribute__((unused)) __gen_user_data *data,
   4406                                 __attribute__((unused)) void * restrict dst,
   4407                                 __attribute__((unused)) const struct GEN7_3DSTATE_VF_STATISTICS * restrict values)
   4408 {
   4409    uint32_t * restrict dw = (uint32_t * restrict) dst;
   4410 
   4411    dw[0] =
   4412       __gen_uint(values->StatisticsEnable, 0, 0) |
   4413       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   4414       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   4415       __gen_uint(values->CommandSubType, 27, 28) |
   4416       __gen_uint(values->CommandType, 29, 31);
   4417 }
   4418 
   4419 #define GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_CC_length      2
   4420 #define GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_CC_length_bias      2
   4421 #define GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_CC_header\
   4422    .DWordLength                         =      0,  \
   4423    ._3DCommandSubOpcode                 =     35,  \
   4424    ._3DCommandOpcode                    =      0,  \
   4425    .CommandSubType                      =      3,  \
   4426    .CommandType                         =      3
   4427 
   4428 struct GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_CC {
   4429    uint32_t                             DWordLength;
   4430    uint32_t                             _3DCommandSubOpcode;
   4431    uint32_t                             _3DCommandOpcode;
   4432    uint32_t                             CommandSubType;
   4433    uint32_t                             CommandType;
   4434    uint64_t                             CCViewportPointer;
   4435 };
   4436 
   4437 static inline void
   4438 GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_CC_pack(__attribute__((unused)) __gen_user_data *data,
   4439                                              __attribute__((unused)) void * restrict dst,
   4440                                              __attribute__((unused)) const struct GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_CC * restrict values)
   4441 {
   4442    uint32_t * restrict dw = (uint32_t * restrict) dst;
   4443 
   4444    dw[0] =
   4445       __gen_uint(values->DWordLength, 0, 7) |
   4446       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   4447       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   4448       __gen_uint(values->CommandSubType, 27, 28) |
   4449       __gen_uint(values->CommandType, 29, 31);
   4450 
   4451    dw[1] =
   4452       __gen_offset(values->CCViewportPointer, 5, 31);
   4453 }
   4454 
   4455 #define GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_length      2
   4456 #define GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_length_bias      2
   4457 #define GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_header\
   4458    .DWordLength                         =      0,  \
   4459    ._3DCommandSubOpcode                 =     33,  \
   4460    ._3DCommandOpcode                    =      0,  \
   4461    .CommandSubType                      =      3,  \
   4462    .CommandType                         =      3
   4463 
   4464 struct GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP {
   4465    uint32_t                             DWordLength;
   4466    uint32_t                             _3DCommandSubOpcode;
   4467    uint32_t                             _3DCommandOpcode;
   4468    uint32_t                             CommandSubType;
   4469    uint32_t                             CommandType;
   4470    uint64_t                             SFClipViewportPointer;
   4471 };
   4472 
   4473 static inline void
   4474 GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
   4475                                                   __attribute__((unused)) void * restrict dst,
   4476                                                   __attribute__((unused)) const struct GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP * restrict values)
   4477 {
   4478    uint32_t * restrict dw = (uint32_t * restrict) dst;
   4479 
   4480    dw[0] =
   4481       __gen_uint(values->DWordLength, 0, 7) |
   4482       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   4483       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   4484       __gen_uint(values->CommandSubType, 27, 28) |
   4485       __gen_uint(values->CommandType, 29, 31);
   4486 
   4487    dw[1] =
   4488       __gen_offset(values->SFClipViewportPointer, 6, 31);
   4489 }
   4490 
   4491 #define GEN7_3DSTATE_VS_length                 6
   4492 #define GEN7_3DSTATE_VS_length_bias            2
   4493 #define GEN7_3DSTATE_VS_header                  \
   4494    .DWordLength                         =      4,  \
   4495    ._3DCommandSubOpcode                 =     16,  \
   4496    ._3DCommandOpcode                    =      0,  \
   4497    .CommandSubType                      =      3,  \
   4498    .CommandType                         =      3
   4499 
   4500 struct GEN7_3DSTATE_VS {
   4501    uint32_t                             DWordLength;
   4502    uint32_t                             _3DCommandSubOpcode;
   4503    uint32_t                             _3DCommandOpcode;
   4504    uint32_t                             CommandSubType;
   4505    uint32_t                             CommandType;
   4506    uint64_t                             KernelStartPointer;
   4507    bool                                 SoftwareExceptionEnable;
   4508    bool                                 IllegalOpcodeExceptionEnable;
   4509    uint32_t                             FloatingPointMode;
   4510 #define IEEE754                                  0
   4511 #define Alternate                                1
   4512    uint32_t                             BindingTableEntryCount;
   4513    uint32_t                             SamplerCount;
   4514 #define NoSamplers                               0
   4515 #define _14Samplers                              1
   4516 #define _58Samplers                              2
   4517 #define _912Samplers                             3
   4518 #define _1316Samplers                            4
   4519    bool                                 VectorMaskEnable;
   4520    bool                                 SingleVertexDispatch;
   4521    uint32_t                             PerThreadScratchSpace;
   4522    __gen_address_type                   ScratchSpaceBasePointer;
   4523    uint32_t                             VertexURBEntryReadOffset;
   4524    uint32_t                             VertexURBEntryReadLength;
   4525    uint32_t                             DispatchGRFStartRegisterForURBData;
   4526    bool                                 Enable;
   4527    bool                                 VertexCacheDisable;
   4528    bool                                 StatisticsEnable;
   4529    uint32_t                             MaximumNumberofThreads;
   4530 };
   4531 
   4532 static inline void
   4533 GEN7_3DSTATE_VS_pack(__attribute__((unused)) __gen_user_data *data,
   4534                      __attribute__((unused)) void * restrict dst,
   4535                      __attribute__((unused)) const struct GEN7_3DSTATE_VS * restrict values)
   4536 {
   4537    uint32_t * restrict dw = (uint32_t * restrict) dst;
   4538 
   4539    dw[0] =
   4540       __gen_uint(values->DWordLength, 0, 7) |
   4541       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   4542       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   4543       __gen_uint(values->CommandSubType, 27, 28) |
   4544       __gen_uint(values->CommandType, 29, 31);
   4545 
   4546    dw[1] =
   4547       __gen_offset(values->KernelStartPointer, 6, 31);
   4548 
   4549    dw[2] =
   4550       __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
   4551       __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
   4552       __gen_uint(values->FloatingPointMode, 16, 16) |
   4553       __gen_uint(values->BindingTableEntryCount, 18, 25) |
   4554       __gen_uint(values->SamplerCount, 27, 29) |
   4555       __gen_uint(values->VectorMaskEnable, 30, 30) |
   4556       __gen_uint(values->SingleVertexDispatch, 31, 31);
   4557 
   4558    const uint32_t v3 =
   4559       __gen_uint(values->PerThreadScratchSpace, 0, 3);
   4560    dw[3] = __gen_combine_address(data, &dw[3], values->ScratchSpaceBasePointer, v3);
   4561 
   4562    dw[4] =
   4563       __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
   4564       __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
   4565       __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
   4566 
   4567    dw[5] =
   4568       __gen_uint(values->Enable, 0, 0) |
   4569       __gen_uint(values->VertexCacheDisable, 1, 1) |
   4570       __gen_uint(values->StatisticsEnable, 10, 10) |
   4571       __gen_uint(values->MaximumNumberofThreads, 25, 31);
   4572 }
   4573 
   4574 #define GEN7_3DSTATE_WM_length                 3
   4575 #define GEN7_3DSTATE_WM_length_bias            2
   4576 #define GEN7_3DSTATE_WM_header                  \
   4577    .DWordLength                         =      1,  \
   4578    ._3DCommandSubOpcode                 =     20,  \
   4579    ._3DCommandOpcode                    =      0,  \
   4580    .CommandSubType                      =      3,  \
   4581    .CommandType                         =      3
   4582 
   4583 struct GEN7_3DSTATE_WM {
   4584    uint32_t                             DWordLength;
   4585    uint32_t                             _3DCommandSubOpcode;
   4586    uint32_t                             _3DCommandOpcode;
   4587    uint32_t                             CommandSubType;
   4588    uint32_t                             CommandType;
   4589    uint32_t                             MultisampleRasterizationMode;
   4590 #define MSRASTMODE_OFF_PIXEL                     0
   4591 #define MSRASTMODE_OFF_PATTERN                   1
   4592 #define MSRASTMODE_ON_PIXEL                      2
   4593 #define MSRASTMODE_ON_PATTERN                    3
   4594    uint32_t                             PointRasterizationRule;
   4595 #define RASTRULE_UPPER_LEFT                      0
   4596 #define RASTRULE_UPPER_RIGHT                     1
   4597    bool                                 LineStippleEnable;
   4598    bool                                 PolygonStippleEnable;
   4599    uint32_t                             LineAntialiasingRegionWidth;
   4600 #define _05pixels                                0
   4601 #define _10pixels                                1
   4602 #define _20pixels                                2
   4603 #define _40pixels                                3
   4604    uint32_t                             LineEndCapAntialiasingRegionWidth;
   4605    bool                                 PixelShaderUsesInputCoverageMask;
   4606    uint32_t                             BarycentricInterpolationMode;
   4607 #define BIM_PERSPECTIVE_PIXEL                    1
   4608 #define BIM_PERSPECTIVE_CENTROID                 2
   4609 #define BIM_PERSPECTIVE_SAMPLE                   4
   4610 #define BIM_LINEAR_PIXEL                         8
   4611 #define BIM_LINEAR_CENTROID                      16
   4612 #define BIM_LINEAR_SAMPLE                        32
   4613    uint32_t                             PositionZWInterpolationMode;
   4614 #define INTERP_PIXEL                             0
   4615 #define INTERP_CENTROID                          2
   4616 #define INTERP_SAMPLE                            3
   4617    bool                                 PixelShaderUsesSourceW;
   4618    bool                                 PixelShaderUsesSourceDepth;
   4619    uint32_t                             EarlyDepthStencilControl;
   4620 #define EDSC_NORMAL                              0
   4621 #define EDSC_PSEXEC                              1
   4622 #define EDSC_PREPS                               2
   4623    uint32_t                             PixelShaderComputedDepthMode;
   4624 #define PSCDEPTH_OFF                             0
   4625 #define PSCDEPTH_ON                              1
   4626 #define PSCDEPTH_ON_GE                           2
   4627 #define PSCDEPTH_ON_LE                           3
   4628    bool                                 PixelShaderKillsPixel;
   4629    bool                                 LegacyDiamondLineRasterization;
   4630    bool                                 HierarchicalDepthBufferResolveEnable;
   4631    bool                                 DepthBufferResolveEnable;
   4632    bool                                 ThreadDispatchEnable;
   4633    bool                                 DepthBufferClear;
   4634    bool                                 StatisticsEnable;
   4635    uint32_t                             MultisampleDispatchMode;
   4636 #define MSDISPMODE_PERSAMPLE                     0
   4637 #define MSDISPMODE_PERPIXEL                      1
   4638 };
   4639 
   4640 static inline void
   4641 GEN7_3DSTATE_WM_pack(__attribute__((unused)) __gen_user_data *data,
   4642                      __attribute__((unused)) void * restrict dst,
   4643                      __attribute__((unused)) const struct GEN7_3DSTATE_WM * restrict values)
   4644 {
   4645    uint32_t * restrict dw = (uint32_t * restrict) dst;
   4646 
   4647    dw[0] =
   4648       __gen_uint(values->DWordLength, 0, 7) |
   4649       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   4650       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   4651       __gen_uint(values->CommandSubType, 27, 28) |
   4652       __gen_uint(values->CommandType, 29, 31);
   4653 
   4654    dw[1] =
   4655       __gen_uint(values->MultisampleRasterizationMode, 0, 1) |
   4656       __gen_uint(values->PointRasterizationRule, 2, 2) |
   4657       __gen_uint(values->LineStippleEnable, 3, 3) |
   4658       __gen_uint(values->PolygonStippleEnable, 4, 4) |
   4659       __gen_uint(values->LineAntialiasingRegionWidth, 6, 7) |
   4660       __gen_uint(values->LineEndCapAntialiasingRegionWidth, 8, 9) |
   4661       __gen_uint(values->PixelShaderUsesInputCoverageMask, 10, 10) |
   4662       __gen_uint(values->BarycentricInterpolationMode, 11, 16) |
   4663       __gen_uint(values->PositionZWInterpolationMode, 17, 18) |
   4664       __gen_uint(values->PixelShaderUsesSourceW, 19, 19) |
   4665       __gen_uint(values->PixelShaderUsesSourceDepth, 20, 20) |
   4666       __gen_uint(values->EarlyDepthStencilControl, 21, 22) |
   4667       __gen_uint(values->PixelShaderComputedDepthMode, 23, 24) |
   4668       __gen_uint(values->PixelShaderKillsPixel, 25, 25) |
   4669       __gen_uint(values->LegacyDiamondLineRasterization, 26, 26) |
   4670       __gen_uint(values->HierarchicalDepthBufferResolveEnable, 27, 27) |
   4671       __gen_uint(values->DepthBufferResolveEnable, 28, 28) |
   4672       __gen_uint(values->ThreadDispatchEnable, 29, 29) |
   4673       __gen_uint(values->DepthBufferClear, 30, 30) |
   4674       __gen_uint(values->StatisticsEnable, 31, 31);
   4675 
   4676    dw[2] =
   4677       __gen_uint(values->MultisampleDispatchMode, 31, 31);
   4678 }
   4679 
   4680 #define GEN7_GPGPU_OBJECT_length               8
   4681 #define GEN7_GPGPU_OBJECT_length_bias          2
   4682 #define GEN7_GPGPU_OBJECT_header                \
   4683    .DWordLength                         =      6,  \
   4684    .SubOpcode                           =      4,  \
   4685    .MediaCommandOpcode                  =      1,  \
   4686    .Pipeline                            =      2,  \
   4687    .CommandType                         =      3
   4688 
   4689 struct GEN7_GPGPU_OBJECT {
   4690    uint32_t                             DWordLength;
   4691    bool                                 PredicateEnable;
   4692    uint32_t                             SubOpcode;
   4693    uint32_t                             MediaCommandOpcode;
   4694    uint32_t                             Pipeline;
   4695    uint32_t                             CommandType;
   4696    uint32_t                             InterfaceDescriptorOffset;
   4697    uint32_t                             SharedLocalMemoryFixedOffset;
   4698    uint32_t                             IndirectDataLength;
   4699    uint32_t                             HalfSliceDestinationSelect;
   4700 #define HalfSlice1                               2
   4701 #define HalfSlice0                               1
   4702 #define EitherHalfSlice                          0
   4703    uint32_t                             EndofThreadGroup;
   4704    uint32_t                             SharedLocalMemoryOffset;
   4705    uint64_t                             IndirectDataStartAddress;
   4706    uint32_t                             ThreadGroupIDX;
   4707    uint32_t                             ThreadGroupIDY;
   4708    uint32_t                             ThreadGroupIDZ;
   4709    uint32_t                             ExecutionMask;
   4710 };
   4711 
   4712 static inline void
   4713 GEN7_GPGPU_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
   4714                        __attribute__((unused)) void * restrict dst,
   4715                        __attribute__((unused)) const struct GEN7_GPGPU_OBJECT * restrict values)
   4716 {
   4717    uint32_t * restrict dw = (uint32_t * restrict) dst;
   4718 
   4719    dw[0] =
   4720       __gen_uint(values->DWordLength, 0, 7) |
   4721       __gen_uint(values->PredicateEnable, 8, 8) |
   4722       __gen_uint(values->SubOpcode, 16, 23) |
   4723       __gen_uint(values->MediaCommandOpcode, 24, 26) |
   4724       __gen_uint(values->Pipeline, 27, 28) |
   4725       __gen_uint(values->CommandType, 29, 31);
   4726 
   4727    dw[1] =
   4728       __gen_uint(values->InterfaceDescriptorOffset, 0, 4) |
   4729       __gen_uint(values->SharedLocalMemoryFixedOffset, 7, 7);
   4730 
   4731    dw[2] =
   4732       __gen_uint(values->IndirectDataLength, 0, 16) |
   4733       __gen_uint(values->HalfSliceDestinationSelect, 17, 18) |
   4734       __gen_uint(values->EndofThreadGroup, 24, 24) |
   4735       __gen_uint(values->SharedLocalMemoryOffset, 28, 31);
   4736 
   4737    dw[3] =
   4738       __gen_offset(values->IndirectDataStartAddress, 0, 31);
   4739 
   4740    dw[4] =
   4741       __gen_uint(values->ThreadGroupIDX, 0, 31);
   4742 
   4743    dw[5] =
   4744       __gen_uint(values->ThreadGroupIDY, 0, 31);
   4745 
   4746    dw[6] =
   4747       __gen_uint(values->ThreadGroupIDZ, 0, 31);
   4748 
   4749    dw[7] =
   4750       __gen_uint(values->ExecutionMask, 0, 31);
   4751 }
   4752 
   4753 #define GEN7_GPGPU_WALKER_length              11
   4754 #define GEN7_GPGPU_WALKER_length_bias          2
   4755 #define GEN7_GPGPU_WALKER_header                \
   4756    .DWordLength                         =      9,  \
   4757    .SubOpcodeA                          =      5,  \
   4758    .MediaCommandOpcode                  =      1,  \
   4759    .Pipeline                            =      2,  \
   4760    .CommandType                         =      3
   4761 
   4762 struct GEN7_GPGPU_WALKER {
   4763    uint32_t                             DWordLength;
   4764    bool                                 PredicateEnable;
   4765    bool                                 IndirectParameterEnable;
   4766    uint32_t                             SubOpcodeA;
   4767    uint32_t                             MediaCommandOpcode;
   4768    uint32_t                             Pipeline;
   4769    uint32_t                             CommandType;
   4770    uint32_t                             InterfaceDescriptorOffset;
   4771    uint32_t                             ThreadWidthCounterMaximum;
   4772    uint32_t                             ThreadHeightCounterMaximum;
   4773    uint32_t                             ThreadDepthCounterMaximum;
   4774    uint32_t                             SIMDSize;
   4775 #define SIMD8                                    0
   4776 #define SIMD16                                   1
   4777 #define SIMD32                                   2
   4778    uint32_t                             ThreadGroupIDStartingX;
   4779    uint32_t                             ThreadGroupIDXDimension;
   4780    uint32_t                             ThreadGroupIDStartingY;
   4781    uint32_t                             ThreadGroupIDYDimension;
   4782    uint32_t                             ThreadGroupIDStartingZ;
   4783    uint32_t                             ThreadGroupIDZDimension;
   4784    uint32_t                             RightExecutionMask;
   4785    uint32_t                             BottomExecutionMask;
   4786 };
   4787 
   4788 static inline void
   4789 GEN7_GPGPU_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
   4790                        __attribute__((unused)) void * restrict dst,
   4791                        __attribute__((unused)) const struct GEN7_GPGPU_WALKER * restrict values)
   4792 {
   4793    uint32_t * restrict dw = (uint32_t * restrict) dst;
   4794 
   4795    dw[0] =
   4796       __gen_uint(values->DWordLength, 0, 7) |
   4797       __gen_uint(values->PredicateEnable, 8, 8) |
   4798       __gen_uint(values->IndirectParameterEnable, 10, 10) |
   4799       __gen_uint(values->SubOpcodeA, 16, 23) |
   4800       __gen_uint(values->MediaCommandOpcode, 24, 26) |
   4801       __gen_uint(values->Pipeline, 27, 28) |
   4802       __gen_uint(values->CommandType, 29, 31);
   4803 
   4804    dw[1] =
   4805       __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
   4806 
   4807    dw[2] =
   4808       __gen_uint(values->ThreadWidthCounterMaximum, 0, 5) |
   4809       __gen_uint(values->ThreadHeightCounterMaximum, 8, 13) |
   4810       __gen_uint(values->ThreadDepthCounterMaximum, 16, 21) |
   4811       __gen_uint(values->SIMDSize, 30, 31);
   4812 
   4813    dw[3] =
   4814       __gen_uint(values->ThreadGroupIDStartingX, 0, 31);
   4815 
   4816    dw[4] =
   4817       __gen_uint(values->ThreadGroupIDXDimension, 0, 31);
   4818 
   4819    dw[5] =
   4820       __gen_uint(values->ThreadGroupIDStartingY, 0, 31);
   4821 
   4822    dw[6] =
   4823       __gen_uint(values->ThreadGroupIDYDimension, 0, 31);
   4824 
   4825    dw[7] =
   4826       __gen_uint(values->ThreadGroupIDStartingZ, 0, 31);
   4827 
   4828    dw[8] =
   4829       __gen_uint(values->ThreadGroupIDZDimension, 0, 31);
   4830 
   4831    dw[9] =
   4832       __gen_uint(values->RightExecutionMask, 0, 31);
   4833 
   4834    dw[10] =
   4835       __gen_uint(values->BottomExecutionMask, 0, 31);
   4836 }
   4837 
   4838 #define GEN7_MEDIA_CURBE_LOAD_length           4
   4839 #define GEN7_MEDIA_CURBE_LOAD_length_bias      2
   4840 #define GEN7_MEDIA_CURBE_LOAD_header            \
   4841    .DWordLength                         =      2,  \
   4842    .SubOpcode                           =      1,  \
   4843    .MediaCommandOpcode                  =      0,  \
   4844    .Pipeline                            =      2,  \
   4845    .CommandType                         =      3
   4846 
   4847 struct GEN7_MEDIA_CURBE_LOAD {
   4848    uint32_t                             DWordLength;
   4849    uint32_t                             SubOpcode;
   4850    uint32_t                             MediaCommandOpcode;
   4851    uint32_t                             Pipeline;
   4852    uint32_t                             CommandType;
   4853    uint32_t                             CURBETotalDataLength;
   4854    uint32_t                             CURBEDataStartAddress;
   4855 };
   4856 
   4857 static inline void
   4858 GEN7_MEDIA_CURBE_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
   4859                            __attribute__((unused)) void * restrict dst,
   4860                            __attribute__((unused)) const struct GEN7_MEDIA_CURBE_LOAD * restrict values)
   4861 {
   4862    uint32_t * restrict dw = (uint32_t * restrict) dst;
   4863 
   4864    dw[0] =
   4865       __gen_uint(values->DWordLength, 0, 15) |
   4866       __gen_uint(values->SubOpcode, 16, 23) |
   4867       __gen_uint(values->MediaCommandOpcode, 24, 26) |
   4868       __gen_uint(values->Pipeline, 27, 28) |
   4869       __gen_uint(values->CommandType, 29, 31);
   4870 
   4871    dw[1] = 0;
   4872 
   4873    dw[2] =
   4874       __gen_uint(values->CURBETotalDataLength, 0, 16);
   4875 
   4876    dw[3] =
   4877       __gen_uint(values->CURBEDataStartAddress, 0, 31);
   4878 }
   4879 
   4880 #define GEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length      4
   4881 #define GEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length_bias      2
   4882 #define GEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD_header\
   4883    .DWordLength                         =      2,  \
   4884    .SubOpcode                           =      2,  \
   4885    .MediaCommandOpcode                  =      0,  \
   4886    .Pipeline                            =      2,  \
   4887    .CommandType                         =      3
   4888 
   4889 struct GEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD {
   4890    uint32_t                             DWordLength;
   4891    uint32_t                             SubOpcode;
   4892    uint32_t                             MediaCommandOpcode;
   4893    uint32_t                             Pipeline;
   4894    uint32_t                             CommandType;
   4895    uint32_t                             InterfaceDescriptorTotalLength;
   4896    uint64_t                             InterfaceDescriptorDataStartAddress;
   4897 };
   4898 
   4899 static inline void
   4900 GEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
   4901                                           __attribute__((unused)) void * restrict dst,
   4902                                           __attribute__((unused)) const struct GEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD * restrict values)
   4903 {
   4904    uint32_t * restrict dw = (uint32_t * restrict) dst;
   4905 
   4906    dw[0] =
   4907       __gen_uint(values->DWordLength, 0, 15) |
   4908       __gen_uint(values->SubOpcode, 16, 23) |
   4909       __gen_uint(values->MediaCommandOpcode, 24, 26) |
   4910       __gen_uint(values->Pipeline, 27, 28) |
   4911       __gen_uint(values->CommandType, 29, 31);
   4912 
   4913    dw[1] = 0;
   4914 
   4915    dw[2] =
   4916       __gen_uint(values->InterfaceDescriptorTotalLength, 0, 16);
   4917 
   4918    dw[3] =
   4919       __gen_offset(values->InterfaceDescriptorDataStartAddress, 0, 31);
   4920 }
   4921 
   4922 #define GEN7_MEDIA_OBJECT_length_bias          2
   4923 #define GEN7_MEDIA_OBJECT_header                \
   4924    .DWordLength                         =      4,  \
   4925    .MediaCommandSubOpcode               =      0,  \
   4926    .MediaCommandOpcode                  =      1,  \
   4927    .MediaCommandPipeline                =      2,  \
   4928    .CommandType                         =      3
   4929 
   4930 struct GEN7_MEDIA_OBJECT {
   4931    uint32_t                             DWordLength;
   4932    uint32_t                             MediaCommandSubOpcode;
   4933    uint32_t                             MediaCommandOpcode;
   4934    uint32_t                             MediaCommandPipeline;
   4935    uint32_t                             CommandType;
   4936    uint32_t                             InterfaceDescriptorOffset;
   4937    uint32_t                             IndirectDataLength;
   4938    uint32_t                             HalfSliceDestinationSelect;
   4939 #define HalfSlice1                               2
   4940 #define HalfSlice0                               1
   4941 #define Eitherhalfslice                          0
   4942    uint32_t                             UseScoreboard;
   4943 #define Notusingscoreboard                       0
   4944 #define Usingscoreboard                          1
   4945    uint32_t                             ThreadSynchronization;
   4946 #define Nothreadsynchronization                  0
   4947 #define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
   4948    bool                                 ChildrenPresent;
   4949    __gen_address_type                   IndirectDataStartAddress;
   4950    uint32_t                             ScoreboardX;
   4951    uint32_t                             ScoredboardY;
   4952    uint32_t                             ScoreboardMask;
   4953    uint32_t                             ScoreboardColor;
   4954    /* variable length fields follow */
   4955 };
   4956 
   4957 static inline void
   4958 GEN7_MEDIA_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
   4959                        __attribute__((unused)) void * restrict dst,
   4960                        __attribute__((unused)) const struct GEN7_MEDIA_OBJECT * restrict values)
   4961 {
   4962    uint32_t * restrict dw = (uint32_t * restrict) dst;
   4963 
   4964    dw[0] =
   4965       __gen_uint(values->DWordLength, 0, 15) |
   4966       __gen_uint(values->MediaCommandSubOpcode, 16, 23) |
   4967       __gen_uint(values->MediaCommandOpcode, 24, 26) |
   4968       __gen_uint(values->MediaCommandPipeline, 27, 28) |
   4969       __gen_uint(values->CommandType, 29, 31);
   4970 
   4971    dw[1] =
   4972       __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
   4973 
   4974    dw[2] =
   4975       __gen_uint(values->IndirectDataLength, 0, 16) |
   4976       __gen_uint(values->HalfSliceDestinationSelect, 17, 18) |
   4977       __gen_uint(values->UseScoreboard, 21, 21) |
   4978       __gen_uint(values->ThreadSynchronization, 24, 24) |
   4979       __gen_uint(values->ChildrenPresent, 31, 31);
   4980 
   4981    dw[3] = __gen_combine_address(data, &dw[3], values->IndirectDataStartAddress, 0);
   4982 
   4983    dw[4] =
   4984       __gen_uint(values->ScoreboardX, 0, 8) |
   4985       __gen_uint(values->ScoredboardY, 16, 24);
   4986 
   4987    dw[5] =
   4988       __gen_uint(values->ScoreboardMask, 0, 7) |
   4989       __gen_uint(values->ScoreboardColor, 16, 19);
   4990 }
   4991 
   4992 #define GEN7_MEDIA_OBJECT_PRT_length          16
   4993 #define GEN7_MEDIA_OBJECT_PRT_length_bias      2
   4994 #define GEN7_MEDIA_OBJECT_PRT_header            \
   4995    .DWordLength                         =     14,  \
   4996    .SubOpcode                           =      2,  \
   4997    .MediaCommandOpcode                  =      1,  \
   4998    .Pipeline                            =      2,  \
   4999    .CommandType                         =      3
   5000 
   5001 struct GEN7_MEDIA_OBJECT_PRT {
   5002    uint32_t                             DWordLength;
   5003    uint32_t                             SubOpcode;
   5004    uint32_t                             MediaCommandOpcode;
   5005    uint32_t                             Pipeline;
   5006    uint32_t                             CommandType;
   5007    uint32_t                             InterfaceDescriptorOffset;
   5008    uint32_t                             PRT_FenceType;
   5009 #define Rootthreadqueue                          0
   5010 #define VFEstateflush                            1
   5011    bool                                 PRT_FenceNeeded;
   5012    bool                                 ChildrenPresent;
   5013    uint32_t                             InlineData[12];
   5014 };
   5015 
   5016 static inline void
   5017 GEN7_MEDIA_OBJECT_PRT_pack(__attribute__((unused)) __gen_user_data *data,
   5018                            __attribute__((unused)) void * restrict dst,
   5019                            __attribute__((unused)) const struct GEN7_MEDIA_OBJECT_PRT * restrict values)
   5020 {
   5021    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5022 
   5023    dw[0] =
   5024       __gen_uint(values->DWordLength, 0, 15) |
   5025       __gen_uint(values->SubOpcode, 16, 23) |
   5026       __gen_uint(values->MediaCommandOpcode, 24, 26) |
   5027       __gen_uint(values->Pipeline, 27, 28) |
   5028       __gen_uint(values->CommandType, 29, 31);
   5029 
   5030    dw[1] =
   5031       __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
   5032 
   5033    dw[2] =
   5034       __gen_uint(values->PRT_FenceType, 22, 22) |
   5035       __gen_uint(values->PRT_FenceNeeded, 23, 23) |
   5036       __gen_uint(values->ChildrenPresent, 31, 31);
   5037 
   5038    dw[3] = 0;
   5039 
   5040    dw[4] =
   5041       __gen_uint(values->InlineData[0], 0, 31);
   5042 
   5043    dw[5] =
   5044       __gen_uint(values->InlineData[1], 0, 31);
   5045 
   5046    dw[6] =
   5047       __gen_uint(values->InlineData[2], 0, 31);
   5048 
   5049    dw[7] =
   5050       __gen_uint(values->InlineData[3], 0, 31);
   5051 
   5052    dw[8] =
   5053       __gen_uint(values->InlineData[4], 0, 31);
   5054 
   5055    dw[9] =
   5056       __gen_uint(values->InlineData[5], 0, 31);
   5057 
   5058    dw[10] =
   5059       __gen_uint(values->InlineData[6], 0, 31);
   5060 
   5061    dw[11] =
   5062       __gen_uint(values->InlineData[7], 0, 31);
   5063 
   5064    dw[12] =
   5065       __gen_uint(values->InlineData[8], 0, 31);
   5066 
   5067    dw[13] =
   5068       __gen_uint(values->InlineData[9], 0, 31);
   5069 
   5070    dw[14] =
   5071       __gen_uint(values->InlineData[10], 0, 31);
   5072 
   5073    dw[15] =
   5074       __gen_uint(values->InlineData[11], 0, 31);
   5075 }
   5076 
   5077 #define GEN7_MEDIA_OBJECT_WALKER_length_bias      2
   5078 #define GEN7_MEDIA_OBJECT_WALKER_header         \
   5079    .DWordLength                         =     15,  \
   5080    .SubOpcode                           =      3,  \
   5081    .MediaCommandOpcode                  =      1,  \
   5082    .Pipeline                            =      2,  \
   5083    .CommandType                         =      3
   5084 
   5085 struct GEN7_MEDIA_OBJECT_WALKER {
   5086    uint32_t                             DWordLength;
   5087    uint32_t                             SubOpcode;
   5088    uint32_t                             MediaCommandOpcode;
   5089    uint32_t                             Pipeline;
   5090    uint32_t                             CommandType;
   5091    uint32_t                             InterfaceDescriptorOffset;
   5092    uint32_t                             IndirectDataLength;
   5093    uint32_t                             UseScoreboard;
   5094 #define Notusingscoreboard                       0
   5095 #define Usingscoreboard                          1
   5096    uint32_t                             ThreadSynchronization;
   5097 #define Nothreadsynchronization                  0
   5098 #define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
   5099    uint32_t                             ChildrenPresent;
   5100    uint64_t                             IndirectDataStartAddress;
   5101    uint32_t                             ScoreboardMask;
   5102    int32_t                              MidLoopUnitX;
   5103    int32_t                              LocalMidLoopUnitY;
   5104    uint32_t                             MiddleLoopExtraSteps;
   5105    uint32_t                             ColorCountMinusOne;
   5106    uint32_t                             Repel;
   5107    uint32_t                             DualMode;
   5108    uint32_t                             LocalLoopExecCount;
   5109    uint32_t                             GlobalLoopExecCount;
   5110    uint32_t                             BlockResolutionX;
   5111    uint32_t                             BlockResolutionY;
   5112    uint32_t                             LocalStartX;
   5113    uint32_t                             LocalStartY;
   5114    uint32_t                             LocalEndX;
   5115    uint32_t                             LocalEndY;
   5116    int32_t                              LocalOuterLoopStrideX;
   5117    int32_t                              LocalOuterLoopStrideY;
   5118    int32_t                              LocalInnerLoopUnitX;
   5119    int32_t                              LocalInnerLoopUnitY;
   5120    uint32_t                             GlobalResolutionX;
   5121    uint32_t                             GlobalResolutionY;
   5122    int32_t                              GlobalStartX;
   5123    int32_t                              GlobalStartY;
   5124    int32_t                              GlobalOuterLoopStrideX;
   5125    int32_t                              GlobalOuterLoopStrideY;
   5126    int32_t                              GlobalInnerLoopUnitX;
   5127    int32_t                              GlobalInnerLoopUnitY;
   5128    /* variable length fields follow */
   5129 };
   5130 
   5131 static inline void
   5132 GEN7_MEDIA_OBJECT_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
   5133                               __attribute__((unused)) void * restrict dst,
   5134                               __attribute__((unused)) const struct GEN7_MEDIA_OBJECT_WALKER * restrict values)
   5135 {
   5136    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5137 
   5138    dw[0] =
   5139       __gen_uint(values->DWordLength, 0, 15) |
   5140       __gen_uint(values->SubOpcode, 16, 23) |
   5141       __gen_uint(values->MediaCommandOpcode, 24, 26) |
   5142       __gen_uint(values->Pipeline, 27, 28) |
   5143       __gen_uint(values->CommandType, 29, 31);
   5144 
   5145    dw[1] =
   5146       __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
   5147 
   5148    dw[2] =
   5149       __gen_uint(values->IndirectDataLength, 0, 16) |
   5150       __gen_uint(values->UseScoreboard, 21, 21) |
   5151       __gen_uint(values->ThreadSynchronization, 24, 24) |
   5152       __gen_uint(values->ChildrenPresent, 31, 31);
   5153 
   5154    dw[3] =
   5155       __gen_offset(values->IndirectDataStartAddress, 0, 31);
   5156 
   5157    dw[4] = 0;
   5158 
   5159    dw[5] =
   5160       __gen_uint(values->ScoreboardMask, 0, 7);
   5161 
   5162    dw[6] =
   5163       __gen_sint(values->MidLoopUnitX, 8, 9) |
   5164       __gen_sint(values->LocalMidLoopUnitY, 12, 13) |
   5165       __gen_uint(values->MiddleLoopExtraSteps, 16, 20) |
   5166       __gen_uint(values->ColorCountMinusOne, 24, 27) |
   5167       __gen_uint(values->Repel, 30, 30) |
   5168       __gen_uint(values->DualMode, 31, 31);
   5169 
   5170    dw[7] =
   5171       __gen_uint(values->LocalLoopExecCount, 0, 9) |
   5172       __gen_uint(values->GlobalLoopExecCount, 16, 25);
   5173 
   5174    dw[8] =
   5175       __gen_uint(values->BlockResolutionX, 0, 8) |
   5176       __gen_uint(values->BlockResolutionY, 16, 24);
   5177 
   5178    dw[9] =
   5179       __gen_uint(values->LocalStartX, 0, 8) |
   5180       __gen_uint(values->LocalStartY, 16, 24);
   5181 
   5182    dw[10] =
   5183       __gen_uint(values->LocalEndX, 0, 8) |
   5184       __gen_uint(values->LocalEndY, 16, 24);
   5185 
   5186    dw[11] =
   5187       __gen_sint(values->LocalOuterLoopStrideX, 0, 9) |
   5188       __gen_sint(values->LocalOuterLoopStrideY, 16, 25);
   5189 
   5190    dw[12] =
   5191       __gen_sint(values->LocalInnerLoopUnitX, 0, 9) |
   5192       __gen_sint(values->LocalInnerLoopUnitY, 16, 25);
   5193 
   5194    dw[13] =
   5195       __gen_uint(values->GlobalResolutionX, 0, 8) |
   5196       __gen_uint(values->GlobalResolutionY, 16, 24);
   5197 
   5198    dw[14] =
   5199       __gen_sint(values->GlobalStartX, 0, 9) |
   5200       __gen_sint(values->GlobalStartY, 16, 25);
   5201 
   5202    dw[15] =
   5203       __gen_sint(values->GlobalOuterLoopStrideX, 0, 9) |
   5204       __gen_sint(values->GlobalOuterLoopStrideY, 16, 25);
   5205 
   5206    dw[16] =
   5207       __gen_sint(values->GlobalInnerLoopUnitX, 0, 9) |
   5208       __gen_sint(values->GlobalInnerLoopUnitY, 16, 25);
   5209 }
   5210 
   5211 #define GEN7_MEDIA_STATE_FLUSH_length          2
   5212 #define GEN7_MEDIA_STATE_FLUSH_length_bias      2
   5213 #define GEN7_MEDIA_STATE_FLUSH_header           \
   5214    .DWordLength                         =      0,  \
   5215    .SubOpcode                           =      4,  \
   5216    .MediaCommandOpcode                  =      0,  \
   5217    .Pipeline                            =      2,  \
   5218    .CommandType                         =      3
   5219 
   5220 struct GEN7_MEDIA_STATE_FLUSH {
   5221    uint32_t                             DWordLength;
   5222    uint32_t                             SubOpcode;
   5223    uint32_t                             MediaCommandOpcode;
   5224    uint32_t                             Pipeline;
   5225    uint32_t                             CommandType;
   5226    uint32_t                             InterfaceDescriptorOffset;
   5227    uint32_t                             WatermarkRequired;
   5228 };
   5229 
   5230 static inline void
   5231 GEN7_MEDIA_STATE_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
   5232                             __attribute__((unused)) void * restrict dst,
   5233                             __attribute__((unused)) const struct GEN7_MEDIA_STATE_FLUSH * restrict values)
   5234 {
   5235    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5236 
   5237    dw[0] =
   5238       __gen_uint(values->DWordLength, 0, 15) |
   5239       __gen_uint(values->SubOpcode, 16, 23) |
   5240       __gen_uint(values->MediaCommandOpcode, 24, 26) |
   5241       __gen_uint(values->Pipeline, 27, 28) |
   5242       __gen_uint(values->CommandType, 29, 31);
   5243 
   5244    dw[1] =
   5245       __gen_uint(values->InterfaceDescriptorOffset, 0, 5) |
   5246       __gen_uint(values->WatermarkRequired, 6, 6);
   5247 }
   5248 
   5249 #define GEN7_MEDIA_VFE_STATE_length            8
   5250 #define GEN7_MEDIA_VFE_STATE_length_bias       2
   5251 #define GEN7_MEDIA_VFE_STATE_header             \
   5252    .DWordLength                         =      6,  \
   5253    .SubOpcode                           =      0,  \
   5254    .MediaCommandOpcode                  =      0,  \
   5255    .Pipeline                            =      2,  \
   5256    .CommandType                         =      3
   5257 
   5258 struct GEN7_MEDIA_VFE_STATE {
   5259    uint32_t                             DWordLength;
   5260    uint32_t                             SubOpcode;
   5261    uint32_t                             MediaCommandOpcode;
   5262    uint32_t                             Pipeline;
   5263    uint32_t                             CommandType;
   5264    uint32_t                             PerThreadScratchSpace;
   5265    __gen_address_type                   ScratchSpaceBasePointer;
   5266    uint32_t                             GPGPUMode;
   5267    uint32_t                             GatewayMMIOAccessControl;
   5268 #define NoMMIOreadwriteallowed                   0
   5269 #define MMIOreadwritetoanyaddress                2
   5270    uint32_t                             BypassGatewayControl;
   5271 #define MaintainingOpenGatewayForwardMsgCloseGatewayprotocollegacymode 0
   5272 #define BypassingOpenGatewayCloseGatewayprotocol 1
   5273    uint32_t                             ResetGatewayTimer;
   5274 #define Maintainingtheexistingtimestampstate     0
   5275 #define Resettingrelativetimerandlatchingtheglobaltimestamp 1
   5276    uint32_t                             NumberofURBEntries;
   5277    uint32_t                             MaximumNumberofThreads;
   5278    uint32_t                             CURBEAllocationSize;
   5279    uint32_t                             URBEntryAllocationSize;
   5280    uint32_t                             ScoreboardMask;
   5281    uint32_t                             ScoreboardType;
   5282 #define StallingScoreboard                       0
   5283 #define NonStallingScoreboard                    1
   5284    uint32_t                             ScoreboardEnable;
   5285 #define Scoreboarddisabled                       0
   5286 #define Scoreboardenabled                        1
   5287    int32_t                              Scoreboard0DeltaX;
   5288    int32_t                              Scoreboard0DeltaY;
   5289    int32_t                              Scoreboard1DeltaX;
   5290    int32_t                              Scoreboard1DeltaY;
   5291    int32_t                              Scoreboard2DeltaX;
   5292    int32_t                              Scoreboard2DeltaY;
   5293    int32_t                              Scoreboard3DeltaX;
   5294    int32_t                              Scoreboard3DeltaY;
   5295    int32_t                              Scoreboard4DeltaX;
   5296    int32_t                              Scoreboard4DeltaY;
   5297    int32_t                              Scoreboard5DeltaX;
   5298    int32_t                              Scoreboard5DeltaY;
   5299    int32_t                              Scoreboard6DeltaX;
   5300    int32_t                              Scoreboard6DeltaY;
   5301    int32_t                              Scoreboard7DeltaX;
   5302    int32_t                              Scoreboard7DeltaY;
   5303 };
   5304 
   5305 static inline void
   5306 GEN7_MEDIA_VFE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
   5307                           __attribute__((unused)) void * restrict dst,
   5308                           __attribute__((unused)) const struct GEN7_MEDIA_VFE_STATE * restrict values)
   5309 {
   5310    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5311 
   5312    dw[0] =
   5313       __gen_uint(values->DWordLength, 0, 15) |
   5314       __gen_uint(values->SubOpcode, 16, 23) |
   5315       __gen_uint(values->MediaCommandOpcode, 24, 26) |
   5316       __gen_uint(values->Pipeline, 27, 28) |
   5317       __gen_uint(values->CommandType, 29, 31);
   5318 
   5319    const uint32_t v1 =
   5320       __gen_uint(values->PerThreadScratchSpace, 0, 3);
   5321    dw[1] = __gen_combine_address(data, &dw[1], values->ScratchSpaceBasePointer, v1);
   5322 
   5323    dw[2] =
   5324       __gen_uint(values->GPGPUMode, 2, 2) |
   5325       __gen_uint(values->GatewayMMIOAccessControl, 3, 4) |
   5326       __gen_uint(values->BypassGatewayControl, 6, 6) |
   5327       __gen_uint(values->ResetGatewayTimer, 7, 7) |
   5328       __gen_uint(values->NumberofURBEntries, 8, 15) |
   5329       __gen_uint(values->MaximumNumberofThreads, 16, 31);
   5330 
   5331    dw[3] = 0;
   5332 
   5333    dw[4] =
   5334       __gen_uint(values->CURBEAllocationSize, 0, 15) |
   5335       __gen_uint(values->URBEntryAllocationSize, 16, 31);
   5336 
   5337    dw[5] =
   5338       __gen_uint(values->ScoreboardMask, 0, 7) |
   5339       __gen_uint(values->ScoreboardType, 30, 30) |
   5340       __gen_uint(values->ScoreboardEnable, 31, 31);
   5341 
   5342    dw[6] =
   5343       __gen_sint(values->Scoreboard0DeltaX, 0, 3) |
   5344       __gen_sint(values->Scoreboard0DeltaY, 4, 7) |
   5345       __gen_sint(values->Scoreboard1DeltaX, 8, 11) |
   5346       __gen_sint(values->Scoreboard1DeltaY, 12, 15) |
   5347       __gen_sint(values->Scoreboard2DeltaX, 16, 19) |
   5348       __gen_sint(values->Scoreboard2DeltaY, 20, 23) |
   5349       __gen_sint(values->Scoreboard3DeltaX, 24, 27) |
   5350       __gen_sint(values->Scoreboard3DeltaY, 28, 31);
   5351 
   5352    dw[7] =
   5353       __gen_sint(values->Scoreboard4DeltaX, 0, 3) |
   5354       __gen_sint(values->Scoreboard4DeltaY, 4, 7) |
   5355       __gen_sint(values->Scoreboard5DeltaX, 8, 11) |
   5356       __gen_sint(values->Scoreboard5DeltaY, 12, 15) |
   5357       __gen_sint(values->Scoreboard6DeltaX, 16, 19) |
   5358       __gen_sint(values->Scoreboard6DeltaY, 20, 23) |
   5359       __gen_sint(values->Scoreboard7DeltaX, 24, 27) |
   5360       __gen_sint(values->Scoreboard7DeltaY, 28, 31);
   5361 }
   5362 
   5363 #define GEN7_MI_ARB_CHECK_length               1
   5364 #define GEN7_MI_ARB_CHECK_length_bias          1
   5365 #define GEN7_MI_ARB_CHECK_header                \
   5366    .MICommandOpcode                     =      5,  \
   5367    .CommandType                         =      0
   5368 
   5369 struct GEN7_MI_ARB_CHECK {
   5370    uint32_t                             MICommandOpcode;
   5371    uint32_t                             CommandType;
   5372 };
   5373 
   5374 static inline void
   5375 GEN7_MI_ARB_CHECK_pack(__attribute__((unused)) __gen_user_data *data,
   5376                        __attribute__((unused)) void * restrict dst,
   5377                        __attribute__((unused)) const struct GEN7_MI_ARB_CHECK * restrict values)
   5378 {
   5379    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5380 
   5381    dw[0] =
   5382       __gen_uint(values->MICommandOpcode, 23, 28) |
   5383       __gen_uint(values->CommandType, 29, 31);
   5384 }
   5385 
   5386 #define GEN7_MI_ARB_ON_OFF_length              1
   5387 #define GEN7_MI_ARB_ON_OFF_length_bias         1
   5388 #define GEN7_MI_ARB_ON_OFF_header               \
   5389    .MICommandOpcode                     =      8,  \
   5390    .CommandType                         =      0
   5391 
   5392 struct GEN7_MI_ARB_ON_OFF {
   5393    bool                                 ArbitrationEnable;
   5394    uint32_t                             MICommandOpcode;
   5395    uint32_t                             CommandType;
   5396 };
   5397 
   5398 static inline void
   5399 GEN7_MI_ARB_ON_OFF_pack(__attribute__((unused)) __gen_user_data *data,
   5400                         __attribute__((unused)) void * restrict dst,
   5401                         __attribute__((unused)) const struct GEN7_MI_ARB_ON_OFF * restrict values)
   5402 {
   5403    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5404 
   5405    dw[0] =
   5406       __gen_uint(values->ArbitrationEnable, 0, 0) |
   5407       __gen_uint(values->MICommandOpcode, 23, 28) |
   5408       __gen_uint(values->CommandType, 29, 31);
   5409 }
   5410 
   5411 #define GEN7_MI_BATCH_BUFFER_END_length        1
   5412 #define GEN7_MI_BATCH_BUFFER_END_length_bias      1
   5413 #define GEN7_MI_BATCH_BUFFER_END_header         \
   5414    .MICommandOpcode                     =     10,  \
   5415    .CommandType                         =      0
   5416 
   5417 struct GEN7_MI_BATCH_BUFFER_END {
   5418    uint32_t                             MICommandOpcode;
   5419    uint32_t                             CommandType;
   5420 };
   5421 
   5422 static inline void
   5423 GEN7_MI_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
   5424                               __attribute__((unused)) void * restrict dst,
   5425                               __attribute__((unused)) const struct GEN7_MI_BATCH_BUFFER_END * restrict values)
   5426 {
   5427    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5428 
   5429    dw[0] =
   5430       __gen_uint(values->MICommandOpcode, 23, 28) |
   5431       __gen_uint(values->CommandType, 29, 31);
   5432 }
   5433 
   5434 #define GEN7_MI_BATCH_BUFFER_START_length      2
   5435 #define GEN7_MI_BATCH_BUFFER_START_length_bias      2
   5436 #define GEN7_MI_BATCH_BUFFER_START_header       \
   5437    .DWordLength                         =      0,  \
   5438    .MICommandOpcode                     =     49,  \
   5439    .CommandType                         =      0
   5440 
   5441 struct GEN7_MI_BATCH_BUFFER_START {
   5442    uint32_t                             DWordLength;
   5443    uint32_t                             AddressSpaceIndicator;
   5444 #define ASI_GGTT                                 0
   5445 #define ASI_PPGTT                                1
   5446    bool                                 ClearCommandBufferEnable;
   5447    uint32_t                             MICommandOpcode;
   5448    uint32_t                             CommandType;
   5449    __gen_address_type                   BatchBufferStartAddress;
   5450 };
   5451 
   5452 static inline void
   5453 GEN7_MI_BATCH_BUFFER_START_pack(__attribute__((unused)) __gen_user_data *data,
   5454                                 __attribute__((unused)) void * restrict dst,
   5455                                 __attribute__((unused)) const struct GEN7_MI_BATCH_BUFFER_START * restrict values)
   5456 {
   5457    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5458 
   5459    dw[0] =
   5460       __gen_uint(values->DWordLength, 0, 7) |
   5461       __gen_uint(values->AddressSpaceIndicator, 8, 8) |
   5462       __gen_uint(values->ClearCommandBufferEnable, 11, 11) |
   5463       __gen_uint(values->MICommandOpcode, 23, 28) |
   5464       __gen_uint(values->CommandType, 29, 31);
   5465 
   5466    dw[1] = __gen_combine_address(data, &dw[1], values->BatchBufferStartAddress, 0);
   5467 }
   5468 
   5469 #define GEN7_MI_CLFLUSH_length_bias            2
   5470 #define GEN7_MI_CLFLUSH_header                  \
   5471    .DWordLength                         =      1,  \
   5472    .MICommandOpcode                     =     39,  \
   5473    .CommandType                         =      0
   5474 
   5475 struct GEN7_MI_CLFLUSH {
   5476    uint32_t                             DWordLength;
   5477    bool                                 UseGlobalGTT;
   5478    uint32_t                             MICommandOpcode;
   5479    uint32_t                             CommandType;
   5480    uint32_t                             StartingCachelineOffset;
   5481    __gen_address_type                   PageBaseAddress;
   5482    __gen_address_type                   PageBaseAddressHigh;
   5483    /* variable length fields follow */
   5484 };
   5485 
   5486 static inline void
   5487 GEN7_MI_CLFLUSH_pack(__attribute__((unused)) __gen_user_data *data,
   5488                      __attribute__((unused)) void * restrict dst,
   5489                      __attribute__((unused)) const struct GEN7_MI_CLFLUSH * restrict values)
   5490 {
   5491    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5492 
   5493    dw[0] =
   5494       __gen_uint(values->DWordLength, 0, 9) |
   5495       __gen_uint(values->UseGlobalGTT, 22, 22) |
   5496       __gen_uint(values->MICommandOpcode, 23, 28) |
   5497       __gen_uint(values->CommandType, 29, 31);
   5498 
   5499    const uint32_t v1 =
   5500       __gen_uint(values->StartingCachelineOffset, 6, 11);
   5501    dw[1] = __gen_combine_address(data, &dw[1], values->PageBaseAddress, v1);
   5502 
   5503    dw[2] = __gen_combine_address(data, &dw[2], values->PageBaseAddressHigh, 0);
   5504 }
   5505 
   5506 #define GEN7_MI_CONDITIONAL_BATCH_BUFFER_END_length      2
   5507 #define GEN7_MI_CONDITIONAL_BATCH_BUFFER_END_length_bias      2
   5508 #define GEN7_MI_CONDITIONAL_BATCH_BUFFER_END_header\
   5509    .DWordLength                         =      0,  \
   5510    .CompareSemaphore                    =      0,  \
   5511    .MICommandOpcode                     =     54,  \
   5512    .CommandType                         =      0
   5513 
   5514 struct GEN7_MI_CONDITIONAL_BATCH_BUFFER_END {
   5515    uint32_t                             DWordLength;
   5516    uint32_t                             CompareSemaphore;
   5517    bool                                 UseGlobalGTT;
   5518    uint32_t                             MICommandOpcode;
   5519    uint32_t                             CommandType;
   5520    uint32_t                             CompareDataDword;
   5521    __gen_address_type                   CompareAddress;
   5522 };
   5523 
   5524 static inline void
   5525 GEN7_MI_CONDITIONAL_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
   5526                                           __attribute__((unused)) void * restrict dst,
   5527                                           __attribute__((unused)) const struct GEN7_MI_CONDITIONAL_BATCH_BUFFER_END * restrict values)
   5528 {
   5529    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5530 
   5531    dw[0] =
   5532       __gen_uint(values->DWordLength, 0, 7) |
   5533       __gen_uint(values->CompareSemaphore, 21, 21) |
   5534       __gen_uint(values->UseGlobalGTT, 22, 22) |
   5535       __gen_uint(values->MICommandOpcode, 23, 28) |
   5536       __gen_uint(values->CommandType, 29, 31);
   5537 
   5538    dw[1] =
   5539       __gen_uint(values->CompareDataDword, 0, 31);
   5540 }
   5541 
   5542 #define GEN7_MI_FLUSH_length                   1
   5543 #define GEN7_MI_FLUSH_length_bias              1
   5544 #define GEN7_MI_FLUSH_header                    \
   5545    .MICommandOpcode                     =      4,  \
   5546    .CommandType                         =      0
   5547 
   5548 struct GEN7_MI_FLUSH {
   5549    uint32_t                             StateInstructionCacheInvalidate;
   5550 #define DontInvalidate                           0
   5551 #define Invalidate                               1
   5552    uint32_t                             RenderCacheFlushInhibit;
   5553 #define Flush                                    0
   5554 #define DontFlush                                1
   5555    uint32_t                             GlobalSnapshotCountReset;
   5556 #define DontReset                                0
   5557 #define Reset                                    1
   5558    bool                                 GenericMediaStateClear;
   5559    bool                                 IndirectStatePointersDisable;
   5560    uint32_t                             MICommandOpcode;
   5561    uint32_t                             CommandType;
   5562 };
   5563 
   5564 static inline void
   5565 GEN7_MI_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
   5566                    __attribute__((unused)) void * restrict dst,
   5567                    __attribute__((unused)) const struct GEN7_MI_FLUSH * restrict values)
   5568 {
   5569    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5570 
   5571    dw[0] =
   5572       __gen_uint(values->StateInstructionCacheInvalidate, 1, 1) |
   5573       __gen_uint(values->RenderCacheFlushInhibit, 2, 2) |
   5574       __gen_uint(values->GlobalSnapshotCountReset, 3, 3) |
   5575       __gen_uint(values->GenericMediaStateClear, 4, 4) |
   5576       __gen_uint(values->IndirectStatePointersDisable, 5, 5) |
   5577       __gen_uint(values->MICommandOpcode, 23, 28) |
   5578       __gen_uint(values->CommandType, 29, 31);
   5579 }
   5580 
   5581 #define GEN7_MI_LOAD_REGISTER_IMM_length       3
   5582 #define GEN7_MI_LOAD_REGISTER_IMM_length_bias      2
   5583 #define GEN7_MI_LOAD_REGISTER_IMM_header        \
   5584    .DWordLength                         =      1,  \
   5585    .MICommandOpcode                     =     34,  \
   5586    .CommandType                         =      0
   5587 
   5588 struct GEN7_MI_LOAD_REGISTER_IMM {
   5589    uint32_t                             DWordLength;
   5590    uint32_t                             ByteWriteDisables;
   5591    uint32_t                             MICommandOpcode;
   5592    uint32_t                             CommandType;
   5593    uint64_t                             RegisterOffset;
   5594    uint32_t                             DataDWord;
   5595    /* variable length fields follow */
   5596 };
   5597 
   5598 static inline void
   5599 GEN7_MI_LOAD_REGISTER_IMM_pack(__attribute__((unused)) __gen_user_data *data,
   5600                                __attribute__((unused)) void * restrict dst,
   5601                                __attribute__((unused)) const struct GEN7_MI_LOAD_REGISTER_IMM * restrict values)
   5602 {
   5603    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5604 
   5605    dw[0] =
   5606       __gen_uint(values->DWordLength, 0, 7) |
   5607       __gen_uint(values->ByteWriteDisables, 8, 11) |
   5608       __gen_uint(values->MICommandOpcode, 23, 28) |
   5609       __gen_uint(values->CommandType, 29, 31);
   5610 
   5611    dw[1] =
   5612       __gen_offset(values->RegisterOffset, 2, 22);
   5613 
   5614    dw[2] =
   5615       __gen_uint(values->DataDWord, 0, 31);
   5616 }
   5617 
   5618 #define GEN7_MI_LOAD_REGISTER_MEM_length       3
   5619 #define GEN7_MI_LOAD_REGISTER_MEM_length_bias      2
   5620 #define GEN7_MI_LOAD_REGISTER_MEM_header        \
   5621    .DWordLength                         =      1,  \
   5622    .MICommandOpcode                     =     41,  \
   5623    .CommandType                         =      0
   5624 
   5625 struct GEN7_MI_LOAD_REGISTER_MEM {
   5626    uint32_t                             DWordLength;
   5627    bool                                 AsyncModeEnable;
   5628    bool                                 UseGlobalGTT;
   5629    uint32_t                             MICommandOpcode;
   5630    uint32_t                             CommandType;
   5631    uint64_t                             RegisterAddress;
   5632    __gen_address_type                   MemoryAddress;
   5633 };
   5634 
   5635 static inline void
   5636 GEN7_MI_LOAD_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
   5637                                __attribute__((unused)) void * restrict dst,
   5638                                __attribute__((unused)) const struct GEN7_MI_LOAD_REGISTER_MEM * restrict values)
   5639 {
   5640    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5641 
   5642    dw[0] =
   5643       __gen_uint(values->DWordLength, 0, 7) |
   5644       __gen_uint(values->AsyncModeEnable, 21, 21) |
   5645       __gen_uint(values->UseGlobalGTT, 22, 22) |
   5646       __gen_uint(values->MICommandOpcode, 23, 28) |
   5647       __gen_uint(values->CommandType, 29, 31);
   5648 
   5649    dw[1] =
   5650       __gen_offset(values->RegisterAddress, 2, 22);
   5651 
   5652    dw[2] = __gen_combine_address(data, &dw[2], values->MemoryAddress, 0);
   5653 }
   5654 
   5655 #define GEN7_MI_NOOP_length                    1
   5656 #define GEN7_MI_NOOP_length_bias               1
   5657 #define GEN7_MI_NOOP_header                     \
   5658    .MICommandOpcode                     =      0,  \
   5659    .CommandType                         =      0
   5660 
   5661 struct GEN7_MI_NOOP {
   5662    uint32_t                             IdentificationNumber;
   5663    bool                                 IdentificationNumberRegisterWriteEnable;
   5664    uint32_t                             MICommandOpcode;
   5665    uint32_t                             CommandType;
   5666 };
   5667 
   5668 static inline void
   5669 GEN7_MI_NOOP_pack(__attribute__((unused)) __gen_user_data *data,
   5670                   __attribute__((unused)) void * restrict dst,
   5671                   __attribute__((unused)) const struct GEN7_MI_NOOP * restrict values)
   5672 {
   5673    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5674 
   5675    dw[0] =
   5676       __gen_uint(values->IdentificationNumber, 0, 21) |
   5677       __gen_uint(values->IdentificationNumberRegisterWriteEnable, 22, 22) |
   5678       __gen_uint(values->MICommandOpcode, 23, 28) |
   5679       __gen_uint(values->CommandType, 29, 31);
   5680 }
   5681 
   5682 #define GEN7_MI_PREDICATE_length               1
   5683 #define GEN7_MI_PREDICATE_length_bias          1
   5684 #define GEN7_MI_PREDICATE_header                \
   5685    .MICommandOpcode                     =     12,  \
   5686    .CommandType                         =      0
   5687 
   5688 struct GEN7_MI_PREDICATE {
   5689    uint32_t                             CompareOperation;
   5690 #define COMPARE_TRUE                             0
   5691 #define COMPARE_FALSE                            1
   5692 #define COMPARE_SRCS_EQUAL                       2
   5693 #define COMPARE_DELTAS_EQUAL                     3
   5694    uint32_t                             CombineOperation;
   5695 #define COMBINE_SET                              0
   5696 #define COMBINE_AND                              1
   5697 #define COMBINE_OR                               2
   5698 #define COMBINE_XOR                              3
   5699    uint32_t                             LoadOperation;
   5700 #define LOAD_KEEP                                0
   5701 #define LOAD_LOAD                                2
   5702 #define LOAD_LOADINV                             3
   5703    uint32_t                             MICommandOpcode;
   5704    uint32_t                             CommandType;
   5705 };
   5706 
   5707 static inline void
   5708 GEN7_MI_PREDICATE_pack(__attribute__((unused)) __gen_user_data *data,
   5709                        __attribute__((unused)) void * restrict dst,
   5710                        __attribute__((unused)) const struct GEN7_MI_PREDICATE * restrict values)
   5711 {
   5712    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5713 
   5714    dw[0] =
   5715       __gen_uint(values->CompareOperation, 0, 1) |
   5716       __gen_uint(values->CombineOperation, 3, 4) |
   5717       __gen_uint(values->LoadOperation, 6, 7) |
   5718       __gen_uint(values->MICommandOpcode, 23, 28) |
   5719       __gen_uint(values->CommandType, 29, 31);
   5720 }
   5721 
   5722 #define GEN7_MI_REPORT_HEAD_length             1
   5723 #define GEN7_MI_REPORT_HEAD_length_bias        1
   5724 #define GEN7_MI_REPORT_HEAD_header              \
   5725    .MICommandOpcode                     =      7,  \
   5726    .CommandType                         =      0
   5727 
   5728 struct GEN7_MI_REPORT_HEAD {
   5729    uint32_t                             MICommandOpcode;
   5730    uint32_t                             CommandType;
   5731 };
   5732 
   5733 static inline void
   5734 GEN7_MI_REPORT_HEAD_pack(__attribute__((unused)) __gen_user_data *data,
   5735                          __attribute__((unused)) void * restrict dst,
   5736                          __attribute__((unused)) const struct GEN7_MI_REPORT_HEAD * restrict values)
   5737 {
   5738    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5739 
   5740    dw[0] =
   5741       __gen_uint(values->MICommandOpcode, 23, 28) |
   5742       __gen_uint(values->CommandType, 29, 31);
   5743 }
   5744 
   5745 #define GEN7_MI_REPORT_PERF_COUNT_length       3
   5746 #define GEN7_MI_REPORT_PERF_COUNT_length_bias      2
   5747 #define GEN7_MI_REPORT_PERF_COUNT_header        \
   5748    .DWordLength                         =      1,  \
   5749    .MICommandOpcode                     =     40,  \
   5750    .CommandType                         =      0
   5751 
   5752 struct GEN7_MI_REPORT_PERF_COUNT {
   5753    uint32_t                             DWordLength;
   5754    uint32_t                             MICommandOpcode;
   5755    uint32_t                             CommandType;
   5756    bool                                 UseGlobalGTT;
   5757    __gen_address_type                   MemoryAddress;
   5758    uint32_t                             ReportID;
   5759 };
   5760 
   5761 static inline void
   5762 GEN7_MI_REPORT_PERF_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
   5763                                __attribute__((unused)) void * restrict dst,
   5764                                __attribute__((unused)) const struct GEN7_MI_REPORT_PERF_COUNT * restrict values)
   5765 {
   5766    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5767 
   5768    dw[0] =
   5769       __gen_uint(values->DWordLength, 0, 5) |
   5770       __gen_uint(values->MICommandOpcode, 23, 28) |
   5771       __gen_uint(values->CommandType, 29, 31);
   5772 
   5773    const uint32_t v1 =
   5774       __gen_uint(values->UseGlobalGTT, 0, 0);
   5775    dw[1] = __gen_combine_address(data, &dw[1], values->MemoryAddress, v1);
   5776 
   5777    dw[2] =
   5778       __gen_uint(values->ReportID, 0, 31);
   5779 }
   5780 
   5781 #define GEN7_MI_SEMAPHORE_MBOX_length          3
   5782 #define GEN7_MI_SEMAPHORE_MBOX_length_bias      2
   5783 #define GEN7_MI_SEMAPHORE_MBOX_header           \
   5784    .DWordLength                         =      1,  \
   5785    .MICommandOpcode                     =     22,  \
   5786    .CommandType                         =      0
   5787 
   5788 struct GEN7_MI_SEMAPHORE_MBOX {
   5789    uint32_t                             DWordLength;
   5790    uint32_t                             RegisterSelect;
   5791 #define RVSYNC                                   0
   5792 #define RBSYNC                                   2
   5793 #define UseGeneralRegisterSelect                 3
   5794    uint32_t                             MICommandOpcode;
   5795    uint32_t                             CommandType;
   5796    uint32_t                             SemaphoreDataDword;
   5797 };
   5798 
   5799 static inline void
   5800 GEN7_MI_SEMAPHORE_MBOX_pack(__attribute__((unused)) __gen_user_data *data,
   5801                             __attribute__((unused)) void * restrict dst,
   5802                             __attribute__((unused)) const struct GEN7_MI_SEMAPHORE_MBOX * restrict values)
   5803 {
   5804    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5805 
   5806    dw[0] =
   5807       __gen_uint(values->DWordLength, 0, 7) |
   5808       __gen_uint(values->RegisterSelect, 16, 17) |
   5809       __gen_uint(values->MICommandOpcode, 23, 28) |
   5810       __gen_uint(values->CommandType, 29, 31);
   5811 
   5812    dw[1] =
   5813       __gen_uint(values->SemaphoreDataDword, 0, 31);
   5814 
   5815    dw[2] = 0;
   5816 }
   5817 
   5818 #define GEN7_MI_SET_CONTEXT_length             2
   5819 #define GEN7_MI_SET_CONTEXT_length_bias        2
   5820 #define GEN7_MI_SET_CONTEXT_header              \
   5821    .DWordLength                         =      0,  \
   5822    .MICommandOpcode                     =     24,  \
   5823    .CommandType                         =      0
   5824 
   5825 struct GEN7_MI_SET_CONTEXT {
   5826    uint32_t                             DWordLength;
   5827    uint32_t                             MICommandOpcode;
   5828    uint32_t                             CommandType;
   5829    uint32_t                             RestoreInhibit;
   5830    uint32_t                             ForceRestore;
   5831    bool                                 ExtendedStateRestoreEnable;
   5832    bool                                 ExtendedStateSaveEnable;
   5833    uint32_t                             ReservedMustbe1;
   5834    __gen_address_type                   LogicalContextAddress;
   5835 };
   5836 
   5837 static inline void
   5838 GEN7_MI_SET_CONTEXT_pack(__attribute__((unused)) __gen_user_data *data,
   5839                          __attribute__((unused)) void * restrict dst,
   5840                          __attribute__((unused)) const struct GEN7_MI_SET_CONTEXT * restrict values)
   5841 {
   5842    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5843 
   5844    dw[0] =
   5845       __gen_uint(values->DWordLength, 0, 7) |
   5846       __gen_uint(values->MICommandOpcode, 23, 28) |
   5847       __gen_uint(values->CommandType, 29, 31);
   5848 
   5849    const uint32_t v1 =
   5850       __gen_uint(values->RestoreInhibit, 0, 0) |
   5851       __gen_uint(values->ForceRestore, 1, 1) |
   5852       __gen_uint(values->ExtendedStateRestoreEnable, 2, 2) |
   5853       __gen_uint(values->ExtendedStateSaveEnable, 3, 3) |
   5854       __gen_uint(values->ReservedMustbe1, 8, 8);
   5855    dw[1] = __gen_combine_address(data, &dw[1], values->LogicalContextAddress, v1);
   5856 }
   5857 
   5858 #define GEN7_MI_STORE_DATA_IMM_length          4
   5859 #define GEN7_MI_STORE_DATA_IMM_length_bias      2
   5860 #define GEN7_MI_STORE_DATA_IMM_header           \
   5861    .DWordLength                         =      2,  \
   5862    .MICommandOpcode                     =     32,  \
   5863    .CommandType                         =      0
   5864 
   5865 struct GEN7_MI_STORE_DATA_IMM {
   5866    uint32_t                             DWordLength;
   5867    bool                                 UseGlobalGTT;
   5868    uint32_t                             MICommandOpcode;
   5869    uint32_t                             CommandType;
   5870    uint32_t                             CoreModeEnable;
   5871    __gen_address_type                   Address;
   5872    uint64_t                             ImmediateData;
   5873 };
   5874 
   5875 static inline void
   5876 GEN7_MI_STORE_DATA_IMM_pack(__attribute__((unused)) __gen_user_data *data,
   5877                             __attribute__((unused)) void * restrict dst,
   5878                             __attribute__((unused)) const struct GEN7_MI_STORE_DATA_IMM * restrict values)
   5879 {
   5880    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5881 
   5882    dw[0] =
   5883       __gen_uint(values->DWordLength, 0, 5) |
   5884       __gen_uint(values->UseGlobalGTT, 22, 22) |
   5885       __gen_uint(values->MICommandOpcode, 23, 28) |
   5886       __gen_uint(values->CommandType, 29, 31);
   5887 
   5888    dw[1] = 0;
   5889 
   5890    const uint32_t v2 =
   5891       __gen_uint(values->CoreModeEnable, 0, 0);
   5892    dw[2] = __gen_combine_address(data, &dw[2], values->Address, v2);
   5893 
   5894    const uint64_t v3 =
   5895       __gen_uint(values->ImmediateData, 0, 63);
   5896    dw[3] = v3;
   5897    dw[4] = v3 >> 32;
   5898 }
   5899 
   5900 #define GEN7_MI_STORE_DATA_INDEX_length        3
   5901 #define GEN7_MI_STORE_DATA_INDEX_length_bias      2
   5902 #define GEN7_MI_STORE_DATA_INDEX_header         \
   5903    .DWordLength                         =      1,  \
   5904    .MICommandOpcode                     =     33,  \
   5905    .CommandType                         =      0
   5906 
   5907 struct GEN7_MI_STORE_DATA_INDEX {
   5908    uint32_t                             DWordLength;
   5909    uint32_t                             MICommandOpcode;
   5910    uint32_t                             CommandType;
   5911    uint32_t                             Offset;
   5912    uint32_t                             DataDWord0;
   5913    uint32_t                             DataDWord1;
   5914 };
   5915 
   5916 static inline void
   5917 GEN7_MI_STORE_DATA_INDEX_pack(__attribute__((unused)) __gen_user_data *data,
   5918                               __attribute__((unused)) void * restrict dst,
   5919                               __attribute__((unused)) const struct GEN7_MI_STORE_DATA_INDEX * restrict values)
   5920 {
   5921    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5922 
   5923    dw[0] =
   5924       __gen_uint(values->DWordLength, 0, 7) |
   5925       __gen_uint(values->MICommandOpcode, 23, 28) |
   5926       __gen_uint(values->CommandType, 29, 31);
   5927 
   5928    dw[1] =
   5929       __gen_uint(values->Offset, 2, 11);
   5930 
   5931    dw[2] =
   5932       __gen_uint(values->DataDWord0, 0, 31);
   5933 }
   5934 
   5935 #define GEN7_MI_STORE_REGISTER_MEM_length      3
   5936 #define GEN7_MI_STORE_REGISTER_MEM_length_bias      2
   5937 #define GEN7_MI_STORE_REGISTER_MEM_header       \
   5938    .DWordLength                         =      1,  \
   5939    .MICommandOpcode                     =     36,  \
   5940    .CommandType                         =      0
   5941 
   5942 struct GEN7_MI_STORE_REGISTER_MEM {
   5943    uint32_t                             DWordLength;
   5944    bool                                 UseGlobalGTT;
   5945    uint32_t                             MICommandOpcode;
   5946    uint32_t                             CommandType;
   5947    uint64_t                             RegisterAddress;
   5948    __gen_address_type                   MemoryAddress;
   5949 };
   5950 
   5951 static inline void
   5952 GEN7_MI_STORE_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
   5953                                 __attribute__((unused)) void * restrict dst,
   5954                                 __attribute__((unused)) const struct GEN7_MI_STORE_REGISTER_MEM * restrict values)
   5955 {
   5956    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5957 
   5958    dw[0] =
   5959       __gen_uint(values->DWordLength, 0, 7) |
   5960       __gen_uint(values->UseGlobalGTT, 22, 22) |
   5961       __gen_uint(values->MICommandOpcode, 23, 28) |
   5962       __gen_uint(values->CommandType, 29, 31);
   5963 
   5964    dw[1] =
   5965       __gen_offset(values->RegisterAddress, 2, 22);
   5966 
   5967    dw[2] = __gen_combine_address(data, &dw[2], values->MemoryAddress, 0);
   5968 }
   5969 
   5970 #define GEN7_MI_SUSPEND_FLUSH_length           1
   5971 #define GEN7_MI_SUSPEND_FLUSH_length_bias      1
   5972 #define GEN7_MI_SUSPEND_FLUSH_header            \
   5973    .MICommandOpcode                     =     11,  \
   5974    .CommandType                         =      0
   5975 
   5976 struct GEN7_MI_SUSPEND_FLUSH {
   5977    bool                                 SuspendFlush;
   5978    uint32_t                             MICommandOpcode;
   5979    uint32_t                             CommandType;
   5980 };
   5981 
   5982 static inline void
   5983 GEN7_MI_SUSPEND_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
   5984                            __attribute__((unused)) void * restrict dst,
   5985                            __attribute__((unused)) const struct GEN7_MI_SUSPEND_FLUSH * restrict values)
   5986 {
   5987    uint32_t * restrict dw = (uint32_t * restrict) dst;
   5988 
   5989    dw[0] =
   5990       __gen_uint(values->SuspendFlush, 0, 0) |
   5991       __gen_uint(values->MICommandOpcode, 23, 28) |
   5992       __gen_uint(values->CommandType, 29, 31);
   5993 }
   5994 
   5995 #define GEN7_MI_TOPOLOGY_FILTER_length         1
   5996 #define GEN7_MI_TOPOLOGY_FILTER_length_bias      1
   5997 #define GEN7_MI_TOPOLOGY_FILTER_header          \
   5998    .MICommandOpcode                     =     13,  \
   5999    .CommandType                         =      0
   6000 
   6001 struct GEN7_MI_TOPOLOGY_FILTER {
   6002    enum GEN7_3D_Prim_Topo_Type          TopologyFilterValue;
   6003    uint32_t                             MICommandOpcode;
   6004    uint32_t                             CommandType;
   6005 };
   6006 
   6007 static inline void
   6008 GEN7_MI_TOPOLOGY_FILTER_pack(__attribute__((unused)) __gen_user_data *data,
   6009                              __attribute__((unused)) void * restrict dst,
   6010                              __attribute__((unused)) const struct GEN7_MI_TOPOLOGY_FILTER * restrict values)
   6011 {
   6012    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6013 
   6014    dw[0] =
   6015       __gen_uint(values->TopologyFilterValue, 0, 5) |
   6016       __gen_uint(values->MICommandOpcode, 23, 28) |
   6017       __gen_uint(values->CommandType, 29, 31);
   6018 }
   6019 
   6020 #define GEN7_MI_URB_CLEAR_length               2
   6021 #define GEN7_MI_URB_CLEAR_length_bias          2
   6022 #define GEN7_MI_URB_CLEAR_header                \
   6023    .DWordLength                         =      0,  \
   6024    .MICommandOpcode                     =     25,  \
   6025    .CommandType                         =      0
   6026 
   6027 struct GEN7_MI_URB_CLEAR {
   6028    uint32_t                             DWordLength;
   6029    uint32_t                             MICommandOpcode;
   6030    uint32_t                             CommandType;
   6031    uint64_t                             URBAddress;
   6032    uint32_t                             URBClearLength;
   6033 };
   6034 
   6035 static inline void
   6036 GEN7_MI_URB_CLEAR_pack(__attribute__((unused)) __gen_user_data *data,
   6037                        __attribute__((unused)) void * restrict dst,
   6038                        __attribute__((unused)) const struct GEN7_MI_URB_CLEAR * restrict values)
   6039 {
   6040    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6041 
   6042    dw[0] =
   6043       __gen_uint(values->DWordLength, 0, 7) |
   6044       __gen_uint(values->MICommandOpcode, 23, 28) |
   6045       __gen_uint(values->CommandType, 29, 31);
   6046 
   6047    dw[1] =
   6048       __gen_offset(values->URBAddress, 0, 13) |
   6049       __gen_uint(values->URBClearLength, 16, 28);
   6050 }
   6051 
   6052 #define GEN7_MI_USER_INTERRUPT_length          1
   6053 #define GEN7_MI_USER_INTERRUPT_length_bias      1
   6054 #define GEN7_MI_USER_INTERRUPT_header           \
   6055    .MICommandOpcode                     =      2,  \
   6056    .CommandType                         =      0
   6057 
   6058 struct GEN7_MI_USER_INTERRUPT {
   6059    uint32_t                             MICommandOpcode;
   6060    uint32_t                             CommandType;
   6061 };
   6062 
   6063 static inline void
   6064 GEN7_MI_USER_INTERRUPT_pack(__attribute__((unused)) __gen_user_data *data,
   6065                             __attribute__((unused)) void * restrict dst,
   6066                             __attribute__((unused)) const struct GEN7_MI_USER_INTERRUPT * restrict values)
   6067 {
   6068    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6069 
   6070    dw[0] =
   6071       __gen_uint(values->MICommandOpcode, 23, 28) |
   6072       __gen_uint(values->CommandType, 29, 31);
   6073 }
   6074 
   6075 #define GEN7_MI_WAIT_FOR_EVENT_length          1
   6076 #define GEN7_MI_WAIT_FOR_EVENT_length_bias      1
   6077 #define GEN7_MI_WAIT_FOR_EVENT_header           \
   6078    .MICommandOpcode                     =      3,  \
   6079    .CommandType                         =      0
   6080 
   6081 struct GEN7_MI_WAIT_FOR_EVENT {
   6082    bool                                 DisplayPipeAScanLineWaitEnable;
   6083    bool                                 DisplayPlaneAFlipPendingWaitEnable;
   6084    bool                                 DisplaySpriteAFlipPendingWaitEnable;
   6085    bool                                 DisplayPipeAVerticalBlankWaitEnable;
   6086    bool                                 DisplayPipeAHorizontalBlankWaitEnable;
   6087    bool                                 DisplayPipeBScanLineWaitEnable;
   6088    bool                                 DisplayPlaneBFlipPendingWaitEnable;
   6089    bool                                 DisplaySpriteBFlipPendingWaitEnable;
   6090    bool                                 DisplayPipeBVerticalBlankWaitEnable;
   6091    bool                                 DisplayPipeBHorizontalBlankWaitEnable;
   6092    bool                                 DisplayPipeCScanLineWaitEnable;
   6093    bool                                 DisplayPlaneCFlipPendingWaitEnable;
   6094    uint32_t                             ConditionCodeWaitSelect;
   6095 #define Notenabled                               0
   6096    bool                                 DisplaySpriteCFlipPendingWaitEnable;
   6097    bool                                 DisplayPipeCVerticalBlankWaitEnable;
   6098    bool                                 DisplayPipeCHorizontalBlankWaitEnable;
   6099    uint32_t                             MICommandOpcode;
   6100    uint32_t                             CommandType;
   6101 };
   6102 
   6103 static inline void
   6104 GEN7_MI_WAIT_FOR_EVENT_pack(__attribute__((unused)) __gen_user_data *data,
   6105                             __attribute__((unused)) void * restrict dst,
   6106                             __attribute__((unused)) const struct GEN7_MI_WAIT_FOR_EVENT * restrict values)
   6107 {
   6108    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6109 
   6110    dw[0] =
   6111       __gen_uint(values->DisplayPipeAScanLineWaitEnable, 0, 0) |
   6112       __gen_uint(values->DisplayPlaneAFlipPendingWaitEnable, 1, 1) |
   6113       __gen_uint(values->DisplaySpriteAFlipPendingWaitEnable, 2, 2) |
   6114       __gen_uint(values->DisplayPipeAVerticalBlankWaitEnable, 3, 3) |
   6115       __gen_uint(values->DisplayPipeAHorizontalBlankWaitEnable, 5, 5) |
   6116       __gen_uint(values->DisplayPipeBScanLineWaitEnable, 8, 8) |
   6117       __gen_uint(values->DisplayPlaneBFlipPendingWaitEnable, 9, 9) |
   6118       __gen_uint(values->DisplaySpriteBFlipPendingWaitEnable, 10, 10) |
   6119       __gen_uint(values->DisplayPipeBVerticalBlankWaitEnable, 11, 11) |
   6120       __gen_uint(values->DisplayPipeBHorizontalBlankWaitEnable, 13, 13) |
   6121       __gen_uint(values->DisplayPipeCScanLineWaitEnable, 14, 14) |
   6122       __gen_uint(values->DisplayPlaneCFlipPendingWaitEnable, 15, 15) |
   6123       __gen_uint(values->ConditionCodeWaitSelect, 16, 19) |
   6124       __gen_uint(values->DisplaySpriteCFlipPendingWaitEnable, 20, 20) |
   6125       __gen_uint(values->DisplayPipeCVerticalBlankWaitEnable, 21, 21) |
   6126       __gen_uint(values->DisplayPipeCHorizontalBlankWaitEnable, 22, 22) |
   6127       __gen_uint(values->MICommandOpcode, 23, 28) |
   6128       __gen_uint(values->CommandType, 29, 31);
   6129 }
   6130 
   6131 #define GEN7_PIPELINE_SELECT_length            1
   6132 #define GEN7_PIPELINE_SELECT_length_bias       1
   6133 #define GEN7_PIPELINE_SELECT_header             \
   6134    ._3DCommandSubOpcode                 =      4,  \
   6135    ._3DCommandOpcode                    =      1,  \
   6136    .CommandSubType                      =      1,  \
   6137    .CommandType                         =      3
   6138 
   6139 struct GEN7_PIPELINE_SELECT {
   6140    uint32_t                             PipelineSelection;
   6141 #define _3D                                      0
   6142 #define Media                                    1
   6143 #define GPGPU                                    2
   6144    uint32_t                             _3DCommandSubOpcode;
   6145    uint32_t                             _3DCommandOpcode;
   6146    uint32_t                             CommandSubType;
   6147    uint32_t                             CommandType;
   6148 };
   6149 
   6150 static inline void
   6151 GEN7_PIPELINE_SELECT_pack(__attribute__((unused)) __gen_user_data *data,
   6152                           __attribute__((unused)) void * restrict dst,
   6153                           __attribute__((unused)) const struct GEN7_PIPELINE_SELECT * restrict values)
   6154 {
   6155    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6156 
   6157    dw[0] =
   6158       __gen_uint(values->PipelineSelection, 0, 1) |
   6159       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   6160       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   6161       __gen_uint(values->CommandSubType, 27, 28) |
   6162       __gen_uint(values->CommandType, 29, 31);
   6163 }
   6164 
   6165 #define GEN7_PIPE_CONTROL_length               5
   6166 #define GEN7_PIPE_CONTROL_length_bias          2
   6167 #define GEN7_PIPE_CONTROL_header                \
   6168    .DWordLength                         =      3,  \
   6169    ._3DCommandSubOpcode                 =      0,  \
   6170    ._3DCommandOpcode                    =      2,  \
   6171    .CommandSubType                      =      3,  \
   6172    .CommandType                         =      3
   6173 
   6174 struct GEN7_PIPE_CONTROL {
   6175    uint32_t                             DWordLength;
   6176    uint32_t                             _3DCommandSubOpcode;
   6177    uint32_t                             _3DCommandOpcode;
   6178    uint32_t                             CommandSubType;
   6179    uint32_t                             CommandType;
   6180    bool                                 DepthCacheFlushEnable;
   6181    bool                                 StallAtPixelScoreboard;
   6182    bool                                 StateCacheInvalidationEnable;
   6183    bool                                 ConstantCacheInvalidationEnable;
   6184    bool                                 VFCacheInvalidationEnable;
   6185    bool                                 DCFlushEnable;
   6186    bool                                 PipeControlFlushEnable;
   6187    bool                                 NotifyEnable;
   6188    bool                                 IndirectStatePointersDisable;
   6189    bool                                 TextureCacheInvalidationEnable;
   6190    bool                                 InstructionCacheInvalidateEnable;
   6191    bool                                 RenderTargetCacheFlushEnable;
   6192    bool                                 DepthStallEnable;
   6193    uint32_t                             PostSyncOperation;
   6194 #define NoWrite                                  0
   6195 #define WriteImmediateData                       1
   6196 #define WritePSDepthCount                        2
   6197 #define WriteTimestamp                           3
   6198    bool                                 GenericMediaStateClear;
   6199    bool                                 TLBInvalidate;
   6200    bool                                 GlobalSnapshotCountReset;
   6201    bool                                 CommandStreamerStallEnable;
   6202    uint32_t                             StoreDataIndex;
   6203    uint32_t                             LRIPostSyncOperation;
   6204 #define NoLRIOperation                           0
   6205 #define MMIOWriteImmediateData                   1
   6206    uint32_t                             DestinationAddressType;
   6207 #define DAT_PPGTT                                0
   6208 #define DAT_GGTT                                 1
   6209    __gen_address_type                   Address;
   6210    uint64_t                             ImmediateData;
   6211 };
   6212 
   6213 static inline void
   6214 GEN7_PIPE_CONTROL_pack(__attribute__((unused)) __gen_user_data *data,
   6215                        __attribute__((unused)) void * restrict dst,
   6216                        __attribute__((unused)) const struct GEN7_PIPE_CONTROL * restrict values)
   6217 {
   6218    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6219 
   6220    dw[0] =
   6221       __gen_uint(values->DWordLength, 0, 7) |
   6222       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   6223       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   6224       __gen_uint(values->CommandSubType, 27, 28) |
   6225       __gen_uint(values->CommandType, 29, 31);
   6226 
   6227    dw[1] =
   6228       __gen_uint(values->DepthCacheFlushEnable, 0, 0) |
   6229       __gen_uint(values->StallAtPixelScoreboard, 1, 1) |
   6230       __gen_uint(values->StateCacheInvalidationEnable, 2, 2) |
   6231       __gen_uint(values->ConstantCacheInvalidationEnable, 3, 3) |
   6232       __gen_uint(values->VFCacheInvalidationEnable, 4, 4) |
   6233       __gen_uint(values->DCFlushEnable, 5, 5) |
   6234       __gen_uint(values->PipeControlFlushEnable, 7, 7) |
   6235       __gen_uint(values->NotifyEnable, 8, 8) |
   6236       __gen_uint(values->IndirectStatePointersDisable, 9, 9) |
   6237       __gen_uint(values->TextureCacheInvalidationEnable, 10, 10) |
   6238       __gen_uint(values->InstructionCacheInvalidateEnable, 11, 11) |
   6239       __gen_uint(values->RenderTargetCacheFlushEnable, 12, 12) |
   6240       __gen_uint(values->DepthStallEnable, 13, 13) |
   6241       __gen_uint(values->PostSyncOperation, 14, 15) |
   6242       __gen_uint(values->GenericMediaStateClear, 16, 16) |
   6243       __gen_uint(values->TLBInvalidate, 18, 18) |
   6244       __gen_uint(values->GlobalSnapshotCountReset, 19, 19) |
   6245       __gen_uint(values->CommandStreamerStallEnable, 20, 20) |
   6246       __gen_uint(values->StoreDataIndex, 21, 21) |
   6247       __gen_uint(values->LRIPostSyncOperation, 23, 23) |
   6248       __gen_uint(values->DestinationAddressType, 24, 24);
   6249 
   6250    dw[2] = __gen_combine_address(data, &dw[2], values->Address, 0);
   6251 
   6252    const uint64_t v3 =
   6253       __gen_uint(values->ImmediateData, 0, 63);
   6254    dw[3] = v3;
   6255    dw[4] = v3 >> 32;
   6256 }
   6257 
   6258 #define GEN7_STATE_BASE_ADDRESS_length        10
   6259 #define GEN7_STATE_BASE_ADDRESS_length_bias      2
   6260 #define GEN7_STATE_BASE_ADDRESS_header          \
   6261    .DWordLength                         =      8,  \
   6262    ._3DCommandSubOpcode                 =      1,  \
   6263    ._3DCommandOpcode                    =      1,  \
   6264    .CommandSubType                      =      0,  \
   6265    .CommandType                         =      3
   6266 
   6267 struct GEN7_STATE_BASE_ADDRESS {
   6268    uint32_t                             DWordLength;
   6269    uint32_t                             _3DCommandSubOpcode;
   6270    uint32_t                             _3DCommandOpcode;
   6271    uint32_t                             CommandSubType;
   6272    uint32_t                             CommandType;
   6273    bool                                 GeneralStateBaseAddressModifyEnable;
   6274    uint32_t                             StatelessDataPortAccessForceWriteThru;
   6275    uint32_t                             StatelessDataPortAccessMOCS;
   6276    uint32_t                             GeneralStateMOCS;
   6277    __gen_address_type                   GeneralStateBaseAddress;
   6278    bool                                 SurfaceStateBaseAddressModifyEnable;
   6279    uint32_t                             SurfaceStateMOCS;
   6280    __gen_address_type                   SurfaceStateBaseAddress;
   6281    bool                                 DynamicStateBaseAddressModifyEnable;
   6282    uint32_t                             DynamicStateMOCS;
   6283    __gen_address_type                   DynamicStateBaseAddress;
   6284    bool                                 IndirectObjectBaseAddressModifyEnable;
   6285    uint32_t                             IndirectObjectMOCS;
   6286    __gen_address_type                   IndirectObjectBaseAddress;
   6287    bool                                 InstructionBaseAddressModifyEnable;
   6288    uint32_t                             InstructionMOCS;
   6289    __gen_address_type                   InstructionBaseAddress;
   6290    bool                                 GeneralStateAccessUpperBoundModifyEnable;
   6291    __gen_address_type                   GeneralStateAccessUpperBound;
   6292    bool                                 DynamicStateAccessUpperBoundModifyEnable;
   6293    __gen_address_type                   DynamicStateAccessUpperBound;
   6294    bool                                 IndirectObjectAccessUpperBoundModifyEnable;
   6295    __gen_address_type                   IndirectObjectAccessUpperBound;
   6296    bool                                 InstructionAccessUpperBoundModifyEnable;
   6297    __gen_address_type                   InstructionAccessUpperBound;
   6298 };
   6299 
   6300 static inline void
   6301 GEN7_STATE_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
   6302                              __attribute__((unused)) void * restrict dst,
   6303                              __attribute__((unused)) const struct GEN7_STATE_BASE_ADDRESS * restrict values)
   6304 {
   6305    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6306 
   6307    dw[0] =
   6308       __gen_uint(values->DWordLength, 0, 7) |
   6309       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   6310       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   6311       __gen_uint(values->CommandSubType, 27, 28) |
   6312       __gen_uint(values->CommandType, 29, 31);
   6313 
   6314    const uint32_t v1 =
   6315       __gen_uint(values->GeneralStateBaseAddressModifyEnable, 0, 0) |
   6316       __gen_uint(values->StatelessDataPortAccessForceWriteThru, 3, 3) |
   6317       __gen_uint(values->StatelessDataPortAccessMOCS, 4, 7) |
   6318       __gen_uint(values->GeneralStateMOCS, 8, 11);
   6319    dw[1] = __gen_combine_address(data, &dw[1], values->GeneralStateBaseAddress, v1);
   6320 
   6321    const uint32_t v2 =
   6322       __gen_uint(values->SurfaceStateBaseAddressModifyEnable, 0, 0) |
   6323       __gen_uint(values->SurfaceStateMOCS, 8, 11);
   6324    dw[2] = __gen_combine_address(data, &dw[2], values->SurfaceStateBaseAddress, v2);
   6325 
   6326    const uint32_t v3 =
   6327       __gen_uint(values->DynamicStateBaseAddressModifyEnable, 0, 0) |
   6328       __gen_uint(values->DynamicStateMOCS, 8, 11);
   6329    dw[3] = __gen_combine_address(data, &dw[3], values->DynamicStateBaseAddress, v3);
   6330 
   6331    const uint32_t v4 =
   6332       __gen_uint(values->IndirectObjectBaseAddressModifyEnable, 0, 0) |
   6333       __gen_uint(values->IndirectObjectMOCS, 8, 11);
   6334    dw[4] = __gen_combine_address(data, &dw[4], values->IndirectObjectBaseAddress, v4);
   6335 
   6336    const uint32_t v5 =
   6337       __gen_uint(values->InstructionBaseAddressModifyEnable, 0, 0) |
   6338       __gen_uint(values->InstructionMOCS, 8, 11);
   6339    dw[5] = __gen_combine_address(data, &dw[5], values->InstructionBaseAddress, v5);
   6340 
   6341    const uint32_t v6 =
   6342       __gen_uint(values->GeneralStateAccessUpperBoundModifyEnable, 0, 0);
   6343    dw[6] = __gen_combine_address(data, &dw[6], values->GeneralStateAccessUpperBound, v6);
   6344 
   6345    const uint32_t v7 =
   6346       __gen_uint(values->DynamicStateAccessUpperBoundModifyEnable, 0, 0);
   6347    dw[7] = __gen_combine_address(data, &dw[7], values->DynamicStateAccessUpperBound, v7);
   6348 
   6349    const uint32_t v8 =
   6350       __gen_uint(values->IndirectObjectAccessUpperBoundModifyEnable, 0, 0);
   6351    dw[8] = __gen_combine_address(data, &dw[8], values->IndirectObjectAccessUpperBound, v8);
   6352 
   6353    const uint32_t v9 =
   6354       __gen_uint(values->InstructionAccessUpperBoundModifyEnable, 0, 0);
   6355    dw[9] = __gen_combine_address(data, &dw[9], values->InstructionAccessUpperBound, v9);
   6356 }
   6357 
   6358 #define GEN7_STATE_PREFETCH_length             2
   6359 #define GEN7_STATE_PREFETCH_length_bias        2
   6360 #define GEN7_STATE_PREFETCH_header              \
   6361    .DWordLength                         =      0,  \
   6362    ._3DCommandSubOpcode                 =      3,  \
   6363    ._3DCommandOpcode                    =      0,  \
   6364    .CommandSubType                      =      0,  \
   6365    .CommandType                         =      3
   6366 
   6367 struct GEN7_STATE_PREFETCH {
   6368    uint32_t                             DWordLength;
   6369    uint32_t                             _3DCommandSubOpcode;
   6370    uint32_t                             _3DCommandOpcode;
   6371    uint32_t                             CommandSubType;
   6372    uint32_t                             CommandType;
   6373    uint32_t                             PrefetchCount;
   6374    __gen_address_type                   PrefetchPointer;
   6375 };
   6376 
   6377 static inline void
   6378 GEN7_STATE_PREFETCH_pack(__attribute__((unused)) __gen_user_data *data,
   6379                          __attribute__((unused)) void * restrict dst,
   6380                          __attribute__((unused)) const struct GEN7_STATE_PREFETCH * restrict values)
   6381 {
   6382    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6383 
   6384    dw[0] =
   6385       __gen_uint(values->DWordLength, 0, 7) |
   6386       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   6387       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   6388       __gen_uint(values->CommandSubType, 27, 28) |
   6389       __gen_uint(values->CommandType, 29, 31);
   6390 
   6391    const uint32_t v1 =
   6392       __gen_uint(values->PrefetchCount, 0, 2);
   6393    dw[1] = __gen_combine_address(data, &dw[1], values->PrefetchPointer, v1);
   6394 }
   6395 
   6396 #define GEN7_STATE_SIP_length                  2
   6397 #define GEN7_STATE_SIP_length_bias             2
   6398 #define GEN7_STATE_SIP_header                   \
   6399    .DWordLength                         =      0,  \
   6400    ._3DCommandSubOpcode                 =      2,  \
   6401    ._3DCommandOpcode                    =      1,  \
   6402    .CommandSubType                      =      0,  \
   6403    .CommandType                         =      3
   6404 
   6405 struct GEN7_STATE_SIP {
   6406    uint32_t                             DWordLength;
   6407    uint32_t                             _3DCommandSubOpcode;
   6408    uint32_t                             _3DCommandOpcode;
   6409    uint32_t                             CommandSubType;
   6410    uint32_t                             CommandType;
   6411    uint64_t                             SystemInstructionPointer;
   6412 };
   6413 
   6414 static inline void
   6415 GEN7_STATE_SIP_pack(__attribute__((unused)) __gen_user_data *data,
   6416                     __attribute__((unused)) void * restrict dst,
   6417                     __attribute__((unused)) const struct GEN7_STATE_SIP * restrict values)
   6418 {
   6419    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6420 
   6421    dw[0] =
   6422       __gen_uint(values->DWordLength, 0, 7) |
   6423       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   6424       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   6425       __gen_uint(values->CommandSubType, 27, 28) |
   6426       __gen_uint(values->CommandType, 29, 31);
   6427 
   6428    dw[1] =
   6429       __gen_offset(values->SystemInstructionPointer, 4, 31);
   6430 }
   6431 
   6432 #define GEN7_SWTESS_BASE_ADDRESS_length        2
   6433 #define GEN7_SWTESS_BASE_ADDRESS_length_bias      2
   6434 #define GEN7_SWTESS_BASE_ADDRESS_header         \
   6435    .DWordLength                         =      0,  \
   6436    ._3DCommandSubOpcode                 =      3,  \
   6437    ._3DCommandOpcode                    =      1,  \
   6438    .CommandSubType                      =      0,  \
   6439    .CommandType                         =      3
   6440 
   6441 struct GEN7_SWTESS_BASE_ADDRESS {
   6442    uint32_t                             DWordLength;
   6443    uint32_t                             _3DCommandSubOpcode;
   6444    uint32_t                             _3DCommandOpcode;
   6445    uint32_t                             CommandSubType;
   6446    uint32_t                             CommandType;
   6447    uint32_t                             SWTessellationMOCS;
   6448    __gen_address_type                   SWTessellationBaseAddress;
   6449 };
   6450 
   6451 static inline void
   6452 GEN7_SWTESS_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
   6453                               __attribute__((unused)) void * restrict dst,
   6454                               __attribute__((unused)) const struct GEN7_SWTESS_BASE_ADDRESS * restrict values)
   6455 {
   6456    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6457 
   6458    dw[0] =
   6459       __gen_uint(values->DWordLength, 0, 7) |
   6460       __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
   6461       __gen_uint(values->_3DCommandOpcode, 24, 26) |
   6462       __gen_uint(values->CommandSubType, 27, 28) |
   6463       __gen_uint(values->CommandType, 29, 31);
   6464 
   6465    const uint32_t v1 =
   6466       __gen_uint(values->SWTessellationMOCS, 8, 11);
   6467    dw[1] = __gen_combine_address(data, &dw[1], values->SWTessellationBaseAddress, v1);
   6468 }
   6469 
   6470 #define GEN7_BCS_FAULT_REG_num            0x4294
   6471 #define GEN7_BCS_FAULT_REG_length              1
   6472 struct GEN7_BCS_FAULT_REG {
   6473    bool                                 ValidBit;
   6474    uint32_t                             FaultType;
   6475 #define PageFault                                0
   6476 #define InvalidPDFault                           1
   6477 #define UnloadedPDFault                          2
   6478 #define InvalidandUnloadedPDfault                3
   6479    uint32_t                             SRCIDofFault;
   6480    uint32_t                             GTTSEL;
   6481 #define PPGTT                                    0
   6482 #define GGTT                                     1
   6483    __gen_address_type                   VirtualAddressofFault;
   6484 };
   6485 
   6486 static inline void
   6487 GEN7_BCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
   6488                         __attribute__((unused)) void * restrict dst,
   6489                         __attribute__((unused)) const struct GEN7_BCS_FAULT_REG * restrict values)
   6490 {
   6491    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6492 
   6493    const uint32_t v0 =
   6494       __gen_uint(values->ValidBit, 0, 0) |
   6495       __gen_uint(values->FaultType, 1, 2) |
   6496       __gen_uint(values->SRCIDofFault, 3, 10) |
   6497       __gen_uint(values->GTTSEL, 11, 11);
   6498    dw[0] = __gen_combine_address(data, &dw[0], values->VirtualAddressofFault, v0);
   6499 }
   6500 
   6501 #define GEN7_BCS_INSTDONE_num             0x2206c
   6502 #define GEN7_BCS_INSTDONE_length               1
   6503 struct GEN7_BCS_INSTDONE {
   6504    bool                                 RingEnable;
   6505    bool                                 BlitterIDLE;
   6506    bool                                 GABIDLE;
   6507    bool                                 BCSDone;
   6508 };
   6509 
   6510 static inline void
   6511 GEN7_BCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
   6512                        __attribute__((unused)) void * restrict dst,
   6513                        __attribute__((unused)) const struct GEN7_BCS_INSTDONE * restrict values)
   6514 {
   6515    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6516 
   6517    dw[0] =
   6518       __gen_uint(values->RingEnable, 0, 0) |
   6519       __gen_uint(values->BlitterIDLE, 1, 1) |
   6520       __gen_uint(values->GABIDLE, 2, 2) |
   6521       __gen_uint(values->BCSDone, 3, 3);
   6522 }
   6523 
   6524 #define GEN7_BCS_RING_BUFFER_CTL_num      0x2203c
   6525 #define GEN7_BCS_RING_BUFFER_CTL_length        1
   6526 struct GEN7_BCS_RING_BUFFER_CTL {
   6527    bool                                 RingBufferEnable;
   6528    uint32_t                             AutomaticReportHeadPointer;
   6529 #define MI_AUTOREPORT_OFF                        0
   6530 #define MI_AUTOREPORT_64KB                       1
   6531 #define MI_AUTOREPORT_4KB                        2
   6532 #define MI_AUTOREPORT_128KB                      3
   6533    bool                                 DisableRegisterAccesses;
   6534    bool                                 SemaphoreWait;
   6535    bool                                 RBWait;
   6536    uint32_t                             BufferLengthinpages1;
   6537 };
   6538 
   6539 static inline void
   6540 GEN7_BCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
   6541                               __attribute__((unused)) void * restrict dst,
   6542                               __attribute__((unused)) const struct GEN7_BCS_RING_BUFFER_CTL * restrict values)
   6543 {
   6544    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6545 
   6546    dw[0] =
   6547       __gen_uint(values->RingBufferEnable, 0, 0) |
   6548       __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
   6549       __gen_uint(values->DisableRegisterAccesses, 8, 8) |
   6550       __gen_uint(values->SemaphoreWait, 10, 10) |
   6551       __gen_uint(values->RBWait, 11, 11) |
   6552       __gen_uint(values->BufferLengthinpages1, 12, 20);
   6553 }
   6554 
   6555 #define GEN7_CL_INVOCATION_COUNT_num      0x2338
   6556 #define GEN7_CL_INVOCATION_COUNT_length        2
   6557 struct GEN7_CL_INVOCATION_COUNT {
   6558    uint64_t                             CLInvocationCountReport;
   6559 };
   6560 
   6561 static inline void
   6562 GEN7_CL_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
   6563                               __attribute__((unused)) void * restrict dst,
   6564                               __attribute__((unused)) const struct GEN7_CL_INVOCATION_COUNT * restrict values)
   6565 {
   6566    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6567 
   6568    const uint64_t v0 =
   6569       __gen_uint(values->CLInvocationCountReport, 0, 63);
   6570    dw[0] = v0;
   6571    dw[1] = v0 >> 32;
   6572 }
   6573 
   6574 #define GEN7_CL_PRIMITIVES_COUNT_num      0x2340
   6575 #define GEN7_CL_PRIMITIVES_COUNT_length        2
   6576 struct GEN7_CL_PRIMITIVES_COUNT {
   6577    uint64_t                             CLPrimitivesCountReport;
   6578 };
   6579 
   6580 static inline void
   6581 GEN7_CL_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
   6582                               __attribute__((unused)) void * restrict dst,
   6583                               __attribute__((unused)) const struct GEN7_CL_PRIMITIVES_COUNT * restrict values)
   6584 {
   6585    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6586 
   6587    const uint64_t v0 =
   6588       __gen_uint(values->CLPrimitivesCountReport, 0, 63);
   6589    dw[0] = v0;
   6590    dw[1] = v0 >> 32;
   6591 }
   6592 
   6593 #define GEN7_CS_INVOCATION_COUNT_num      0x2290
   6594 #define GEN7_CS_INVOCATION_COUNT_length        2
   6595 struct GEN7_CS_INVOCATION_COUNT {
   6596    uint64_t                             CSInvocationCountReport;
   6597 };
   6598 
   6599 static inline void
   6600 GEN7_CS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
   6601                               __attribute__((unused)) void * restrict dst,
   6602                               __attribute__((unused)) const struct GEN7_CS_INVOCATION_COUNT * restrict values)
   6603 {
   6604    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6605 
   6606    const uint64_t v0 =
   6607       __gen_uint(values->CSInvocationCountReport, 0, 63);
   6608    dw[0] = v0;
   6609    dw[1] = v0 >> 32;
   6610 }
   6611 
   6612 #define GEN7_DS_INVOCATION_COUNT_num      0x2308
   6613 #define GEN7_DS_INVOCATION_COUNT_length        2
   6614 struct GEN7_DS_INVOCATION_COUNT {
   6615    uint64_t                             DSInvocationCountReport;
   6616 };
   6617 
   6618 static inline void
   6619 GEN7_DS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
   6620                               __attribute__((unused)) void * restrict dst,
   6621                               __attribute__((unused)) const struct GEN7_DS_INVOCATION_COUNT * restrict values)
   6622 {
   6623    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6624 
   6625    const uint64_t v0 =
   6626       __gen_uint(values->DSInvocationCountReport, 0, 63);
   6627    dw[0] = v0;
   6628    dw[1] = v0 >> 32;
   6629 }
   6630 
   6631 #define GEN7_ERR_INT_num                  0x44040
   6632 #define GEN7_ERR_INT_length                    1
   6633 struct GEN7_ERR_INT {
   6634    bool                                 PrimaryAGTTFaultStatus;
   6635    bool                                 PrimaryBGTTFaultStatus;
   6636    bool                                 SpriteAGTTFaultStatus;
   6637    bool                                 SpriteBGTTFaultStatus;
   6638    bool                                 CursorAGTTFaultStatus;
   6639    bool                                 CursorBGTTFaultStatus;
   6640    bool                                 Invalidpagetableentrydata;
   6641    bool                                 InvalidGTTpagetableentry;
   6642 };
   6643 
   6644 static inline void
   6645 GEN7_ERR_INT_pack(__attribute__((unused)) __gen_user_data *data,
   6646                   __attribute__((unused)) void * restrict dst,
   6647                   __attribute__((unused)) const struct GEN7_ERR_INT * restrict values)
   6648 {
   6649    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6650 
   6651    dw[0] =
   6652       __gen_uint(values->PrimaryAGTTFaultStatus, 0, 0) |
   6653       __gen_uint(values->PrimaryBGTTFaultStatus, 1, 1) |
   6654       __gen_uint(values->SpriteAGTTFaultStatus, 2, 2) |
   6655       __gen_uint(values->SpriteBGTTFaultStatus, 3, 3) |
   6656       __gen_uint(values->CursorAGTTFaultStatus, 4, 4) |
   6657       __gen_uint(values->CursorBGTTFaultStatus, 5, 5) |
   6658       __gen_uint(values->Invalidpagetableentrydata, 6, 6) |
   6659       __gen_uint(values->InvalidGTTpagetableentry, 7, 7);
   6660 }
   6661 
   6662 #define GEN7_GFX_ARB_ERROR_RPT_num        0x40a0
   6663 #define GEN7_GFX_ARB_ERROR_RPT_length          1
   6664 struct GEN7_GFX_ARB_ERROR_RPT {
   6665    bool                                 TLBPageFaultError;
   6666    bool                                 ContextPageFaultError;
   6667    bool                                 InvalidPageDirectoryentryerror;
   6668    bool                                 HardwareStatusPageFaultError;
   6669    bool                                 TLBPageVTDTranslationError;
   6670    bool                                 ContextPageVTDTranslationError;
   6671    bool                                 PageDirectoryEntryVTDTranslationError;
   6672    bool                                 HardwareStatusPageVTDTranslationError;
   6673    bool                                 UnloadedPDError;
   6674 };
   6675 
   6676 static inline void
   6677 GEN7_GFX_ARB_ERROR_RPT_pack(__attribute__((unused)) __gen_user_data *data,
   6678                             __attribute__((unused)) void * restrict dst,
   6679                             __attribute__((unused)) const struct GEN7_GFX_ARB_ERROR_RPT * restrict values)
   6680 {
   6681    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6682 
   6683    dw[0] =
   6684       __gen_uint(values->TLBPageFaultError, 0, 0) |
   6685       __gen_uint(values->ContextPageFaultError, 1, 1) |
   6686       __gen_uint(values->InvalidPageDirectoryentryerror, 2, 2) |
   6687       __gen_uint(values->HardwareStatusPageFaultError, 3, 3) |
   6688       __gen_uint(values->TLBPageVTDTranslationError, 4, 4) |
   6689       __gen_uint(values->ContextPageVTDTranslationError, 5, 5) |
   6690       __gen_uint(values->PageDirectoryEntryVTDTranslationError, 6, 6) |
   6691       __gen_uint(values->HardwareStatusPageVTDTranslationError, 7, 7) |
   6692       __gen_uint(values->UnloadedPDError, 8, 8);
   6693 }
   6694 
   6695 #define GEN7_GS_INVOCATION_COUNT_num      0x2328
   6696 #define GEN7_GS_INVOCATION_COUNT_length        2
   6697 struct GEN7_GS_INVOCATION_COUNT {
   6698    uint64_t                             GSInvocationCountReport;
   6699 };
   6700 
   6701 static inline void
   6702 GEN7_GS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
   6703                               __attribute__((unused)) void * restrict dst,
   6704                               __attribute__((unused)) const struct GEN7_GS_INVOCATION_COUNT * restrict values)
   6705 {
   6706    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6707 
   6708    const uint64_t v0 =
   6709       __gen_uint(values->GSInvocationCountReport, 0, 63);
   6710    dw[0] = v0;
   6711    dw[1] = v0 >> 32;
   6712 }
   6713 
   6714 #define GEN7_GS_PRIMITIVES_COUNT_num      0x2330
   6715 #define GEN7_GS_PRIMITIVES_COUNT_length        2
   6716 struct GEN7_GS_PRIMITIVES_COUNT {
   6717    uint64_t                             GSPrimitivesCountReport;
   6718 };
   6719 
   6720 static inline void
   6721 GEN7_GS_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
   6722                               __attribute__((unused)) void * restrict dst,
   6723                               __attribute__((unused)) const struct GEN7_GS_PRIMITIVES_COUNT * restrict values)
   6724 {
   6725    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6726 
   6727    const uint64_t v0 =
   6728       __gen_uint(values->GSPrimitivesCountReport, 0, 63);
   6729    dw[0] = v0;
   6730    dw[1] = v0 >> 32;
   6731 }
   6732 
   6733 #define GEN7_HS_INVOCATION_COUNT_num      0x2300
   6734 #define GEN7_HS_INVOCATION_COUNT_length        2
   6735 struct GEN7_HS_INVOCATION_COUNT {
   6736    uint64_t                             HSInvocationCountReport;
   6737 };
   6738 
   6739 static inline void
   6740 GEN7_HS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
   6741                               __attribute__((unused)) void * restrict dst,
   6742                               __attribute__((unused)) const struct GEN7_HS_INVOCATION_COUNT * restrict values)
   6743 {
   6744    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6745 
   6746    const uint64_t v0 =
   6747       __gen_uint(values->HSInvocationCountReport, 0, 63);
   6748    dw[0] = v0;
   6749    dw[1] = v0 >> 32;
   6750 }
   6751 
   6752 #define GEN7_IA_PRIMITIVES_COUNT_num      0x2318
   6753 #define GEN7_IA_PRIMITIVES_COUNT_length        2
   6754 struct GEN7_IA_PRIMITIVES_COUNT {
   6755    uint64_t                             IAPrimitivesCountReport;
   6756 };
   6757 
   6758 static inline void
   6759 GEN7_IA_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
   6760                               __attribute__((unused)) void * restrict dst,
   6761                               __attribute__((unused)) const struct GEN7_IA_PRIMITIVES_COUNT * restrict values)
   6762 {
   6763    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6764 
   6765    const uint64_t v0 =
   6766       __gen_uint(values->IAPrimitivesCountReport, 0, 63);
   6767    dw[0] = v0;
   6768    dw[1] = v0 >> 32;
   6769 }
   6770 
   6771 #define GEN7_IA_VERTICES_COUNT_num        0x2310
   6772 #define GEN7_IA_VERTICES_COUNT_length          2
   6773 struct GEN7_IA_VERTICES_COUNT {
   6774    uint64_t                             IAVerticesCountReport;
   6775 };
   6776 
   6777 static inline void
   6778 GEN7_IA_VERTICES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
   6779                             __attribute__((unused)) void * restrict dst,
   6780                             __attribute__((unused)) const struct GEN7_IA_VERTICES_COUNT * restrict values)
   6781 {
   6782    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6783 
   6784    const uint64_t v0 =
   6785       __gen_uint(values->IAVerticesCountReport, 0, 63);
   6786    dw[0] = v0;
   6787    dw[1] = v0 >> 32;
   6788 }
   6789 
   6790 #define GEN7_INSTDONE_1_num               0x206c
   6791 #define GEN7_INSTDONE_1_length                 1
   6792 struct GEN7_INSTDONE_1 {
   6793    bool                                 PRB0RingEnable;
   6794    bool                                 VFGDone;
   6795    bool                                 VSDone;
   6796    bool                                 HSDone;
   6797    bool                                 TEDone;
   6798    bool                                 DSDone;
   6799    bool                                 GSDone;
   6800    bool                                 SOLDone;
   6801    bool                                 CLDone;
   6802    bool                                 SFDone;
   6803    bool                                 TDGDone;
   6804    bool                                 URBMDone;
   6805    bool                                 SVGDone;
   6806    bool                                 GAFSDone;
   6807    bool                                 VFEDone;
   6808    bool                                 TSGDone;
   6809    bool                                 GAFMDone;
   6810    bool                                 GAMDone;
   6811    bool                                 SDEDone;
   6812    bool                                 RCCFBCCSDone;
   6813 };
   6814 
   6815 static inline void
   6816 GEN7_INSTDONE_1_pack(__attribute__((unused)) __gen_user_data *data,
   6817                      __attribute__((unused)) void * restrict dst,
   6818                      __attribute__((unused)) const struct GEN7_INSTDONE_1 * restrict values)
   6819 {
   6820    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6821 
   6822    dw[0] =
   6823       __gen_uint(values->PRB0RingEnable, 0, 0) |
   6824       __gen_uint(values->VFGDone, 1, 1) |
   6825       __gen_uint(values->VSDone, 2, 2) |
   6826       __gen_uint(values->HSDone, 3, 3) |
   6827       __gen_uint(values->TEDone, 4, 4) |
   6828       __gen_uint(values->DSDone, 5, 5) |
   6829       __gen_uint(values->GSDone, 6, 6) |
   6830       __gen_uint(values->SOLDone, 7, 7) |
   6831       __gen_uint(values->CLDone, 8, 8) |
   6832       __gen_uint(values->SFDone, 9, 9) |
   6833       __gen_uint(values->TDGDone, 12, 12) |
   6834       __gen_uint(values->URBMDone, 13, 13) |
   6835       __gen_uint(values->SVGDone, 14, 14) |
   6836       __gen_uint(values->GAFSDone, 15, 15) |
   6837       __gen_uint(values->VFEDone, 16, 16) |
   6838       __gen_uint(values->TSGDone, 17, 17) |
   6839       __gen_uint(values->GAFMDone, 18, 18) |
   6840       __gen_uint(values->GAMDone, 19, 19) |
   6841       __gen_uint(values->SDEDone, 22, 22) |
   6842       __gen_uint(values->RCCFBCCSDone, 23, 23);
   6843 }
   6844 
   6845 #define GEN7_INSTPM_num                   0x20c0
   6846 #define GEN7_INSTPM_length                     1
   6847 struct GEN7_INSTPM {
   6848    bool                                 _3DStateInstructionDisable;
   6849    bool                                 _3DRenderingInstructionDisable;
   6850    bool                                 MediaInstructionDisable;
   6851    bool                                 CONSTANT_BUFFERAddressOffsetDisable;
   6852    bool                                 _3DStateInstructionDisableMask;
   6853    bool                                 _3DRenderingInstructionDisableMask;
   6854    bool                                 MediaInstructionDisableMask;
   6855    bool                                 CONSTANT_BUFFERAddressOffsetDisableMask;
   6856 };
   6857 
   6858 static inline void
   6859 GEN7_INSTPM_pack(__attribute__((unused)) __gen_user_data *data,
   6860                  __attribute__((unused)) void * restrict dst,
   6861                  __attribute__((unused)) const struct GEN7_INSTPM * restrict values)
   6862 {
   6863    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6864 
   6865    dw[0] =
   6866       __gen_uint(values->_3DStateInstructionDisable, 1, 1) |
   6867       __gen_uint(values->_3DRenderingInstructionDisable, 2, 2) |
   6868       __gen_uint(values->MediaInstructionDisable, 3, 3) |
   6869       __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisable, 6, 6) |
   6870       __gen_uint(values->_3DStateInstructionDisableMask, 17, 17) |
   6871       __gen_uint(values->_3DRenderingInstructionDisableMask, 18, 18) |
   6872       __gen_uint(values->MediaInstructionDisableMask, 19, 19) |
   6873       __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisableMask, 22, 22);
   6874 }
   6875 
   6876 #define GEN7_L3CNTLREG2_num               0xb020
   6877 #define GEN7_L3CNTLREG2_length                 1
   6878 struct GEN7_L3CNTLREG2 {
   6879    uint32_t                             SLMEnable;
   6880    uint32_t                             URBAllocation;
   6881    uint32_t                             URBLowBandwidth;
   6882    uint32_t                             ALLAllocation;
   6883    uint32_t                             ROAllocation;
   6884    uint32_t                             ROLowBandwidth;
   6885    uint32_t                             DCAllocation;
   6886    uint32_t                             DCLowBandwidth;
   6887 };
   6888 
   6889 static inline void
   6890 GEN7_L3CNTLREG2_pack(__attribute__((unused)) __gen_user_data *data,
   6891                      __attribute__((unused)) void * restrict dst,
   6892                      __attribute__((unused)) const struct GEN7_L3CNTLREG2 * restrict values)
   6893 {
   6894    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6895 
   6896    dw[0] =
   6897       __gen_uint(values->SLMEnable, 0, 0) |
   6898       __gen_uint(values->URBAllocation, 1, 6) |
   6899       __gen_uint(values->URBLowBandwidth, 7, 7) |
   6900       __gen_uint(values->ALLAllocation, 8, 13) |
   6901       __gen_uint(values->ROAllocation, 14, 19) |
   6902       __gen_uint(values->ROLowBandwidth, 20, 20) |
   6903       __gen_uint(values->DCAllocation, 21, 26) |
   6904       __gen_uint(values->DCLowBandwidth, 27, 27);
   6905 }
   6906 
   6907 #define GEN7_L3CNTLREG3_num               0xb024
   6908 #define GEN7_L3CNTLREG3_length                 1
   6909 struct GEN7_L3CNTLREG3 {
   6910    uint32_t                             ISAllocation;
   6911    uint32_t                             ISLowBandwidth;
   6912    uint32_t                             CAllocation;
   6913    uint32_t                             CLowBandwidth;
   6914    uint32_t                             TAllocation;
   6915    uint32_t                             TLowBandwidth;
   6916 };
   6917 
   6918 static inline void
   6919 GEN7_L3CNTLREG3_pack(__attribute__((unused)) __gen_user_data *data,
   6920                      __attribute__((unused)) void * restrict dst,
   6921                      __attribute__((unused)) const struct GEN7_L3CNTLREG3 * restrict values)
   6922 {
   6923    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6924 
   6925    dw[0] =
   6926       __gen_uint(values->ISAllocation, 1, 6) |
   6927       __gen_uint(values->ISLowBandwidth, 7, 7) |
   6928       __gen_uint(values->CAllocation, 8, 13) |
   6929       __gen_uint(values->CLowBandwidth, 14, 14) |
   6930       __gen_uint(values->TAllocation, 15, 20) |
   6931       __gen_uint(values->TLowBandwidth, 21, 21);
   6932 }
   6933 
   6934 #define GEN7_L3SQCREG1_num                0xb010
   6935 #define GEN7_L3SQCREG1_length                  1
   6936 struct GEN7_L3SQCREG1 {
   6937    uint32_t                             ConvertDC_UC;
   6938    uint32_t                             ConvertIS_UC;
   6939    uint32_t                             ConvertC_UC;
   6940    uint32_t                             ConvertT_UC;
   6941 };
   6942 
   6943 static inline void
   6944 GEN7_L3SQCREG1_pack(__attribute__((unused)) __gen_user_data *data,
   6945                     __attribute__((unused)) void * restrict dst,
   6946                     __attribute__((unused)) const struct GEN7_L3SQCREG1 * restrict values)
   6947 {
   6948    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6949 
   6950    dw[0] =
   6951       __gen_uint(values->ConvertDC_UC, 24, 24) |
   6952       __gen_uint(values->ConvertIS_UC, 25, 25) |
   6953       __gen_uint(values->ConvertC_UC, 26, 26) |
   6954       __gen_uint(values->ConvertT_UC, 27, 27);
   6955 }
   6956 
   6957 #define GEN7_PS_INVOCATION_COUNT_num      0x2348
   6958 #define GEN7_PS_INVOCATION_COUNT_length        2
   6959 struct GEN7_PS_INVOCATION_COUNT {
   6960    uint64_t                             PSInvocationCountReport;
   6961 };
   6962 
   6963 static inline void
   6964 GEN7_PS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
   6965                               __attribute__((unused)) void * restrict dst,
   6966                               __attribute__((unused)) const struct GEN7_PS_INVOCATION_COUNT * restrict values)
   6967 {
   6968    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6969 
   6970    const uint64_t v0 =
   6971       __gen_uint(values->PSInvocationCountReport, 0, 63);
   6972    dw[0] = v0;
   6973    dw[1] = v0 >> 32;
   6974 }
   6975 
   6976 #define GEN7_RCS_FAULT_REG_num            0x4094
   6977 #define GEN7_RCS_FAULT_REG_length              1
   6978 struct GEN7_RCS_FAULT_REG {
   6979    bool                                 ValidBit;
   6980    uint32_t                             FaultType;
   6981 #define PageFault                                0
   6982 #define InvalidPDFault                           1
   6983 #define UnloadedPDFault                          2
   6984 #define InvalidandUnloadedPDfault                3
   6985    uint32_t                             SRCIDofFault;
   6986    uint32_t                             GTTSEL;
   6987 #define PPGTT                                    0
   6988 #define GGTT                                     1
   6989    __gen_address_type                   VirtualAddressofFault;
   6990 };
   6991 
   6992 static inline void
   6993 GEN7_RCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
   6994                         __attribute__((unused)) void * restrict dst,
   6995                         __attribute__((unused)) const struct GEN7_RCS_FAULT_REG * restrict values)
   6996 {
   6997    uint32_t * restrict dw = (uint32_t * restrict) dst;
   6998 
   6999    const uint32_t v0 =
   7000       __gen_uint(values->ValidBit, 0, 0) |
   7001       __gen_uint(values->FaultType, 1, 2) |
   7002       __gen_uint(values->SRCIDofFault, 3, 10) |
   7003       __gen_uint(values->GTTSEL, 11, 11);
   7004    dw[0] = __gen_combine_address(data, &dw[0], values->VirtualAddressofFault, v0);
   7005 }
   7006 
   7007 #define GEN7_RCS_RING_BUFFER_CTL_num      0x203c
   7008 #define GEN7_RCS_RING_BUFFER_CTL_length        1
   7009 struct GEN7_RCS_RING_BUFFER_CTL {
   7010    bool                                 RingBufferEnable;
   7011    uint32_t                             AutomaticReportHeadPointer;
   7012 #define MI_AUTOREPORT_OFF                        0
   7013 #define MI_AUTOREPORT_64KBMI_AUTOREPORT_4KB      1
   7014 #define MI_AUTOREPORT_128KB                      3
   7015    bool                                 SemaphoreWait;
   7016    bool                                 RBWait;
   7017    uint32_t                             BufferLengthinpages1;
   7018 };
   7019 
   7020 static inline void
   7021 GEN7_RCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
   7022                               __attribute__((unused)) void * restrict dst,
   7023                               __attribute__((unused)) const struct GEN7_RCS_RING_BUFFER_CTL * restrict values)
   7024 {
   7025    uint32_t * restrict dw = (uint32_t * restrict) dst;
   7026 
   7027    dw[0] =
   7028       __gen_uint(values->RingBufferEnable, 0, 0) |
   7029       __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
   7030       __gen_uint(values->SemaphoreWait, 10, 10) |
   7031       __gen_uint(values->RBWait, 11, 11) |
   7032       __gen_uint(values->BufferLengthinpages1, 12, 20);
   7033 }
   7034 
   7035 #define GEN7_ROW_INSTDONE_num             0xe164
   7036 #define GEN7_ROW_INSTDONE_length               1
   7037 struct GEN7_ROW_INSTDONE {
   7038    bool                                 BCDone;
   7039    bool                                 PSDDone;
   7040    bool                                 DCDone;
   7041    bool                                 DAPRDone;
   7042    bool                                 TDLDone;
   7043    bool                                 GWDone;
   7044    bool                                 ICDone;
   7045    bool                                 EU00DoneSS0;
   7046    bool                                 EU01DoneSS0;
   7047    bool                                 EU02DoneSS0;
   7048    bool                                 EU03DoneSS0;
   7049    bool                                 MA0DoneSS0;
   7050    bool                                 EU10DoneSS0;
   7051    bool                                 EU11DoneSS0;
   7052    bool                                 EU12DoneSS0;
   7053    bool                                 EU13DoneSS0;
   7054    bool                                 MA1Done;
   7055 };
   7056 
   7057 static inline void
   7058 GEN7_ROW_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
   7059                        __attribute__((unused)) void * restrict dst,
   7060                        __attribute__((unused)) const struct GEN7_ROW_INSTDONE * restrict values)
   7061 {
   7062    uint32_t * restrict dw = (uint32_t * restrict) dst;
   7063 
   7064    dw[0] =
   7065       __gen_uint(values->BCDone, 0, 0) |
   7066       __gen_uint(values->PSDDone, 1, 1) |
   7067       __gen_uint(values->DCDone, 2, 2) |
   7068       __gen_uint(values->DAPRDone, 3, 3) |
   7069       __gen_uint(values->TDLDone, 6, 6) |
   7070       __gen_uint(values->GWDone, 8, 8) |
   7071       __gen_uint(values->ICDone, 12, 12) |
   7072       __gen_uint(values->EU00DoneSS0, 16, 16) |
   7073       __gen_uint(values->EU01DoneSS0, 17, 17) |
   7074       __gen_uint(values->EU02DoneSS0, 18, 18) |
   7075       __gen_uint(values->EU03DoneSS0, 19, 19) |
   7076       __gen_uint(values->MA0DoneSS0, 20, 20) |
   7077       __gen_uint(values->EU10DoneSS0, 21, 21) |
   7078       __gen_uint(values->EU11DoneSS0, 22, 22) |
   7079       __gen_uint(values->EU12DoneSS0, 23, 23) |
   7080       __gen_uint(values->EU13DoneSS0, 24, 24) |
   7081       __gen_uint(values->MA1Done, 25, 25);
   7082 }
   7083 
   7084 #define GEN7_SAMPLER_INSTDONE_num         0xe160
   7085 #define GEN7_SAMPLER_INSTDONE_length           1
   7086 struct GEN7_SAMPLER_INSTDONE {
   7087    bool                                 VMEDone;
   7088    bool                                 PL0Done;
   7089    bool                                 SO0Done;
   7090    bool                                 DG0Done;
   7091    bool                                 FT0Done;
   7092    bool                                 DM0Done;
   7093    bool                                 SCDone;
   7094    bool                                 FL0Done;
   7095    bool                                 QCDone;
   7096    bool                                 SVSMDone;
   7097    bool                                 SI0Done;
   7098    bool                                 MT0Done;
   7099    bool                                 AVSDone;
   7100    bool                                 IEFDone;
   7101    bool                                 VDIDone;
   7102    bool                                 SVSMARB3;
   7103    bool                                 SVSMARB2;
   7104    bool                                 SVSMARB1;
   7105    bool                                 SVSMAdapter;
   7106 };
   7107 
   7108 static inline void
   7109 GEN7_SAMPLER_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
   7110                            __attribute__((unused)) void * restrict dst,
   7111                            __attribute__((unused)) const struct GEN7_SAMPLER_INSTDONE * restrict values)
   7112 {
   7113    uint32_t * restrict dw = (uint32_t * restrict) dst;
   7114 
   7115    dw[0] =
   7116       __gen_uint(values->VMEDone, 0, 0) |
   7117       __gen_uint(values->PL0Done, 1, 1) |
   7118       __gen_uint(values->SO0Done, 2, 2) |
   7119       __gen_uint(values->DG0Done, 3, 3) |
   7120       __gen_uint(values->FT0Done, 4, 4) |
   7121       __gen_uint(values->DM0Done, 5, 5) |
   7122       __gen_uint(values->SCDone, 6, 6) |
   7123       __gen_uint(values->FL0Done, 7, 7) |
   7124       __gen_uint(values->QCDone, 8, 8) |
   7125       __gen_uint(values->SVSMDone, 9, 9) |
   7126       __gen_uint(values->SI0Done, 10, 10) |
   7127       __gen_uint(values->MT0Done, 11, 11) |
   7128       __gen_uint(values->AVSDone, 12, 12) |
   7129       __gen_uint(values->IEFDone, 13, 13) |
   7130       __gen_uint(values->VDIDone, 14, 14) |
   7131       __gen_uint(values->SVSMARB3, 15, 15) |
   7132       __gen_uint(values->SVSMARB2, 16, 16) |
   7133       __gen_uint(values->SVSMARB1, 17, 17) |
   7134       __gen_uint(values->SVSMAdapter, 18, 18);
   7135 }
   7136 
   7137 #define GEN7_SC_INSTDONE_num              0x7100
   7138 #define GEN7_SC_INSTDONE_length                1
   7139 struct GEN7_SC_INSTDONE {
   7140    bool                                 SVLDone;
   7141    bool                                 WMFEDone;
   7142    bool                                 WMBEDone;
   7143    bool                                 HIZDone;
   7144    bool                                 STCDone;
   7145    bool                                 IZDone;
   7146    bool                                 SBEDone;
   7147    bool                                 RCZDone;
   7148    bool                                 RCCDone;
   7149    bool                                 RCPBEDone;
   7150    bool                                 RCPFEDone;
   7151    bool                                 DAPBDone;
   7152    bool                                 DAPRBEDone;
   7153    bool                                 IECPDone;
   7154    bool                                 SARBDone;
   7155    bool                                 VSCDone;
   7156 };
   7157 
   7158 static inline void
   7159 GEN7_SC_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
   7160                       __attribute__((unused)) void * restrict dst,
   7161                       __attribute__((unused)) const struct GEN7_SC_INSTDONE * restrict values)
   7162 {
   7163    uint32_t * restrict dw = (uint32_t * restrict) dst;
   7164 
   7165    dw[0] =
   7166       __gen_uint(values->SVLDone, 0, 0) |
   7167       __gen_uint(values->WMFEDone, 1, 1) |
   7168       __gen_uint(values->WMBEDone, 2, 2) |
   7169       __gen_uint(values->HIZDone, 3, 3) |
   7170       __gen_uint(values->STCDone, 4, 4) |
   7171       __gen_uint(values->IZDone, 5, 5) |
   7172       __gen_uint(values->SBEDone, 6, 6) |
   7173       __gen_uint(values->RCZDone, 8, 8) |
   7174       __gen_uint(values->RCCDone, 9, 9) |
   7175       __gen_uint(values->RCPBEDone, 10, 10) |
   7176       __gen_uint(values->RCPFEDone, 11, 11) |
   7177       __gen_uint(values->DAPBDone, 12, 12) |
   7178       __gen_uint(values->DAPRBEDone, 13, 13) |
   7179       __gen_uint(values->IECPDone, 14, 14) |
   7180       __gen_uint(values->SARBDone, 15, 15) |
   7181       __gen_uint(values->VSCDone, 16, 16);
   7182 }
   7183 
   7184 #define GEN7_SO_NUM_PRIMS_WRITTEN0_num    0x5200
   7185 #define GEN7_SO_NUM_PRIMS_WRITTEN0_length      2
   7186 struct GEN7_SO_NUM_PRIMS_WRITTEN0 {
   7187    uint64_t                             NumPrimsWrittenCount;
   7188 };
   7189 
   7190 static inline void
   7191 GEN7_SO_NUM_PRIMS_WRITTEN0_pack(__attribute__((unused)) __gen_user_data *data,
   7192                                 __attribute__((unused)) void * restrict dst,
   7193                                 __attribute__((unused)) const struct GEN7_SO_NUM_PRIMS_WRITTEN0 * restrict values)
   7194 {
   7195    uint32_t * restrict dw = (uint32_t * restrict) dst;
   7196 
   7197    const uint64_t v0 =
   7198       __gen_uint(values->NumPrimsWrittenCount, 0, 63);
   7199    dw[0] = v0;
   7200    dw[1] = v0 >> 32;
   7201 }
   7202 
   7203 #define GEN7_SO_NUM_PRIMS_WRITTEN1_num    0x5208
   7204 #define GEN7_SO_NUM_PRIMS_WRITTEN1_length      2
   7205 struct GEN7_SO_NUM_PRIMS_WRITTEN1 {
   7206    uint64_t                             NumPrimsWrittenCount;
   7207 };
   7208 
   7209 static inline void
   7210 GEN7_SO_NUM_PRIMS_WRITTEN1_pack(__attribute__((unused)) __gen_user_data *data,
   7211                                 __attribute__((unused)) void * restrict dst,
   7212                                 __attribute__((unused)) const struct GEN7_SO_NUM_PRIMS_WRITTEN1 * restrict values)
   7213 {
   7214    uint32_t * restrict dw = (uint32_t * restrict) dst;
   7215 
   7216    const uint64_t v0 =
   7217       __gen_uint(values->NumPrimsWrittenCount, 0, 63);
   7218    dw[0] = v0;
   7219    dw[1] = v0 >> 32;
   7220 }
   7221 
   7222 #define GEN7_SO_NUM_PRIMS_WRITTEN2_num    0x5210
   7223 #define GEN7_SO_NUM_PRIMS_WRITTEN2_length      2
   7224 struct GEN7_SO_NUM_PRIMS_WRITTEN2 {
   7225    uint64_t                             NumPrimsWrittenCount;
   7226 };
   7227 
   7228 static inline void
   7229 GEN7_SO_NUM_PRIMS_WRITTEN2_pack(__attribute__((unused)) __gen_user_data *data,
   7230                                 __attribute__((unused)) void * restrict dst,
   7231                                 __attribute__((unused)) const struct GEN7_SO_NUM_PRIMS_WRITTEN2 * restrict values)
   7232 {
   7233    uint32_t * restrict dw = (uint32_t * restrict) dst;
   7234 
   7235    const uint64_t v0 =
   7236       __gen_uint(values->NumPrimsWrittenCount, 0, 63);
   7237    dw[0] = v0;
   7238    dw[1] = v0 >> 32;
   7239 }
   7240 
   7241 #define GEN7_SO_NUM_PRIMS_WRITTEN3_num    0x5218
   7242 #define GEN7_SO_NUM_PRIMS_WRITTEN3_length      2
   7243 struct GEN7_SO_NUM_PRIMS_WRITTEN3 {
   7244    uint64_t                             NumPrimsWrittenCount;
   7245 };
   7246 
   7247 static inline void
   7248 GEN7_SO_NUM_PRIMS_WRITTEN3_pack(__attribute__((unused)) __gen_user_data *data,
   7249                                 __attribute__((unused)) void * restrict dst,
   7250                                 __attribute__((unused)) const struct GEN7_SO_NUM_PRIMS_WRITTEN3 * restrict values)
   7251 {
   7252    uint32_t * restrict dw = (uint32_t * restrict) dst;
   7253 
   7254    const uint64_t v0 =
   7255       __gen_uint(values->NumPrimsWrittenCount, 0, 63);
   7256    dw[0] = v0;
   7257    dw[1] = v0 >> 32;
   7258 }
   7259 
   7260 #define GEN7_SO_PRIM_STORAGE_NEEDED0_num  0x5240
   7261 #define GEN7_SO_PRIM_STORAGE_NEEDED0_length      2
   7262 struct GEN7_SO_PRIM_STORAGE_NEEDED0 {
   7263    uint64_t                             PrimStorageNeededCount;
   7264 };
   7265 
   7266 static inline void
   7267 GEN7_SO_PRIM_STORAGE_NEEDED0_pack(__attribute__((unused)) __gen_user_data *data,
   7268                                   __attribute__((unused)) void * restrict dst,
   7269                                   __attribute__((unused)) const struct GEN7_SO_PRIM_STORAGE_NEEDED0 * restrict values)
   7270 {
   7271    uint32_t * restrict dw = (uint32_t * restrict) dst;
   7272 
   7273    const uint64_t v0 =
   7274       __gen_uint(values->PrimStorageNeededCount, 0, 63);
   7275    dw[0] = v0;
   7276    dw[1] = v0 >> 32;
   7277 }
   7278 
   7279 #define GEN7_SO_PRIM_STORAGE_NEEDED1_num  0x5248
   7280 #define GEN7_SO_PRIM_STORAGE_NEEDED1_length      2
   7281 struct GEN7_SO_PRIM_STORAGE_NEEDED1 {
   7282    uint64_t                             PrimStorageNeededCount;
   7283 };
   7284 
   7285 static inline void
   7286 GEN7_SO_PRIM_STORAGE_NEEDED1_pack(__attribute__((unused)) __gen_user_data *data,
   7287                                   __attribute__((unused)) void * restrict dst,
   7288                                   __attribute__((unused)) const struct GEN7_SO_PRIM_STORAGE_NEEDED1 * restrict values)
   7289 {
   7290    uint32_t * restrict dw = (uint32_t * restrict) dst;
   7291 
   7292    const uint64_t v0 =
   7293       __gen_uint(values->PrimStorageNeededCount, 0, 63);
   7294    dw[0] = v0;
   7295    dw[1] = v0 >> 32;
   7296 }
   7297 
   7298 #define GEN7_SO_PRIM_STORAGE_NEEDED2_num  0x5250
   7299 #define GEN7_SO_PRIM_STORAGE_NEEDED2_length      2
   7300 struct GEN7_SO_PRIM_STORAGE_NEEDED2 {
   7301    uint64_t                             PrimStorageNeededCount;
   7302 };
   7303 
   7304 static inline void
   7305 GEN7_SO_PRIM_STORAGE_NEEDED2_pack(__attribute__((unused)) __gen_user_data *data,
   7306                                   __attribute__((unused)) void * restrict dst,
   7307                                   __attribute__((unused)) const struct GEN7_SO_PRIM_STORAGE_NEEDED2 * restrict values)
   7308 {
   7309    uint32_t * restrict dw = (uint32_t * restrict) dst;
   7310 
   7311    const uint64_t v0 =
   7312       __gen_uint(values->PrimStorageNeededCount, 0, 63);
   7313    dw[0] = v0;
   7314    dw[1] = v0 >> 32;
   7315 }
   7316 
   7317 #define GEN7_SO_PRIM_STORAGE_NEEDED3_num  0x5258
   7318 #define GEN7_SO_PRIM_STORAGE_NEEDED3_length      2
   7319 struct GEN7_SO_PRIM_STORAGE_NEEDED3 {
   7320    uint64_t                             PrimStorageNeededCount;
   7321 };
   7322 
   7323 static inline void
   7324 GEN7_SO_PRIM_STORAGE_NEEDED3_pack(__attribute__((unused)) __gen_user_data *data,
   7325                                   __attribute__((unused)) void * restrict dst,
   7326                                   __attribute__((unused)) const struct GEN7_SO_PRIM_STORAGE_NEEDED3 * restrict values)
   7327 {
   7328    uint32_t * restrict dw = (uint32_t * restrict) dst;
   7329 
   7330    const uint64_t v0 =
   7331       __gen_uint(values->PrimStorageNeededCount, 0, 63);
   7332    dw[0] = v0;
   7333    dw[1] = v0 >> 32;
   7334 }
   7335 
   7336 #define GEN7_SO_WRITE_OFFSET0_num         0x5280
   7337 #define GEN7_SO_WRITE_OFFSET0_length           1
   7338 struct GEN7_SO_WRITE_OFFSET0 {
   7339    uint64_t                             WriteOffset;
   7340 };
   7341 
   7342 static inline void
   7343 GEN7_SO_WRITE_OFFSET0_pack(__attribute__((unused)) __gen_user_data *data,
   7344                            __attribute__((unused)) void * restrict dst,
   7345                            __attribute__((unused)) const struct GEN7_SO_WRITE_OFFSET0 * restrict values)
   7346 {
   7347    uint32_t * restrict dw = (uint32_t * restrict) dst;
   7348 
   7349    dw[0] =
   7350       __gen_offset(values->WriteOffset, 2, 31);
   7351 }
   7352 
   7353 #define GEN7_SO_WRITE_OFFSET1_num         0x5284
   7354 #define GEN7_SO_WRITE_OFFSET1_length           1
   7355 struct GEN7_SO_WRITE_OFFSET1 {
   7356    uint64_t                             WriteOffset;
   7357 };
   7358 
   7359 static inline void
   7360 GEN7_SO_WRITE_OFFSET1_pack(__attribute__((unused)) __gen_user_data *data,
   7361                            __attribute__((unused)) void * restrict dst,
   7362                            __attribute__((unused)) const struct GEN7_SO_WRITE_OFFSET1 * restrict values)
   7363 {
   7364    uint32_t * restrict dw = (uint32_t * restrict) dst;
   7365 
   7366    dw[0] =
   7367       __gen_offset(values->WriteOffset, 2, 31);
   7368 }
   7369 
   7370 #define GEN7_SO_WRITE_OFFSET2_num         0x5288
   7371 #define GEN7_SO_WRITE_OFFSET2_length           1
   7372 struct GEN7_SO_WRITE_OFFSET2 {
   7373    uint64_t                             WriteOffset;
   7374 };
   7375 
   7376 static inline void
   7377 GEN7_SO_WRITE_OFFSET2_pack(__attribute__((unused)) __gen_user_data *data,
   7378                            __attribute__((unused)) void * restrict dst,
   7379                            __attribute__((unused)) const struct GEN7_SO_WRITE_OFFSET2 * restrict values)
   7380 {
   7381    uint32_t * restrict dw = (uint32_t * restrict) dst;
   7382 
   7383    dw[0] =
   7384       __gen_offset(values->WriteOffset, 2, 31);
   7385 }
   7386 
   7387 #define GEN7_SO_WRITE_OFFSET3_num         0x528c
   7388 #define GEN7_SO_WRITE_OFFSET3_length           1
   7389 struct GEN7_SO_WRITE_OFFSET3 {
   7390    uint64_t                             WriteOffset;
   7391 };
   7392 
   7393 static inline void
   7394 GEN7_SO_WRITE_OFFSET3_pack(__attribute__((unused)) __gen_user_data *data,
   7395                            __attribute__((unused)) void * restrict dst,
   7396                            __attribute__((unused)) const struct GEN7_SO_WRITE_OFFSET3 * restrict values)
   7397 {
   7398    uint32_t * restrict dw = (uint32_t * restrict) dst;
   7399 
   7400    dw[0] =
   7401       __gen_offset(values->WriteOffset, 2, 31);
   7402 }
   7403 
   7404 #define GEN7_VCS_FAULT_REG_num            0x4194
   7405 #define GEN7_VCS_FAULT_REG_length              1
   7406 struct GEN7_VCS_FAULT_REG {
   7407    bool                                 ValidBit;
   7408    uint32_t                             FaultType;
   7409 #define PageFault                                0
   7410 #define InvalidPDFault                           1
   7411 #define UnloadedPDFault                          2
   7412 #define InvalidandUnloadedPDfault                3
   7413    uint32_t                             SRCIDofFault;
   7414    uint32_t                             GTTSEL;
   7415 #define PPGTT                                    0
   7416 #define GGTT                                     1
   7417    __gen_address_type                   VirtualAddressofFault;
   7418 };
   7419 
   7420 static inline void
   7421 GEN7_VCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
   7422                         __attribute__((unused)) void * restrict dst,
   7423                         __attribute__((unused)) const struct GEN7_VCS_FAULT_REG * restrict values)
   7424 {
   7425    uint32_t * restrict dw = (uint32_t * restrict) dst;
   7426 
   7427    const uint32_t v0 =
   7428       __gen_uint(values->ValidBit, 0, 0) |
   7429       __gen_uint(values->FaultType, 1, 2) |
   7430       __gen_uint(values->SRCIDofFault, 3, 10) |
   7431       __gen_uint(values->GTTSEL, 11, 11);
   7432    dw[0] = __gen_combine_address(data, &dw[0], values->VirtualAddressofFault, v0);
   7433 }
   7434 
   7435 #define GEN7_VCS_INSTDONE_num             0x1206c
   7436 #define GEN7_VCS_INSTDONE_length               1
   7437 struct GEN7_VCS_INSTDONE {
   7438    bool                                 RingEnable;
   7439    bool                                 USBDone;
   7440    bool                                 QRCDone;
   7441    bool                                 SECDone;
   7442    bool                                 MPCDone;
   7443    bool                                 VFTDone;
   7444    bool                                 BSPDone;
   7445    bool                                 VLFDone;
   7446    bool                                 VOPDone;
   7447    bool                                 VMCDone;
   7448    bool                                 VIPDone;
   7449    bool                                 VITDone;
   7450    bool                                 VDSDone;
   7451    bool                                 VMXDone;
   7452    bool                                 VCPDone;
   7453    bool                                 VCDDone;
   7454    bool                                 VADDone;
   7455    bool                                 VMDDone;
   7456    bool                                 VISDone;
   7457    bool                                 VACDone;
   7458    bool                                 VAMDone;
   7459    bool                                 JPGDone;
   7460    bool                                 VBPDone;
   7461    bool                                 VHRDone;
   7462    bool                                 VCIDone;
   7463    bool                                 VCRDone;
   7464    bool                                 VINDone;
   7465    bool                                 VPRDone;
   7466    bool                                 VTQDone;
   7467    bool                                 VCSDone;
   7468    bool                                 GACDone;
   7469 };
   7470 
   7471 static inline void
   7472 GEN7_VCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
   7473                        __attribute__((unused)) void * restrict dst,
   7474                        __attribute__((unused)) const struct GEN7_VCS_INSTDONE * restrict values)
   7475 {
   7476    uint32_t * restrict dw = (uint32_t * restrict) dst;
   7477 
   7478    dw[0] =
   7479       __gen_uint(values->RingEnable, 0, 0) |
   7480       __gen_uint(values->USBDone, 1, 1) |
   7481       __gen_uint(values->QRCDone, 2, 2) |
   7482       __gen_uint(values->SECDone, 3, 3) |
   7483       __gen_uint(values->MPCDone, 4, 4) |
   7484       __gen_uint(values->VFTDone, 5, 5) |
   7485       __gen_uint(values->BSPDone, 6, 6) |
   7486       __gen_uint(values->VLFDone, 7, 7) |
   7487       __gen_uint(values->VOPDone, 8, 8) |
   7488       __gen_uint(values->VMCDone, 9, 9) |
   7489       __gen_uint(values->VIPDone, 10, 10) |
   7490       __gen_uint(values->VITDone, 11, 11) |
   7491       __gen_uint(values->VDSDone, 12, 12) |
   7492       __gen_uint(values->VMXDone, 13, 13) |
   7493       __gen_uint(values->VCPDone, 14, 14) |
   7494       __gen_uint(values->VCDDone, 15, 15) |
   7495       __gen_uint(values->VADDone, 16, 16) |
   7496       __gen_uint(values->VMDDone, 17, 17) |
   7497       __gen_uint(values->VISDone, 18, 18) |
   7498       __gen_uint(values->VACDone, 19, 19) |
   7499       __gen_uint(values->VAMDone, 20, 20) |
   7500       __gen_uint(values->JPGDone, 21, 21) |
   7501       __gen_uint(values->VBPDone, 22, 22) |
   7502       __gen_uint(values->VHRDone, 23, 23) |
   7503       __gen_uint(values->VCIDone, 24, 24) |
   7504       __gen_uint(values->VCRDone, 25, 25) |
   7505       __gen_uint(values->VINDone, 26, 26) |
   7506       __gen_uint(values->VPRDone, 27, 27) |
   7507       __gen_uint(values->VTQDone, 28, 28) |
   7508       __gen_uint(values->VCSDone, 30, 30) |
   7509       __gen_uint(values->GACDone, 31, 31);
   7510 }
   7511 
   7512 #define GEN7_VCS_RING_BUFFER_CTL_num      0x1203c
   7513 #define GEN7_VCS_RING_BUFFER_CTL_length        1
   7514 struct GEN7_VCS_RING_BUFFER_CTL {
   7515    bool                                 RingBufferEnable;
   7516    uint32_t                             AutomaticReportHeadPointer;
   7517 #define MI_AUTOREPORT_OFF                        0
   7518 #define MI_AUTOREPORT_64KB                       1
   7519 #define MI_AUTOREPORT_4KB                        2
   7520 #define MI_AUTOREPORT_128KB                      3
   7521    bool                                 DisableRegisterAccesses;
   7522    bool                                 SemaphoreWait;
   7523    bool                                 RBWait;
   7524    uint32_t                             BufferLengthinpages1;
   7525 };
   7526 
   7527 static inline void
   7528 GEN7_VCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
   7529                               __attribute__((unused)) void * restrict dst,
   7530                               __attribute__((unused)) const struct GEN7_VCS_RING_BUFFER_CTL * restrict values)
   7531 {
   7532    uint32_t * restrict dw = (uint32_t * restrict) dst;
   7533 
   7534    dw[0] =
   7535       __gen_uint(values->RingBufferEnable, 0, 0) |
   7536       __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
   7537       __gen_uint(values->DisableRegisterAccesses, 8, 8) |
   7538       __gen_uint(values->SemaphoreWait, 10, 10) |
   7539       __gen_uint(values->RBWait, 11, 11) |
   7540       __gen_uint(values->BufferLengthinpages1, 12, 20);
   7541 }
   7542 
   7543 #define GEN7_VS_INVOCATION_COUNT_num      0x2320
   7544 #define GEN7_VS_INVOCATION_COUNT_length        2
   7545 struct GEN7_VS_INVOCATION_COUNT {
   7546    uint64_t                             VSInvocationCountReport;
   7547 };
   7548 
   7549 static inline void
   7550 GEN7_VS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
   7551                               __attribute__((unused)) void * restrict dst,
   7552                               __attribute__((unused)) const struct GEN7_VS_INVOCATION_COUNT * restrict values)
   7553 {
   7554    uint32_t * restrict dw = (uint32_t * restrict) dst;
   7555 
   7556    const uint64_t v0 =
   7557       __gen_uint(values->VSInvocationCountReport, 0, 63);
   7558    dw[0] = v0;
   7559    dw[1] = v0 >> 32;
   7560 }
   7561 
   7562 #endif /* GEN7_PACK_H */
   7563