gen7_pack.h revision 10e230b6
110e230b6Smaya/*
210e230b6Smaya * Copyright (C) 2016 Intel Corporation
310e230b6Smaya *
410e230b6Smaya * Permission is hereby granted, free of charge, to any person obtaining a
510e230b6Smaya * copy of this software and associated documentation files (the "Software"),
610e230b6Smaya * to deal in the Software without restriction, including without limitation
710e230b6Smaya * the rights to use, copy, modify, merge, publish, distribute, sublicense,
810e230b6Smaya * and/or sell copies of the Software, and to permit persons to whom the
910e230b6Smaya * Software is furnished to do so, subject to the following conditions:
1010e230b6Smaya *
1110e230b6Smaya * The above copyright notice and this permission notice (including the next
1210e230b6Smaya * paragraph) shall be included in all copies or substantial portions of the
1310e230b6Smaya * Software.
1410e230b6Smaya *
1510e230b6Smaya * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1610e230b6Smaya * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1710e230b6Smaya * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1810e230b6Smaya * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1910e230b6Smaya * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2010e230b6Smaya * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2110e230b6Smaya * IN THE SOFTWARE.
2210e230b6Smaya */
2310e230b6Smaya
2410e230b6Smaya
2510e230b6Smaya/* Instructions, enums and structures for IVB.
2610e230b6Smaya *
2710e230b6Smaya * This file has been generated, do not hand edit.
2810e230b6Smaya */
2910e230b6Smaya
3010e230b6Smaya#ifndef GEN7_PACK_H
3110e230b6Smaya#define GEN7_PACK_H
3210e230b6Smaya
3310e230b6Smaya#include <stdio.h>
3410e230b6Smaya#include <stdint.h>
3510e230b6Smaya#include <stdbool.h>
3610e230b6Smaya#include <assert.h>
3710e230b6Smaya#include <math.h>
3810e230b6Smaya
3910e230b6Smaya#ifndef __gen_validate_value
4010e230b6Smaya#define __gen_validate_value(x)
4110e230b6Smaya#endif
4210e230b6Smaya
4310e230b6Smaya#ifndef __gen_field_functions
4410e230b6Smaya#define __gen_field_functions
4510e230b6Smaya
4610e230b6Smaya#ifdef NDEBUG
4710e230b6Smaya#define NDEBUG_UNUSED __attribute__((unused))
4810e230b6Smaya#else
4910e230b6Smaya#define NDEBUG_UNUSED
5010e230b6Smaya#endif
5110e230b6Smaya
5210e230b6Smayaunion __gen_value {
5310e230b6Smaya   float f;
5410e230b6Smaya   uint32_t dw;
5510e230b6Smaya};
5610e230b6Smaya
5710e230b6Smayastatic inline uint64_t
5810e230b6Smaya__gen_mbo(uint32_t start, uint32_t end)
5910e230b6Smaya{
6010e230b6Smaya   return (~0ull >> (64 - (end - start + 1))) << start;
6110e230b6Smaya}
6210e230b6Smaya
6310e230b6Smayastatic inline uint64_t
6410e230b6Smaya__gen_uint(uint64_t v, uint32_t start, NDEBUG_UNUSED uint32_t end)
6510e230b6Smaya{
6610e230b6Smaya   __gen_validate_value(v);
6710e230b6Smaya
6810e230b6Smaya#ifndef NDEBUG
6910e230b6Smaya   const int width = end - start + 1;
7010e230b6Smaya   if (width < 64) {
7110e230b6Smaya      const uint64_t max = (1ull << width) - 1;
7210e230b6Smaya      assert(v <= max);
7310e230b6Smaya   }
7410e230b6Smaya#endif
7510e230b6Smaya
7610e230b6Smaya   return v << start;
7710e230b6Smaya}
7810e230b6Smaya
7910e230b6Smayastatic inline uint64_t
8010e230b6Smaya__gen_sint(int64_t v, uint32_t start, uint32_t end)
8110e230b6Smaya{
8210e230b6Smaya   const int width = end - start + 1;
8310e230b6Smaya
8410e230b6Smaya   __gen_validate_value(v);
8510e230b6Smaya
8610e230b6Smaya#ifndef NDEBUG
8710e230b6Smaya   if (width < 64) {
8810e230b6Smaya      const int64_t max = (1ll << (width - 1)) - 1;
8910e230b6Smaya      const int64_t min = -(1ll << (width - 1));
9010e230b6Smaya      assert(min <= v && v <= max);
9110e230b6Smaya   }
9210e230b6Smaya#endif
9310e230b6Smaya
9410e230b6Smaya   const uint64_t mask = ~0ull >> (64 - width);
9510e230b6Smaya
9610e230b6Smaya   return (v & mask) << start;
9710e230b6Smaya}
9810e230b6Smaya
9910e230b6Smayastatic inline uint64_t
10010e230b6Smaya__gen_offset(uint64_t v, NDEBUG_UNUSED uint32_t start, NDEBUG_UNUSED uint32_t end)
10110e230b6Smaya{
10210e230b6Smaya   __gen_validate_value(v);
10310e230b6Smaya#ifndef NDEBUG
10410e230b6Smaya   uint64_t mask = (~0ull >> (64 - (end - start + 1))) << start;
10510e230b6Smaya
10610e230b6Smaya   assert((v & ~mask) == 0);
10710e230b6Smaya#endif
10810e230b6Smaya
10910e230b6Smaya   return v;
11010e230b6Smaya}
11110e230b6Smaya
11210e230b6Smayastatic inline uint32_t
11310e230b6Smaya__gen_float(float v)
11410e230b6Smaya{
11510e230b6Smaya   __gen_validate_value(v);
11610e230b6Smaya   return ((union __gen_value) { .f = (v) }).dw;
11710e230b6Smaya}
11810e230b6Smaya
11910e230b6Smayastatic inline uint64_t
12010e230b6Smaya__gen_sfixed(float v, uint32_t start, uint32_t end, uint32_t fract_bits)
12110e230b6Smaya{
12210e230b6Smaya   __gen_validate_value(v);
12310e230b6Smaya
12410e230b6Smaya   const float factor = (1 << fract_bits);
12510e230b6Smaya
12610e230b6Smaya#ifndef NDEBUG
12710e230b6Smaya   const float max = ((1 << (end - start)) - 1) / factor;
12810e230b6Smaya   const float min = -(1 << (end - start)) / factor;
12910e230b6Smaya   assert(min <= v && v <= max);
13010e230b6Smaya#endif
13110e230b6Smaya
13210e230b6Smaya   const int64_t int_val = llroundf(v * factor);
13310e230b6Smaya   const uint64_t mask = ~0ull >> (64 - (end - start + 1));
13410e230b6Smaya
13510e230b6Smaya   return (int_val & mask) << start;
13610e230b6Smaya}
13710e230b6Smaya
13810e230b6Smayastatic inline uint64_t
13910e230b6Smaya__gen_ufixed(float v, uint32_t start, NDEBUG_UNUSED uint32_t end, uint32_t fract_bits)
14010e230b6Smaya{
14110e230b6Smaya   __gen_validate_value(v);
14210e230b6Smaya
14310e230b6Smaya   const float factor = (1 << fract_bits);
14410e230b6Smaya
14510e230b6Smaya#ifndef NDEBUG
14610e230b6Smaya   const float max = ((1 << (end - start + 1)) - 1) / factor;
14710e230b6Smaya   const float min = 0.0f;
14810e230b6Smaya   assert(min <= v && v <= max);
14910e230b6Smaya#endif
15010e230b6Smaya
15110e230b6Smaya   const uint64_t uint_val = llroundf(v * factor);
15210e230b6Smaya
15310e230b6Smaya   return uint_val << start;
15410e230b6Smaya}
15510e230b6Smaya
15610e230b6Smaya#ifndef __gen_address_type
15710e230b6Smaya#error #define __gen_address_type before including this file
15810e230b6Smaya#endif
15910e230b6Smaya
16010e230b6Smaya#ifndef __gen_user_data
16110e230b6Smaya#error #define __gen_combine_address before including this file
16210e230b6Smaya#endif
16310e230b6Smaya
16410e230b6Smaya#undef NDEBUG_UNUSED
16510e230b6Smaya
16610e230b6Smaya#endif
16710e230b6Smaya
16810e230b6Smaya
16910e230b6Smayaenum GEN7_3D_Color_Buffer_Blend_Factor {
17010e230b6Smaya   BLENDFACTOR_ONE                      =      1,
17110e230b6Smaya   BLENDFACTOR_SRC_COLOR                =      2,
17210e230b6Smaya   BLENDFACTOR_SRC_ALPHA                =      3,
17310e230b6Smaya   BLENDFACTOR_DST_ALPHA                =      4,
17410e230b6Smaya   BLENDFACTOR_DST_COLOR                =      5,
17510e230b6Smaya   BLENDFACTOR_SRC_ALPHA_SATURATE       =      6,
17610e230b6Smaya   BLENDFACTOR_CONST_COLOR              =      7,
17710e230b6Smaya   BLENDFACTOR_CONST_ALPHA              =      8,
17810e230b6Smaya   BLENDFACTOR_SRC1_COLOR               =      9,
17910e230b6Smaya   BLENDFACTOR_SRC1_ALPHA               =     10,
18010e230b6Smaya   BLENDFACTOR_ZERO                     =     17,
18110e230b6Smaya   BLENDFACTOR_INV_SRC_COLOR            =     18,
18210e230b6Smaya   BLENDFACTOR_INV_SRC_ALPHA            =     19,
18310e230b6Smaya   BLENDFACTOR_INV_DST_ALPHA            =     20,
18410e230b6Smaya   BLENDFACTOR_INV_DST_COLOR            =     21,
18510e230b6Smaya   BLENDFACTOR_INV_CONST_COLOR          =     23,
18610e230b6Smaya   BLENDFACTOR_INV_CONST_ALPHA          =     24,
18710e230b6Smaya   BLENDFACTOR_INV_SRC1_COLOR           =     25,
18810e230b6Smaya   BLENDFACTOR_INV_SRC1_ALPHA           =     26,
18910e230b6Smaya};
19010e230b6Smaya
19110e230b6Smayaenum GEN7_3D_Color_Buffer_Blend_Function {
19210e230b6Smaya   BLENDFUNCTION_ADD                    =      0,
19310e230b6Smaya   BLENDFUNCTION_SUBTRACT               =      1,
19410e230b6Smaya   BLENDFUNCTION_REVERSE_SUBTRACT       =      2,
19510e230b6Smaya   BLENDFUNCTION_MIN                    =      3,
19610e230b6Smaya   BLENDFUNCTION_MAX                    =      4,
19710e230b6Smaya};
19810e230b6Smaya
19910e230b6Smayaenum GEN7_3D_Compare_Function {
20010e230b6Smaya   COMPAREFUNCTION_ALWAYS               =      0,
20110e230b6Smaya   COMPAREFUNCTION_NEVER                =      1,
20210e230b6Smaya   COMPAREFUNCTION_LESS                 =      2,
20310e230b6Smaya   COMPAREFUNCTION_EQUAL                =      3,
20410e230b6Smaya   COMPAREFUNCTION_LEQUAL               =      4,
20510e230b6Smaya   COMPAREFUNCTION_GREATER              =      5,
20610e230b6Smaya   COMPAREFUNCTION_NOTEQUAL             =      6,
20710e230b6Smaya   COMPAREFUNCTION_GEQUAL               =      7,
20810e230b6Smaya};
20910e230b6Smaya
21010e230b6Smayaenum GEN7_3D_Logic_Op_Function {
21110e230b6Smaya   LOGICOP_CLEAR                        =      0,
21210e230b6Smaya   LOGICOP_NOR                          =      1,
21310e230b6Smaya   LOGICOP_AND_INVERTED                 =      2,
21410e230b6Smaya   LOGICOP_COPY_INVERTED                =      3,
21510e230b6Smaya   LOGICOP_AND_REVERSE                  =      4,
21610e230b6Smaya   LOGICOP_INVERT                       =      5,
21710e230b6Smaya   LOGICOP_XOR                          =      6,
21810e230b6Smaya   LOGICOP_NAND                         =      7,
21910e230b6Smaya   LOGICOP_AND                          =      8,
22010e230b6Smaya   LOGICOP_EQUIV                        =      9,
22110e230b6Smaya   LOGICOP_NOOP                         =     10,
22210e230b6Smaya   LOGICOP_OR_INVERTED                  =     11,
22310e230b6Smaya   LOGICOP_COPY                         =     12,
22410e230b6Smaya   LOGICOP_OR_REVERSE                   =     13,
22510e230b6Smaya   LOGICOP_OR                           =     14,
22610e230b6Smaya   LOGICOP_SET                          =     15,
22710e230b6Smaya};
22810e230b6Smaya
22910e230b6Smayaenum GEN7_3D_Prim_Topo_Type {
23010e230b6Smaya   _3DPRIM_POINTLIST                    =      1,
23110e230b6Smaya   _3DPRIM_LINELIST                     =      2,
23210e230b6Smaya   _3DPRIM_LINESTRIP                    =      3,
23310e230b6Smaya   _3DPRIM_TRILIST                      =      4,
23410e230b6Smaya   _3DPRIM_TRISTRIP                     =      5,
23510e230b6Smaya   _3DPRIM_TRIFAN                       =      6,
23610e230b6Smaya   _3DPRIM_QUADLIST                     =      7,
23710e230b6Smaya   _3DPRIM_QUADSTRIP                    =      8,
23810e230b6Smaya   _3DPRIM_LINELIST_ADJ                 =      9,
23910e230b6Smaya   _3DPRIM_LINESTRIP_ADJ                =     10,
24010e230b6Smaya   _3DPRIM_TRILIST_ADJ                  =     11,
24110e230b6Smaya   _3DPRIM_TRISTRIP_ADJ                 =     12,
24210e230b6Smaya   _3DPRIM_TRISTRIP_REVERSE             =     13,
24310e230b6Smaya   _3DPRIM_POLYGON                      =     14,
24410e230b6Smaya   _3DPRIM_RECTLIST                     =     15,
24510e230b6Smaya   _3DPRIM_LINELOOP                     =     16,
24610e230b6Smaya   _3DPRIM_POINTLIST_BF                 =     17,
24710e230b6Smaya   _3DPRIM_LINESTRIP_CONT               =     18,
24810e230b6Smaya   _3DPRIM_LINESTRIP_BF                 =     19,
24910e230b6Smaya   _3DPRIM_LINESTRIP_CONT_BF            =     20,
25010e230b6Smaya   _3DPRIM_TRIFAN_NOSTIPPLE             =     22,
25110e230b6Smaya   _3DPRIM_PATCHLIST_1                  =     32,
25210e230b6Smaya   _3DPRIM_PATCHLIST_2                  =     33,
25310e230b6Smaya   _3DPRIM_PATCHLIST_3                  =     34,
25410e230b6Smaya   _3DPRIM_PATCHLIST_4                  =     35,
25510e230b6Smaya   _3DPRIM_PATCHLIST_5                  =     36,
25610e230b6Smaya   _3DPRIM_PATCHLIST_6                  =     37,
25710e230b6Smaya   _3DPRIM_PATCHLIST_7                  =     38,
25810e230b6Smaya   _3DPRIM_PATCHLIST_8                  =     39,
25910e230b6Smaya   _3DPRIM_PATCHLIST_9                  =     40,
26010e230b6Smaya   _3DPRIM_PATCHLIST_10                 =     41,
26110e230b6Smaya   _3DPRIM_PATCHLIST_11                 =     42,
26210e230b6Smaya   _3DPRIM_PATCHLIST_12                 =     43,
26310e230b6Smaya   _3DPRIM_PATCHLIST_13                 =     44,
26410e230b6Smaya   _3DPRIM_PATCHLIST_14                 =     45,
26510e230b6Smaya   _3DPRIM_PATCHLIST_15                 =     46,
26610e230b6Smaya   _3DPRIM_PATCHLIST_16                 =     47,
26710e230b6Smaya   _3DPRIM_PATCHLIST_17                 =     48,
26810e230b6Smaya   _3DPRIM_PATCHLIST_18                 =     49,
26910e230b6Smaya   _3DPRIM_PATCHLIST_19                 =     50,
27010e230b6Smaya   _3DPRIM_PATCHLIST_20                 =     51,
27110e230b6Smaya   _3DPRIM_PATCHLIST_21                 =     52,
27210e230b6Smaya   _3DPRIM_PATCHLIST_22                 =     53,
27310e230b6Smaya   _3DPRIM_PATCHLIST_23                 =     54,
27410e230b6Smaya   _3DPRIM_PATCHLIST_24                 =     55,
27510e230b6Smaya   _3DPRIM_PATCHLIST_25                 =     56,
27610e230b6Smaya   _3DPRIM_PATCHLIST_26                 =     57,
27710e230b6Smaya   _3DPRIM_PATCHLIST_27                 =     58,
27810e230b6Smaya   _3DPRIM_PATCHLIST_28                 =     59,
27910e230b6Smaya   _3DPRIM_PATCHLIST_29                 =     60,
28010e230b6Smaya   _3DPRIM_PATCHLIST_30                 =     61,
28110e230b6Smaya   _3DPRIM_PATCHLIST_31                 =     62,
28210e230b6Smaya   _3DPRIM_PATCHLIST_32                 =     63,
28310e230b6Smaya};
28410e230b6Smaya
28510e230b6Smayaenum GEN7_3D_Stencil_Operation {
28610e230b6Smaya   STENCILOP_KEEP                       =      0,
28710e230b6Smaya   STENCILOP_ZERO                       =      1,
28810e230b6Smaya   STENCILOP_REPLACE                    =      2,
28910e230b6Smaya   STENCILOP_INCRSAT                    =      3,
29010e230b6Smaya   STENCILOP_DECRSAT                    =      4,
29110e230b6Smaya   STENCILOP_INCR                       =      5,
29210e230b6Smaya   STENCILOP_DECR                       =      6,
29310e230b6Smaya   STENCILOP_INVERT                     =      7,
29410e230b6Smaya};
29510e230b6Smaya
29610e230b6Smayaenum GEN7_3D_Vertex_Component_Control {
29710e230b6Smaya   VFCOMP_NOSTORE                       =      0,
29810e230b6Smaya   VFCOMP_STORE_SRC                     =      1,
29910e230b6Smaya   VFCOMP_STORE_0                       =      2,
30010e230b6Smaya   VFCOMP_STORE_1_FP                    =      3,
30110e230b6Smaya   VFCOMP_STORE_1_INT                   =      4,
30210e230b6Smaya   VFCOMP_STORE_VID                     =      5,
30310e230b6Smaya   VFCOMP_STORE_IID                     =      6,
30410e230b6Smaya   VFCOMP_STORE_PID                     =      7,
30510e230b6Smaya};
30610e230b6Smaya
30710e230b6Smayaenum GEN7_TextureCoordinateMode {
30810e230b6Smaya   TCM_WRAP                             =      0,
30910e230b6Smaya   TCM_MIRROR                           =      1,
31010e230b6Smaya   TCM_CLAMP                            =      2,
31110e230b6Smaya   TCM_CUBE                             =      3,
31210e230b6Smaya   TCM_CLAMP_BORDER                     =      4,
31310e230b6Smaya   TCM_MIRROR_ONCE                      =      5,
31410e230b6Smaya};
31510e230b6Smaya
31610e230b6Smaya#define GEN7_3DSTATE_CONSTANT_BODY_length      6
31710e230b6Smayastruct GEN7_3DSTATE_CONSTANT_BODY {
31810e230b6Smaya   uint32_t                             ReadLength[4];
31910e230b6Smaya   uint32_t                             MOCS;
32010e230b6Smaya   __gen_address_type                   Buffer[4];
32110e230b6Smaya};
32210e230b6Smaya
32310e230b6Smayastatic inline void
32410e230b6SmayaGEN7_3DSTATE_CONSTANT_BODY_pack(__attribute__((unused)) __gen_user_data *data,
32510e230b6Smaya                                __attribute__((unused)) void * restrict dst,
32610e230b6Smaya                                __attribute__((unused)) const struct GEN7_3DSTATE_CONSTANT_BODY * restrict values)
32710e230b6Smaya{
32810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
32910e230b6Smaya
33010e230b6Smaya   dw[0] =
33110e230b6Smaya      __gen_uint(values->ReadLength[0], 0, 15) |
33210e230b6Smaya      __gen_uint(values->ReadLength[1], 16, 31);
33310e230b6Smaya
33410e230b6Smaya   dw[1] =
33510e230b6Smaya      __gen_uint(values->ReadLength[2], 0, 15) |
33610e230b6Smaya      __gen_uint(values->ReadLength[3], 16, 31);
33710e230b6Smaya
33810e230b6Smaya   const uint32_t v2 =
33910e230b6Smaya      __gen_uint(values->MOCS, 0, 4);
34010e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->Buffer[0], v2);
34110e230b6Smaya
34210e230b6Smaya   dw[3] = __gen_combine_address(data, &dw[3], values->Buffer[1], 0);
34310e230b6Smaya
34410e230b6Smaya   dw[4] = __gen_combine_address(data, &dw[4], values->Buffer[2], 0);
34510e230b6Smaya
34610e230b6Smaya   dw[5] = __gen_combine_address(data, &dw[5], values->Buffer[3], 0);
34710e230b6Smaya}
34810e230b6Smaya
34910e230b6Smaya#define GEN7_BINDING_TABLE_STATE_length        1
35010e230b6Smayastruct GEN7_BINDING_TABLE_STATE {
35110e230b6Smaya   uint64_t                             SurfaceStatePointer;
35210e230b6Smaya};
35310e230b6Smaya
35410e230b6Smayastatic inline void
35510e230b6SmayaGEN7_BINDING_TABLE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
35610e230b6Smaya                              __attribute__((unused)) void * restrict dst,
35710e230b6Smaya                              __attribute__((unused)) const struct GEN7_BINDING_TABLE_STATE * restrict values)
35810e230b6Smaya{
35910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
36010e230b6Smaya
36110e230b6Smaya   dw[0] =
36210e230b6Smaya      __gen_offset(values->SurfaceStatePointer, 5, 31);
36310e230b6Smaya}
36410e230b6Smaya
36510e230b6Smaya#define GEN7_BLEND_STATE_ENTRY_length          2
36610e230b6Smayastruct GEN7_BLEND_STATE_ENTRY {
36710e230b6Smaya   enum GEN7_3D_Color_Buffer_Blend_Factor DestinationBlendFactor;
36810e230b6Smaya   enum GEN7_3D_Color_Buffer_Blend_Factor SourceBlendFactor;
36910e230b6Smaya   enum GEN7_3D_Color_Buffer_Blend_Function ColorBlendFunction;
37010e230b6Smaya   enum GEN7_3D_Color_Buffer_Blend_Factor DestinationAlphaBlendFactor;
37110e230b6Smaya   enum GEN7_3D_Color_Buffer_Blend_Factor SourceAlphaBlendFactor;
37210e230b6Smaya   enum GEN7_3D_Color_Buffer_Blend_Function AlphaBlendFunction;
37310e230b6Smaya   bool                                 IndependentAlphaBlendEnable;
37410e230b6Smaya   bool                                 ColorBufferBlendEnable;
37510e230b6Smaya   bool                                 PostBlendColorClampEnable;
37610e230b6Smaya   bool                                 PreBlendColorClampEnable;
37710e230b6Smaya   uint32_t                             ColorClampRange;
37810e230b6Smaya#define COLORCLAMP_UNORM                         0
37910e230b6Smaya#define COLORCLAMP_SNORM                         1
38010e230b6Smaya#define COLORCLAMP_RTFORMAT                      2
38110e230b6Smaya   uint32_t                             YDitherOffset;
38210e230b6Smaya   uint32_t                             XDitherOffset;
38310e230b6Smaya   bool                                 ColorDitherEnable;
38410e230b6Smaya   enum GEN7_3D_Compare_Function        AlphaTestFunction;
38510e230b6Smaya   bool                                 AlphaTestEnable;
38610e230b6Smaya   enum GEN7_3D_Logic_Op_Function       LogicOpFunction;
38710e230b6Smaya   bool                                 LogicOpEnable;
38810e230b6Smaya   bool                                 WriteDisableBlue;
38910e230b6Smaya   bool                                 WriteDisableGreen;
39010e230b6Smaya   bool                                 WriteDisableRed;
39110e230b6Smaya   bool                                 WriteDisableAlpha;
39210e230b6Smaya   bool                                 AlphaToCoverageDitherEnable;
39310e230b6Smaya   bool                                 AlphaToOneEnable;
39410e230b6Smaya   bool                                 AlphaToCoverageEnable;
39510e230b6Smaya};
39610e230b6Smaya
39710e230b6Smayastatic inline void
39810e230b6SmayaGEN7_BLEND_STATE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
39910e230b6Smaya                            __attribute__((unused)) void * restrict dst,
40010e230b6Smaya                            __attribute__((unused)) const struct GEN7_BLEND_STATE_ENTRY * restrict values)
40110e230b6Smaya{
40210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
40310e230b6Smaya
40410e230b6Smaya   dw[0] =
40510e230b6Smaya      __gen_uint(values->DestinationBlendFactor, 0, 4) |
40610e230b6Smaya      __gen_uint(values->SourceBlendFactor, 5, 9) |
40710e230b6Smaya      __gen_uint(values->ColorBlendFunction, 11, 13) |
40810e230b6Smaya      __gen_uint(values->DestinationAlphaBlendFactor, 15, 19) |
40910e230b6Smaya      __gen_uint(values->SourceAlphaBlendFactor, 20, 24) |
41010e230b6Smaya      __gen_uint(values->AlphaBlendFunction, 26, 28) |
41110e230b6Smaya      __gen_uint(values->IndependentAlphaBlendEnable, 30, 30) |
41210e230b6Smaya      __gen_uint(values->ColorBufferBlendEnable, 31, 31);
41310e230b6Smaya
41410e230b6Smaya   dw[1] =
41510e230b6Smaya      __gen_uint(values->PostBlendColorClampEnable, 0, 0) |
41610e230b6Smaya      __gen_uint(values->PreBlendColorClampEnable, 1, 1) |
41710e230b6Smaya      __gen_uint(values->ColorClampRange, 2, 3) |
41810e230b6Smaya      __gen_uint(values->YDitherOffset, 8, 9) |
41910e230b6Smaya      __gen_uint(values->XDitherOffset, 10, 11) |
42010e230b6Smaya      __gen_uint(values->ColorDitherEnable, 12, 12) |
42110e230b6Smaya      __gen_uint(values->AlphaTestFunction, 13, 15) |
42210e230b6Smaya      __gen_uint(values->AlphaTestEnable, 16, 16) |
42310e230b6Smaya      __gen_uint(values->LogicOpFunction, 18, 21) |
42410e230b6Smaya      __gen_uint(values->LogicOpEnable, 22, 22) |
42510e230b6Smaya      __gen_uint(values->WriteDisableBlue, 24, 24) |
42610e230b6Smaya      __gen_uint(values->WriteDisableGreen, 25, 25) |
42710e230b6Smaya      __gen_uint(values->WriteDisableRed, 26, 26) |
42810e230b6Smaya      __gen_uint(values->WriteDisableAlpha, 27, 27) |
42910e230b6Smaya      __gen_uint(values->AlphaToCoverageDitherEnable, 29, 29) |
43010e230b6Smaya      __gen_uint(values->AlphaToOneEnable, 30, 30) |
43110e230b6Smaya      __gen_uint(values->AlphaToCoverageEnable, 31, 31);
43210e230b6Smaya}
43310e230b6Smaya
43410e230b6Smaya#define GEN7_BLEND_STATE_length                0
43510e230b6Smayastruct GEN7_BLEND_STATE {
43610e230b6Smaya   /* variable length fields follow */
43710e230b6Smaya};
43810e230b6Smaya
43910e230b6Smayastatic inline void
44010e230b6SmayaGEN7_BLEND_STATE_pack(__attribute__((unused)) __gen_user_data *data,
44110e230b6Smaya                      __attribute__((unused)) void * restrict dst,
44210e230b6Smaya                      __attribute__((unused)) const struct GEN7_BLEND_STATE * restrict values)
44310e230b6Smaya{
44410e230b6Smaya}
44510e230b6Smaya
44610e230b6Smaya#define GEN7_CC_VIEWPORT_length                2
44710e230b6Smayastruct GEN7_CC_VIEWPORT {
44810e230b6Smaya   float                                MinimumDepth;
44910e230b6Smaya   float                                MaximumDepth;
45010e230b6Smaya};
45110e230b6Smaya
45210e230b6Smayastatic inline void
45310e230b6SmayaGEN7_CC_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
45410e230b6Smaya                      __attribute__((unused)) void * restrict dst,
45510e230b6Smaya                      __attribute__((unused)) const struct GEN7_CC_VIEWPORT * restrict values)
45610e230b6Smaya{
45710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
45810e230b6Smaya
45910e230b6Smaya   dw[0] =
46010e230b6Smaya      __gen_float(values->MinimumDepth);
46110e230b6Smaya
46210e230b6Smaya   dw[1] =
46310e230b6Smaya      __gen_float(values->MaximumDepth);
46410e230b6Smaya}
46510e230b6Smaya
46610e230b6Smaya#define GEN7_COLOR_CALC_STATE_length           6
46710e230b6Smayastruct GEN7_COLOR_CALC_STATE {
46810e230b6Smaya   uint32_t                             AlphaTestFormat;
46910e230b6Smaya#define ALPHATEST_UNORM8                         0
47010e230b6Smaya#define ALPHATEST_FLOAT32                        1
47110e230b6Smaya   bool                                 RoundDisableFunctionDisable;
47210e230b6Smaya   uint32_t                             BackfaceStencilReferenceValue;
47310e230b6Smaya   uint32_t                             StencilReferenceValue;
47410e230b6Smaya   uint32_t                             AlphaReferenceValueAsUNORM8;
47510e230b6Smaya   float                                AlphaReferenceValueAsFLOAT32;
47610e230b6Smaya   float                                BlendConstantColorRed;
47710e230b6Smaya   float                                BlendConstantColorGreen;
47810e230b6Smaya   float                                BlendConstantColorBlue;
47910e230b6Smaya   float                                BlendConstantColorAlpha;
48010e230b6Smaya};
48110e230b6Smaya
48210e230b6Smayastatic inline void
48310e230b6SmayaGEN7_COLOR_CALC_STATE_pack(__attribute__((unused)) __gen_user_data *data,
48410e230b6Smaya                           __attribute__((unused)) void * restrict dst,
48510e230b6Smaya                           __attribute__((unused)) const struct GEN7_COLOR_CALC_STATE * restrict values)
48610e230b6Smaya{
48710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
48810e230b6Smaya
48910e230b6Smaya   dw[0] =
49010e230b6Smaya      __gen_uint(values->AlphaTestFormat, 0, 0) |
49110e230b6Smaya      __gen_uint(values->RoundDisableFunctionDisable, 15, 15) |
49210e230b6Smaya      __gen_uint(values->BackfaceStencilReferenceValue, 16, 23) |
49310e230b6Smaya      __gen_uint(values->StencilReferenceValue, 24, 31);
49410e230b6Smaya
49510e230b6Smaya   dw[1] =
49610e230b6Smaya      __gen_uint(values->AlphaReferenceValueAsUNORM8, 0, 31) |
49710e230b6Smaya      __gen_float(values->AlphaReferenceValueAsFLOAT32);
49810e230b6Smaya
49910e230b6Smaya   dw[2] =
50010e230b6Smaya      __gen_float(values->BlendConstantColorRed);
50110e230b6Smaya
50210e230b6Smaya   dw[3] =
50310e230b6Smaya      __gen_float(values->BlendConstantColorGreen);
50410e230b6Smaya
50510e230b6Smaya   dw[4] =
50610e230b6Smaya      __gen_float(values->BlendConstantColorBlue);
50710e230b6Smaya
50810e230b6Smaya   dw[5] =
50910e230b6Smaya      __gen_float(values->BlendConstantColorAlpha);
51010e230b6Smaya}
51110e230b6Smaya
51210e230b6Smaya#define GEN7_DEPTH_STENCIL_STATE_length        3
51310e230b6Smayastruct GEN7_DEPTH_STENCIL_STATE {
51410e230b6Smaya   enum GEN7_3D_Stencil_Operation       BackfaceStencilPassDepthPassOp;
51510e230b6Smaya   enum GEN7_3D_Stencil_Operation       BackfaceStencilPassDepthFailOp;
51610e230b6Smaya   enum GEN7_3D_Stencil_Operation       BackfaceStencilFailOp;
51710e230b6Smaya   enum GEN7_3D_Compare_Function        BackfaceStencilTestFunction;
51810e230b6Smaya   bool                                 DoubleSidedStencilEnable;
51910e230b6Smaya   bool                                 StencilBufferWriteEnable;
52010e230b6Smaya   enum GEN7_3D_Stencil_Operation       StencilPassDepthPassOp;
52110e230b6Smaya   enum GEN7_3D_Stencil_Operation       StencilPassDepthFailOp;
52210e230b6Smaya   enum GEN7_3D_Stencil_Operation       StencilFailOp;
52310e230b6Smaya   enum GEN7_3D_Compare_Function        StencilTestFunction;
52410e230b6Smaya   bool                                 StencilTestEnable;
52510e230b6Smaya   uint32_t                             BackfaceStencilWriteMask;
52610e230b6Smaya   uint32_t                             BackfaceStencilTestMask;
52710e230b6Smaya   uint32_t                             StencilWriteMask;
52810e230b6Smaya   uint32_t                             StencilTestMask;
52910e230b6Smaya   bool                                 DepthBufferWriteEnable;
53010e230b6Smaya   enum GEN7_3D_Compare_Function        DepthTestFunction;
53110e230b6Smaya   bool                                 DepthTestEnable;
53210e230b6Smaya};
53310e230b6Smaya
53410e230b6Smayastatic inline void
53510e230b6SmayaGEN7_DEPTH_STENCIL_STATE_pack(__attribute__((unused)) __gen_user_data *data,
53610e230b6Smaya                              __attribute__((unused)) void * restrict dst,
53710e230b6Smaya                              __attribute__((unused)) const struct GEN7_DEPTH_STENCIL_STATE * restrict values)
53810e230b6Smaya{
53910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
54010e230b6Smaya
54110e230b6Smaya   dw[0] =
54210e230b6Smaya      __gen_uint(values->BackfaceStencilPassDepthPassOp, 3, 5) |
54310e230b6Smaya      __gen_uint(values->BackfaceStencilPassDepthFailOp, 6, 8) |
54410e230b6Smaya      __gen_uint(values->BackfaceStencilFailOp, 9, 11) |
54510e230b6Smaya      __gen_uint(values->BackfaceStencilTestFunction, 12, 14) |
54610e230b6Smaya      __gen_uint(values->DoubleSidedStencilEnable, 15, 15) |
54710e230b6Smaya      __gen_uint(values->StencilBufferWriteEnable, 18, 18) |
54810e230b6Smaya      __gen_uint(values->StencilPassDepthPassOp, 19, 21) |
54910e230b6Smaya      __gen_uint(values->StencilPassDepthFailOp, 22, 24) |
55010e230b6Smaya      __gen_uint(values->StencilFailOp, 25, 27) |
55110e230b6Smaya      __gen_uint(values->StencilTestFunction, 28, 30) |
55210e230b6Smaya      __gen_uint(values->StencilTestEnable, 31, 31);
55310e230b6Smaya
55410e230b6Smaya   dw[1] =
55510e230b6Smaya      __gen_uint(values->BackfaceStencilWriteMask, 0, 7) |
55610e230b6Smaya      __gen_uint(values->BackfaceStencilTestMask, 8, 15) |
55710e230b6Smaya      __gen_uint(values->StencilWriteMask, 16, 23) |
55810e230b6Smaya      __gen_uint(values->StencilTestMask, 24, 31);
55910e230b6Smaya
56010e230b6Smaya   dw[2] =
56110e230b6Smaya      __gen_uint(values->DepthBufferWriteEnable, 26, 26) |
56210e230b6Smaya      __gen_uint(values->DepthTestFunction, 27, 29) |
56310e230b6Smaya      __gen_uint(values->DepthTestEnable, 31, 31);
56410e230b6Smaya}
56510e230b6Smaya
56610e230b6Smaya#define GEN7_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT_length      2
56710e230b6Smayastruct GEN7_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT {
56810e230b6Smaya   bool                                 MBErrorConcealmentPSliceWeightPredictionDisable;
56910e230b6Smaya   bool                                 MBErrorConcealmentPSliceMotionVectorsOverrideDisable;
57010e230b6Smaya   bool                                 MBErrorConcealmentPSliceReferenceIndexOverrideDisable;
57110e230b6Smaya   bool                                 MBErrorConcealmentBSpatialWeightPredictionDisable;
57210e230b6Smaya   bool                                 MBErrorConcealmentBSpatialMotionVectorsOverrideDisable;
57310e230b6Smaya   bool                                 MBErrorConcealmentBSpatialReferenceIndexOverrideDisable;
57410e230b6Smaya   uint32_t                             MBErrorConcealmentBSpatialPredictionMode;
57510e230b6Smaya   bool                                 MBHeaderErrorHandling;
57610e230b6Smaya   bool                                 EntropyErrorHandling;
57710e230b6Smaya   bool                                 MPRErrorHandling;
57810e230b6Smaya   bool                                 BSDPrematureCompleteErrorHandling;
57910e230b6Smaya   uint32_t                             ConcealmentPictureID;
58010e230b6Smaya   bool                                 MBErrorConcealmentBTemporalWeightPredictionDisable;
58110e230b6Smaya   bool                                 MBErrorConcealmentBTemporalMotionVectorsOverrideEnable;
58210e230b6Smaya   bool                                 MBErrorConcealmentBTemporalReferenceIndexOverrideEnable;
58310e230b6Smaya   uint32_t                             MBErrorConcealmentBTemporalPredictionMode;
58410e230b6Smaya   bool                                 InitCurrentMBNumber;
58510e230b6Smaya   uint32_t                             ConcealmentMethod;
58610e230b6Smaya   uint32_t                             FirstMBBitOffset;
58710e230b6Smaya   bool                                 LastSlice;
58810e230b6Smaya   bool                                 EmulationPreventionBytePresent;
58910e230b6Smaya   bool                                 FixPrevMBSkipped;
59010e230b6Smaya   uint32_t                             FirstMBByteOffsetofSliceDataorSliceHeader;
59110e230b6Smaya};
59210e230b6Smaya
59310e230b6Smayastatic inline void
59410e230b6SmayaGEN7_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
59510e230b6Smaya                                                         __attribute__((unused)) void * restrict dst,
59610e230b6Smaya                                                         __attribute__((unused)) const struct GEN7_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT * restrict values)
59710e230b6Smaya{
59810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
59910e230b6Smaya
60010e230b6Smaya   dw[0] =
60110e230b6Smaya      __gen_uint(values->MBErrorConcealmentPSliceWeightPredictionDisable, 0, 0) |
60210e230b6Smaya      __gen_uint(values->MBErrorConcealmentPSliceMotionVectorsOverrideDisable, 1, 1) |
60310e230b6Smaya      __gen_uint(values->MBErrorConcealmentPSliceReferenceIndexOverrideDisable, 2, 2) |
60410e230b6Smaya      __gen_uint(values->MBErrorConcealmentBSpatialWeightPredictionDisable, 3, 3) |
60510e230b6Smaya      __gen_uint(values->MBErrorConcealmentBSpatialMotionVectorsOverrideDisable, 4, 4) |
60610e230b6Smaya      __gen_uint(values->MBErrorConcealmentBSpatialReferenceIndexOverrideDisable, 5, 5) |
60710e230b6Smaya      __gen_uint(values->MBErrorConcealmentBSpatialPredictionMode, 6, 7) |
60810e230b6Smaya      __gen_uint(values->MBHeaderErrorHandling, 8, 8) |
60910e230b6Smaya      __gen_uint(values->EntropyErrorHandling, 10, 10) |
61010e230b6Smaya      __gen_uint(values->MPRErrorHandling, 12, 12) |
61110e230b6Smaya      __gen_uint(values->BSDPrematureCompleteErrorHandling, 14, 14) |
61210e230b6Smaya      __gen_uint(values->ConcealmentPictureID, 16, 21) |
61310e230b6Smaya      __gen_uint(values->MBErrorConcealmentBTemporalWeightPredictionDisable, 24, 24) |
61410e230b6Smaya      __gen_uint(values->MBErrorConcealmentBTemporalMotionVectorsOverrideEnable, 25, 25) |
61510e230b6Smaya      __gen_uint(values->MBErrorConcealmentBTemporalReferenceIndexOverrideEnable, 26, 26) |
61610e230b6Smaya      __gen_uint(values->MBErrorConcealmentBTemporalPredictionMode, 27, 28) |
61710e230b6Smaya      __gen_uint(values->InitCurrentMBNumber, 30, 30) |
61810e230b6Smaya      __gen_uint(values->ConcealmentMethod, 31, 31);
61910e230b6Smaya
62010e230b6Smaya   dw[1] =
62110e230b6Smaya      __gen_uint(values->FirstMBBitOffset, 0, 2) |
62210e230b6Smaya      __gen_uint(values->LastSlice, 3, 3) |
62310e230b6Smaya      __gen_uint(values->EmulationPreventionBytePresent, 4, 4) |
62410e230b6Smaya      __gen_uint(values->FixPrevMBSkipped, 7, 7) |
62510e230b6Smaya      __gen_uint(values->FirstMBByteOffsetofSliceDataorSliceHeader, 16, 31);
62610e230b6Smaya}
62710e230b6Smaya
62810e230b6Smaya#define GEN7_INTERFACE_DESCRIPTOR_DATA_length      8
62910e230b6Smayastruct GEN7_INTERFACE_DESCRIPTOR_DATA {
63010e230b6Smaya   uint64_t                             KernelStartPointer;
63110e230b6Smaya   bool                                 SoftwareExceptionEnable;
63210e230b6Smaya   bool                                 MaskStackExceptionEnable;
63310e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
63410e230b6Smaya   uint32_t                             FloatingPointMode;
63510e230b6Smaya#define IEEE754                                  0
63610e230b6Smaya#define Alternate                                1
63710e230b6Smaya   uint32_t                             ThreadPriority;
63810e230b6Smaya#define NormalPriority                           0
63910e230b6Smaya#define HighPriority                             1
64010e230b6Smaya   bool                                 SingleProgramFlow;
64110e230b6Smaya   uint32_t                             SamplerCount;
64210e230b6Smaya#define Nosamplersused                           0
64310e230b6Smaya#define Between1and4samplersused                 1
64410e230b6Smaya#define Between5and8samplersused                 2
64510e230b6Smaya#define Between9and12samplersused                3
64610e230b6Smaya#define Between13and16samplersused               4
64710e230b6Smaya   uint64_t                             SamplerStatePointer;
64810e230b6Smaya   uint32_t                             BindingTableEntryCount;
64910e230b6Smaya   uint64_t                             BindingTablePointer;
65010e230b6Smaya   uint32_t                             ConstantURBEntryReadOffset;
65110e230b6Smaya   uint32_t                             ConstantURBEntryReadLength;
65210e230b6Smaya   uint32_t                             NumberofThreadsinGPGPUThreadGroup;
65310e230b6Smaya   uint32_t                             SharedLocalMemorySize;
65410e230b6Smaya   bool                                 BarrierEnable;
65510e230b6Smaya   uint32_t                             RoundingMode;
65610e230b6Smaya#define RTNE                                     0
65710e230b6Smaya#define RU                                       1
65810e230b6Smaya#define RD                                       2
65910e230b6Smaya#define RTZ                                      3
66010e230b6Smaya};
66110e230b6Smaya
66210e230b6Smayastatic inline void
66310e230b6SmayaGEN7_INTERFACE_DESCRIPTOR_DATA_pack(__attribute__((unused)) __gen_user_data *data,
66410e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
66510e230b6Smaya                                    __attribute__((unused)) const struct GEN7_INTERFACE_DESCRIPTOR_DATA * restrict values)
66610e230b6Smaya{
66710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
66810e230b6Smaya
66910e230b6Smaya   dw[0] =
67010e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 31);
67110e230b6Smaya
67210e230b6Smaya   dw[1] =
67310e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
67410e230b6Smaya      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
67510e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
67610e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
67710e230b6Smaya      __gen_uint(values->ThreadPriority, 17, 17) |
67810e230b6Smaya      __gen_uint(values->SingleProgramFlow, 18, 18);
67910e230b6Smaya
68010e230b6Smaya   dw[2] =
68110e230b6Smaya      __gen_uint(values->SamplerCount, 2, 4) |
68210e230b6Smaya      __gen_offset(values->SamplerStatePointer, 5, 31);
68310e230b6Smaya
68410e230b6Smaya   dw[3] =
68510e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 0, 4) |
68610e230b6Smaya      __gen_offset(values->BindingTablePointer, 5, 15);
68710e230b6Smaya
68810e230b6Smaya   dw[4] =
68910e230b6Smaya      __gen_uint(values->ConstantURBEntryReadOffset, 0, 15) |
69010e230b6Smaya      __gen_uint(values->ConstantURBEntryReadLength, 16, 31);
69110e230b6Smaya
69210e230b6Smaya   dw[5] =
69310e230b6Smaya      __gen_uint(values->NumberofThreadsinGPGPUThreadGroup, 0, 7) |
69410e230b6Smaya      __gen_uint(values->SharedLocalMemorySize, 16, 20) |
69510e230b6Smaya      __gen_uint(values->BarrierEnable, 21, 21) |
69610e230b6Smaya      __gen_uint(values->RoundingMode, 22, 23);
69710e230b6Smaya
69810e230b6Smaya   dw[6] = 0;
69910e230b6Smaya
70010e230b6Smaya   dw[7] = 0;
70110e230b6Smaya}
70210e230b6Smaya
70310e230b6Smaya#define GEN7_MEMORY_OBJECT_CONTROL_STATE_length      1
70410e230b6Smayastruct GEN7_MEMORY_OBJECT_CONTROL_STATE {
70510e230b6Smaya   uint32_t                             L3CacheabilityControlL3CC;
70610e230b6Smaya   uint32_t                             LLCCacheabilityControlLLCCC;
70710e230b6Smaya   uint32_t                             GraphicsDataTypeGFDT;
70810e230b6Smaya};
70910e230b6Smaya
71010e230b6Smayastatic inline void
71110e230b6SmayaGEN7_MEMORY_OBJECT_CONTROL_STATE_pack(__attribute__((unused)) __gen_user_data *data,
71210e230b6Smaya                                      __attribute__((unused)) void * restrict dst,
71310e230b6Smaya                                      __attribute__((unused)) const struct GEN7_MEMORY_OBJECT_CONTROL_STATE * restrict values)
71410e230b6Smaya{
71510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
71610e230b6Smaya
71710e230b6Smaya   dw[0] =
71810e230b6Smaya      __gen_uint(values->L3CacheabilityControlL3CC, 0, 0) |
71910e230b6Smaya      __gen_uint(values->LLCCacheabilityControlLLCCC, 1, 1) |
72010e230b6Smaya      __gen_uint(values->GraphicsDataTypeGFDT, 2, 2);
72110e230b6Smaya}
72210e230b6Smaya
72310e230b6Smaya#define GEN7_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION_length      2
72410e230b6Smayastruct GEN7_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION {
72510e230b6Smaya   uint32_t                             FirstMBBitOffset;
72610e230b6Smaya   bool                                 LastMB;
72710e230b6Smaya   bool                                 LastPicSlice;
72810e230b6Smaya   uint32_t                             MBCount;
72910e230b6Smaya   uint32_t                             SliceVerticalPosition;
73010e230b6Smaya   uint32_t                             SliceHorizontalPosition;
73110e230b6Smaya   uint32_t                             QuantizerScaleCode;
73210e230b6Smaya};
73310e230b6Smaya
73410e230b6Smayastatic inline void
73510e230b6SmayaGEN7_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION_pack(__attribute__((unused)) __gen_user_data *data,
73610e230b6Smaya                                                       __attribute__((unused)) void * restrict dst,
73710e230b6Smaya                                                       __attribute__((unused)) const struct GEN7_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION * restrict values)
73810e230b6Smaya{
73910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
74010e230b6Smaya
74110e230b6Smaya   dw[0] =
74210e230b6Smaya      __gen_uint(values->FirstMBBitOffset, 0, 2) |
74310e230b6Smaya      __gen_uint(values->LastMB, 3, 3) |
74410e230b6Smaya      __gen_uint(values->LastPicSlice, 5, 5) |
74510e230b6Smaya      __gen_uint(values->MBCount, 8, 14) |
74610e230b6Smaya      __gen_uint(values->SliceVerticalPosition, 16, 22) |
74710e230b6Smaya      __gen_uint(values->SliceHorizontalPosition, 24, 30);
74810e230b6Smaya
74910e230b6Smaya   dw[1] =
75010e230b6Smaya      __gen_uint(values->QuantizerScaleCode, 24, 28);
75110e230b6Smaya}
75210e230b6Smaya
75310e230b6Smaya#define GEN7_PALETTE_ENTRY_length              1
75410e230b6Smayastruct GEN7_PALETTE_ENTRY {
75510e230b6Smaya   uint32_t                             Blue;
75610e230b6Smaya   uint32_t                             Green;
75710e230b6Smaya   uint32_t                             Red;
75810e230b6Smaya   uint32_t                             Alpha;
75910e230b6Smaya};
76010e230b6Smaya
76110e230b6Smayastatic inline void
76210e230b6SmayaGEN7_PALETTE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
76310e230b6Smaya                        __attribute__((unused)) void * restrict dst,
76410e230b6Smaya                        __attribute__((unused)) const struct GEN7_PALETTE_ENTRY * restrict values)
76510e230b6Smaya{
76610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
76710e230b6Smaya
76810e230b6Smaya   dw[0] =
76910e230b6Smaya      __gen_uint(values->Blue, 0, 7) |
77010e230b6Smaya      __gen_uint(values->Green, 8, 15) |
77110e230b6Smaya      __gen_uint(values->Red, 16, 23) |
77210e230b6Smaya      __gen_uint(values->Alpha, 24, 31);
77310e230b6Smaya}
77410e230b6Smaya
77510e230b6Smaya#define GEN7_RENDER_SURFACE_STATE_length       8
77610e230b6Smayastruct GEN7_RENDER_SURFACE_STATE {
77710e230b6Smaya   bool                                 CubeFaceEnablePositiveZ;
77810e230b6Smaya   bool                                 CubeFaceEnableNegativeZ;
77910e230b6Smaya   bool                                 CubeFaceEnablePositiveY;
78010e230b6Smaya   bool                                 CubeFaceEnableNegativeY;
78110e230b6Smaya   bool                                 CubeFaceEnablePositiveX;
78210e230b6Smaya   bool                                 CubeFaceEnableNegativeX;
78310e230b6Smaya   uint32_t                             MediaBoundaryPixelMode;
78410e230b6Smaya#define NORMAL_MODE                              0
78510e230b6Smaya#define PROGRESSIVE_FRAME                        2
78610e230b6Smaya#define INTERLACED_FRAME                         3
78710e230b6Smaya   uint32_t                             RenderCacheReadWriteMode;
78810e230b6Smaya   uint32_t                             SurfaceArraySpacing;
78910e230b6Smaya#define ARYSPC_FULL                              0
79010e230b6Smaya#define ARYSPC_LOD0                              1
79110e230b6Smaya   uint32_t                             VerticalLineStrideOffset;
79210e230b6Smaya   uint32_t                             VerticalLineStride;
79310e230b6Smaya   uint32_t                             TileWalk;
79410e230b6Smaya#define TILEWALK_XMAJOR                          0
79510e230b6Smaya#define TILEWALK_YMAJOR                          1
79610e230b6Smaya   bool                                 TiledSurface;
79710e230b6Smaya   uint32_t                             SurfaceHorizontalAlignment;
79810e230b6Smaya#define HALIGN_4                                 0
79910e230b6Smaya#define HALIGN_8                                 1
80010e230b6Smaya   uint32_t                             SurfaceVerticalAlignment;
80110e230b6Smaya#define VALIGN_2                                 0
80210e230b6Smaya#define VALIGN_4                                 1
80310e230b6Smaya   uint32_t                             SurfaceFormat;
80410e230b6Smaya   bool                                 SurfaceArray;
80510e230b6Smaya   uint32_t                             SurfaceType;
80610e230b6Smaya#define SURFTYPE_1D                              0
80710e230b6Smaya#define SURFTYPE_2D                              1
80810e230b6Smaya#define SURFTYPE_3D                              2
80910e230b6Smaya#define SURFTYPE_CUBE                            3
81010e230b6Smaya#define SURFTYPE_BUFFER                          4
81110e230b6Smaya#define SURFTYPE_STRBUF                          5
81210e230b6Smaya#define SURFTYPE_NULL                            7
81310e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
81410e230b6Smaya   uint32_t                             Width;
81510e230b6Smaya   uint32_t                             Height;
81610e230b6Smaya   uint32_t                             SurfacePitch;
81710e230b6Smaya   uint32_t                             Depth;
81810e230b6Smaya   uint32_t                             MultisamplePositionPaletteIndex;
81910e230b6Smaya   uint32_t                             StrbufMinimumArrayElement;
82010e230b6Smaya   uint32_t                             NumberofMultisamples;
82110e230b6Smaya#define MULTISAMPLECOUNT_1                       0
82210e230b6Smaya#define MULTISAMPLECOUNT_4                       2
82310e230b6Smaya#define MULTISAMPLECOUNT_8                       3
82410e230b6Smaya   uint32_t                             MultisampledSurfaceStorageFormat;
82510e230b6Smaya#define MSFMT_MSS                                0
82610e230b6Smaya#define MSFMT_DEPTH_STENCIL                      1
82710e230b6Smaya   uint32_t                             RenderTargetViewExtent;
82810e230b6Smaya   uint32_t                             MinimumArrayElement;
82910e230b6Smaya   uint32_t                             RenderTargetRotation;
83010e230b6Smaya#define RTROTATE_0DEG                            0
83110e230b6Smaya#define RTROTATE_90DEG                           1
83210e230b6Smaya#define RTROTATE_270DEG                          3
83310e230b6Smaya   uint32_t                             MIPCountLOD;
83410e230b6Smaya   uint32_t                             SurfaceMinLOD;
83510e230b6Smaya   uint32_t                             MOCS;
83610e230b6Smaya   uint32_t                             YOffset;
83710e230b6Smaya   uint32_t                             XOffset;
83810e230b6Smaya   bool                                 MCSEnable;
83910e230b6Smaya   uint32_t                             YOffsetforUVPlane;
84010e230b6Smaya   bool                                 AppendCounterEnable;
84110e230b6Smaya   uint32_t                             AuxiliarySurfacePitch;
84210e230b6Smaya   __gen_address_type                   AppendCounterAddress;
84310e230b6Smaya   __gen_address_type                   AuxiliarySurfaceBaseAddress;
84410e230b6Smaya   uint32_t                             XOffsetforUVPlane;
84510e230b6Smaya   uint32_t                             ReservedMBZ;
84610e230b6Smaya   float                                ResourceMinLOD;
84710e230b6Smaya   uint32_t                             AlphaClearColor;
84810e230b6Smaya#define CC_ZERO                                  0
84910e230b6Smaya#define CC_ONE                                   1
85010e230b6Smaya   uint32_t                             BlueClearColor;
85110e230b6Smaya#define CC_ZERO                                  0
85210e230b6Smaya#define CC_ONE                                   1
85310e230b6Smaya   uint32_t                             GreenClearColor;
85410e230b6Smaya#define CC_ZERO                                  0
85510e230b6Smaya#define CC_ONE                                   1
85610e230b6Smaya   uint32_t                             RedClearColor;
85710e230b6Smaya#define CC_ZERO                                  0
85810e230b6Smaya#define CC_ONE                                   1
85910e230b6Smaya};
86010e230b6Smaya
86110e230b6Smayastatic inline void
86210e230b6SmayaGEN7_RENDER_SURFACE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
86310e230b6Smaya                               __attribute__((unused)) void * restrict dst,
86410e230b6Smaya                               __attribute__((unused)) const struct GEN7_RENDER_SURFACE_STATE * restrict values)
86510e230b6Smaya{
86610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
86710e230b6Smaya
86810e230b6Smaya   dw[0] =
86910e230b6Smaya      __gen_uint(values->CubeFaceEnablePositiveZ, 0, 0) |
87010e230b6Smaya      __gen_uint(values->CubeFaceEnableNegativeZ, 1, 1) |
87110e230b6Smaya      __gen_uint(values->CubeFaceEnablePositiveY, 2, 2) |
87210e230b6Smaya      __gen_uint(values->CubeFaceEnableNegativeY, 3, 3) |
87310e230b6Smaya      __gen_uint(values->CubeFaceEnablePositiveX, 4, 4) |
87410e230b6Smaya      __gen_uint(values->CubeFaceEnableNegativeX, 5, 5) |
87510e230b6Smaya      __gen_uint(values->MediaBoundaryPixelMode, 6, 7) |
87610e230b6Smaya      __gen_uint(values->RenderCacheReadWriteMode, 8, 8) |
87710e230b6Smaya      __gen_uint(values->SurfaceArraySpacing, 10, 10) |
87810e230b6Smaya      __gen_uint(values->VerticalLineStrideOffset, 11, 11) |
87910e230b6Smaya      __gen_uint(values->VerticalLineStride, 12, 12) |
88010e230b6Smaya      __gen_uint(values->TileWalk, 13, 13) |
88110e230b6Smaya      __gen_uint(values->TiledSurface, 14, 14) |
88210e230b6Smaya      __gen_uint(values->SurfaceHorizontalAlignment, 15, 15) |
88310e230b6Smaya      __gen_uint(values->SurfaceVerticalAlignment, 16, 17) |
88410e230b6Smaya      __gen_uint(values->SurfaceFormat, 18, 26) |
88510e230b6Smaya      __gen_uint(values->SurfaceArray, 28, 28) |
88610e230b6Smaya      __gen_uint(values->SurfaceType, 29, 31);
88710e230b6Smaya
88810e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->SurfaceBaseAddress, 0);
88910e230b6Smaya
89010e230b6Smaya   dw[2] =
89110e230b6Smaya      __gen_uint(values->Width, 0, 13) |
89210e230b6Smaya      __gen_uint(values->Height, 16, 29);
89310e230b6Smaya
89410e230b6Smaya   dw[3] =
89510e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 17) |
89610e230b6Smaya      __gen_uint(values->Depth, 21, 31);
89710e230b6Smaya
89810e230b6Smaya   dw[4] =
89910e230b6Smaya      __gen_uint(values->MultisamplePositionPaletteIndex, 0, 2) |
90010e230b6Smaya      __gen_uint(values->StrbufMinimumArrayElement, 0, 26) |
90110e230b6Smaya      __gen_uint(values->NumberofMultisamples, 3, 5) |
90210e230b6Smaya      __gen_uint(values->MultisampledSurfaceStorageFormat, 6, 6) |
90310e230b6Smaya      __gen_uint(values->RenderTargetViewExtent, 7, 17) |
90410e230b6Smaya      __gen_uint(values->MinimumArrayElement, 18, 28) |
90510e230b6Smaya      __gen_uint(values->RenderTargetRotation, 29, 30);
90610e230b6Smaya
90710e230b6Smaya   dw[5] =
90810e230b6Smaya      __gen_uint(values->MIPCountLOD, 0, 3) |
90910e230b6Smaya      __gen_uint(values->SurfaceMinLOD, 4, 7) |
91010e230b6Smaya      __gen_uint(values->MOCS, 16, 19) |
91110e230b6Smaya      __gen_uint(values->YOffset, 20, 23) |
91210e230b6Smaya      __gen_uint(values->XOffset, 25, 31);
91310e230b6Smaya
91410e230b6Smaya   const uint32_t v6 =
91510e230b6Smaya      __gen_uint(values->MCSEnable, 0, 0) |
91610e230b6Smaya      __gen_uint(values->YOffsetforUVPlane, 0, 13) |
91710e230b6Smaya      __gen_uint(values->AppendCounterEnable, 1, 1) |
91810e230b6Smaya      __gen_uint(values->AuxiliarySurfacePitch, 3, 11) |
91910e230b6Smaya      __gen_uint(values->XOffsetforUVPlane, 16, 29) |
92010e230b6Smaya      __gen_uint(values->ReservedMBZ, 30, 31);
92110e230b6Smaya   dw[6] = __gen_combine_address(data, &dw[6], values->AuxiliarySurfaceBaseAddress, v6);
92210e230b6Smaya
92310e230b6Smaya   dw[7] =
92410e230b6Smaya      __gen_ufixed(values->ResourceMinLOD, 0, 11, 8) |
92510e230b6Smaya      __gen_uint(values->AlphaClearColor, 28, 28) |
92610e230b6Smaya      __gen_uint(values->BlueClearColor, 29, 29) |
92710e230b6Smaya      __gen_uint(values->GreenClearColor, 30, 30) |
92810e230b6Smaya      __gen_uint(values->RedClearColor, 31, 31);
92910e230b6Smaya}
93010e230b6Smaya
93110e230b6Smaya#define GEN7_SAMPLER_BORDER_COLOR_STATE_length      4
93210e230b6Smayastruct GEN7_SAMPLER_BORDER_COLOR_STATE {
93310e230b6Smaya   uint32_t                             BorderColorUnormRed;
93410e230b6Smaya   float                                BorderColorFloatRed;
93510e230b6Smaya   uint32_t                             BorderColorUnormGreen;
93610e230b6Smaya   uint32_t                             BorderColorUnormBlue;
93710e230b6Smaya   uint32_t                             BorderColorUnormAlpha;
93810e230b6Smaya   float                                BorderColorFloatGreen;
93910e230b6Smaya   float                                BorderColorFloatBlue;
94010e230b6Smaya   float                                BorderColorFloatAlpha;
94110e230b6Smaya};
94210e230b6Smaya
94310e230b6Smayastatic inline void
94410e230b6SmayaGEN7_SAMPLER_BORDER_COLOR_STATE_pack(__attribute__((unused)) __gen_user_data *data,
94510e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
94610e230b6Smaya                                     __attribute__((unused)) const struct GEN7_SAMPLER_BORDER_COLOR_STATE * restrict values)
94710e230b6Smaya{
94810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
94910e230b6Smaya
95010e230b6Smaya   dw[0] =
95110e230b6Smaya      __gen_uint(values->BorderColorUnormRed, 0, 7) |
95210e230b6Smaya      __gen_float(values->BorderColorFloatRed) |
95310e230b6Smaya      __gen_uint(values->BorderColorUnormGreen, 8, 15) |
95410e230b6Smaya      __gen_uint(values->BorderColorUnormBlue, 16, 23) |
95510e230b6Smaya      __gen_uint(values->BorderColorUnormAlpha, 24, 31);
95610e230b6Smaya
95710e230b6Smaya   dw[1] =
95810e230b6Smaya      __gen_float(values->BorderColorFloatGreen);
95910e230b6Smaya
96010e230b6Smaya   dw[2] =
96110e230b6Smaya      __gen_float(values->BorderColorFloatBlue);
96210e230b6Smaya
96310e230b6Smaya   dw[3] =
96410e230b6Smaya      __gen_float(values->BorderColorFloatAlpha);
96510e230b6Smaya}
96610e230b6Smaya
96710e230b6Smaya#define GEN7_SAMPLER_STATE_length              4
96810e230b6Smayastruct GEN7_SAMPLER_STATE {
96910e230b6Smaya   uint32_t                             AnisotropicAlgorithm;
97010e230b6Smaya#define LEGACY                                   0
97110e230b6Smaya#define EWAApproximation                         1
97210e230b6Smaya   float                                TextureLODBias;
97310e230b6Smaya   uint32_t                             MinModeFilter;
97410e230b6Smaya#define MAPFILTER_NEAREST                        0
97510e230b6Smaya#define MAPFILTER_LINEAR                         1
97610e230b6Smaya#define MAPFILTER_ANISOTROPIC                    2
97710e230b6Smaya#define MAPFILTER_MONO                           6
97810e230b6Smaya   uint32_t                             MagModeFilter;
97910e230b6Smaya#define MAPFILTER_NEAREST                        0
98010e230b6Smaya#define MAPFILTER_LINEAR                         1
98110e230b6Smaya#define MAPFILTER_ANISOTROPIC                    2
98210e230b6Smaya#define MAPFILTER_MONO                           6
98310e230b6Smaya   uint32_t                             MipModeFilter;
98410e230b6Smaya#define MIPFILTER_NONE                           0
98510e230b6Smaya#define MIPFILTER_NEAREST                        1
98610e230b6Smaya#define MIPFILTER_LINEAR                         3
98710e230b6Smaya   float                                BaseMipLevel;
98810e230b6Smaya   uint32_t                             LODPreClampEnable;
98910e230b6Smaya#define CLAMP_ENABLE_OGL                         1
99010e230b6Smaya   uint32_t                             TextureBorderColorMode;
99110e230b6Smaya#define DX10OGL                                  0
99210e230b6Smaya#define DX9                                      1
99310e230b6Smaya   bool                                 SamplerDisable;
99410e230b6Smaya   uint32_t                             CubeSurfaceControlMode;
99510e230b6Smaya#define PROGRAMMED                               0
99610e230b6Smaya#define OVERRIDE                                 1
99710e230b6Smaya   uint32_t                             ShadowFunction;
99810e230b6Smaya#define PREFILTEROPALWAYS                        0
99910e230b6Smaya#define PREFILTEROPNEVER                         1
100010e230b6Smaya#define PREFILTEROPLESS                          2
100110e230b6Smaya#define PREFILTEROPEQUAL                         3
100210e230b6Smaya#define PREFILTEROPLEQUAL                        4
100310e230b6Smaya#define PREFILTEROPGREATER                       5
100410e230b6Smaya#define PREFILTEROPNOTEQUAL                      6
100510e230b6Smaya#define PREFILTEROPGEQUAL                        7
100610e230b6Smaya   float                                MaxLOD;
100710e230b6Smaya   float                                MinLOD;
100810e230b6Smaya   uint64_t                             BorderColorPointer;
100910e230b6Smaya   enum GEN7_TextureCoordinateMode      TCZAddressControlMode;
101010e230b6Smaya   enum GEN7_TextureCoordinateMode      TCYAddressControlMode;
101110e230b6Smaya   enum GEN7_TextureCoordinateMode      TCXAddressControlMode;
101210e230b6Smaya   bool                                 NonnormalizedCoordinateEnable;
101310e230b6Smaya   uint32_t                             TrilinearFilterQuality;
101410e230b6Smaya#define FULL                                     0
101510e230b6Smaya#define MED                                      2
101610e230b6Smaya#define LOW                                      3
101710e230b6Smaya   bool                                 RAddressMinFilterRoundingEnable;
101810e230b6Smaya   bool                                 RAddressMagFilterRoundingEnable;
101910e230b6Smaya   bool                                 VAddressMinFilterRoundingEnable;
102010e230b6Smaya   bool                                 VAddressMagFilterRoundingEnable;
102110e230b6Smaya   bool                                 UAddressMinFilterRoundingEnable;
102210e230b6Smaya   bool                                 UAddressMagFilterRoundingEnable;
102310e230b6Smaya   uint32_t                             MaximumAnisotropy;
102410e230b6Smaya#define RATIO21                                  0
102510e230b6Smaya#define RATIO41                                  1
102610e230b6Smaya#define RATIO61                                  2
102710e230b6Smaya#define RATIO81                                  3
102810e230b6Smaya#define RATIO101                                 4
102910e230b6Smaya#define RATIO121                                 5
103010e230b6Smaya#define RATIO141                                 6
103110e230b6Smaya#define RATIO161                                 7
103210e230b6Smaya   uint32_t                             ChromaKeyMode;
103310e230b6Smaya#define KEYFILTER_KILL_ON_ANY_MATCH              0
103410e230b6Smaya#define KEYFILTER_REPLACE_BLACK                  1
103510e230b6Smaya   uint32_t                             ChromaKeyIndex;
103610e230b6Smaya   bool                                 ChromaKeyEnable;
103710e230b6Smaya};
103810e230b6Smaya
103910e230b6Smayastatic inline void
104010e230b6SmayaGEN7_SAMPLER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
104110e230b6Smaya                        __attribute__((unused)) void * restrict dst,
104210e230b6Smaya                        __attribute__((unused)) const struct GEN7_SAMPLER_STATE * restrict values)
104310e230b6Smaya{
104410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
104510e230b6Smaya
104610e230b6Smaya   dw[0] =
104710e230b6Smaya      __gen_uint(values->AnisotropicAlgorithm, 0, 0) |
104810e230b6Smaya      __gen_sfixed(values->TextureLODBias, 1, 13, 8) |
104910e230b6Smaya      __gen_uint(values->MinModeFilter, 14, 16) |
105010e230b6Smaya      __gen_uint(values->MagModeFilter, 17, 19) |
105110e230b6Smaya      __gen_uint(values->MipModeFilter, 20, 21) |
105210e230b6Smaya      __gen_ufixed(values->BaseMipLevel, 22, 26, 1) |
105310e230b6Smaya      __gen_uint(values->LODPreClampEnable, 28, 28) |
105410e230b6Smaya      __gen_uint(values->TextureBorderColorMode, 29, 29) |
105510e230b6Smaya      __gen_uint(values->SamplerDisable, 31, 31);
105610e230b6Smaya
105710e230b6Smaya   dw[1] =
105810e230b6Smaya      __gen_uint(values->CubeSurfaceControlMode, 0, 0) |
105910e230b6Smaya      __gen_uint(values->ShadowFunction, 1, 3) |
106010e230b6Smaya      __gen_ufixed(values->MaxLOD, 8, 19, 8) |
106110e230b6Smaya      __gen_ufixed(values->MinLOD, 20, 31, 8);
106210e230b6Smaya
106310e230b6Smaya   dw[2] =
106410e230b6Smaya      __gen_offset(values->BorderColorPointer, 5, 31);
106510e230b6Smaya
106610e230b6Smaya   dw[3] =
106710e230b6Smaya      __gen_uint(values->TCZAddressControlMode, 0, 2) |
106810e230b6Smaya      __gen_uint(values->TCYAddressControlMode, 3, 5) |
106910e230b6Smaya      __gen_uint(values->TCXAddressControlMode, 6, 8) |
107010e230b6Smaya      __gen_uint(values->NonnormalizedCoordinateEnable, 10, 10) |
107110e230b6Smaya      __gen_uint(values->TrilinearFilterQuality, 11, 12) |
107210e230b6Smaya      __gen_uint(values->RAddressMinFilterRoundingEnable, 13, 13) |
107310e230b6Smaya      __gen_uint(values->RAddressMagFilterRoundingEnable, 14, 14) |
107410e230b6Smaya      __gen_uint(values->VAddressMinFilterRoundingEnable, 15, 15) |
107510e230b6Smaya      __gen_uint(values->VAddressMagFilterRoundingEnable, 16, 16) |
107610e230b6Smaya      __gen_uint(values->UAddressMinFilterRoundingEnable, 17, 17) |
107710e230b6Smaya      __gen_uint(values->UAddressMagFilterRoundingEnable, 18, 18) |
107810e230b6Smaya      __gen_uint(values->MaximumAnisotropy, 19, 21) |
107910e230b6Smaya      __gen_uint(values->ChromaKeyMode, 22, 22) |
108010e230b6Smaya      __gen_uint(values->ChromaKeyIndex, 23, 24) |
108110e230b6Smaya      __gen_uint(values->ChromaKeyEnable, 25, 25);
108210e230b6Smaya}
108310e230b6Smaya
108410e230b6Smaya#define GEN7_SCISSOR_RECT_length               2
108510e230b6Smayastruct GEN7_SCISSOR_RECT {
108610e230b6Smaya   uint32_t                             ScissorRectangleXMin;
108710e230b6Smaya   uint32_t                             ScissorRectangleYMin;
108810e230b6Smaya   uint32_t                             ScissorRectangleXMax;
108910e230b6Smaya   uint32_t                             ScissorRectangleYMax;
109010e230b6Smaya};
109110e230b6Smaya
109210e230b6Smayastatic inline void
109310e230b6SmayaGEN7_SCISSOR_RECT_pack(__attribute__((unused)) __gen_user_data *data,
109410e230b6Smaya                       __attribute__((unused)) void * restrict dst,
109510e230b6Smaya                       __attribute__((unused)) const struct GEN7_SCISSOR_RECT * restrict values)
109610e230b6Smaya{
109710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
109810e230b6Smaya
109910e230b6Smaya   dw[0] =
110010e230b6Smaya      __gen_uint(values->ScissorRectangleXMin, 0, 15) |
110110e230b6Smaya      __gen_uint(values->ScissorRectangleYMin, 16, 31);
110210e230b6Smaya
110310e230b6Smaya   dw[1] =
110410e230b6Smaya      __gen_uint(values->ScissorRectangleXMax, 0, 15) |
110510e230b6Smaya      __gen_uint(values->ScissorRectangleYMax, 16, 31);
110610e230b6Smaya}
110710e230b6Smaya
110810e230b6Smaya#define GEN7_SF_CLIP_VIEWPORT_length          16
110910e230b6Smayastruct GEN7_SF_CLIP_VIEWPORT {
111010e230b6Smaya   float                                ViewportMatrixElementm00;
111110e230b6Smaya   float                                ViewportMatrixElementm11;
111210e230b6Smaya   float                                ViewportMatrixElementm22;
111310e230b6Smaya   float                                ViewportMatrixElementm30;
111410e230b6Smaya   float                                ViewportMatrixElementm31;
111510e230b6Smaya   float                                ViewportMatrixElementm32;
111610e230b6Smaya   float                                XMinClipGuardband;
111710e230b6Smaya   float                                XMaxClipGuardband;
111810e230b6Smaya   float                                YMinClipGuardband;
111910e230b6Smaya   float                                YMaxClipGuardband;
112010e230b6Smaya};
112110e230b6Smaya
112210e230b6Smayastatic inline void
112310e230b6SmayaGEN7_SF_CLIP_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
112410e230b6Smaya                           __attribute__((unused)) void * restrict dst,
112510e230b6Smaya                           __attribute__((unused)) const struct GEN7_SF_CLIP_VIEWPORT * restrict values)
112610e230b6Smaya{
112710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
112810e230b6Smaya
112910e230b6Smaya   dw[0] =
113010e230b6Smaya      __gen_float(values->ViewportMatrixElementm00);
113110e230b6Smaya
113210e230b6Smaya   dw[1] =
113310e230b6Smaya      __gen_float(values->ViewportMatrixElementm11);
113410e230b6Smaya
113510e230b6Smaya   dw[2] =
113610e230b6Smaya      __gen_float(values->ViewportMatrixElementm22);
113710e230b6Smaya
113810e230b6Smaya   dw[3] =
113910e230b6Smaya      __gen_float(values->ViewportMatrixElementm30);
114010e230b6Smaya
114110e230b6Smaya   dw[4] =
114210e230b6Smaya      __gen_float(values->ViewportMatrixElementm31);
114310e230b6Smaya
114410e230b6Smaya   dw[5] =
114510e230b6Smaya      __gen_float(values->ViewportMatrixElementm32);
114610e230b6Smaya
114710e230b6Smaya   dw[6] = 0;
114810e230b6Smaya
114910e230b6Smaya   dw[7] = 0;
115010e230b6Smaya
115110e230b6Smaya   dw[8] =
115210e230b6Smaya      __gen_float(values->XMinClipGuardband);
115310e230b6Smaya
115410e230b6Smaya   dw[9] =
115510e230b6Smaya      __gen_float(values->XMaxClipGuardband);
115610e230b6Smaya
115710e230b6Smaya   dw[10] =
115810e230b6Smaya      __gen_float(values->YMinClipGuardband);
115910e230b6Smaya
116010e230b6Smaya   dw[11] =
116110e230b6Smaya      __gen_float(values->YMaxClipGuardband);
116210e230b6Smaya
116310e230b6Smaya   dw[12] = 0;
116410e230b6Smaya
116510e230b6Smaya   dw[13] = 0;
116610e230b6Smaya
116710e230b6Smaya   dw[14] = 0;
116810e230b6Smaya
116910e230b6Smaya   dw[15] = 0;
117010e230b6Smaya}
117110e230b6Smaya
117210e230b6Smaya#define GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_length      1
117310e230b6Smayastruct GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL {
117410e230b6Smaya   uint32_t                             SourceAttribute;
117510e230b6Smaya   uint32_t                             SwizzleSelect;
117610e230b6Smaya#define INPUTATTR                                0
117710e230b6Smaya#define INPUTATTR_FACING                         1
117810e230b6Smaya#define INPUTATTR_W                              2
117910e230b6Smaya#define INPUTATTR_FACING_W                       3
118010e230b6Smaya   uint32_t                             ConstantSource;
118110e230b6Smaya#define CONST_0000                               0
118210e230b6Smaya#define CONST_0001_FLOAT                         1
118310e230b6Smaya#define CONST_1111_FLOAT                         2
118410e230b6Smaya#define PRIM_ID                                  3
118510e230b6Smaya   uint32_t                             SwizzleControlMode;
118610e230b6Smaya   bool                                 ComponentOverrideX;
118710e230b6Smaya   bool                                 ComponentOverrideY;
118810e230b6Smaya   bool                                 ComponentOverrideZ;
118910e230b6Smaya   bool                                 ComponentOverrideW;
119010e230b6Smaya};
119110e230b6Smaya
119210e230b6Smayastatic inline void
119310e230b6SmayaGEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(__attribute__((unused)) __gen_user_data *data,
119410e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
119510e230b6Smaya                                     __attribute__((unused)) const struct GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL * restrict values)
119610e230b6Smaya{
119710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
119810e230b6Smaya
119910e230b6Smaya   dw[0] =
120010e230b6Smaya      __gen_uint(values->SourceAttribute, 0, 4) |
120110e230b6Smaya      __gen_uint(values->SwizzleSelect, 6, 7) |
120210e230b6Smaya      __gen_uint(values->ConstantSource, 9, 10) |
120310e230b6Smaya      __gen_uint(values->SwizzleControlMode, 11, 11) |
120410e230b6Smaya      __gen_uint(values->ComponentOverrideX, 12, 12) |
120510e230b6Smaya      __gen_uint(values->ComponentOverrideY, 13, 13) |
120610e230b6Smaya      __gen_uint(values->ComponentOverrideZ, 14, 14) |
120710e230b6Smaya      __gen_uint(values->ComponentOverrideW, 15, 15);
120810e230b6Smaya}
120910e230b6Smaya
121010e230b6Smaya#define GEN7_SO_DECL_length                    1
121110e230b6Smayastruct GEN7_SO_DECL {
121210e230b6Smaya   uint32_t                             ComponentMask;
121310e230b6Smaya   uint32_t                             RegisterIndex;
121410e230b6Smaya   uint32_t                             HoleFlag;
121510e230b6Smaya   uint32_t                             OutputBufferSlot;
121610e230b6Smaya};
121710e230b6Smaya
121810e230b6Smayastatic inline void
121910e230b6SmayaGEN7_SO_DECL_pack(__attribute__((unused)) __gen_user_data *data,
122010e230b6Smaya                  __attribute__((unused)) void * restrict dst,
122110e230b6Smaya                  __attribute__((unused)) const struct GEN7_SO_DECL * restrict values)
122210e230b6Smaya{
122310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
122410e230b6Smaya
122510e230b6Smaya   dw[0] =
122610e230b6Smaya      __gen_uint(values->ComponentMask, 0, 3) |
122710e230b6Smaya      __gen_uint(values->RegisterIndex, 4, 9) |
122810e230b6Smaya      __gen_uint(values->HoleFlag, 11, 11) |
122910e230b6Smaya      __gen_uint(values->OutputBufferSlot, 12, 13);
123010e230b6Smaya}
123110e230b6Smaya
123210e230b6Smaya#define GEN7_SO_DECL_ENTRY_length              2
123310e230b6Smayastruct GEN7_SO_DECL_ENTRY {
123410e230b6Smaya   struct GEN7_SO_DECL                  Stream0Decl;
123510e230b6Smaya   struct GEN7_SO_DECL                  Stream1Decl;
123610e230b6Smaya   struct GEN7_SO_DECL                  Stream2Decl;
123710e230b6Smaya   struct GEN7_SO_DECL                  Stream3Decl;
123810e230b6Smaya};
123910e230b6Smaya
124010e230b6Smayastatic inline void
124110e230b6SmayaGEN7_SO_DECL_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
124210e230b6Smaya                        __attribute__((unused)) void * restrict dst,
124310e230b6Smaya                        __attribute__((unused)) const struct GEN7_SO_DECL_ENTRY * restrict values)
124410e230b6Smaya{
124510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
124610e230b6Smaya
124710e230b6Smaya   uint32_t v0_0;
124810e230b6Smaya   GEN7_SO_DECL_pack(data, &v0_0, &values->Stream0Decl);
124910e230b6Smaya
125010e230b6Smaya   uint32_t v0_1;
125110e230b6Smaya   GEN7_SO_DECL_pack(data, &v0_1, &values->Stream1Decl);
125210e230b6Smaya
125310e230b6Smaya   dw[0] =
125410e230b6Smaya      __gen_uint(v0_0, 0, 15) |
125510e230b6Smaya      __gen_uint(v0_1, 16, 31);
125610e230b6Smaya
125710e230b6Smaya   uint32_t v1_0;
125810e230b6Smaya   GEN7_SO_DECL_pack(data, &v1_0, &values->Stream2Decl);
125910e230b6Smaya
126010e230b6Smaya   uint32_t v1_1;
126110e230b6Smaya   GEN7_SO_DECL_pack(data, &v1_1, &values->Stream3Decl);
126210e230b6Smaya
126310e230b6Smaya   dw[1] =
126410e230b6Smaya      __gen_uint(v1_0, 0, 15) |
126510e230b6Smaya      __gen_uint(v1_1, 16, 31);
126610e230b6Smaya}
126710e230b6Smaya
126810e230b6Smaya#define GEN7_VERTEX_BUFFER_STATE_length        4
126910e230b6Smayastruct GEN7_VERTEX_BUFFER_STATE {
127010e230b6Smaya   uint32_t                             BufferPitch;
127110e230b6Smaya   bool                                 VertexFetchInvalidate;
127210e230b6Smaya   bool                                 NullVertexBuffer;
127310e230b6Smaya   bool                                 AddressModifyEnable;
127410e230b6Smaya   uint32_t                             MOCS;
127510e230b6Smaya   uint32_t                             BufferAccessType;
127610e230b6Smaya#define VERTEXDATA                               0
127710e230b6Smaya#define INSTANCEDATA                             1
127810e230b6Smaya   uint32_t                             VertexBufferIndex;
127910e230b6Smaya   __gen_address_type                   BufferStartingAddress;
128010e230b6Smaya   __gen_address_type                   EndAddress;
128110e230b6Smaya   uint32_t                             InstanceDataStepRate;
128210e230b6Smaya};
128310e230b6Smaya
128410e230b6Smayastatic inline void
128510e230b6SmayaGEN7_VERTEX_BUFFER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
128610e230b6Smaya                              __attribute__((unused)) void * restrict dst,
128710e230b6Smaya                              __attribute__((unused)) const struct GEN7_VERTEX_BUFFER_STATE * restrict values)
128810e230b6Smaya{
128910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
129010e230b6Smaya
129110e230b6Smaya   dw[0] =
129210e230b6Smaya      __gen_uint(values->BufferPitch, 0, 11) |
129310e230b6Smaya      __gen_uint(values->VertexFetchInvalidate, 12, 12) |
129410e230b6Smaya      __gen_uint(values->NullVertexBuffer, 13, 13) |
129510e230b6Smaya      __gen_uint(values->AddressModifyEnable, 14, 14) |
129610e230b6Smaya      __gen_uint(values->MOCS, 16, 19) |
129710e230b6Smaya      __gen_uint(values->BufferAccessType, 20, 20) |
129810e230b6Smaya      __gen_uint(values->VertexBufferIndex, 26, 31);
129910e230b6Smaya
130010e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->BufferStartingAddress, 0);
130110e230b6Smaya
130210e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->EndAddress, 0);
130310e230b6Smaya
130410e230b6Smaya   dw[3] =
130510e230b6Smaya      __gen_uint(values->InstanceDataStepRate, 0, 31);
130610e230b6Smaya}
130710e230b6Smaya
130810e230b6Smaya#define GEN7_VERTEX_ELEMENT_STATE_length       2
130910e230b6Smayastruct GEN7_VERTEX_ELEMENT_STATE {
131010e230b6Smaya   uint32_t                             SourceElementOffset;
131110e230b6Smaya   bool                                 EdgeFlagEnable;
131210e230b6Smaya   uint32_t                             SourceElementFormat;
131310e230b6Smaya   bool                                 Valid;
131410e230b6Smaya   uint32_t                             VertexBufferIndex;
131510e230b6Smaya   enum GEN7_3D_Vertex_Component_Control Component3Control;
131610e230b6Smaya   enum GEN7_3D_Vertex_Component_Control Component2Control;
131710e230b6Smaya   enum GEN7_3D_Vertex_Component_Control Component1Control;
131810e230b6Smaya   enum GEN7_3D_Vertex_Component_Control Component0Control;
131910e230b6Smaya};
132010e230b6Smaya
132110e230b6Smayastatic inline void
132210e230b6SmayaGEN7_VERTEX_ELEMENT_STATE_pack(__attribute__((unused)) __gen_user_data *data,
132310e230b6Smaya                               __attribute__((unused)) void * restrict dst,
132410e230b6Smaya                               __attribute__((unused)) const struct GEN7_VERTEX_ELEMENT_STATE * restrict values)
132510e230b6Smaya{
132610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
132710e230b6Smaya
132810e230b6Smaya   dw[0] =
132910e230b6Smaya      __gen_uint(values->SourceElementOffset, 0, 11) |
133010e230b6Smaya      __gen_uint(values->EdgeFlagEnable, 15, 15) |
133110e230b6Smaya      __gen_uint(values->SourceElementFormat, 16, 24) |
133210e230b6Smaya      __gen_uint(values->Valid, 25, 25) |
133310e230b6Smaya      __gen_uint(values->VertexBufferIndex, 26, 31);
133410e230b6Smaya
133510e230b6Smaya   dw[1] =
133610e230b6Smaya      __gen_uint(values->Component3Control, 16, 18) |
133710e230b6Smaya      __gen_uint(values->Component2Control, 20, 22) |
133810e230b6Smaya      __gen_uint(values->Component1Control, 24, 26) |
133910e230b6Smaya      __gen_uint(values->Component0Control, 28, 30);
134010e230b6Smaya}
134110e230b6Smaya
134210e230b6Smaya#define GEN7_3DPRIMITIVE_length                7
134310e230b6Smaya#define GEN7_3DPRIMITIVE_length_bias           2
134410e230b6Smaya#define GEN7_3DPRIMITIVE_header                 \
134510e230b6Smaya   .DWordLength                         =      5,  \
134610e230b6Smaya   ._3DCommandSubOpcode                 =      0,  \
134710e230b6Smaya   ._3DCommandOpcode                    =      3,  \
134810e230b6Smaya   .CommandSubType                      =      3,  \
134910e230b6Smaya   .CommandType                         =      3
135010e230b6Smaya
135110e230b6Smayastruct GEN7_3DPRIMITIVE {
135210e230b6Smaya   uint32_t                             DWordLength;
135310e230b6Smaya   bool                                 PredicateEnable;
135410e230b6Smaya   bool                                 IndirectParameterEnable;
135510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
135610e230b6Smaya   uint32_t                             _3DCommandOpcode;
135710e230b6Smaya   uint32_t                             CommandSubType;
135810e230b6Smaya   uint32_t                             CommandType;
135910e230b6Smaya   enum GEN7_3D_Prim_Topo_Type          PrimitiveTopologyType;
136010e230b6Smaya   uint32_t                             VertexAccessType;
136110e230b6Smaya#define SEQUENTIAL                               0
136210e230b6Smaya#define RANDOM                                   1
136310e230b6Smaya   bool                                 EndOffsetEnable;
136410e230b6Smaya   uint32_t                             VertexCountPerInstance;
136510e230b6Smaya   uint32_t                             StartVertexLocation;
136610e230b6Smaya   uint32_t                             InstanceCount;
136710e230b6Smaya   uint32_t                             StartInstanceLocation;
136810e230b6Smaya   int32_t                              BaseVertexLocation;
136910e230b6Smaya};
137010e230b6Smaya
137110e230b6Smayastatic inline void
137210e230b6SmayaGEN7_3DPRIMITIVE_pack(__attribute__((unused)) __gen_user_data *data,
137310e230b6Smaya                      __attribute__((unused)) void * restrict dst,
137410e230b6Smaya                      __attribute__((unused)) const struct GEN7_3DPRIMITIVE * restrict values)
137510e230b6Smaya{
137610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
137710e230b6Smaya
137810e230b6Smaya   dw[0] =
137910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
138010e230b6Smaya      __gen_uint(values->PredicateEnable, 8, 8) |
138110e230b6Smaya      __gen_uint(values->IndirectParameterEnable, 10, 10) |
138210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
138310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
138410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
138510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
138610e230b6Smaya
138710e230b6Smaya   dw[1] =
138810e230b6Smaya      __gen_uint(values->PrimitiveTopologyType, 0, 5) |
138910e230b6Smaya      __gen_uint(values->VertexAccessType, 8, 8) |
139010e230b6Smaya      __gen_uint(values->EndOffsetEnable, 9, 9);
139110e230b6Smaya
139210e230b6Smaya   dw[2] =
139310e230b6Smaya      __gen_uint(values->VertexCountPerInstance, 0, 31);
139410e230b6Smaya
139510e230b6Smaya   dw[3] =
139610e230b6Smaya      __gen_uint(values->StartVertexLocation, 0, 31);
139710e230b6Smaya
139810e230b6Smaya   dw[4] =
139910e230b6Smaya      __gen_uint(values->InstanceCount, 0, 31);
140010e230b6Smaya
140110e230b6Smaya   dw[5] =
140210e230b6Smaya      __gen_uint(values->StartInstanceLocation, 0, 31);
140310e230b6Smaya
140410e230b6Smaya   dw[6] =
140510e230b6Smaya      __gen_sint(values->BaseVertexLocation, 0, 31);
140610e230b6Smaya}
140710e230b6Smaya
140810e230b6Smaya#define GEN7_3DSTATE_AA_LINE_PARAMETERS_length      3
140910e230b6Smaya#define GEN7_3DSTATE_AA_LINE_PARAMETERS_length_bias      2
141010e230b6Smaya#define GEN7_3DSTATE_AA_LINE_PARAMETERS_header  \
141110e230b6Smaya   .DWordLength                         =      1,  \
141210e230b6Smaya   ._3DCommandSubOpcode                 =     10,  \
141310e230b6Smaya   ._3DCommandOpcode                    =      1,  \
141410e230b6Smaya   .CommandSubType                      =      3,  \
141510e230b6Smaya   .CommandType                         =      3
141610e230b6Smaya
141710e230b6Smayastruct GEN7_3DSTATE_AA_LINE_PARAMETERS {
141810e230b6Smaya   uint32_t                             DWordLength;
141910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
142010e230b6Smaya   uint32_t                             _3DCommandOpcode;
142110e230b6Smaya   uint32_t                             CommandSubType;
142210e230b6Smaya   uint32_t                             CommandType;
142310e230b6Smaya   float                                AACoverageSlope;
142410e230b6Smaya   float                                AACoverageBias;
142510e230b6Smaya   float                                AACoverageEndCapSlope;
142610e230b6Smaya   float                                AACoverageEndCapBias;
142710e230b6Smaya};
142810e230b6Smaya
142910e230b6Smayastatic inline void
143010e230b6SmayaGEN7_3DSTATE_AA_LINE_PARAMETERS_pack(__attribute__((unused)) __gen_user_data *data,
143110e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
143210e230b6Smaya                                     __attribute__((unused)) const struct GEN7_3DSTATE_AA_LINE_PARAMETERS * restrict values)
143310e230b6Smaya{
143410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
143510e230b6Smaya
143610e230b6Smaya   dw[0] =
143710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
143810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
143910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
144010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
144110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
144210e230b6Smaya
144310e230b6Smaya   dw[1] =
144410e230b6Smaya      __gen_ufixed(values->AACoverageSlope, 0, 7, 8) |
144510e230b6Smaya      __gen_ufixed(values->AACoverageBias, 16, 23, 8);
144610e230b6Smaya
144710e230b6Smaya   dw[2] =
144810e230b6Smaya      __gen_ufixed(values->AACoverageEndCapSlope, 0, 7, 8) |
144910e230b6Smaya      __gen_ufixed(values->AACoverageEndCapBias, 16, 23, 8);
145010e230b6Smaya}
145110e230b6Smaya
145210e230b6Smaya#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_DS_length      2
145310e230b6Smaya#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_DS_length_bias      2
145410e230b6Smaya#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_DS_header\
145510e230b6Smaya   .DWordLength                         =      0,  \
145610e230b6Smaya   ._3DCommandSubOpcode                 =     40,  \
145710e230b6Smaya   ._3DCommandOpcode                    =      0,  \
145810e230b6Smaya   .CommandSubType                      =      3,  \
145910e230b6Smaya   .CommandType                         =      3
146010e230b6Smaya
146110e230b6Smayastruct GEN7_3DSTATE_BINDING_TABLE_POINTERS_DS {
146210e230b6Smaya   uint32_t                             DWordLength;
146310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
146410e230b6Smaya   uint32_t                             _3DCommandOpcode;
146510e230b6Smaya   uint32_t                             CommandSubType;
146610e230b6Smaya   uint32_t                             CommandType;
146710e230b6Smaya   uint64_t                             PointertoDSBindingTable;
146810e230b6Smaya};
146910e230b6Smaya
147010e230b6Smayastatic inline void
147110e230b6SmayaGEN7_3DSTATE_BINDING_TABLE_POINTERS_DS_pack(__attribute__((unused)) __gen_user_data *data,
147210e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
147310e230b6Smaya                                            __attribute__((unused)) const struct GEN7_3DSTATE_BINDING_TABLE_POINTERS_DS * restrict values)
147410e230b6Smaya{
147510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
147610e230b6Smaya
147710e230b6Smaya   dw[0] =
147810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
147910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
148010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
148110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
148210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
148310e230b6Smaya
148410e230b6Smaya   dw[1] =
148510e230b6Smaya      __gen_offset(values->PointertoDSBindingTable, 5, 15);
148610e230b6Smaya}
148710e230b6Smaya
148810e230b6Smaya#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_GS_length      2
148910e230b6Smaya#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_GS_length_bias      2
149010e230b6Smaya#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_GS_header\
149110e230b6Smaya   .DWordLength                         =      0,  \
149210e230b6Smaya   ._3DCommandSubOpcode                 =     41,  \
149310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
149410e230b6Smaya   .CommandSubType                      =      3,  \
149510e230b6Smaya   .CommandType                         =      3
149610e230b6Smaya
149710e230b6Smayastruct GEN7_3DSTATE_BINDING_TABLE_POINTERS_GS {
149810e230b6Smaya   uint32_t                             DWordLength;
149910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
150010e230b6Smaya   uint32_t                             _3DCommandOpcode;
150110e230b6Smaya   uint32_t                             CommandSubType;
150210e230b6Smaya   uint32_t                             CommandType;
150310e230b6Smaya   uint64_t                             PointertoGSBindingTable;
150410e230b6Smaya};
150510e230b6Smaya
150610e230b6Smayastatic inline void
150710e230b6SmayaGEN7_3DSTATE_BINDING_TABLE_POINTERS_GS_pack(__attribute__((unused)) __gen_user_data *data,
150810e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
150910e230b6Smaya                                            __attribute__((unused)) const struct GEN7_3DSTATE_BINDING_TABLE_POINTERS_GS * restrict values)
151010e230b6Smaya{
151110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
151210e230b6Smaya
151310e230b6Smaya   dw[0] =
151410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
151510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
151610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
151710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
151810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
151910e230b6Smaya
152010e230b6Smaya   dw[1] =
152110e230b6Smaya      __gen_offset(values->PointertoGSBindingTable, 5, 15);
152210e230b6Smaya}
152310e230b6Smaya
152410e230b6Smaya#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_HS_length      2
152510e230b6Smaya#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_HS_length_bias      2
152610e230b6Smaya#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_HS_header\
152710e230b6Smaya   .DWordLength                         =      0,  \
152810e230b6Smaya   ._3DCommandSubOpcode                 =     39,  \
152910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
153010e230b6Smaya   .CommandSubType                      =      3,  \
153110e230b6Smaya   .CommandType                         =      3
153210e230b6Smaya
153310e230b6Smayastruct GEN7_3DSTATE_BINDING_TABLE_POINTERS_HS {
153410e230b6Smaya   uint32_t                             DWordLength;
153510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
153610e230b6Smaya   uint32_t                             _3DCommandOpcode;
153710e230b6Smaya   uint32_t                             CommandSubType;
153810e230b6Smaya   uint32_t                             CommandType;
153910e230b6Smaya   uint64_t                             PointertoHSBindingTable;
154010e230b6Smaya};
154110e230b6Smaya
154210e230b6Smayastatic inline void
154310e230b6SmayaGEN7_3DSTATE_BINDING_TABLE_POINTERS_HS_pack(__attribute__((unused)) __gen_user_data *data,
154410e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
154510e230b6Smaya                                            __attribute__((unused)) const struct GEN7_3DSTATE_BINDING_TABLE_POINTERS_HS * restrict values)
154610e230b6Smaya{
154710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
154810e230b6Smaya
154910e230b6Smaya   dw[0] =
155010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
155110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
155210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
155310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
155410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
155510e230b6Smaya
155610e230b6Smaya   dw[1] =
155710e230b6Smaya      __gen_offset(values->PointertoHSBindingTable, 5, 15);
155810e230b6Smaya}
155910e230b6Smaya
156010e230b6Smaya#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_PS_length      2
156110e230b6Smaya#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_PS_length_bias      2
156210e230b6Smaya#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_PS_header\
156310e230b6Smaya   .DWordLength                         =      0,  \
156410e230b6Smaya   ._3DCommandSubOpcode                 =     42,  \
156510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
156610e230b6Smaya   .CommandSubType                      =      3,  \
156710e230b6Smaya   .CommandType                         =      3
156810e230b6Smaya
156910e230b6Smayastruct GEN7_3DSTATE_BINDING_TABLE_POINTERS_PS {
157010e230b6Smaya   uint32_t                             DWordLength;
157110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
157210e230b6Smaya   uint32_t                             _3DCommandOpcode;
157310e230b6Smaya   uint32_t                             CommandSubType;
157410e230b6Smaya   uint32_t                             CommandType;
157510e230b6Smaya   uint64_t                             PointertoPSBindingTable;
157610e230b6Smaya};
157710e230b6Smaya
157810e230b6Smayastatic inline void
157910e230b6SmayaGEN7_3DSTATE_BINDING_TABLE_POINTERS_PS_pack(__attribute__((unused)) __gen_user_data *data,
158010e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
158110e230b6Smaya                                            __attribute__((unused)) const struct GEN7_3DSTATE_BINDING_TABLE_POINTERS_PS * restrict values)
158210e230b6Smaya{
158310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
158410e230b6Smaya
158510e230b6Smaya   dw[0] =
158610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
158710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
158810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
158910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
159010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
159110e230b6Smaya
159210e230b6Smaya   dw[1] =
159310e230b6Smaya      __gen_offset(values->PointertoPSBindingTable, 5, 15);
159410e230b6Smaya}
159510e230b6Smaya
159610e230b6Smaya#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_VS_length      2
159710e230b6Smaya#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_VS_length_bias      2
159810e230b6Smaya#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_VS_header\
159910e230b6Smaya   .DWordLength                         =      0,  \
160010e230b6Smaya   ._3DCommandSubOpcode                 =     38,  \
160110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
160210e230b6Smaya   .CommandSubType                      =      3,  \
160310e230b6Smaya   .CommandType                         =      3
160410e230b6Smaya
160510e230b6Smayastruct GEN7_3DSTATE_BINDING_TABLE_POINTERS_VS {
160610e230b6Smaya   uint32_t                             DWordLength;
160710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
160810e230b6Smaya   uint32_t                             _3DCommandOpcode;
160910e230b6Smaya   uint32_t                             CommandSubType;
161010e230b6Smaya   uint32_t                             CommandType;
161110e230b6Smaya   uint64_t                             PointertoVSBindingTable;
161210e230b6Smaya};
161310e230b6Smaya
161410e230b6Smayastatic inline void
161510e230b6SmayaGEN7_3DSTATE_BINDING_TABLE_POINTERS_VS_pack(__attribute__((unused)) __gen_user_data *data,
161610e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
161710e230b6Smaya                                            __attribute__((unused)) const struct GEN7_3DSTATE_BINDING_TABLE_POINTERS_VS * restrict values)
161810e230b6Smaya{
161910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
162010e230b6Smaya
162110e230b6Smaya   dw[0] =
162210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
162310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
162410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
162510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
162610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
162710e230b6Smaya
162810e230b6Smaya   dw[1] =
162910e230b6Smaya      __gen_offset(values->PointertoVSBindingTable, 5, 15);
163010e230b6Smaya}
163110e230b6Smaya
163210e230b6Smaya#define GEN7_3DSTATE_BLEND_STATE_POINTERS_length      2
163310e230b6Smaya#define GEN7_3DSTATE_BLEND_STATE_POINTERS_length_bias      2
163410e230b6Smaya#define GEN7_3DSTATE_BLEND_STATE_POINTERS_header\
163510e230b6Smaya   .DWordLength                         =      0,  \
163610e230b6Smaya   ._3DCommandSubOpcode                 =     36,  \
163710e230b6Smaya   ._3DCommandOpcode                    =      0,  \
163810e230b6Smaya   .CommandSubType                      =      3,  \
163910e230b6Smaya   .CommandType                         =      3
164010e230b6Smaya
164110e230b6Smayastruct GEN7_3DSTATE_BLEND_STATE_POINTERS {
164210e230b6Smaya   uint32_t                             DWordLength;
164310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
164410e230b6Smaya   uint32_t                             _3DCommandOpcode;
164510e230b6Smaya   uint32_t                             CommandSubType;
164610e230b6Smaya   uint32_t                             CommandType;
164710e230b6Smaya   uint64_t                             BlendStatePointer;
164810e230b6Smaya};
164910e230b6Smaya
165010e230b6Smayastatic inline void
165110e230b6SmayaGEN7_3DSTATE_BLEND_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
165210e230b6Smaya                                       __attribute__((unused)) void * restrict dst,
165310e230b6Smaya                                       __attribute__((unused)) const struct GEN7_3DSTATE_BLEND_STATE_POINTERS * restrict values)
165410e230b6Smaya{
165510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
165610e230b6Smaya
165710e230b6Smaya   dw[0] =
165810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
165910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
166010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
166110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
166210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
166310e230b6Smaya
166410e230b6Smaya   dw[1] =
166510e230b6Smaya      __gen_mbo(0, 0) |
166610e230b6Smaya      __gen_offset(values->BlendStatePointer, 6, 31);
166710e230b6Smaya}
166810e230b6Smaya
166910e230b6Smaya#define GEN7_3DSTATE_CC_STATE_POINTERS_length      2
167010e230b6Smaya#define GEN7_3DSTATE_CC_STATE_POINTERS_length_bias      2
167110e230b6Smaya#define GEN7_3DSTATE_CC_STATE_POINTERS_header   \
167210e230b6Smaya   .DWordLength                         =      0,  \
167310e230b6Smaya   ._3DCommandSubOpcode                 =     14,  \
167410e230b6Smaya   ._3DCommandOpcode                    =      0,  \
167510e230b6Smaya   .CommandSubType                      =      3,  \
167610e230b6Smaya   .CommandType                         =      3
167710e230b6Smaya
167810e230b6Smayastruct GEN7_3DSTATE_CC_STATE_POINTERS {
167910e230b6Smaya   uint32_t                             DWordLength;
168010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
168110e230b6Smaya   uint32_t                             _3DCommandOpcode;
168210e230b6Smaya   uint32_t                             CommandSubType;
168310e230b6Smaya   uint32_t                             CommandType;
168410e230b6Smaya   uint64_t                             ColorCalcStatePointer;
168510e230b6Smaya};
168610e230b6Smaya
168710e230b6Smayastatic inline void
168810e230b6SmayaGEN7_3DSTATE_CC_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
168910e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
169010e230b6Smaya                                    __attribute__((unused)) const struct GEN7_3DSTATE_CC_STATE_POINTERS * restrict values)
169110e230b6Smaya{
169210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
169310e230b6Smaya
169410e230b6Smaya   dw[0] =
169510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
169610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
169710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
169810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
169910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
170010e230b6Smaya
170110e230b6Smaya   dw[1] =
170210e230b6Smaya      __gen_mbo(0, 0) |
170310e230b6Smaya      __gen_offset(values->ColorCalcStatePointer, 6, 31);
170410e230b6Smaya}
170510e230b6Smaya
170610e230b6Smaya#define GEN7_3DSTATE_CHROMA_KEY_length         4
170710e230b6Smaya#define GEN7_3DSTATE_CHROMA_KEY_length_bias      2
170810e230b6Smaya#define GEN7_3DSTATE_CHROMA_KEY_header          \
170910e230b6Smaya   .DWordLength                         =      2,  \
171010e230b6Smaya   ._3DCommandSubOpcode                 =      4,  \
171110e230b6Smaya   ._3DCommandOpcode                    =      1,  \
171210e230b6Smaya   .CommandSubType                      =      3,  \
171310e230b6Smaya   .CommandType                         =      3
171410e230b6Smaya
171510e230b6Smayastruct GEN7_3DSTATE_CHROMA_KEY {
171610e230b6Smaya   uint32_t                             DWordLength;
171710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
171810e230b6Smaya   uint32_t                             _3DCommandOpcode;
171910e230b6Smaya   uint32_t                             CommandSubType;
172010e230b6Smaya   uint32_t                             CommandType;
172110e230b6Smaya   uint32_t                             ChromaKeyTableIndex;
172210e230b6Smaya   uint32_t                             ChromaKeyLowValue;
172310e230b6Smaya   uint32_t                             ChromaKeyHighValue;
172410e230b6Smaya};
172510e230b6Smaya
172610e230b6Smayastatic inline void
172710e230b6SmayaGEN7_3DSTATE_CHROMA_KEY_pack(__attribute__((unused)) __gen_user_data *data,
172810e230b6Smaya                             __attribute__((unused)) void * restrict dst,
172910e230b6Smaya                             __attribute__((unused)) const struct GEN7_3DSTATE_CHROMA_KEY * restrict values)
173010e230b6Smaya{
173110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
173210e230b6Smaya
173310e230b6Smaya   dw[0] =
173410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
173510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
173610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
173710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
173810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
173910e230b6Smaya
174010e230b6Smaya   dw[1] =
174110e230b6Smaya      __gen_uint(values->ChromaKeyTableIndex, 30, 31);
174210e230b6Smaya
174310e230b6Smaya   dw[2] =
174410e230b6Smaya      __gen_uint(values->ChromaKeyLowValue, 0, 31);
174510e230b6Smaya
174610e230b6Smaya   dw[3] =
174710e230b6Smaya      __gen_uint(values->ChromaKeyHighValue, 0, 31);
174810e230b6Smaya}
174910e230b6Smaya
175010e230b6Smaya#define GEN7_3DSTATE_CLEAR_PARAMS_length       3
175110e230b6Smaya#define GEN7_3DSTATE_CLEAR_PARAMS_length_bias      2
175210e230b6Smaya#define GEN7_3DSTATE_CLEAR_PARAMS_header        \
175310e230b6Smaya   .DWordLength                         =      1,  \
175410e230b6Smaya   ._3DCommandSubOpcode                 =      4,  \
175510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
175610e230b6Smaya   .CommandSubType                      =      3,  \
175710e230b6Smaya   .CommandType                         =      3
175810e230b6Smaya
175910e230b6Smayastruct GEN7_3DSTATE_CLEAR_PARAMS {
176010e230b6Smaya   uint32_t                             DWordLength;
176110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
176210e230b6Smaya   uint32_t                             _3DCommandOpcode;
176310e230b6Smaya   uint32_t                             CommandSubType;
176410e230b6Smaya   uint32_t                             CommandType;
176510e230b6Smaya   uint32_t                             DepthClearValue;
176610e230b6Smaya   bool                                 DepthClearValueValid;
176710e230b6Smaya};
176810e230b6Smaya
176910e230b6Smayastatic inline void
177010e230b6SmayaGEN7_3DSTATE_CLEAR_PARAMS_pack(__attribute__((unused)) __gen_user_data *data,
177110e230b6Smaya                               __attribute__((unused)) void * restrict dst,
177210e230b6Smaya                               __attribute__((unused)) const struct GEN7_3DSTATE_CLEAR_PARAMS * restrict values)
177310e230b6Smaya{
177410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
177510e230b6Smaya
177610e230b6Smaya   dw[0] =
177710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
177810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
177910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
178010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
178110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
178210e230b6Smaya
178310e230b6Smaya   dw[1] =
178410e230b6Smaya      __gen_uint(values->DepthClearValue, 0, 31);
178510e230b6Smaya
178610e230b6Smaya   dw[2] =
178710e230b6Smaya      __gen_uint(values->DepthClearValueValid, 0, 0);
178810e230b6Smaya}
178910e230b6Smaya
179010e230b6Smaya#define GEN7_3DSTATE_CLIP_length               4
179110e230b6Smaya#define GEN7_3DSTATE_CLIP_length_bias          2
179210e230b6Smaya#define GEN7_3DSTATE_CLIP_header                \
179310e230b6Smaya   .DWordLength                         =      2,  \
179410e230b6Smaya   ._3DCommandSubOpcode                 =     18,  \
179510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
179610e230b6Smaya   .CommandSubType                      =      3,  \
179710e230b6Smaya   .CommandType                         =      3
179810e230b6Smaya
179910e230b6Smayastruct GEN7_3DSTATE_CLIP {
180010e230b6Smaya   uint32_t                             DWordLength;
180110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
180210e230b6Smaya   uint32_t                             _3DCommandOpcode;
180310e230b6Smaya   uint32_t                             CommandSubType;
180410e230b6Smaya   uint32_t                             CommandType;
180510e230b6Smaya   uint32_t                             UserClipDistanceCullTestEnableBitmask;
180610e230b6Smaya   bool                                 StatisticsEnable;
180710e230b6Smaya   uint32_t                             CullMode;
180810e230b6Smaya#define CULLMODE_BOTH                            0
180910e230b6Smaya#define CULLMODE_NONE                            1
181010e230b6Smaya#define CULLMODE_FRONT                           2
181110e230b6Smaya#define CULLMODE_BACK                            3
181210e230b6Smaya   bool                                 EarlyCullEnable;
181310e230b6Smaya   uint32_t                             VertexSubPixelPrecisionSelect;
181410e230b6Smaya   uint32_t                             FrontWinding;
181510e230b6Smaya   uint32_t                             TriangleFanProvokingVertexSelect;
181610e230b6Smaya#define Vertex0                                  0
181710e230b6Smaya#define Vertex1                                  1
181810e230b6Smaya#define Vertex2                                  2
181910e230b6Smaya   uint32_t                             LineStripListProvokingVertexSelect;
182010e230b6Smaya#define Vertex0                                  0
182110e230b6Smaya#define Vertex1                                  1
182210e230b6Smaya   uint32_t                             TriangleStripListProvokingVertexSelect;
182310e230b6Smaya#define Vertex0                                  0
182410e230b6Smaya#define Vertex1                                  1
182510e230b6Smaya#define Vertex2                                  2
182610e230b6Smaya   bool                                 NonPerspectiveBarycentricEnable;
182710e230b6Smaya   bool                                 PerspectiveDivideDisable;
182810e230b6Smaya   uint32_t                             ClipMode;
182910e230b6Smaya#define CLIPMODE_NORMAL                          0
183010e230b6Smaya#define CLIPMODE_REJECT_ALL                      3
183110e230b6Smaya#define CLIPMODE_ACCEPT_ALL                      4
183210e230b6Smaya   uint32_t                             UserClipDistanceClipTestEnableBitmask;
183310e230b6Smaya   bool                                 GuardbandClipTestEnable;
183410e230b6Smaya   bool                                 ViewportZClipTestEnable;
183510e230b6Smaya   bool                                 ViewportXYClipTestEnable;
183610e230b6Smaya   uint32_t                             APIMode;
183710e230b6Smaya#define APIMODE_OGL                              0
183810e230b6Smaya#define APIMODE_D3D                              1
183910e230b6Smaya   bool                                 ClipEnable;
184010e230b6Smaya   uint32_t                             MaximumVPIndex;
184110e230b6Smaya   bool                                 ForceZeroRTAIndexEnable;
184210e230b6Smaya   float                                MaximumPointWidth;
184310e230b6Smaya   float                                MinimumPointWidth;
184410e230b6Smaya};
184510e230b6Smaya
184610e230b6Smayastatic inline void
184710e230b6SmayaGEN7_3DSTATE_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
184810e230b6Smaya                       __attribute__((unused)) void * restrict dst,
184910e230b6Smaya                       __attribute__((unused)) const struct GEN7_3DSTATE_CLIP * restrict values)
185010e230b6Smaya{
185110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
185210e230b6Smaya
185310e230b6Smaya   dw[0] =
185410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
185510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
185610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
185710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
185810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
185910e230b6Smaya
186010e230b6Smaya   dw[1] =
186110e230b6Smaya      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
186210e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
186310e230b6Smaya      __gen_uint(values->CullMode, 16, 17) |
186410e230b6Smaya      __gen_uint(values->EarlyCullEnable, 18, 18) |
186510e230b6Smaya      __gen_uint(values->VertexSubPixelPrecisionSelect, 19, 19) |
186610e230b6Smaya      __gen_uint(values->FrontWinding, 20, 20);
186710e230b6Smaya
186810e230b6Smaya   dw[2] =
186910e230b6Smaya      __gen_uint(values->TriangleFanProvokingVertexSelect, 0, 1) |
187010e230b6Smaya      __gen_uint(values->LineStripListProvokingVertexSelect, 2, 3) |
187110e230b6Smaya      __gen_uint(values->TriangleStripListProvokingVertexSelect, 4, 5) |
187210e230b6Smaya      __gen_uint(values->NonPerspectiveBarycentricEnable, 8, 8) |
187310e230b6Smaya      __gen_uint(values->PerspectiveDivideDisable, 9, 9) |
187410e230b6Smaya      __gen_uint(values->ClipMode, 13, 15) |
187510e230b6Smaya      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 16, 23) |
187610e230b6Smaya      __gen_uint(values->GuardbandClipTestEnable, 26, 26) |
187710e230b6Smaya      __gen_uint(values->ViewportZClipTestEnable, 27, 27) |
187810e230b6Smaya      __gen_uint(values->ViewportXYClipTestEnable, 28, 28) |
187910e230b6Smaya      __gen_uint(values->APIMode, 30, 30) |
188010e230b6Smaya      __gen_uint(values->ClipEnable, 31, 31);
188110e230b6Smaya
188210e230b6Smaya   dw[3] =
188310e230b6Smaya      __gen_uint(values->MaximumVPIndex, 0, 3) |
188410e230b6Smaya      __gen_uint(values->ForceZeroRTAIndexEnable, 5, 5) |
188510e230b6Smaya      __gen_ufixed(values->MaximumPointWidth, 6, 16, 3) |
188610e230b6Smaya      __gen_ufixed(values->MinimumPointWidth, 17, 27, 3);
188710e230b6Smaya}
188810e230b6Smaya
188910e230b6Smaya#define GEN7_3DSTATE_CONSTANT_DS_length        7
189010e230b6Smaya#define GEN7_3DSTATE_CONSTANT_DS_length_bias      2
189110e230b6Smaya#define GEN7_3DSTATE_CONSTANT_DS_header         \
189210e230b6Smaya   .DWordLength                         =      5,  \
189310e230b6Smaya   ._3DCommandSubOpcode                 =     26,  \
189410e230b6Smaya   ._3DCommandOpcode                    =      0,  \
189510e230b6Smaya   .CommandSubType                      =      3,  \
189610e230b6Smaya   .CommandType                         =      3
189710e230b6Smaya
189810e230b6Smayastruct GEN7_3DSTATE_CONSTANT_DS {
189910e230b6Smaya   uint32_t                             DWordLength;
190010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
190110e230b6Smaya   uint32_t                             _3DCommandOpcode;
190210e230b6Smaya   uint32_t                             CommandSubType;
190310e230b6Smaya   uint32_t                             CommandType;
190410e230b6Smaya   struct GEN7_3DSTATE_CONSTANT_BODY    ConstantBody;
190510e230b6Smaya};
190610e230b6Smaya
190710e230b6Smayastatic inline void
190810e230b6SmayaGEN7_3DSTATE_CONSTANT_DS_pack(__attribute__((unused)) __gen_user_data *data,
190910e230b6Smaya                              __attribute__((unused)) void * restrict dst,
191010e230b6Smaya                              __attribute__((unused)) const struct GEN7_3DSTATE_CONSTANT_DS * restrict values)
191110e230b6Smaya{
191210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
191310e230b6Smaya
191410e230b6Smaya   dw[0] =
191510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
191610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
191710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
191810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
191910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
192010e230b6Smaya
192110e230b6Smaya   GEN7_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
192210e230b6Smaya}
192310e230b6Smaya
192410e230b6Smaya#define GEN7_3DSTATE_CONSTANT_GS_length        7
192510e230b6Smaya#define GEN7_3DSTATE_CONSTANT_GS_length_bias      2
192610e230b6Smaya#define GEN7_3DSTATE_CONSTANT_GS_header         \
192710e230b6Smaya   .DWordLength                         =      5,  \
192810e230b6Smaya   ._3DCommandSubOpcode                 =     22,  \
192910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
193010e230b6Smaya   .CommandSubType                      =      3,  \
193110e230b6Smaya   .CommandType                         =      3
193210e230b6Smaya
193310e230b6Smayastruct GEN7_3DSTATE_CONSTANT_GS {
193410e230b6Smaya   uint32_t                             DWordLength;
193510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
193610e230b6Smaya   uint32_t                             _3DCommandOpcode;
193710e230b6Smaya   uint32_t                             CommandSubType;
193810e230b6Smaya   uint32_t                             CommandType;
193910e230b6Smaya   struct GEN7_3DSTATE_CONSTANT_BODY    ConstantBody;
194010e230b6Smaya};
194110e230b6Smaya
194210e230b6Smayastatic inline void
194310e230b6SmayaGEN7_3DSTATE_CONSTANT_GS_pack(__attribute__((unused)) __gen_user_data *data,
194410e230b6Smaya                              __attribute__((unused)) void * restrict dst,
194510e230b6Smaya                              __attribute__((unused)) const struct GEN7_3DSTATE_CONSTANT_GS * restrict values)
194610e230b6Smaya{
194710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
194810e230b6Smaya
194910e230b6Smaya   dw[0] =
195010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
195110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
195210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
195310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
195410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
195510e230b6Smaya
195610e230b6Smaya   GEN7_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
195710e230b6Smaya}
195810e230b6Smaya
195910e230b6Smaya#define GEN7_3DSTATE_CONSTANT_HS_length        7
196010e230b6Smaya#define GEN7_3DSTATE_CONSTANT_HS_length_bias      2
196110e230b6Smaya#define GEN7_3DSTATE_CONSTANT_HS_header         \
196210e230b6Smaya   .DWordLength                         =      5,  \
196310e230b6Smaya   ._3DCommandSubOpcode                 =     25,  \
196410e230b6Smaya   ._3DCommandOpcode                    =      0,  \
196510e230b6Smaya   .CommandSubType                      =      3,  \
196610e230b6Smaya   .CommandType                         =      3
196710e230b6Smaya
196810e230b6Smayastruct GEN7_3DSTATE_CONSTANT_HS {
196910e230b6Smaya   uint32_t                             DWordLength;
197010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
197110e230b6Smaya   uint32_t                             _3DCommandOpcode;
197210e230b6Smaya   uint32_t                             CommandSubType;
197310e230b6Smaya   uint32_t                             CommandType;
197410e230b6Smaya   struct GEN7_3DSTATE_CONSTANT_BODY    ConstantBody;
197510e230b6Smaya};
197610e230b6Smaya
197710e230b6Smayastatic inline void
197810e230b6SmayaGEN7_3DSTATE_CONSTANT_HS_pack(__attribute__((unused)) __gen_user_data *data,
197910e230b6Smaya                              __attribute__((unused)) void * restrict dst,
198010e230b6Smaya                              __attribute__((unused)) const struct GEN7_3DSTATE_CONSTANT_HS * restrict values)
198110e230b6Smaya{
198210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
198310e230b6Smaya
198410e230b6Smaya   dw[0] =
198510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
198610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
198710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
198810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
198910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
199010e230b6Smaya
199110e230b6Smaya   GEN7_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
199210e230b6Smaya}
199310e230b6Smaya
199410e230b6Smaya#define GEN7_3DSTATE_CONSTANT_PS_length        7
199510e230b6Smaya#define GEN7_3DSTATE_CONSTANT_PS_length_bias      2
199610e230b6Smaya#define GEN7_3DSTATE_CONSTANT_PS_header         \
199710e230b6Smaya   .DWordLength                         =      5,  \
199810e230b6Smaya   ._3DCommandSubOpcode                 =     23,  \
199910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
200010e230b6Smaya   .CommandSubType                      =      3,  \
200110e230b6Smaya   .CommandType                         =      3
200210e230b6Smaya
200310e230b6Smayastruct GEN7_3DSTATE_CONSTANT_PS {
200410e230b6Smaya   uint32_t                             DWordLength;
200510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
200610e230b6Smaya   uint32_t                             _3DCommandOpcode;
200710e230b6Smaya   uint32_t                             CommandSubType;
200810e230b6Smaya   uint32_t                             CommandType;
200910e230b6Smaya   struct GEN7_3DSTATE_CONSTANT_BODY    ConstantBody;
201010e230b6Smaya};
201110e230b6Smaya
201210e230b6Smayastatic inline void
201310e230b6SmayaGEN7_3DSTATE_CONSTANT_PS_pack(__attribute__((unused)) __gen_user_data *data,
201410e230b6Smaya                              __attribute__((unused)) void * restrict dst,
201510e230b6Smaya                              __attribute__((unused)) const struct GEN7_3DSTATE_CONSTANT_PS * restrict values)
201610e230b6Smaya{
201710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
201810e230b6Smaya
201910e230b6Smaya   dw[0] =
202010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
202110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
202210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
202310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
202410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
202510e230b6Smaya
202610e230b6Smaya   GEN7_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
202710e230b6Smaya}
202810e230b6Smaya
202910e230b6Smaya#define GEN7_3DSTATE_CONSTANT_VS_length        7
203010e230b6Smaya#define GEN7_3DSTATE_CONSTANT_VS_length_bias      2
203110e230b6Smaya#define GEN7_3DSTATE_CONSTANT_VS_header         \
203210e230b6Smaya   .DWordLength                         =      5,  \
203310e230b6Smaya   ._3DCommandSubOpcode                 =     21,  \
203410e230b6Smaya   ._3DCommandOpcode                    =      0,  \
203510e230b6Smaya   .CommandSubType                      =      3,  \
203610e230b6Smaya   .CommandType                         =      3
203710e230b6Smaya
203810e230b6Smayastruct GEN7_3DSTATE_CONSTANT_VS {
203910e230b6Smaya   uint32_t                             DWordLength;
204010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
204110e230b6Smaya   uint32_t                             _3DCommandOpcode;
204210e230b6Smaya   uint32_t                             CommandSubType;
204310e230b6Smaya   uint32_t                             CommandType;
204410e230b6Smaya   struct GEN7_3DSTATE_CONSTANT_BODY    ConstantBody;
204510e230b6Smaya};
204610e230b6Smaya
204710e230b6Smayastatic inline void
204810e230b6SmayaGEN7_3DSTATE_CONSTANT_VS_pack(__attribute__((unused)) __gen_user_data *data,
204910e230b6Smaya                              __attribute__((unused)) void * restrict dst,
205010e230b6Smaya                              __attribute__((unused)) const struct GEN7_3DSTATE_CONSTANT_VS * restrict values)
205110e230b6Smaya{
205210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
205310e230b6Smaya
205410e230b6Smaya   dw[0] =
205510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
205610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
205710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
205810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
205910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
206010e230b6Smaya
206110e230b6Smaya   GEN7_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
206210e230b6Smaya}
206310e230b6Smaya
206410e230b6Smaya#define GEN7_3DSTATE_DEPTH_BUFFER_length       7
206510e230b6Smaya#define GEN7_3DSTATE_DEPTH_BUFFER_length_bias      2
206610e230b6Smaya#define GEN7_3DSTATE_DEPTH_BUFFER_header        \
206710e230b6Smaya   .DWordLength                         =      5,  \
206810e230b6Smaya   ._3DCommandSubOpcode                 =      5,  \
206910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
207010e230b6Smaya   .CommandSubType                      =      3,  \
207110e230b6Smaya   .CommandType                         =      3
207210e230b6Smaya
207310e230b6Smayastruct GEN7_3DSTATE_DEPTH_BUFFER {
207410e230b6Smaya   uint32_t                             DWordLength;
207510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
207610e230b6Smaya   uint32_t                             _3DCommandOpcode;
207710e230b6Smaya   uint32_t                             CommandSubType;
207810e230b6Smaya   uint32_t                             CommandType;
207910e230b6Smaya   uint32_t                             SurfacePitch;
208010e230b6Smaya   uint32_t                             SurfaceFormat;
208110e230b6Smaya#define D32_FLOAT                                1
208210e230b6Smaya#define D24_UNORM_X8_UINT                        3
208310e230b6Smaya#define D16_UNORM                                5
208410e230b6Smaya   bool                                 HierarchicalDepthBufferEnable;
208510e230b6Smaya   bool                                 StencilWriteEnable;
208610e230b6Smaya   bool                                 DepthWriteEnable;
208710e230b6Smaya   uint32_t                             SurfaceType;
208810e230b6Smaya#define SURFTYPE_1D                              0
208910e230b6Smaya#define SURFTYPE_2D                              1
209010e230b6Smaya#define SURFTYPE_3D                              2
209110e230b6Smaya#define SURFTYPE_CUBE                            3
209210e230b6Smaya#define SURFTYPE_NULL                            7
209310e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
209410e230b6Smaya   uint32_t                             LOD;
209510e230b6Smaya   uint32_t                             Width;
209610e230b6Smaya   uint32_t                             Height;
209710e230b6Smaya   uint32_t                             MOCS;
209810e230b6Smaya   uint32_t                             MinimumArrayElement;
209910e230b6Smaya   uint32_t                             Depth;
210010e230b6Smaya#define SURFTYPE_CUBEmustbezero                  0
210110e230b6Smaya   int32_t                              DepthCoordinateOffsetX;
210210e230b6Smaya   int32_t                              DepthCoordinateOffsetY;
210310e230b6Smaya   uint32_t                             RenderTargetViewExtent;
210410e230b6Smaya};
210510e230b6Smaya
210610e230b6Smayastatic inline void
210710e230b6SmayaGEN7_3DSTATE_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
210810e230b6Smaya                               __attribute__((unused)) void * restrict dst,
210910e230b6Smaya                               __attribute__((unused)) const struct GEN7_3DSTATE_DEPTH_BUFFER * restrict values)
211010e230b6Smaya{
211110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
211210e230b6Smaya
211310e230b6Smaya   dw[0] =
211410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
211510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
211610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
211710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
211810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
211910e230b6Smaya
212010e230b6Smaya   dw[1] =
212110e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 17) |
212210e230b6Smaya      __gen_uint(values->SurfaceFormat, 18, 20) |
212310e230b6Smaya      __gen_uint(values->HierarchicalDepthBufferEnable, 22, 22) |
212410e230b6Smaya      __gen_uint(values->StencilWriteEnable, 27, 27) |
212510e230b6Smaya      __gen_uint(values->DepthWriteEnable, 28, 28) |
212610e230b6Smaya      __gen_uint(values->SurfaceType, 29, 31);
212710e230b6Smaya
212810e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
212910e230b6Smaya
213010e230b6Smaya   dw[3] =
213110e230b6Smaya      __gen_uint(values->LOD, 0, 3) |
213210e230b6Smaya      __gen_uint(values->Width, 4, 17) |
213310e230b6Smaya      __gen_uint(values->Height, 18, 31);
213410e230b6Smaya
213510e230b6Smaya   dw[4] =
213610e230b6Smaya      __gen_uint(values->MOCS, 0, 3) |
213710e230b6Smaya      __gen_uint(values->MinimumArrayElement, 10, 20) |
213810e230b6Smaya      __gen_uint(values->Depth, 21, 31);
213910e230b6Smaya
214010e230b6Smaya   dw[5] =
214110e230b6Smaya      __gen_sint(values->DepthCoordinateOffsetX, 0, 15) |
214210e230b6Smaya      __gen_sint(values->DepthCoordinateOffsetY, 16, 31);
214310e230b6Smaya
214410e230b6Smaya   dw[6] =
214510e230b6Smaya      __gen_uint(values->RenderTargetViewExtent, 21, 31);
214610e230b6Smaya}
214710e230b6Smaya
214810e230b6Smaya#define GEN7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS_length      2
214910e230b6Smaya#define GEN7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS_length_bias      2
215010e230b6Smaya#define GEN7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS_header\
215110e230b6Smaya   .DWordLength                         =      0,  \
215210e230b6Smaya   ._3DCommandSubOpcode                 =     37,  \
215310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
215410e230b6Smaya   .CommandSubType                      =      3,  \
215510e230b6Smaya   .CommandType                         =      3
215610e230b6Smaya
215710e230b6Smayastruct GEN7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS {
215810e230b6Smaya   uint32_t                             DWordLength;
215910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
216010e230b6Smaya   uint32_t                             _3DCommandOpcode;
216110e230b6Smaya   uint32_t                             CommandSubType;
216210e230b6Smaya   uint32_t                             CommandType;
216310e230b6Smaya   uint64_t                             PointertoDEPTH_STENCIL_STATE;
216410e230b6Smaya};
216510e230b6Smaya
216610e230b6Smayastatic inline void
216710e230b6SmayaGEN7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
216810e230b6Smaya                                               __attribute__((unused)) void * restrict dst,
216910e230b6Smaya                                               __attribute__((unused)) const struct GEN7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS * restrict values)
217010e230b6Smaya{
217110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
217210e230b6Smaya
217310e230b6Smaya   dw[0] =
217410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
217510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
217610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
217710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
217810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
217910e230b6Smaya
218010e230b6Smaya   dw[1] =
218110e230b6Smaya      __gen_mbo(0, 0) |
218210e230b6Smaya      __gen_offset(values->PointertoDEPTH_STENCIL_STATE, 6, 31);
218310e230b6Smaya}
218410e230b6Smaya
218510e230b6Smaya#define GEN7_3DSTATE_DRAWING_RECTANGLE_length      4
218610e230b6Smaya#define GEN7_3DSTATE_DRAWING_RECTANGLE_length_bias      2
218710e230b6Smaya#define GEN7_3DSTATE_DRAWING_RECTANGLE_header   \
218810e230b6Smaya   .DWordLength                         =      2,  \
218910e230b6Smaya   ._3DCommandSubOpcode                 =      0,  \
219010e230b6Smaya   ._3DCommandOpcode                    =      1,  \
219110e230b6Smaya   .CommandSubType                      =      3,  \
219210e230b6Smaya   .CommandType                         =      3
219310e230b6Smaya
219410e230b6Smayastruct GEN7_3DSTATE_DRAWING_RECTANGLE {
219510e230b6Smaya   uint32_t                             DWordLength;
219610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
219710e230b6Smaya   uint32_t                             _3DCommandOpcode;
219810e230b6Smaya   uint32_t                             CommandSubType;
219910e230b6Smaya   uint32_t                             CommandType;
220010e230b6Smaya   uint32_t                             ClippedDrawingRectangleXMin;
220110e230b6Smaya   uint32_t                             ClippedDrawingRectangleYMin;
220210e230b6Smaya   uint32_t                             ClippedDrawingRectangleXMax;
220310e230b6Smaya   uint32_t                             ClippedDrawingRectangleYMax;
220410e230b6Smaya   int32_t                              DrawingRectangleOriginX;
220510e230b6Smaya   int32_t                              DrawingRectangleOriginY;
220610e230b6Smaya};
220710e230b6Smaya
220810e230b6Smayastatic inline void
220910e230b6SmayaGEN7_3DSTATE_DRAWING_RECTANGLE_pack(__attribute__((unused)) __gen_user_data *data,
221010e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
221110e230b6Smaya                                    __attribute__((unused)) const struct GEN7_3DSTATE_DRAWING_RECTANGLE * restrict values)
221210e230b6Smaya{
221310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
221410e230b6Smaya
221510e230b6Smaya   dw[0] =
221610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
221710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
221810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
221910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
222010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
222110e230b6Smaya
222210e230b6Smaya   dw[1] =
222310e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleXMin, 0, 15) |
222410e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleYMin, 16, 31);
222510e230b6Smaya
222610e230b6Smaya   dw[2] =
222710e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleXMax, 0, 15) |
222810e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleYMax, 16, 31);
222910e230b6Smaya
223010e230b6Smaya   dw[3] =
223110e230b6Smaya      __gen_sint(values->DrawingRectangleOriginX, 0, 15) |
223210e230b6Smaya      __gen_sint(values->DrawingRectangleOriginY, 16, 31);
223310e230b6Smaya}
223410e230b6Smaya
223510e230b6Smaya#define GEN7_3DSTATE_DS_length                 6
223610e230b6Smaya#define GEN7_3DSTATE_DS_length_bias            2
223710e230b6Smaya#define GEN7_3DSTATE_DS_header                  \
223810e230b6Smaya   .DWordLength                         =      4,  \
223910e230b6Smaya   ._3DCommandSubOpcode                 =     29,  \
224010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
224110e230b6Smaya   .CommandSubType                      =      3,  \
224210e230b6Smaya   .CommandType                         =      3
224310e230b6Smaya
224410e230b6Smayastruct GEN7_3DSTATE_DS {
224510e230b6Smaya   uint32_t                             DWordLength;
224610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
224710e230b6Smaya   uint32_t                             _3DCommandOpcode;
224810e230b6Smaya   uint32_t                             CommandSubType;
224910e230b6Smaya   uint32_t                             CommandType;
225010e230b6Smaya   uint64_t                             KernelStartPointer;
225110e230b6Smaya   bool                                 SoftwareExceptionEnable;
225210e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
225310e230b6Smaya   uint32_t                             FloatingPointMode;
225410e230b6Smaya#define IEEE754                                  0
225510e230b6Smaya#define Alternate                                1
225610e230b6Smaya   uint32_t                             BindingTableEntryCount;
225710e230b6Smaya   uint32_t                             SamplerCount;
225810e230b6Smaya#define NoSamplers                               0
225910e230b6Smaya#define _14Samplers                              1
226010e230b6Smaya#define _58Samplers                              2
226110e230b6Smaya#define _912Samplers                             3
226210e230b6Smaya#define _1316Samplers                            4
226310e230b6Smaya   bool                                 VectorMaskEnable;
226410e230b6Smaya   uint32_t                             SingleDomainPointDispatch;
226510e230b6Smaya   uint32_t                             PerThreadScratchSpace;
226610e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
226710e230b6Smaya   uint32_t                             PatchURBEntryReadOffset;
226810e230b6Smaya   uint32_t                             PatchURBEntryReadLength;
226910e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData;
227010e230b6Smaya   bool                                 Enable;
227110e230b6Smaya   bool                                 DSCacheDisable;
227210e230b6Smaya   bool                                 ComputeWCoordinateEnable;
227310e230b6Smaya   bool                                 StatisticsEnable;
227410e230b6Smaya   uint32_t                             MaximumNumberofThreads;
227510e230b6Smaya};
227610e230b6Smaya
227710e230b6Smayastatic inline void
227810e230b6SmayaGEN7_3DSTATE_DS_pack(__attribute__((unused)) __gen_user_data *data,
227910e230b6Smaya                     __attribute__((unused)) void * restrict dst,
228010e230b6Smaya                     __attribute__((unused)) const struct GEN7_3DSTATE_DS * restrict values)
228110e230b6Smaya{
228210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
228310e230b6Smaya
228410e230b6Smaya   dw[0] =
228510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
228610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
228710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
228810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
228910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
229010e230b6Smaya
229110e230b6Smaya   dw[1] =
229210e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 31);
229310e230b6Smaya
229410e230b6Smaya   dw[2] =
229510e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
229610e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
229710e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
229810e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
229910e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
230010e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
230110e230b6Smaya      __gen_uint(values->SingleDomainPointDispatch, 31, 31);
230210e230b6Smaya
230310e230b6Smaya   const uint32_t v3 =
230410e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
230510e230b6Smaya   dw[3] = __gen_combine_address(data, &dw[3], values->ScratchSpaceBasePointer, v3);
230610e230b6Smaya
230710e230b6Smaya   dw[4] =
230810e230b6Smaya      __gen_uint(values->PatchURBEntryReadOffset, 4, 9) |
230910e230b6Smaya      __gen_uint(values->PatchURBEntryReadLength, 11, 17) |
231010e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
231110e230b6Smaya
231210e230b6Smaya   dw[5] =
231310e230b6Smaya      __gen_uint(values->Enable, 0, 0) |
231410e230b6Smaya      __gen_uint(values->DSCacheDisable, 1, 1) |
231510e230b6Smaya      __gen_uint(values->ComputeWCoordinateEnable, 2, 2) |
231610e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
231710e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 25, 31);
231810e230b6Smaya}
231910e230b6Smaya
232010e230b6Smaya#define GEN7_3DSTATE_GS_length                 7
232110e230b6Smaya#define GEN7_3DSTATE_GS_length_bias            2
232210e230b6Smaya#define GEN7_3DSTATE_GS_header                  \
232310e230b6Smaya   .DWordLength                         =      5,  \
232410e230b6Smaya   ._3DCommandSubOpcode                 =     17,  \
232510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
232610e230b6Smaya   .CommandSubType                      =      3,  \
232710e230b6Smaya   .CommandType                         =      3
232810e230b6Smaya
232910e230b6Smayastruct GEN7_3DSTATE_GS {
233010e230b6Smaya   uint32_t                             DWordLength;
233110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
233210e230b6Smaya   uint32_t                             _3DCommandOpcode;
233310e230b6Smaya   uint32_t                             CommandSubType;
233410e230b6Smaya   uint32_t                             CommandType;
233510e230b6Smaya   uint64_t                             KernelStartPointer;
233610e230b6Smaya   bool                                 SoftwareExceptionEnable;
233710e230b6Smaya   bool                                 MaskStackExceptionEnable;
233810e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
233910e230b6Smaya   uint32_t                             FloatingPointMode;
234010e230b6Smaya#define IEEE754                                  0
234110e230b6Smaya#define alternate                                1
234210e230b6Smaya   uint32_t                             ThreadPriority;
234310e230b6Smaya#define NormalPriority                           0
234410e230b6Smaya#define HighPriority                             1
234510e230b6Smaya   uint32_t                             BindingTableEntryCount;
234610e230b6Smaya   uint32_t                             SamplerCount;
234710e230b6Smaya#define NoSamplers                               0
234810e230b6Smaya#define _14Samplers                              1
234910e230b6Smaya#define _58Samplers                              2
235010e230b6Smaya#define _912Samplers                             3
235110e230b6Smaya#define _1316Samplers                            4
235210e230b6Smaya   bool                                 VectorMaskEnable;
235310e230b6Smaya   bool                                 SingleProgramFlow;
235410e230b6Smaya   uint32_t                             PerThreadScratchSpace;
235510e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
235610e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData;
235710e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
235810e230b6Smaya   bool                                 IncludeVertexHandles;
235910e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
236010e230b6Smaya   enum GEN7_3D_Prim_Topo_Type          OutputTopology;
236110e230b6Smaya   uint32_t                             OutputVertexSize;
236210e230b6Smaya   bool                                 Enable;
236310e230b6Smaya   bool                                 DiscardAdjacency;
236410e230b6Smaya   uint32_t                             ReorderMode;
236510e230b6Smaya#define LEADING                                  0
236610e230b6Smaya#define TRAILING                                 1
236710e230b6Smaya   uint32_t                             Hint;
236810e230b6Smaya   bool                                 IncludePrimitiveID;
236910e230b6Smaya   uint32_t                             GSInvocationsIncrementValue;
237010e230b6Smaya   uint32_t                             StatisticsEnable;
237110e230b6Smaya   uint32_t                             DispatchMode;
237210e230b6Smaya#define DISPATCH_MODE_SINGLE                     0
237310e230b6Smaya#define DISPATCH_MODE_DUAL_INSTANCE              1
237410e230b6Smaya#define DISPATCH_MODE_DUAL_OBJECT                2
237510e230b6Smaya   uint32_t                             DefaultStreamID;
237610e230b6Smaya   uint32_t                             InstanceControl;
237710e230b6Smaya   uint32_t                             ControlDataHeaderSize;
237810e230b6Smaya   uint32_t                             ControlDataFormat;
237910e230b6Smaya#define GSCTL_CUT                                0
238010e230b6Smaya#define GSCTL_SID                                1
238110e230b6Smaya   uint32_t                             MaximumNumberofThreads;
238210e230b6Smaya   uint64_t                             SemaphoreHandle;
238310e230b6Smaya};
238410e230b6Smaya
238510e230b6Smayastatic inline void
238610e230b6SmayaGEN7_3DSTATE_GS_pack(__attribute__((unused)) __gen_user_data *data,
238710e230b6Smaya                     __attribute__((unused)) void * restrict dst,
238810e230b6Smaya                     __attribute__((unused)) const struct GEN7_3DSTATE_GS * restrict values)
238910e230b6Smaya{
239010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
239110e230b6Smaya
239210e230b6Smaya   dw[0] =
239310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
239410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
239510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
239610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
239710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
239810e230b6Smaya
239910e230b6Smaya   dw[1] =
240010e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 31);
240110e230b6Smaya
240210e230b6Smaya   dw[2] =
240310e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
240410e230b6Smaya      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
240510e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
240610e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
240710e230b6Smaya      __gen_uint(values->ThreadPriority, 17, 17) |
240810e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
240910e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
241010e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
241110e230b6Smaya      __gen_uint(values->SingleProgramFlow, 31, 31);
241210e230b6Smaya
241310e230b6Smaya   const uint32_t v3 =
241410e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
241510e230b6Smaya   dw[3] = __gen_combine_address(data, &dw[3], values->ScratchSpaceBasePointer, v3);
241610e230b6Smaya
241710e230b6Smaya   dw[4] =
241810e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData, 0, 3) |
241910e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
242010e230b6Smaya      __gen_uint(values->IncludeVertexHandles, 10, 10) |
242110e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
242210e230b6Smaya      __gen_uint(values->OutputTopology, 17, 22) |
242310e230b6Smaya      __gen_uint(values->OutputVertexSize, 23, 28);
242410e230b6Smaya
242510e230b6Smaya   dw[5] =
242610e230b6Smaya      __gen_uint(values->Enable, 0, 0) |
242710e230b6Smaya      __gen_uint(values->DiscardAdjacency, 1, 1) |
242810e230b6Smaya      __gen_uint(values->ReorderMode, 2, 2) |
242910e230b6Smaya      __gen_uint(values->Hint, 3, 3) |
243010e230b6Smaya      __gen_uint(values->IncludePrimitiveID, 4, 4) |
243110e230b6Smaya      __gen_uint(values->GSInvocationsIncrementValue, 5, 9) |
243210e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
243310e230b6Smaya      __gen_uint(values->DispatchMode, 11, 12) |
243410e230b6Smaya      __gen_uint(values->DefaultStreamID, 13, 14) |
243510e230b6Smaya      __gen_uint(values->InstanceControl, 15, 19) |
243610e230b6Smaya      __gen_uint(values->ControlDataHeaderSize, 20, 23) |
243710e230b6Smaya      __gen_uint(values->ControlDataFormat, 24, 24) |
243810e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 25, 31);
243910e230b6Smaya
244010e230b6Smaya   dw[6] =
244110e230b6Smaya      __gen_offset(values->SemaphoreHandle, 0, 11);
244210e230b6Smaya}
244310e230b6Smaya
244410e230b6Smaya#define GEN7_3DSTATE_HIER_DEPTH_BUFFER_length      3
244510e230b6Smaya#define GEN7_3DSTATE_HIER_DEPTH_BUFFER_length_bias      2
244610e230b6Smaya#define GEN7_3DSTATE_HIER_DEPTH_BUFFER_header   \
244710e230b6Smaya   .DWordLength                         =      1,  \
244810e230b6Smaya   ._3DCommandSubOpcode                 =      7,  \
244910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
245010e230b6Smaya   .CommandSubType                      =      3,  \
245110e230b6Smaya   .CommandType                         =      3
245210e230b6Smaya
245310e230b6Smayastruct GEN7_3DSTATE_HIER_DEPTH_BUFFER {
245410e230b6Smaya   uint32_t                             DWordLength;
245510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
245610e230b6Smaya   uint32_t                             _3DCommandOpcode;
245710e230b6Smaya   uint32_t                             CommandSubType;
245810e230b6Smaya   uint32_t                             CommandType;
245910e230b6Smaya   uint32_t                             SurfacePitch;
246010e230b6Smaya   uint32_t                             MOCS;
246110e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
246210e230b6Smaya};
246310e230b6Smaya
246410e230b6Smayastatic inline void
246510e230b6SmayaGEN7_3DSTATE_HIER_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
246610e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
246710e230b6Smaya                                    __attribute__((unused)) const struct GEN7_3DSTATE_HIER_DEPTH_BUFFER * restrict values)
246810e230b6Smaya{
246910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
247010e230b6Smaya
247110e230b6Smaya   dw[0] =
247210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
247310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
247410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
247510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
247610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
247710e230b6Smaya
247810e230b6Smaya   dw[1] =
247910e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 16) |
248010e230b6Smaya      __gen_uint(values->MOCS, 25, 28);
248110e230b6Smaya
248210e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
248310e230b6Smaya}
248410e230b6Smaya
248510e230b6Smaya#define GEN7_3DSTATE_HS_length                 7
248610e230b6Smaya#define GEN7_3DSTATE_HS_length_bias            2
248710e230b6Smaya#define GEN7_3DSTATE_HS_header                  \
248810e230b6Smaya   .DWordLength                         =      5,  \
248910e230b6Smaya   ._3DCommandSubOpcode                 =     27,  \
249010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
249110e230b6Smaya   .CommandSubType                      =      3,  \
249210e230b6Smaya   .CommandType                         =      3
249310e230b6Smaya
249410e230b6Smayastruct GEN7_3DSTATE_HS {
249510e230b6Smaya   uint32_t                             DWordLength;
249610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
249710e230b6Smaya   uint32_t                             _3DCommandOpcode;
249810e230b6Smaya   uint32_t                             CommandSubType;
249910e230b6Smaya   uint32_t                             CommandType;
250010e230b6Smaya   uint32_t                             MaximumNumberofThreads;
250110e230b6Smaya   bool                                 SoftwareExceptionEnable;
250210e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
250310e230b6Smaya   uint32_t                             FloatingPointMode;
250410e230b6Smaya#define IEEE754                                  0
250510e230b6Smaya#define alternate                                1
250610e230b6Smaya   uint32_t                             BindingTableEntryCount;
250710e230b6Smaya   uint32_t                             SamplerCount;
250810e230b6Smaya#define NoSamplers                               0
250910e230b6Smaya#define _14Samplers                              1
251010e230b6Smaya#define _58Samplers                              2
251110e230b6Smaya#define _912Samplers                             3
251210e230b6Smaya#define _1316Samplers                            4
251310e230b6Smaya   uint32_t                             InstanceCount;
251410e230b6Smaya   bool                                 StatisticsEnable;
251510e230b6Smaya   bool                                 Enable;
251610e230b6Smaya   uint64_t                             KernelStartPointer;
251710e230b6Smaya   uint32_t                             PerThreadScratchSpace;
251810e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
251910e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
252010e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
252110e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData;
252210e230b6Smaya   bool                                 IncludeVertexHandles;
252310e230b6Smaya   bool                                 VectorMaskEnable;
252410e230b6Smaya   bool                                 SingleProgramFlow;
252510e230b6Smaya   uint64_t                             SemaphoreHandle;
252610e230b6Smaya};
252710e230b6Smaya
252810e230b6Smayastatic inline void
252910e230b6SmayaGEN7_3DSTATE_HS_pack(__attribute__((unused)) __gen_user_data *data,
253010e230b6Smaya                     __attribute__((unused)) void * restrict dst,
253110e230b6Smaya                     __attribute__((unused)) const struct GEN7_3DSTATE_HS * restrict values)
253210e230b6Smaya{
253310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
253410e230b6Smaya
253510e230b6Smaya   dw[0] =
253610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
253710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
253810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
253910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
254010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
254110e230b6Smaya
254210e230b6Smaya   dw[1] =
254310e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 0, 6) |
254410e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
254510e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
254610e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
254710e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
254810e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29);
254910e230b6Smaya
255010e230b6Smaya   dw[2] =
255110e230b6Smaya      __gen_uint(values->InstanceCount, 0, 3) |
255210e230b6Smaya      __gen_uint(values->StatisticsEnable, 29, 29) |
255310e230b6Smaya      __gen_uint(values->Enable, 31, 31);
255410e230b6Smaya
255510e230b6Smaya   dw[3] =
255610e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 31);
255710e230b6Smaya
255810e230b6Smaya   const uint32_t v4 =
255910e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
256010e230b6Smaya   dw[4] = __gen_combine_address(data, &dw[4], values->ScratchSpaceBasePointer, v4);
256110e230b6Smaya
256210e230b6Smaya   dw[5] =
256310e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
256410e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
256510e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData, 19, 23) |
256610e230b6Smaya      __gen_uint(values->IncludeVertexHandles, 24, 24) |
256710e230b6Smaya      __gen_uint(values->VectorMaskEnable, 26, 26) |
256810e230b6Smaya      __gen_uint(values->SingleProgramFlow, 27, 27);
256910e230b6Smaya
257010e230b6Smaya   dw[6] =
257110e230b6Smaya      __gen_offset(values->SemaphoreHandle, 0, 11);
257210e230b6Smaya}
257310e230b6Smaya
257410e230b6Smaya#define GEN7_3DSTATE_INDEX_BUFFER_length       3
257510e230b6Smaya#define GEN7_3DSTATE_INDEX_BUFFER_length_bias      2
257610e230b6Smaya#define GEN7_3DSTATE_INDEX_BUFFER_header        \
257710e230b6Smaya   .DWordLength                         =      1,  \
257810e230b6Smaya   ._3DCommandSubOpcode                 =     10,  \
257910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
258010e230b6Smaya   .CommandSubType                      =      3,  \
258110e230b6Smaya   .CommandType                         =      3
258210e230b6Smaya
258310e230b6Smayastruct GEN7_3DSTATE_INDEX_BUFFER {
258410e230b6Smaya   uint32_t                             DWordLength;
258510e230b6Smaya   uint32_t                             IndexFormat;
258610e230b6Smaya#define INDEX_BYTE                               0
258710e230b6Smaya#define INDEX_WORD                               1
258810e230b6Smaya#define INDEX_DWORD                              2
258910e230b6Smaya   bool                                 CutIndexEnable;
259010e230b6Smaya   uint32_t                             MOCS;
259110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
259210e230b6Smaya   uint32_t                             _3DCommandOpcode;
259310e230b6Smaya   uint32_t                             CommandSubType;
259410e230b6Smaya   uint32_t                             CommandType;
259510e230b6Smaya   __gen_address_type                   BufferStartingAddress;
259610e230b6Smaya   __gen_address_type                   BufferEndingAddress;
259710e230b6Smaya};
259810e230b6Smaya
259910e230b6Smayastatic inline void
260010e230b6SmayaGEN7_3DSTATE_INDEX_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
260110e230b6Smaya                               __attribute__((unused)) void * restrict dst,
260210e230b6Smaya                               __attribute__((unused)) const struct GEN7_3DSTATE_INDEX_BUFFER * restrict values)
260310e230b6Smaya{
260410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
260510e230b6Smaya
260610e230b6Smaya   dw[0] =
260710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
260810e230b6Smaya      __gen_uint(values->IndexFormat, 8, 9) |
260910e230b6Smaya      __gen_uint(values->CutIndexEnable, 10, 10) |
261010e230b6Smaya      __gen_uint(values->MOCS, 12, 15) |
261110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
261210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
261310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
261410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
261510e230b6Smaya
261610e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->BufferStartingAddress, 0);
261710e230b6Smaya
261810e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->BufferEndingAddress, 0);
261910e230b6Smaya}
262010e230b6Smaya
262110e230b6Smaya#define GEN7_3DSTATE_LINE_STIPPLE_length       3
262210e230b6Smaya#define GEN7_3DSTATE_LINE_STIPPLE_length_bias      2
262310e230b6Smaya#define GEN7_3DSTATE_LINE_STIPPLE_header        \
262410e230b6Smaya   .DWordLength                         =      1,  \
262510e230b6Smaya   ._3DCommandSubOpcode                 =      8,  \
262610e230b6Smaya   ._3DCommandOpcode                    =      1,  \
262710e230b6Smaya   .CommandSubType                      =      3,  \
262810e230b6Smaya   .CommandType                         =      3
262910e230b6Smaya
263010e230b6Smayastruct GEN7_3DSTATE_LINE_STIPPLE {
263110e230b6Smaya   uint32_t                             DWordLength;
263210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
263310e230b6Smaya   uint32_t                             _3DCommandOpcode;
263410e230b6Smaya   uint32_t                             CommandSubType;
263510e230b6Smaya   uint32_t                             CommandType;
263610e230b6Smaya   uint32_t                             LineStipplePattern;
263710e230b6Smaya   uint32_t                             CurrentStippleIndex;
263810e230b6Smaya   uint32_t                             CurrentRepeatCounter;
263910e230b6Smaya   bool                                 ModifyEnableCurrentRepeatCounterCurrentStippleIndex;
264010e230b6Smaya   uint32_t                             LineStippleRepeatCount;
264110e230b6Smaya   float                                LineStippleInverseRepeatCount;
264210e230b6Smaya};
264310e230b6Smaya
264410e230b6Smayastatic inline void
264510e230b6SmayaGEN7_3DSTATE_LINE_STIPPLE_pack(__attribute__((unused)) __gen_user_data *data,
264610e230b6Smaya                               __attribute__((unused)) void * restrict dst,
264710e230b6Smaya                               __attribute__((unused)) const struct GEN7_3DSTATE_LINE_STIPPLE * restrict values)
264810e230b6Smaya{
264910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
265010e230b6Smaya
265110e230b6Smaya   dw[0] =
265210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
265310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
265410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
265510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
265610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
265710e230b6Smaya
265810e230b6Smaya   dw[1] =
265910e230b6Smaya      __gen_uint(values->LineStipplePattern, 0, 15) |
266010e230b6Smaya      __gen_uint(values->CurrentStippleIndex, 16, 19) |
266110e230b6Smaya      __gen_uint(values->CurrentRepeatCounter, 21, 29) |
266210e230b6Smaya      __gen_uint(values->ModifyEnableCurrentRepeatCounterCurrentStippleIndex, 31, 31);
266310e230b6Smaya
266410e230b6Smaya   dw[2] =
266510e230b6Smaya      __gen_uint(values->LineStippleRepeatCount, 0, 8) |
266610e230b6Smaya      __gen_ufixed(values->LineStippleInverseRepeatCount, 15, 31, 16);
266710e230b6Smaya}
266810e230b6Smaya
266910e230b6Smaya#define GEN7_3DSTATE_MONOFILTER_SIZE_length      2
267010e230b6Smaya#define GEN7_3DSTATE_MONOFILTER_SIZE_length_bias      2
267110e230b6Smaya#define GEN7_3DSTATE_MONOFILTER_SIZE_header     \
267210e230b6Smaya   .DWordLength                         =      0,  \
267310e230b6Smaya   ._3DCommandSubOpcode                 =     17,  \
267410e230b6Smaya   ._3DCommandOpcode                    =      1,  \
267510e230b6Smaya   .CommandSubType                      =      3,  \
267610e230b6Smaya   .CommandType                         =      3
267710e230b6Smaya
267810e230b6Smayastruct GEN7_3DSTATE_MONOFILTER_SIZE {
267910e230b6Smaya   uint32_t                             DWordLength;
268010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
268110e230b6Smaya   uint32_t                             _3DCommandOpcode;
268210e230b6Smaya   uint32_t                             CommandSubType;
268310e230b6Smaya   uint32_t                             CommandType;
268410e230b6Smaya   uint32_t                             MonochromeFilterHeight;
268510e230b6Smaya   uint32_t                             MonochromeFilterWidth;
268610e230b6Smaya};
268710e230b6Smaya
268810e230b6Smayastatic inline void
268910e230b6SmayaGEN7_3DSTATE_MONOFILTER_SIZE_pack(__attribute__((unused)) __gen_user_data *data,
269010e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
269110e230b6Smaya                                  __attribute__((unused)) const struct GEN7_3DSTATE_MONOFILTER_SIZE * restrict values)
269210e230b6Smaya{
269310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
269410e230b6Smaya
269510e230b6Smaya   dw[0] =
269610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
269710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
269810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
269910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
270010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
270110e230b6Smaya
270210e230b6Smaya   dw[1] =
270310e230b6Smaya      __gen_uint(values->MonochromeFilterHeight, 0, 2) |
270410e230b6Smaya      __gen_uint(values->MonochromeFilterWidth, 3, 5);
270510e230b6Smaya}
270610e230b6Smaya
270710e230b6Smaya#define GEN7_3DSTATE_MULTISAMPLE_length        4
270810e230b6Smaya#define GEN7_3DSTATE_MULTISAMPLE_length_bias      2
270910e230b6Smaya#define GEN7_3DSTATE_MULTISAMPLE_header         \
271010e230b6Smaya   .DWordLength                         =      2,  \
271110e230b6Smaya   ._3DCommandSubOpcode                 =     13,  \
271210e230b6Smaya   ._3DCommandOpcode                    =      1,  \
271310e230b6Smaya   .CommandSubType                      =      3,  \
271410e230b6Smaya   .CommandType                         =      3
271510e230b6Smaya
271610e230b6Smayastruct GEN7_3DSTATE_MULTISAMPLE {
271710e230b6Smaya   uint32_t                             DWordLength;
271810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
271910e230b6Smaya   uint32_t                             _3DCommandOpcode;
272010e230b6Smaya   uint32_t                             CommandSubType;
272110e230b6Smaya   uint32_t                             CommandType;
272210e230b6Smaya   uint32_t                             NumberofMultisamples;
272310e230b6Smaya#define NUMSAMPLES_1                             0
272410e230b6Smaya#define NUMSAMPLES_4                             2
272510e230b6Smaya#define NUMSAMPLES_8                             3
272610e230b6Smaya   uint32_t                             PixelLocation;
272710e230b6Smaya#define CENTER                                   0
272810e230b6Smaya#define UL_CORNER                                1
272910e230b6Smaya   float                                Sample0YOffset;
273010e230b6Smaya   float                                Sample0XOffset;
273110e230b6Smaya   float                                Sample1YOffset;
273210e230b6Smaya   float                                Sample1XOffset;
273310e230b6Smaya   float                                Sample2YOffset;
273410e230b6Smaya   float                                Sample2XOffset;
273510e230b6Smaya   float                                Sample3YOffset;
273610e230b6Smaya   float                                Sample3XOffset;
273710e230b6Smaya   float                                Sample4YOffset;
273810e230b6Smaya   float                                Sample4XOffset;
273910e230b6Smaya   float                                Sample5YOffset;
274010e230b6Smaya   float                                Sample5XOffset;
274110e230b6Smaya   float                                Sample6YOffset;
274210e230b6Smaya   float                                Sample6XOffset;
274310e230b6Smaya   float                                Sample7YOffset;
274410e230b6Smaya   float                                Sample7XOffset;
274510e230b6Smaya};
274610e230b6Smaya
274710e230b6Smayastatic inline void
274810e230b6SmayaGEN7_3DSTATE_MULTISAMPLE_pack(__attribute__((unused)) __gen_user_data *data,
274910e230b6Smaya                              __attribute__((unused)) void * restrict dst,
275010e230b6Smaya                              __attribute__((unused)) const struct GEN7_3DSTATE_MULTISAMPLE * restrict values)
275110e230b6Smaya{
275210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
275310e230b6Smaya
275410e230b6Smaya   dw[0] =
275510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
275610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
275710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
275810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
275910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
276010e230b6Smaya
276110e230b6Smaya   dw[1] =
276210e230b6Smaya      __gen_uint(values->NumberofMultisamples, 1, 3) |
276310e230b6Smaya      __gen_uint(values->PixelLocation, 4, 4);
276410e230b6Smaya
276510e230b6Smaya   dw[2] =
276610e230b6Smaya      __gen_ufixed(values->Sample0YOffset, 0, 3, 4) |
276710e230b6Smaya      __gen_ufixed(values->Sample0XOffset, 4, 7, 4) |
276810e230b6Smaya      __gen_ufixed(values->Sample1YOffset, 8, 11, 4) |
276910e230b6Smaya      __gen_ufixed(values->Sample1XOffset, 12, 15, 4) |
277010e230b6Smaya      __gen_ufixed(values->Sample2YOffset, 16, 19, 4) |
277110e230b6Smaya      __gen_ufixed(values->Sample2XOffset, 20, 23, 4) |
277210e230b6Smaya      __gen_ufixed(values->Sample3YOffset, 24, 27, 4) |
277310e230b6Smaya      __gen_ufixed(values->Sample3XOffset, 28, 31, 4);
277410e230b6Smaya
277510e230b6Smaya   dw[3] =
277610e230b6Smaya      __gen_ufixed(values->Sample4YOffset, 0, 3, 4) |
277710e230b6Smaya      __gen_ufixed(values->Sample4XOffset, 4, 7, 4) |
277810e230b6Smaya      __gen_ufixed(values->Sample5YOffset, 8, 11, 4) |
277910e230b6Smaya      __gen_ufixed(values->Sample5XOffset, 12, 15, 4) |
278010e230b6Smaya      __gen_ufixed(values->Sample6YOffset, 16, 19, 4) |
278110e230b6Smaya      __gen_ufixed(values->Sample6XOffset, 20, 23, 4) |
278210e230b6Smaya      __gen_ufixed(values->Sample7YOffset, 24, 27, 4) |
278310e230b6Smaya      __gen_ufixed(values->Sample7XOffset, 28, 31, 4);
278410e230b6Smaya}
278510e230b6Smaya
278610e230b6Smaya#define GEN7_3DSTATE_POLY_STIPPLE_OFFSET_length      2
278710e230b6Smaya#define GEN7_3DSTATE_POLY_STIPPLE_OFFSET_length_bias      2
278810e230b6Smaya#define GEN7_3DSTATE_POLY_STIPPLE_OFFSET_header \
278910e230b6Smaya   .DWordLength                         =      0,  \
279010e230b6Smaya   ._3DCommandSubOpcode                 =      6,  \
279110e230b6Smaya   ._3DCommandOpcode                    =      1,  \
279210e230b6Smaya   .CommandSubType                      =      3,  \
279310e230b6Smaya   .CommandType                         =      3
279410e230b6Smaya
279510e230b6Smayastruct GEN7_3DSTATE_POLY_STIPPLE_OFFSET {
279610e230b6Smaya   uint32_t                             DWordLength;
279710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
279810e230b6Smaya   uint32_t                             _3DCommandOpcode;
279910e230b6Smaya   uint32_t                             CommandSubType;
280010e230b6Smaya   uint32_t                             CommandType;
280110e230b6Smaya   uint32_t                             PolygonStippleYOffset;
280210e230b6Smaya   uint32_t                             PolygonStippleXOffset;
280310e230b6Smaya};
280410e230b6Smaya
280510e230b6Smayastatic inline void
280610e230b6SmayaGEN7_3DSTATE_POLY_STIPPLE_OFFSET_pack(__attribute__((unused)) __gen_user_data *data,
280710e230b6Smaya                                      __attribute__((unused)) void * restrict dst,
280810e230b6Smaya                                      __attribute__((unused)) const struct GEN7_3DSTATE_POLY_STIPPLE_OFFSET * restrict values)
280910e230b6Smaya{
281010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
281110e230b6Smaya
281210e230b6Smaya   dw[0] =
281310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
281410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
281510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
281610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
281710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
281810e230b6Smaya
281910e230b6Smaya   dw[1] =
282010e230b6Smaya      __gen_uint(values->PolygonStippleYOffset, 0, 4) |
282110e230b6Smaya      __gen_uint(values->PolygonStippleXOffset, 8, 12);
282210e230b6Smaya}
282310e230b6Smaya
282410e230b6Smaya#define GEN7_3DSTATE_POLY_STIPPLE_PATTERN_length     33
282510e230b6Smaya#define GEN7_3DSTATE_POLY_STIPPLE_PATTERN_length_bias      2
282610e230b6Smaya#define GEN7_3DSTATE_POLY_STIPPLE_PATTERN_header\
282710e230b6Smaya   .DWordLength                         =     31,  \
282810e230b6Smaya   ._3DCommandSubOpcode                 =      7,  \
282910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
283010e230b6Smaya   .CommandSubType                      =      3,  \
283110e230b6Smaya   .CommandType                         =      3
283210e230b6Smaya
283310e230b6Smayastruct GEN7_3DSTATE_POLY_STIPPLE_PATTERN {
283410e230b6Smaya   uint32_t                             DWordLength;
283510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
283610e230b6Smaya   uint32_t                             _3DCommandOpcode;
283710e230b6Smaya   uint32_t                             CommandSubType;
283810e230b6Smaya   uint32_t                             CommandType;
283910e230b6Smaya   uint32_t                             PatternRow[32];
284010e230b6Smaya};
284110e230b6Smaya
284210e230b6Smayastatic inline void
284310e230b6SmayaGEN7_3DSTATE_POLY_STIPPLE_PATTERN_pack(__attribute__((unused)) __gen_user_data *data,
284410e230b6Smaya                                       __attribute__((unused)) void * restrict dst,
284510e230b6Smaya                                       __attribute__((unused)) const struct GEN7_3DSTATE_POLY_STIPPLE_PATTERN * restrict values)
284610e230b6Smaya{
284710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
284810e230b6Smaya
284910e230b6Smaya   dw[0] =
285010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
285110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
285210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
285310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
285410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
285510e230b6Smaya
285610e230b6Smaya   dw[1] =
285710e230b6Smaya      __gen_uint(values->PatternRow[0], 0, 31);
285810e230b6Smaya
285910e230b6Smaya   dw[2] =
286010e230b6Smaya      __gen_uint(values->PatternRow[1], 0, 31);
286110e230b6Smaya
286210e230b6Smaya   dw[3] =
286310e230b6Smaya      __gen_uint(values->PatternRow[2], 0, 31);
286410e230b6Smaya
286510e230b6Smaya   dw[4] =
286610e230b6Smaya      __gen_uint(values->PatternRow[3], 0, 31);
286710e230b6Smaya
286810e230b6Smaya   dw[5] =
286910e230b6Smaya      __gen_uint(values->PatternRow[4], 0, 31);
287010e230b6Smaya
287110e230b6Smaya   dw[6] =
287210e230b6Smaya      __gen_uint(values->PatternRow[5], 0, 31);
287310e230b6Smaya
287410e230b6Smaya   dw[7] =
287510e230b6Smaya      __gen_uint(values->PatternRow[6], 0, 31);
287610e230b6Smaya
287710e230b6Smaya   dw[8] =
287810e230b6Smaya      __gen_uint(values->PatternRow[7], 0, 31);
287910e230b6Smaya
288010e230b6Smaya   dw[9] =
288110e230b6Smaya      __gen_uint(values->PatternRow[8], 0, 31);
288210e230b6Smaya
288310e230b6Smaya   dw[10] =
288410e230b6Smaya      __gen_uint(values->PatternRow[9], 0, 31);
288510e230b6Smaya
288610e230b6Smaya   dw[11] =
288710e230b6Smaya      __gen_uint(values->PatternRow[10], 0, 31);
288810e230b6Smaya
288910e230b6Smaya   dw[12] =
289010e230b6Smaya      __gen_uint(values->PatternRow[11], 0, 31);
289110e230b6Smaya
289210e230b6Smaya   dw[13] =
289310e230b6Smaya      __gen_uint(values->PatternRow[12], 0, 31);
289410e230b6Smaya
289510e230b6Smaya   dw[14] =
289610e230b6Smaya      __gen_uint(values->PatternRow[13], 0, 31);
289710e230b6Smaya
289810e230b6Smaya   dw[15] =
289910e230b6Smaya      __gen_uint(values->PatternRow[14], 0, 31);
290010e230b6Smaya
290110e230b6Smaya   dw[16] =
290210e230b6Smaya      __gen_uint(values->PatternRow[15], 0, 31);
290310e230b6Smaya
290410e230b6Smaya   dw[17] =
290510e230b6Smaya      __gen_uint(values->PatternRow[16], 0, 31);
290610e230b6Smaya
290710e230b6Smaya   dw[18] =
290810e230b6Smaya      __gen_uint(values->PatternRow[17], 0, 31);
290910e230b6Smaya
291010e230b6Smaya   dw[19] =
291110e230b6Smaya      __gen_uint(values->PatternRow[18], 0, 31);
291210e230b6Smaya
291310e230b6Smaya   dw[20] =
291410e230b6Smaya      __gen_uint(values->PatternRow[19], 0, 31);
291510e230b6Smaya
291610e230b6Smaya   dw[21] =
291710e230b6Smaya      __gen_uint(values->PatternRow[20], 0, 31);
291810e230b6Smaya
291910e230b6Smaya   dw[22] =
292010e230b6Smaya      __gen_uint(values->PatternRow[21], 0, 31);
292110e230b6Smaya
292210e230b6Smaya   dw[23] =
292310e230b6Smaya      __gen_uint(values->PatternRow[22], 0, 31);
292410e230b6Smaya
292510e230b6Smaya   dw[24] =
292610e230b6Smaya      __gen_uint(values->PatternRow[23], 0, 31);
292710e230b6Smaya
292810e230b6Smaya   dw[25] =
292910e230b6Smaya      __gen_uint(values->PatternRow[24], 0, 31);
293010e230b6Smaya
293110e230b6Smaya   dw[26] =
293210e230b6Smaya      __gen_uint(values->PatternRow[25], 0, 31);
293310e230b6Smaya
293410e230b6Smaya   dw[27] =
293510e230b6Smaya      __gen_uint(values->PatternRow[26], 0, 31);
293610e230b6Smaya
293710e230b6Smaya   dw[28] =
293810e230b6Smaya      __gen_uint(values->PatternRow[27], 0, 31);
293910e230b6Smaya
294010e230b6Smaya   dw[29] =
294110e230b6Smaya      __gen_uint(values->PatternRow[28], 0, 31);
294210e230b6Smaya
294310e230b6Smaya   dw[30] =
294410e230b6Smaya      __gen_uint(values->PatternRow[29], 0, 31);
294510e230b6Smaya
294610e230b6Smaya   dw[31] =
294710e230b6Smaya      __gen_uint(values->PatternRow[30], 0, 31);
294810e230b6Smaya
294910e230b6Smaya   dw[32] =
295010e230b6Smaya      __gen_uint(values->PatternRow[31], 0, 31);
295110e230b6Smaya}
295210e230b6Smaya
295310e230b6Smaya#define GEN7_3DSTATE_PS_length                 8
295410e230b6Smaya#define GEN7_3DSTATE_PS_length_bias            2
295510e230b6Smaya#define GEN7_3DSTATE_PS_header                  \
295610e230b6Smaya   .DWordLength                         =      6,  \
295710e230b6Smaya   ._3DCommandSubOpcode                 =     32,  \
295810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
295910e230b6Smaya   .CommandSubType                      =      3,  \
296010e230b6Smaya   .CommandType                         =      3
296110e230b6Smaya
296210e230b6Smayastruct GEN7_3DSTATE_PS {
296310e230b6Smaya   uint32_t                             DWordLength;
296410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
296510e230b6Smaya   uint32_t                             _3DCommandOpcode;
296610e230b6Smaya   uint32_t                             CommandSubType;
296710e230b6Smaya   uint32_t                             CommandType;
296810e230b6Smaya   uint64_t                             KernelStartPointer0;
296910e230b6Smaya   bool                                 SoftwareExceptionEnable;
297010e230b6Smaya   bool                                 MaskStackExceptionEnable;
297110e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
297210e230b6Smaya   uint32_t                             RoundingMode;
297310e230b6Smaya#define RTNE                                     0
297410e230b6Smaya#define RU                                       1
297510e230b6Smaya#define RD                                       2
297610e230b6Smaya#define RTZ                                      3
297710e230b6Smaya   uint32_t                             FloatingPointMode;
297810e230b6Smaya#define IEEE745                                  0
297910e230b6Smaya#define Alt                                      1
298010e230b6Smaya   uint32_t                             BindingTableEntryCount;
298110e230b6Smaya   uint32_t                             DenormalMode;
298210e230b6Smaya#define FTZ                                      0
298310e230b6Smaya#define RET                                      1
298410e230b6Smaya   uint32_t                             SamplerCount;
298510e230b6Smaya   bool                                 VectorMaskEnable;
298610e230b6Smaya   bool                                 SingleProgramFlow;
298710e230b6Smaya   uint32_t                             PerThreadScratchSpace;
298810e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
298910e230b6Smaya   bool                                 _8PixelDispatchEnable;
299010e230b6Smaya   bool                                 _16PixelDispatchEnable;
299110e230b6Smaya   bool                                 _32PixelDispatchEnable;
299210e230b6Smaya   uint32_t                             PositionXYOffsetSelect;
299310e230b6Smaya#define POSOFFSET_NONE                           0
299410e230b6Smaya#define POSOFFSET_CENTROID                       2
299510e230b6Smaya#define POSOFFSET_SAMPLE                         3
299610e230b6Smaya   bool                                 RenderTargetResolveEnable;
299710e230b6Smaya   bool                                 DualSourceBlendEnable;
299810e230b6Smaya   bool                                 RenderTargetFastClearEnable;
299910e230b6Smaya   bool                                 oMaskPresenttoRenderTarget;
300010e230b6Smaya   bool                                 AttributeEnable;
300110e230b6Smaya   bool                                 PushConstantEnable;
300210e230b6Smaya   uint32_t                             MaximumNumberofThreads;
300310e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForConstantSetupData2;
300410e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForConstantSetupData1;
300510e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForConstantSetupData0;
300610e230b6Smaya   uint64_t                             KernelStartPointer1;
300710e230b6Smaya   uint64_t                             KernelStartPointer2;
300810e230b6Smaya};
300910e230b6Smaya
301010e230b6Smayastatic inline void
301110e230b6SmayaGEN7_3DSTATE_PS_pack(__attribute__((unused)) __gen_user_data *data,
301210e230b6Smaya                     __attribute__((unused)) void * restrict dst,
301310e230b6Smaya                     __attribute__((unused)) const struct GEN7_3DSTATE_PS * restrict values)
301410e230b6Smaya{
301510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
301610e230b6Smaya
301710e230b6Smaya   dw[0] =
301810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
301910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
302010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
302110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
302210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
302310e230b6Smaya
302410e230b6Smaya   dw[1] =
302510e230b6Smaya      __gen_offset(values->KernelStartPointer0, 6, 31);
302610e230b6Smaya
302710e230b6Smaya   dw[2] =
302810e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
302910e230b6Smaya      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
303010e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
303110e230b6Smaya      __gen_uint(values->RoundingMode, 14, 15) |
303210e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
303310e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
303410e230b6Smaya      __gen_uint(values->DenormalMode, 26, 26) |
303510e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
303610e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
303710e230b6Smaya      __gen_uint(values->SingleProgramFlow, 31, 31);
303810e230b6Smaya
303910e230b6Smaya   const uint32_t v3 =
304010e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
304110e230b6Smaya   dw[3] = __gen_combine_address(data, &dw[3], values->ScratchSpaceBasePointer, v3);
304210e230b6Smaya
304310e230b6Smaya   dw[4] =
304410e230b6Smaya      __gen_uint(values->_8PixelDispatchEnable, 0, 0) |
304510e230b6Smaya      __gen_uint(values->_16PixelDispatchEnable, 1, 1) |
304610e230b6Smaya      __gen_uint(values->_32PixelDispatchEnable, 2, 2) |
304710e230b6Smaya      __gen_uint(values->PositionXYOffsetSelect, 3, 4) |
304810e230b6Smaya      __gen_uint(values->RenderTargetResolveEnable, 6, 6) |
304910e230b6Smaya      __gen_uint(values->DualSourceBlendEnable, 7, 7) |
305010e230b6Smaya      __gen_uint(values->RenderTargetFastClearEnable, 8, 8) |
305110e230b6Smaya      __gen_uint(values->oMaskPresenttoRenderTarget, 9, 9) |
305210e230b6Smaya      __gen_uint(values->AttributeEnable, 10, 10) |
305310e230b6Smaya      __gen_uint(values->PushConstantEnable, 11, 11) |
305410e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 24, 31);
305510e230b6Smaya
305610e230b6Smaya   dw[5] =
305710e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData2, 0, 6) |
305810e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData1, 8, 14) |
305910e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData0, 16, 22);
306010e230b6Smaya
306110e230b6Smaya   dw[6] =
306210e230b6Smaya      __gen_offset(values->KernelStartPointer1, 6, 31);
306310e230b6Smaya
306410e230b6Smaya   dw[7] =
306510e230b6Smaya      __gen_offset(values->KernelStartPointer2, 6, 31);
306610e230b6Smaya}
306710e230b6Smaya
306810e230b6Smaya#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_DS_length      2
306910e230b6Smaya#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_DS_length_bias      2
307010e230b6Smaya#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_DS_header\
307110e230b6Smaya   .DWordLength                         =      0,  \
307210e230b6Smaya   ._3DCommandSubOpcode                 =     20,  \
307310e230b6Smaya   ._3DCommandOpcode                    =      1,  \
307410e230b6Smaya   .CommandSubType                      =      3,  \
307510e230b6Smaya   .CommandType                         =      3
307610e230b6Smaya
307710e230b6Smayastruct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_DS {
307810e230b6Smaya   uint32_t                             DWordLength;
307910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
308010e230b6Smaya   uint32_t                             _3DCommandOpcode;
308110e230b6Smaya   uint32_t                             CommandSubType;
308210e230b6Smaya   uint32_t                             CommandType;
308310e230b6Smaya   uint32_t                             ConstantBufferSize;
308410e230b6Smaya#define _0KB                                     0
308510e230b6Smaya   uint32_t                             ConstantBufferOffset;
308610e230b6Smaya#define _0KB                                     0
308710e230b6Smaya};
308810e230b6Smaya
308910e230b6Smayastatic inline void
309010e230b6SmayaGEN7_3DSTATE_PUSH_CONSTANT_ALLOC_DS_pack(__attribute__((unused)) __gen_user_data *data,
309110e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
309210e230b6Smaya                                         __attribute__((unused)) const struct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_DS * restrict values)
309310e230b6Smaya{
309410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
309510e230b6Smaya
309610e230b6Smaya   dw[0] =
309710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
309810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
309910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
310010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
310110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
310210e230b6Smaya
310310e230b6Smaya   dw[1] =
310410e230b6Smaya      __gen_uint(values->ConstantBufferSize, 0, 4) |
310510e230b6Smaya      __gen_uint(values->ConstantBufferOffset, 16, 19);
310610e230b6Smaya}
310710e230b6Smaya
310810e230b6Smaya#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_GS_length      2
310910e230b6Smaya#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_GS_length_bias      2
311010e230b6Smaya#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_GS_header\
311110e230b6Smaya   .DWordLength                         =      0,  \
311210e230b6Smaya   ._3DCommandSubOpcode                 =     21,  \
311310e230b6Smaya   ._3DCommandOpcode                    =      1,  \
311410e230b6Smaya   .CommandSubType                      =      3,  \
311510e230b6Smaya   .CommandType                         =      3
311610e230b6Smaya
311710e230b6Smayastruct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_GS {
311810e230b6Smaya   uint32_t                             DWordLength;
311910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
312010e230b6Smaya   uint32_t                             _3DCommandOpcode;
312110e230b6Smaya   uint32_t                             CommandSubType;
312210e230b6Smaya   uint32_t                             CommandType;
312310e230b6Smaya   uint32_t                             ConstantBufferSize;
312410e230b6Smaya#define _0KB                                     0
312510e230b6Smaya   uint32_t                             ConstantBufferOffset;
312610e230b6Smaya#define _0KB                                     0
312710e230b6Smaya};
312810e230b6Smaya
312910e230b6Smayastatic inline void
313010e230b6SmayaGEN7_3DSTATE_PUSH_CONSTANT_ALLOC_GS_pack(__attribute__((unused)) __gen_user_data *data,
313110e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
313210e230b6Smaya                                         __attribute__((unused)) const struct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_GS * restrict values)
313310e230b6Smaya{
313410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
313510e230b6Smaya
313610e230b6Smaya   dw[0] =
313710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
313810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
313910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
314010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
314110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
314210e230b6Smaya
314310e230b6Smaya   dw[1] =
314410e230b6Smaya      __gen_uint(values->ConstantBufferSize, 0, 4) |
314510e230b6Smaya      __gen_uint(values->ConstantBufferOffset, 16, 19);
314610e230b6Smaya}
314710e230b6Smaya
314810e230b6Smaya#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_HS_length      2
314910e230b6Smaya#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_HS_length_bias      2
315010e230b6Smaya#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_HS_header\
315110e230b6Smaya   .DWordLength                         =      0,  \
315210e230b6Smaya   ._3DCommandSubOpcode                 =     19,  \
315310e230b6Smaya   ._3DCommandOpcode                    =      1,  \
315410e230b6Smaya   .CommandSubType                      =      3,  \
315510e230b6Smaya   .CommandType                         =      3
315610e230b6Smaya
315710e230b6Smayastruct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_HS {
315810e230b6Smaya   uint32_t                             DWordLength;
315910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
316010e230b6Smaya   uint32_t                             _3DCommandOpcode;
316110e230b6Smaya   uint32_t                             CommandSubType;
316210e230b6Smaya   uint32_t                             CommandType;
316310e230b6Smaya   uint32_t                             ConstantBufferSize;
316410e230b6Smaya#define _0KB                                     0
316510e230b6Smaya   uint32_t                             ConstantBufferOffset;
316610e230b6Smaya#define _0KB                                     0
316710e230b6Smaya};
316810e230b6Smaya
316910e230b6Smayastatic inline void
317010e230b6SmayaGEN7_3DSTATE_PUSH_CONSTANT_ALLOC_HS_pack(__attribute__((unused)) __gen_user_data *data,
317110e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
317210e230b6Smaya                                         __attribute__((unused)) const struct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_HS * restrict values)
317310e230b6Smaya{
317410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
317510e230b6Smaya
317610e230b6Smaya   dw[0] =
317710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
317810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
317910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
318010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
318110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
318210e230b6Smaya
318310e230b6Smaya   dw[1] =
318410e230b6Smaya      __gen_uint(values->ConstantBufferSize, 0, 4) |
318510e230b6Smaya      __gen_uint(values->ConstantBufferOffset, 16, 19);
318610e230b6Smaya}
318710e230b6Smaya
318810e230b6Smaya#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_PS_length      2
318910e230b6Smaya#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_PS_length_bias      2
319010e230b6Smaya#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_PS_header\
319110e230b6Smaya   .DWordLength                         =      0,  \
319210e230b6Smaya   ._3DCommandSubOpcode                 =     22,  \
319310e230b6Smaya   ._3DCommandOpcode                    =      1,  \
319410e230b6Smaya   .CommandSubType                      =      3,  \
319510e230b6Smaya   .CommandType                         =      3
319610e230b6Smaya
319710e230b6Smayastruct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_PS {
319810e230b6Smaya   uint32_t                             DWordLength;
319910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
320010e230b6Smaya   uint32_t                             _3DCommandOpcode;
320110e230b6Smaya   uint32_t                             CommandSubType;
320210e230b6Smaya   uint32_t                             CommandType;
320310e230b6Smaya   uint32_t                             ConstantBufferSize;
320410e230b6Smaya#define _0KB                                     0
320510e230b6Smaya   uint32_t                             ConstantBufferOffset;
320610e230b6Smaya#define _0KB                                     0
320710e230b6Smaya};
320810e230b6Smaya
320910e230b6Smayastatic inline void
321010e230b6SmayaGEN7_3DSTATE_PUSH_CONSTANT_ALLOC_PS_pack(__attribute__((unused)) __gen_user_data *data,
321110e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
321210e230b6Smaya                                         __attribute__((unused)) const struct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_PS * restrict values)
321310e230b6Smaya{
321410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
321510e230b6Smaya
321610e230b6Smaya   dw[0] =
321710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
321810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
321910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
322010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
322110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
322210e230b6Smaya
322310e230b6Smaya   dw[1] =
322410e230b6Smaya      __gen_uint(values->ConstantBufferSize, 0, 4) |
322510e230b6Smaya      __gen_uint(values->ConstantBufferOffset, 16, 19);
322610e230b6Smaya}
322710e230b6Smaya
322810e230b6Smaya#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_VS_length      2
322910e230b6Smaya#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_VS_length_bias      2
323010e230b6Smaya#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_VS_header\
323110e230b6Smaya   .DWordLength                         =      0,  \
323210e230b6Smaya   ._3DCommandSubOpcode                 =     18,  \
323310e230b6Smaya   ._3DCommandOpcode                    =      1,  \
323410e230b6Smaya   .CommandSubType                      =      3,  \
323510e230b6Smaya   .CommandType                         =      3
323610e230b6Smaya
323710e230b6Smayastruct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_VS {
323810e230b6Smaya   uint32_t                             DWordLength;
323910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
324010e230b6Smaya   uint32_t                             _3DCommandOpcode;
324110e230b6Smaya   uint32_t                             CommandSubType;
324210e230b6Smaya   uint32_t                             CommandType;
324310e230b6Smaya   uint32_t                             ConstantBufferSize;
324410e230b6Smaya#define _0KB                                     0
324510e230b6Smaya   uint32_t                             ConstantBufferOffset;
324610e230b6Smaya#define _0KB                                     0
324710e230b6Smaya};
324810e230b6Smaya
324910e230b6Smayastatic inline void
325010e230b6SmayaGEN7_3DSTATE_PUSH_CONSTANT_ALLOC_VS_pack(__attribute__((unused)) __gen_user_data *data,
325110e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
325210e230b6Smaya                                         __attribute__((unused)) const struct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_VS * restrict values)
325310e230b6Smaya{
325410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
325510e230b6Smaya
325610e230b6Smaya   dw[0] =
325710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
325810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
325910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
326010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
326110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
326210e230b6Smaya
326310e230b6Smaya   dw[1] =
326410e230b6Smaya      __gen_uint(values->ConstantBufferSize, 0, 4) |
326510e230b6Smaya      __gen_uint(values->ConstantBufferOffset, 16, 19);
326610e230b6Smaya}
326710e230b6Smaya
326810e230b6Smaya#define GEN7_3DSTATE_SAMPLER_PALETTE_LOAD0_length_bias      2
326910e230b6Smaya#define GEN7_3DSTATE_SAMPLER_PALETTE_LOAD0_header\
327010e230b6Smaya   ._3DCommandSubOpcode                 =      2,  \
327110e230b6Smaya   ._3DCommandOpcode                    =      1,  \
327210e230b6Smaya   .CommandSubType                      =      3,  \
327310e230b6Smaya   .CommandType                         =      3
327410e230b6Smaya
327510e230b6Smayastruct GEN7_3DSTATE_SAMPLER_PALETTE_LOAD0 {
327610e230b6Smaya   uint32_t                             DWordLength;
327710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
327810e230b6Smaya   uint32_t                             _3DCommandOpcode;
327910e230b6Smaya   uint32_t                             CommandSubType;
328010e230b6Smaya   uint32_t                             CommandType;
328110e230b6Smaya   /* variable length fields follow */
328210e230b6Smaya};
328310e230b6Smaya
328410e230b6Smayastatic inline void
328510e230b6SmayaGEN7_3DSTATE_SAMPLER_PALETTE_LOAD0_pack(__attribute__((unused)) __gen_user_data *data,
328610e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
328710e230b6Smaya                                        __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_PALETTE_LOAD0 * restrict values)
328810e230b6Smaya{
328910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
329010e230b6Smaya
329110e230b6Smaya   dw[0] =
329210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
329310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
329410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
329510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
329610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
329710e230b6Smaya}
329810e230b6Smaya
329910e230b6Smaya#define GEN7_3DSTATE_SAMPLER_PALETTE_LOAD1_length_bias      2
330010e230b6Smaya#define GEN7_3DSTATE_SAMPLER_PALETTE_LOAD1_header\
330110e230b6Smaya   .DWordLength                         =      0,  \
330210e230b6Smaya   ._3DCommandSubOpcode                 =     12,  \
330310e230b6Smaya   ._3DCommandOpcode                    =      1,  \
330410e230b6Smaya   .CommandSubType                      =      3,  \
330510e230b6Smaya   .CommandType                         =      3
330610e230b6Smaya
330710e230b6Smayastruct GEN7_3DSTATE_SAMPLER_PALETTE_LOAD1 {
330810e230b6Smaya   uint32_t                             DWordLength;
330910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
331010e230b6Smaya   uint32_t                             _3DCommandOpcode;
331110e230b6Smaya   uint32_t                             CommandSubType;
331210e230b6Smaya   uint32_t                             CommandType;
331310e230b6Smaya   /* variable length fields follow */
331410e230b6Smaya};
331510e230b6Smaya
331610e230b6Smayastatic inline void
331710e230b6SmayaGEN7_3DSTATE_SAMPLER_PALETTE_LOAD1_pack(__attribute__((unused)) __gen_user_data *data,
331810e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
331910e230b6Smaya                                        __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_PALETTE_LOAD1 * restrict values)
332010e230b6Smaya{
332110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
332210e230b6Smaya
332310e230b6Smaya   dw[0] =
332410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
332510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
332610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
332710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
332810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
332910e230b6Smaya}
333010e230b6Smaya
333110e230b6Smaya#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_DS_length      2
333210e230b6Smaya#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_DS_length_bias      2
333310e230b6Smaya#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_DS_header\
333410e230b6Smaya   .DWordLength                         =      0,  \
333510e230b6Smaya   ._3DCommandSubOpcode                 =     45,  \
333610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
333710e230b6Smaya   .CommandSubType                      =      3,  \
333810e230b6Smaya   .CommandType                         =      3
333910e230b6Smaya
334010e230b6Smayastruct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_DS {
334110e230b6Smaya   uint32_t                             DWordLength;
334210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
334310e230b6Smaya   uint32_t                             _3DCommandOpcode;
334410e230b6Smaya   uint32_t                             CommandSubType;
334510e230b6Smaya   uint32_t                             CommandType;
334610e230b6Smaya   uint64_t                             PointertoDSSamplerState;
334710e230b6Smaya};
334810e230b6Smaya
334910e230b6Smayastatic inline void
335010e230b6SmayaGEN7_3DSTATE_SAMPLER_STATE_POINTERS_DS_pack(__attribute__((unused)) __gen_user_data *data,
335110e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
335210e230b6Smaya                                            __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_DS * restrict values)
335310e230b6Smaya{
335410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
335510e230b6Smaya
335610e230b6Smaya   dw[0] =
335710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
335810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
335910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
336010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
336110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
336210e230b6Smaya
336310e230b6Smaya   dw[1] =
336410e230b6Smaya      __gen_offset(values->PointertoDSSamplerState, 5, 31);
336510e230b6Smaya}
336610e230b6Smaya
336710e230b6Smaya#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_GS_length      2
336810e230b6Smaya#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_GS_length_bias      2
336910e230b6Smaya#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_GS_header\
337010e230b6Smaya   .DWordLength                         =      0,  \
337110e230b6Smaya   ._3DCommandSubOpcode                 =     46,  \
337210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
337310e230b6Smaya   .CommandSubType                      =      3,  \
337410e230b6Smaya   .CommandType                         =      3
337510e230b6Smaya
337610e230b6Smayastruct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_GS {
337710e230b6Smaya   uint32_t                             DWordLength;
337810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
337910e230b6Smaya   uint32_t                             _3DCommandOpcode;
338010e230b6Smaya   uint32_t                             CommandSubType;
338110e230b6Smaya   uint32_t                             CommandType;
338210e230b6Smaya   uint64_t                             PointertoGSSamplerState;
338310e230b6Smaya};
338410e230b6Smaya
338510e230b6Smayastatic inline void
338610e230b6SmayaGEN7_3DSTATE_SAMPLER_STATE_POINTERS_GS_pack(__attribute__((unused)) __gen_user_data *data,
338710e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
338810e230b6Smaya                                            __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_GS * restrict values)
338910e230b6Smaya{
339010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
339110e230b6Smaya
339210e230b6Smaya   dw[0] =
339310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
339410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
339510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
339610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
339710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
339810e230b6Smaya
339910e230b6Smaya   dw[1] =
340010e230b6Smaya      __gen_offset(values->PointertoGSSamplerState, 5, 31);
340110e230b6Smaya}
340210e230b6Smaya
340310e230b6Smaya#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_HS_length      2
340410e230b6Smaya#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_HS_length_bias      2
340510e230b6Smaya#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_HS_header\
340610e230b6Smaya   .DWordLength                         =      0,  \
340710e230b6Smaya   ._3DCommandSubOpcode                 =     44,  \
340810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
340910e230b6Smaya   .CommandSubType                      =      3,  \
341010e230b6Smaya   .CommandType                         =      3
341110e230b6Smaya
341210e230b6Smayastruct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_HS {
341310e230b6Smaya   uint32_t                             DWordLength;
341410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
341510e230b6Smaya   uint32_t                             _3DCommandOpcode;
341610e230b6Smaya   uint32_t                             CommandSubType;
341710e230b6Smaya   uint32_t                             CommandType;
341810e230b6Smaya   uint64_t                             PointertoHSSamplerState;
341910e230b6Smaya};
342010e230b6Smaya
342110e230b6Smayastatic inline void
342210e230b6SmayaGEN7_3DSTATE_SAMPLER_STATE_POINTERS_HS_pack(__attribute__((unused)) __gen_user_data *data,
342310e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
342410e230b6Smaya                                            __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_HS * restrict values)
342510e230b6Smaya{
342610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
342710e230b6Smaya
342810e230b6Smaya   dw[0] =
342910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
343010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
343110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
343210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
343310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
343410e230b6Smaya
343510e230b6Smaya   dw[1] =
343610e230b6Smaya      __gen_offset(values->PointertoHSSamplerState, 5, 31);
343710e230b6Smaya}
343810e230b6Smaya
343910e230b6Smaya#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_PS_length      2
344010e230b6Smaya#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_PS_length_bias      2
344110e230b6Smaya#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_PS_header\
344210e230b6Smaya   .DWordLength                         =      0,  \
344310e230b6Smaya   ._3DCommandSubOpcode                 =     47,  \
344410e230b6Smaya   ._3DCommandOpcode                    =      0,  \
344510e230b6Smaya   .CommandSubType                      =      3,  \
344610e230b6Smaya   .CommandType                         =      3
344710e230b6Smaya
344810e230b6Smayastruct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_PS {
344910e230b6Smaya   uint32_t                             DWordLength;
345010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
345110e230b6Smaya   uint32_t                             _3DCommandOpcode;
345210e230b6Smaya   uint32_t                             CommandSubType;
345310e230b6Smaya   uint32_t                             CommandType;
345410e230b6Smaya   uint64_t                             PointertoPSSamplerState;
345510e230b6Smaya};
345610e230b6Smaya
345710e230b6Smayastatic inline void
345810e230b6SmayaGEN7_3DSTATE_SAMPLER_STATE_POINTERS_PS_pack(__attribute__((unused)) __gen_user_data *data,
345910e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
346010e230b6Smaya                                            __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_PS * restrict values)
346110e230b6Smaya{
346210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
346310e230b6Smaya
346410e230b6Smaya   dw[0] =
346510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
346610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
346710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
346810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
346910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
347010e230b6Smaya
347110e230b6Smaya   dw[1] =
347210e230b6Smaya      __gen_offset(values->PointertoPSSamplerState, 5, 31);
347310e230b6Smaya}
347410e230b6Smaya
347510e230b6Smaya#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_VS_length      2
347610e230b6Smaya#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_VS_length_bias      2
347710e230b6Smaya#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_VS_header\
347810e230b6Smaya   .DWordLength                         =      0,  \
347910e230b6Smaya   ._3DCommandSubOpcode                 =     43,  \
348010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
348110e230b6Smaya   .CommandSubType                      =      3,  \
348210e230b6Smaya   .CommandType                         =      3
348310e230b6Smaya
348410e230b6Smayastruct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_VS {
348510e230b6Smaya   uint32_t                             DWordLength;
348610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
348710e230b6Smaya   uint32_t                             _3DCommandOpcode;
348810e230b6Smaya   uint32_t                             CommandSubType;
348910e230b6Smaya   uint32_t                             CommandType;
349010e230b6Smaya   uint64_t                             PointertoVSSamplerState;
349110e230b6Smaya};
349210e230b6Smaya
349310e230b6Smayastatic inline void
349410e230b6SmayaGEN7_3DSTATE_SAMPLER_STATE_POINTERS_VS_pack(__attribute__((unused)) __gen_user_data *data,
349510e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
349610e230b6Smaya                                            __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_VS * restrict values)
349710e230b6Smaya{
349810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
349910e230b6Smaya
350010e230b6Smaya   dw[0] =
350110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
350210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
350310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
350410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
350510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
350610e230b6Smaya
350710e230b6Smaya   dw[1] =
350810e230b6Smaya      __gen_offset(values->PointertoVSSamplerState, 5, 31);
350910e230b6Smaya}
351010e230b6Smaya
351110e230b6Smaya#define GEN7_3DSTATE_SAMPLE_MASK_length        2
351210e230b6Smaya#define GEN7_3DSTATE_SAMPLE_MASK_length_bias      2
351310e230b6Smaya#define GEN7_3DSTATE_SAMPLE_MASK_header         \
351410e230b6Smaya   .DWordLength                         =      0,  \
351510e230b6Smaya   ._3DCommandSubOpcode                 =     24,  \
351610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
351710e230b6Smaya   .CommandSubType                      =      3,  \
351810e230b6Smaya   .CommandType                         =      3
351910e230b6Smaya
352010e230b6Smayastruct GEN7_3DSTATE_SAMPLE_MASK {
352110e230b6Smaya   uint32_t                             DWordLength;
352210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
352310e230b6Smaya   uint32_t                             _3DCommandOpcode;
352410e230b6Smaya   uint32_t                             CommandSubType;
352510e230b6Smaya   uint32_t                             CommandType;
352610e230b6Smaya   uint32_t                             SampleMask;
352710e230b6Smaya};
352810e230b6Smaya
352910e230b6Smayastatic inline void
353010e230b6SmayaGEN7_3DSTATE_SAMPLE_MASK_pack(__attribute__((unused)) __gen_user_data *data,
353110e230b6Smaya                              __attribute__((unused)) void * restrict dst,
353210e230b6Smaya                              __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLE_MASK * restrict values)
353310e230b6Smaya{
353410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
353510e230b6Smaya
353610e230b6Smaya   dw[0] =
353710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
353810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
353910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
354010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
354110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
354210e230b6Smaya
354310e230b6Smaya   dw[1] =
354410e230b6Smaya      __gen_uint(values->SampleMask, 0, 7);
354510e230b6Smaya}
354610e230b6Smaya
354710e230b6Smaya#define GEN7_3DSTATE_SBE_length               14
354810e230b6Smaya#define GEN7_3DSTATE_SBE_length_bias           2
354910e230b6Smaya#define GEN7_3DSTATE_SBE_header                 \
355010e230b6Smaya   .DWordLength                         =     12,  \
355110e230b6Smaya   ._3DCommandSubOpcode                 =     31,  \
355210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
355310e230b6Smaya   .CommandSubType                      =      3,  \
355410e230b6Smaya   .CommandType                         =      3
355510e230b6Smaya
355610e230b6Smayastruct GEN7_3DSTATE_SBE {
355710e230b6Smaya   uint32_t                             DWordLength;
355810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
355910e230b6Smaya   uint32_t                             _3DCommandOpcode;
356010e230b6Smaya   uint32_t                             CommandSubType;
356110e230b6Smaya   uint32_t                             CommandType;
356210e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
356310e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
356410e230b6Smaya   uint32_t                             PointSpriteTextureCoordinateOrigin;
356510e230b6Smaya#define UPPERLEFT                                0
356610e230b6Smaya#define LOWERLEFT                                1
356710e230b6Smaya   bool                                 AttributeSwizzleEnable;
356810e230b6Smaya   uint32_t                             NumberofSFOutputAttributes;
356910e230b6Smaya   uint32_t                             AttributeSwizzleControlMode;
357010e230b6Smaya#define SWIZ_0_15                                0
357110e230b6Smaya#define SWIZ_16_31                               1
357210e230b6Smaya   struct GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL Attribute[16];
357310e230b6Smaya   uint32_t                             PointSpriteTextureCoordinateEnable;
357410e230b6Smaya   uint32_t                             ConstantInterpolationEnable;
357510e230b6Smaya   uint32_t                             Attribute0WrapShortestEnables;
357610e230b6Smaya   uint32_t                             Attribute1WrapShortestEnables;
357710e230b6Smaya   uint32_t                             Attribute2WrapShortestEnables;
357810e230b6Smaya   uint32_t                             Attribute3WrapShortestEnables;
357910e230b6Smaya   uint32_t                             Attribute4WrapShortestEnables;
358010e230b6Smaya   uint32_t                             Attribute5WrapShortestEnables;
358110e230b6Smaya   uint32_t                             Attribute6WrapShortestEnables;
358210e230b6Smaya   uint32_t                             Attribute7WrapShortestEnables;
358310e230b6Smaya   uint32_t                             Attribute8WrapShortestEnables;
358410e230b6Smaya   uint32_t                             Attribute9WrapShortestEnables;
358510e230b6Smaya   uint32_t                             Attribute10WrapShortestEnables;
358610e230b6Smaya   uint32_t                             Attribute11WrapShortestEnables;
358710e230b6Smaya   uint32_t                             Attribute12WrapShortestEnables;
358810e230b6Smaya   uint32_t                             Attribute13WrapShortestEnables;
358910e230b6Smaya   uint32_t                             Attribute14WrapShortestEnables;
359010e230b6Smaya   uint32_t                             Attribute15WrapShortestEnables;
359110e230b6Smaya};
359210e230b6Smaya
359310e230b6Smayastatic inline void
359410e230b6SmayaGEN7_3DSTATE_SBE_pack(__attribute__((unused)) __gen_user_data *data,
359510e230b6Smaya                      __attribute__((unused)) void * restrict dst,
359610e230b6Smaya                      __attribute__((unused)) const struct GEN7_3DSTATE_SBE * restrict values)
359710e230b6Smaya{
359810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
359910e230b6Smaya
360010e230b6Smaya   dw[0] =
360110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
360210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
360310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
360410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
360510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
360610e230b6Smaya
360710e230b6Smaya   dw[1] =
360810e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
360910e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 15) |
361010e230b6Smaya      __gen_uint(values->PointSpriteTextureCoordinateOrigin, 20, 20) |
361110e230b6Smaya      __gen_uint(values->AttributeSwizzleEnable, 21, 21) |
361210e230b6Smaya      __gen_uint(values->NumberofSFOutputAttributes, 22, 27) |
361310e230b6Smaya      __gen_uint(values->AttributeSwizzleControlMode, 28, 28);
361410e230b6Smaya
361510e230b6Smaya   uint32_t v2_0;
361610e230b6Smaya   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v2_0, &values->Attribute[0]);
361710e230b6Smaya
361810e230b6Smaya   uint32_t v2_1;
361910e230b6Smaya   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v2_1, &values->Attribute[1]);
362010e230b6Smaya
362110e230b6Smaya   dw[2] =
362210e230b6Smaya      __gen_uint(v2_0, 0, 15) |
362310e230b6Smaya      __gen_uint(v2_1, 16, 31);
362410e230b6Smaya
362510e230b6Smaya   uint32_t v3_0;
362610e230b6Smaya   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v3_0, &values->Attribute[2]);
362710e230b6Smaya
362810e230b6Smaya   uint32_t v3_1;
362910e230b6Smaya   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v3_1, &values->Attribute[3]);
363010e230b6Smaya
363110e230b6Smaya   dw[3] =
363210e230b6Smaya      __gen_uint(v3_0, 0, 15) |
363310e230b6Smaya      __gen_uint(v3_1, 16, 31);
363410e230b6Smaya
363510e230b6Smaya   uint32_t v4_0;
363610e230b6Smaya   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v4_0, &values->Attribute[4]);
363710e230b6Smaya
363810e230b6Smaya   uint32_t v4_1;
363910e230b6Smaya   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v4_1, &values->Attribute[5]);
364010e230b6Smaya
364110e230b6Smaya   dw[4] =
364210e230b6Smaya      __gen_uint(v4_0, 0, 15) |
364310e230b6Smaya      __gen_uint(v4_1, 16, 31);
364410e230b6Smaya
364510e230b6Smaya   uint32_t v5_0;
364610e230b6Smaya   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v5_0, &values->Attribute[6]);
364710e230b6Smaya
364810e230b6Smaya   uint32_t v5_1;
364910e230b6Smaya   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v5_1, &values->Attribute[7]);
365010e230b6Smaya
365110e230b6Smaya   dw[5] =
365210e230b6Smaya      __gen_uint(v5_0, 0, 15) |
365310e230b6Smaya      __gen_uint(v5_1, 16, 31);
365410e230b6Smaya
365510e230b6Smaya   uint32_t v6_0;
365610e230b6Smaya   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v6_0, &values->Attribute[8]);
365710e230b6Smaya
365810e230b6Smaya   uint32_t v6_1;
365910e230b6Smaya   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v6_1, &values->Attribute[9]);
366010e230b6Smaya
366110e230b6Smaya   dw[6] =
366210e230b6Smaya      __gen_uint(v6_0, 0, 15) |
366310e230b6Smaya      __gen_uint(v6_1, 16, 31);
366410e230b6Smaya
366510e230b6Smaya   uint32_t v7_0;
366610e230b6Smaya   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v7_0, &values->Attribute[10]);
366710e230b6Smaya
366810e230b6Smaya   uint32_t v7_1;
366910e230b6Smaya   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v7_1, &values->Attribute[11]);
367010e230b6Smaya
367110e230b6Smaya   dw[7] =
367210e230b6Smaya      __gen_uint(v7_0, 0, 15) |
367310e230b6Smaya      __gen_uint(v7_1, 16, 31);
367410e230b6Smaya
367510e230b6Smaya   uint32_t v8_0;
367610e230b6Smaya   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_0, &values->Attribute[12]);
367710e230b6Smaya
367810e230b6Smaya   uint32_t v8_1;
367910e230b6Smaya   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_1, &values->Attribute[13]);
368010e230b6Smaya
368110e230b6Smaya   dw[8] =
368210e230b6Smaya      __gen_uint(v8_0, 0, 15) |
368310e230b6Smaya      __gen_uint(v8_1, 16, 31);
368410e230b6Smaya
368510e230b6Smaya   uint32_t v9_0;
368610e230b6Smaya   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v9_0, &values->Attribute[14]);
368710e230b6Smaya
368810e230b6Smaya   uint32_t v9_1;
368910e230b6Smaya   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v9_1, &values->Attribute[15]);
369010e230b6Smaya
369110e230b6Smaya   dw[9] =
369210e230b6Smaya      __gen_uint(v9_0, 0, 15) |
369310e230b6Smaya      __gen_uint(v9_1, 16, 31);
369410e230b6Smaya
369510e230b6Smaya   dw[10] =
369610e230b6Smaya      __gen_uint(values->PointSpriteTextureCoordinateEnable, 0, 31);
369710e230b6Smaya
369810e230b6Smaya   dw[11] =
369910e230b6Smaya      __gen_uint(values->ConstantInterpolationEnable, 0, 31);
370010e230b6Smaya
370110e230b6Smaya   dw[12] =
370210e230b6Smaya      __gen_uint(values->Attribute0WrapShortestEnables, 0, 3) |
370310e230b6Smaya      __gen_uint(values->Attribute1WrapShortestEnables, 4, 7) |
370410e230b6Smaya      __gen_uint(values->Attribute2WrapShortestEnables, 8, 11) |
370510e230b6Smaya      __gen_uint(values->Attribute3WrapShortestEnables, 12, 15) |
370610e230b6Smaya      __gen_uint(values->Attribute4WrapShortestEnables, 16, 19) |
370710e230b6Smaya      __gen_uint(values->Attribute5WrapShortestEnables, 20, 23) |
370810e230b6Smaya      __gen_uint(values->Attribute6WrapShortestEnables, 24, 27) |
370910e230b6Smaya      __gen_uint(values->Attribute7WrapShortestEnables, 28, 31);
371010e230b6Smaya
371110e230b6Smaya   dw[13] =
371210e230b6Smaya      __gen_uint(values->Attribute8WrapShortestEnables, 0, 3) |
371310e230b6Smaya      __gen_uint(values->Attribute9WrapShortestEnables, 4, 7) |
371410e230b6Smaya      __gen_uint(values->Attribute10WrapShortestEnables, 8, 11) |
371510e230b6Smaya      __gen_uint(values->Attribute11WrapShortestEnables, 12, 15) |
371610e230b6Smaya      __gen_uint(values->Attribute12WrapShortestEnables, 16, 19) |
371710e230b6Smaya      __gen_uint(values->Attribute13WrapShortestEnables, 20, 23) |
371810e230b6Smaya      __gen_uint(values->Attribute14WrapShortestEnables, 24, 27) |
371910e230b6Smaya      __gen_uint(values->Attribute15WrapShortestEnables, 28, 31);
372010e230b6Smaya}
372110e230b6Smaya
372210e230b6Smaya#define GEN7_3DSTATE_SCISSOR_STATE_POINTERS_length      2
372310e230b6Smaya#define GEN7_3DSTATE_SCISSOR_STATE_POINTERS_length_bias      2
372410e230b6Smaya#define GEN7_3DSTATE_SCISSOR_STATE_POINTERS_header\
372510e230b6Smaya   .DWordLength                         =      0,  \
372610e230b6Smaya   ._3DCommandSubOpcode                 =     15,  \
372710e230b6Smaya   ._3DCommandOpcode                    =      0,  \
372810e230b6Smaya   .CommandSubType                      =      3,  \
372910e230b6Smaya   .CommandType                         =      3
373010e230b6Smaya
373110e230b6Smayastruct GEN7_3DSTATE_SCISSOR_STATE_POINTERS {
373210e230b6Smaya   uint32_t                             DWordLength;
373310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
373410e230b6Smaya   uint32_t                             _3DCommandOpcode;
373510e230b6Smaya   uint32_t                             CommandSubType;
373610e230b6Smaya   uint32_t                             CommandType;
373710e230b6Smaya   uint64_t                             ScissorRectPointer;
373810e230b6Smaya};
373910e230b6Smaya
374010e230b6Smayastatic inline void
374110e230b6SmayaGEN7_3DSTATE_SCISSOR_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
374210e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
374310e230b6Smaya                                         __attribute__((unused)) const struct GEN7_3DSTATE_SCISSOR_STATE_POINTERS * restrict values)
374410e230b6Smaya{
374510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
374610e230b6Smaya
374710e230b6Smaya   dw[0] =
374810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
374910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
375010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
375110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
375210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
375310e230b6Smaya
375410e230b6Smaya   dw[1] =
375510e230b6Smaya      __gen_offset(values->ScissorRectPointer, 5, 31);
375610e230b6Smaya}
375710e230b6Smaya
375810e230b6Smaya#define GEN7_3DSTATE_SF_length                 7
375910e230b6Smaya#define GEN7_3DSTATE_SF_length_bias            2
376010e230b6Smaya#define GEN7_3DSTATE_SF_header                  \
376110e230b6Smaya   .DWordLength                         =      5,  \
376210e230b6Smaya   ._3DCommandSubOpcode                 =     19,  \
376310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
376410e230b6Smaya   .CommandSubType                      =      3,  \
376510e230b6Smaya   .CommandType                         =      3
376610e230b6Smaya
376710e230b6Smayastruct GEN7_3DSTATE_SF {
376810e230b6Smaya   uint32_t                             DWordLength;
376910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
377010e230b6Smaya   uint32_t                             _3DCommandOpcode;
377110e230b6Smaya   uint32_t                             CommandSubType;
377210e230b6Smaya   uint32_t                             CommandType;
377310e230b6Smaya   uint32_t                             FrontWinding;
377410e230b6Smaya   bool                                 ViewportTransformEnable;
377510e230b6Smaya   uint32_t                             BackFaceFillMode;
377610e230b6Smaya#define FILL_MODE_SOLID                          0
377710e230b6Smaya#define FILL_MODE_WIREFRAME                      1
377810e230b6Smaya#define FILL_MODE_POINT                          2
377910e230b6Smaya   uint32_t                             FrontFaceFillMode;
378010e230b6Smaya#define FILL_MODE_SOLID                          0
378110e230b6Smaya#define FILL_MODE_WIREFRAME                      1
378210e230b6Smaya#define FILL_MODE_POINT                          2
378310e230b6Smaya   bool                                 GlobalDepthOffsetEnablePoint;
378410e230b6Smaya   bool                                 GlobalDepthOffsetEnableWireframe;
378510e230b6Smaya   bool                                 GlobalDepthOffsetEnableSolid;
378610e230b6Smaya   bool                                 StatisticsEnable;
378710e230b6Smaya   bool                                 LegacyGlobalDepthBiasEnable;
378810e230b6Smaya   uint32_t                             DepthBufferSurfaceFormat;
378910e230b6Smaya#define D32_FLOAT_S8X24_UINT                     0
379010e230b6Smaya#define D32_FLOAT                                1
379110e230b6Smaya#define D24_UNORM_S8_UINT                        2
379210e230b6Smaya#define D24_UNORM_X8_UINT                        3
379310e230b6Smaya#define D16_UNORM                                5
379410e230b6Smaya   uint32_t                             MultisampleRasterizationMode;
379510e230b6Smaya#define MSRASTMODE_OFF_PIXEL                     0
379610e230b6Smaya#define MSRASTMODE_OFF_PATTERN                   1
379710e230b6Smaya#define MSRASTMODE_ON_PIXEL                      2
379810e230b6Smaya#define MSRASTMODE_ON_PATTERN                    3
379910e230b6Smaya   bool                                 ScissorRectangleEnable;
380010e230b6Smaya   uint32_t                             LineEndCapAntialiasingRegionWidth;
380110e230b6Smaya#define _05pixels                                0
380210e230b6Smaya#define _10pixels                                1
380310e230b6Smaya#define _20pixels                                2
380410e230b6Smaya#define _40pixels                                3
380510e230b6Smaya   float                                LineWidth;
380610e230b6Smaya   uint32_t                             CullMode;
380710e230b6Smaya#define CULLMODE_BOTH                            0
380810e230b6Smaya#define CULLMODE_NONE                            1
380910e230b6Smaya#define CULLMODE_FRONT                           2
381010e230b6Smaya#define CULLMODE_BACK                            3
381110e230b6Smaya   bool                                 AntiAliasingEnable;
381210e230b6Smaya   float                                PointWidth;
381310e230b6Smaya   uint32_t                             PointWidthSource;
381410e230b6Smaya#define Vertex                                   0
381510e230b6Smaya#define State                                    1
381610e230b6Smaya   uint32_t                             VertexSubPixelPrecisionSelect;
381710e230b6Smaya#define _8Bit                                    0
381810e230b6Smaya#define _4Bit                                    1
381910e230b6Smaya   uint32_t                             AALineDistanceMode;
382010e230b6Smaya#define AALINEDISTANCE_TRUE                      1
382110e230b6Smaya   uint32_t                             TriangleFanProvokingVertexSelect;
382210e230b6Smaya#define Vertex0                                  0
382310e230b6Smaya#define Vertex1                                  1
382410e230b6Smaya#define Vertex2                                  2
382510e230b6Smaya   uint32_t                             LineStripListProvokingVertexSelect;
382610e230b6Smaya   uint32_t                             TriangleStripListProvokingVertexSelect;
382710e230b6Smaya#define Vertex0                                  0
382810e230b6Smaya#define Vertex1                                  1
382910e230b6Smaya#define Vertex2                                  2
383010e230b6Smaya   bool                                 LastPixelEnable;
383110e230b6Smaya   float                                GlobalDepthOffsetConstant;
383210e230b6Smaya   float                                GlobalDepthOffsetScale;
383310e230b6Smaya   float                                GlobalDepthOffsetClamp;
383410e230b6Smaya};
383510e230b6Smaya
383610e230b6Smayastatic inline void
383710e230b6SmayaGEN7_3DSTATE_SF_pack(__attribute__((unused)) __gen_user_data *data,
383810e230b6Smaya                     __attribute__((unused)) void * restrict dst,
383910e230b6Smaya                     __attribute__((unused)) const struct GEN7_3DSTATE_SF * restrict values)
384010e230b6Smaya{
384110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
384210e230b6Smaya
384310e230b6Smaya   dw[0] =
384410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
384510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
384610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
384710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
384810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
384910e230b6Smaya
385010e230b6Smaya   dw[1] =
385110e230b6Smaya      __gen_uint(values->FrontWinding, 0, 0) |
385210e230b6Smaya      __gen_uint(values->ViewportTransformEnable, 1, 1) |
385310e230b6Smaya      __gen_uint(values->BackFaceFillMode, 3, 4) |
385410e230b6Smaya      __gen_uint(values->FrontFaceFillMode, 5, 6) |
385510e230b6Smaya      __gen_uint(values->GlobalDepthOffsetEnablePoint, 7, 7) |
385610e230b6Smaya      __gen_uint(values->GlobalDepthOffsetEnableWireframe, 8, 8) |
385710e230b6Smaya      __gen_uint(values->GlobalDepthOffsetEnableSolid, 9, 9) |
385810e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
385910e230b6Smaya      __gen_uint(values->LegacyGlobalDepthBiasEnable, 11, 11) |
386010e230b6Smaya      __gen_uint(values->DepthBufferSurfaceFormat, 12, 14);
386110e230b6Smaya
386210e230b6Smaya   dw[2] =
386310e230b6Smaya      __gen_uint(values->MultisampleRasterizationMode, 8, 9) |
386410e230b6Smaya      __gen_uint(values->ScissorRectangleEnable, 11, 11) |
386510e230b6Smaya      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 16, 17) |
386610e230b6Smaya      __gen_ufixed(values->LineWidth, 18, 27, 7) |
386710e230b6Smaya      __gen_uint(values->CullMode, 29, 30) |
386810e230b6Smaya      __gen_uint(values->AntiAliasingEnable, 31, 31);
386910e230b6Smaya
387010e230b6Smaya   dw[3] =
387110e230b6Smaya      __gen_ufixed(values->PointWidth, 0, 10, 3) |
387210e230b6Smaya      __gen_uint(values->PointWidthSource, 11, 11) |
387310e230b6Smaya      __gen_uint(values->VertexSubPixelPrecisionSelect, 12, 12) |
387410e230b6Smaya      __gen_uint(values->AALineDistanceMode, 14, 14) |
387510e230b6Smaya      __gen_uint(values->TriangleFanProvokingVertexSelect, 25, 26) |
387610e230b6Smaya      __gen_uint(values->LineStripListProvokingVertexSelect, 27, 28) |
387710e230b6Smaya      __gen_uint(values->TriangleStripListProvokingVertexSelect, 29, 30) |
387810e230b6Smaya      __gen_uint(values->LastPixelEnable, 31, 31);
387910e230b6Smaya
388010e230b6Smaya   dw[4] =
388110e230b6Smaya      __gen_float(values->GlobalDepthOffsetConstant);
388210e230b6Smaya
388310e230b6Smaya   dw[5] =
388410e230b6Smaya      __gen_float(values->GlobalDepthOffsetScale);
388510e230b6Smaya
388610e230b6Smaya   dw[6] =
388710e230b6Smaya      __gen_float(values->GlobalDepthOffsetClamp);
388810e230b6Smaya}
388910e230b6Smaya
389010e230b6Smaya#define GEN7_3DSTATE_SO_BUFFER_length          4
389110e230b6Smaya#define GEN7_3DSTATE_SO_BUFFER_length_bias      2
389210e230b6Smaya#define GEN7_3DSTATE_SO_BUFFER_header           \
389310e230b6Smaya   .DWordLength                         =      2,  \
389410e230b6Smaya   ._3DCommandSubOpcode                 =     24,  \
389510e230b6Smaya   ._3DCommandOpcode                    =      1,  \
389610e230b6Smaya   .CommandSubType                      =      3,  \
389710e230b6Smaya   .CommandType                         =      3
389810e230b6Smaya
389910e230b6Smayastruct GEN7_3DSTATE_SO_BUFFER {
390010e230b6Smaya   uint32_t                             DWordLength;
390110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
390210e230b6Smaya   uint32_t                             _3DCommandOpcode;
390310e230b6Smaya   uint32_t                             CommandSubType;
390410e230b6Smaya   uint32_t                             CommandType;
390510e230b6Smaya   uint32_t                             SurfacePitch;
390610e230b6Smaya   uint32_t                             MOCS;
390710e230b6Smaya   uint32_t                             SOBufferIndex;
390810e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
390910e230b6Smaya   __gen_address_type                   SurfaceEndAddress;
391010e230b6Smaya};
391110e230b6Smaya
391210e230b6Smayastatic inline void
391310e230b6SmayaGEN7_3DSTATE_SO_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
391410e230b6Smaya                            __attribute__((unused)) void * restrict dst,
391510e230b6Smaya                            __attribute__((unused)) const struct GEN7_3DSTATE_SO_BUFFER * restrict values)
391610e230b6Smaya{
391710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
391810e230b6Smaya
391910e230b6Smaya   dw[0] =
392010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
392110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
392210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
392310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
392410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
392510e230b6Smaya
392610e230b6Smaya   dw[1] =
392710e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 11) |
392810e230b6Smaya      __gen_uint(values->MOCS, 25, 28) |
392910e230b6Smaya      __gen_uint(values->SOBufferIndex, 29, 30);
393010e230b6Smaya
393110e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
393210e230b6Smaya
393310e230b6Smaya   dw[3] = __gen_combine_address(data, &dw[3], values->SurfaceEndAddress, 0);
393410e230b6Smaya}
393510e230b6Smaya
393610e230b6Smaya#define GEN7_3DSTATE_SO_DECL_LIST_length_bias      2
393710e230b6Smaya#define GEN7_3DSTATE_SO_DECL_LIST_header        \
393810e230b6Smaya   ._3DCommandSubOpcode                 =     23,  \
393910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
394010e230b6Smaya   .CommandSubType                      =      3,  \
394110e230b6Smaya   .CommandType                         =      3
394210e230b6Smaya
394310e230b6Smayastruct GEN7_3DSTATE_SO_DECL_LIST {
394410e230b6Smaya   uint32_t                             DWordLength;
394510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
394610e230b6Smaya   uint32_t                             _3DCommandOpcode;
394710e230b6Smaya   uint32_t                             CommandSubType;
394810e230b6Smaya   uint32_t                             CommandType;
394910e230b6Smaya   uint32_t                             StreamtoBufferSelects0;
395010e230b6Smaya   uint32_t                             StreamtoBufferSelects1;
395110e230b6Smaya   uint32_t                             StreamtoBufferSelects2;
395210e230b6Smaya   uint32_t                             StreamtoBufferSelects3;
395310e230b6Smaya   uint32_t                             NumEntries0;
395410e230b6Smaya   uint32_t                             NumEntries1;
395510e230b6Smaya   uint32_t                             NumEntries2;
395610e230b6Smaya   uint32_t                             NumEntries3;
395710e230b6Smaya   /* variable length fields follow */
395810e230b6Smaya};
395910e230b6Smaya
396010e230b6Smayastatic inline void
396110e230b6SmayaGEN7_3DSTATE_SO_DECL_LIST_pack(__attribute__((unused)) __gen_user_data *data,
396210e230b6Smaya                               __attribute__((unused)) void * restrict dst,
396310e230b6Smaya                               __attribute__((unused)) const struct GEN7_3DSTATE_SO_DECL_LIST * restrict values)
396410e230b6Smaya{
396510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
396610e230b6Smaya
396710e230b6Smaya   dw[0] =
396810e230b6Smaya      __gen_uint(values->DWordLength, 0, 8) |
396910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
397010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
397110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
397210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
397310e230b6Smaya
397410e230b6Smaya   dw[1] =
397510e230b6Smaya      __gen_uint(values->StreamtoBufferSelects0, 0, 3) |
397610e230b6Smaya      __gen_uint(values->StreamtoBufferSelects1, 4, 7) |
397710e230b6Smaya      __gen_uint(values->StreamtoBufferSelects2, 8, 11) |
397810e230b6Smaya      __gen_uint(values->StreamtoBufferSelects3, 12, 15);
397910e230b6Smaya
398010e230b6Smaya   dw[2] =
398110e230b6Smaya      __gen_uint(values->NumEntries0, 0, 7) |
398210e230b6Smaya      __gen_uint(values->NumEntries1, 8, 15) |
398310e230b6Smaya      __gen_uint(values->NumEntries2, 16, 23) |
398410e230b6Smaya      __gen_uint(values->NumEntries3, 24, 31);
398510e230b6Smaya}
398610e230b6Smaya
398710e230b6Smaya#define GEN7_3DSTATE_STENCIL_BUFFER_length      3
398810e230b6Smaya#define GEN7_3DSTATE_STENCIL_BUFFER_length_bias      2
398910e230b6Smaya#define GEN7_3DSTATE_STENCIL_BUFFER_header      \
399010e230b6Smaya   .DWordLength                         =      1,  \
399110e230b6Smaya   ._3DCommandSubOpcode                 =      6,  \
399210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
399310e230b6Smaya   .CommandSubType                      =      3,  \
399410e230b6Smaya   .CommandType                         =      3
399510e230b6Smaya
399610e230b6Smayastruct GEN7_3DSTATE_STENCIL_BUFFER {
399710e230b6Smaya   uint32_t                             DWordLength;
399810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
399910e230b6Smaya   uint32_t                             _3DCommandOpcode;
400010e230b6Smaya   uint32_t                             CommandSubType;
400110e230b6Smaya   uint32_t                             CommandType;
400210e230b6Smaya   uint32_t                             SurfacePitch;
400310e230b6Smaya   uint32_t                             MOCS;
400410e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
400510e230b6Smaya};
400610e230b6Smaya
400710e230b6Smayastatic inline void
400810e230b6SmayaGEN7_3DSTATE_STENCIL_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
400910e230b6Smaya                                 __attribute__((unused)) void * restrict dst,
401010e230b6Smaya                                 __attribute__((unused)) const struct GEN7_3DSTATE_STENCIL_BUFFER * restrict values)
401110e230b6Smaya{
401210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
401310e230b6Smaya
401410e230b6Smaya   dw[0] =
401510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
401610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
401710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
401810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
401910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
402010e230b6Smaya
402110e230b6Smaya   dw[1] =
402210e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 16) |
402310e230b6Smaya      __gen_uint(values->MOCS, 25, 28);
402410e230b6Smaya
402510e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
402610e230b6Smaya}
402710e230b6Smaya
402810e230b6Smaya#define GEN7_3DSTATE_STREAMOUT_length          3
402910e230b6Smaya#define GEN7_3DSTATE_STREAMOUT_length_bias      2
403010e230b6Smaya#define GEN7_3DSTATE_STREAMOUT_header           \
403110e230b6Smaya   .DWordLength                         =      1,  \
403210e230b6Smaya   ._3DCommandSubOpcode                 =     30,  \
403310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
403410e230b6Smaya   .CommandSubType                      =      3,  \
403510e230b6Smaya   .CommandType                         =      3
403610e230b6Smaya
403710e230b6Smayastruct GEN7_3DSTATE_STREAMOUT {
403810e230b6Smaya   uint32_t                             DWordLength;
403910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
404010e230b6Smaya   uint32_t                             _3DCommandOpcode;
404110e230b6Smaya   uint32_t                             CommandSubType;
404210e230b6Smaya   uint32_t                             CommandType;
404310e230b6Smaya   bool                                 SOBufferEnable0;
404410e230b6Smaya   bool                                 SOBufferEnable1;
404510e230b6Smaya   bool                                 SOBufferEnable2;
404610e230b6Smaya   bool                                 SOBufferEnable3;
404710e230b6Smaya   bool                                 SOStatisticsEnable;
404810e230b6Smaya   uint32_t                             ReorderMode;
404910e230b6Smaya#define LEADING                                  0
405010e230b6Smaya#define TRAILING                                 1
405110e230b6Smaya   uint32_t                             RenderStreamSelect;
405210e230b6Smaya   bool                                 RenderingDisable;
405310e230b6Smaya   bool                                 SOFunctionEnable;
405410e230b6Smaya   uint32_t                             Stream0VertexReadLength;
405510e230b6Smaya   uint32_t                             Stream0VertexReadOffset;
405610e230b6Smaya   uint32_t                             Stream1VertexReadLength;
405710e230b6Smaya   uint32_t                             Stream1VertexReadOffset;
405810e230b6Smaya   uint32_t                             Stream2VertexReadLength;
405910e230b6Smaya   uint32_t                             Stream2VertexReadOffset;
406010e230b6Smaya   uint32_t                             Stream3VertexReadLength;
406110e230b6Smaya   uint32_t                             Stream3VertexReadOffset;
406210e230b6Smaya};
406310e230b6Smaya
406410e230b6Smayastatic inline void
406510e230b6SmayaGEN7_3DSTATE_STREAMOUT_pack(__attribute__((unused)) __gen_user_data *data,
406610e230b6Smaya                            __attribute__((unused)) void * restrict dst,
406710e230b6Smaya                            __attribute__((unused)) const struct GEN7_3DSTATE_STREAMOUT * restrict values)
406810e230b6Smaya{
406910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
407010e230b6Smaya
407110e230b6Smaya   dw[0] =
407210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
407310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
407410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
407510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
407610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
407710e230b6Smaya
407810e230b6Smaya   dw[1] =
407910e230b6Smaya      __gen_uint(values->SOBufferEnable0, 8, 8) |
408010e230b6Smaya      __gen_uint(values->SOBufferEnable1, 9, 9) |
408110e230b6Smaya      __gen_uint(values->SOBufferEnable2, 10, 10) |
408210e230b6Smaya      __gen_uint(values->SOBufferEnable3, 11, 11) |
408310e230b6Smaya      __gen_uint(values->SOStatisticsEnable, 25, 25) |
408410e230b6Smaya      __gen_uint(values->ReorderMode, 26, 26) |
408510e230b6Smaya      __gen_uint(values->RenderStreamSelect, 27, 28) |
408610e230b6Smaya      __gen_uint(values->RenderingDisable, 30, 30) |
408710e230b6Smaya      __gen_uint(values->SOFunctionEnable, 31, 31);
408810e230b6Smaya
408910e230b6Smaya   dw[2] =
409010e230b6Smaya      __gen_uint(values->Stream0VertexReadLength, 0, 4) |
409110e230b6Smaya      __gen_uint(values->Stream0VertexReadOffset, 5, 5) |
409210e230b6Smaya      __gen_uint(values->Stream1VertexReadLength, 8, 12) |
409310e230b6Smaya      __gen_uint(values->Stream1VertexReadOffset, 13, 13) |
409410e230b6Smaya      __gen_uint(values->Stream2VertexReadLength, 16, 20) |
409510e230b6Smaya      __gen_uint(values->Stream2VertexReadOffset, 21, 21) |
409610e230b6Smaya      __gen_uint(values->Stream3VertexReadLength, 24, 28) |
409710e230b6Smaya      __gen_uint(values->Stream3VertexReadOffset, 29, 29);
409810e230b6Smaya}
409910e230b6Smaya
410010e230b6Smaya#define GEN7_3DSTATE_TE_length                 4
410110e230b6Smaya#define GEN7_3DSTATE_TE_length_bias            2
410210e230b6Smaya#define GEN7_3DSTATE_TE_header                  \
410310e230b6Smaya   .DWordLength                         =      2,  \
410410e230b6Smaya   ._3DCommandSubOpcode                 =     28,  \
410510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
410610e230b6Smaya   .CommandSubType                      =      3,  \
410710e230b6Smaya   .CommandType                         =      3
410810e230b6Smaya
410910e230b6Smayastruct GEN7_3DSTATE_TE {
411010e230b6Smaya   uint32_t                             DWordLength;
411110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
411210e230b6Smaya   uint32_t                             _3DCommandOpcode;
411310e230b6Smaya   uint32_t                             CommandSubType;
411410e230b6Smaya   uint32_t                             CommandType;
411510e230b6Smaya   bool                                 TEEnable;
411610e230b6Smaya   uint32_t                             TEMode;
411710e230b6Smaya#define HW_TESS                                  0
411810e230b6Smaya#define SW_TESS                                  1
411910e230b6Smaya   uint32_t                             TEDomain;
412010e230b6Smaya#define QUAD                                     0
412110e230b6Smaya#define TRI                                      1
412210e230b6Smaya#define ISOLINE                                  2
412310e230b6Smaya   uint32_t                             OutputTopology;
412410e230b6Smaya#define OUTPUT_POINT                             0
412510e230b6Smaya#define OUTPUT_LINE                              1
412610e230b6Smaya#define OUTPUT_TRI_CW                            2
412710e230b6Smaya#define OUTPUT_TRI_CCW                           3
412810e230b6Smaya   uint32_t                             Partitioning;
412910e230b6Smaya#define INTEGER                                  0
413010e230b6Smaya#define ODD_FRACTIONAL                           1
413110e230b6Smaya#define EVEN_FRACTIONAL                          2
413210e230b6Smaya   float                                MaximumTessellationFactorOdd;
413310e230b6Smaya   float                                MaximumTessellationFactorNotOdd;
413410e230b6Smaya};
413510e230b6Smaya
413610e230b6Smayastatic inline void
413710e230b6SmayaGEN7_3DSTATE_TE_pack(__attribute__((unused)) __gen_user_data *data,
413810e230b6Smaya                     __attribute__((unused)) void * restrict dst,
413910e230b6Smaya                     __attribute__((unused)) const struct GEN7_3DSTATE_TE * restrict values)
414010e230b6Smaya{
414110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
414210e230b6Smaya
414310e230b6Smaya   dw[0] =
414410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
414510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
414610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
414710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
414810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
414910e230b6Smaya
415010e230b6Smaya   dw[1] =
415110e230b6Smaya      __gen_uint(values->TEEnable, 0, 0) |
415210e230b6Smaya      __gen_uint(values->TEMode, 1, 2) |
415310e230b6Smaya      __gen_uint(values->TEDomain, 4, 5) |
415410e230b6Smaya      __gen_uint(values->OutputTopology, 8, 9) |
415510e230b6Smaya      __gen_uint(values->Partitioning, 12, 13);
415610e230b6Smaya
415710e230b6Smaya   dw[2] =
415810e230b6Smaya      __gen_float(values->MaximumTessellationFactorOdd);
415910e230b6Smaya
416010e230b6Smaya   dw[3] =
416110e230b6Smaya      __gen_float(values->MaximumTessellationFactorNotOdd);
416210e230b6Smaya}
416310e230b6Smaya
416410e230b6Smaya#define GEN7_3DSTATE_URB_DS_length             2
416510e230b6Smaya#define GEN7_3DSTATE_URB_DS_length_bias        2
416610e230b6Smaya#define GEN7_3DSTATE_URB_DS_header              \
416710e230b6Smaya   .DWordLength                         =      0,  \
416810e230b6Smaya   ._3DCommandSubOpcode                 =     50,  \
416910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
417010e230b6Smaya   .CommandSubType                      =      3,  \
417110e230b6Smaya   .CommandType                         =      3
417210e230b6Smaya
417310e230b6Smayastruct GEN7_3DSTATE_URB_DS {
417410e230b6Smaya   uint32_t                             DWordLength;
417510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
417610e230b6Smaya   uint32_t                             _3DCommandOpcode;
417710e230b6Smaya   uint32_t                             CommandSubType;
417810e230b6Smaya   uint32_t                             CommandType;
417910e230b6Smaya   uint32_t                             DSNumberofURBEntries;
418010e230b6Smaya   uint32_t                             DSURBEntryAllocationSize;
418110e230b6Smaya   uint32_t                             DSURBStartingAddress;
418210e230b6Smaya};
418310e230b6Smaya
418410e230b6Smayastatic inline void
418510e230b6SmayaGEN7_3DSTATE_URB_DS_pack(__attribute__((unused)) __gen_user_data *data,
418610e230b6Smaya                         __attribute__((unused)) void * restrict dst,
418710e230b6Smaya                         __attribute__((unused)) const struct GEN7_3DSTATE_URB_DS * restrict values)
418810e230b6Smaya{
418910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
419010e230b6Smaya
419110e230b6Smaya   dw[0] =
419210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
419310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
419410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
419510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
419610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
419710e230b6Smaya
419810e230b6Smaya   dw[1] =
419910e230b6Smaya      __gen_uint(values->DSNumberofURBEntries, 0, 15) |
420010e230b6Smaya      __gen_uint(values->DSURBEntryAllocationSize, 16, 24) |
420110e230b6Smaya      __gen_uint(values->DSURBStartingAddress, 25, 29);
420210e230b6Smaya}
420310e230b6Smaya
420410e230b6Smaya#define GEN7_3DSTATE_URB_GS_length             2
420510e230b6Smaya#define GEN7_3DSTATE_URB_GS_length_bias        2
420610e230b6Smaya#define GEN7_3DSTATE_URB_GS_header              \
420710e230b6Smaya   .DWordLength                         =      0,  \
420810e230b6Smaya   ._3DCommandSubOpcode                 =     51,  \
420910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
421010e230b6Smaya   .CommandSubType                      =      3,  \
421110e230b6Smaya   .CommandType                         =      3
421210e230b6Smaya
421310e230b6Smayastruct GEN7_3DSTATE_URB_GS {
421410e230b6Smaya   uint32_t                             DWordLength;
421510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
421610e230b6Smaya   uint32_t                             _3DCommandOpcode;
421710e230b6Smaya   uint32_t                             CommandSubType;
421810e230b6Smaya   uint32_t                             CommandType;
421910e230b6Smaya   uint32_t                             GSNumberofURBEntries;
422010e230b6Smaya   uint32_t                             GSURBEntryAllocationSize;
422110e230b6Smaya   uint32_t                             GSURBStartingAddress;
422210e230b6Smaya};
422310e230b6Smaya
422410e230b6Smayastatic inline void
422510e230b6SmayaGEN7_3DSTATE_URB_GS_pack(__attribute__((unused)) __gen_user_data *data,
422610e230b6Smaya                         __attribute__((unused)) void * restrict dst,
422710e230b6Smaya                         __attribute__((unused)) const struct GEN7_3DSTATE_URB_GS * restrict values)
422810e230b6Smaya{
422910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
423010e230b6Smaya
423110e230b6Smaya   dw[0] =
423210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
423310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
423410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
423510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
423610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
423710e230b6Smaya
423810e230b6Smaya   dw[1] =
423910e230b6Smaya      __gen_uint(values->GSNumberofURBEntries, 0, 15) |
424010e230b6Smaya      __gen_uint(values->GSURBEntryAllocationSize, 16, 24) |
424110e230b6Smaya      __gen_uint(values->GSURBStartingAddress, 25, 29);
424210e230b6Smaya}
424310e230b6Smaya
424410e230b6Smaya#define GEN7_3DSTATE_URB_HS_length             2
424510e230b6Smaya#define GEN7_3DSTATE_URB_HS_length_bias        2
424610e230b6Smaya#define GEN7_3DSTATE_URB_HS_header              \
424710e230b6Smaya   .DWordLength                         =      0,  \
424810e230b6Smaya   ._3DCommandSubOpcode                 =     49,  \
424910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
425010e230b6Smaya   .CommandSubType                      =      3,  \
425110e230b6Smaya   .CommandType                         =      3
425210e230b6Smaya
425310e230b6Smayastruct GEN7_3DSTATE_URB_HS {
425410e230b6Smaya   uint32_t                             DWordLength;
425510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
425610e230b6Smaya   uint32_t                             _3DCommandOpcode;
425710e230b6Smaya   uint32_t                             CommandSubType;
425810e230b6Smaya   uint32_t                             CommandType;
425910e230b6Smaya   uint32_t                             HSNumberofURBEntries;
426010e230b6Smaya   uint32_t                             HSURBEntryAllocationSize;
426110e230b6Smaya   uint32_t                             HSURBStartingAddress;
426210e230b6Smaya};
426310e230b6Smaya
426410e230b6Smayastatic inline void
426510e230b6SmayaGEN7_3DSTATE_URB_HS_pack(__attribute__((unused)) __gen_user_data *data,
426610e230b6Smaya                         __attribute__((unused)) void * restrict dst,
426710e230b6Smaya                         __attribute__((unused)) const struct GEN7_3DSTATE_URB_HS * restrict values)
426810e230b6Smaya{
426910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
427010e230b6Smaya
427110e230b6Smaya   dw[0] =
427210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
427310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
427410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
427510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
427610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
427710e230b6Smaya
427810e230b6Smaya   dw[1] =
427910e230b6Smaya      __gen_uint(values->HSNumberofURBEntries, 0, 15) |
428010e230b6Smaya      __gen_uint(values->HSURBEntryAllocationSize, 16, 24) |
428110e230b6Smaya      __gen_uint(values->HSURBStartingAddress, 25, 29);
428210e230b6Smaya}
428310e230b6Smaya
428410e230b6Smaya#define GEN7_3DSTATE_URB_VS_length             2
428510e230b6Smaya#define GEN7_3DSTATE_URB_VS_length_bias        2
428610e230b6Smaya#define GEN7_3DSTATE_URB_VS_header              \
428710e230b6Smaya   .DWordLength                         =      0,  \
428810e230b6Smaya   ._3DCommandSubOpcode                 =     48,  \
428910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
429010e230b6Smaya   .CommandSubType                      =      3,  \
429110e230b6Smaya   .CommandType                         =      3
429210e230b6Smaya
429310e230b6Smayastruct GEN7_3DSTATE_URB_VS {
429410e230b6Smaya   uint32_t                             DWordLength;
429510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
429610e230b6Smaya   uint32_t                             _3DCommandOpcode;
429710e230b6Smaya   uint32_t                             CommandSubType;
429810e230b6Smaya   uint32_t                             CommandType;
429910e230b6Smaya   uint32_t                             VSNumberofURBEntries;
430010e230b6Smaya   uint32_t                             VSURBEntryAllocationSize;
430110e230b6Smaya   uint32_t                             VSURBStartingAddress;
430210e230b6Smaya};
430310e230b6Smaya
430410e230b6Smayastatic inline void
430510e230b6SmayaGEN7_3DSTATE_URB_VS_pack(__attribute__((unused)) __gen_user_data *data,
430610e230b6Smaya                         __attribute__((unused)) void * restrict dst,
430710e230b6Smaya                         __attribute__((unused)) const struct GEN7_3DSTATE_URB_VS * restrict values)
430810e230b6Smaya{
430910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
431010e230b6Smaya
431110e230b6Smaya   dw[0] =
431210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
431310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
431410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
431510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
431610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
431710e230b6Smaya
431810e230b6Smaya   dw[1] =
431910e230b6Smaya      __gen_uint(values->VSNumberofURBEntries, 0, 15) |
432010e230b6Smaya      __gen_uint(values->VSURBEntryAllocationSize, 16, 24) |
432110e230b6Smaya      __gen_uint(values->VSURBStartingAddress, 25, 29);
432210e230b6Smaya}
432310e230b6Smaya
432410e230b6Smaya#define GEN7_3DSTATE_VERTEX_BUFFERS_length_bias      2
432510e230b6Smaya#define GEN7_3DSTATE_VERTEX_BUFFERS_header      \
432610e230b6Smaya   .DWordLength                         =      3,  \
432710e230b6Smaya   ._3DCommandSubOpcode                 =      8,  \
432810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
432910e230b6Smaya   .CommandSubType                      =      3,  \
433010e230b6Smaya   .CommandType                         =      3
433110e230b6Smaya
433210e230b6Smayastruct GEN7_3DSTATE_VERTEX_BUFFERS {
433310e230b6Smaya   uint32_t                             DWordLength;
433410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
433510e230b6Smaya   uint32_t                             _3DCommandOpcode;
433610e230b6Smaya   uint32_t                             CommandSubType;
433710e230b6Smaya   uint32_t                             CommandType;
433810e230b6Smaya   /* variable length fields follow */
433910e230b6Smaya};
434010e230b6Smaya
434110e230b6Smayastatic inline void
434210e230b6SmayaGEN7_3DSTATE_VERTEX_BUFFERS_pack(__attribute__((unused)) __gen_user_data *data,
434310e230b6Smaya                                 __attribute__((unused)) void * restrict dst,
434410e230b6Smaya                                 __attribute__((unused)) const struct GEN7_3DSTATE_VERTEX_BUFFERS * restrict values)
434510e230b6Smaya{
434610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
434710e230b6Smaya
434810e230b6Smaya   dw[0] =
434910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
435010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
435110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
435210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
435310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
435410e230b6Smaya}
435510e230b6Smaya
435610e230b6Smaya#define GEN7_3DSTATE_VERTEX_ELEMENTS_length_bias      2
435710e230b6Smaya#define GEN7_3DSTATE_VERTEX_ELEMENTS_header     \
435810e230b6Smaya   .DWordLength                         =      1,  \
435910e230b6Smaya   ._3DCommandSubOpcode                 =      9,  \
436010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
436110e230b6Smaya   .CommandSubType                      =      3,  \
436210e230b6Smaya   .CommandType                         =      3
436310e230b6Smaya
436410e230b6Smayastruct GEN7_3DSTATE_VERTEX_ELEMENTS {
436510e230b6Smaya   uint32_t                             DWordLength;
436610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
436710e230b6Smaya   uint32_t                             _3DCommandOpcode;
436810e230b6Smaya   uint32_t                             CommandSubType;
436910e230b6Smaya   uint32_t                             CommandType;
437010e230b6Smaya   /* variable length fields follow */
437110e230b6Smaya};
437210e230b6Smaya
437310e230b6Smayastatic inline void
437410e230b6SmayaGEN7_3DSTATE_VERTEX_ELEMENTS_pack(__attribute__((unused)) __gen_user_data *data,
437510e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
437610e230b6Smaya                                  __attribute__((unused)) const struct GEN7_3DSTATE_VERTEX_ELEMENTS * restrict values)
437710e230b6Smaya{
437810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
437910e230b6Smaya
438010e230b6Smaya   dw[0] =
438110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
438210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
438310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
438410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
438510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
438610e230b6Smaya}
438710e230b6Smaya
438810e230b6Smaya#define GEN7_3DSTATE_VF_STATISTICS_length      1
438910e230b6Smaya#define GEN7_3DSTATE_VF_STATISTICS_length_bias      1
439010e230b6Smaya#define GEN7_3DSTATE_VF_STATISTICS_header       \
439110e230b6Smaya   ._3DCommandSubOpcode                 =     11,  \
439210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
439310e230b6Smaya   .CommandSubType                      =      1,  \
439410e230b6Smaya   .CommandType                         =      3
439510e230b6Smaya
439610e230b6Smayastruct GEN7_3DSTATE_VF_STATISTICS {
439710e230b6Smaya   bool                                 StatisticsEnable;
439810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
439910e230b6Smaya   uint32_t                             _3DCommandOpcode;
440010e230b6Smaya   uint32_t                             CommandSubType;
440110e230b6Smaya   uint32_t                             CommandType;
440210e230b6Smaya};
440310e230b6Smaya
440410e230b6Smayastatic inline void
440510e230b6SmayaGEN7_3DSTATE_VF_STATISTICS_pack(__attribute__((unused)) __gen_user_data *data,
440610e230b6Smaya                                __attribute__((unused)) void * restrict dst,
440710e230b6Smaya                                __attribute__((unused)) const struct GEN7_3DSTATE_VF_STATISTICS * restrict values)
440810e230b6Smaya{
440910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
441010e230b6Smaya
441110e230b6Smaya   dw[0] =
441210e230b6Smaya      __gen_uint(values->StatisticsEnable, 0, 0) |
441310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
441410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
441510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
441610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
441710e230b6Smaya}
441810e230b6Smaya
441910e230b6Smaya#define GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_CC_length      2
442010e230b6Smaya#define GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_CC_length_bias      2
442110e230b6Smaya#define GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_CC_header\
442210e230b6Smaya   .DWordLength                         =      0,  \
442310e230b6Smaya   ._3DCommandSubOpcode                 =     35,  \
442410e230b6Smaya   ._3DCommandOpcode                    =      0,  \
442510e230b6Smaya   .CommandSubType                      =      3,  \
442610e230b6Smaya   .CommandType                         =      3
442710e230b6Smaya
442810e230b6Smayastruct GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_CC {
442910e230b6Smaya   uint32_t                             DWordLength;
443010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
443110e230b6Smaya   uint32_t                             _3DCommandOpcode;
443210e230b6Smaya   uint32_t                             CommandSubType;
443310e230b6Smaya   uint32_t                             CommandType;
443410e230b6Smaya   uint64_t                             CCViewportPointer;
443510e230b6Smaya};
443610e230b6Smaya
443710e230b6Smayastatic inline void
443810e230b6SmayaGEN7_3DSTATE_VIEWPORT_STATE_POINTERS_CC_pack(__attribute__((unused)) __gen_user_data *data,
443910e230b6Smaya                                             __attribute__((unused)) void * restrict dst,
444010e230b6Smaya                                             __attribute__((unused)) const struct GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_CC * restrict values)
444110e230b6Smaya{
444210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
444310e230b6Smaya
444410e230b6Smaya   dw[0] =
444510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
444610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
444710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
444810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
444910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
445010e230b6Smaya
445110e230b6Smaya   dw[1] =
445210e230b6Smaya      __gen_offset(values->CCViewportPointer, 5, 31);
445310e230b6Smaya}
445410e230b6Smaya
445510e230b6Smaya#define GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_length      2
445610e230b6Smaya#define GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_length_bias      2
445710e230b6Smaya#define GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_header\
445810e230b6Smaya   .DWordLength                         =      0,  \
445910e230b6Smaya   ._3DCommandSubOpcode                 =     33,  \
446010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
446110e230b6Smaya   .CommandSubType                      =      3,  \
446210e230b6Smaya   .CommandType                         =      3
446310e230b6Smaya
446410e230b6Smayastruct GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP {
446510e230b6Smaya   uint32_t                             DWordLength;
446610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
446710e230b6Smaya   uint32_t                             _3DCommandOpcode;
446810e230b6Smaya   uint32_t                             CommandSubType;
446910e230b6Smaya   uint32_t                             CommandType;
447010e230b6Smaya   uint64_t                             SFClipViewportPointer;
447110e230b6Smaya};
447210e230b6Smaya
447310e230b6Smayastatic inline void
447410e230b6SmayaGEN7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
447510e230b6Smaya                                                  __attribute__((unused)) void * restrict dst,
447610e230b6Smaya                                                  __attribute__((unused)) const struct GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP * restrict values)
447710e230b6Smaya{
447810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
447910e230b6Smaya
448010e230b6Smaya   dw[0] =
448110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
448210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
448310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
448410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
448510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
448610e230b6Smaya
448710e230b6Smaya   dw[1] =
448810e230b6Smaya      __gen_offset(values->SFClipViewportPointer, 6, 31);
448910e230b6Smaya}
449010e230b6Smaya
449110e230b6Smaya#define GEN7_3DSTATE_VS_length                 6
449210e230b6Smaya#define GEN7_3DSTATE_VS_length_bias            2
449310e230b6Smaya#define GEN7_3DSTATE_VS_header                  \
449410e230b6Smaya   .DWordLength                         =      4,  \
449510e230b6Smaya   ._3DCommandSubOpcode                 =     16,  \
449610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
449710e230b6Smaya   .CommandSubType                      =      3,  \
449810e230b6Smaya   .CommandType                         =      3
449910e230b6Smaya
450010e230b6Smayastruct GEN7_3DSTATE_VS {
450110e230b6Smaya   uint32_t                             DWordLength;
450210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
450310e230b6Smaya   uint32_t                             _3DCommandOpcode;
450410e230b6Smaya   uint32_t                             CommandSubType;
450510e230b6Smaya   uint32_t                             CommandType;
450610e230b6Smaya   uint64_t                             KernelStartPointer;
450710e230b6Smaya   bool                                 SoftwareExceptionEnable;
450810e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
450910e230b6Smaya   uint32_t                             FloatingPointMode;
451010e230b6Smaya#define IEEE754                                  0
451110e230b6Smaya#define Alternate                                1
451210e230b6Smaya   uint32_t                             BindingTableEntryCount;
451310e230b6Smaya   uint32_t                             SamplerCount;
451410e230b6Smaya#define NoSamplers                               0
451510e230b6Smaya#define _14Samplers                              1
451610e230b6Smaya#define _58Samplers                              2
451710e230b6Smaya#define _912Samplers                             3
451810e230b6Smaya#define _1316Samplers                            4
451910e230b6Smaya   bool                                 VectorMaskEnable;
452010e230b6Smaya   bool                                 SingleVertexDispatch;
452110e230b6Smaya   uint32_t                             PerThreadScratchSpace;
452210e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
452310e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
452410e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
452510e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData;
452610e230b6Smaya   bool                                 Enable;
452710e230b6Smaya   bool                                 VertexCacheDisable;
452810e230b6Smaya   bool                                 StatisticsEnable;
452910e230b6Smaya   uint32_t                             MaximumNumberofThreads;
453010e230b6Smaya};
453110e230b6Smaya
453210e230b6Smayastatic inline void
453310e230b6SmayaGEN7_3DSTATE_VS_pack(__attribute__((unused)) __gen_user_data *data,
453410e230b6Smaya                     __attribute__((unused)) void * restrict dst,
453510e230b6Smaya                     __attribute__((unused)) const struct GEN7_3DSTATE_VS * restrict values)
453610e230b6Smaya{
453710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
453810e230b6Smaya
453910e230b6Smaya   dw[0] =
454010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
454110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
454210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
454310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
454410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
454510e230b6Smaya
454610e230b6Smaya   dw[1] =
454710e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 31);
454810e230b6Smaya
454910e230b6Smaya   dw[2] =
455010e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
455110e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
455210e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
455310e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
455410e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
455510e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
455610e230b6Smaya      __gen_uint(values->SingleVertexDispatch, 31, 31);
455710e230b6Smaya
455810e230b6Smaya   const uint32_t v3 =
455910e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
456010e230b6Smaya   dw[3] = __gen_combine_address(data, &dw[3], values->ScratchSpaceBasePointer, v3);
456110e230b6Smaya
456210e230b6Smaya   dw[4] =
456310e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
456410e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
456510e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
456610e230b6Smaya
456710e230b6Smaya   dw[5] =
456810e230b6Smaya      __gen_uint(values->Enable, 0, 0) |
456910e230b6Smaya      __gen_uint(values->VertexCacheDisable, 1, 1) |
457010e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
457110e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 25, 31);
457210e230b6Smaya}
457310e230b6Smaya
457410e230b6Smaya#define GEN7_3DSTATE_WM_length                 3
457510e230b6Smaya#define GEN7_3DSTATE_WM_length_bias            2
457610e230b6Smaya#define GEN7_3DSTATE_WM_header                  \
457710e230b6Smaya   .DWordLength                         =      1,  \
457810e230b6Smaya   ._3DCommandSubOpcode                 =     20,  \
457910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
458010e230b6Smaya   .CommandSubType                      =      3,  \
458110e230b6Smaya   .CommandType                         =      3
458210e230b6Smaya
458310e230b6Smayastruct GEN7_3DSTATE_WM {
458410e230b6Smaya   uint32_t                             DWordLength;
458510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
458610e230b6Smaya   uint32_t                             _3DCommandOpcode;
458710e230b6Smaya   uint32_t                             CommandSubType;
458810e230b6Smaya   uint32_t                             CommandType;
458910e230b6Smaya   uint32_t                             MultisampleRasterizationMode;
459010e230b6Smaya#define MSRASTMODE_OFF_PIXEL                     0
459110e230b6Smaya#define MSRASTMODE_OFF_PATTERN                   1
459210e230b6Smaya#define MSRASTMODE_ON_PIXEL                      2
459310e230b6Smaya#define MSRASTMODE_ON_PATTERN                    3
459410e230b6Smaya   uint32_t                             PointRasterizationRule;
459510e230b6Smaya#define RASTRULE_UPPER_LEFT                      0
459610e230b6Smaya#define RASTRULE_UPPER_RIGHT                     1
459710e230b6Smaya   bool                                 LineStippleEnable;
459810e230b6Smaya   bool                                 PolygonStippleEnable;
459910e230b6Smaya   uint32_t                             LineAntialiasingRegionWidth;
460010e230b6Smaya#define _05pixels                                0
460110e230b6Smaya#define _10pixels                                1
460210e230b6Smaya#define _20pixels                                2
460310e230b6Smaya#define _40pixels                                3
460410e230b6Smaya   uint32_t                             LineEndCapAntialiasingRegionWidth;
460510e230b6Smaya   bool                                 PixelShaderUsesInputCoverageMask;
460610e230b6Smaya   uint32_t                             BarycentricInterpolationMode;
460710e230b6Smaya#define BIM_PERSPECTIVE_PIXEL                    1
460810e230b6Smaya#define BIM_PERSPECTIVE_CENTROID                 2
460910e230b6Smaya#define BIM_PERSPECTIVE_SAMPLE                   4
461010e230b6Smaya#define BIM_LINEAR_PIXEL                         8
461110e230b6Smaya#define BIM_LINEAR_CENTROID                      16
461210e230b6Smaya#define BIM_LINEAR_SAMPLE                        32
461310e230b6Smaya   uint32_t                             PositionZWInterpolationMode;
461410e230b6Smaya#define INTERP_PIXEL                             0
461510e230b6Smaya#define INTERP_CENTROID                          2
461610e230b6Smaya#define INTERP_SAMPLE                            3
461710e230b6Smaya   bool                                 PixelShaderUsesSourceW;
461810e230b6Smaya   bool                                 PixelShaderUsesSourceDepth;
461910e230b6Smaya   uint32_t                             EarlyDepthStencilControl;
462010e230b6Smaya#define EDSC_NORMAL                              0
462110e230b6Smaya#define EDSC_PSEXEC                              1
462210e230b6Smaya#define EDSC_PREPS                               2
462310e230b6Smaya   uint32_t                             PixelShaderComputedDepthMode;
462410e230b6Smaya#define PSCDEPTH_OFF                             0
462510e230b6Smaya#define PSCDEPTH_ON                              1
462610e230b6Smaya#define PSCDEPTH_ON_GE                           2
462710e230b6Smaya#define PSCDEPTH_ON_LE                           3
462810e230b6Smaya   bool                                 PixelShaderKillsPixel;
462910e230b6Smaya   bool                                 LegacyDiamondLineRasterization;
463010e230b6Smaya   bool                                 HierarchicalDepthBufferResolveEnable;
463110e230b6Smaya   bool                                 DepthBufferResolveEnable;
463210e230b6Smaya   bool                                 ThreadDispatchEnable;
463310e230b6Smaya   bool                                 DepthBufferClear;
463410e230b6Smaya   bool                                 StatisticsEnable;
463510e230b6Smaya   uint32_t                             MultisampleDispatchMode;
463610e230b6Smaya#define MSDISPMODE_PERSAMPLE                     0
463710e230b6Smaya#define MSDISPMODE_PERPIXEL                      1
463810e230b6Smaya};
463910e230b6Smaya
464010e230b6Smayastatic inline void
464110e230b6SmayaGEN7_3DSTATE_WM_pack(__attribute__((unused)) __gen_user_data *data,
464210e230b6Smaya                     __attribute__((unused)) void * restrict dst,
464310e230b6Smaya                     __attribute__((unused)) const struct GEN7_3DSTATE_WM * restrict values)
464410e230b6Smaya{
464510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
464610e230b6Smaya
464710e230b6Smaya   dw[0] =
464810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
464910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
465010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
465110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
465210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
465310e230b6Smaya
465410e230b6Smaya   dw[1] =
465510e230b6Smaya      __gen_uint(values->MultisampleRasterizationMode, 0, 1) |
465610e230b6Smaya      __gen_uint(values->PointRasterizationRule, 2, 2) |
465710e230b6Smaya      __gen_uint(values->LineStippleEnable, 3, 3) |
465810e230b6Smaya      __gen_uint(values->PolygonStippleEnable, 4, 4) |
465910e230b6Smaya      __gen_uint(values->LineAntialiasingRegionWidth, 6, 7) |
466010e230b6Smaya      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 8, 9) |
466110e230b6Smaya      __gen_uint(values->PixelShaderUsesInputCoverageMask, 10, 10) |
466210e230b6Smaya      __gen_uint(values->BarycentricInterpolationMode, 11, 16) |
466310e230b6Smaya      __gen_uint(values->PositionZWInterpolationMode, 17, 18) |
466410e230b6Smaya      __gen_uint(values->PixelShaderUsesSourceW, 19, 19) |
466510e230b6Smaya      __gen_uint(values->PixelShaderUsesSourceDepth, 20, 20) |
466610e230b6Smaya      __gen_uint(values->EarlyDepthStencilControl, 21, 22) |
466710e230b6Smaya      __gen_uint(values->PixelShaderComputedDepthMode, 23, 24) |
466810e230b6Smaya      __gen_uint(values->PixelShaderKillsPixel, 25, 25) |
466910e230b6Smaya      __gen_uint(values->LegacyDiamondLineRasterization, 26, 26) |
467010e230b6Smaya      __gen_uint(values->HierarchicalDepthBufferResolveEnable, 27, 27) |
467110e230b6Smaya      __gen_uint(values->DepthBufferResolveEnable, 28, 28) |
467210e230b6Smaya      __gen_uint(values->ThreadDispatchEnable, 29, 29) |
467310e230b6Smaya      __gen_uint(values->DepthBufferClear, 30, 30) |
467410e230b6Smaya      __gen_uint(values->StatisticsEnable, 31, 31);
467510e230b6Smaya
467610e230b6Smaya   dw[2] =
467710e230b6Smaya      __gen_uint(values->MultisampleDispatchMode, 31, 31);
467810e230b6Smaya}
467910e230b6Smaya
468010e230b6Smaya#define GEN7_GPGPU_OBJECT_length               8
468110e230b6Smaya#define GEN7_GPGPU_OBJECT_length_bias          2
468210e230b6Smaya#define GEN7_GPGPU_OBJECT_header                \
468310e230b6Smaya   .DWordLength                         =      6,  \
468410e230b6Smaya   .SubOpcode                           =      4,  \
468510e230b6Smaya   .MediaCommandOpcode                  =      1,  \
468610e230b6Smaya   .Pipeline                            =      2,  \
468710e230b6Smaya   .CommandType                         =      3
468810e230b6Smaya
468910e230b6Smayastruct GEN7_GPGPU_OBJECT {
469010e230b6Smaya   uint32_t                             DWordLength;
469110e230b6Smaya   bool                                 PredicateEnable;
469210e230b6Smaya   uint32_t                             SubOpcode;
469310e230b6Smaya   uint32_t                             MediaCommandOpcode;
469410e230b6Smaya   uint32_t                             Pipeline;
469510e230b6Smaya   uint32_t                             CommandType;
469610e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
469710e230b6Smaya   uint32_t                             SharedLocalMemoryFixedOffset;
469810e230b6Smaya   uint32_t                             IndirectDataLength;
469910e230b6Smaya   uint32_t                             HalfSliceDestinationSelect;
470010e230b6Smaya#define HalfSlice1                               2
470110e230b6Smaya#define HalfSlice0                               1
470210e230b6Smaya#define EitherHalfSlice                          0
470310e230b6Smaya   uint32_t                             EndofThreadGroup;
470410e230b6Smaya   uint32_t                             SharedLocalMemoryOffset;
470510e230b6Smaya   uint64_t                             IndirectDataStartAddress;
470610e230b6Smaya   uint32_t                             ThreadGroupIDX;
470710e230b6Smaya   uint32_t                             ThreadGroupIDY;
470810e230b6Smaya   uint32_t                             ThreadGroupIDZ;
470910e230b6Smaya   uint32_t                             ExecutionMask;
471010e230b6Smaya};
471110e230b6Smaya
471210e230b6Smayastatic inline void
471310e230b6SmayaGEN7_GPGPU_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
471410e230b6Smaya                       __attribute__((unused)) void * restrict dst,
471510e230b6Smaya                       __attribute__((unused)) const struct GEN7_GPGPU_OBJECT * restrict values)
471610e230b6Smaya{
471710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
471810e230b6Smaya
471910e230b6Smaya   dw[0] =
472010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
472110e230b6Smaya      __gen_uint(values->PredicateEnable, 8, 8) |
472210e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
472310e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
472410e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
472510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
472610e230b6Smaya
472710e230b6Smaya   dw[1] =
472810e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 4) |
472910e230b6Smaya      __gen_uint(values->SharedLocalMemoryFixedOffset, 7, 7);
473010e230b6Smaya
473110e230b6Smaya   dw[2] =
473210e230b6Smaya      __gen_uint(values->IndirectDataLength, 0, 16) |
473310e230b6Smaya      __gen_uint(values->HalfSliceDestinationSelect, 17, 18) |
473410e230b6Smaya      __gen_uint(values->EndofThreadGroup, 24, 24) |
473510e230b6Smaya      __gen_uint(values->SharedLocalMemoryOffset, 28, 31);
473610e230b6Smaya
473710e230b6Smaya   dw[3] =
473810e230b6Smaya      __gen_offset(values->IndirectDataStartAddress, 0, 31);
473910e230b6Smaya
474010e230b6Smaya   dw[4] =
474110e230b6Smaya      __gen_uint(values->ThreadGroupIDX, 0, 31);
474210e230b6Smaya
474310e230b6Smaya   dw[5] =
474410e230b6Smaya      __gen_uint(values->ThreadGroupIDY, 0, 31);
474510e230b6Smaya
474610e230b6Smaya   dw[6] =
474710e230b6Smaya      __gen_uint(values->ThreadGroupIDZ, 0, 31);
474810e230b6Smaya
474910e230b6Smaya   dw[7] =
475010e230b6Smaya      __gen_uint(values->ExecutionMask, 0, 31);
475110e230b6Smaya}
475210e230b6Smaya
475310e230b6Smaya#define GEN7_GPGPU_WALKER_length              11
475410e230b6Smaya#define GEN7_GPGPU_WALKER_length_bias          2
475510e230b6Smaya#define GEN7_GPGPU_WALKER_header                \
475610e230b6Smaya   .DWordLength                         =      9,  \
475710e230b6Smaya   .SubOpcodeA                          =      5,  \
475810e230b6Smaya   .MediaCommandOpcode                  =      1,  \
475910e230b6Smaya   .Pipeline                            =      2,  \
476010e230b6Smaya   .CommandType                         =      3
476110e230b6Smaya
476210e230b6Smayastruct GEN7_GPGPU_WALKER {
476310e230b6Smaya   uint32_t                             DWordLength;
476410e230b6Smaya   bool                                 PredicateEnable;
476510e230b6Smaya   bool                                 IndirectParameterEnable;
476610e230b6Smaya   uint32_t                             SubOpcodeA;
476710e230b6Smaya   uint32_t                             MediaCommandOpcode;
476810e230b6Smaya   uint32_t                             Pipeline;
476910e230b6Smaya   uint32_t                             CommandType;
477010e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
477110e230b6Smaya   uint32_t                             ThreadWidthCounterMaximum;
477210e230b6Smaya   uint32_t                             ThreadHeightCounterMaximum;
477310e230b6Smaya   uint32_t                             ThreadDepthCounterMaximum;
477410e230b6Smaya   uint32_t                             SIMDSize;
477510e230b6Smaya#define SIMD8                                    0
477610e230b6Smaya#define SIMD16                                   1
477710e230b6Smaya#define SIMD32                                   2
477810e230b6Smaya   uint32_t                             ThreadGroupIDStartingX;
477910e230b6Smaya   uint32_t                             ThreadGroupIDXDimension;
478010e230b6Smaya   uint32_t                             ThreadGroupIDStartingY;
478110e230b6Smaya   uint32_t                             ThreadGroupIDYDimension;
478210e230b6Smaya   uint32_t                             ThreadGroupIDStartingZ;
478310e230b6Smaya   uint32_t                             ThreadGroupIDZDimension;
478410e230b6Smaya   uint32_t                             RightExecutionMask;
478510e230b6Smaya   uint32_t                             BottomExecutionMask;
478610e230b6Smaya};
478710e230b6Smaya
478810e230b6Smayastatic inline void
478910e230b6SmayaGEN7_GPGPU_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
479010e230b6Smaya                       __attribute__((unused)) void * restrict dst,
479110e230b6Smaya                       __attribute__((unused)) const struct GEN7_GPGPU_WALKER * restrict values)
479210e230b6Smaya{
479310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
479410e230b6Smaya
479510e230b6Smaya   dw[0] =
479610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
479710e230b6Smaya      __gen_uint(values->PredicateEnable, 8, 8) |
479810e230b6Smaya      __gen_uint(values->IndirectParameterEnable, 10, 10) |
479910e230b6Smaya      __gen_uint(values->SubOpcodeA, 16, 23) |
480010e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
480110e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
480210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
480310e230b6Smaya
480410e230b6Smaya   dw[1] =
480510e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
480610e230b6Smaya
480710e230b6Smaya   dw[2] =
480810e230b6Smaya      __gen_uint(values->ThreadWidthCounterMaximum, 0, 5) |
480910e230b6Smaya      __gen_uint(values->ThreadHeightCounterMaximum, 8, 13) |
481010e230b6Smaya      __gen_uint(values->ThreadDepthCounterMaximum, 16, 21) |
481110e230b6Smaya      __gen_uint(values->SIMDSize, 30, 31);
481210e230b6Smaya
481310e230b6Smaya   dw[3] =
481410e230b6Smaya      __gen_uint(values->ThreadGroupIDStartingX, 0, 31);
481510e230b6Smaya
481610e230b6Smaya   dw[4] =
481710e230b6Smaya      __gen_uint(values->ThreadGroupIDXDimension, 0, 31);
481810e230b6Smaya
481910e230b6Smaya   dw[5] =
482010e230b6Smaya      __gen_uint(values->ThreadGroupIDStartingY, 0, 31);
482110e230b6Smaya
482210e230b6Smaya   dw[6] =
482310e230b6Smaya      __gen_uint(values->ThreadGroupIDYDimension, 0, 31);
482410e230b6Smaya
482510e230b6Smaya   dw[7] =
482610e230b6Smaya      __gen_uint(values->ThreadGroupIDStartingZ, 0, 31);
482710e230b6Smaya
482810e230b6Smaya   dw[8] =
482910e230b6Smaya      __gen_uint(values->ThreadGroupIDZDimension, 0, 31);
483010e230b6Smaya
483110e230b6Smaya   dw[9] =
483210e230b6Smaya      __gen_uint(values->RightExecutionMask, 0, 31);
483310e230b6Smaya
483410e230b6Smaya   dw[10] =
483510e230b6Smaya      __gen_uint(values->BottomExecutionMask, 0, 31);
483610e230b6Smaya}
483710e230b6Smaya
483810e230b6Smaya#define GEN7_MEDIA_CURBE_LOAD_length           4
483910e230b6Smaya#define GEN7_MEDIA_CURBE_LOAD_length_bias      2
484010e230b6Smaya#define GEN7_MEDIA_CURBE_LOAD_header            \
484110e230b6Smaya   .DWordLength                         =      2,  \
484210e230b6Smaya   .SubOpcode                           =      1,  \
484310e230b6Smaya   .MediaCommandOpcode                  =      0,  \
484410e230b6Smaya   .Pipeline                            =      2,  \
484510e230b6Smaya   .CommandType                         =      3
484610e230b6Smaya
484710e230b6Smayastruct GEN7_MEDIA_CURBE_LOAD {
484810e230b6Smaya   uint32_t                             DWordLength;
484910e230b6Smaya   uint32_t                             SubOpcode;
485010e230b6Smaya   uint32_t                             MediaCommandOpcode;
485110e230b6Smaya   uint32_t                             Pipeline;
485210e230b6Smaya   uint32_t                             CommandType;
485310e230b6Smaya   uint32_t                             CURBETotalDataLength;
485410e230b6Smaya   uint32_t                             CURBEDataStartAddress;
485510e230b6Smaya};
485610e230b6Smaya
485710e230b6Smayastatic inline void
485810e230b6SmayaGEN7_MEDIA_CURBE_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
485910e230b6Smaya                           __attribute__((unused)) void * restrict dst,
486010e230b6Smaya                           __attribute__((unused)) const struct GEN7_MEDIA_CURBE_LOAD * restrict values)
486110e230b6Smaya{
486210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
486310e230b6Smaya
486410e230b6Smaya   dw[0] =
486510e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
486610e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
486710e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
486810e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
486910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
487010e230b6Smaya
487110e230b6Smaya   dw[1] = 0;
487210e230b6Smaya
487310e230b6Smaya   dw[2] =
487410e230b6Smaya      __gen_uint(values->CURBETotalDataLength, 0, 16);
487510e230b6Smaya
487610e230b6Smaya   dw[3] =
487710e230b6Smaya      __gen_uint(values->CURBEDataStartAddress, 0, 31);
487810e230b6Smaya}
487910e230b6Smaya
488010e230b6Smaya#define GEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length      4
488110e230b6Smaya#define GEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length_bias      2
488210e230b6Smaya#define GEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD_header\
488310e230b6Smaya   .DWordLength                         =      2,  \
488410e230b6Smaya   .SubOpcode                           =      2,  \
488510e230b6Smaya   .MediaCommandOpcode                  =      0,  \
488610e230b6Smaya   .Pipeline                            =      2,  \
488710e230b6Smaya   .CommandType                         =      3
488810e230b6Smaya
488910e230b6Smayastruct GEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD {
489010e230b6Smaya   uint32_t                             DWordLength;
489110e230b6Smaya   uint32_t                             SubOpcode;
489210e230b6Smaya   uint32_t                             MediaCommandOpcode;
489310e230b6Smaya   uint32_t                             Pipeline;
489410e230b6Smaya   uint32_t                             CommandType;
489510e230b6Smaya   uint32_t                             InterfaceDescriptorTotalLength;
489610e230b6Smaya   uint64_t                             InterfaceDescriptorDataStartAddress;
489710e230b6Smaya};
489810e230b6Smaya
489910e230b6Smayastatic inline void
490010e230b6SmayaGEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
490110e230b6Smaya                                          __attribute__((unused)) void * restrict dst,
490210e230b6Smaya                                          __attribute__((unused)) const struct GEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD * restrict values)
490310e230b6Smaya{
490410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
490510e230b6Smaya
490610e230b6Smaya   dw[0] =
490710e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
490810e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
490910e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
491010e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
491110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
491210e230b6Smaya
491310e230b6Smaya   dw[1] = 0;
491410e230b6Smaya
491510e230b6Smaya   dw[2] =
491610e230b6Smaya      __gen_uint(values->InterfaceDescriptorTotalLength, 0, 16);
491710e230b6Smaya
491810e230b6Smaya   dw[3] =
491910e230b6Smaya      __gen_offset(values->InterfaceDescriptorDataStartAddress, 0, 31);
492010e230b6Smaya}
492110e230b6Smaya
492210e230b6Smaya#define GEN7_MEDIA_OBJECT_length_bias          2
492310e230b6Smaya#define GEN7_MEDIA_OBJECT_header                \
492410e230b6Smaya   .DWordLength                         =      4,  \
492510e230b6Smaya   .MediaCommandSubOpcode               =      0,  \
492610e230b6Smaya   .MediaCommandOpcode                  =      1,  \
492710e230b6Smaya   .MediaCommandPipeline                =      2,  \
492810e230b6Smaya   .CommandType                         =      3
492910e230b6Smaya
493010e230b6Smayastruct GEN7_MEDIA_OBJECT {
493110e230b6Smaya   uint32_t                             DWordLength;
493210e230b6Smaya   uint32_t                             MediaCommandSubOpcode;
493310e230b6Smaya   uint32_t                             MediaCommandOpcode;
493410e230b6Smaya   uint32_t                             MediaCommandPipeline;
493510e230b6Smaya   uint32_t                             CommandType;
493610e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
493710e230b6Smaya   uint32_t                             IndirectDataLength;
493810e230b6Smaya   uint32_t                             HalfSliceDestinationSelect;
493910e230b6Smaya#define HalfSlice1                               2
494010e230b6Smaya#define HalfSlice0                               1
494110e230b6Smaya#define Eitherhalfslice                          0
494210e230b6Smaya   uint32_t                             UseScoreboard;
494310e230b6Smaya#define Notusingscoreboard                       0
494410e230b6Smaya#define Usingscoreboard                          1
494510e230b6Smaya   uint32_t                             ThreadSynchronization;
494610e230b6Smaya#define Nothreadsynchronization                  0
494710e230b6Smaya#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
494810e230b6Smaya   bool                                 ChildrenPresent;
494910e230b6Smaya   __gen_address_type                   IndirectDataStartAddress;
495010e230b6Smaya   uint32_t                             ScoreboardX;
495110e230b6Smaya   uint32_t                             ScoredboardY;
495210e230b6Smaya   uint32_t                             ScoreboardMask;
495310e230b6Smaya   uint32_t                             ScoreboardColor;
495410e230b6Smaya   /* variable length fields follow */
495510e230b6Smaya};
495610e230b6Smaya
495710e230b6Smayastatic inline void
495810e230b6SmayaGEN7_MEDIA_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
495910e230b6Smaya                       __attribute__((unused)) void * restrict dst,
496010e230b6Smaya                       __attribute__((unused)) const struct GEN7_MEDIA_OBJECT * restrict values)
496110e230b6Smaya{
496210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
496310e230b6Smaya
496410e230b6Smaya   dw[0] =
496510e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
496610e230b6Smaya      __gen_uint(values->MediaCommandSubOpcode, 16, 23) |
496710e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
496810e230b6Smaya      __gen_uint(values->MediaCommandPipeline, 27, 28) |
496910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
497010e230b6Smaya
497110e230b6Smaya   dw[1] =
497210e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
497310e230b6Smaya
497410e230b6Smaya   dw[2] =
497510e230b6Smaya      __gen_uint(values->IndirectDataLength, 0, 16) |
497610e230b6Smaya      __gen_uint(values->HalfSliceDestinationSelect, 17, 18) |
497710e230b6Smaya      __gen_uint(values->UseScoreboard, 21, 21) |
497810e230b6Smaya      __gen_uint(values->ThreadSynchronization, 24, 24) |
497910e230b6Smaya      __gen_uint(values->ChildrenPresent, 31, 31);
498010e230b6Smaya
498110e230b6Smaya   dw[3] = __gen_combine_address(data, &dw[3], values->IndirectDataStartAddress, 0);
498210e230b6Smaya
498310e230b6Smaya   dw[4] =
498410e230b6Smaya      __gen_uint(values->ScoreboardX, 0, 8) |
498510e230b6Smaya      __gen_uint(values->ScoredboardY, 16, 24);
498610e230b6Smaya
498710e230b6Smaya   dw[5] =
498810e230b6Smaya      __gen_uint(values->ScoreboardMask, 0, 7) |
498910e230b6Smaya      __gen_uint(values->ScoreboardColor, 16, 19);
499010e230b6Smaya}
499110e230b6Smaya
499210e230b6Smaya#define GEN7_MEDIA_OBJECT_PRT_length          16
499310e230b6Smaya#define GEN7_MEDIA_OBJECT_PRT_length_bias      2
499410e230b6Smaya#define GEN7_MEDIA_OBJECT_PRT_header            \
499510e230b6Smaya   .DWordLength                         =     14,  \
499610e230b6Smaya   .SubOpcode                           =      2,  \
499710e230b6Smaya   .MediaCommandOpcode                  =      1,  \
499810e230b6Smaya   .Pipeline                            =      2,  \
499910e230b6Smaya   .CommandType                         =      3
500010e230b6Smaya
500110e230b6Smayastruct GEN7_MEDIA_OBJECT_PRT {
500210e230b6Smaya   uint32_t                             DWordLength;
500310e230b6Smaya   uint32_t                             SubOpcode;
500410e230b6Smaya   uint32_t                             MediaCommandOpcode;
500510e230b6Smaya   uint32_t                             Pipeline;
500610e230b6Smaya   uint32_t                             CommandType;
500710e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
500810e230b6Smaya   uint32_t                             PRT_FenceType;
500910e230b6Smaya#define Rootthreadqueue                          0
501010e230b6Smaya#define VFEstateflush                            1
501110e230b6Smaya   bool                                 PRT_FenceNeeded;
501210e230b6Smaya   bool                                 ChildrenPresent;
501310e230b6Smaya   uint32_t                             InlineData[12];
501410e230b6Smaya};
501510e230b6Smaya
501610e230b6Smayastatic inline void
501710e230b6SmayaGEN7_MEDIA_OBJECT_PRT_pack(__attribute__((unused)) __gen_user_data *data,
501810e230b6Smaya                           __attribute__((unused)) void * restrict dst,
501910e230b6Smaya                           __attribute__((unused)) const struct GEN7_MEDIA_OBJECT_PRT * restrict values)
502010e230b6Smaya{
502110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
502210e230b6Smaya
502310e230b6Smaya   dw[0] =
502410e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
502510e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
502610e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
502710e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
502810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
502910e230b6Smaya
503010e230b6Smaya   dw[1] =
503110e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
503210e230b6Smaya
503310e230b6Smaya   dw[2] =
503410e230b6Smaya      __gen_uint(values->PRT_FenceType, 22, 22) |
503510e230b6Smaya      __gen_uint(values->PRT_FenceNeeded, 23, 23) |
503610e230b6Smaya      __gen_uint(values->ChildrenPresent, 31, 31);
503710e230b6Smaya
503810e230b6Smaya   dw[3] = 0;
503910e230b6Smaya
504010e230b6Smaya   dw[4] =
504110e230b6Smaya      __gen_uint(values->InlineData[0], 0, 31);
504210e230b6Smaya
504310e230b6Smaya   dw[5] =
504410e230b6Smaya      __gen_uint(values->InlineData[1], 0, 31);
504510e230b6Smaya
504610e230b6Smaya   dw[6] =
504710e230b6Smaya      __gen_uint(values->InlineData[2], 0, 31);
504810e230b6Smaya
504910e230b6Smaya   dw[7] =
505010e230b6Smaya      __gen_uint(values->InlineData[3], 0, 31);
505110e230b6Smaya
505210e230b6Smaya   dw[8] =
505310e230b6Smaya      __gen_uint(values->InlineData[4], 0, 31);
505410e230b6Smaya
505510e230b6Smaya   dw[9] =
505610e230b6Smaya      __gen_uint(values->InlineData[5], 0, 31);
505710e230b6Smaya
505810e230b6Smaya   dw[10] =
505910e230b6Smaya      __gen_uint(values->InlineData[6], 0, 31);
506010e230b6Smaya
506110e230b6Smaya   dw[11] =
506210e230b6Smaya      __gen_uint(values->InlineData[7], 0, 31);
506310e230b6Smaya
506410e230b6Smaya   dw[12] =
506510e230b6Smaya      __gen_uint(values->InlineData[8], 0, 31);
506610e230b6Smaya
506710e230b6Smaya   dw[13] =
506810e230b6Smaya      __gen_uint(values->InlineData[9], 0, 31);
506910e230b6Smaya
507010e230b6Smaya   dw[14] =
507110e230b6Smaya      __gen_uint(values->InlineData[10], 0, 31);
507210e230b6Smaya
507310e230b6Smaya   dw[15] =
507410e230b6Smaya      __gen_uint(values->InlineData[11], 0, 31);
507510e230b6Smaya}
507610e230b6Smaya
507710e230b6Smaya#define GEN7_MEDIA_OBJECT_WALKER_length_bias      2
507810e230b6Smaya#define GEN7_MEDIA_OBJECT_WALKER_header         \
507910e230b6Smaya   .DWordLength                         =     15,  \
508010e230b6Smaya   .SubOpcode                           =      3,  \
508110e230b6Smaya   .MediaCommandOpcode                  =      1,  \
508210e230b6Smaya   .Pipeline                            =      2,  \
508310e230b6Smaya   .CommandType                         =      3
508410e230b6Smaya
508510e230b6Smayastruct GEN7_MEDIA_OBJECT_WALKER {
508610e230b6Smaya   uint32_t                             DWordLength;
508710e230b6Smaya   uint32_t                             SubOpcode;
508810e230b6Smaya   uint32_t                             MediaCommandOpcode;
508910e230b6Smaya   uint32_t                             Pipeline;
509010e230b6Smaya   uint32_t                             CommandType;
509110e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
509210e230b6Smaya   uint32_t                             IndirectDataLength;
509310e230b6Smaya   uint32_t                             UseScoreboard;
509410e230b6Smaya#define Notusingscoreboard                       0
509510e230b6Smaya#define Usingscoreboard                          1
509610e230b6Smaya   uint32_t                             ThreadSynchronization;
509710e230b6Smaya#define Nothreadsynchronization                  0
509810e230b6Smaya#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
509910e230b6Smaya   uint32_t                             ChildrenPresent;
510010e230b6Smaya   uint64_t                             IndirectDataStartAddress;
510110e230b6Smaya   uint32_t                             ScoreboardMask;
510210e230b6Smaya   int32_t                              MidLoopUnitX;
510310e230b6Smaya   int32_t                              LocalMidLoopUnitY;
510410e230b6Smaya   uint32_t                             MiddleLoopExtraSteps;
510510e230b6Smaya   uint32_t                             ColorCountMinusOne;
510610e230b6Smaya   uint32_t                             Repel;
510710e230b6Smaya   uint32_t                             DualMode;
510810e230b6Smaya   uint32_t                             LocalLoopExecCount;
510910e230b6Smaya   uint32_t                             GlobalLoopExecCount;
511010e230b6Smaya   uint32_t                             BlockResolutionX;
511110e230b6Smaya   uint32_t                             BlockResolutionY;
511210e230b6Smaya   uint32_t                             LocalStartX;
511310e230b6Smaya   uint32_t                             LocalStartY;
511410e230b6Smaya   uint32_t                             LocalEndX;
511510e230b6Smaya   uint32_t                             LocalEndY;
511610e230b6Smaya   int32_t                              LocalOuterLoopStrideX;
511710e230b6Smaya   int32_t                              LocalOuterLoopStrideY;
511810e230b6Smaya   int32_t                              LocalInnerLoopUnitX;
511910e230b6Smaya   int32_t                              LocalInnerLoopUnitY;
512010e230b6Smaya   uint32_t                             GlobalResolutionX;
512110e230b6Smaya   uint32_t                             GlobalResolutionY;
512210e230b6Smaya   int32_t                              GlobalStartX;
512310e230b6Smaya   int32_t                              GlobalStartY;
512410e230b6Smaya   int32_t                              GlobalOuterLoopStrideX;
512510e230b6Smaya   int32_t                              GlobalOuterLoopStrideY;
512610e230b6Smaya   int32_t                              GlobalInnerLoopUnitX;
512710e230b6Smaya   int32_t                              GlobalInnerLoopUnitY;
512810e230b6Smaya   /* variable length fields follow */
512910e230b6Smaya};
513010e230b6Smaya
513110e230b6Smayastatic inline void
513210e230b6SmayaGEN7_MEDIA_OBJECT_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
513310e230b6Smaya                              __attribute__((unused)) void * restrict dst,
513410e230b6Smaya                              __attribute__((unused)) const struct GEN7_MEDIA_OBJECT_WALKER * restrict values)
513510e230b6Smaya{
513610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
513710e230b6Smaya
513810e230b6Smaya   dw[0] =
513910e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
514010e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
514110e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
514210e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
514310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
514410e230b6Smaya
514510e230b6Smaya   dw[1] =
514610e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
514710e230b6Smaya
514810e230b6Smaya   dw[2] =
514910e230b6Smaya      __gen_uint(values->IndirectDataLength, 0, 16) |
515010e230b6Smaya      __gen_uint(values->UseScoreboard, 21, 21) |
515110e230b6Smaya      __gen_uint(values->ThreadSynchronization, 24, 24) |
515210e230b6Smaya      __gen_uint(values->ChildrenPresent, 31, 31);
515310e230b6Smaya
515410e230b6Smaya   dw[3] =
515510e230b6Smaya      __gen_offset(values->IndirectDataStartAddress, 0, 31);
515610e230b6Smaya
515710e230b6Smaya   dw[4] = 0;
515810e230b6Smaya
515910e230b6Smaya   dw[5] =
516010e230b6Smaya      __gen_uint(values->ScoreboardMask, 0, 7);
516110e230b6Smaya
516210e230b6Smaya   dw[6] =
516310e230b6Smaya      __gen_sint(values->MidLoopUnitX, 8, 9) |
516410e230b6Smaya      __gen_sint(values->LocalMidLoopUnitY, 12, 13) |
516510e230b6Smaya      __gen_uint(values->MiddleLoopExtraSteps, 16, 20) |
516610e230b6Smaya      __gen_uint(values->ColorCountMinusOne, 24, 27) |
516710e230b6Smaya      __gen_uint(values->Repel, 30, 30) |
516810e230b6Smaya      __gen_uint(values->DualMode, 31, 31);
516910e230b6Smaya
517010e230b6Smaya   dw[7] =
517110e230b6Smaya      __gen_uint(values->LocalLoopExecCount, 0, 9) |
517210e230b6Smaya      __gen_uint(values->GlobalLoopExecCount, 16, 25);
517310e230b6Smaya
517410e230b6Smaya   dw[8] =
517510e230b6Smaya      __gen_uint(values->BlockResolutionX, 0, 8) |
517610e230b6Smaya      __gen_uint(values->BlockResolutionY, 16, 24);
517710e230b6Smaya
517810e230b6Smaya   dw[9] =
517910e230b6Smaya      __gen_uint(values->LocalStartX, 0, 8) |
518010e230b6Smaya      __gen_uint(values->LocalStartY, 16, 24);
518110e230b6Smaya
518210e230b6Smaya   dw[10] =
518310e230b6Smaya      __gen_uint(values->LocalEndX, 0, 8) |
518410e230b6Smaya      __gen_uint(values->LocalEndY, 16, 24);
518510e230b6Smaya
518610e230b6Smaya   dw[11] =
518710e230b6Smaya      __gen_sint(values->LocalOuterLoopStrideX, 0, 9) |
518810e230b6Smaya      __gen_sint(values->LocalOuterLoopStrideY, 16, 25);
518910e230b6Smaya
519010e230b6Smaya   dw[12] =
519110e230b6Smaya      __gen_sint(values->LocalInnerLoopUnitX, 0, 9) |
519210e230b6Smaya      __gen_sint(values->LocalInnerLoopUnitY, 16, 25);
519310e230b6Smaya
519410e230b6Smaya   dw[13] =
519510e230b6Smaya      __gen_uint(values->GlobalResolutionX, 0, 8) |
519610e230b6Smaya      __gen_uint(values->GlobalResolutionY, 16, 24);
519710e230b6Smaya
519810e230b6Smaya   dw[14] =
519910e230b6Smaya      __gen_sint(values->GlobalStartX, 0, 9) |
520010e230b6Smaya      __gen_sint(values->GlobalStartY, 16, 25);
520110e230b6Smaya
520210e230b6Smaya   dw[15] =
520310e230b6Smaya      __gen_sint(values->GlobalOuterLoopStrideX, 0, 9) |
520410e230b6Smaya      __gen_sint(values->GlobalOuterLoopStrideY, 16, 25);
520510e230b6Smaya
520610e230b6Smaya   dw[16] =
520710e230b6Smaya      __gen_sint(values->GlobalInnerLoopUnitX, 0, 9) |
520810e230b6Smaya      __gen_sint(values->GlobalInnerLoopUnitY, 16, 25);
520910e230b6Smaya}
521010e230b6Smaya
521110e230b6Smaya#define GEN7_MEDIA_STATE_FLUSH_length          2
521210e230b6Smaya#define GEN7_MEDIA_STATE_FLUSH_length_bias      2
521310e230b6Smaya#define GEN7_MEDIA_STATE_FLUSH_header           \
521410e230b6Smaya   .DWordLength                         =      0,  \
521510e230b6Smaya   .SubOpcode                           =      4,  \
521610e230b6Smaya   .MediaCommandOpcode                  =      0,  \
521710e230b6Smaya   .Pipeline                            =      2,  \
521810e230b6Smaya   .CommandType                         =      3
521910e230b6Smaya
522010e230b6Smayastruct GEN7_MEDIA_STATE_FLUSH {
522110e230b6Smaya   uint32_t                             DWordLength;
522210e230b6Smaya   uint32_t                             SubOpcode;
522310e230b6Smaya   uint32_t                             MediaCommandOpcode;
522410e230b6Smaya   uint32_t                             Pipeline;
522510e230b6Smaya   uint32_t                             CommandType;
522610e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
522710e230b6Smaya   uint32_t                             WatermarkRequired;
522810e230b6Smaya};
522910e230b6Smaya
523010e230b6Smayastatic inline void
523110e230b6SmayaGEN7_MEDIA_STATE_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
523210e230b6Smaya                            __attribute__((unused)) void * restrict dst,
523310e230b6Smaya                            __attribute__((unused)) const struct GEN7_MEDIA_STATE_FLUSH * restrict values)
523410e230b6Smaya{
523510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
523610e230b6Smaya
523710e230b6Smaya   dw[0] =
523810e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
523910e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
524010e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
524110e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
524210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
524310e230b6Smaya
524410e230b6Smaya   dw[1] =
524510e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 5) |
524610e230b6Smaya      __gen_uint(values->WatermarkRequired, 6, 6);
524710e230b6Smaya}
524810e230b6Smaya
524910e230b6Smaya#define GEN7_MEDIA_VFE_STATE_length            8
525010e230b6Smaya#define GEN7_MEDIA_VFE_STATE_length_bias       2
525110e230b6Smaya#define GEN7_MEDIA_VFE_STATE_header             \
525210e230b6Smaya   .DWordLength                         =      6,  \
525310e230b6Smaya   .SubOpcode                           =      0,  \
525410e230b6Smaya   .MediaCommandOpcode                  =      0,  \
525510e230b6Smaya   .Pipeline                            =      2,  \
525610e230b6Smaya   .CommandType                         =      3
525710e230b6Smaya
525810e230b6Smayastruct GEN7_MEDIA_VFE_STATE {
525910e230b6Smaya   uint32_t                             DWordLength;
526010e230b6Smaya   uint32_t                             SubOpcode;
526110e230b6Smaya   uint32_t                             MediaCommandOpcode;
526210e230b6Smaya   uint32_t                             Pipeline;
526310e230b6Smaya   uint32_t                             CommandType;
526410e230b6Smaya   uint32_t                             PerThreadScratchSpace;
526510e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
526610e230b6Smaya   uint32_t                             GPGPUMode;
526710e230b6Smaya   uint32_t                             GatewayMMIOAccessControl;
526810e230b6Smaya#define NoMMIOreadwriteallowed                   0
526910e230b6Smaya#define MMIOreadwritetoanyaddress                2
527010e230b6Smaya   uint32_t                             BypassGatewayControl;
527110e230b6Smaya#define MaintainingOpenGatewayForwardMsgCloseGatewayprotocollegacymode 0
527210e230b6Smaya#define BypassingOpenGatewayCloseGatewayprotocol 1
527310e230b6Smaya   uint32_t                             ResetGatewayTimer;
527410e230b6Smaya#define Maintainingtheexistingtimestampstate     0
527510e230b6Smaya#define Resettingrelativetimerandlatchingtheglobaltimestamp 1
527610e230b6Smaya   uint32_t                             NumberofURBEntries;
527710e230b6Smaya   uint32_t                             MaximumNumberofThreads;
527810e230b6Smaya   uint32_t                             CURBEAllocationSize;
527910e230b6Smaya   uint32_t                             URBEntryAllocationSize;
528010e230b6Smaya   uint32_t                             ScoreboardMask;
528110e230b6Smaya   uint32_t                             ScoreboardType;
528210e230b6Smaya#define StallingScoreboard                       0
528310e230b6Smaya#define NonStallingScoreboard                    1
528410e230b6Smaya   uint32_t                             ScoreboardEnable;
528510e230b6Smaya#define Scoreboarddisabled                       0
528610e230b6Smaya#define Scoreboardenabled                        1
528710e230b6Smaya   int32_t                              Scoreboard0DeltaX;
528810e230b6Smaya   int32_t                              Scoreboard0DeltaY;
528910e230b6Smaya   int32_t                              Scoreboard1DeltaX;
529010e230b6Smaya   int32_t                              Scoreboard1DeltaY;
529110e230b6Smaya   int32_t                              Scoreboard2DeltaX;
529210e230b6Smaya   int32_t                              Scoreboard2DeltaY;
529310e230b6Smaya   int32_t                              Scoreboard3DeltaX;
529410e230b6Smaya   int32_t                              Scoreboard3DeltaY;
529510e230b6Smaya   int32_t                              Scoreboard4DeltaX;
529610e230b6Smaya   int32_t                              Scoreboard4DeltaY;
529710e230b6Smaya   int32_t                              Scoreboard5DeltaX;
529810e230b6Smaya   int32_t                              Scoreboard5DeltaY;
529910e230b6Smaya   int32_t                              Scoreboard6DeltaX;
530010e230b6Smaya   int32_t                              Scoreboard6DeltaY;
530110e230b6Smaya   int32_t                              Scoreboard7DeltaX;
530210e230b6Smaya   int32_t                              Scoreboard7DeltaY;
530310e230b6Smaya};
530410e230b6Smaya
530510e230b6Smayastatic inline void
530610e230b6SmayaGEN7_MEDIA_VFE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
530710e230b6Smaya                          __attribute__((unused)) void * restrict dst,
530810e230b6Smaya                          __attribute__((unused)) const struct GEN7_MEDIA_VFE_STATE * restrict values)
530910e230b6Smaya{
531010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
531110e230b6Smaya
531210e230b6Smaya   dw[0] =
531310e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
531410e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
531510e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
531610e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
531710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
531810e230b6Smaya
531910e230b6Smaya   const uint32_t v1 =
532010e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
532110e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->ScratchSpaceBasePointer, v1);
532210e230b6Smaya
532310e230b6Smaya   dw[2] =
532410e230b6Smaya      __gen_uint(values->GPGPUMode, 2, 2) |
532510e230b6Smaya      __gen_uint(values->GatewayMMIOAccessControl, 3, 4) |
532610e230b6Smaya      __gen_uint(values->BypassGatewayControl, 6, 6) |
532710e230b6Smaya      __gen_uint(values->ResetGatewayTimer, 7, 7) |
532810e230b6Smaya      __gen_uint(values->NumberofURBEntries, 8, 15) |
532910e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 16, 31);
533010e230b6Smaya
533110e230b6Smaya   dw[3] = 0;
533210e230b6Smaya
533310e230b6Smaya   dw[4] =
533410e230b6Smaya      __gen_uint(values->CURBEAllocationSize, 0, 15) |
533510e230b6Smaya      __gen_uint(values->URBEntryAllocationSize, 16, 31);
533610e230b6Smaya
533710e230b6Smaya   dw[5] =
533810e230b6Smaya      __gen_uint(values->ScoreboardMask, 0, 7) |
533910e230b6Smaya      __gen_uint(values->ScoreboardType, 30, 30) |
534010e230b6Smaya      __gen_uint(values->ScoreboardEnable, 31, 31);
534110e230b6Smaya
534210e230b6Smaya   dw[6] =
534310e230b6Smaya      __gen_sint(values->Scoreboard0DeltaX, 0, 3) |
534410e230b6Smaya      __gen_sint(values->Scoreboard0DeltaY, 4, 7) |
534510e230b6Smaya      __gen_sint(values->Scoreboard1DeltaX, 8, 11) |
534610e230b6Smaya      __gen_sint(values->Scoreboard1DeltaY, 12, 15) |
534710e230b6Smaya      __gen_sint(values->Scoreboard2DeltaX, 16, 19) |
534810e230b6Smaya      __gen_sint(values->Scoreboard2DeltaY, 20, 23) |
534910e230b6Smaya      __gen_sint(values->Scoreboard3DeltaX, 24, 27) |
535010e230b6Smaya      __gen_sint(values->Scoreboard3DeltaY, 28, 31);
535110e230b6Smaya
535210e230b6Smaya   dw[7] =
535310e230b6Smaya      __gen_sint(values->Scoreboard4DeltaX, 0, 3) |
535410e230b6Smaya      __gen_sint(values->Scoreboard4DeltaY, 4, 7) |
535510e230b6Smaya      __gen_sint(values->Scoreboard5DeltaX, 8, 11) |
535610e230b6Smaya      __gen_sint(values->Scoreboard5DeltaY, 12, 15) |
535710e230b6Smaya      __gen_sint(values->Scoreboard6DeltaX, 16, 19) |
535810e230b6Smaya      __gen_sint(values->Scoreboard6DeltaY, 20, 23) |
535910e230b6Smaya      __gen_sint(values->Scoreboard7DeltaX, 24, 27) |
536010e230b6Smaya      __gen_sint(values->Scoreboard7DeltaY, 28, 31);
536110e230b6Smaya}
536210e230b6Smaya
536310e230b6Smaya#define GEN7_MI_ARB_CHECK_length               1
536410e230b6Smaya#define GEN7_MI_ARB_CHECK_length_bias          1
536510e230b6Smaya#define GEN7_MI_ARB_CHECK_header                \
536610e230b6Smaya   .MICommandOpcode                     =      5,  \
536710e230b6Smaya   .CommandType                         =      0
536810e230b6Smaya
536910e230b6Smayastruct GEN7_MI_ARB_CHECK {
537010e230b6Smaya   uint32_t                             MICommandOpcode;
537110e230b6Smaya   uint32_t                             CommandType;
537210e230b6Smaya};
537310e230b6Smaya
537410e230b6Smayastatic inline void
537510e230b6SmayaGEN7_MI_ARB_CHECK_pack(__attribute__((unused)) __gen_user_data *data,
537610e230b6Smaya                       __attribute__((unused)) void * restrict dst,
537710e230b6Smaya                       __attribute__((unused)) const struct GEN7_MI_ARB_CHECK * restrict values)
537810e230b6Smaya{
537910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
538010e230b6Smaya
538110e230b6Smaya   dw[0] =
538210e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
538310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
538410e230b6Smaya}
538510e230b6Smaya
538610e230b6Smaya#define GEN7_MI_ARB_ON_OFF_length              1
538710e230b6Smaya#define GEN7_MI_ARB_ON_OFF_length_bias         1
538810e230b6Smaya#define GEN7_MI_ARB_ON_OFF_header               \
538910e230b6Smaya   .MICommandOpcode                     =      8,  \
539010e230b6Smaya   .CommandType                         =      0
539110e230b6Smaya
539210e230b6Smayastruct GEN7_MI_ARB_ON_OFF {
539310e230b6Smaya   bool                                 ArbitrationEnable;
539410e230b6Smaya   uint32_t                             MICommandOpcode;
539510e230b6Smaya   uint32_t                             CommandType;
539610e230b6Smaya};
539710e230b6Smaya
539810e230b6Smayastatic inline void
539910e230b6SmayaGEN7_MI_ARB_ON_OFF_pack(__attribute__((unused)) __gen_user_data *data,
540010e230b6Smaya                        __attribute__((unused)) void * restrict dst,
540110e230b6Smaya                        __attribute__((unused)) const struct GEN7_MI_ARB_ON_OFF * restrict values)
540210e230b6Smaya{
540310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
540410e230b6Smaya
540510e230b6Smaya   dw[0] =
540610e230b6Smaya      __gen_uint(values->ArbitrationEnable, 0, 0) |
540710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
540810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
540910e230b6Smaya}
541010e230b6Smaya
541110e230b6Smaya#define GEN7_MI_BATCH_BUFFER_END_length        1
541210e230b6Smaya#define GEN7_MI_BATCH_BUFFER_END_length_bias      1
541310e230b6Smaya#define GEN7_MI_BATCH_BUFFER_END_header         \
541410e230b6Smaya   .MICommandOpcode                     =     10,  \
541510e230b6Smaya   .CommandType                         =      0
541610e230b6Smaya
541710e230b6Smayastruct GEN7_MI_BATCH_BUFFER_END {
541810e230b6Smaya   uint32_t                             MICommandOpcode;
541910e230b6Smaya   uint32_t                             CommandType;
542010e230b6Smaya};
542110e230b6Smaya
542210e230b6Smayastatic inline void
542310e230b6SmayaGEN7_MI_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
542410e230b6Smaya                              __attribute__((unused)) void * restrict dst,
542510e230b6Smaya                              __attribute__((unused)) const struct GEN7_MI_BATCH_BUFFER_END * restrict values)
542610e230b6Smaya{
542710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
542810e230b6Smaya
542910e230b6Smaya   dw[0] =
543010e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
543110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
543210e230b6Smaya}
543310e230b6Smaya
543410e230b6Smaya#define GEN7_MI_BATCH_BUFFER_START_length      2
543510e230b6Smaya#define GEN7_MI_BATCH_BUFFER_START_length_bias      2
543610e230b6Smaya#define GEN7_MI_BATCH_BUFFER_START_header       \
543710e230b6Smaya   .DWordLength                         =      0,  \
543810e230b6Smaya   .MICommandOpcode                     =     49,  \
543910e230b6Smaya   .CommandType                         =      0
544010e230b6Smaya
544110e230b6Smayastruct GEN7_MI_BATCH_BUFFER_START {
544210e230b6Smaya   uint32_t                             DWordLength;
544310e230b6Smaya   uint32_t                             AddressSpaceIndicator;
544410e230b6Smaya#define ASI_GGTT                                 0
544510e230b6Smaya#define ASI_PPGTT                                1
544610e230b6Smaya   bool                                 ClearCommandBufferEnable;
544710e230b6Smaya   uint32_t                             MICommandOpcode;
544810e230b6Smaya   uint32_t                             CommandType;
544910e230b6Smaya   __gen_address_type                   BatchBufferStartAddress;
545010e230b6Smaya};
545110e230b6Smaya
545210e230b6Smayastatic inline void
545310e230b6SmayaGEN7_MI_BATCH_BUFFER_START_pack(__attribute__((unused)) __gen_user_data *data,
545410e230b6Smaya                                __attribute__((unused)) void * restrict dst,
545510e230b6Smaya                                __attribute__((unused)) const struct GEN7_MI_BATCH_BUFFER_START * restrict values)
545610e230b6Smaya{
545710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
545810e230b6Smaya
545910e230b6Smaya   dw[0] =
546010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
546110e230b6Smaya      __gen_uint(values->AddressSpaceIndicator, 8, 8) |
546210e230b6Smaya      __gen_uint(values->ClearCommandBufferEnable, 11, 11) |
546310e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
546410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
546510e230b6Smaya
546610e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->BatchBufferStartAddress, 0);
546710e230b6Smaya}
546810e230b6Smaya
546910e230b6Smaya#define GEN7_MI_CLFLUSH_length_bias            2
547010e230b6Smaya#define GEN7_MI_CLFLUSH_header                  \
547110e230b6Smaya   .DWordLength                         =      1,  \
547210e230b6Smaya   .MICommandOpcode                     =     39,  \
547310e230b6Smaya   .CommandType                         =      0
547410e230b6Smaya
547510e230b6Smayastruct GEN7_MI_CLFLUSH {
547610e230b6Smaya   uint32_t                             DWordLength;
547710e230b6Smaya   bool                                 UseGlobalGTT;
547810e230b6Smaya   uint32_t                             MICommandOpcode;
547910e230b6Smaya   uint32_t                             CommandType;
548010e230b6Smaya   uint32_t                             StartingCachelineOffset;
548110e230b6Smaya   __gen_address_type                   PageBaseAddress;
548210e230b6Smaya   __gen_address_type                   PageBaseAddressHigh;
548310e230b6Smaya   /* variable length fields follow */
548410e230b6Smaya};
548510e230b6Smaya
548610e230b6Smayastatic inline void
548710e230b6SmayaGEN7_MI_CLFLUSH_pack(__attribute__((unused)) __gen_user_data *data,
548810e230b6Smaya                     __attribute__((unused)) void * restrict dst,
548910e230b6Smaya                     __attribute__((unused)) const struct GEN7_MI_CLFLUSH * restrict values)
549010e230b6Smaya{
549110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
549210e230b6Smaya
549310e230b6Smaya   dw[0] =
549410e230b6Smaya      __gen_uint(values->DWordLength, 0, 9) |
549510e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
549610e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
549710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
549810e230b6Smaya
549910e230b6Smaya   const uint32_t v1 =
550010e230b6Smaya      __gen_uint(values->StartingCachelineOffset, 6, 11);
550110e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->PageBaseAddress, v1);
550210e230b6Smaya
550310e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->PageBaseAddressHigh, 0);
550410e230b6Smaya}
550510e230b6Smaya
550610e230b6Smaya#define GEN7_MI_CONDITIONAL_BATCH_BUFFER_END_length      2
550710e230b6Smaya#define GEN7_MI_CONDITIONAL_BATCH_BUFFER_END_length_bias      2
550810e230b6Smaya#define GEN7_MI_CONDITIONAL_BATCH_BUFFER_END_header\
550910e230b6Smaya   .DWordLength                         =      0,  \
551010e230b6Smaya   .CompareSemaphore                    =      0,  \
551110e230b6Smaya   .MICommandOpcode                     =     54,  \
551210e230b6Smaya   .CommandType                         =      0
551310e230b6Smaya
551410e230b6Smayastruct GEN7_MI_CONDITIONAL_BATCH_BUFFER_END {
551510e230b6Smaya   uint32_t                             DWordLength;
551610e230b6Smaya   uint32_t                             CompareSemaphore;
551710e230b6Smaya   bool                                 UseGlobalGTT;
551810e230b6Smaya   uint32_t                             MICommandOpcode;
551910e230b6Smaya   uint32_t                             CommandType;
552010e230b6Smaya   uint32_t                             CompareDataDword;
552110e230b6Smaya   __gen_address_type                   CompareAddress;
552210e230b6Smaya};
552310e230b6Smaya
552410e230b6Smayastatic inline void
552510e230b6SmayaGEN7_MI_CONDITIONAL_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
552610e230b6Smaya                                          __attribute__((unused)) void * restrict dst,
552710e230b6Smaya                                          __attribute__((unused)) const struct GEN7_MI_CONDITIONAL_BATCH_BUFFER_END * restrict values)
552810e230b6Smaya{
552910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
553010e230b6Smaya
553110e230b6Smaya   dw[0] =
553210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
553310e230b6Smaya      __gen_uint(values->CompareSemaphore, 21, 21) |
553410e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
553510e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
553610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
553710e230b6Smaya
553810e230b6Smaya   dw[1] =
553910e230b6Smaya      __gen_uint(values->CompareDataDword, 0, 31);
554010e230b6Smaya}
554110e230b6Smaya
554210e230b6Smaya#define GEN7_MI_FLUSH_length                   1
554310e230b6Smaya#define GEN7_MI_FLUSH_length_bias              1
554410e230b6Smaya#define GEN7_MI_FLUSH_header                    \
554510e230b6Smaya   .MICommandOpcode                     =      4,  \
554610e230b6Smaya   .CommandType                         =      0
554710e230b6Smaya
554810e230b6Smayastruct GEN7_MI_FLUSH {
554910e230b6Smaya   uint32_t                             StateInstructionCacheInvalidate;
555010e230b6Smaya#define DontInvalidate                           0
555110e230b6Smaya#define Invalidate                               1
555210e230b6Smaya   uint32_t                             RenderCacheFlushInhibit;
555310e230b6Smaya#define Flush                                    0
555410e230b6Smaya#define DontFlush                                1
555510e230b6Smaya   uint32_t                             GlobalSnapshotCountReset;
555610e230b6Smaya#define DontReset                                0
555710e230b6Smaya#define Reset                                    1
555810e230b6Smaya   bool                                 GenericMediaStateClear;
555910e230b6Smaya   bool                                 IndirectStatePointersDisable;
556010e230b6Smaya   uint32_t                             MICommandOpcode;
556110e230b6Smaya   uint32_t                             CommandType;
556210e230b6Smaya};
556310e230b6Smaya
556410e230b6Smayastatic inline void
556510e230b6SmayaGEN7_MI_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
556610e230b6Smaya                   __attribute__((unused)) void * restrict dst,
556710e230b6Smaya                   __attribute__((unused)) const struct GEN7_MI_FLUSH * restrict values)
556810e230b6Smaya{
556910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
557010e230b6Smaya
557110e230b6Smaya   dw[0] =
557210e230b6Smaya      __gen_uint(values->StateInstructionCacheInvalidate, 1, 1) |
557310e230b6Smaya      __gen_uint(values->RenderCacheFlushInhibit, 2, 2) |
557410e230b6Smaya      __gen_uint(values->GlobalSnapshotCountReset, 3, 3) |
557510e230b6Smaya      __gen_uint(values->GenericMediaStateClear, 4, 4) |
557610e230b6Smaya      __gen_uint(values->IndirectStatePointersDisable, 5, 5) |
557710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
557810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
557910e230b6Smaya}
558010e230b6Smaya
558110e230b6Smaya#define GEN7_MI_LOAD_REGISTER_IMM_length       3
558210e230b6Smaya#define GEN7_MI_LOAD_REGISTER_IMM_length_bias      2
558310e230b6Smaya#define GEN7_MI_LOAD_REGISTER_IMM_header        \
558410e230b6Smaya   .DWordLength                         =      1,  \
558510e230b6Smaya   .MICommandOpcode                     =     34,  \
558610e230b6Smaya   .CommandType                         =      0
558710e230b6Smaya
558810e230b6Smayastruct GEN7_MI_LOAD_REGISTER_IMM {
558910e230b6Smaya   uint32_t                             DWordLength;
559010e230b6Smaya   uint32_t                             ByteWriteDisables;
559110e230b6Smaya   uint32_t                             MICommandOpcode;
559210e230b6Smaya   uint32_t                             CommandType;
559310e230b6Smaya   uint64_t                             RegisterOffset;
559410e230b6Smaya   uint32_t                             DataDWord;
559510e230b6Smaya   /* variable length fields follow */
559610e230b6Smaya};
559710e230b6Smaya
559810e230b6Smayastatic inline void
559910e230b6SmayaGEN7_MI_LOAD_REGISTER_IMM_pack(__attribute__((unused)) __gen_user_data *data,
560010e230b6Smaya                               __attribute__((unused)) void * restrict dst,
560110e230b6Smaya                               __attribute__((unused)) const struct GEN7_MI_LOAD_REGISTER_IMM * restrict values)
560210e230b6Smaya{
560310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
560410e230b6Smaya
560510e230b6Smaya   dw[0] =
560610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
560710e230b6Smaya      __gen_uint(values->ByteWriteDisables, 8, 11) |
560810e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
560910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
561010e230b6Smaya
561110e230b6Smaya   dw[1] =
561210e230b6Smaya      __gen_offset(values->RegisterOffset, 2, 22);
561310e230b6Smaya
561410e230b6Smaya   dw[2] =
561510e230b6Smaya      __gen_uint(values->DataDWord, 0, 31);
561610e230b6Smaya}
561710e230b6Smaya
561810e230b6Smaya#define GEN7_MI_LOAD_REGISTER_MEM_length       3
561910e230b6Smaya#define GEN7_MI_LOAD_REGISTER_MEM_length_bias      2
562010e230b6Smaya#define GEN7_MI_LOAD_REGISTER_MEM_header        \
562110e230b6Smaya   .DWordLength                         =      1,  \
562210e230b6Smaya   .MICommandOpcode                     =     41,  \
562310e230b6Smaya   .CommandType                         =      0
562410e230b6Smaya
562510e230b6Smayastruct GEN7_MI_LOAD_REGISTER_MEM {
562610e230b6Smaya   uint32_t                             DWordLength;
562710e230b6Smaya   bool                                 AsyncModeEnable;
562810e230b6Smaya   bool                                 UseGlobalGTT;
562910e230b6Smaya   uint32_t                             MICommandOpcode;
563010e230b6Smaya   uint32_t                             CommandType;
563110e230b6Smaya   uint64_t                             RegisterAddress;
563210e230b6Smaya   __gen_address_type                   MemoryAddress;
563310e230b6Smaya};
563410e230b6Smaya
563510e230b6Smayastatic inline void
563610e230b6SmayaGEN7_MI_LOAD_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
563710e230b6Smaya                               __attribute__((unused)) void * restrict dst,
563810e230b6Smaya                               __attribute__((unused)) const struct GEN7_MI_LOAD_REGISTER_MEM * restrict values)
563910e230b6Smaya{
564010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
564110e230b6Smaya
564210e230b6Smaya   dw[0] =
564310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
564410e230b6Smaya      __gen_uint(values->AsyncModeEnable, 21, 21) |
564510e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
564610e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
564710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
564810e230b6Smaya
564910e230b6Smaya   dw[1] =
565010e230b6Smaya      __gen_offset(values->RegisterAddress, 2, 22);
565110e230b6Smaya
565210e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->MemoryAddress, 0);
565310e230b6Smaya}
565410e230b6Smaya
565510e230b6Smaya#define GEN7_MI_NOOP_length                    1
565610e230b6Smaya#define GEN7_MI_NOOP_length_bias               1
565710e230b6Smaya#define GEN7_MI_NOOP_header                     \
565810e230b6Smaya   .MICommandOpcode                     =      0,  \
565910e230b6Smaya   .CommandType                         =      0
566010e230b6Smaya
566110e230b6Smayastruct GEN7_MI_NOOP {
566210e230b6Smaya   uint32_t                             IdentificationNumber;
566310e230b6Smaya   bool                                 IdentificationNumberRegisterWriteEnable;
566410e230b6Smaya   uint32_t                             MICommandOpcode;
566510e230b6Smaya   uint32_t                             CommandType;
566610e230b6Smaya};
566710e230b6Smaya
566810e230b6Smayastatic inline void
566910e230b6SmayaGEN7_MI_NOOP_pack(__attribute__((unused)) __gen_user_data *data,
567010e230b6Smaya                  __attribute__((unused)) void * restrict dst,
567110e230b6Smaya                  __attribute__((unused)) const struct GEN7_MI_NOOP * restrict values)
567210e230b6Smaya{
567310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
567410e230b6Smaya
567510e230b6Smaya   dw[0] =
567610e230b6Smaya      __gen_uint(values->IdentificationNumber, 0, 21) |
567710e230b6Smaya      __gen_uint(values->IdentificationNumberRegisterWriteEnable, 22, 22) |
567810e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
567910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
568010e230b6Smaya}
568110e230b6Smaya
568210e230b6Smaya#define GEN7_MI_PREDICATE_length               1
568310e230b6Smaya#define GEN7_MI_PREDICATE_length_bias          1
568410e230b6Smaya#define GEN7_MI_PREDICATE_header                \
568510e230b6Smaya   .MICommandOpcode                     =     12,  \
568610e230b6Smaya   .CommandType                         =      0
568710e230b6Smaya
568810e230b6Smayastruct GEN7_MI_PREDICATE {
568910e230b6Smaya   uint32_t                             CompareOperation;
569010e230b6Smaya#define COMPARE_TRUE                             0
569110e230b6Smaya#define COMPARE_FALSE                            1
569210e230b6Smaya#define COMPARE_SRCS_EQUAL                       2
569310e230b6Smaya#define COMPARE_DELTAS_EQUAL                     3
569410e230b6Smaya   uint32_t                             CombineOperation;
569510e230b6Smaya#define COMBINE_SET                              0
569610e230b6Smaya#define COMBINE_AND                              1
569710e230b6Smaya#define COMBINE_OR                               2
569810e230b6Smaya#define COMBINE_XOR                              3
569910e230b6Smaya   uint32_t                             LoadOperation;
570010e230b6Smaya#define LOAD_KEEP                                0
570110e230b6Smaya#define LOAD_LOAD                                2
570210e230b6Smaya#define LOAD_LOADINV                             3
570310e230b6Smaya   uint32_t                             MICommandOpcode;
570410e230b6Smaya   uint32_t                             CommandType;
570510e230b6Smaya};
570610e230b6Smaya
570710e230b6Smayastatic inline void
570810e230b6SmayaGEN7_MI_PREDICATE_pack(__attribute__((unused)) __gen_user_data *data,
570910e230b6Smaya                       __attribute__((unused)) void * restrict dst,
571010e230b6Smaya                       __attribute__((unused)) const struct GEN7_MI_PREDICATE * restrict values)
571110e230b6Smaya{
571210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
571310e230b6Smaya
571410e230b6Smaya   dw[0] =
571510e230b6Smaya      __gen_uint(values->CompareOperation, 0, 1) |
571610e230b6Smaya      __gen_uint(values->CombineOperation, 3, 4) |
571710e230b6Smaya      __gen_uint(values->LoadOperation, 6, 7) |
571810e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
571910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
572010e230b6Smaya}
572110e230b6Smaya
572210e230b6Smaya#define GEN7_MI_REPORT_HEAD_length             1
572310e230b6Smaya#define GEN7_MI_REPORT_HEAD_length_bias        1
572410e230b6Smaya#define GEN7_MI_REPORT_HEAD_header              \
572510e230b6Smaya   .MICommandOpcode                     =      7,  \
572610e230b6Smaya   .CommandType                         =      0
572710e230b6Smaya
572810e230b6Smayastruct GEN7_MI_REPORT_HEAD {
572910e230b6Smaya   uint32_t                             MICommandOpcode;
573010e230b6Smaya   uint32_t                             CommandType;
573110e230b6Smaya};
573210e230b6Smaya
573310e230b6Smayastatic inline void
573410e230b6SmayaGEN7_MI_REPORT_HEAD_pack(__attribute__((unused)) __gen_user_data *data,
573510e230b6Smaya                         __attribute__((unused)) void * restrict dst,
573610e230b6Smaya                         __attribute__((unused)) const struct GEN7_MI_REPORT_HEAD * restrict values)
573710e230b6Smaya{
573810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
573910e230b6Smaya
574010e230b6Smaya   dw[0] =
574110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
574210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
574310e230b6Smaya}
574410e230b6Smaya
574510e230b6Smaya#define GEN7_MI_REPORT_PERF_COUNT_length       3
574610e230b6Smaya#define GEN7_MI_REPORT_PERF_COUNT_length_bias      2
574710e230b6Smaya#define GEN7_MI_REPORT_PERF_COUNT_header        \
574810e230b6Smaya   .DWordLength                         =      1,  \
574910e230b6Smaya   .MICommandOpcode                     =     40,  \
575010e230b6Smaya   .CommandType                         =      0
575110e230b6Smaya
575210e230b6Smayastruct GEN7_MI_REPORT_PERF_COUNT {
575310e230b6Smaya   uint32_t                             DWordLength;
575410e230b6Smaya   uint32_t                             MICommandOpcode;
575510e230b6Smaya   uint32_t                             CommandType;
575610e230b6Smaya   bool                                 UseGlobalGTT;
575710e230b6Smaya   __gen_address_type                   MemoryAddress;
575810e230b6Smaya   uint32_t                             ReportID;
575910e230b6Smaya};
576010e230b6Smaya
576110e230b6Smayastatic inline void
576210e230b6SmayaGEN7_MI_REPORT_PERF_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
576310e230b6Smaya                               __attribute__((unused)) void * restrict dst,
576410e230b6Smaya                               __attribute__((unused)) const struct GEN7_MI_REPORT_PERF_COUNT * restrict values)
576510e230b6Smaya{
576610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
576710e230b6Smaya
576810e230b6Smaya   dw[0] =
576910e230b6Smaya      __gen_uint(values->DWordLength, 0, 5) |
577010e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
577110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
577210e230b6Smaya
577310e230b6Smaya   const uint32_t v1 =
577410e230b6Smaya      __gen_uint(values->UseGlobalGTT, 0, 0);
577510e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->MemoryAddress, v1);
577610e230b6Smaya
577710e230b6Smaya   dw[2] =
577810e230b6Smaya      __gen_uint(values->ReportID, 0, 31);
577910e230b6Smaya}
578010e230b6Smaya
578110e230b6Smaya#define GEN7_MI_SEMAPHORE_MBOX_length          3
578210e230b6Smaya#define GEN7_MI_SEMAPHORE_MBOX_length_bias      2
578310e230b6Smaya#define GEN7_MI_SEMAPHORE_MBOX_header           \
578410e230b6Smaya   .DWordLength                         =      1,  \
578510e230b6Smaya   .MICommandOpcode                     =     22,  \
578610e230b6Smaya   .CommandType                         =      0
578710e230b6Smaya
578810e230b6Smayastruct GEN7_MI_SEMAPHORE_MBOX {
578910e230b6Smaya   uint32_t                             DWordLength;
579010e230b6Smaya   uint32_t                             RegisterSelect;
579110e230b6Smaya#define RVSYNC                                   0
579210e230b6Smaya#define RBSYNC                                   2
579310e230b6Smaya#define UseGeneralRegisterSelect                 3
579410e230b6Smaya   uint32_t                             MICommandOpcode;
579510e230b6Smaya   uint32_t                             CommandType;
579610e230b6Smaya   uint32_t                             SemaphoreDataDword;
579710e230b6Smaya};
579810e230b6Smaya
579910e230b6Smayastatic inline void
580010e230b6SmayaGEN7_MI_SEMAPHORE_MBOX_pack(__attribute__((unused)) __gen_user_data *data,
580110e230b6Smaya                            __attribute__((unused)) void * restrict dst,
580210e230b6Smaya                            __attribute__((unused)) const struct GEN7_MI_SEMAPHORE_MBOX * restrict values)
580310e230b6Smaya{
580410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
580510e230b6Smaya
580610e230b6Smaya   dw[0] =
580710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
580810e230b6Smaya      __gen_uint(values->RegisterSelect, 16, 17) |
580910e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
581010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
581110e230b6Smaya
581210e230b6Smaya   dw[1] =
581310e230b6Smaya      __gen_uint(values->SemaphoreDataDword, 0, 31);
581410e230b6Smaya
581510e230b6Smaya   dw[2] = 0;
581610e230b6Smaya}
581710e230b6Smaya
581810e230b6Smaya#define GEN7_MI_SET_CONTEXT_length             2
581910e230b6Smaya#define GEN7_MI_SET_CONTEXT_length_bias        2
582010e230b6Smaya#define GEN7_MI_SET_CONTEXT_header              \
582110e230b6Smaya   .DWordLength                         =      0,  \
582210e230b6Smaya   .MICommandOpcode                     =     24,  \
582310e230b6Smaya   .CommandType                         =      0
582410e230b6Smaya
582510e230b6Smayastruct GEN7_MI_SET_CONTEXT {
582610e230b6Smaya   uint32_t                             DWordLength;
582710e230b6Smaya   uint32_t                             MICommandOpcode;
582810e230b6Smaya   uint32_t                             CommandType;
582910e230b6Smaya   uint32_t                             RestoreInhibit;
583010e230b6Smaya   uint32_t                             ForceRestore;
583110e230b6Smaya   bool                                 ExtendedStateRestoreEnable;
583210e230b6Smaya   bool                                 ExtendedStateSaveEnable;
583310e230b6Smaya   uint32_t                             ReservedMustbe1;
583410e230b6Smaya   __gen_address_type                   LogicalContextAddress;
583510e230b6Smaya};
583610e230b6Smaya
583710e230b6Smayastatic inline void
583810e230b6SmayaGEN7_MI_SET_CONTEXT_pack(__attribute__((unused)) __gen_user_data *data,
583910e230b6Smaya                         __attribute__((unused)) void * restrict dst,
584010e230b6Smaya                         __attribute__((unused)) const struct GEN7_MI_SET_CONTEXT * restrict values)
584110e230b6Smaya{
584210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
584310e230b6Smaya
584410e230b6Smaya   dw[0] =
584510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
584610e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
584710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
584810e230b6Smaya
584910e230b6Smaya   const uint32_t v1 =
585010e230b6Smaya      __gen_uint(values->RestoreInhibit, 0, 0) |
585110e230b6Smaya      __gen_uint(values->ForceRestore, 1, 1) |
585210e230b6Smaya      __gen_uint(values->ExtendedStateRestoreEnable, 2, 2) |
585310e230b6Smaya      __gen_uint(values->ExtendedStateSaveEnable, 3, 3) |
585410e230b6Smaya      __gen_uint(values->ReservedMustbe1, 8, 8);
585510e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->LogicalContextAddress, v1);
585610e230b6Smaya}
585710e230b6Smaya
585810e230b6Smaya#define GEN7_MI_STORE_DATA_IMM_length          4
585910e230b6Smaya#define GEN7_MI_STORE_DATA_IMM_length_bias      2
586010e230b6Smaya#define GEN7_MI_STORE_DATA_IMM_header           \
586110e230b6Smaya   .DWordLength                         =      2,  \
586210e230b6Smaya   .MICommandOpcode                     =     32,  \
586310e230b6Smaya   .CommandType                         =      0
586410e230b6Smaya
586510e230b6Smayastruct GEN7_MI_STORE_DATA_IMM {
586610e230b6Smaya   uint32_t                             DWordLength;
586710e230b6Smaya   bool                                 UseGlobalGTT;
586810e230b6Smaya   uint32_t                             MICommandOpcode;
586910e230b6Smaya   uint32_t                             CommandType;
587010e230b6Smaya   uint32_t                             CoreModeEnable;
587110e230b6Smaya   __gen_address_type                   Address;
587210e230b6Smaya   uint64_t                             ImmediateData;
587310e230b6Smaya};
587410e230b6Smaya
587510e230b6Smayastatic inline void
587610e230b6SmayaGEN7_MI_STORE_DATA_IMM_pack(__attribute__((unused)) __gen_user_data *data,
587710e230b6Smaya                            __attribute__((unused)) void * restrict dst,
587810e230b6Smaya                            __attribute__((unused)) const struct GEN7_MI_STORE_DATA_IMM * restrict values)
587910e230b6Smaya{
588010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
588110e230b6Smaya
588210e230b6Smaya   dw[0] =
588310e230b6Smaya      __gen_uint(values->DWordLength, 0, 5) |
588410e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
588510e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
588610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
588710e230b6Smaya
588810e230b6Smaya   dw[1] = 0;
588910e230b6Smaya
589010e230b6Smaya   const uint32_t v2 =
589110e230b6Smaya      __gen_uint(values->CoreModeEnable, 0, 0);
589210e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->Address, v2);
589310e230b6Smaya
589410e230b6Smaya   const uint64_t v3 =
589510e230b6Smaya      __gen_uint(values->ImmediateData, 0, 63);
589610e230b6Smaya   dw[3] = v3;
589710e230b6Smaya   dw[4] = v3 >> 32;
589810e230b6Smaya}
589910e230b6Smaya
590010e230b6Smaya#define GEN7_MI_STORE_DATA_INDEX_length        3
590110e230b6Smaya#define GEN7_MI_STORE_DATA_INDEX_length_bias      2
590210e230b6Smaya#define GEN7_MI_STORE_DATA_INDEX_header         \
590310e230b6Smaya   .DWordLength                         =      1,  \
590410e230b6Smaya   .MICommandOpcode                     =     33,  \
590510e230b6Smaya   .CommandType                         =      0
590610e230b6Smaya
590710e230b6Smayastruct GEN7_MI_STORE_DATA_INDEX {
590810e230b6Smaya   uint32_t                             DWordLength;
590910e230b6Smaya   uint32_t                             MICommandOpcode;
591010e230b6Smaya   uint32_t                             CommandType;
591110e230b6Smaya   uint32_t                             Offset;
591210e230b6Smaya   uint32_t                             DataDWord0;
591310e230b6Smaya   uint32_t                             DataDWord1;
591410e230b6Smaya};
591510e230b6Smaya
591610e230b6Smayastatic inline void
591710e230b6SmayaGEN7_MI_STORE_DATA_INDEX_pack(__attribute__((unused)) __gen_user_data *data,
591810e230b6Smaya                              __attribute__((unused)) void * restrict dst,
591910e230b6Smaya                              __attribute__((unused)) const struct GEN7_MI_STORE_DATA_INDEX * restrict values)
592010e230b6Smaya{
592110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
592210e230b6Smaya
592310e230b6Smaya   dw[0] =
592410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
592510e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
592610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
592710e230b6Smaya
592810e230b6Smaya   dw[1] =
592910e230b6Smaya      __gen_uint(values->Offset, 2, 11);
593010e230b6Smaya
593110e230b6Smaya   dw[2] =
593210e230b6Smaya      __gen_uint(values->DataDWord0, 0, 31);
593310e230b6Smaya}
593410e230b6Smaya
593510e230b6Smaya#define GEN7_MI_STORE_REGISTER_MEM_length      3
593610e230b6Smaya#define GEN7_MI_STORE_REGISTER_MEM_length_bias      2
593710e230b6Smaya#define GEN7_MI_STORE_REGISTER_MEM_header       \
593810e230b6Smaya   .DWordLength                         =      1,  \
593910e230b6Smaya   .MICommandOpcode                     =     36,  \
594010e230b6Smaya   .CommandType                         =      0
594110e230b6Smaya
594210e230b6Smayastruct GEN7_MI_STORE_REGISTER_MEM {
594310e230b6Smaya   uint32_t                             DWordLength;
594410e230b6Smaya   bool                                 UseGlobalGTT;
594510e230b6Smaya   uint32_t                             MICommandOpcode;
594610e230b6Smaya   uint32_t                             CommandType;
594710e230b6Smaya   uint64_t                             RegisterAddress;
594810e230b6Smaya   __gen_address_type                   MemoryAddress;
594910e230b6Smaya};
595010e230b6Smaya
595110e230b6Smayastatic inline void
595210e230b6SmayaGEN7_MI_STORE_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
595310e230b6Smaya                                __attribute__((unused)) void * restrict dst,
595410e230b6Smaya                                __attribute__((unused)) const struct GEN7_MI_STORE_REGISTER_MEM * restrict values)
595510e230b6Smaya{
595610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
595710e230b6Smaya
595810e230b6Smaya   dw[0] =
595910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
596010e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
596110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
596210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
596310e230b6Smaya
596410e230b6Smaya   dw[1] =
596510e230b6Smaya      __gen_offset(values->RegisterAddress, 2, 22);
596610e230b6Smaya
596710e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->MemoryAddress, 0);
596810e230b6Smaya}
596910e230b6Smaya
597010e230b6Smaya#define GEN7_MI_SUSPEND_FLUSH_length           1
597110e230b6Smaya#define GEN7_MI_SUSPEND_FLUSH_length_bias      1
597210e230b6Smaya#define GEN7_MI_SUSPEND_FLUSH_header            \
597310e230b6Smaya   .MICommandOpcode                     =     11,  \
597410e230b6Smaya   .CommandType                         =      0
597510e230b6Smaya
597610e230b6Smayastruct GEN7_MI_SUSPEND_FLUSH {
597710e230b6Smaya   bool                                 SuspendFlush;
597810e230b6Smaya   uint32_t                             MICommandOpcode;
597910e230b6Smaya   uint32_t                             CommandType;
598010e230b6Smaya};
598110e230b6Smaya
598210e230b6Smayastatic inline void
598310e230b6SmayaGEN7_MI_SUSPEND_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
598410e230b6Smaya                           __attribute__((unused)) void * restrict dst,
598510e230b6Smaya                           __attribute__((unused)) const struct GEN7_MI_SUSPEND_FLUSH * restrict values)
598610e230b6Smaya{
598710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
598810e230b6Smaya
598910e230b6Smaya   dw[0] =
599010e230b6Smaya      __gen_uint(values->SuspendFlush, 0, 0) |
599110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
599210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
599310e230b6Smaya}
599410e230b6Smaya
599510e230b6Smaya#define GEN7_MI_TOPOLOGY_FILTER_length         1
599610e230b6Smaya#define GEN7_MI_TOPOLOGY_FILTER_length_bias      1
599710e230b6Smaya#define GEN7_MI_TOPOLOGY_FILTER_header          \
599810e230b6Smaya   .MICommandOpcode                     =     13,  \
599910e230b6Smaya   .CommandType                         =      0
600010e230b6Smaya
600110e230b6Smayastruct GEN7_MI_TOPOLOGY_FILTER {
600210e230b6Smaya   enum GEN7_3D_Prim_Topo_Type          TopologyFilterValue;
600310e230b6Smaya   uint32_t                             MICommandOpcode;
600410e230b6Smaya   uint32_t                             CommandType;
600510e230b6Smaya};
600610e230b6Smaya
600710e230b6Smayastatic inline void
600810e230b6SmayaGEN7_MI_TOPOLOGY_FILTER_pack(__attribute__((unused)) __gen_user_data *data,
600910e230b6Smaya                             __attribute__((unused)) void * restrict dst,
601010e230b6Smaya                             __attribute__((unused)) const struct GEN7_MI_TOPOLOGY_FILTER * restrict values)
601110e230b6Smaya{
601210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
601310e230b6Smaya
601410e230b6Smaya   dw[0] =
601510e230b6Smaya      __gen_uint(values->TopologyFilterValue, 0, 5) |
601610e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
601710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
601810e230b6Smaya}
601910e230b6Smaya
602010e230b6Smaya#define GEN7_MI_URB_CLEAR_length               2
602110e230b6Smaya#define GEN7_MI_URB_CLEAR_length_bias          2
602210e230b6Smaya#define GEN7_MI_URB_CLEAR_header                \
602310e230b6Smaya   .DWordLength                         =      0,  \
602410e230b6Smaya   .MICommandOpcode                     =     25,  \
602510e230b6Smaya   .CommandType                         =      0
602610e230b6Smaya
602710e230b6Smayastruct GEN7_MI_URB_CLEAR {
602810e230b6Smaya   uint32_t                             DWordLength;
602910e230b6Smaya   uint32_t                             MICommandOpcode;
603010e230b6Smaya   uint32_t                             CommandType;
603110e230b6Smaya   uint64_t                             URBAddress;
603210e230b6Smaya   uint32_t                             URBClearLength;
603310e230b6Smaya};
603410e230b6Smaya
603510e230b6Smayastatic inline void
603610e230b6SmayaGEN7_MI_URB_CLEAR_pack(__attribute__((unused)) __gen_user_data *data,
603710e230b6Smaya                       __attribute__((unused)) void * restrict dst,
603810e230b6Smaya                       __attribute__((unused)) const struct GEN7_MI_URB_CLEAR * restrict values)
603910e230b6Smaya{
604010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
604110e230b6Smaya
604210e230b6Smaya   dw[0] =
604310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
604410e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
604510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
604610e230b6Smaya
604710e230b6Smaya   dw[1] =
604810e230b6Smaya      __gen_offset(values->URBAddress, 0, 13) |
604910e230b6Smaya      __gen_uint(values->URBClearLength, 16, 28);
605010e230b6Smaya}
605110e230b6Smaya
605210e230b6Smaya#define GEN7_MI_USER_INTERRUPT_length          1
605310e230b6Smaya#define GEN7_MI_USER_INTERRUPT_length_bias      1
605410e230b6Smaya#define GEN7_MI_USER_INTERRUPT_header           \
605510e230b6Smaya   .MICommandOpcode                     =      2,  \
605610e230b6Smaya   .CommandType                         =      0
605710e230b6Smaya
605810e230b6Smayastruct GEN7_MI_USER_INTERRUPT {
605910e230b6Smaya   uint32_t                             MICommandOpcode;
606010e230b6Smaya   uint32_t                             CommandType;
606110e230b6Smaya};
606210e230b6Smaya
606310e230b6Smayastatic inline void
606410e230b6SmayaGEN7_MI_USER_INTERRUPT_pack(__attribute__((unused)) __gen_user_data *data,
606510e230b6Smaya                            __attribute__((unused)) void * restrict dst,
606610e230b6Smaya                            __attribute__((unused)) const struct GEN7_MI_USER_INTERRUPT * restrict values)
606710e230b6Smaya{
606810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
606910e230b6Smaya
607010e230b6Smaya   dw[0] =
607110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
607210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
607310e230b6Smaya}
607410e230b6Smaya
607510e230b6Smaya#define GEN7_MI_WAIT_FOR_EVENT_length          1
607610e230b6Smaya#define GEN7_MI_WAIT_FOR_EVENT_length_bias      1
607710e230b6Smaya#define GEN7_MI_WAIT_FOR_EVENT_header           \
607810e230b6Smaya   .MICommandOpcode                     =      3,  \
607910e230b6Smaya   .CommandType                         =      0
608010e230b6Smaya
608110e230b6Smayastruct GEN7_MI_WAIT_FOR_EVENT {
608210e230b6Smaya   bool                                 DisplayPipeAScanLineWaitEnable;
608310e230b6Smaya   bool                                 DisplayPlaneAFlipPendingWaitEnable;
608410e230b6Smaya   bool                                 DisplaySpriteAFlipPendingWaitEnable;
608510e230b6Smaya   bool                                 DisplayPipeAVerticalBlankWaitEnable;
608610e230b6Smaya   bool                                 DisplayPipeAHorizontalBlankWaitEnable;
608710e230b6Smaya   bool                                 DisplayPipeBScanLineWaitEnable;
608810e230b6Smaya   bool                                 DisplayPlaneBFlipPendingWaitEnable;
608910e230b6Smaya   bool                                 DisplaySpriteBFlipPendingWaitEnable;
609010e230b6Smaya   bool                                 DisplayPipeBVerticalBlankWaitEnable;
609110e230b6Smaya   bool                                 DisplayPipeBHorizontalBlankWaitEnable;
609210e230b6Smaya   bool                                 DisplayPipeCScanLineWaitEnable;
609310e230b6Smaya   bool                                 DisplayPlaneCFlipPendingWaitEnable;
609410e230b6Smaya   uint32_t                             ConditionCodeWaitSelect;
609510e230b6Smaya#define Notenabled                               0
609610e230b6Smaya   bool                                 DisplaySpriteCFlipPendingWaitEnable;
609710e230b6Smaya   bool                                 DisplayPipeCVerticalBlankWaitEnable;
609810e230b6Smaya   bool                                 DisplayPipeCHorizontalBlankWaitEnable;
609910e230b6Smaya   uint32_t                             MICommandOpcode;
610010e230b6Smaya   uint32_t                             CommandType;
610110e230b6Smaya};
610210e230b6Smaya
610310e230b6Smayastatic inline void
610410e230b6SmayaGEN7_MI_WAIT_FOR_EVENT_pack(__attribute__((unused)) __gen_user_data *data,
610510e230b6Smaya                            __attribute__((unused)) void * restrict dst,
610610e230b6Smaya                            __attribute__((unused)) const struct GEN7_MI_WAIT_FOR_EVENT * restrict values)
610710e230b6Smaya{
610810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
610910e230b6Smaya
611010e230b6Smaya   dw[0] =
611110e230b6Smaya      __gen_uint(values->DisplayPipeAScanLineWaitEnable, 0, 0) |
611210e230b6Smaya      __gen_uint(values->DisplayPlaneAFlipPendingWaitEnable, 1, 1) |
611310e230b6Smaya      __gen_uint(values->DisplaySpriteAFlipPendingWaitEnable, 2, 2) |
611410e230b6Smaya      __gen_uint(values->DisplayPipeAVerticalBlankWaitEnable, 3, 3) |
611510e230b6Smaya      __gen_uint(values->DisplayPipeAHorizontalBlankWaitEnable, 5, 5) |
611610e230b6Smaya      __gen_uint(values->DisplayPipeBScanLineWaitEnable, 8, 8) |
611710e230b6Smaya      __gen_uint(values->DisplayPlaneBFlipPendingWaitEnable, 9, 9) |
611810e230b6Smaya      __gen_uint(values->DisplaySpriteBFlipPendingWaitEnable, 10, 10) |
611910e230b6Smaya      __gen_uint(values->DisplayPipeBVerticalBlankWaitEnable, 11, 11) |
612010e230b6Smaya      __gen_uint(values->DisplayPipeBHorizontalBlankWaitEnable, 13, 13) |
612110e230b6Smaya      __gen_uint(values->DisplayPipeCScanLineWaitEnable, 14, 14) |
612210e230b6Smaya      __gen_uint(values->DisplayPlaneCFlipPendingWaitEnable, 15, 15) |
612310e230b6Smaya      __gen_uint(values->ConditionCodeWaitSelect, 16, 19) |
612410e230b6Smaya      __gen_uint(values->DisplaySpriteCFlipPendingWaitEnable, 20, 20) |
612510e230b6Smaya      __gen_uint(values->DisplayPipeCVerticalBlankWaitEnable, 21, 21) |
612610e230b6Smaya      __gen_uint(values->DisplayPipeCHorizontalBlankWaitEnable, 22, 22) |
612710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
612810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
612910e230b6Smaya}
613010e230b6Smaya
613110e230b6Smaya#define GEN7_PIPELINE_SELECT_length            1
613210e230b6Smaya#define GEN7_PIPELINE_SELECT_length_bias       1
613310e230b6Smaya#define GEN7_PIPELINE_SELECT_header             \
613410e230b6Smaya   ._3DCommandSubOpcode                 =      4,  \
613510e230b6Smaya   ._3DCommandOpcode                    =      1,  \
613610e230b6Smaya   .CommandSubType                      =      1,  \
613710e230b6Smaya   .CommandType                         =      3
613810e230b6Smaya
613910e230b6Smayastruct GEN7_PIPELINE_SELECT {
614010e230b6Smaya   uint32_t                             PipelineSelection;
614110e230b6Smaya#define _3D                                      0
614210e230b6Smaya#define Media                                    1
614310e230b6Smaya#define GPGPU                                    2
614410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
614510e230b6Smaya   uint32_t                             _3DCommandOpcode;
614610e230b6Smaya   uint32_t                             CommandSubType;
614710e230b6Smaya   uint32_t                             CommandType;
614810e230b6Smaya};
614910e230b6Smaya
615010e230b6Smayastatic inline void
615110e230b6SmayaGEN7_PIPELINE_SELECT_pack(__attribute__((unused)) __gen_user_data *data,
615210e230b6Smaya                          __attribute__((unused)) void * restrict dst,
615310e230b6Smaya                          __attribute__((unused)) const struct GEN7_PIPELINE_SELECT * restrict values)
615410e230b6Smaya{
615510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
615610e230b6Smaya
615710e230b6Smaya   dw[0] =
615810e230b6Smaya      __gen_uint(values->PipelineSelection, 0, 1) |
615910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
616010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
616110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
616210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
616310e230b6Smaya}
616410e230b6Smaya
616510e230b6Smaya#define GEN7_PIPE_CONTROL_length               5
616610e230b6Smaya#define GEN7_PIPE_CONTROL_length_bias          2
616710e230b6Smaya#define GEN7_PIPE_CONTROL_header                \
616810e230b6Smaya   .DWordLength                         =      3,  \
616910e230b6Smaya   ._3DCommandSubOpcode                 =      0,  \
617010e230b6Smaya   ._3DCommandOpcode                    =      2,  \
617110e230b6Smaya   .CommandSubType                      =      3,  \
617210e230b6Smaya   .CommandType                         =      3
617310e230b6Smaya
617410e230b6Smayastruct GEN7_PIPE_CONTROL {
617510e230b6Smaya   uint32_t                             DWordLength;
617610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
617710e230b6Smaya   uint32_t                             _3DCommandOpcode;
617810e230b6Smaya   uint32_t                             CommandSubType;
617910e230b6Smaya   uint32_t                             CommandType;
618010e230b6Smaya   bool                                 DepthCacheFlushEnable;
618110e230b6Smaya   bool                                 StallAtPixelScoreboard;
618210e230b6Smaya   bool                                 StateCacheInvalidationEnable;
618310e230b6Smaya   bool                                 ConstantCacheInvalidationEnable;
618410e230b6Smaya   bool                                 VFCacheInvalidationEnable;
618510e230b6Smaya   bool                                 DCFlushEnable;
618610e230b6Smaya   bool                                 PipeControlFlushEnable;
618710e230b6Smaya   bool                                 NotifyEnable;
618810e230b6Smaya   bool                                 IndirectStatePointersDisable;
618910e230b6Smaya   bool                                 TextureCacheInvalidationEnable;
619010e230b6Smaya   bool                                 InstructionCacheInvalidateEnable;
619110e230b6Smaya   bool                                 RenderTargetCacheFlushEnable;
619210e230b6Smaya   bool                                 DepthStallEnable;
619310e230b6Smaya   uint32_t                             PostSyncOperation;
619410e230b6Smaya#define NoWrite                                  0
619510e230b6Smaya#define WriteImmediateData                       1
619610e230b6Smaya#define WritePSDepthCount                        2
619710e230b6Smaya#define WriteTimestamp                           3
619810e230b6Smaya   bool                                 GenericMediaStateClear;
619910e230b6Smaya   bool                                 TLBInvalidate;
620010e230b6Smaya   bool                                 GlobalSnapshotCountReset;
620110e230b6Smaya   bool                                 CommandStreamerStallEnable;
620210e230b6Smaya   uint32_t                             StoreDataIndex;
620310e230b6Smaya   uint32_t                             LRIPostSyncOperation;
620410e230b6Smaya#define NoLRIOperation                           0
620510e230b6Smaya#define MMIOWriteImmediateData                   1
620610e230b6Smaya   uint32_t                             DestinationAddressType;
620710e230b6Smaya#define DAT_PPGTT                                0
620810e230b6Smaya#define DAT_GGTT                                 1
620910e230b6Smaya   __gen_address_type                   Address;
621010e230b6Smaya   uint64_t                             ImmediateData;
621110e230b6Smaya};
621210e230b6Smaya
621310e230b6Smayastatic inline void
621410e230b6SmayaGEN7_PIPE_CONTROL_pack(__attribute__((unused)) __gen_user_data *data,
621510e230b6Smaya                       __attribute__((unused)) void * restrict dst,
621610e230b6Smaya                       __attribute__((unused)) const struct GEN7_PIPE_CONTROL * restrict values)
621710e230b6Smaya{
621810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
621910e230b6Smaya
622010e230b6Smaya   dw[0] =
622110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
622210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
622310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
622410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
622510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
622610e230b6Smaya
622710e230b6Smaya   dw[1] =
622810e230b6Smaya      __gen_uint(values->DepthCacheFlushEnable, 0, 0) |
622910e230b6Smaya      __gen_uint(values->StallAtPixelScoreboard, 1, 1) |
623010e230b6Smaya      __gen_uint(values->StateCacheInvalidationEnable, 2, 2) |
623110e230b6Smaya      __gen_uint(values->ConstantCacheInvalidationEnable, 3, 3) |
623210e230b6Smaya      __gen_uint(values->VFCacheInvalidationEnable, 4, 4) |
623310e230b6Smaya      __gen_uint(values->DCFlushEnable, 5, 5) |
623410e230b6Smaya      __gen_uint(values->PipeControlFlushEnable, 7, 7) |
623510e230b6Smaya      __gen_uint(values->NotifyEnable, 8, 8) |
623610e230b6Smaya      __gen_uint(values->IndirectStatePointersDisable, 9, 9) |
623710e230b6Smaya      __gen_uint(values->TextureCacheInvalidationEnable, 10, 10) |
623810e230b6Smaya      __gen_uint(values->InstructionCacheInvalidateEnable, 11, 11) |
623910e230b6Smaya      __gen_uint(values->RenderTargetCacheFlushEnable, 12, 12) |
624010e230b6Smaya      __gen_uint(values->DepthStallEnable, 13, 13) |
624110e230b6Smaya      __gen_uint(values->PostSyncOperation, 14, 15) |
624210e230b6Smaya      __gen_uint(values->GenericMediaStateClear, 16, 16) |
624310e230b6Smaya      __gen_uint(values->TLBInvalidate, 18, 18) |
624410e230b6Smaya      __gen_uint(values->GlobalSnapshotCountReset, 19, 19) |
624510e230b6Smaya      __gen_uint(values->CommandStreamerStallEnable, 20, 20) |
624610e230b6Smaya      __gen_uint(values->StoreDataIndex, 21, 21) |
624710e230b6Smaya      __gen_uint(values->LRIPostSyncOperation, 23, 23) |
624810e230b6Smaya      __gen_uint(values->DestinationAddressType, 24, 24);
624910e230b6Smaya
625010e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->Address, 0);
625110e230b6Smaya
625210e230b6Smaya   const uint64_t v3 =
625310e230b6Smaya      __gen_uint(values->ImmediateData, 0, 63);
625410e230b6Smaya   dw[3] = v3;
625510e230b6Smaya   dw[4] = v3 >> 32;
625610e230b6Smaya}
625710e230b6Smaya
625810e230b6Smaya#define GEN7_STATE_BASE_ADDRESS_length        10
625910e230b6Smaya#define GEN7_STATE_BASE_ADDRESS_length_bias      2
626010e230b6Smaya#define GEN7_STATE_BASE_ADDRESS_header          \
626110e230b6Smaya   .DWordLength                         =      8,  \
626210e230b6Smaya   ._3DCommandSubOpcode                 =      1,  \
626310e230b6Smaya   ._3DCommandOpcode                    =      1,  \
626410e230b6Smaya   .CommandSubType                      =      0,  \
626510e230b6Smaya   .CommandType                         =      3
626610e230b6Smaya
626710e230b6Smayastruct GEN7_STATE_BASE_ADDRESS {
626810e230b6Smaya   uint32_t                             DWordLength;
626910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
627010e230b6Smaya   uint32_t                             _3DCommandOpcode;
627110e230b6Smaya   uint32_t                             CommandSubType;
627210e230b6Smaya   uint32_t                             CommandType;
627310e230b6Smaya   bool                                 GeneralStateBaseAddressModifyEnable;
627410e230b6Smaya   uint32_t                             StatelessDataPortAccessForceWriteThru;
627510e230b6Smaya   uint32_t                             StatelessDataPortAccessMOCS;
627610e230b6Smaya   uint32_t                             GeneralStateMOCS;
627710e230b6Smaya   __gen_address_type                   GeneralStateBaseAddress;
627810e230b6Smaya   bool                                 SurfaceStateBaseAddressModifyEnable;
627910e230b6Smaya   uint32_t                             SurfaceStateMOCS;
628010e230b6Smaya   __gen_address_type                   SurfaceStateBaseAddress;
628110e230b6Smaya   bool                                 DynamicStateBaseAddressModifyEnable;
628210e230b6Smaya   uint32_t                             DynamicStateMOCS;
628310e230b6Smaya   __gen_address_type                   DynamicStateBaseAddress;
628410e230b6Smaya   bool                                 IndirectObjectBaseAddressModifyEnable;
628510e230b6Smaya   uint32_t                             IndirectObjectMOCS;
628610e230b6Smaya   __gen_address_type                   IndirectObjectBaseAddress;
628710e230b6Smaya   bool                                 InstructionBaseAddressModifyEnable;
628810e230b6Smaya   uint32_t                             InstructionMOCS;
628910e230b6Smaya   __gen_address_type                   InstructionBaseAddress;
629010e230b6Smaya   bool                                 GeneralStateAccessUpperBoundModifyEnable;
629110e230b6Smaya   __gen_address_type                   GeneralStateAccessUpperBound;
629210e230b6Smaya   bool                                 DynamicStateAccessUpperBoundModifyEnable;
629310e230b6Smaya   __gen_address_type                   DynamicStateAccessUpperBound;
629410e230b6Smaya   bool                                 IndirectObjectAccessUpperBoundModifyEnable;
629510e230b6Smaya   __gen_address_type                   IndirectObjectAccessUpperBound;
629610e230b6Smaya   bool                                 InstructionAccessUpperBoundModifyEnable;
629710e230b6Smaya   __gen_address_type                   InstructionAccessUpperBound;
629810e230b6Smaya};
629910e230b6Smaya
630010e230b6Smayastatic inline void
630110e230b6SmayaGEN7_STATE_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
630210e230b6Smaya                             __attribute__((unused)) void * restrict dst,
630310e230b6Smaya                             __attribute__((unused)) const struct GEN7_STATE_BASE_ADDRESS * restrict values)
630410e230b6Smaya{
630510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
630610e230b6Smaya
630710e230b6Smaya   dw[0] =
630810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
630910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
631010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
631110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
631210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
631310e230b6Smaya
631410e230b6Smaya   const uint32_t v1 =
631510e230b6Smaya      __gen_uint(values->GeneralStateBaseAddressModifyEnable, 0, 0) |
631610e230b6Smaya      __gen_uint(values->StatelessDataPortAccessForceWriteThru, 3, 3) |
631710e230b6Smaya      __gen_uint(values->StatelessDataPortAccessMOCS, 4, 7) |
631810e230b6Smaya      __gen_uint(values->GeneralStateMOCS, 8, 11);
631910e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->GeneralStateBaseAddress, v1);
632010e230b6Smaya
632110e230b6Smaya   const uint32_t v2 =
632210e230b6Smaya      __gen_uint(values->SurfaceStateBaseAddressModifyEnable, 0, 0) |
632310e230b6Smaya      __gen_uint(values->SurfaceStateMOCS, 8, 11);
632410e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->SurfaceStateBaseAddress, v2);
632510e230b6Smaya
632610e230b6Smaya   const uint32_t v3 =
632710e230b6Smaya      __gen_uint(values->DynamicStateBaseAddressModifyEnable, 0, 0) |
632810e230b6Smaya      __gen_uint(values->DynamicStateMOCS, 8, 11);
632910e230b6Smaya   dw[3] = __gen_combine_address(data, &dw[3], values->DynamicStateBaseAddress, v3);
633010e230b6Smaya
633110e230b6Smaya   const uint32_t v4 =
633210e230b6Smaya      __gen_uint(values->IndirectObjectBaseAddressModifyEnable, 0, 0) |
633310e230b6Smaya      __gen_uint(values->IndirectObjectMOCS, 8, 11);
633410e230b6Smaya   dw[4] = __gen_combine_address(data, &dw[4], values->IndirectObjectBaseAddress, v4);
633510e230b6Smaya
633610e230b6Smaya   const uint32_t v5 =
633710e230b6Smaya      __gen_uint(values->InstructionBaseAddressModifyEnable, 0, 0) |
633810e230b6Smaya      __gen_uint(values->InstructionMOCS, 8, 11);
633910e230b6Smaya   dw[5] = __gen_combine_address(data, &dw[5], values->InstructionBaseAddress, v5);
634010e230b6Smaya
634110e230b6Smaya   const uint32_t v6 =
634210e230b6Smaya      __gen_uint(values->GeneralStateAccessUpperBoundModifyEnable, 0, 0);
634310e230b6Smaya   dw[6] = __gen_combine_address(data, &dw[6], values->GeneralStateAccessUpperBound, v6);
634410e230b6Smaya
634510e230b6Smaya   const uint32_t v7 =
634610e230b6Smaya      __gen_uint(values->DynamicStateAccessUpperBoundModifyEnable, 0, 0);
634710e230b6Smaya   dw[7] = __gen_combine_address(data, &dw[7], values->DynamicStateAccessUpperBound, v7);
634810e230b6Smaya
634910e230b6Smaya   const uint32_t v8 =
635010e230b6Smaya      __gen_uint(values->IndirectObjectAccessUpperBoundModifyEnable, 0, 0);
635110e230b6Smaya   dw[8] = __gen_combine_address(data, &dw[8], values->IndirectObjectAccessUpperBound, v8);
635210e230b6Smaya
635310e230b6Smaya   const uint32_t v9 =
635410e230b6Smaya      __gen_uint(values->InstructionAccessUpperBoundModifyEnable, 0, 0);
635510e230b6Smaya   dw[9] = __gen_combine_address(data, &dw[9], values->InstructionAccessUpperBound, v9);
635610e230b6Smaya}
635710e230b6Smaya
635810e230b6Smaya#define GEN7_STATE_PREFETCH_length             2
635910e230b6Smaya#define GEN7_STATE_PREFETCH_length_bias        2
636010e230b6Smaya#define GEN7_STATE_PREFETCH_header              \
636110e230b6Smaya   .DWordLength                         =      0,  \
636210e230b6Smaya   ._3DCommandSubOpcode                 =      3,  \
636310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
636410e230b6Smaya   .CommandSubType                      =      0,  \
636510e230b6Smaya   .CommandType                         =      3
636610e230b6Smaya
636710e230b6Smayastruct GEN7_STATE_PREFETCH {
636810e230b6Smaya   uint32_t                             DWordLength;
636910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
637010e230b6Smaya   uint32_t                             _3DCommandOpcode;
637110e230b6Smaya   uint32_t                             CommandSubType;
637210e230b6Smaya   uint32_t                             CommandType;
637310e230b6Smaya   uint32_t                             PrefetchCount;
637410e230b6Smaya   __gen_address_type                   PrefetchPointer;
637510e230b6Smaya};
637610e230b6Smaya
637710e230b6Smayastatic inline void
637810e230b6SmayaGEN7_STATE_PREFETCH_pack(__attribute__((unused)) __gen_user_data *data,
637910e230b6Smaya                         __attribute__((unused)) void * restrict dst,
638010e230b6Smaya                         __attribute__((unused)) const struct GEN7_STATE_PREFETCH * restrict values)
638110e230b6Smaya{
638210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
638310e230b6Smaya
638410e230b6Smaya   dw[0] =
638510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
638610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
638710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
638810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
638910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
639010e230b6Smaya
639110e230b6Smaya   const uint32_t v1 =
639210e230b6Smaya      __gen_uint(values->PrefetchCount, 0, 2);
639310e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->PrefetchPointer, v1);
639410e230b6Smaya}
639510e230b6Smaya
639610e230b6Smaya#define GEN7_STATE_SIP_length                  2
639710e230b6Smaya#define GEN7_STATE_SIP_length_bias             2
639810e230b6Smaya#define GEN7_STATE_SIP_header                   \
639910e230b6Smaya   .DWordLength                         =      0,  \
640010e230b6Smaya   ._3DCommandSubOpcode                 =      2,  \
640110e230b6Smaya   ._3DCommandOpcode                    =      1,  \
640210e230b6Smaya   .CommandSubType                      =      0,  \
640310e230b6Smaya   .CommandType                         =      3
640410e230b6Smaya
640510e230b6Smayastruct GEN7_STATE_SIP {
640610e230b6Smaya   uint32_t                             DWordLength;
640710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
640810e230b6Smaya   uint32_t                             _3DCommandOpcode;
640910e230b6Smaya   uint32_t                             CommandSubType;
641010e230b6Smaya   uint32_t                             CommandType;
641110e230b6Smaya   uint64_t                             SystemInstructionPointer;
641210e230b6Smaya};
641310e230b6Smaya
641410e230b6Smayastatic inline void
641510e230b6SmayaGEN7_STATE_SIP_pack(__attribute__((unused)) __gen_user_data *data,
641610e230b6Smaya                    __attribute__((unused)) void * restrict dst,
641710e230b6Smaya                    __attribute__((unused)) const struct GEN7_STATE_SIP * restrict values)
641810e230b6Smaya{
641910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
642010e230b6Smaya
642110e230b6Smaya   dw[0] =
642210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
642310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
642410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
642510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
642610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
642710e230b6Smaya
642810e230b6Smaya   dw[1] =
642910e230b6Smaya      __gen_offset(values->SystemInstructionPointer, 4, 31);
643010e230b6Smaya}
643110e230b6Smaya
643210e230b6Smaya#define GEN7_SWTESS_BASE_ADDRESS_length        2
643310e230b6Smaya#define GEN7_SWTESS_BASE_ADDRESS_length_bias      2
643410e230b6Smaya#define GEN7_SWTESS_BASE_ADDRESS_header         \
643510e230b6Smaya   .DWordLength                         =      0,  \
643610e230b6Smaya   ._3DCommandSubOpcode                 =      3,  \
643710e230b6Smaya   ._3DCommandOpcode                    =      1,  \
643810e230b6Smaya   .CommandSubType                      =      0,  \
643910e230b6Smaya   .CommandType                         =      3
644010e230b6Smaya
644110e230b6Smayastruct GEN7_SWTESS_BASE_ADDRESS {
644210e230b6Smaya   uint32_t                             DWordLength;
644310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
644410e230b6Smaya   uint32_t                             _3DCommandOpcode;
644510e230b6Smaya   uint32_t                             CommandSubType;
644610e230b6Smaya   uint32_t                             CommandType;
644710e230b6Smaya   uint32_t                             SWTessellationMOCS;
644810e230b6Smaya   __gen_address_type                   SWTessellationBaseAddress;
644910e230b6Smaya};
645010e230b6Smaya
645110e230b6Smayastatic inline void
645210e230b6SmayaGEN7_SWTESS_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
645310e230b6Smaya                              __attribute__((unused)) void * restrict dst,
645410e230b6Smaya                              __attribute__((unused)) const struct GEN7_SWTESS_BASE_ADDRESS * restrict values)
645510e230b6Smaya{
645610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
645710e230b6Smaya
645810e230b6Smaya   dw[0] =
645910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
646010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
646110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
646210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
646310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
646410e230b6Smaya
646510e230b6Smaya   const uint32_t v1 =
646610e230b6Smaya      __gen_uint(values->SWTessellationMOCS, 8, 11);
646710e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->SWTessellationBaseAddress, v1);
646810e230b6Smaya}
646910e230b6Smaya
647010e230b6Smaya#define GEN7_BCS_FAULT_REG_num            0x4294
647110e230b6Smaya#define GEN7_BCS_FAULT_REG_length              1
647210e230b6Smayastruct GEN7_BCS_FAULT_REG {
647310e230b6Smaya   bool                                 ValidBit;
647410e230b6Smaya   uint32_t                             FaultType;
647510e230b6Smaya#define PageFault                                0
647610e230b6Smaya#define InvalidPDFault                           1
647710e230b6Smaya#define UnloadedPDFault                          2
647810e230b6Smaya#define InvalidandUnloadedPDfault                3
647910e230b6Smaya   uint32_t                             SRCIDofFault;
648010e230b6Smaya   uint32_t                             GTTSEL;
648110e230b6Smaya#define PPGTT                                    0
648210e230b6Smaya#define GGTT                                     1
648310e230b6Smaya   __gen_address_type                   VirtualAddressofFault;
648410e230b6Smaya};
648510e230b6Smaya
648610e230b6Smayastatic inline void
648710e230b6SmayaGEN7_BCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
648810e230b6Smaya                        __attribute__((unused)) void * restrict dst,
648910e230b6Smaya                        __attribute__((unused)) const struct GEN7_BCS_FAULT_REG * restrict values)
649010e230b6Smaya{
649110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
649210e230b6Smaya
649310e230b6Smaya   const uint32_t v0 =
649410e230b6Smaya      __gen_uint(values->ValidBit, 0, 0) |
649510e230b6Smaya      __gen_uint(values->FaultType, 1, 2) |
649610e230b6Smaya      __gen_uint(values->SRCIDofFault, 3, 10) |
649710e230b6Smaya      __gen_uint(values->GTTSEL, 11, 11);
649810e230b6Smaya   dw[0] = __gen_combine_address(data, &dw[0], values->VirtualAddressofFault, v0);
649910e230b6Smaya}
650010e230b6Smaya
650110e230b6Smaya#define GEN7_BCS_INSTDONE_num             0x2206c
650210e230b6Smaya#define GEN7_BCS_INSTDONE_length               1
650310e230b6Smayastruct GEN7_BCS_INSTDONE {
650410e230b6Smaya   bool                                 RingEnable;
650510e230b6Smaya   bool                                 BlitterIDLE;
650610e230b6Smaya   bool                                 GABIDLE;
650710e230b6Smaya   bool                                 BCSDone;
650810e230b6Smaya};
650910e230b6Smaya
651010e230b6Smayastatic inline void
651110e230b6SmayaGEN7_BCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
651210e230b6Smaya                       __attribute__((unused)) void * restrict dst,
651310e230b6Smaya                       __attribute__((unused)) const struct GEN7_BCS_INSTDONE * restrict values)
651410e230b6Smaya{
651510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
651610e230b6Smaya
651710e230b6Smaya   dw[0] =
651810e230b6Smaya      __gen_uint(values->RingEnable, 0, 0) |
651910e230b6Smaya      __gen_uint(values->BlitterIDLE, 1, 1) |
652010e230b6Smaya      __gen_uint(values->GABIDLE, 2, 2) |
652110e230b6Smaya      __gen_uint(values->BCSDone, 3, 3);
652210e230b6Smaya}
652310e230b6Smaya
652410e230b6Smaya#define GEN7_BCS_RING_BUFFER_CTL_num      0x2203c
652510e230b6Smaya#define GEN7_BCS_RING_BUFFER_CTL_length        1
652610e230b6Smayastruct GEN7_BCS_RING_BUFFER_CTL {
652710e230b6Smaya   bool                                 RingBufferEnable;
652810e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
652910e230b6Smaya#define MI_AUTOREPORT_OFF                        0
653010e230b6Smaya#define MI_AUTOREPORT_64KB                       1
653110e230b6Smaya#define MI_AUTOREPORT_4KB                        2
653210e230b6Smaya#define MI_AUTOREPORT_128KB                      3
653310e230b6Smaya   bool                                 DisableRegisterAccesses;
653410e230b6Smaya   bool                                 SemaphoreWait;
653510e230b6Smaya   bool                                 RBWait;
653610e230b6Smaya   uint32_t                             BufferLengthinpages1;
653710e230b6Smaya};
653810e230b6Smaya
653910e230b6Smayastatic inline void
654010e230b6SmayaGEN7_BCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
654110e230b6Smaya                              __attribute__((unused)) void * restrict dst,
654210e230b6Smaya                              __attribute__((unused)) const struct GEN7_BCS_RING_BUFFER_CTL * restrict values)
654310e230b6Smaya{
654410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
654510e230b6Smaya
654610e230b6Smaya   dw[0] =
654710e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
654810e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
654910e230b6Smaya      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
655010e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
655110e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
655210e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
655310e230b6Smaya}
655410e230b6Smaya
655510e230b6Smaya#define GEN7_CL_INVOCATION_COUNT_num      0x2338
655610e230b6Smaya#define GEN7_CL_INVOCATION_COUNT_length        2
655710e230b6Smayastruct GEN7_CL_INVOCATION_COUNT {
655810e230b6Smaya   uint64_t                             CLInvocationCountReport;
655910e230b6Smaya};
656010e230b6Smaya
656110e230b6Smayastatic inline void
656210e230b6SmayaGEN7_CL_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
656310e230b6Smaya                              __attribute__((unused)) void * restrict dst,
656410e230b6Smaya                              __attribute__((unused)) const struct GEN7_CL_INVOCATION_COUNT * restrict values)
656510e230b6Smaya{
656610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
656710e230b6Smaya
656810e230b6Smaya   const uint64_t v0 =
656910e230b6Smaya      __gen_uint(values->CLInvocationCountReport, 0, 63);
657010e230b6Smaya   dw[0] = v0;
657110e230b6Smaya   dw[1] = v0 >> 32;
657210e230b6Smaya}
657310e230b6Smaya
657410e230b6Smaya#define GEN7_CL_PRIMITIVES_COUNT_num      0x2340
657510e230b6Smaya#define GEN7_CL_PRIMITIVES_COUNT_length        2
657610e230b6Smayastruct GEN7_CL_PRIMITIVES_COUNT {
657710e230b6Smaya   uint64_t                             CLPrimitivesCountReport;
657810e230b6Smaya};
657910e230b6Smaya
658010e230b6Smayastatic inline void
658110e230b6SmayaGEN7_CL_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
658210e230b6Smaya                              __attribute__((unused)) void * restrict dst,
658310e230b6Smaya                              __attribute__((unused)) const struct GEN7_CL_PRIMITIVES_COUNT * restrict values)
658410e230b6Smaya{
658510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
658610e230b6Smaya
658710e230b6Smaya   const uint64_t v0 =
658810e230b6Smaya      __gen_uint(values->CLPrimitivesCountReport, 0, 63);
658910e230b6Smaya   dw[0] = v0;
659010e230b6Smaya   dw[1] = v0 >> 32;
659110e230b6Smaya}
659210e230b6Smaya
659310e230b6Smaya#define GEN7_CS_INVOCATION_COUNT_num      0x2290
659410e230b6Smaya#define GEN7_CS_INVOCATION_COUNT_length        2
659510e230b6Smayastruct GEN7_CS_INVOCATION_COUNT {
659610e230b6Smaya   uint64_t                             CSInvocationCountReport;
659710e230b6Smaya};
659810e230b6Smaya
659910e230b6Smayastatic inline void
660010e230b6SmayaGEN7_CS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
660110e230b6Smaya                              __attribute__((unused)) void * restrict dst,
660210e230b6Smaya                              __attribute__((unused)) const struct GEN7_CS_INVOCATION_COUNT * restrict values)
660310e230b6Smaya{
660410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
660510e230b6Smaya
660610e230b6Smaya   const uint64_t v0 =
660710e230b6Smaya      __gen_uint(values->CSInvocationCountReport, 0, 63);
660810e230b6Smaya   dw[0] = v0;
660910e230b6Smaya   dw[1] = v0 >> 32;
661010e230b6Smaya}
661110e230b6Smaya
661210e230b6Smaya#define GEN7_DS_INVOCATION_COUNT_num      0x2308
661310e230b6Smaya#define GEN7_DS_INVOCATION_COUNT_length        2
661410e230b6Smayastruct GEN7_DS_INVOCATION_COUNT {
661510e230b6Smaya   uint64_t                             DSInvocationCountReport;
661610e230b6Smaya};
661710e230b6Smaya
661810e230b6Smayastatic inline void
661910e230b6SmayaGEN7_DS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
662010e230b6Smaya                              __attribute__((unused)) void * restrict dst,
662110e230b6Smaya                              __attribute__((unused)) const struct GEN7_DS_INVOCATION_COUNT * restrict values)
662210e230b6Smaya{
662310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
662410e230b6Smaya
662510e230b6Smaya   const uint64_t v0 =
662610e230b6Smaya      __gen_uint(values->DSInvocationCountReport, 0, 63);
662710e230b6Smaya   dw[0] = v0;
662810e230b6Smaya   dw[1] = v0 >> 32;
662910e230b6Smaya}
663010e230b6Smaya
663110e230b6Smaya#define GEN7_ERR_INT_num                  0x44040
663210e230b6Smaya#define GEN7_ERR_INT_length                    1
663310e230b6Smayastruct GEN7_ERR_INT {
663410e230b6Smaya   bool                                 PrimaryAGTTFaultStatus;
663510e230b6Smaya   bool                                 PrimaryBGTTFaultStatus;
663610e230b6Smaya   bool                                 SpriteAGTTFaultStatus;
663710e230b6Smaya   bool                                 SpriteBGTTFaultStatus;
663810e230b6Smaya   bool                                 CursorAGTTFaultStatus;
663910e230b6Smaya   bool                                 CursorBGTTFaultStatus;
664010e230b6Smaya   bool                                 Invalidpagetableentrydata;
664110e230b6Smaya   bool                                 InvalidGTTpagetableentry;
664210e230b6Smaya};
664310e230b6Smaya
664410e230b6Smayastatic inline void
664510e230b6SmayaGEN7_ERR_INT_pack(__attribute__((unused)) __gen_user_data *data,
664610e230b6Smaya                  __attribute__((unused)) void * restrict dst,
664710e230b6Smaya                  __attribute__((unused)) const struct GEN7_ERR_INT * restrict values)
664810e230b6Smaya{
664910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
665010e230b6Smaya
665110e230b6Smaya   dw[0] =
665210e230b6Smaya      __gen_uint(values->PrimaryAGTTFaultStatus, 0, 0) |
665310e230b6Smaya      __gen_uint(values->PrimaryBGTTFaultStatus, 1, 1) |
665410e230b6Smaya      __gen_uint(values->SpriteAGTTFaultStatus, 2, 2) |
665510e230b6Smaya      __gen_uint(values->SpriteBGTTFaultStatus, 3, 3) |
665610e230b6Smaya      __gen_uint(values->CursorAGTTFaultStatus, 4, 4) |
665710e230b6Smaya      __gen_uint(values->CursorBGTTFaultStatus, 5, 5) |
665810e230b6Smaya      __gen_uint(values->Invalidpagetableentrydata, 6, 6) |
665910e230b6Smaya      __gen_uint(values->InvalidGTTpagetableentry, 7, 7);
666010e230b6Smaya}
666110e230b6Smaya
666210e230b6Smaya#define GEN7_GFX_ARB_ERROR_RPT_num        0x40a0
666310e230b6Smaya#define GEN7_GFX_ARB_ERROR_RPT_length          1
666410e230b6Smayastruct GEN7_GFX_ARB_ERROR_RPT {
666510e230b6Smaya   bool                                 TLBPageFaultError;
666610e230b6Smaya   bool                                 ContextPageFaultError;
666710e230b6Smaya   bool                                 InvalidPageDirectoryentryerror;
666810e230b6Smaya   bool                                 HardwareStatusPageFaultError;
666910e230b6Smaya   bool                                 TLBPageVTDTranslationError;
667010e230b6Smaya   bool                                 ContextPageVTDTranslationError;
667110e230b6Smaya   bool                                 PageDirectoryEntryVTDTranslationError;
667210e230b6Smaya   bool                                 HardwareStatusPageVTDTranslationError;
667310e230b6Smaya   bool                                 UnloadedPDError;
667410e230b6Smaya};
667510e230b6Smaya
667610e230b6Smayastatic inline void
667710e230b6SmayaGEN7_GFX_ARB_ERROR_RPT_pack(__attribute__((unused)) __gen_user_data *data,
667810e230b6Smaya                            __attribute__((unused)) void * restrict dst,
667910e230b6Smaya                            __attribute__((unused)) const struct GEN7_GFX_ARB_ERROR_RPT * restrict values)
668010e230b6Smaya{
668110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
668210e230b6Smaya
668310e230b6Smaya   dw[0] =
668410e230b6Smaya      __gen_uint(values->TLBPageFaultError, 0, 0) |
668510e230b6Smaya      __gen_uint(values->ContextPageFaultError, 1, 1) |
668610e230b6Smaya      __gen_uint(values->InvalidPageDirectoryentryerror, 2, 2) |
668710e230b6Smaya      __gen_uint(values->HardwareStatusPageFaultError, 3, 3) |
668810e230b6Smaya      __gen_uint(values->TLBPageVTDTranslationError, 4, 4) |
668910e230b6Smaya      __gen_uint(values->ContextPageVTDTranslationError, 5, 5) |
669010e230b6Smaya      __gen_uint(values->PageDirectoryEntryVTDTranslationError, 6, 6) |
669110e230b6Smaya      __gen_uint(values->HardwareStatusPageVTDTranslationError, 7, 7) |
669210e230b6Smaya      __gen_uint(values->UnloadedPDError, 8, 8);
669310e230b6Smaya}
669410e230b6Smaya
669510e230b6Smaya#define GEN7_GS_INVOCATION_COUNT_num      0x2328
669610e230b6Smaya#define GEN7_GS_INVOCATION_COUNT_length        2
669710e230b6Smayastruct GEN7_GS_INVOCATION_COUNT {
669810e230b6Smaya   uint64_t                             GSInvocationCountReport;
669910e230b6Smaya};
670010e230b6Smaya
670110e230b6Smayastatic inline void
670210e230b6SmayaGEN7_GS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
670310e230b6Smaya                              __attribute__((unused)) void * restrict dst,
670410e230b6Smaya                              __attribute__((unused)) const struct GEN7_GS_INVOCATION_COUNT * restrict values)
670510e230b6Smaya{
670610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
670710e230b6Smaya
670810e230b6Smaya   const uint64_t v0 =
670910e230b6Smaya      __gen_uint(values->GSInvocationCountReport, 0, 63);
671010e230b6Smaya   dw[0] = v0;
671110e230b6Smaya   dw[1] = v0 >> 32;
671210e230b6Smaya}
671310e230b6Smaya
671410e230b6Smaya#define GEN7_GS_PRIMITIVES_COUNT_num      0x2330
671510e230b6Smaya#define GEN7_GS_PRIMITIVES_COUNT_length        2
671610e230b6Smayastruct GEN7_GS_PRIMITIVES_COUNT {
671710e230b6Smaya   uint64_t                             GSPrimitivesCountReport;
671810e230b6Smaya};
671910e230b6Smaya
672010e230b6Smayastatic inline void
672110e230b6SmayaGEN7_GS_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
672210e230b6Smaya                              __attribute__((unused)) void * restrict dst,
672310e230b6Smaya                              __attribute__((unused)) const struct GEN7_GS_PRIMITIVES_COUNT * restrict values)
672410e230b6Smaya{
672510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
672610e230b6Smaya
672710e230b6Smaya   const uint64_t v0 =
672810e230b6Smaya      __gen_uint(values->GSPrimitivesCountReport, 0, 63);
672910e230b6Smaya   dw[0] = v0;
673010e230b6Smaya   dw[1] = v0 >> 32;
673110e230b6Smaya}
673210e230b6Smaya
673310e230b6Smaya#define GEN7_HS_INVOCATION_COUNT_num      0x2300
673410e230b6Smaya#define GEN7_HS_INVOCATION_COUNT_length        2
673510e230b6Smayastruct GEN7_HS_INVOCATION_COUNT {
673610e230b6Smaya   uint64_t                             HSInvocationCountReport;
673710e230b6Smaya};
673810e230b6Smaya
673910e230b6Smayastatic inline void
674010e230b6SmayaGEN7_HS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
674110e230b6Smaya                              __attribute__((unused)) void * restrict dst,
674210e230b6Smaya                              __attribute__((unused)) const struct GEN7_HS_INVOCATION_COUNT * restrict values)
674310e230b6Smaya{
674410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
674510e230b6Smaya
674610e230b6Smaya   const uint64_t v0 =
674710e230b6Smaya      __gen_uint(values->HSInvocationCountReport, 0, 63);
674810e230b6Smaya   dw[0] = v0;
674910e230b6Smaya   dw[1] = v0 >> 32;
675010e230b6Smaya}
675110e230b6Smaya
675210e230b6Smaya#define GEN7_IA_PRIMITIVES_COUNT_num      0x2318
675310e230b6Smaya#define GEN7_IA_PRIMITIVES_COUNT_length        2
675410e230b6Smayastruct GEN7_IA_PRIMITIVES_COUNT {
675510e230b6Smaya   uint64_t                             IAPrimitivesCountReport;
675610e230b6Smaya};
675710e230b6Smaya
675810e230b6Smayastatic inline void
675910e230b6SmayaGEN7_IA_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
676010e230b6Smaya                              __attribute__((unused)) void * restrict dst,
676110e230b6Smaya                              __attribute__((unused)) const struct GEN7_IA_PRIMITIVES_COUNT * restrict values)
676210e230b6Smaya{
676310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
676410e230b6Smaya
676510e230b6Smaya   const uint64_t v0 =
676610e230b6Smaya      __gen_uint(values->IAPrimitivesCountReport, 0, 63);
676710e230b6Smaya   dw[0] = v0;
676810e230b6Smaya   dw[1] = v0 >> 32;
676910e230b6Smaya}
677010e230b6Smaya
677110e230b6Smaya#define GEN7_IA_VERTICES_COUNT_num        0x2310
677210e230b6Smaya#define GEN7_IA_VERTICES_COUNT_length          2
677310e230b6Smayastruct GEN7_IA_VERTICES_COUNT {
677410e230b6Smaya   uint64_t                             IAVerticesCountReport;
677510e230b6Smaya};
677610e230b6Smaya
677710e230b6Smayastatic inline void
677810e230b6SmayaGEN7_IA_VERTICES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
677910e230b6Smaya                            __attribute__((unused)) void * restrict dst,
678010e230b6Smaya                            __attribute__((unused)) const struct GEN7_IA_VERTICES_COUNT * restrict values)
678110e230b6Smaya{
678210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
678310e230b6Smaya
678410e230b6Smaya   const uint64_t v0 =
678510e230b6Smaya      __gen_uint(values->IAVerticesCountReport, 0, 63);
678610e230b6Smaya   dw[0] = v0;
678710e230b6Smaya   dw[1] = v0 >> 32;
678810e230b6Smaya}
678910e230b6Smaya
679010e230b6Smaya#define GEN7_INSTDONE_1_num               0x206c
679110e230b6Smaya#define GEN7_INSTDONE_1_length                 1
679210e230b6Smayastruct GEN7_INSTDONE_1 {
679310e230b6Smaya   bool                                 PRB0RingEnable;
679410e230b6Smaya   bool                                 VFGDone;
679510e230b6Smaya   bool                                 VSDone;
679610e230b6Smaya   bool                                 HSDone;
679710e230b6Smaya   bool                                 TEDone;
679810e230b6Smaya   bool                                 DSDone;
679910e230b6Smaya   bool                                 GSDone;
680010e230b6Smaya   bool                                 SOLDone;
680110e230b6Smaya   bool                                 CLDone;
680210e230b6Smaya   bool                                 SFDone;
680310e230b6Smaya   bool                                 TDGDone;
680410e230b6Smaya   bool                                 URBMDone;
680510e230b6Smaya   bool                                 SVGDone;
680610e230b6Smaya   bool                                 GAFSDone;
680710e230b6Smaya   bool                                 VFEDone;
680810e230b6Smaya   bool                                 TSGDone;
680910e230b6Smaya   bool                                 GAFMDone;
681010e230b6Smaya   bool                                 GAMDone;
681110e230b6Smaya   bool                                 SDEDone;
681210e230b6Smaya   bool                                 RCCFBCCSDone;
681310e230b6Smaya};
681410e230b6Smaya
681510e230b6Smayastatic inline void
681610e230b6SmayaGEN7_INSTDONE_1_pack(__attribute__((unused)) __gen_user_data *data,
681710e230b6Smaya                     __attribute__((unused)) void * restrict dst,
681810e230b6Smaya                     __attribute__((unused)) const struct GEN7_INSTDONE_1 * restrict values)
681910e230b6Smaya{
682010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
682110e230b6Smaya
682210e230b6Smaya   dw[0] =
682310e230b6Smaya      __gen_uint(values->PRB0RingEnable, 0, 0) |
682410e230b6Smaya      __gen_uint(values->VFGDone, 1, 1) |
682510e230b6Smaya      __gen_uint(values->VSDone, 2, 2) |
682610e230b6Smaya      __gen_uint(values->HSDone, 3, 3) |
682710e230b6Smaya      __gen_uint(values->TEDone, 4, 4) |
682810e230b6Smaya      __gen_uint(values->DSDone, 5, 5) |
682910e230b6Smaya      __gen_uint(values->GSDone, 6, 6) |
683010e230b6Smaya      __gen_uint(values->SOLDone, 7, 7) |
683110e230b6Smaya      __gen_uint(values->CLDone, 8, 8) |
683210e230b6Smaya      __gen_uint(values->SFDone, 9, 9) |
683310e230b6Smaya      __gen_uint(values->TDGDone, 12, 12) |
683410e230b6Smaya      __gen_uint(values->URBMDone, 13, 13) |
683510e230b6Smaya      __gen_uint(values->SVGDone, 14, 14) |
683610e230b6Smaya      __gen_uint(values->GAFSDone, 15, 15) |
683710e230b6Smaya      __gen_uint(values->VFEDone, 16, 16) |
683810e230b6Smaya      __gen_uint(values->TSGDone, 17, 17) |
683910e230b6Smaya      __gen_uint(values->GAFMDone, 18, 18) |
684010e230b6Smaya      __gen_uint(values->GAMDone, 19, 19) |
684110e230b6Smaya      __gen_uint(values->SDEDone, 22, 22) |
684210e230b6Smaya      __gen_uint(values->RCCFBCCSDone, 23, 23);
684310e230b6Smaya}
684410e230b6Smaya
684510e230b6Smaya#define GEN7_INSTPM_num                   0x20c0
684610e230b6Smaya#define GEN7_INSTPM_length                     1
684710e230b6Smayastruct GEN7_INSTPM {
684810e230b6Smaya   bool                                 _3DStateInstructionDisable;
684910e230b6Smaya   bool                                 _3DRenderingInstructionDisable;
685010e230b6Smaya   bool                                 MediaInstructionDisable;
685110e230b6Smaya   bool                                 CONSTANT_BUFFERAddressOffsetDisable;
685210e230b6Smaya   bool                                 _3DStateInstructionDisableMask;
685310e230b6Smaya   bool                                 _3DRenderingInstructionDisableMask;
685410e230b6Smaya   bool                                 MediaInstructionDisableMask;
685510e230b6Smaya   bool                                 CONSTANT_BUFFERAddressOffsetDisableMask;
685610e230b6Smaya};
685710e230b6Smaya
685810e230b6Smayastatic inline void
685910e230b6SmayaGEN7_INSTPM_pack(__attribute__((unused)) __gen_user_data *data,
686010e230b6Smaya                 __attribute__((unused)) void * restrict dst,
686110e230b6Smaya                 __attribute__((unused)) const struct GEN7_INSTPM * restrict values)
686210e230b6Smaya{
686310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
686410e230b6Smaya
686510e230b6Smaya   dw[0] =
686610e230b6Smaya      __gen_uint(values->_3DStateInstructionDisable, 1, 1) |
686710e230b6Smaya      __gen_uint(values->_3DRenderingInstructionDisable, 2, 2) |
686810e230b6Smaya      __gen_uint(values->MediaInstructionDisable, 3, 3) |
686910e230b6Smaya      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisable, 6, 6) |
687010e230b6Smaya      __gen_uint(values->_3DStateInstructionDisableMask, 17, 17) |
687110e230b6Smaya      __gen_uint(values->_3DRenderingInstructionDisableMask, 18, 18) |
687210e230b6Smaya      __gen_uint(values->MediaInstructionDisableMask, 19, 19) |
687310e230b6Smaya      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisableMask, 22, 22);
687410e230b6Smaya}
687510e230b6Smaya
687610e230b6Smaya#define GEN7_L3CNTLREG2_num               0xb020
687710e230b6Smaya#define GEN7_L3CNTLREG2_length                 1
687810e230b6Smayastruct GEN7_L3CNTLREG2 {
687910e230b6Smaya   uint32_t                             SLMEnable;
688010e230b6Smaya   uint32_t                             URBAllocation;
688110e230b6Smaya   uint32_t                             URBLowBandwidth;
688210e230b6Smaya   uint32_t                             ALLAllocation;
688310e230b6Smaya   uint32_t                             ROAllocation;
688410e230b6Smaya   uint32_t                             ROLowBandwidth;
688510e230b6Smaya   uint32_t                             DCAllocation;
688610e230b6Smaya   uint32_t                             DCLowBandwidth;
688710e230b6Smaya};
688810e230b6Smaya
688910e230b6Smayastatic inline void
689010e230b6SmayaGEN7_L3CNTLREG2_pack(__attribute__((unused)) __gen_user_data *data,
689110e230b6Smaya                     __attribute__((unused)) void * restrict dst,
689210e230b6Smaya                     __attribute__((unused)) const struct GEN7_L3CNTLREG2 * restrict values)
689310e230b6Smaya{
689410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
689510e230b6Smaya
689610e230b6Smaya   dw[0] =
689710e230b6Smaya      __gen_uint(values->SLMEnable, 0, 0) |
689810e230b6Smaya      __gen_uint(values->URBAllocation, 1, 6) |
689910e230b6Smaya      __gen_uint(values->URBLowBandwidth, 7, 7) |
690010e230b6Smaya      __gen_uint(values->ALLAllocation, 8, 13) |
690110e230b6Smaya      __gen_uint(values->ROAllocation, 14, 19) |
690210e230b6Smaya      __gen_uint(values->ROLowBandwidth, 20, 20) |
690310e230b6Smaya      __gen_uint(values->DCAllocation, 21, 26) |
690410e230b6Smaya      __gen_uint(values->DCLowBandwidth, 27, 27);
690510e230b6Smaya}
690610e230b6Smaya
690710e230b6Smaya#define GEN7_L3CNTLREG3_num               0xb024
690810e230b6Smaya#define GEN7_L3CNTLREG3_length                 1
690910e230b6Smayastruct GEN7_L3CNTLREG3 {
691010e230b6Smaya   uint32_t                             ISAllocation;
691110e230b6Smaya   uint32_t                             ISLowBandwidth;
691210e230b6Smaya   uint32_t                             CAllocation;
691310e230b6Smaya   uint32_t                             CLowBandwidth;
691410e230b6Smaya   uint32_t                             TAllocation;
691510e230b6Smaya   uint32_t                             TLowBandwidth;
691610e230b6Smaya};
691710e230b6Smaya
691810e230b6Smayastatic inline void
691910e230b6SmayaGEN7_L3CNTLREG3_pack(__attribute__((unused)) __gen_user_data *data,
692010e230b6Smaya                     __attribute__((unused)) void * restrict dst,
692110e230b6Smaya                     __attribute__((unused)) const struct GEN7_L3CNTLREG3 * restrict values)
692210e230b6Smaya{
692310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
692410e230b6Smaya
692510e230b6Smaya   dw[0] =
692610e230b6Smaya      __gen_uint(values->ISAllocation, 1, 6) |
692710e230b6Smaya      __gen_uint(values->ISLowBandwidth, 7, 7) |
692810e230b6Smaya      __gen_uint(values->CAllocation, 8, 13) |
692910e230b6Smaya      __gen_uint(values->CLowBandwidth, 14, 14) |
693010e230b6Smaya      __gen_uint(values->TAllocation, 15, 20) |
693110e230b6Smaya      __gen_uint(values->TLowBandwidth, 21, 21);
693210e230b6Smaya}
693310e230b6Smaya
693410e230b6Smaya#define GEN7_L3SQCREG1_num                0xb010
693510e230b6Smaya#define GEN7_L3SQCREG1_length                  1
693610e230b6Smayastruct GEN7_L3SQCREG1 {
693710e230b6Smaya   uint32_t                             ConvertDC_UC;
693810e230b6Smaya   uint32_t                             ConvertIS_UC;
693910e230b6Smaya   uint32_t                             ConvertC_UC;
694010e230b6Smaya   uint32_t                             ConvertT_UC;
694110e230b6Smaya};
694210e230b6Smaya
694310e230b6Smayastatic inline void
694410e230b6SmayaGEN7_L3SQCREG1_pack(__attribute__((unused)) __gen_user_data *data,
694510e230b6Smaya                    __attribute__((unused)) void * restrict dst,
694610e230b6Smaya                    __attribute__((unused)) const struct GEN7_L3SQCREG1 * restrict values)
694710e230b6Smaya{
694810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
694910e230b6Smaya
695010e230b6Smaya   dw[0] =
695110e230b6Smaya      __gen_uint(values->ConvertDC_UC, 24, 24) |
695210e230b6Smaya      __gen_uint(values->ConvertIS_UC, 25, 25) |
695310e230b6Smaya      __gen_uint(values->ConvertC_UC, 26, 26) |
695410e230b6Smaya      __gen_uint(values->ConvertT_UC, 27, 27);
695510e230b6Smaya}
695610e230b6Smaya
695710e230b6Smaya#define GEN7_PS_INVOCATION_COUNT_num      0x2348
695810e230b6Smaya#define GEN7_PS_INVOCATION_COUNT_length        2
695910e230b6Smayastruct GEN7_PS_INVOCATION_COUNT {
696010e230b6Smaya   uint64_t                             PSInvocationCountReport;
696110e230b6Smaya};
696210e230b6Smaya
696310e230b6Smayastatic inline void
696410e230b6SmayaGEN7_PS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
696510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
696610e230b6Smaya                              __attribute__((unused)) const struct GEN7_PS_INVOCATION_COUNT * restrict values)
696710e230b6Smaya{
696810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
696910e230b6Smaya
697010e230b6Smaya   const uint64_t v0 =
697110e230b6Smaya      __gen_uint(values->PSInvocationCountReport, 0, 63);
697210e230b6Smaya   dw[0] = v0;
697310e230b6Smaya   dw[1] = v0 >> 32;
697410e230b6Smaya}
697510e230b6Smaya
697610e230b6Smaya#define GEN7_RCS_FAULT_REG_num            0x4094
697710e230b6Smaya#define GEN7_RCS_FAULT_REG_length              1
697810e230b6Smayastruct GEN7_RCS_FAULT_REG {
697910e230b6Smaya   bool                                 ValidBit;
698010e230b6Smaya   uint32_t                             FaultType;
698110e230b6Smaya#define PageFault                                0
698210e230b6Smaya#define InvalidPDFault                           1
698310e230b6Smaya#define UnloadedPDFault                          2
698410e230b6Smaya#define InvalidandUnloadedPDfault                3
698510e230b6Smaya   uint32_t                             SRCIDofFault;
698610e230b6Smaya   uint32_t                             GTTSEL;
698710e230b6Smaya#define PPGTT                                    0
698810e230b6Smaya#define GGTT                                     1
698910e230b6Smaya   __gen_address_type                   VirtualAddressofFault;
699010e230b6Smaya};
699110e230b6Smaya
699210e230b6Smayastatic inline void
699310e230b6SmayaGEN7_RCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
699410e230b6Smaya                        __attribute__((unused)) void * restrict dst,
699510e230b6Smaya                        __attribute__((unused)) const struct GEN7_RCS_FAULT_REG * restrict values)
699610e230b6Smaya{
699710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
699810e230b6Smaya
699910e230b6Smaya   const uint32_t v0 =
700010e230b6Smaya      __gen_uint(values->ValidBit, 0, 0) |
700110e230b6Smaya      __gen_uint(values->FaultType, 1, 2) |
700210e230b6Smaya      __gen_uint(values->SRCIDofFault, 3, 10) |
700310e230b6Smaya      __gen_uint(values->GTTSEL, 11, 11);
700410e230b6Smaya   dw[0] = __gen_combine_address(data, &dw[0], values->VirtualAddressofFault, v0);
700510e230b6Smaya}
700610e230b6Smaya
700710e230b6Smaya#define GEN7_RCS_RING_BUFFER_CTL_num      0x203c
700810e230b6Smaya#define GEN7_RCS_RING_BUFFER_CTL_length        1
700910e230b6Smayastruct GEN7_RCS_RING_BUFFER_CTL {
701010e230b6Smaya   bool                                 RingBufferEnable;
701110e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
701210e230b6Smaya#define MI_AUTOREPORT_OFF                        0
701310e230b6Smaya#define MI_AUTOREPORT_64KBMI_AUTOREPORT_4KB      1
701410e230b6Smaya#define MI_AUTOREPORT_128KB                      3
701510e230b6Smaya   bool                                 SemaphoreWait;
701610e230b6Smaya   bool                                 RBWait;
701710e230b6Smaya   uint32_t                             BufferLengthinpages1;
701810e230b6Smaya};
701910e230b6Smaya
702010e230b6Smayastatic inline void
702110e230b6SmayaGEN7_RCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
702210e230b6Smaya                              __attribute__((unused)) void * restrict dst,
702310e230b6Smaya                              __attribute__((unused)) const struct GEN7_RCS_RING_BUFFER_CTL * restrict values)
702410e230b6Smaya{
702510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
702610e230b6Smaya
702710e230b6Smaya   dw[0] =
702810e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
702910e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
703010e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
703110e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
703210e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
703310e230b6Smaya}
703410e230b6Smaya
703510e230b6Smaya#define GEN7_ROW_INSTDONE_num             0xe164
703610e230b6Smaya#define GEN7_ROW_INSTDONE_length               1
703710e230b6Smayastruct GEN7_ROW_INSTDONE {
703810e230b6Smaya   bool                                 BCDone;
703910e230b6Smaya   bool                                 PSDDone;
704010e230b6Smaya   bool                                 DCDone;
704110e230b6Smaya   bool                                 DAPRDone;
704210e230b6Smaya   bool                                 TDLDone;
704310e230b6Smaya   bool                                 GWDone;
704410e230b6Smaya   bool                                 ICDone;
704510e230b6Smaya   bool                                 EU00DoneSS0;
704610e230b6Smaya   bool                                 EU01DoneSS0;
704710e230b6Smaya   bool                                 EU02DoneSS0;
704810e230b6Smaya   bool                                 EU03DoneSS0;
704910e230b6Smaya   bool                                 MA0DoneSS0;
705010e230b6Smaya   bool                                 EU10DoneSS0;
705110e230b6Smaya   bool                                 EU11DoneSS0;
705210e230b6Smaya   bool                                 EU12DoneSS0;
705310e230b6Smaya   bool                                 EU13DoneSS0;
705410e230b6Smaya   bool                                 MA1Done;
705510e230b6Smaya};
705610e230b6Smaya
705710e230b6Smayastatic inline void
705810e230b6SmayaGEN7_ROW_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
705910e230b6Smaya                       __attribute__((unused)) void * restrict dst,
706010e230b6Smaya                       __attribute__((unused)) const struct GEN7_ROW_INSTDONE * restrict values)
706110e230b6Smaya{
706210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
706310e230b6Smaya
706410e230b6Smaya   dw[0] =
706510e230b6Smaya      __gen_uint(values->BCDone, 0, 0) |
706610e230b6Smaya      __gen_uint(values->PSDDone, 1, 1) |
706710e230b6Smaya      __gen_uint(values->DCDone, 2, 2) |
706810e230b6Smaya      __gen_uint(values->DAPRDone, 3, 3) |
706910e230b6Smaya      __gen_uint(values->TDLDone, 6, 6) |
707010e230b6Smaya      __gen_uint(values->GWDone, 8, 8) |
707110e230b6Smaya      __gen_uint(values->ICDone, 12, 12) |
707210e230b6Smaya      __gen_uint(values->EU00DoneSS0, 16, 16) |
707310e230b6Smaya      __gen_uint(values->EU01DoneSS0, 17, 17) |
707410e230b6Smaya      __gen_uint(values->EU02DoneSS0, 18, 18) |
707510e230b6Smaya      __gen_uint(values->EU03DoneSS0, 19, 19) |
707610e230b6Smaya      __gen_uint(values->MA0DoneSS0, 20, 20) |
707710e230b6Smaya      __gen_uint(values->EU10DoneSS0, 21, 21) |
707810e230b6Smaya      __gen_uint(values->EU11DoneSS0, 22, 22) |
707910e230b6Smaya      __gen_uint(values->EU12DoneSS0, 23, 23) |
708010e230b6Smaya      __gen_uint(values->EU13DoneSS0, 24, 24) |
708110e230b6Smaya      __gen_uint(values->MA1Done, 25, 25);
708210e230b6Smaya}
708310e230b6Smaya
708410e230b6Smaya#define GEN7_SAMPLER_INSTDONE_num         0xe160
708510e230b6Smaya#define GEN7_SAMPLER_INSTDONE_length           1
708610e230b6Smayastruct GEN7_SAMPLER_INSTDONE {
708710e230b6Smaya   bool                                 VMEDone;
708810e230b6Smaya   bool                                 PL0Done;
708910e230b6Smaya   bool                                 SO0Done;
709010e230b6Smaya   bool                                 DG0Done;
709110e230b6Smaya   bool                                 FT0Done;
709210e230b6Smaya   bool                                 DM0Done;
709310e230b6Smaya   bool                                 SCDone;
709410e230b6Smaya   bool                                 FL0Done;
709510e230b6Smaya   bool                                 QCDone;
709610e230b6Smaya   bool                                 SVSMDone;
709710e230b6Smaya   bool                                 SI0Done;
709810e230b6Smaya   bool                                 MT0Done;
709910e230b6Smaya   bool                                 AVSDone;
710010e230b6Smaya   bool                                 IEFDone;
710110e230b6Smaya   bool                                 VDIDone;
710210e230b6Smaya   bool                                 SVSMARB3;
710310e230b6Smaya   bool                                 SVSMARB2;
710410e230b6Smaya   bool                                 SVSMARB1;
710510e230b6Smaya   bool                                 SVSMAdapter;
710610e230b6Smaya};
710710e230b6Smaya
710810e230b6Smayastatic inline void
710910e230b6SmayaGEN7_SAMPLER_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
711010e230b6Smaya                           __attribute__((unused)) void * restrict dst,
711110e230b6Smaya                           __attribute__((unused)) const struct GEN7_SAMPLER_INSTDONE * restrict values)
711210e230b6Smaya{
711310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
711410e230b6Smaya
711510e230b6Smaya   dw[0] =
711610e230b6Smaya      __gen_uint(values->VMEDone, 0, 0) |
711710e230b6Smaya      __gen_uint(values->PL0Done, 1, 1) |
711810e230b6Smaya      __gen_uint(values->SO0Done, 2, 2) |
711910e230b6Smaya      __gen_uint(values->DG0Done, 3, 3) |
712010e230b6Smaya      __gen_uint(values->FT0Done, 4, 4) |
712110e230b6Smaya      __gen_uint(values->DM0Done, 5, 5) |
712210e230b6Smaya      __gen_uint(values->SCDone, 6, 6) |
712310e230b6Smaya      __gen_uint(values->FL0Done, 7, 7) |
712410e230b6Smaya      __gen_uint(values->QCDone, 8, 8) |
712510e230b6Smaya      __gen_uint(values->SVSMDone, 9, 9) |
712610e230b6Smaya      __gen_uint(values->SI0Done, 10, 10) |
712710e230b6Smaya      __gen_uint(values->MT0Done, 11, 11) |
712810e230b6Smaya      __gen_uint(values->AVSDone, 12, 12) |
712910e230b6Smaya      __gen_uint(values->IEFDone, 13, 13) |
713010e230b6Smaya      __gen_uint(values->VDIDone, 14, 14) |
713110e230b6Smaya      __gen_uint(values->SVSMARB3, 15, 15) |
713210e230b6Smaya      __gen_uint(values->SVSMARB2, 16, 16) |
713310e230b6Smaya      __gen_uint(values->SVSMARB1, 17, 17) |
713410e230b6Smaya      __gen_uint(values->SVSMAdapter, 18, 18);
713510e230b6Smaya}
713610e230b6Smaya
713710e230b6Smaya#define GEN7_SC_INSTDONE_num              0x7100
713810e230b6Smaya#define GEN7_SC_INSTDONE_length                1
713910e230b6Smayastruct GEN7_SC_INSTDONE {
714010e230b6Smaya   bool                                 SVLDone;
714110e230b6Smaya   bool                                 WMFEDone;
714210e230b6Smaya   bool                                 WMBEDone;
714310e230b6Smaya   bool                                 HIZDone;
714410e230b6Smaya   bool                                 STCDone;
714510e230b6Smaya   bool                                 IZDone;
714610e230b6Smaya   bool                                 SBEDone;
714710e230b6Smaya   bool                                 RCZDone;
714810e230b6Smaya   bool                                 RCCDone;
714910e230b6Smaya   bool                                 RCPBEDone;
715010e230b6Smaya   bool                                 RCPFEDone;
715110e230b6Smaya   bool                                 DAPBDone;
715210e230b6Smaya   bool                                 DAPRBEDone;
715310e230b6Smaya   bool                                 IECPDone;
715410e230b6Smaya   bool                                 SARBDone;
715510e230b6Smaya   bool                                 VSCDone;
715610e230b6Smaya};
715710e230b6Smaya
715810e230b6Smayastatic inline void
715910e230b6SmayaGEN7_SC_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
716010e230b6Smaya                      __attribute__((unused)) void * restrict dst,
716110e230b6Smaya                      __attribute__((unused)) const struct GEN7_SC_INSTDONE * restrict values)
716210e230b6Smaya{
716310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
716410e230b6Smaya
716510e230b6Smaya   dw[0] =
716610e230b6Smaya      __gen_uint(values->SVLDone, 0, 0) |
716710e230b6Smaya      __gen_uint(values->WMFEDone, 1, 1) |
716810e230b6Smaya      __gen_uint(values->WMBEDone, 2, 2) |
716910e230b6Smaya      __gen_uint(values->HIZDone, 3, 3) |
717010e230b6Smaya      __gen_uint(values->STCDone, 4, 4) |
717110e230b6Smaya      __gen_uint(values->IZDone, 5, 5) |
717210e230b6Smaya      __gen_uint(values->SBEDone, 6, 6) |
717310e230b6Smaya      __gen_uint(values->RCZDone, 8, 8) |
717410e230b6Smaya      __gen_uint(values->RCCDone, 9, 9) |
717510e230b6Smaya      __gen_uint(values->RCPBEDone, 10, 10) |
717610e230b6Smaya      __gen_uint(values->RCPFEDone, 11, 11) |
717710e230b6Smaya      __gen_uint(values->DAPBDone, 12, 12) |
717810e230b6Smaya      __gen_uint(values->DAPRBEDone, 13, 13) |
717910e230b6Smaya      __gen_uint(values->IECPDone, 14, 14) |
718010e230b6Smaya      __gen_uint(values->SARBDone, 15, 15) |
718110e230b6Smaya      __gen_uint(values->VSCDone, 16, 16);
718210e230b6Smaya}
718310e230b6Smaya
718410e230b6Smaya#define GEN7_SO_NUM_PRIMS_WRITTEN0_num    0x5200
718510e230b6Smaya#define GEN7_SO_NUM_PRIMS_WRITTEN0_length      2
718610e230b6Smayastruct GEN7_SO_NUM_PRIMS_WRITTEN0 {
718710e230b6Smaya   uint64_t                             NumPrimsWrittenCount;
718810e230b6Smaya};
718910e230b6Smaya
719010e230b6Smayastatic inline void
719110e230b6SmayaGEN7_SO_NUM_PRIMS_WRITTEN0_pack(__attribute__((unused)) __gen_user_data *data,
719210e230b6Smaya                                __attribute__((unused)) void * restrict dst,
719310e230b6Smaya                                __attribute__((unused)) const struct GEN7_SO_NUM_PRIMS_WRITTEN0 * restrict values)
719410e230b6Smaya{
719510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
719610e230b6Smaya
719710e230b6Smaya   const uint64_t v0 =
719810e230b6Smaya      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
719910e230b6Smaya   dw[0] = v0;
720010e230b6Smaya   dw[1] = v0 >> 32;
720110e230b6Smaya}
720210e230b6Smaya
720310e230b6Smaya#define GEN7_SO_NUM_PRIMS_WRITTEN1_num    0x5208
720410e230b6Smaya#define GEN7_SO_NUM_PRIMS_WRITTEN1_length      2
720510e230b6Smayastruct GEN7_SO_NUM_PRIMS_WRITTEN1 {
720610e230b6Smaya   uint64_t                             NumPrimsWrittenCount;
720710e230b6Smaya};
720810e230b6Smaya
720910e230b6Smayastatic inline void
721010e230b6SmayaGEN7_SO_NUM_PRIMS_WRITTEN1_pack(__attribute__((unused)) __gen_user_data *data,
721110e230b6Smaya                                __attribute__((unused)) void * restrict dst,
721210e230b6Smaya                                __attribute__((unused)) const struct GEN7_SO_NUM_PRIMS_WRITTEN1 * restrict values)
721310e230b6Smaya{
721410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
721510e230b6Smaya
721610e230b6Smaya   const uint64_t v0 =
721710e230b6Smaya      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
721810e230b6Smaya   dw[0] = v0;
721910e230b6Smaya   dw[1] = v0 >> 32;
722010e230b6Smaya}
722110e230b6Smaya
722210e230b6Smaya#define GEN7_SO_NUM_PRIMS_WRITTEN2_num    0x5210
722310e230b6Smaya#define GEN7_SO_NUM_PRIMS_WRITTEN2_length      2
722410e230b6Smayastruct GEN7_SO_NUM_PRIMS_WRITTEN2 {
722510e230b6Smaya   uint64_t                             NumPrimsWrittenCount;
722610e230b6Smaya};
722710e230b6Smaya
722810e230b6Smayastatic inline void
722910e230b6SmayaGEN7_SO_NUM_PRIMS_WRITTEN2_pack(__attribute__((unused)) __gen_user_data *data,
723010e230b6Smaya                                __attribute__((unused)) void * restrict dst,
723110e230b6Smaya                                __attribute__((unused)) const struct GEN7_SO_NUM_PRIMS_WRITTEN2 * restrict values)
723210e230b6Smaya{
723310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
723410e230b6Smaya
723510e230b6Smaya   const uint64_t v0 =
723610e230b6Smaya      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
723710e230b6Smaya   dw[0] = v0;
723810e230b6Smaya   dw[1] = v0 >> 32;
723910e230b6Smaya}
724010e230b6Smaya
724110e230b6Smaya#define GEN7_SO_NUM_PRIMS_WRITTEN3_num    0x5218
724210e230b6Smaya#define GEN7_SO_NUM_PRIMS_WRITTEN3_length      2
724310e230b6Smayastruct GEN7_SO_NUM_PRIMS_WRITTEN3 {
724410e230b6Smaya   uint64_t                             NumPrimsWrittenCount;
724510e230b6Smaya};
724610e230b6Smaya
724710e230b6Smayastatic inline void
724810e230b6SmayaGEN7_SO_NUM_PRIMS_WRITTEN3_pack(__attribute__((unused)) __gen_user_data *data,
724910e230b6Smaya                                __attribute__((unused)) void * restrict dst,
725010e230b6Smaya                                __attribute__((unused)) const struct GEN7_SO_NUM_PRIMS_WRITTEN3 * restrict values)
725110e230b6Smaya{
725210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
725310e230b6Smaya
725410e230b6Smaya   const uint64_t v0 =
725510e230b6Smaya      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
725610e230b6Smaya   dw[0] = v0;
725710e230b6Smaya   dw[1] = v0 >> 32;
725810e230b6Smaya}
725910e230b6Smaya
726010e230b6Smaya#define GEN7_SO_PRIM_STORAGE_NEEDED0_num  0x5240
726110e230b6Smaya#define GEN7_SO_PRIM_STORAGE_NEEDED0_length      2
726210e230b6Smayastruct GEN7_SO_PRIM_STORAGE_NEEDED0 {
726310e230b6Smaya   uint64_t                             PrimStorageNeededCount;
726410e230b6Smaya};
726510e230b6Smaya
726610e230b6Smayastatic inline void
726710e230b6SmayaGEN7_SO_PRIM_STORAGE_NEEDED0_pack(__attribute__((unused)) __gen_user_data *data,
726810e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
726910e230b6Smaya                                  __attribute__((unused)) const struct GEN7_SO_PRIM_STORAGE_NEEDED0 * restrict values)
727010e230b6Smaya{
727110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
727210e230b6Smaya
727310e230b6Smaya   const uint64_t v0 =
727410e230b6Smaya      __gen_uint(values->PrimStorageNeededCount, 0, 63);
727510e230b6Smaya   dw[0] = v0;
727610e230b6Smaya   dw[1] = v0 >> 32;
727710e230b6Smaya}
727810e230b6Smaya
727910e230b6Smaya#define GEN7_SO_PRIM_STORAGE_NEEDED1_num  0x5248
728010e230b6Smaya#define GEN7_SO_PRIM_STORAGE_NEEDED1_length      2
728110e230b6Smayastruct GEN7_SO_PRIM_STORAGE_NEEDED1 {
728210e230b6Smaya   uint64_t                             PrimStorageNeededCount;
728310e230b6Smaya};
728410e230b6Smaya
728510e230b6Smayastatic inline void
728610e230b6SmayaGEN7_SO_PRIM_STORAGE_NEEDED1_pack(__attribute__((unused)) __gen_user_data *data,
728710e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
728810e230b6Smaya                                  __attribute__((unused)) const struct GEN7_SO_PRIM_STORAGE_NEEDED1 * restrict values)
728910e230b6Smaya{
729010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
729110e230b6Smaya
729210e230b6Smaya   const uint64_t v0 =
729310e230b6Smaya      __gen_uint(values->PrimStorageNeededCount, 0, 63);
729410e230b6Smaya   dw[0] = v0;
729510e230b6Smaya   dw[1] = v0 >> 32;
729610e230b6Smaya}
729710e230b6Smaya
729810e230b6Smaya#define GEN7_SO_PRIM_STORAGE_NEEDED2_num  0x5250
729910e230b6Smaya#define GEN7_SO_PRIM_STORAGE_NEEDED2_length      2
730010e230b6Smayastruct GEN7_SO_PRIM_STORAGE_NEEDED2 {
730110e230b6Smaya   uint64_t                             PrimStorageNeededCount;
730210e230b6Smaya};
730310e230b6Smaya
730410e230b6Smayastatic inline void
730510e230b6SmayaGEN7_SO_PRIM_STORAGE_NEEDED2_pack(__attribute__((unused)) __gen_user_data *data,
730610e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
730710e230b6Smaya                                  __attribute__((unused)) const struct GEN7_SO_PRIM_STORAGE_NEEDED2 * restrict values)
730810e230b6Smaya{
730910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
731010e230b6Smaya
731110e230b6Smaya   const uint64_t v0 =
731210e230b6Smaya      __gen_uint(values->PrimStorageNeededCount, 0, 63);
731310e230b6Smaya   dw[0] = v0;
731410e230b6Smaya   dw[1] = v0 >> 32;
731510e230b6Smaya}
731610e230b6Smaya
731710e230b6Smaya#define GEN7_SO_PRIM_STORAGE_NEEDED3_num  0x5258
731810e230b6Smaya#define GEN7_SO_PRIM_STORAGE_NEEDED3_length      2
731910e230b6Smayastruct GEN7_SO_PRIM_STORAGE_NEEDED3 {
732010e230b6Smaya   uint64_t                             PrimStorageNeededCount;
732110e230b6Smaya};
732210e230b6Smaya
732310e230b6Smayastatic inline void
732410e230b6SmayaGEN7_SO_PRIM_STORAGE_NEEDED3_pack(__attribute__((unused)) __gen_user_data *data,
732510e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
732610e230b6Smaya                                  __attribute__((unused)) const struct GEN7_SO_PRIM_STORAGE_NEEDED3 * restrict values)
732710e230b6Smaya{
732810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
732910e230b6Smaya
733010e230b6Smaya   const uint64_t v0 =
733110e230b6Smaya      __gen_uint(values->PrimStorageNeededCount, 0, 63);
733210e230b6Smaya   dw[0] = v0;
733310e230b6Smaya   dw[1] = v0 >> 32;
733410e230b6Smaya}
733510e230b6Smaya
733610e230b6Smaya#define GEN7_SO_WRITE_OFFSET0_num         0x5280
733710e230b6Smaya#define GEN7_SO_WRITE_OFFSET0_length           1
733810e230b6Smayastruct GEN7_SO_WRITE_OFFSET0 {
733910e230b6Smaya   uint64_t                             WriteOffset;
734010e230b6Smaya};
734110e230b6Smaya
734210e230b6Smayastatic inline void
734310e230b6SmayaGEN7_SO_WRITE_OFFSET0_pack(__attribute__((unused)) __gen_user_data *data,
734410e230b6Smaya                           __attribute__((unused)) void * restrict dst,
734510e230b6Smaya                           __attribute__((unused)) const struct GEN7_SO_WRITE_OFFSET0 * restrict values)
734610e230b6Smaya{
734710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
734810e230b6Smaya
734910e230b6Smaya   dw[0] =
735010e230b6Smaya      __gen_offset(values->WriteOffset, 2, 31);
735110e230b6Smaya}
735210e230b6Smaya
735310e230b6Smaya#define GEN7_SO_WRITE_OFFSET1_num         0x5284
735410e230b6Smaya#define GEN7_SO_WRITE_OFFSET1_length           1
735510e230b6Smayastruct GEN7_SO_WRITE_OFFSET1 {
735610e230b6Smaya   uint64_t                             WriteOffset;
735710e230b6Smaya};
735810e230b6Smaya
735910e230b6Smayastatic inline void
736010e230b6SmayaGEN7_SO_WRITE_OFFSET1_pack(__attribute__((unused)) __gen_user_data *data,
736110e230b6Smaya                           __attribute__((unused)) void * restrict dst,
736210e230b6Smaya                           __attribute__((unused)) const struct GEN7_SO_WRITE_OFFSET1 * restrict values)
736310e230b6Smaya{
736410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
736510e230b6Smaya
736610e230b6Smaya   dw[0] =
736710e230b6Smaya      __gen_offset(values->WriteOffset, 2, 31);
736810e230b6Smaya}
736910e230b6Smaya
737010e230b6Smaya#define GEN7_SO_WRITE_OFFSET2_num         0x5288
737110e230b6Smaya#define GEN7_SO_WRITE_OFFSET2_length           1
737210e230b6Smayastruct GEN7_SO_WRITE_OFFSET2 {
737310e230b6Smaya   uint64_t                             WriteOffset;
737410e230b6Smaya};
737510e230b6Smaya
737610e230b6Smayastatic inline void
737710e230b6SmayaGEN7_SO_WRITE_OFFSET2_pack(__attribute__((unused)) __gen_user_data *data,
737810e230b6Smaya                           __attribute__((unused)) void * restrict dst,
737910e230b6Smaya                           __attribute__((unused)) const struct GEN7_SO_WRITE_OFFSET2 * restrict values)
738010e230b6Smaya{
738110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
738210e230b6Smaya
738310e230b6Smaya   dw[0] =
738410e230b6Smaya      __gen_offset(values->WriteOffset, 2, 31);
738510e230b6Smaya}
738610e230b6Smaya
738710e230b6Smaya#define GEN7_SO_WRITE_OFFSET3_num         0x528c
738810e230b6Smaya#define GEN7_SO_WRITE_OFFSET3_length           1
738910e230b6Smayastruct GEN7_SO_WRITE_OFFSET3 {
739010e230b6Smaya   uint64_t                             WriteOffset;
739110e230b6Smaya};
739210e230b6Smaya
739310e230b6Smayastatic inline void
739410e230b6SmayaGEN7_SO_WRITE_OFFSET3_pack(__attribute__((unused)) __gen_user_data *data,
739510e230b6Smaya                           __attribute__((unused)) void * restrict dst,
739610e230b6Smaya                           __attribute__((unused)) const struct GEN7_SO_WRITE_OFFSET3 * restrict values)
739710e230b6Smaya{
739810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
739910e230b6Smaya
740010e230b6Smaya   dw[0] =
740110e230b6Smaya      __gen_offset(values->WriteOffset, 2, 31);
740210e230b6Smaya}
740310e230b6Smaya
740410e230b6Smaya#define GEN7_VCS_FAULT_REG_num            0x4194
740510e230b6Smaya#define GEN7_VCS_FAULT_REG_length              1
740610e230b6Smayastruct GEN7_VCS_FAULT_REG {
740710e230b6Smaya   bool                                 ValidBit;
740810e230b6Smaya   uint32_t                             FaultType;
740910e230b6Smaya#define PageFault                                0
741010e230b6Smaya#define InvalidPDFault                           1
741110e230b6Smaya#define UnloadedPDFault                          2
741210e230b6Smaya#define InvalidandUnloadedPDfault                3
741310e230b6Smaya   uint32_t                             SRCIDofFault;
741410e230b6Smaya   uint32_t                             GTTSEL;
741510e230b6Smaya#define PPGTT                                    0
741610e230b6Smaya#define GGTT                                     1
741710e230b6Smaya   __gen_address_type                   VirtualAddressofFault;
741810e230b6Smaya};
741910e230b6Smaya
742010e230b6Smayastatic inline void
742110e230b6SmayaGEN7_VCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
742210e230b6Smaya                        __attribute__((unused)) void * restrict dst,
742310e230b6Smaya                        __attribute__((unused)) const struct GEN7_VCS_FAULT_REG * restrict values)
742410e230b6Smaya{
742510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
742610e230b6Smaya
742710e230b6Smaya   const uint32_t v0 =
742810e230b6Smaya      __gen_uint(values->ValidBit, 0, 0) |
742910e230b6Smaya      __gen_uint(values->FaultType, 1, 2) |
743010e230b6Smaya      __gen_uint(values->SRCIDofFault, 3, 10) |
743110e230b6Smaya      __gen_uint(values->GTTSEL, 11, 11);
743210e230b6Smaya   dw[0] = __gen_combine_address(data, &dw[0], values->VirtualAddressofFault, v0);
743310e230b6Smaya}
743410e230b6Smaya
743510e230b6Smaya#define GEN7_VCS_INSTDONE_num             0x1206c
743610e230b6Smaya#define GEN7_VCS_INSTDONE_length               1
743710e230b6Smayastruct GEN7_VCS_INSTDONE {
743810e230b6Smaya   bool                                 RingEnable;
743910e230b6Smaya   bool                                 USBDone;
744010e230b6Smaya   bool                                 QRCDone;
744110e230b6Smaya   bool                                 SECDone;
744210e230b6Smaya   bool                                 MPCDone;
744310e230b6Smaya   bool                                 VFTDone;
744410e230b6Smaya   bool                                 BSPDone;
744510e230b6Smaya   bool                                 VLFDone;
744610e230b6Smaya   bool                                 VOPDone;
744710e230b6Smaya   bool                                 VMCDone;
744810e230b6Smaya   bool                                 VIPDone;
744910e230b6Smaya   bool                                 VITDone;
745010e230b6Smaya   bool                                 VDSDone;
745110e230b6Smaya   bool                                 VMXDone;
745210e230b6Smaya   bool                                 VCPDone;
745310e230b6Smaya   bool                                 VCDDone;
745410e230b6Smaya   bool                                 VADDone;
745510e230b6Smaya   bool                                 VMDDone;
745610e230b6Smaya   bool                                 VISDone;
745710e230b6Smaya   bool                                 VACDone;
745810e230b6Smaya   bool                                 VAMDone;
745910e230b6Smaya   bool                                 JPGDone;
746010e230b6Smaya   bool                                 VBPDone;
746110e230b6Smaya   bool                                 VHRDone;
746210e230b6Smaya   bool                                 VCIDone;
746310e230b6Smaya   bool                                 VCRDone;
746410e230b6Smaya   bool                                 VINDone;
746510e230b6Smaya   bool                                 VPRDone;
746610e230b6Smaya   bool                                 VTQDone;
746710e230b6Smaya   bool                                 VCSDone;
746810e230b6Smaya   bool                                 GACDone;
746910e230b6Smaya};
747010e230b6Smaya
747110e230b6Smayastatic inline void
747210e230b6SmayaGEN7_VCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
747310e230b6Smaya                       __attribute__((unused)) void * restrict dst,
747410e230b6Smaya                       __attribute__((unused)) const struct GEN7_VCS_INSTDONE * restrict values)
747510e230b6Smaya{
747610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
747710e230b6Smaya
747810e230b6Smaya   dw[0] =
747910e230b6Smaya      __gen_uint(values->RingEnable, 0, 0) |
748010e230b6Smaya      __gen_uint(values->USBDone, 1, 1) |
748110e230b6Smaya      __gen_uint(values->QRCDone, 2, 2) |
748210e230b6Smaya      __gen_uint(values->SECDone, 3, 3) |
748310e230b6Smaya      __gen_uint(values->MPCDone, 4, 4) |
748410e230b6Smaya      __gen_uint(values->VFTDone, 5, 5) |
748510e230b6Smaya      __gen_uint(values->BSPDone, 6, 6) |
748610e230b6Smaya      __gen_uint(values->VLFDone, 7, 7) |
748710e230b6Smaya      __gen_uint(values->VOPDone, 8, 8) |
748810e230b6Smaya      __gen_uint(values->VMCDone, 9, 9) |
748910e230b6Smaya      __gen_uint(values->VIPDone, 10, 10) |
749010e230b6Smaya      __gen_uint(values->VITDone, 11, 11) |
749110e230b6Smaya      __gen_uint(values->VDSDone, 12, 12) |
749210e230b6Smaya      __gen_uint(values->VMXDone, 13, 13) |
749310e230b6Smaya      __gen_uint(values->VCPDone, 14, 14) |
749410e230b6Smaya      __gen_uint(values->VCDDone, 15, 15) |
749510e230b6Smaya      __gen_uint(values->VADDone, 16, 16) |
749610e230b6Smaya      __gen_uint(values->VMDDone, 17, 17) |
749710e230b6Smaya      __gen_uint(values->VISDone, 18, 18) |
749810e230b6Smaya      __gen_uint(values->VACDone, 19, 19) |
749910e230b6Smaya      __gen_uint(values->VAMDone, 20, 20) |
750010e230b6Smaya      __gen_uint(values->JPGDone, 21, 21) |
750110e230b6Smaya      __gen_uint(values->VBPDone, 22, 22) |
750210e230b6Smaya      __gen_uint(values->VHRDone, 23, 23) |
750310e230b6Smaya      __gen_uint(values->VCIDone, 24, 24) |
750410e230b6Smaya      __gen_uint(values->VCRDone, 25, 25) |
750510e230b6Smaya      __gen_uint(values->VINDone, 26, 26) |
750610e230b6Smaya      __gen_uint(values->VPRDone, 27, 27) |
750710e230b6Smaya      __gen_uint(values->VTQDone, 28, 28) |
750810e230b6Smaya      __gen_uint(values->VCSDone, 30, 30) |
750910e230b6Smaya      __gen_uint(values->GACDone, 31, 31);
751010e230b6Smaya}
751110e230b6Smaya
751210e230b6Smaya#define GEN7_VCS_RING_BUFFER_CTL_num      0x1203c
751310e230b6Smaya#define GEN7_VCS_RING_BUFFER_CTL_length        1
751410e230b6Smayastruct GEN7_VCS_RING_BUFFER_CTL {
751510e230b6Smaya   bool                                 RingBufferEnable;
751610e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
751710e230b6Smaya#define MI_AUTOREPORT_OFF                        0
751810e230b6Smaya#define MI_AUTOREPORT_64KB                       1
751910e230b6Smaya#define MI_AUTOREPORT_4KB                        2
752010e230b6Smaya#define MI_AUTOREPORT_128KB                      3
752110e230b6Smaya   bool                                 DisableRegisterAccesses;
752210e230b6Smaya   bool                                 SemaphoreWait;
752310e230b6Smaya   bool                                 RBWait;
752410e230b6Smaya   uint32_t                             BufferLengthinpages1;
752510e230b6Smaya};
752610e230b6Smaya
752710e230b6Smayastatic inline void
752810e230b6SmayaGEN7_VCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
752910e230b6Smaya                              __attribute__((unused)) void * restrict dst,
753010e230b6Smaya                              __attribute__((unused)) const struct GEN7_VCS_RING_BUFFER_CTL * restrict values)
753110e230b6Smaya{
753210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
753310e230b6Smaya
753410e230b6Smaya   dw[0] =
753510e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
753610e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
753710e230b6Smaya      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
753810e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
753910e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
754010e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
754110e230b6Smaya}
754210e230b6Smaya
754310e230b6Smaya#define GEN7_VS_INVOCATION_COUNT_num      0x2320
754410e230b6Smaya#define GEN7_VS_INVOCATION_COUNT_length        2
754510e230b6Smayastruct GEN7_VS_INVOCATION_COUNT {
754610e230b6Smaya   uint64_t                             VSInvocationCountReport;
754710e230b6Smaya};
754810e230b6Smaya
754910e230b6Smayastatic inline void
755010e230b6SmayaGEN7_VS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
755110e230b6Smaya                              __attribute__((unused)) void * restrict dst,
755210e230b6Smaya                              __attribute__((unused)) const struct GEN7_VS_INVOCATION_COUNT * restrict values)
755310e230b6Smaya{
755410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
755510e230b6Smaya
755610e230b6Smaya   const uint64_t v0 =
755710e230b6Smaya      __gen_uint(values->VSInvocationCountReport, 0, 63);
755810e230b6Smaya   dw[0] = v0;
755910e230b6Smaya   dw[1] = v0 >> 32;
756010e230b6Smaya}
756110e230b6Smaya
756210e230b6Smaya#endif /* GEN7_PACK_H */
7563