gen6_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 SNB.
2610e230b6Smaya *
2710e230b6Smaya * This file has been generated, do not hand edit.
2810e230b6Smaya */
2910e230b6Smaya
3010e230b6Smaya#ifndef GEN6_PACK_H
3110e230b6Smaya#define GEN6_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 GEN6_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 GEN6_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 GEN6_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 GEN6_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 GEN6_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};
25210e230b6Smaya
25310e230b6Smayaenum GEN6_3D_Stencil_Operation {
25410e230b6Smaya   STENCILOP_KEEP                       =      0,
25510e230b6Smaya   STENCILOP_ZERO                       =      1,
25610e230b6Smaya   STENCILOP_REPLACE                    =      2,
25710e230b6Smaya   STENCILOP_INCRSAT                    =      3,
25810e230b6Smaya   STENCILOP_DECRSAT                    =      4,
25910e230b6Smaya   STENCILOP_INCR                       =      5,
26010e230b6Smaya   STENCILOP_DECR                       =      6,
26110e230b6Smaya   STENCILOP_INVERT                     =      7,
26210e230b6Smaya};
26310e230b6Smaya
26410e230b6Smayaenum GEN6_3D_Vertex_Component_Control {
26510e230b6Smaya   VFCOMP_NOSTORE                       =      0,
26610e230b6Smaya   VFCOMP_STORE_SRC                     =      1,
26710e230b6Smaya   VFCOMP_STORE_0                       =      2,
26810e230b6Smaya   VFCOMP_STORE_1_FP                    =      3,
26910e230b6Smaya   VFCOMP_STORE_1_INT                   =      4,
27010e230b6Smaya   VFCOMP_STORE_VID                     =      5,
27110e230b6Smaya   VFCOMP_STORE_IID                     =      6,
27210e230b6Smaya   VFCOMP_STORE_PID                     =      7,
27310e230b6Smaya};
27410e230b6Smaya
27510e230b6Smayaenum GEN6_TextureCoordinateMode {
27610e230b6Smaya   TCM_WRAP                             =      0,
27710e230b6Smaya   TCM_MIRROR                           =      1,
27810e230b6Smaya   TCM_CLAMP                            =      2,
27910e230b6Smaya   TCM_CUBE                             =      3,
28010e230b6Smaya   TCM_CLAMP_BORDER                     =      4,
28110e230b6Smaya   TCM_MIRROR_ONCE                      =      5,
28210e230b6Smaya};
28310e230b6Smaya
28410e230b6Smaya#define GEN6_3DSTATE_CONSTANT_BODY_length      4
28510e230b6Smayastruct GEN6_3DSTATE_CONSTANT_BODY {
28610e230b6Smaya   uint32_t                             ConstantBuffer0ReadLength;
28710e230b6Smaya   uint64_t                             PointertoConstantBuffer0;
28810e230b6Smaya   uint32_t                             ConstantBuffer1ReadLength;
28910e230b6Smaya   __gen_address_type                   PointertoConstantBuffer1;
29010e230b6Smaya   uint32_t                             ConstantBuffer2ReadLength;
29110e230b6Smaya   __gen_address_type                   PointertoConstantBuffer2;
29210e230b6Smaya   uint32_t                             ConstantBuffer3ReadLength;
29310e230b6Smaya   __gen_address_type                   PointertoConstantBuffer3;
29410e230b6Smaya};
29510e230b6Smaya
29610e230b6Smayastatic inline void
29710e230b6SmayaGEN6_3DSTATE_CONSTANT_BODY_pack(__attribute__((unused)) __gen_user_data *data,
29810e230b6Smaya                                __attribute__((unused)) void * restrict dst,
29910e230b6Smaya                                __attribute__((unused)) const struct GEN6_3DSTATE_CONSTANT_BODY * restrict values)
30010e230b6Smaya{
30110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
30210e230b6Smaya
30310e230b6Smaya   dw[0] =
30410e230b6Smaya      __gen_uint(values->ConstantBuffer0ReadLength, 0, 4) |
30510e230b6Smaya      __gen_offset(values->PointertoConstantBuffer0, 5, 31);
30610e230b6Smaya
30710e230b6Smaya   const uint32_t v1 =
30810e230b6Smaya      __gen_uint(values->ConstantBuffer1ReadLength, 0, 4);
30910e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->PointertoConstantBuffer1, v1);
31010e230b6Smaya
31110e230b6Smaya   const uint32_t v2 =
31210e230b6Smaya      __gen_uint(values->ConstantBuffer2ReadLength, 0, 4);
31310e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->PointertoConstantBuffer2, v2);
31410e230b6Smaya
31510e230b6Smaya   const uint32_t v3 =
31610e230b6Smaya      __gen_uint(values->ConstantBuffer3ReadLength, 0, 4);
31710e230b6Smaya   dw[3] = __gen_combine_address(data, &dw[3], values->PointertoConstantBuffer3, v3);
31810e230b6Smaya}
31910e230b6Smaya
32010e230b6Smaya#define GEN6_BINDING_TABLE_STATE_length        1
32110e230b6Smayastruct GEN6_BINDING_TABLE_STATE {
32210e230b6Smaya   uint64_t                             SurfaceStatePointer;
32310e230b6Smaya};
32410e230b6Smaya
32510e230b6Smayastatic inline void
32610e230b6SmayaGEN6_BINDING_TABLE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
32710e230b6Smaya                              __attribute__((unused)) void * restrict dst,
32810e230b6Smaya                              __attribute__((unused)) const struct GEN6_BINDING_TABLE_STATE * restrict values)
32910e230b6Smaya{
33010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
33110e230b6Smaya
33210e230b6Smaya   dw[0] =
33310e230b6Smaya      __gen_offset(values->SurfaceStatePointer, 5, 31);
33410e230b6Smaya}
33510e230b6Smaya
33610e230b6Smaya#define GEN6_BLEND_STATE_ENTRY_length          2
33710e230b6Smayastruct GEN6_BLEND_STATE_ENTRY {
33810e230b6Smaya   enum GEN6_3D_Color_Buffer_Blend_Factor DestinationBlendFactor;
33910e230b6Smaya   enum GEN6_3D_Color_Buffer_Blend_Factor SourceBlendFactor;
34010e230b6Smaya   enum GEN6_3D_Color_Buffer_Blend_Function ColorBlendFunction;
34110e230b6Smaya   enum GEN6_3D_Color_Buffer_Blend_Factor DestinationAlphaBlendFactor;
34210e230b6Smaya   enum GEN6_3D_Color_Buffer_Blend_Factor SourceAlphaBlendFactor;
34310e230b6Smaya   enum GEN6_3D_Color_Buffer_Blend_Function AlphaBlendFunction;
34410e230b6Smaya   bool                                 IndependentAlphaBlendEnable;
34510e230b6Smaya   bool                                 ColorBufferBlendEnable;
34610e230b6Smaya   bool                                 PostBlendColorClampEnable;
34710e230b6Smaya   bool                                 PreBlendColorClampEnable;
34810e230b6Smaya   uint32_t                             ColorClampRange;
34910e230b6Smaya#define COLORCLAMP_UNORM                         0
35010e230b6Smaya#define COLORCLAMP_SNORM                         1
35110e230b6Smaya#define COLORCLAMP_RTFORMAT                      2
35210e230b6Smaya   uint32_t                             YDitherOffset;
35310e230b6Smaya   uint32_t                             XDitherOffset;
35410e230b6Smaya   bool                                 ColorDitherEnable;
35510e230b6Smaya   enum GEN6_3D_Compare_Function        AlphaTestFunction;
35610e230b6Smaya   bool                                 AlphaTestEnable;
35710e230b6Smaya   enum GEN6_3D_Logic_Op_Function       LogicOpFunction;
35810e230b6Smaya   bool                                 LogicOpEnable;
35910e230b6Smaya   bool                                 WriteDisableBlue;
36010e230b6Smaya   bool                                 WriteDisableGreen;
36110e230b6Smaya   bool                                 WriteDisableRed;
36210e230b6Smaya   bool                                 WriteDisableAlpha;
36310e230b6Smaya   bool                                 AlphaToCoverageDitherEnable;
36410e230b6Smaya   bool                                 AlphaToOneEnable;
36510e230b6Smaya   bool                                 AlphaToCoverageEnable;
36610e230b6Smaya};
36710e230b6Smaya
36810e230b6Smayastatic inline void
36910e230b6SmayaGEN6_BLEND_STATE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
37010e230b6Smaya                            __attribute__((unused)) void * restrict dst,
37110e230b6Smaya                            __attribute__((unused)) const struct GEN6_BLEND_STATE_ENTRY * restrict values)
37210e230b6Smaya{
37310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
37410e230b6Smaya
37510e230b6Smaya   dw[0] =
37610e230b6Smaya      __gen_uint(values->DestinationBlendFactor, 0, 4) |
37710e230b6Smaya      __gen_uint(values->SourceBlendFactor, 5, 9) |
37810e230b6Smaya      __gen_uint(values->ColorBlendFunction, 11, 13) |
37910e230b6Smaya      __gen_uint(values->DestinationAlphaBlendFactor, 15, 19) |
38010e230b6Smaya      __gen_uint(values->SourceAlphaBlendFactor, 20, 24) |
38110e230b6Smaya      __gen_uint(values->AlphaBlendFunction, 26, 28) |
38210e230b6Smaya      __gen_uint(values->IndependentAlphaBlendEnable, 30, 30) |
38310e230b6Smaya      __gen_uint(values->ColorBufferBlendEnable, 31, 31);
38410e230b6Smaya
38510e230b6Smaya   dw[1] =
38610e230b6Smaya      __gen_uint(values->PostBlendColorClampEnable, 0, 0) |
38710e230b6Smaya      __gen_uint(values->PreBlendColorClampEnable, 1, 1) |
38810e230b6Smaya      __gen_uint(values->ColorClampRange, 2, 3) |
38910e230b6Smaya      __gen_uint(values->YDitherOffset, 8, 9) |
39010e230b6Smaya      __gen_uint(values->XDitherOffset, 10, 11) |
39110e230b6Smaya      __gen_uint(values->ColorDitherEnable, 12, 12) |
39210e230b6Smaya      __gen_uint(values->AlphaTestFunction, 13, 15) |
39310e230b6Smaya      __gen_uint(values->AlphaTestEnable, 16, 16) |
39410e230b6Smaya      __gen_uint(values->LogicOpFunction, 18, 21) |
39510e230b6Smaya      __gen_uint(values->LogicOpEnable, 22, 22) |
39610e230b6Smaya      __gen_uint(values->WriteDisableBlue, 24, 24) |
39710e230b6Smaya      __gen_uint(values->WriteDisableGreen, 25, 25) |
39810e230b6Smaya      __gen_uint(values->WriteDisableRed, 26, 26) |
39910e230b6Smaya      __gen_uint(values->WriteDisableAlpha, 27, 27) |
40010e230b6Smaya      __gen_uint(values->AlphaToCoverageDitherEnable, 29, 29) |
40110e230b6Smaya      __gen_uint(values->AlphaToOneEnable, 30, 30) |
40210e230b6Smaya      __gen_uint(values->AlphaToCoverageEnable, 31, 31);
40310e230b6Smaya}
40410e230b6Smaya
40510e230b6Smaya#define GEN6_BLEND_STATE_length                0
40610e230b6Smayastruct GEN6_BLEND_STATE {
40710e230b6Smaya   /* variable length fields follow */
40810e230b6Smaya};
40910e230b6Smaya
41010e230b6Smayastatic inline void
41110e230b6SmayaGEN6_BLEND_STATE_pack(__attribute__((unused)) __gen_user_data *data,
41210e230b6Smaya                      __attribute__((unused)) void * restrict dst,
41310e230b6Smaya                      __attribute__((unused)) const struct GEN6_BLEND_STATE * restrict values)
41410e230b6Smaya{
41510e230b6Smaya}
41610e230b6Smaya
41710e230b6Smaya#define GEN6_CC_VIEWPORT_length                2
41810e230b6Smayastruct GEN6_CC_VIEWPORT {
41910e230b6Smaya   float                                MinimumDepth;
42010e230b6Smaya   float                                MaximumDepth;
42110e230b6Smaya};
42210e230b6Smaya
42310e230b6Smayastatic inline void
42410e230b6SmayaGEN6_CC_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
42510e230b6Smaya                      __attribute__((unused)) void * restrict dst,
42610e230b6Smaya                      __attribute__((unused)) const struct GEN6_CC_VIEWPORT * restrict values)
42710e230b6Smaya{
42810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
42910e230b6Smaya
43010e230b6Smaya   dw[0] =
43110e230b6Smaya      __gen_float(values->MinimumDepth);
43210e230b6Smaya
43310e230b6Smaya   dw[1] =
43410e230b6Smaya      __gen_float(values->MaximumDepth);
43510e230b6Smaya}
43610e230b6Smaya
43710e230b6Smaya#define GEN6_CLIP_VIEWPORT_length              4
43810e230b6Smayastruct GEN6_CLIP_VIEWPORT {
43910e230b6Smaya   float                                XMinClipGuardband;
44010e230b6Smaya   float                                XMaxClipGuardband;
44110e230b6Smaya   float                                YMinClipGuardband;
44210e230b6Smaya   float                                YMaxClipGuardband;
44310e230b6Smaya};
44410e230b6Smaya
44510e230b6Smayastatic inline void
44610e230b6SmayaGEN6_CLIP_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
44710e230b6Smaya                        __attribute__((unused)) void * restrict dst,
44810e230b6Smaya                        __attribute__((unused)) const struct GEN6_CLIP_VIEWPORT * restrict values)
44910e230b6Smaya{
45010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
45110e230b6Smaya
45210e230b6Smaya   dw[0] =
45310e230b6Smaya      __gen_float(values->XMinClipGuardband);
45410e230b6Smaya
45510e230b6Smaya   dw[1] =
45610e230b6Smaya      __gen_float(values->XMaxClipGuardband);
45710e230b6Smaya
45810e230b6Smaya   dw[2] =
45910e230b6Smaya      __gen_float(values->YMinClipGuardband);
46010e230b6Smaya
46110e230b6Smaya   dw[3] =
46210e230b6Smaya      __gen_float(values->YMaxClipGuardband);
46310e230b6Smaya}
46410e230b6Smaya
46510e230b6Smaya#define GEN6_COLOR_CALC_STATE_length           6
46610e230b6Smayastruct GEN6_COLOR_CALC_STATE {
46710e230b6Smaya   uint32_t                             AlphaTestFormat;
46810e230b6Smaya#define ALPHATEST_UNORM8                         0
46910e230b6Smaya#define ALPHATEST_FLOAT32                        1
47010e230b6Smaya   bool                                 RoundDisableFunctionDisable;
47110e230b6Smaya   uint32_t                             BackfaceStencilReferenceValue;
47210e230b6Smaya   uint32_t                             StencilReferenceValue;
47310e230b6Smaya   uint32_t                             AlphaReferenceValueAsUNORM8;
47410e230b6Smaya   float                                AlphaReferenceValueAsFLOAT32;
47510e230b6Smaya   float                                BlendConstantColorRed;
47610e230b6Smaya   float                                BlendConstantColorGreen;
47710e230b6Smaya   float                                BlendConstantColorBlue;
47810e230b6Smaya   float                                BlendConstantColorAlpha;
47910e230b6Smaya};
48010e230b6Smaya
48110e230b6Smayastatic inline void
48210e230b6SmayaGEN6_COLOR_CALC_STATE_pack(__attribute__((unused)) __gen_user_data *data,
48310e230b6Smaya                           __attribute__((unused)) void * restrict dst,
48410e230b6Smaya                           __attribute__((unused)) const struct GEN6_COLOR_CALC_STATE * restrict values)
48510e230b6Smaya{
48610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
48710e230b6Smaya
48810e230b6Smaya   dw[0] =
48910e230b6Smaya      __gen_uint(values->AlphaTestFormat, 0, 0) |
49010e230b6Smaya      __gen_uint(values->RoundDisableFunctionDisable, 15, 15) |
49110e230b6Smaya      __gen_uint(values->BackfaceStencilReferenceValue, 16, 23) |
49210e230b6Smaya      __gen_uint(values->StencilReferenceValue, 24, 31);
49310e230b6Smaya
49410e230b6Smaya   dw[1] =
49510e230b6Smaya      __gen_uint(values->AlphaReferenceValueAsUNORM8, 0, 31) |
49610e230b6Smaya      __gen_float(values->AlphaReferenceValueAsFLOAT32);
49710e230b6Smaya
49810e230b6Smaya   dw[2] =
49910e230b6Smaya      __gen_float(values->BlendConstantColorRed);
50010e230b6Smaya
50110e230b6Smaya   dw[3] =
50210e230b6Smaya      __gen_float(values->BlendConstantColorGreen);
50310e230b6Smaya
50410e230b6Smaya   dw[4] =
50510e230b6Smaya      __gen_float(values->BlendConstantColorBlue);
50610e230b6Smaya
50710e230b6Smaya   dw[5] =
50810e230b6Smaya      __gen_float(values->BlendConstantColorAlpha);
50910e230b6Smaya}
51010e230b6Smaya
51110e230b6Smaya#define GEN6_DEPTH_STENCIL_STATE_length        3
51210e230b6Smayastruct GEN6_DEPTH_STENCIL_STATE {
51310e230b6Smaya   enum GEN6_3D_Stencil_Operation       BackfaceStencilPassDepthPassOp;
51410e230b6Smaya   enum GEN6_3D_Stencil_Operation       BackfaceStencilPassDepthFailOp;
51510e230b6Smaya   enum GEN6_3D_Stencil_Operation       BackfaceStencilFailOp;
51610e230b6Smaya   enum GEN6_3D_Compare_Function        BackfaceStencilTestFunction;
51710e230b6Smaya   bool                                 DoubleSidedStencilEnable;
51810e230b6Smaya   bool                                 StencilBufferWriteEnable;
51910e230b6Smaya   enum GEN6_3D_Stencil_Operation       StencilPassDepthPassOp;
52010e230b6Smaya   enum GEN6_3D_Stencil_Operation       StencilPassDepthFailOp;
52110e230b6Smaya   enum GEN6_3D_Stencil_Operation       StencilFailOp;
52210e230b6Smaya   enum GEN6_3D_Compare_Function        StencilTestFunction;
52310e230b6Smaya   bool                                 StencilTestEnable;
52410e230b6Smaya   uint32_t                             BackfaceStencilWriteMask;
52510e230b6Smaya   uint32_t                             BackfaceStencilTestMask;
52610e230b6Smaya   uint32_t                             StencilWriteMask;
52710e230b6Smaya   uint32_t                             StencilTestMask;
52810e230b6Smaya   bool                                 DepthBufferWriteEnable;
52910e230b6Smaya   enum GEN6_3D_Compare_Function        DepthTestFunction;
53010e230b6Smaya   bool                                 DepthTestEnable;
53110e230b6Smaya};
53210e230b6Smaya
53310e230b6Smayastatic inline void
53410e230b6SmayaGEN6_DEPTH_STENCIL_STATE_pack(__attribute__((unused)) __gen_user_data *data,
53510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
53610e230b6Smaya                              __attribute__((unused)) const struct GEN6_DEPTH_STENCIL_STATE * restrict values)
53710e230b6Smaya{
53810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
53910e230b6Smaya
54010e230b6Smaya   dw[0] =
54110e230b6Smaya      __gen_uint(values->BackfaceStencilPassDepthPassOp, 3, 5) |
54210e230b6Smaya      __gen_uint(values->BackfaceStencilPassDepthFailOp, 6, 8) |
54310e230b6Smaya      __gen_uint(values->BackfaceStencilFailOp, 9, 11) |
54410e230b6Smaya      __gen_uint(values->BackfaceStencilTestFunction, 12, 14) |
54510e230b6Smaya      __gen_uint(values->DoubleSidedStencilEnable, 15, 15) |
54610e230b6Smaya      __gen_uint(values->StencilBufferWriteEnable, 18, 18) |
54710e230b6Smaya      __gen_uint(values->StencilPassDepthPassOp, 19, 21) |
54810e230b6Smaya      __gen_uint(values->StencilPassDepthFailOp, 22, 24) |
54910e230b6Smaya      __gen_uint(values->StencilFailOp, 25, 27) |
55010e230b6Smaya      __gen_uint(values->StencilTestFunction, 28, 30) |
55110e230b6Smaya      __gen_uint(values->StencilTestEnable, 31, 31);
55210e230b6Smaya
55310e230b6Smaya   dw[1] =
55410e230b6Smaya      __gen_uint(values->BackfaceStencilWriteMask, 0, 7) |
55510e230b6Smaya      __gen_uint(values->BackfaceStencilTestMask, 8, 15) |
55610e230b6Smaya      __gen_uint(values->StencilWriteMask, 16, 23) |
55710e230b6Smaya      __gen_uint(values->StencilTestMask, 24, 31);
55810e230b6Smaya
55910e230b6Smaya   dw[2] =
56010e230b6Smaya      __gen_uint(values->DepthBufferWriteEnable, 26, 26) |
56110e230b6Smaya      __gen_uint(values->DepthTestFunction, 27, 29) |
56210e230b6Smaya      __gen_uint(values->DepthTestEnable, 31, 31);
56310e230b6Smaya}
56410e230b6Smaya
56510e230b6Smaya#define GEN6_INTERFACE_DESCRIPTOR_DATA_length      8
56610e230b6Smayastruct GEN6_INTERFACE_DESCRIPTOR_DATA {
56710e230b6Smaya   uint64_t                             KernelStartPointer;
56810e230b6Smaya   bool                                 SoftwareExceptionEnable;
56910e230b6Smaya   bool                                 MaskStackExceptionEnable;
57010e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
57110e230b6Smaya   uint32_t                             FloatingPointMode;
57210e230b6Smaya#define IEEE754                                  0
57310e230b6Smaya#define Alternate                                1
57410e230b6Smaya   uint32_t                             ThreadPriority;
57510e230b6Smaya#define NormalPriority                           0
57610e230b6Smaya#define HighPriority                             1
57710e230b6Smaya   bool                                 SingleProgramFlow;
57810e230b6Smaya   uint32_t                             SamplerCount;
57910e230b6Smaya#define Nosamplersused                           0
58010e230b6Smaya#define Between1and4samplersused                 1
58110e230b6Smaya#define Between5and8samplersused                 2
58210e230b6Smaya#define Between9and12samplersused                3
58310e230b6Smaya#define Between13and16samplersused               4
58410e230b6Smaya   uint64_t                             SamplerStatePointer;
58510e230b6Smaya   uint32_t                             BindingTableEntryCount;
58610e230b6Smaya   uint64_t                             BindingTablePointer;
58710e230b6Smaya   uint32_t                             ConstantURBEntryReadOffset;
58810e230b6Smaya   uint32_t                             ConstantURBEntryReadLength;
58910e230b6Smaya   uint32_t                             BarrierID;
59010e230b6Smaya   uint32_t                             BarrierReturnByte;
59110e230b6Smaya   uint32_t                             BarrierReturnGRFOffset;
59210e230b6Smaya};
59310e230b6Smaya
59410e230b6Smayastatic inline void
59510e230b6SmayaGEN6_INTERFACE_DESCRIPTOR_DATA_pack(__attribute__((unused)) __gen_user_data *data,
59610e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
59710e230b6Smaya                                    __attribute__((unused)) const struct GEN6_INTERFACE_DESCRIPTOR_DATA * restrict values)
59810e230b6Smaya{
59910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
60010e230b6Smaya
60110e230b6Smaya   dw[0] =
60210e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 31);
60310e230b6Smaya
60410e230b6Smaya   dw[1] =
60510e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
60610e230b6Smaya      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
60710e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
60810e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
60910e230b6Smaya      __gen_uint(values->ThreadPriority, 17, 17) |
61010e230b6Smaya      __gen_uint(values->SingleProgramFlow, 18, 18);
61110e230b6Smaya
61210e230b6Smaya   dw[2] =
61310e230b6Smaya      __gen_uint(values->SamplerCount, 2, 4) |
61410e230b6Smaya      __gen_offset(values->SamplerStatePointer, 5, 31);
61510e230b6Smaya
61610e230b6Smaya   dw[3] =
61710e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 0, 4) |
61810e230b6Smaya      __gen_offset(values->BindingTablePointer, 5, 31);
61910e230b6Smaya
62010e230b6Smaya   dw[4] =
62110e230b6Smaya      __gen_uint(values->ConstantURBEntryReadOffset, 0, 15) |
62210e230b6Smaya      __gen_uint(values->ConstantURBEntryReadLength, 16, 31);
62310e230b6Smaya
62410e230b6Smaya   dw[5] =
62510e230b6Smaya      __gen_uint(values->BarrierID, 0, 3) |
62610e230b6Smaya      __gen_uint(values->BarrierReturnByte, 8, 15) |
62710e230b6Smaya      __gen_uint(values->BarrierReturnGRFOffset, 24, 31);
62810e230b6Smaya
62910e230b6Smaya   dw[6] = 0;
63010e230b6Smaya
63110e230b6Smaya   dw[7] = 0;
63210e230b6Smaya}
63310e230b6Smaya
63410e230b6Smaya#define GEN6_MEMORY_OBJECT_CONTROL_STATE_length      1
63510e230b6Smayastruct GEN6_MEMORY_OBJECT_CONTROL_STATE {
63610e230b6Smaya   uint32_t                             CacheabilityControl;
63710e230b6Smaya   uint32_t                             GraphicsDataTypeGFDT;
63810e230b6Smaya};
63910e230b6Smaya
64010e230b6Smayastatic inline void
64110e230b6SmayaGEN6_MEMORY_OBJECT_CONTROL_STATE_pack(__attribute__((unused)) __gen_user_data *data,
64210e230b6Smaya                                      __attribute__((unused)) void * restrict dst,
64310e230b6Smaya                                      __attribute__((unused)) const struct GEN6_MEMORY_OBJECT_CONTROL_STATE * restrict values)
64410e230b6Smaya{
64510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
64610e230b6Smaya
64710e230b6Smaya   dw[0] =
64810e230b6Smaya      __gen_uint(values->CacheabilityControl, 0, 1) |
64910e230b6Smaya      __gen_uint(values->GraphicsDataTypeGFDT, 2, 2);
65010e230b6Smaya}
65110e230b6Smaya
65210e230b6Smaya#define GEN6_PALETTE_ENTRY_length              1
65310e230b6Smayastruct GEN6_PALETTE_ENTRY {
65410e230b6Smaya   uint32_t                             Blue;
65510e230b6Smaya   uint32_t                             Green;
65610e230b6Smaya   uint32_t                             Red;
65710e230b6Smaya   uint32_t                             Alpha;
65810e230b6Smaya};
65910e230b6Smaya
66010e230b6Smayastatic inline void
66110e230b6SmayaGEN6_PALETTE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
66210e230b6Smaya                        __attribute__((unused)) void * restrict dst,
66310e230b6Smaya                        __attribute__((unused)) const struct GEN6_PALETTE_ENTRY * restrict values)
66410e230b6Smaya{
66510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
66610e230b6Smaya
66710e230b6Smaya   dw[0] =
66810e230b6Smaya      __gen_uint(values->Blue, 0, 7) |
66910e230b6Smaya      __gen_uint(values->Green, 8, 15) |
67010e230b6Smaya      __gen_uint(values->Red, 16, 23) |
67110e230b6Smaya      __gen_uint(values->Alpha, 24, 31);
67210e230b6Smaya}
67310e230b6Smaya
67410e230b6Smaya#define GEN6_RENDER_SURFACE_STATE_length       6
67510e230b6Smayastruct GEN6_RENDER_SURFACE_STATE {
67610e230b6Smaya   bool                                 CubeFaceEnablePositiveZ;
67710e230b6Smaya   bool                                 CubeFaceEnableNegativeZ;
67810e230b6Smaya   bool                                 CubeFaceEnablePositiveY;
67910e230b6Smaya   bool                                 CubeFaceEnableNegativeY;
68010e230b6Smaya   bool                                 CubeFaceEnablePositiveX;
68110e230b6Smaya   bool                                 CubeFaceEnableNegativeX;
68210e230b6Smaya   uint32_t                             MediaBoundaryPixelMode;
68310e230b6Smaya#define NORMAL_MODE                              0
68410e230b6Smaya#define PROGRESSIVE_FRAME                        2
68510e230b6Smaya#define INTERLACED_FRAME                         3
68610e230b6Smaya   uint32_t                             RenderCacheReadWriteMode;
68710e230b6Smaya#define WRITE_ONLY                               0
68810e230b6Smaya#define READ_WRITE                               1
68910e230b6Smaya   uint32_t                             CubeMapCornerMode;
69010e230b6Smaya#define CUBE_REPLICATE                           0
69110e230b6Smaya#define CUBE_AVERAGE                             1
69210e230b6Smaya   uint32_t                             MIPMapLayoutMode;
69310e230b6Smaya#define MIPLAYOUT_BELOW                          0
69410e230b6Smaya#define MIPLAYOUT_RIGHT                          1
69510e230b6Smaya   uint32_t                             VerticalLineStrideOffset;
69610e230b6Smaya   uint32_t                             VerticalLineStride;
69710e230b6Smaya   uint32_t                             SurfaceFormat;
69810e230b6Smaya   uint32_t                             DataReturnFormat;
69910e230b6Smaya#define DATA_RETURN_FLOAT32                      0
70010e230b6Smaya   uint32_t                             SurfaceType;
70110e230b6Smaya#define SURFTYPE_1D                              0
70210e230b6Smaya#define SURFTYPE_2D                              1
70310e230b6Smaya#define SURFTYPE_3D                              2
70410e230b6Smaya#define SURFTYPE_CUBE                            3
70510e230b6Smaya#define SURFTYPE_BUFFER                          4
70610e230b6Smaya#define SURFTYPE_NULL                            7
70710e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
70810e230b6Smaya   uint32_t                             RenderTargetRotation;
70910e230b6Smaya#define RTROTATE_0DEG                            0
71010e230b6Smaya#define RTROTATE_90DEG                           1
71110e230b6Smaya#define RTROTATE_270DEG                          3
71210e230b6Smaya   uint32_t                             MIPCountLOD;
71310e230b6Smaya   uint32_t                             Width;
71410e230b6Smaya   uint32_t                             Height;
71510e230b6Smaya   uint32_t                             TileWalk;
71610e230b6Smaya#define TILEWALK_XMAJOR                          0
71710e230b6Smaya#define TILEWALK_YMAJOR                          1
71810e230b6Smaya   bool                                 TiledSurface;
71910e230b6Smaya   uint32_t                             SurfacePitch;
72010e230b6Smaya   uint32_t                             Depth;
72110e230b6Smaya   uint32_t                             MultisamplePositionPaletteIndex;
72210e230b6Smaya   uint32_t                             NumberofMultisamples;
72310e230b6Smaya#define MULTISAMPLECOUNT_1                       0
72410e230b6Smaya#define MULTISAMPLECOUNT_4                       2
72510e230b6Smaya   uint32_t                             RenderTargetViewExtent;
72610e230b6Smaya   uint32_t                             MinimumArrayElement;
72710e230b6Smaya   uint32_t                             SurfaceMinLOD;
72810e230b6Smaya   uint32_t                             MOCS;
72910e230b6Smaya   uint32_t                             YOffset;
73010e230b6Smaya   uint32_t                             SurfaceVerticalAlignment;
73110e230b6Smaya#define VALIGN_2                                 0
73210e230b6Smaya#define VALIGN_4                                 1
73310e230b6Smaya   uint32_t                             XOffset;
73410e230b6Smaya};
73510e230b6Smaya
73610e230b6Smayastatic inline void
73710e230b6SmayaGEN6_RENDER_SURFACE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
73810e230b6Smaya                               __attribute__((unused)) void * restrict dst,
73910e230b6Smaya                               __attribute__((unused)) const struct GEN6_RENDER_SURFACE_STATE * restrict values)
74010e230b6Smaya{
74110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
74210e230b6Smaya
74310e230b6Smaya   dw[0] =
74410e230b6Smaya      __gen_uint(values->CubeFaceEnablePositiveZ, 0, 0) |
74510e230b6Smaya      __gen_uint(values->CubeFaceEnableNegativeZ, 1, 1) |
74610e230b6Smaya      __gen_uint(values->CubeFaceEnablePositiveY, 2, 2) |
74710e230b6Smaya      __gen_uint(values->CubeFaceEnableNegativeY, 3, 3) |
74810e230b6Smaya      __gen_uint(values->CubeFaceEnablePositiveX, 4, 4) |
74910e230b6Smaya      __gen_uint(values->CubeFaceEnableNegativeX, 5, 5) |
75010e230b6Smaya      __gen_uint(values->MediaBoundaryPixelMode, 6, 7) |
75110e230b6Smaya      __gen_uint(values->RenderCacheReadWriteMode, 8, 8) |
75210e230b6Smaya      __gen_uint(values->CubeMapCornerMode, 9, 9) |
75310e230b6Smaya      __gen_uint(values->MIPMapLayoutMode, 10, 10) |
75410e230b6Smaya      __gen_uint(values->VerticalLineStrideOffset, 11, 11) |
75510e230b6Smaya      __gen_uint(values->VerticalLineStride, 12, 12) |
75610e230b6Smaya      __gen_uint(values->SurfaceFormat, 18, 26) |
75710e230b6Smaya      __gen_uint(values->DataReturnFormat, 27, 27) |
75810e230b6Smaya      __gen_uint(values->SurfaceType, 29, 31);
75910e230b6Smaya
76010e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->SurfaceBaseAddress, 0);
76110e230b6Smaya
76210e230b6Smaya   dw[2] =
76310e230b6Smaya      __gen_uint(values->RenderTargetRotation, 0, 1) |
76410e230b6Smaya      __gen_uint(values->MIPCountLOD, 2, 5) |
76510e230b6Smaya      __gen_uint(values->Width, 6, 18) |
76610e230b6Smaya      __gen_uint(values->Height, 19, 31);
76710e230b6Smaya
76810e230b6Smaya   dw[3] =
76910e230b6Smaya      __gen_uint(values->TileWalk, 0, 0) |
77010e230b6Smaya      __gen_uint(values->TiledSurface, 1, 1) |
77110e230b6Smaya      __gen_uint(values->SurfacePitch, 3, 19) |
77210e230b6Smaya      __gen_uint(values->Depth, 21, 31);
77310e230b6Smaya
77410e230b6Smaya   dw[4] =
77510e230b6Smaya      __gen_uint(values->MultisamplePositionPaletteIndex, 0, 2) |
77610e230b6Smaya      __gen_uint(values->NumberofMultisamples, 4, 6) |
77710e230b6Smaya      __gen_uint(values->RenderTargetViewExtent, 8, 16) |
77810e230b6Smaya      __gen_uint(values->MinimumArrayElement, 17, 27) |
77910e230b6Smaya      __gen_uint(values->SurfaceMinLOD, 28, 31);
78010e230b6Smaya
78110e230b6Smaya   dw[5] =
78210e230b6Smaya      __gen_uint(values->MOCS, 16, 19) |
78310e230b6Smaya      __gen_uint(values->YOffset, 20, 23) |
78410e230b6Smaya      __gen_uint(values->SurfaceVerticalAlignment, 24, 24) |
78510e230b6Smaya      __gen_uint(values->XOffset, 25, 31);
78610e230b6Smaya}
78710e230b6Smaya
78810e230b6Smaya#define GEN6_SAMPLER_BORDER_COLOR_STATE_length     12
78910e230b6Smayastruct GEN6_SAMPLER_BORDER_COLOR_STATE {
79010e230b6Smaya   uint32_t                             BorderColorUnormRed;
79110e230b6Smaya   uint32_t                             BorderColorUnormGreen;
79210e230b6Smaya   uint32_t                             BorderColorUnormBlue;
79310e230b6Smaya   uint32_t                             BorderColorUnormAlpha;
79410e230b6Smaya   float                                BorderColorFloatRed;
79510e230b6Smaya   float                                BorderColorFloatGreen;
79610e230b6Smaya   float                                BorderColorFloatBlue;
79710e230b6Smaya   float                                BorderColorFloatAlpha;
79810e230b6Smaya   uint32_t                             BorderColorFloat16Red;
79910e230b6Smaya   uint32_t                             BorderColorFloat16Green;
80010e230b6Smaya   uint32_t                             BorderColorFloat16Blue;
80110e230b6Smaya   uint32_t                             BorderColorFloat16Alpha;
80210e230b6Smaya   uint32_t                             BorderColorUnorm16Red;
80310e230b6Smaya   uint32_t                             BorderColorUnorm16Green;
80410e230b6Smaya   uint32_t                             BorderColorUnorm16Blue;
80510e230b6Smaya   uint32_t                             BorderColorUnorm16Alpha;
80610e230b6Smaya   int32_t                              BorderColorSnorm16Red;
80710e230b6Smaya   int32_t                              BorderColorSnorm16Green;
80810e230b6Smaya   int32_t                              BorderColorSnorm16Blue;
80910e230b6Smaya   int32_t                              BorderColorSnorm16Alpha;
81010e230b6Smaya   int32_t                              BorderColorSnorm8Red;
81110e230b6Smaya   int32_t                              BorderColorSnorm8Green;
81210e230b6Smaya   int32_t                              BorderColorSnorm8Blue;
81310e230b6Smaya   int32_t                              BorderColorSnorm8Alpha;
81410e230b6Smaya};
81510e230b6Smaya
81610e230b6Smayastatic inline void
81710e230b6SmayaGEN6_SAMPLER_BORDER_COLOR_STATE_pack(__attribute__((unused)) __gen_user_data *data,
81810e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
81910e230b6Smaya                                     __attribute__((unused)) const struct GEN6_SAMPLER_BORDER_COLOR_STATE * restrict values)
82010e230b6Smaya{
82110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
82210e230b6Smaya
82310e230b6Smaya   dw[0] =
82410e230b6Smaya      __gen_uint(values->BorderColorUnormRed, 0, 7) |
82510e230b6Smaya      __gen_uint(values->BorderColorUnormGreen, 8, 15) |
82610e230b6Smaya      __gen_uint(values->BorderColorUnormBlue, 16, 23) |
82710e230b6Smaya      __gen_uint(values->BorderColorUnormAlpha, 24, 31);
82810e230b6Smaya
82910e230b6Smaya   dw[1] =
83010e230b6Smaya      __gen_float(values->BorderColorFloatRed);
83110e230b6Smaya
83210e230b6Smaya   dw[2] =
83310e230b6Smaya      __gen_float(values->BorderColorFloatGreen);
83410e230b6Smaya
83510e230b6Smaya   dw[3] =
83610e230b6Smaya      __gen_float(values->BorderColorFloatBlue);
83710e230b6Smaya
83810e230b6Smaya   dw[4] =
83910e230b6Smaya      __gen_float(values->BorderColorFloatAlpha);
84010e230b6Smaya
84110e230b6Smaya   dw[5] =
84210e230b6Smaya      __gen_uint(values->BorderColorFloat16Red, 0, 15) |
84310e230b6Smaya      __gen_uint(values->BorderColorFloat16Green, 16, 31);
84410e230b6Smaya
84510e230b6Smaya   dw[6] =
84610e230b6Smaya      __gen_uint(values->BorderColorFloat16Blue, 0, 15) |
84710e230b6Smaya      __gen_uint(values->BorderColorFloat16Alpha, 16, 31);
84810e230b6Smaya
84910e230b6Smaya   dw[7] =
85010e230b6Smaya      __gen_uint(values->BorderColorUnorm16Red, 0, 15) |
85110e230b6Smaya      __gen_uint(values->BorderColorUnorm16Green, 16, 31);
85210e230b6Smaya
85310e230b6Smaya   dw[8] =
85410e230b6Smaya      __gen_uint(values->BorderColorUnorm16Blue, 0, 15) |
85510e230b6Smaya      __gen_uint(values->BorderColorUnorm16Alpha, 16, 31);
85610e230b6Smaya
85710e230b6Smaya   dw[9] =
85810e230b6Smaya      __gen_sint(values->BorderColorSnorm16Red, 0, 15) |
85910e230b6Smaya      __gen_sint(values->BorderColorSnorm16Green, 16, 31);
86010e230b6Smaya
86110e230b6Smaya   dw[10] =
86210e230b6Smaya      __gen_sint(values->BorderColorSnorm16Blue, 0, 15) |
86310e230b6Smaya      __gen_sint(values->BorderColorSnorm16Alpha, 16, 31);
86410e230b6Smaya
86510e230b6Smaya   dw[11] =
86610e230b6Smaya      __gen_sint(values->BorderColorSnorm8Red, 0, 7) |
86710e230b6Smaya      __gen_sint(values->BorderColorSnorm8Green, 8, 15) |
86810e230b6Smaya      __gen_sint(values->BorderColorSnorm8Blue, 16, 23) |
86910e230b6Smaya      __gen_sint(values->BorderColorSnorm8Alpha, 24, 31);
87010e230b6Smaya}
87110e230b6Smaya
87210e230b6Smaya#define GEN6_SAMPLER_STATE_length              4
87310e230b6Smayastruct GEN6_SAMPLER_STATE {
87410e230b6Smaya   uint32_t                             ShadowFunction;
87510e230b6Smaya#define PREFILTEROP_ALWAYS                       0
87610e230b6Smaya#define PREFILTEROP_NEVER                        1
87710e230b6Smaya#define PREFILTEROP_LESS                         2
87810e230b6Smaya#define PREFILTEROP_EQUAL                        3
87910e230b6Smaya#define PREFILTEROP_LEQUAL                       4
88010e230b6Smaya#define PREFILTEROP_GREATER                      5
88110e230b6Smaya#define PREFILTEROP_NOTEQUAL                     6
88210e230b6Smaya#define PREFILTEROP_GEQUAL                       7
88310e230b6Smaya   float                                TextureLODBias;
88410e230b6Smaya   uint32_t                             MinModeFilter;
88510e230b6Smaya   uint32_t                             MagModeFilter;
88610e230b6Smaya#define MAPFILTER_NEAREST                        0
88710e230b6Smaya#define MAPFILTER_LINEAR                         1
88810e230b6Smaya#define MAPFILTER_ANISOTROPIC                    2
88910e230b6Smaya#define MAPFILTER_MONO                           6
89010e230b6Smaya   uint32_t                             MipModeFilter;
89110e230b6Smaya#define MIPFILTER_NONE                           0
89210e230b6Smaya#define MIPFILTER_NEAREST                        1
89310e230b6Smaya#define MIPFILTER_LINEAR                         3
89410e230b6Smaya   float                                BaseMipLevel;
89510e230b6Smaya   uint32_t                             MinandMagStateNotEqual;
89610e230b6Smaya#define MIN_MAG_EQ                               0
89710e230b6Smaya#define MIN_MAG_NEQ                              1
89810e230b6Smaya   uint32_t                             LODPreClampEnable;
89910e230b6Smaya#define CLAMP_ENABLE_OGL                         1
90010e230b6Smaya   uint32_t                             TextureBorderColorMode;
90110e230b6Smaya#define DX10OGL                                  0
90210e230b6Smaya#define DX9                                      1
90310e230b6Smaya   bool                                 SamplerDisable;
90410e230b6Smaya   enum GEN6_TextureCoordinateMode      TCZAddressControlMode;
90510e230b6Smaya   enum GEN6_TextureCoordinateMode      TCYAddressControlMode;
90610e230b6Smaya   enum GEN6_TextureCoordinateMode      TCXAddressControlMode;
90710e230b6Smaya   uint32_t                             CubeSurfaceControlMode;
90810e230b6Smaya#define CUBECTRLMODE_PROGRAMMED                  0
90910e230b6Smaya#define CUBECTRLMODE_OVERRIDE                    1
91010e230b6Smaya   float                                MaxLOD;
91110e230b6Smaya   float                                MinLOD;
91210e230b6Smaya   uint64_t                             BorderColorPointer;
91310e230b6Smaya   bool                                 NonnormalizedCoordinateEnable;
91410e230b6Smaya   bool                                 RAddressMinFilterRoundingEnable;
91510e230b6Smaya   bool                                 RAddressMagFilterRoundingEnable;
91610e230b6Smaya   bool                                 VAddressMinFilterRoundingEnable;
91710e230b6Smaya   bool                                 VAddressMagFilterRoundingEnable;
91810e230b6Smaya   bool                                 UAddressMinFilterRoundingEnable;
91910e230b6Smaya   bool                                 UAddressMagFilterRoundingEnable;
92010e230b6Smaya   uint32_t                             MaximumAnisotropy;
92110e230b6Smaya#define RATIO21                                  0
92210e230b6Smaya#define RATIO41                                  1
92310e230b6Smaya#define RATIO61                                  2
92410e230b6Smaya#define RATIO81                                  3
92510e230b6Smaya#define RATIO101                                 4
92610e230b6Smaya#define RATIO121                                 5
92710e230b6Smaya#define RATIO141                                 6
92810e230b6Smaya#define RATIO161                                 7
92910e230b6Smaya   uint32_t                             ChromaKeyMode;
93010e230b6Smaya#define KEYFILTER_KILL_ON_ANY_MATCH              0
93110e230b6Smaya#define KEYFILTER_REPLACE_BLACK                  1
93210e230b6Smaya   uint32_t                             ChromaKeyIndex;
93310e230b6Smaya   bool                                 ChromaKeyEnable;
93410e230b6Smaya   uint32_t                             MonochromeFilterWidth;
93510e230b6Smaya   uint32_t                             MonochromeFilterHeightReserved;
93610e230b6Smaya};
93710e230b6Smaya
93810e230b6Smayastatic inline void
93910e230b6SmayaGEN6_SAMPLER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
94010e230b6Smaya                        __attribute__((unused)) void * restrict dst,
94110e230b6Smaya                        __attribute__((unused)) const struct GEN6_SAMPLER_STATE * restrict values)
94210e230b6Smaya{
94310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
94410e230b6Smaya
94510e230b6Smaya   dw[0] =
94610e230b6Smaya      __gen_uint(values->ShadowFunction, 0, 2) |
94710e230b6Smaya      __gen_sfixed(values->TextureLODBias, 3, 13, 6) |
94810e230b6Smaya      __gen_uint(values->MinModeFilter, 14, 16) |
94910e230b6Smaya      __gen_uint(values->MagModeFilter, 17, 19) |
95010e230b6Smaya      __gen_uint(values->MipModeFilter, 20, 21) |
95110e230b6Smaya      __gen_ufixed(values->BaseMipLevel, 22, 26, 1) |
95210e230b6Smaya      __gen_uint(values->MinandMagStateNotEqual, 27, 27) |
95310e230b6Smaya      __gen_uint(values->LODPreClampEnable, 28, 28) |
95410e230b6Smaya      __gen_uint(values->TextureBorderColorMode, 29, 29) |
95510e230b6Smaya      __gen_uint(values->SamplerDisable, 31, 31);
95610e230b6Smaya
95710e230b6Smaya   dw[1] =
95810e230b6Smaya      __gen_uint(values->TCZAddressControlMode, 0, 2) |
95910e230b6Smaya      __gen_uint(values->TCYAddressControlMode, 3, 5) |
96010e230b6Smaya      __gen_uint(values->TCXAddressControlMode, 6, 8) |
96110e230b6Smaya      __gen_uint(values->CubeSurfaceControlMode, 9, 9) |
96210e230b6Smaya      __gen_ufixed(values->MaxLOD, 12, 21, 6) |
96310e230b6Smaya      __gen_ufixed(values->MinLOD, 22, 31, 6);
96410e230b6Smaya
96510e230b6Smaya   dw[2] =
96610e230b6Smaya      __gen_offset(values->BorderColorPointer, 5, 31);
96710e230b6Smaya
96810e230b6Smaya   dw[3] =
96910e230b6Smaya      __gen_uint(values->NonnormalizedCoordinateEnable, 0, 0) |
97010e230b6Smaya      __gen_uint(values->RAddressMinFilterRoundingEnable, 13, 13) |
97110e230b6Smaya      __gen_uint(values->RAddressMagFilterRoundingEnable, 14, 14) |
97210e230b6Smaya      __gen_uint(values->VAddressMinFilterRoundingEnable, 15, 15) |
97310e230b6Smaya      __gen_uint(values->VAddressMagFilterRoundingEnable, 16, 16) |
97410e230b6Smaya      __gen_uint(values->UAddressMinFilterRoundingEnable, 17, 17) |
97510e230b6Smaya      __gen_uint(values->UAddressMagFilterRoundingEnable, 18, 18) |
97610e230b6Smaya      __gen_uint(values->MaximumAnisotropy, 19, 21) |
97710e230b6Smaya      __gen_uint(values->ChromaKeyMode, 22, 22) |
97810e230b6Smaya      __gen_uint(values->ChromaKeyIndex, 23, 24) |
97910e230b6Smaya      __gen_uint(values->ChromaKeyEnable, 25, 25) |
98010e230b6Smaya      __gen_uint(values->MonochromeFilterWidth, 26, 28) |
98110e230b6Smaya      __gen_uint(values->MonochromeFilterHeightReserved, 29, 31);
98210e230b6Smaya}
98310e230b6Smaya
98410e230b6Smaya#define GEN6_SCISSOR_RECT_length               2
98510e230b6Smayastruct GEN6_SCISSOR_RECT {
98610e230b6Smaya   uint32_t                             ScissorRectangleXMin;
98710e230b6Smaya   uint32_t                             ScissorRectangleYMin;
98810e230b6Smaya   uint32_t                             ScissorRectangleXMax;
98910e230b6Smaya   uint32_t                             ScissorRectangleYMax;
99010e230b6Smaya};
99110e230b6Smaya
99210e230b6Smayastatic inline void
99310e230b6SmayaGEN6_SCISSOR_RECT_pack(__attribute__((unused)) __gen_user_data *data,
99410e230b6Smaya                       __attribute__((unused)) void * restrict dst,
99510e230b6Smaya                       __attribute__((unused)) const struct GEN6_SCISSOR_RECT * restrict values)
99610e230b6Smaya{
99710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
99810e230b6Smaya
99910e230b6Smaya   dw[0] =
100010e230b6Smaya      __gen_uint(values->ScissorRectangleXMin, 0, 15) |
100110e230b6Smaya      __gen_uint(values->ScissorRectangleYMin, 16, 31);
100210e230b6Smaya
100310e230b6Smaya   dw[1] =
100410e230b6Smaya      __gen_uint(values->ScissorRectangleXMax, 0, 15) |
100510e230b6Smaya      __gen_uint(values->ScissorRectangleYMax, 16, 31);
100610e230b6Smaya}
100710e230b6Smaya
100810e230b6Smaya#define GEN6_SF_OUTPUT_ATTRIBUTE_DETAIL_length      1
100910e230b6Smayastruct GEN6_SF_OUTPUT_ATTRIBUTE_DETAIL {
101010e230b6Smaya   uint32_t                             SourceAttribute;
101110e230b6Smaya   uint32_t                             SwizzleSelect;
101210e230b6Smaya#define INPUTATTR                                0
101310e230b6Smaya#define INPUTATTR_FACING                         1
101410e230b6Smaya#define INPUTATTR_W                              2
101510e230b6Smaya#define INPUTATTR_FACING_W                       3
101610e230b6Smaya   uint32_t                             ConstantSource;
101710e230b6Smaya#define CONST_0000                               0
101810e230b6Smaya#define CONST_0001_FLOAT                         1
101910e230b6Smaya#define CONST_1111_FLOAT                         2
102010e230b6Smaya#define PRIM_ID                                  3
102110e230b6Smaya   uint32_t                             SwizzleControlMode;
102210e230b6Smaya   bool                                 ComponentOverrideX;
102310e230b6Smaya   bool                                 ComponentOverrideY;
102410e230b6Smaya   bool                                 ComponentOverrideZ;
102510e230b6Smaya   bool                                 ComponentOverrideW;
102610e230b6Smaya};
102710e230b6Smaya
102810e230b6Smayastatic inline void
102910e230b6SmayaGEN6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(__attribute__((unused)) __gen_user_data *data,
103010e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
103110e230b6Smaya                                     __attribute__((unused)) const struct GEN6_SF_OUTPUT_ATTRIBUTE_DETAIL * restrict values)
103210e230b6Smaya{
103310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
103410e230b6Smaya
103510e230b6Smaya   dw[0] =
103610e230b6Smaya      __gen_uint(values->SourceAttribute, 0, 4) |
103710e230b6Smaya      __gen_uint(values->SwizzleSelect, 6, 7) |
103810e230b6Smaya      __gen_uint(values->ConstantSource, 9, 10) |
103910e230b6Smaya      __gen_uint(values->SwizzleControlMode, 11, 11) |
104010e230b6Smaya      __gen_uint(values->ComponentOverrideX, 12, 12) |
104110e230b6Smaya      __gen_uint(values->ComponentOverrideY, 13, 13) |
104210e230b6Smaya      __gen_uint(values->ComponentOverrideZ, 14, 14) |
104310e230b6Smaya      __gen_uint(values->ComponentOverrideW, 15, 15);
104410e230b6Smaya}
104510e230b6Smaya
104610e230b6Smaya#define GEN6_SF_VIEWPORT_length                8
104710e230b6Smayastruct GEN6_SF_VIEWPORT {
104810e230b6Smaya   float                                ViewportMatrixElementm00;
104910e230b6Smaya   float                                ViewportMatrixElementm11;
105010e230b6Smaya   float                                ViewportMatrixElementm22;
105110e230b6Smaya#define ExcludesDWord01                          0
105210e230b6Smaya   float                                ViewportMatrixElementm30;
105310e230b6Smaya   float                                ViewportMatrixElementm31;
105410e230b6Smaya   float                                ViewportMatrixElementm32;
105510e230b6Smaya};
105610e230b6Smaya
105710e230b6Smayastatic inline void
105810e230b6SmayaGEN6_SF_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
105910e230b6Smaya                      __attribute__((unused)) void * restrict dst,
106010e230b6Smaya                      __attribute__((unused)) const struct GEN6_SF_VIEWPORT * restrict values)
106110e230b6Smaya{
106210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
106310e230b6Smaya
106410e230b6Smaya   dw[0] =
106510e230b6Smaya      __gen_float(values->ViewportMatrixElementm00);
106610e230b6Smaya
106710e230b6Smaya   dw[1] =
106810e230b6Smaya      __gen_float(values->ViewportMatrixElementm11);
106910e230b6Smaya
107010e230b6Smaya   dw[2] =
107110e230b6Smaya      __gen_float(values->ViewportMatrixElementm22);
107210e230b6Smaya
107310e230b6Smaya   dw[3] =
107410e230b6Smaya      __gen_float(values->ViewportMatrixElementm30);
107510e230b6Smaya
107610e230b6Smaya   dw[4] =
107710e230b6Smaya      __gen_float(values->ViewportMatrixElementm31);
107810e230b6Smaya
107910e230b6Smaya   dw[5] =
108010e230b6Smaya      __gen_float(values->ViewportMatrixElementm32);
108110e230b6Smaya
108210e230b6Smaya   dw[6] = 0;
108310e230b6Smaya
108410e230b6Smaya   dw[7] = 0;
108510e230b6Smaya}
108610e230b6Smaya
108710e230b6Smaya#define GEN6_VERTEX_BUFFER_STATE_length        4
108810e230b6Smayastruct GEN6_VERTEX_BUFFER_STATE {
108910e230b6Smaya   uint32_t                             BufferPitch;
109010e230b6Smaya   bool                                 VertexFetchInvalidate;
109110e230b6Smaya   bool                                 NullVertexBuffer;
109210e230b6Smaya   uint32_t                             MOCS;
109310e230b6Smaya   uint32_t                             BufferAccessType;
109410e230b6Smaya#define VERTEXDATA                               0
109510e230b6Smaya#define INSTANCEDATA                             1
109610e230b6Smaya   uint32_t                             VertexBufferIndex;
109710e230b6Smaya   __gen_address_type                   BufferStartingAddress;
109810e230b6Smaya   __gen_address_type                   EndAddress;
109910e230b6Smaya   uint32_t                             InstanceDataStepRate;
110010e230b6Smaya};
110110e230b6Smaya
110210e230b6Smayastatic inline void
110310e230b6SmayaGEN6_VERTEX_BUFFER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
110410e230b6Smaya                              __attribute__((unused)) void * restrict dst,
110510e230b6Smaya                              __attribute__((unused)) const struct GEN6_VERTEX_BUFFER_STATE * restrict values)
110610e230b6Smaya{
110710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
110810e230b6Smaya
110910e230b6Smaya   dw[0] =
111010e230b6Smaya      __gen_uint(values->BufferPitch, 0, 11) |
111110e230b6Smaya      __gen_uint(values->VertexFetchInvalidate, 12, 12) |
111210e230b6Smaya      __gen_uint(values->NullVertexBuffer, 13, 13) |
111310e230b6Smaya      __gen_uint(values->MOCS, 16, 19) |
111410e230b6Smaya      __gen_uint(values->BufferAccessType, 20, 20) |
111510e230b6Smaya      __gen_uint(values->VertexBufferIndex, 26, 31);
111610e230b6Smaya
111710e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->BufferStartingAddress, 0);
111810e230b6Smaya
111910e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->EndAddress, 0);
112010e230b6Smaya
112110e230b6Smaya   dw[3] =
112210e230b6Smaya      __gen_uint(values->InstanceDataStepRate, 0, 31);
112310e230b6Smaya}
112410e230b6Smaya
112510e230b6Smaya#define GEN6_VERTEX_ELEMENT_STATE_length       2
112610e230b6Smayastruct GEN6_VERTEX_ELEMENT_STATE {
112710e230b6Smaya   uint32_t                             SourceElementOffset;
112810e230b6Smaya   bool                                 EdgeFlagEnable;
112910e230b6Smaya   uint32_t                             SourceElementFormat;
113010e230b6Smaya   bool                                 Valid;
113110e230b6Smaya   uint32_t                             VertexBufferIndex;
113210e230b6Smaya   enum GEN6_3D_Vertex_Component_Control Component3Control;
113310e230b6Smaya   enum GEN6_3D_Vertex_Component_Control Component2Control;
113410e230b6Smaya   enum GEN6_3D_Vertex_Component_Control Component1Control;
113510e230b6Smaya   enum GEN6_3D_Vertex_Component_Control Component0Control;
113610e230b6Smaya};
113710e230b6Smaya
113810e230b6Smayastatic inline void
113910e230b6SmayaGEN6_VERTEX_ELEMENT_STATE_pack(__attribute__((unused)) __gen_user_data *data,
114010e230b6Smaya                               __attribute__((unused)) void * restrict dst,
114110e230b6Smaya                               __attribute__((unused)) const struct GEN6_VERTEX_ELEMENT_STATE * restrict values)
114210e230b6Smaya{
114310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
114410e230b6Smaya
114510e230b6Smaya   dw[0] =
114610e230b6Smaya      __gen_uint(values->SourceElementOffset, 0, 11) |
114710e230b6Smaya      __gen_uint(values->EdgeFlagEnable, 15, 15) |
114810e230b6Smaya      __gen_uint(values->SourceElementFormat, 16, 24) |
114910e230b6Smaya      __gen_uint(values->Valid, 25, 25) |
115010e230b6Smaya      __gen_uint(values->VertexBufferIndex, 26, 31);
115110e230b6Smaya
115210e230b6Smaya   dw[1] =
115310e230b6Smaya      __gen_uint(values->Component3Control, 16, 18) |
115410e230b6Smaya      __gen_uint(values->Component2Control, 20, 22) |
115510e230b6Smaya      __gen_uint(values->Component1Control, 24, 26) |
115610e230b6Smaya      __gen_uint(values->Component0Control, 28, 30);
115710e230b6Smaya}
115810e230b6Smaya
115910e230b6Smaya#define GEN6_3DPRIMITIVE_length                6
116010e230b6Smaya#define GEN6_3DPRIMITIVE_length_bias           2
116110e230b6Smaya#define GEN6_3DPRIMITIVE_header                 \
116210e230b6Smaya   .DWordLength                         =      4,  \
116310e230b6Smaya   ._3DCommandSubOpcode                 =      0,  \
116410e230b6Smaya   ._3DCommandOpcode                    =      3,  \
116510e230b6Smaya   .CommandSubType                      =      3,  \
116610e230b6Smaya   .CommandType                         =      3
116710e230b6Smaya
116810e230b6Smayastruct GEN6_3DPRIMITIVE {
116910e230b6Smaya   uint32_t                             DWordLength;
117010e230b6Smaya   uint32_t                             InternalVertexCount;
117110e230b6Smaya   enum GEN6_3D_Prim_Topo_Type          PrimitiveTopologyType;
117210e230b6Smaya   uint32_t                             VertexAccessType;
117310e230b6Smaya#define SEQUENTIAL                               0
117410e230b6Smaya#define RANDOM                                   1
117510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
117610e230b6Smaya   uint32_t                             _3DCommandOpcode;
117710e230b6Smaya   uint32_t                             CommandSubType;
117810e230b6Smaya   uint32_t                             CommandType;
117910e230b6Smaya   uint32_t                             VertexCountPerInstance;
118010e230b6Smaya   uint32_t                             StartVertexLocation;
118110e230b6Smaya   uint32_t                             InstanceCount;
118210e230b6Smaya#define UNDEFINED                                0
118310e230b6Smaya#define noninstancedoperation                    1
118410e230b6Smaya   uint32_t                             StartInstanceLocation;
118510e230b6Smaya   int32_t                              BaseVertexLocation;
118610e230b6Smaya};
118710e230b6Smaya
118810e230b6Smayastatic inline void
118910e230b6SmayaGEN6_3DPRIMITIVE_pack(__attribute__((unused)) __gen_user_data *data,
119010e230b6Smaya                      __attribute__((unused)) void * restrict dst,
119110e230b6Smaya                      __attribute__((unused)) const struct GEN6_3DPRIMITIVE * restrict values)
119210e230b6Smaya{
119310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
119410e230b6Smaya
119510e230b6Smaya   dw[0] =
119610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
119710e230b6Smaya      __gen_uint(values->InternalVertexCount, 9, 9) |
119810e230b6Smaya      __gen_uint(values->PrimitiveTopologyType, 10, 14) |
119910e230b6Smaya      __gen_uint(values->VertexAccessType, 15, 15) |
120010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
120110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
120210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
120310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
120410e230b6Smaya
120510e230b6Smaya   dw[1] =
120610e230b6Smaya      __gen_uint(values->VertexCountPerInstance, 0, 31);
120710e230b6Smaya
120810e230b6Smaya   dw[2] =
120910e230b6Smaya      __gen_uint(values->StartVertexLocation, 0, 31);
121010e230b6Smaya
121110e230b6Smaya   dw[3] =
121210e230b6Smaya      __gen_uint(values->InstanceCount, 0, 31);
121310e230b6Smaya
121410e230b6Smaya   dw[4] =
121510e230b6Smaya      __gen_uint(values->StartInstanceLocation, 0, 31);
121610e230b6Smaya
121710e230b6Smaya   dw[5] =
121810e230b6Smaya      __gen_sint(values->BaseVertexLocation, 0, 31);
121910e230b6Smaya}
122010e230b6Smaya
122110e230b6Smaya#define GEN6_3DSTATE_AA_LINE_PARAMETERS_length      3
122210e230b6Smaya#define GEN6_3DSTATE_AA_LINE_PARAMETERS_length_bias      2
122310e230b6Smaya#define GEN6_3DSTATE_AA_LINE_PARAMETERS_header  \
122410e230b6Smaya   .DWordLength                         =      1,  \
122510e230b6Smaya   ._3DCommandSubOpcode                 =     10,  \
122610e230b6Smaya   ._3DCommandOpcode                    =      1,  \
122710e230b6Smaya   .CommandSubType                      =      3,  \
122810e230b6Smaya   .CommandType                         =      3
122910e230b6Smaya
123010e230b6Smayastruct GEN6_3DSTATE_AA_LINE_PARAMETERS {
123110e230b6Smaya   uint32_t                             DWordLength;
123210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
123310e230b6Smaya   uint32_t                             _3DCommandOpcode;
123410e230b6Smaya   uint32_t                             CommandSubType;
123510e230b6Smaya   uint32_t                             CommandType;
123610e230b6Smaya   float                                AACoverageSlope;
123710e230b6Smaya   float                                AACoverageBias;
123810e230b6Smaya   float                                AACoverageEndCapSlope;
123910e230b6Smaya   float                                AACoverageEndCapBias;
124010e230b6Smaya};
124110e230b6Smaya
124210e230b6Smayastatic inline void
124310e230b6SmayaGEN6_3DSTATE_AA_LINE_PARAMETERS_pack(__attribute__((unused)) __gen_user_data *data,
124410e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
124510e230b6Smaya                                     __attribute__((unused)) const struct GEN6_3DSTATE_AA_LINE_PARAMETERS * restrict values)
124610e230b6Smaya{
124710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
124810e230b6Smaya
124910e230b6Smaya   dw[0] =
125010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
125110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
125210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
125310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
125410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
125510e230b6Smaya
125610e230b6Smaya   dw[1] =
125710e230b6Smaya      __gen_ufixed(values->AACoverageSlope, 0, 7, 8) |
125810e230b6Smaya      __gen_ufixed(values->AACoverageBias, 16, 23, 8);
125910e230b6Smaya
126010e230b6Smaya   dw[2] =
126110e230b6Smaya      __gen_ufixed(values->AACoverageEndCapSlope, 0, 7, 8) |
126210e230b6Smaya      __gen_ufixed(values->AACoverageEndCapBias, 16, 23, 8);
126310e230b6Smaya}
126410e230b6Smaya
126510e230b6Smaya#define GEN6_3DSTATE_BINDING_TABLE_POINTERS_length      4
126610e230b6Smaya#define GEN6_3DSTATE_BINDING_TABLE_POINTERS_length_bias      2
126710e230b6Smaya#define GEN6_3DSTATE_BINDING_TABLE_POINTERS_header\
126810e230b6Smaya   .DWordLength                         =      2,  \
126910e230b6Smaya   ._3DCommandSubOpcode                 =      1,  \
127010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
127110e230b6Smaya   .CommandSubType                      =      3,  \
127210e230b6Smaya   .CommandType                         =      3
127310e230b6Smaya
127410e230b6Smayastruct GEN6_3DSTATE_BINDING_TABLE_POINTERS {
127510e230b6Smaya   uint32_t                             DWordLength;
127610e230b6Smaya   bool                                 VSBindingTableChange;
127710e230b6Smaya   bool                                 GSBindingTableChange;
127810e230b6Smaya   bool                                 PSBindingTableChange;
127910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
128010e230b6Smaya   uint32_t                             _3DCommandOpcode;
128110e230b6Smaya   uint32_t                             CommandSubType;
128210e230b6Smaya   uint32_t                             CommandType;
128310e230b6Smaya   uint64_t                             PointertoVSBindingTable;
128410e230b6Smaya   uint64_t                             PointertoGSBindingTable;
128510e230b6Smaya   uint64_t                             PointertoPSBindingTable;
128610e230b6Smaya};
128710e230b6Smaya
128810e230b6Smayastatic inline void
128910e230b6SmayaGEN6_3DSTATE_BINDING_TABLE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
129010e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
129110e230b6Smaya                                         __attribute__((unused)) const struct GEN6_3DSTATE_BINDING_TABLE_POINTERS * restrict values)
129210e230b6Smaya{
129310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
129410e230b6Smaya
129510e230b6Smaya   dw[0] =
129610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
129710e230b6Smaya      __gen_uint(values->VSBindingTableChange, 8, 8) |
129810e230b6Smaya      __gen_uint(values->GSBindingTableChange, 9, 9) |
129910e230b6Smaya      __gen_uint(values->PSBindingTableChange, 12, 12) |
130010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
130110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
130210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
130310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
130410e230b6Smaya
130510e230b6Smaya   dw[1] =
130610e230b6Smaya      __gen_offset(values->PointertoVSBindingTable, 5, 31);
130710e230b6Smaya
130810e230b6Smaya   dw[2] =
130910e230b6Smaya      __gen_offset(values->PointertoGSBindingTable, 5, 31);
131010e230b6Smaya
131110e230b6Smaya   dw[3] =
131210e230b6Smaya      __gen_offset(values->PointertoPSBindingTable, 5, 31);
131310e230b6Smaya}
131410e230b6Smaya
131510e230b6Smaya#define GEN6_3DSTATE_CC_STATE_POINTERS_length      4
131610e230b6Smaya#define GEN6_3DSTATE_CC_STATE_POINTERS_length_bias      2
131710e230b6Smaya#define GEN6_3DSTATE_CC_STATE_POINTERS_header   \
131810e230b6Smaya   .DWordLength                         =      2,  \
131910e230b6Smaya   ._3DCommandSubOpcode                 =     14,  \
132010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
132110e230b6Smaya   .CommandSubType                      =      3,  \
132210e230b6Smaya   .CommandType                         =      3
132310e230b6Smaya
132410e230b6Smayastruct GEN6_3DSTATE_CC_STATE_POINTERS {
132510e230b6Smaya   uint32_t                             DWordLength;
132610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
132710e230b6Smaya   uint32_t                             _3DCommandOpcode;
132810e230b6Smaya   uint32_t                             CommandSubType;
132910e230b6Smaya   uint32_t                             CommandType;
133010e230b6Smaya   bool                                 BLEND_STATEChange;
133110e230b6Smaya   uint64_t                             PointertoBLEND_STATE;
133210e230b6Smaya   bool                                 DEPTH_STENCIL_STATEChange;
133310e230b6Smaya   uint64_t                             PointertoDEPTH_STENCIL_STATE;
133410e230b6Smaya   bool                                 ColorCalcStatePointerValid;
133510e230b6Smaya   uint64_t                             ColorCalcStatePointer;
133610e230b6Smaya};
133710e230b6Smaya
133810e230b6Smayastatic inline void
133910e230b6SmayaGEN6_3DSTATE_CC_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
134010e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
134110e230b6Smaya                                    __attribute__((unused)) const struct GEN6_3DSTATE_CC_STATE_POINTERS * restrict values)
134210e230b6Smaya{
134310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
134410e230b6Smaya
134510e230b6Smaya   dw[0] =
134610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
134710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
134810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
134910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
135010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
135110e230b6Smaya
135210e230b6Smaya   dw[1] =
135310e230b6Smaya      __gen_uint(values->BLEND_STATEChange, 0, 0) |
135410e230b6Smaya      __gen_offset(values->PointertoBLEND_STATE, 6, 31);
135510e230b6Smaya
135610e230b6Smaya   dw[2] =
135710e230b6Smaya      __gen_uint(values->DEPTH_STENCIL_STATEChange, 0, 0) |
135810e230b6Smaya      __gen_offset(values->PointertoDEPTH_STENCIL_STATE, 6, 31);
135910e230b6Smaya
136010e230b6Smaya   dw[3] =
136110e230b6Smaya      __gen_uint(values->ColorCalcStatePointerValid, 0, 0) |
136210e230b6Smaya      __gen_offset(values->ColorCalcStatePointer, 6, 31);
136310e230b6Smaya}
136410e230b6Smaya
136510e230b6Smaya#define GEN6_3DSTATE_CHROMA_KEY_length         4
136610e230b6Smaya#define GEN6_3DSTATE_CHROMA_KEY_length_bias      2
136710e230b6Smaya#define GEN6_3DSTATE_CHROMA_KEY_header          \
136810e230b6Smaya   .DWordLength                         =      2,  \
136910e230b6Smaya   ._3DCommandSubOpcode                 =      4,  \
137010e230b6Smaya   ._3DCommandOpcode                    =      1,  \
137110e230b6Smaya   .CommandSubType                      =      3,  \
137210e230b6Smaya   .CommandType                         =      3
137310e230b6Smaya
137410e230b6Smayastruct GEN6_3DSTATE_CHROMA_KEY {
137510e230b6Smaya   uint32_t                             DWordLength;
137610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
137710e230b6Smaya   uint32_t                             _3DCommandOpcode;
137810e230b6Smaya   uint32_t                             CommandSubType;
137910e230b6Smaya   uint32_t                             CommandType;
138010e230b6Smaya   uint32_t                             ChromaKeyTableIndex;
138110e230b6Smaya   uint32_t                             ChromaKeyLowValue;
138210e230b6Smaya   uint32_t                             ChromaKeyHighValue;
138310e230b6Smaya};
138410e230b6Smaya
138510e230b6Smayastatic inline void
138610e230b6SmayaGEN6_3DSTATE_CHROMA_KEY_pack(__attribute__((unused)) __gen_user_data *data,
138710e230b6Smaya                             __attribute__((unused)) void * restrict dst,
138810e230b6Smaya                             __attribute__((unused)) const struct GEN6_3DSTATE_CHROMA_KEY * restrict values)
138910e230b6Smaya{
139010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
139110e230b6Smaya
139210e230b6Smaya   dw[0] =
139310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
139410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
139510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
139610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
139710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
139810e230b6Smaya
139910e230b6Smaya   dw[1] =
140010e230b6Smaya      __gen_uint(values->ChromaKeyTableIndex, 30, 31);
140110e230b6Smaya
140210e230b6Smaya   dw[2] =
140310e230b6Smaya      __gen_uint(values->ChromaKeyLowValue, 0, 31);
140410e230b6Smaya
140510e230b6Smaya   dw[3] =
140610e230b6Smaya      __gen_uint(values->ChromaKeyHighValue, 0, 31);
140710e230b6Smaya}
140810e230b6Smaya
140910e230b6Smaya#define GEN6_3DSTATE_CLEAR_PARAMS_length       2
141010e230b6Smaya#define GEN6_3DSTATE_CLEAR_PARAMS_length_bias      2
141110e230b6Smaya#define GEN6_3DSTATE_CLEAR_PARAMS_header        \
141210e230b6Smaya   .DWordLength                         =      0,  \
141310e230b6Smaya   ._3DCommandSubOpcode                 =     16,  \
141410e230b6Smaya   ._3DCommandOpcode                    =      1,  \
141510e230b6Smaya   .CommandSubType                      =      3,  \
141610e230b6Smaya   .CommandType                         =      3
141710e230b6Smaya
141810e230b6Smayastruct GEN6_3DSTATE_CLEAR_PARAMS {
141910e230b6Smaya   uint32_t                             DWordLength;
142010e230b6Smaya   bool                                 DepthClearValueValid;
142110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
142210e230b6Smaya   uint32_t                             _3DCommandOpcode;
142310e230b6Smaya   uint32_t                             CommandSubType;
142410e230b6Smaya   uint32_t                             CommandType;
142510e230b6Smaya   uint32_t                             DepthClearValue;
142610e230b6Smaya};
142710e230b6Smaya
142810e230b6Smayastatic inline void
142910e230b6SmayaGEN6_3DSTATE_CLEAR_PARAMS_pack(__attribute__((unused)) __gen_user_data *data,
143010e230b6Smaya                               __attribute__((unused)) void * restrict dst,
143110e230b6Smaya                               __attribute__((unused)) const struct GEN6_3DSTATE_CLEAR_PARAMS * restrict values)
143210e230b6Smaya{
143310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
143410e230b6Smaya
143510e230b6Smaya   dw[0] =
143610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
143710e230b6Smaya      __gen_uint(values->DepthClearValueValid, 15, 15) |
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_uint(values->DepthClearValue, 0, 31);
144510e230b6Smaya}
144610e230b6Smaya
144710e230b6Smaya#define GEN6_3DSTATE_CLIP_length               4
144810e230b6Smaya#define GEN6_3DSTATE_CLIP_length_bias          2
144910e230b6Smaya#define GEN6_3DSTATE_CLIP_header                \
145010e230b6Smaya   .DWordLength                         =      2,  \
145110e230b6Smaya   ._3DCommandSubOpcode                 =     18,  \
145210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
145310e230b6Smaya   .CommandSubType                      =      3,  \
145410e230b6Smaya   .CommandType                         =      3
145510e230b6Smaya
145610e230b6Smayastruct GEN6_3DSTATE_CLIP {
145710e230b6Smaya   uint32_t                             DWordLength;
145810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
145910e230b6Smaya   uint32_t                             _3DCommandOpcode;
146010e230b6Smaya   uint32_t                             CommandSubType;
146110e230b6Smaya   uint32_t                             CommandType;
146210e230b6Smaya   uint32_t                             UserClipDistanceCullTestEnableBitmask;
146310e230b6Smaya   bool                                 StatisticsEnable;
146410e230b6Smaya   uint32_t                             TriangleFanProvokingVertexSelect;
146510e230b6Smaya#define Vertex0                                  0
146610e230b6Smaya#define Vertex1                                  1
146710e230b6Smaya#define Vertex2                                  2
146810e230b6Smaya   uint32_t                             LineStripListProvokingVertexSelect;
146910e230b6Smaya#define Vertex0                                  0
147010e230b6Smaya#define Vertex1                                  1
147110e230b6Smaya   uint32_t                             TriangleStripListProvokingVertexSelect;
147210e230b6Smaya#define Vertex0                                  0
147310e230b6Smaya#define Vertex1                                  1
147410e230b6Smaya#define Vertex2                                  2
147510e230b6Smaya   bool                                 NonPerspectiveBarycentricEnable;
147610e230b6Smaya   bool                                 PerspectiveDivideDisable;
147710e230b6Smaya   uint32_t                             ClipMode;
147810e230b6Smaya#define CLIPMODE_NORMAL                          0
147910e230b6Smaya#define reserved                                 2
148010e230b6Smaya#define CLIPMODE_REJECT_ALL                      3
148110e230b6Smaya#define CLIPMODE_ACCEPT_ALL                      4
148210e230b6Smaya   uint32_t                             UserClipDistanceClipTestEnableBitmask;
148310e230b6Smaya   bool                                 GuardbandClipTestEnable;
148410e230b6Smaya   bool                                 ViewportZClipTestEnable;
148510e230b6Smaya   bool                                 ViewportXYClipTestEnable;
148610e230b6Smaya   uint32_t                             APIMode;
148710e230b6Smaya#define APIMODE_OGL                              0
148810e230b6Smaya#define APIMODE_D3D                              1
148910e230b6Smaya   bool                                 ClipEnable;
149010e230b6Smaya   uint32_t                             MaximumVPIndex;
149110e230b6Smaya   bool                                 ForceZeroRTAIndexEnable;
149210e230b6Smaya   float                                MaximumPointWidth;
149310e230b6Smaya   float                                MinimumPointWidth;
149410e230b6Smaya};
149510e230b6Smaya
149610e230b6Smayastatic inline void
149710e230b6SmayaGEN6_3DSTATE_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
149810e230b6Smaya                       __attribute__((unused)) void * restrict dst,
149910e230b6Smaya                       __attribute__((unused)) const struct GEN6_3DSTATE_CLIP * restrict values)
150010e230b6Smaya{
150110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
150210e230b6Smaya
150310e230b6Smaya   dw[0] =
150410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
150510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
150610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
150710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
150810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
150910e230b6Smaya
151010e230b6Smaya   dw[1] =
151110e230b6Smaya      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
151210e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10);
151310e230b6Smaya
151410e230b6Smaya   dw[2] =
151510e230b6Smaya      __gen_uint(values->TriangleFanProvokingVertexSelect, 0, 1) |
151610e230b6Smaya      __gen_uint(values->LineStripListProvokingVertexSelect, 2, 3) |
151710e230b6Smaya      __gen_uint(values->TriangleStripListProvokingVertexSelect, 4, 5) |
151810e230b6Smaya      __gen_uint(values->NonPerspectiveBarycentricEnable, 8, 8) |
151910e230b6Smaya      __gen_uint(values->PerspectiveDivideDisable, 9, 9) |
152010e230b6Smaya      __gen_uint(values->ClipMode, 13, 15) |
152110e230b6Smaya      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 16, 23) |
152210e230b6Smaya      __gen_uint(values->GuardbandClipTestEnable, 26, 26) |
152310e230b6Smaya      __gen_uint(values->ViewportZClipTestEnable, 27, 27) |
152410e230b6Smaya      __gen_uint(values->ViewportXYClipTestEnable, 28, 28) |
152510e230b6Smaya      __gen_uint(values->APIMode, 30, 30) |
152610e230b6Smaya      __gen_uint(values->ClipEnable, 31, 31);
152710e230b6Smaya
152810e230b6Smaya   dw[3] =
152910e230b6Smaya      __gen_uint(values->MaximumVPIndex, 0, 3) |
153010e230b6Smaya      __gen_uint(values->ForceZeroRTAIndexEnable, 5, 5) |
153110e230b6Smaya      __gen_ufixed(values->MaximumPointWidth, 6, 16, 3) |
153210e230b6Smaya      __gen_ufixed(values->MinimumPointWidth, 17, 27, 3);
153310e230b6Smaya}
153410e230b6Smaya
153510e230b6Smaya#define GEN6_3DSTATE_CONSTANT_GS_length        5
153610e230b6Smaya#define GEN6_3DSTATE_CONSTANT_GS_length_bias      2
153710e230b6Smaya#define GEN6_3DSTATE_CONSTANT_GS_header         \
153810e230b6Smaya   .DWordLength                         =      3,  \
153910e230b6Smaya   ._3DCommandSubOpcode                 =     22,  \
154010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
154110e230b6Smaya   .CommandSubType                      =      3,  \
154210e230b6Smaya   .CommandType                         =      3
154310e230b6Smaya
154410e230b6Smayastruct GEN6_3DSTATE_CONSTANT_GS {
154510e230b6Smaya   uint32_t                             DWordLength;
154610e230b6Smaya   uint32_t                             MOCS;
154710e230b6Smaya   bool                                 Buffer0Valid;
154810e230b6Smaya   bool                                 Buffer1Valid;
154910e230b6Smaya   bool                                 Buffer2Valid;
155010e230b6Smaya   bool                                 Buffer3Valid;
155110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
155210e230b6Smaya   uint32_t                             _3DCommandOpcode;
155310e230b6Smaya   uint32_t                             CommandSubType;
155410e230b6Smaya   uint32_t                             CommandType;
155510e230b6Smaya   struct GEN6_3DSTATE_CONSTANT_BODY    ConstantBody;
155610e230b6Smaya};
155710e230b6Smaya
155810e230b6Smayastatic inline void
155910e230b6SmayaGEN6_3DSTATE_CONSTANT_GS_pack(__attribute__((unused)) __gen_user_data *data,
156010e230b6Smaya                              __attribute__((unused)) void * restrict dst,
156110e230b6Smaya                              __attribute__((unused)) const struct GEN6_3DSTATE_CONSTANT_GS * restrict values)
156210e230b6Smaya{
156310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
156410e230b6Smaya
156510e230b6Smaya   dw[0] =
156610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
156710e230b6Smaya      __gen_uint(values->MOCS, 8, 11) |
156810e230b6Smaya      __gen_uint(values->Buffer0Valid, 12, 12) |
156910e230b6Smaya      __gen_uint(values->Buffer1Valid, 13, 13) |
157010e230b6Smaya      __gen_uint(values->Buffer2Valid, 14, 14) |
157110e230b6Smaya      __gen_uint(values->Buffer3Valid, 15, 15) |
157210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
157310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
157410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
157510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
157610e230b6Smaya
157710e230b6Smaya   GEN6_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
157810e230b6Smaya}
157910e230b6Smaya
158010e230b6Smaya#define GEN6_3DSTATE_CONSTANT_PS_length        5
158110e230b6Smaya#define GEN6_3DSTATE_CONSTANT_PS_length_bias      2
158210e230b6Smaya#define GEN6_3DSTATE_CONSTANT_PS_header         \
158310e230b6Smaya   .DWordLength                         =      3,  \
158410e230b6Smaya   ._3DCommandSubOpcode                 =     23,  \
158510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
158610e230b6Smaya   .CommandSubType                      =      3,  \
158710e230b6Smaya   .CommandType                         =      3
158810e230b6Smaya
158910e230b6Smayastruct GEN6_3DSTATE_CONSTANT_PS {
159010e230b6Smaya   uint32_t                             DWordLength;
159110e230b6Smaya   uint32_t                             MOCS;
159210e230b6Smaya   bool                                 Buffer0Valid;
159310e230b6Smaya   bool                                 Buffer1Valid;
159410e230b6Smaya   bool                                 Buffer2Valid;
159510e230b6Smaya   bool                                 Buffer3Valid;
159610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
159710e230b6Smaya   uint32_t                             _3DCommandOpcode;
159810e230b6Smaya   uint32_t                             CommandSubType;
159910e230b6Smaya   uint32_t                             CommandType;
160010e230b6Smaya   struct GEN6_3DSTATE_CONSTANT_BODY    ConstantBody;
160110e230b6Smaya};
160210e230b6Smaya
160310e230b6Smayastatic inline void
160410e230b6SmayaGEN6_3DSTATE_CONSTANT_PS_pack(__attribute__((unused)) __gen_user_data *data,
160510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
160610e230b6Smaya                              __attribute__((unused)) const struct GEN6_3DSTATE_CONSTANT_PS * restrict values)
160710e230b6Smaya{
160810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
160910e230b6Smaya
161010e230b6Smaya   dw[0] =
161110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
161210e230b6Smaya      __gen_uint(values->MOCS, 8, 11) |
161310e230b6Smaya      __gen_uint(values->Buffer0Valid, 12, 12) |
161410e230b6Smaya      __gen_uint(values->Buffer1Valid, 13, 13) |
161510e230b6Smaya      __gen_uint(values->Buffer2Valid, 14, 14) |
161610e230b6Smaya      __gen_uint(values->Buffer3Valid, 15, 15) |
161710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
161810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
161910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
162010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
162110e230b6Smaya
162210e230b6Smaya   GEN6_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
162310e230b6Smaya}
162410e230b6Smaya
162510e230b6Smaya#define GEN6_3DSTATE_CONSTANT_VS_length        5
162610e230b6Smaya#define GEN6_3DSTATE_CONSTANT_VS_length_bias      2
162710e230b6Smaya#define GEN6_3DSTATE_CONSTANT_VS_header         \
162810e230b6Smaya   .DWordLength                         =      3,  \
162910e230b6Smaya   ._3DCommandSubOpcode                 =     21,  \
163010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
163110e230b6Smaya   .CommandSubType                      =      3,  \
163210e230b6Smaya   .CommandType                         =      3
163310e230b6Smaya
163410e230b6Smayastruct GEN6_3DSTATE_CONSTANT_VS {
163510e230b6Smaya   uint32_t                             DWordLength;
163610e230b6Smaya   uint32_t                             MOCS;
163710e230b6Smaya   bool                                 Buffer0Valid;
163810e230b6Smaya   bool                                 Buffer1Valid;
163910e230b6Smaya   bool                                 Buffer2Valid;
164010e230b6Smaya   bool                                 Buffer3Valid;
164110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
164210e230b6Smaya   uint32_t                             _3DCommandOpcode;
164310e230b6Smaya   uint32_t                             CommandSubType;
164410e230b6Smaya   uint32_t                             CommandType;
164510e230b6Smaya   struct GEN6_3DSTATE_CONSTANT_BODY    ConstantBody;
164610e230b6Smaya};
164710e230b6Smaya
164810e230b6Smayastatic inline void
164910e230b6SmayaGEN6_3DSTATE_CONSTANT_VS_pack(__attribute__((unused)) __gen_user_data *data,
165010e230b6Smaya                              __attribute__((unused)) void * restrict dst,
165110e230b6Smaya                              __attribute__((unused)) const struct GEN6_3DSTATE_CONSTANT_VS * restrict values)
165210e230b6Smaya{
165310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
165410e230b6Smaya
165510e230b6Smaya   dw[0] =
165610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
165710e230b6Smaya      __gen_uint(values->MOCS, 8, 11) |
165810e230b6Smaya      __gen_uint(values->Buffer0Valid, 12, 12) |
165910e230b6Smaya      __gen_uint(values->Buffer1Valid, 13, 13) |
166010e230b6Smaya      __gen_uint(values->Buffer2Valid, 14, 14) |
166110e230b6Smaya      __gen_uint(values->Buffer3Valid, 15, 15) |
166210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
166310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
166410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
166510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
166610e230b6Smaya
166710e230b6Smaya   GEN6_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
166810e230b6Smaya}
166910e230b6Smaya
167010e230b6Smaya#define GEN6_3DSTATE_DEPTH_BUFFER_length       7
167110e230b6Smaya#define GEN6_3DSTATE_DEPTH_BUFFER_length_bias      2
167210e230b6Smaya#define GEN6_3DSTATE_DEPTH_BUFFER_header        \
167310e230b6Smaya   .DWordLength                         =      5,  \
167410e230b6Smaya   ._3DCommandSubOpcode                 =      5,  \
167510e230b6Smaya   ._3DCommandOpcode                    =      1,  \
167610e230b6Smaya   .CommandSubType                      =      3,  \
167710e230b6Smaya   .CommandType                         =      3
167810e230b6Smaya
167910e230b6Smayastruct GEN6_3DSTATE_DEPTH_BUFFER {
168010e230b6Smaya   uint32_t                             DWordLength;
168110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
168210e230b6Smaya   uint32_t                             _3DCommandOpcode;
168310e230b6Smaya   uint32_t                             CommandSubType;
168410e230b6Smaya   uint32_t                             CommandType;
168510e230b6Smaya   uint32_t                             SurfacePitch;
168610e230b6Smaya   uint32_t                             SurfaceFormat;
168710e230b6Smaya#define D32_FLOAT_S8X24_UINT                     0
168810e230b6Smaya#define D32_FLOAT                                1
168910e230b6Smaya#define D24_UNORM_S8_UINT                        2
169010e230b6Smaya#define D24_UNORM_X8_UINT                        3
169110e230b6Smaya#define D16_UNORM                                5
169210e230b6Smaya   bool                                 SeparateStencilBufferEnable;
169310e230b6Smaya   bool                                 HierarchicalDepthBufferEnable;
169410e230b6Smaya   uint32_t                             SoftwareTiledRenderingMode;
169510e230b6Smaya#define NORMAL                                   0
169610e230b6Smaya#define STR1                                     1
169710e230b6Smaya#define STR2                                     3
169810e230b6Smaya   uint32_t                             TileWalk;
169910e230b6Smaya#define TILEWALK_YMAJOR                          1
170010e230b6Smaya   bool                                 TiledSurface;
170110e230b6Smaya   uint32_t                             SurfaceType;
170210e230b6Smaya#define SURFTYPE_1D                              0
170310e230b6Smaya#define SURFTYPE_2D                              1
170410e230b6Smaya#define SURFTYPE_3D                              2
170510e230b6Smaya#define SURFTYPE_CUBE                            3
170610e230b6Smaya#define SURFTYPE_NULL                            7
170710e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
170810e230b6Smaya   uint32_t                             MIPMapLayoutMode;
170910e230b6Smaya#define MIPLAYOUT_BELOW                          0
171010e230b6Smaya#define MIPLAYOUT_RIGHT                          1
171110e230b6Smaya   uint32_t                             LOD;
171210e230b6Smaya   uint32_t                             Width;
171310e230b6Smaya   uint32_t                             Height;
171410e230b6Smaya   uint32_t                             RenderTargetViewExtent;
171510e230b6Smaya   uint32_t                             MinimumArrayElement;
171610e230b6Smaya   uint32_t                             Depth;
171710e230b6Smaya   int32_t                              DepthCoordinateOffsetX;
171810e230b6Smaya   int32_t                              DepthCoordinateOffsetY;
171910e230b6Smaya   uint32_t                             MOCS;
172010e230b6Smaya};
172110e230b6Smaya
172210e230b6Smayastatic inline void
172310e230b6SmayaGEN6_3DSTATE_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
172410e230b6Smaya                               __attribute__((unused)) void * restrict dst,
172510e230b6Smaya                               __attribute__((unused)) const struct GEN6_3DSTATE_DEPTH_BUFFER * restrict values)
172610e230b6Smaya{
172710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
172810e230b6Smaya
172910e230b6Smaya   dw[0] =
173010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
173110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
173210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
173310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
173410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
173510e230b6Smaya
173610e230b6Smaya   dw[1] =
173710e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 16) |
173810e230b6Smaya      __gen_uint(values->SurfaceFormat, 18, 20) |
173910e230b6Smaya      __gen_uint(values->SeparateStencilBufferEnable, 21, 21) |
174010e230b6Smaya      __gen_uint(values->HierarchicalDepthBufferEnable, 22, 22) |
174110e230b6Smaya      __gen_uint(values->SoftwareTiledRenderingMode, 23, 24) |
174210e230b6Smaya      __gen_uint(values->TileWalk, 26, 26) |
174310e230b6Smaya      __gen_uint(values->TiledSurface, 27, 27) |
174410e230b6Smaya      __gen_uint(values->SurfaceType, 29, 31);
174510e230b6Smaya
174610e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
174710e230b6Smaya
174810e230b6Smaya   dw[3] =
174910e230b6Smaya      __gen_uint(values->MIPMapLayoutMode, 1, 1) |
175010e230b6Smaya      __gen_uint(values->LOD, 2, 5) |
175110e230b6Smaya      __gen_uint(values->Width, 6, 18) |
175210e230b6Smaya      __gen_uint(values->Height, 19, 31);
175310e230b6Smaya
175410e230b6Smaya   dw[4] =
175510e230b6Smaya      __gen_uint(values->RenderTargetViewExtent, 1, 9) |
175610e230b6Smaya      __gen_uint(values->MinimumArrayElement, 10, 20) |
175710e230b6Smaya      __gen_uint(values->Depth, 21, 31);
175810e230b6Smaya
175910e230b6Smaya   dw[5] =
176010e230b6Smaya      __gen_sint(values->DepthCoordinateOffsetX, 0, 15) |
176110e230b6Smaya      __gen_sint(values->DepthCoordinateOffsetY, 16, 31);
176210e230b6Smaya
176310e230b6Smaya   dw[6] =
176410e230b6Smaya      __gen_uint(values->MOCS, 27, 31);
176510e230b6Smaya}
176610e230b6Smaya
176710e230b6Smaya#define GEN6_3DSTATE_DRAWING_RECTANGLE_length      4
176810e230b6Smaya#define GEN6_3DSTATE_DRAWING_RECTANGLE_length_bias      2
176910e230b6Smaya#define GEN6_3DSTATE_DRAWING_RECTANGLE_header   \
177010e230b6Smaya   .DWordLength                         =      2,  \
177110e230b6Smaya   ._3DCommandSubOpcode                 =      0,  \
177210e230b6Smaya   ._3DCommandOpcode                    =      1,  \
177310e230b6Smaya   .CommandSubType                      =      3,  \
177410e230b6Smaya   .CommandType                         =      3
177510e230b6Smaya
177610e230b6Smayastruct GEN6_3DSTATE_DRAWING_RECTANGLE {
177710e230b6Smaya   uint32_t                             DWordLength;
177810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
177910e230b6Smaya   uint32_t                             _3DCommandOpcode;
178010e230b6Smaya   uint32_t                             CommandSubType;
178110e230b6Smaya   uint32_t                             CommandType;
178210e230b6Smaya   uint32_t                             ClippedDrawingRectangleXMin;
178310e230b6Smaya   uint32_t                             ClippedDrawingRectangleYMin;
178410e230b6Smaya   uint32_t                             ClippedDrawingRectangleXMax;
178510e230b6Smaya   uint32_t                             ClippedDrawingRectangleYMax;
178610e230b6Smaya   int32_t                              DrawingRectangleOriginX;
178710e230b6Smaya   int32_t                              DrawingRectangleOriginY;
178810e230b6Smaya};
178910e230b6Smaya
179010e230b6Smayastatic inline void
179110e230b6SmayaGEN6_3DSTATE_DRAWING_RECTANGLE_pack(__attribute__((unused)) __gen_user_data *data,
179210e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
179310e230b6Smaya                                    __attribute__((unused)) const struct GEN6_3DSTATE_DRAWING_RECTANGLE * restrict values)
179410e230b6Smaya{
179510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
179610e230b6Smaya
179710e230b6Smaya   dw[0] =
179810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
179910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
180010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
180110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
180210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
180310e230b6Smaya
180410e230b6Smaya   dw[1] =
180510e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleXMin, 0, 15) |
180610e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleYMin, 16, 31);
180710e230b6Smaya
180810e230b6Smaya   dw[2] =
180910e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleXMax, 0, 15) |
181010e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleYMax, 16, 31);
181110e230b6Smaya
181210e230b6Smaya   dw[3] =
181310e230b6Smaya      __gen_sint(values->DrawingRectangleOriginX, 0, 15) |
181410e230b6Smaya      __gen_sint(values->DrawingRectangleOriginY, 16, 31);
181510e230b6Smaya}
181610e230b6Smaya
181710e230b6Smaya#define GEN6_3DSTATE_GS_length                 7
181810e230b6Smaya#define GEN6_3DSTATE_GS_length_bias            2
181910e230b6Smaya#define GEN6_3DSTATE_GS_header                  \
182010e230b6Smaya   .DWordLength                         =      5,  \
182110e230b6Smaya   ._3DCommandSubOpcode                 =     17,  \
182210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
182310e230b6Smaya   .CommandSubType                      =      3,  \
182410e230b6Smaya   .CommandType                         =      3
182510e230b6Smaya
182610e230b6Smayastruct GEN6_3DSTATE_GS {
182710e230b6Smaya   uint32_t                             DWordLength;
182810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
182910e230b6Smaya   uint32_t                             _3DCommandOpcode;
183010e230b6Smaya   uint32_t                             CommandSubType;
183110e230b6Smaya   uint32_t                             CommandType;
183210e230b6Smaya   uint64_t                             KernelStartPointer;
183310e230b6Smaya   bool                                 SoftwareExceptionEnable;
183410e230b6Smaya   bool                                 MaskStackExceptionEnable;
183510e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
183610e230b6Smaya   uint32_t                             FloatingPointMode;
183710e230b6Smaya#define IEEE754                                  0
183810e230b6Smaya#define Alternate                                1
183910e230b6Smaya   uint32_t                             ThreadPriority;
184010e230b6Smaya#define NormalPriority                           0
184110e230b6Smaya#define HighPriority                             1
184210e230b6Smaya   uint32_t                             BindingTableEntryCount;
184310e230b6Smaya   uint32_t                             SamplerCount;
184410e230b6Smaya#define NoSamplers                               0
184510e230b6Smaya#define _14Samplers                              1
184610e230b6Smaya#define _58Samplers                              2
184710e230b6Smaya#define _912Samplers                             3
184810e230b6Smaya#define _1316Samplers                            4
184910e230b6Smaya   bool                                 VectorMaskEnable;
185010e230b6Smaya   bool                                 SingleProgramFlow;
185110e230b6Smaya   uint32_t                             PerThreadScratchSpace;
185210e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
185310e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData;
185410e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
185510e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
185610e230b6Smaya   uint32_t                             RenderingEnabled;
185710e230b6Smaya   bool                                 SOStatisticsEnable;
185810e230b6Smaya   bool                                 StatisticsEnable;
185910e230b6Smaya   uint32_t                             MaximumNumberofThreads;
186010e230b6Smaya   bool                                 Enable;
186110e230b6Smaya   uint32_t                             SVBIPostIncrementValue;
186210e230b6Smaya   bool                                 SVBIPostIncrementEnable;
186310e230b6Smaya   bool                                 SVBIPayloadEnable;
186410e230b6Smaya   bool                                 DiscardAdjacency;
186510e230b6Smaya   uint32_t                             ReorderMode;
186610e230b6Smaya#define LEADING                                  0
186710e230b6Smaya#define TRAILING                                 1
186810e230b6Smaya};
186910e230b6Smaya
187010e230b6Smayastatic inline void
187110e230b6SmayaGEN6_3DSTATE_GS_pack(__attribute__((unused)) __gen_user_data *data,
187210e230b6Smaya                     __attribute__((unused)) void * restrict dst,
187310e230b6Smaya                     __attribute__((unused)) const struct GEN6_3DSTATE_GS * restrict values)
187410e230b6Smaya{
187510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
187610e230b6Smaya
187710e230b6Smaya   dw[0] =
187810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
187910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
188010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
188110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
188210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
188310e230b6Smaya
188410e230b6Smaya   dw[1] =
188510e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 31);
188610e230b6Smaya
188710e230b6Smaya   dw[2] =
188810e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
188910e230b6Smaya      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
189010e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
189110e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
189210e230b6Smaya      __gen_uint(values->ThreadPriority, 17, 17) |
189310e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
189410e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
189510e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
189610e230b6Smaya      __gen_uint(values->SingleProgramFlow, 31, 31);
189710e230b6Smaya
189810e230b6Smaya   const uint32_t v3 =
189910e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
190010e230b6Smaya   dw[3] = __gen_combine_address(data, &dw[3], values->ScratchSpaceBasePointer, v3);
190110e230b6Smaya
190210e230b6Smaya   dw[4] =
190310e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData, 0, 3) |
190410e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
190510e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 16);
190610e230b6Smaya
190710e230b6Smaya   dw[5] =
190810e230b6Smaya      __gen_uint(values->RenderingEnabled, 8, 8) |
190910e230b6Smaya      __gen_uint(values->SOStatisticsEnable, 9, 9) |
191010e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
191110e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 25, 31);
191210e230b6Smaya
191310e230b6Smaya   dw[6] =
191410e230b6Smaya      __gen_uint(values->Enable, 15, 15) |
191510e230b6Smaya      __gen_uint(values->SVBIPostIncrementValue, 16, 25) |
191610e230b6Smaya      __gen_uint(values->SVBIPostIncrementEnable, 27, 27) |
191710e230b6Smaya      __gen_uint(values->SVBIPayloadEnable, 28, 28) |
191810e230b6Smaya      __gen_uint(values->DiscardAdjacency, 29, 29) |
191910e230b6Smaya      __gen_uint(values->ReorderMode, 30, 30);
192010e230b6Smaya}
192110e230b6Smaya
192210e230b6Smaya#define GEN6_3DSTATE_GS_SVB_INDEX_length       7
192310e230b6Smaya#define GEN6_3DSTATE_GS_SVB_INDEX_length_bias      2
192410e230b6Smaya#define GEN6_3DSTATE_GS_SVB_INDEX_header        \
192510e230b6Smaya   .DWordLength                         =      5,  \
192610e230b6Smaya   ._3DCommandSubOpcode                 =     11,  \
192710e230b6Smaya   ._3DCommandOpcode                    =      1,  \
192810e230b6Smaya   .CommandSubType                      =      3,  \
192910e230b6Smaya   .CommandType                         =      3
193010e230b6Smaya
193110e230b6Smayastruct GEN6_3DSTATE_GS_SVB_INDEX {
193210e230b6Smaya   uint32_t                             DWordLength;
193310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
193410e230b6Smaya   uint32_t                             _3DCommandOpcode;
193510e230b6Smaya   uint32_t                             CommandSubType;
193610e230b6Smaya   uint32_t                             CommandType;
193710e230b6Smaya   uint32_t                             LoadInternalVertexCount;
193810e230b6Smaya   uint32_t                             IndexNumber;
193910e230b6Smaya   uint32_t                             StreamedVertexBufferIndex;
194010e230b6Smaya   uint32_t                             MaximumIndex;
194110e230b6Smaya};
194210e230b6Smaya
194310e230b6Smayastatic inline void
194410e230b6SmayaGEN6_3DSTATE_GS_SVB_INDEX_pack(__attribute__((unused)) __gen_user_data *data,
194510e230b6Smaya                               __attribute__((unused)) void * restrict dst,
194610e230b6Smaya                               __attribute__((unused)) const struct GEN6_3DSTATE_GS_SVB_INDEX * restrict values)
194710e230b6Smaya{
194810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
194910e230b6Smaya
195010e230b6Smaya   dw[0] =
195110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
195210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
195310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
195410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
195510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
195610e230b6Smaya
195710e230b6Smaya   dw[1] =
195810e230b6Smaya      __gen_uint(values->LoadInternalVertexCount, 0, 0) |
195910e230b6Smaya      __gen_uint(values->IndexNumber, 29, 30);
196010e230b6Smaya
196110e230b6Smaya   dw[2] =
196210e230b6Smaya      __gen_uint(values->StreamedVertexBufferIndex, 0, 31);
196310e230b6Smaya
196410e230b6Smaya   dw[3] =
196510e230b6Smaya      __gen_uint(values->MaximumIndex, 0, 31);
196610e230b6Smaya
196710e230b6Smaya   dw[4] = 0;
196810e230b6Smaya
196910e230b6Smaya   dw[5] = 0;
197010e230b6Smaya
197110e230b6Smaya   dw[6] = 0;
197210e230b6Smaya}
197310e230b6Smaya
197410e230b6Smaya#define GEN6_3DSTATE_HIER_DEPTH_BUFFER_length      3
197510e230b6Smaya#define GEN6_3DSTATE_HIER_DEPTH_BUFFER_length_bias      2
197610e230b6Smaya#define GEN6_3DSTATE_HIER_DEPTH_BUFFER_header   \
197710e230b6Smaya   .DWordLength                         =      1,  \
197810e230b6Smaya   ._3DCommandSubOpcode                 =     15,  \
197910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
198010e230b6Smaya   .CommandSubType                      =      3,  \
198110e230b6Smaya   .CommandType                         =      3
198210e230b6Smaya
198310e230b6Smayastruct GEN6_3DSTATE_HIER_DEPTH_BUFFER {
198410e230b6Smaya   uint32_t                             DWordLength;
198510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
198610e230b6Smaya   uint32_t                             _3DCommandOpcode;
198710e230b6Smaya   uint32_t                             CommandSubType;
198810e230b6Smaya   uint32_t                             CommandType;
198910e230b6Smaya   uint32_t                             SurfacePitch;
199010e230b6Smaya   uint32_t                             MOCS;
199110e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
199210e230b6Smaya};
199310e230b6Smaya
199410e230b6Smayastatic inline void
199510e230b6SmayaGEN6_3DSTATE_HIER_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
199610e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
199710e230b6Smaya                                    __attribute__((unused)) const struct GEN6_3DSTATE_HIER_DEPTH_BUFFER * restrict values)
199810e230b6Smaya{
199910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
200010e230b6Smaya
200110e230b6Smaya   dw[0] =
200210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
200310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
200410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
200510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
200610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
200710e230b6Smaya
200810e230b6Smaya   dw[1] =
200910e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 16) |
201010e230b6Smaya      __gen_uint(values->MOCS, 25, 28);
201110e230b6Smaya
201210e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
201310e230b6Smaya}
201410e230b6Smaya
201510e230b6Smaya#define GEN6_3DSTATE_INDEX_BUFFER_length       3
201610e230b6Smaya#define GEN6_3DSTATE_INDEX_BUFFER_length_bias      2
201710e230b6Smaya#define GEN6_3DSTATE_INDEX_BUFFER_header        \
201810e230b6Smaya   .DWordLength                         =      1,  \
201910e230b6Smaya   ._3DCommandSubOpcode                 =     10,  \
202010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
202110e230b6Smaya   .CommandSubType                      =      3,  \
202210e230b6Smaya   .CommandType                         =      3
202310e230b6Smaya
202410e230b6Smayastruct GEN6_3DSTATE_INDEX_BUFFER {
202510e230b6Smaya   uint32_t                             DWordLength;
202610e230b6Smaya   uint32_t                             IndexFormat;
202710e230b6Smaya#define INDEX_BYTE                               0
202810e230b6Smaya#define INDEX_WORD                               1
202910e230b6Smaya#define INDEX_DWORD                              2
203010e230b6Smaya   bool                                 CutIndexEnable;
203110e230b6Smaya   uint32_t                             MOCS;
203210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
203310e230b6Smaya   uint32_t                             _3DCommandOpcode;
203410e230b6Smaya   uint32_t                             CommandSubType;
203510e230b6Smaya   uint32_t                             CommandType;
203610e230b6Smaya   __gen_address_type                   BufferStartingAddress;
203710e230b6Smaya   __gen_address_type                   BufferEndingAddress;
203810e230b6Smaya};
203910e230b6Smaya
204010e230b6Smayastatic inline void
204110e230b6SmayaGEN6_3DSTATE_INDEX_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
204210e230b6Smaya                               __attribute__((unused)) void * restrict dst,
204310e230b6Smaya                               __attribute__((unused)) const struct GEN6_3DSTATE_INDEX_BUFFER * restrict values)
204410e230b6Smaya{
204510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
204610e230b6Smaya
204710e230b6Smaya   dw[0] =
204810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
204910e230b6Smaya      __gen_uint(values->IndexFormat, 8, 9) |
205010e230b6Smaya      __gen_uint(values->CutIndexEnable, 10, 10) |
205110e230b6Smaya      __gen_uint(values->MOCS, 12, 15) |
205210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
205310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
205410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
205510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
205610e230b6Smaya
205710e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->BufferStartingAddress, 0);
205810e230b6Smaya
205910e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->BufferEndingAddress, 0);
206010e230b6Smaya}
206110e230b6Smaya
206210e230b6Smaya#define GEN6_3DSTATE_LINE_STIPPLE_length       3
206310e230b6Smaya#define GEN6_3DSTATE_LINE_STIPPLE_length_bias      2
206410e230b6Smaya#define GEN6_3DSTATE_LINE_STIPPLE_header        \
206510e230b6Smaya   .DWordLength                         =      1,  \
206610e230b6Smaya   ._3DCommandSubOpcode                 =      8,  \
206710e230b6Smaya   ._3DCommandOpcode                    =      1,  \
206810e230b6Smaya   .CommandSubType                      =      3,  \
206910e230b6Smaya   .CommandType                         =      3
207010e230b6Smaya
207110e230b6Smayastruct GEN6_3DSTATE_LINE_STIPPLE {
207210e230b6Smaya   uint32_t                             DWordLength;
207310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
207410e230b6Smaya   uint32_t                             _3DCommandOpcode;
207510e230b6Smaya   uint32_t                             CommandSubType;
207610e230b6Smaya   uint32_t                             CommandType;
207710e230b6Smaya   uint32_t                             LineStipplePattern;
207810e230b6Smaya   uint32_t                             CurrentStippleIndex;
207910e230b6Smaya   uint32_t                             CurrentRepeatCounter;
208010e230b6Smaya   bool                                 ModifyEnableCurrentRepeatCounterCurrentStippleIndex;
208110e230b6Smaya   uint32_t                             LineStippleRepeatCount;
208210e230b6Smaya   float                                LineStippleInverseRepeatCount;
208310e230b6Smaya};
208410e230b6Smaya
208510e230b6Smayastatic inline void
208610e230b6SmayaGEN6_3DSTATE_LINE_STIPPLE_pack(__attribute__((unused)) __gen_user_data *data,
208710e230b6Smaya                               __attribute__((unused)) void * restrict dst,
208810e230b6Smaya                               __attribute__((unused)) const struct GEN6_3DSTATE_LINE_STIPPLE * restrict values)
208910e230b6Smaya{
209010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
209110e230b6Smaya
209210e230b6Smaya   dw[0] =
209310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
209410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
209510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
209610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
209710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
209810e230b6Smaya
209910e230b6Smaya   dw[1] =
210010e230b6Smaya      __gen_uint(values->LineStipplePattern, 0, 15) |
210110e230b6Smaya      __gen_uint(values->CurrentStippleIndex, 16, 19) |
210210e230b6Smaya      __gen_uint(values->CurrentRepeatCounter, 21, 29) |
210310e230b6Smaya      __gen_uint(values->ModifyEnableCurrentRepeatCounterCurrentStippleIndex, 31, 31);
210410e230b6Smaya
210510e230b6Smaya   dw[2] =
210610e230b6Smaya      __gen_uint(values->LineStippleRepeatCount, 0, 8) |
210710e230b6Smaya      __gen_ufixed(values->LineStippleInverseRepeatCount, 16, 31, 13);
210810e230b6Smaya}
210910e230b6Smaya
211010e230b6Smaya#define GEN6_3DSTATE_MONOFILTER_SIZE_length      2
211110e230b6Smaya#define GEN6_3DSTATE_MONOFILTER_SIZE_length_bias      2
211210e230b6Smaya#define GEN6_3DSTATE_MONOFILTER_SIZE_header     \
211310e230b6Smaya   .DWordLength                         =      0,  \
211410e230b6Smaya   ._3DCommandSubOpcode                 =     17,  \
211510e230b6Smaya   ._3DCommandOpcode                    =      1,  \
211610e230b6Smaya   .CommandSubType                      =      3,  \
211710e230b6Smaya   .CommandType                         =      3
211810e230b6Smaya
211910e230b6Smayastruct GEN6_3DSTATE_MONOFILTER_SIZE {
212010e230b6Smaya   uint32_t                             DWordLength;
212110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
212210e230b6Smaya   uint32_t                             _3DCommandOpcode;
212310e230b6Smaya   uint32_t                             CommandSubType;
212410e230b6Smaya   uint32_t                             CommandType;
212510e230b6Smaya   uint32_t                             MonochromeFilterHeight;
212610e230b6Smaya   uint32_t                             MonochromeFilterWidth;
212710e230b6Smaya};
212810e230b6Smaya
212910e230b6Smayastatic inline void
213010e230b6SmayaGEN6_3DSTATE_MONOFILTER_SIZE_pack(__attribute__((unused)) __gen_user_data *data,
213110e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
213210e230b6Smaya                                  __attribute__((unused)) const struct GEN6_3DSTATE_MONOFILTER_SIZE * restrict values)
213310e230b6Smaya{
213410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
213510e230b6Smaya
213610e230b6Smaya   dw[0] =
213710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
213810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
213910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
214010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
214110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
214210e230b6Smaya
214310e230b6Smaya   dw[1] =
214410e230b6Smaya      __gen_uint(values->MonochromeFilterHeight, 0, 2) |
214510e230b6Smaya      __gen_uint(values->MonochromeFilterWidth, 3, 5);
214610e230b6Smaya}
214710e230b6Smaya
214810e230b6Smaya#define GEN6_3DSTATE_MULTISAMPLE_length        3
214910e230b6Smaya#define GEN6_3DSTATE_MULTISAMPLE_length_bias      2
215010e230b6Smaya#define GEN6_3DSTATE_MULTISAMPLE_header         \
215110e230b6Smaya   .DWordLength                         =      1,  \
215210e230b6Smaya   ._3DCommandSubOpcode                 =     13,  \
215310e230b6Smaya   ._3DCommandOpcode                    =      1,  \
215410e230b6Smaya   .CommandSubType                      =      3,  \
215510e230b6Smaya   .CommandType                         =      3
215610e230b6Smaya
215710e230b6Smayastruct GEN6_3DSTATE_MULTISAMPLE {
215810e230b6Smaya   uint32_t                             DWordLength;
215910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
216010e230b6Smaya   uint32_t                             _3DCommandOpcode;
216110e230b6Smaya   uint32_t                             CommandSubType;
216210e230b6Smaya   uint32_t                             CommandType;
216310e230b6Smaya   uint32_t                             NumberofMultisamples;
216410e230b6Smaya#define NUMSAMPLES_1                             0
216510e230b6Smaya#define NUMSAMPLES_4                             2
216610e230b6Smaya   uint32_t                             PixelLocation;
216710e230b6Smaya#define CENTER                                   0
216810e230b6Smaya#define UL_CORNER                                1
216910e230b6Smaya   float                                Sample0YOffset;
217010e230b6Smaya   float                                Sample0XOffset;
217110e230b6Smaya   float                                Sample1YOffset;
217210e230b6Smaya   float                                Sample1XOffset;
217310e230b6Smaya   float                                Sample2YOffset;
217410e230b6Smaya   float                                Sample2XOffset;
217510e230b6Smaya   float                                Sample3YOffset;
217610e230b6Smaya   float                                Sample3XOffset;
217710e230b6Smaya};
217810e230b6Smaya
217910e230b6Smayastatic inline void
218010e230b6SmayaGEN6_3DSTATE_MULTISAMPLE_pack(__attribute__((unused)) __gen_user_data *data,
218110e230b6Smaya                              __attribute__((unused)) void * restrict dst,
218210e230b6Smaya                              __attribute__((unused)) const struct GEN6_3DSTATE_MULTISAMPLE * restrict values)
218310e230b6Smaya{
218410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
218510e230b6Smaya
218610e230b6Smaya   dw[0] =
218710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
218810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
218910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
219010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
219110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
219210e230b6Smaya
219310e230b6Smaya   dw[1] =
219410e230b6Smaya      __gen_uint(values->NumberofMultisamples, 1, 3) |
219510e230b6Smaya      __gen_uint(values->PixelLocation, 4, 4);
219610e230b6Smaya
219710e230b6Smaya   dw[2] =
219810e230b6Smaya      __gen_ufixed(values->Sample0YOffset, 0, 3, 4) |
219910e230b6Smaya      __gen_ufixed(values->Sample0XOffset, 4, 7, 4) |
220010e230b6Smaya      __gen_ufixed(values->Sample1YOffset, 8, 11, 4) |
220110e230b6Smaya      __gen_ufixed(values->Sample1XOffset, 12, 15, 4) |
220210e230b6Smaya      __gen_ufixed(values->Sample2YOffset, 16, 19, 4) |
220310e230b6Smaya      __gen_ufixed(values->Sample2XOffset, 20, 23, 4) |
220410e230b6Smaya      __gen_ufixed(values->Sample3YOffset, 24, 27, 4) |
220510e230b6Smaya      __gen_ufixed(values->Sample3XOffset, 28, 31, 4);
220610e230b6Smaya}
220710e230b6Smaya
220810e230b6Smaya#define GEN6_3DSTATE_POLY_STIPPLE_OFFSET_length      2
220910e230b6Smaya#define GEN6_3DSTATE_POLY_STIPPLE_OFFSET_length_bias      2
221010e230b6Smaya#define GEN6_3DSTATE_POLY_STIPPLE_OFFSET_header \
221110e230b6Smaya   .DWordLength                         =      0,  \
221210e230b6Smaya   ._3DCommandSubOpcode                 =      6,  \
221310e230b6Smaya   ._3DCommandOpcode                    =      1,  \
221410e230b6Smaya   .CommandSubType                      =      3,  \
221510e230b6Smaya   .CommandType                         =      3
221610e230b6Smaya
221710e230b6Smayastruct GEN6_3DSTATE_POLY_STIPPLE_OFFSET {
221810e230b6Smaya   uint32_t                             DWordLength;
221910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
222010e230b6Smaya   uint32_t                             _3DCommandOpcode;
222110e230b6Smaya   uint32_t                             CommandSubType;
222210e230b6Smaya   uint32_t                             CommandType;
222310e230b6Smaya   uint32_t                             PolygonStippleYOffset;
222410e230b6Smaya   uint32_t                             PolygonStippleXOffset;
222510e230b6Smaya};
222610e230b6Smaya
222710e230b6Smayastatic inline void
222810e230b6SmayaGEN6_3DSTATE_POLY_STIPPLE_OFFSET_pack(__attribute__((unused)) __gen_user_data *data,
222910e230b6Smaya                                      __attribute__((unused)) void * restrict dst,
223010e230b6Smaya                                      __attribute__((unused)) const struct GEN6_3DSTATE_POLY_STIPPLE_OFFSET * restrict values)
223110e230b6Smaya{
223210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
223310e230b6Smaya
223410e230b6Smaya   dw[0] =
223510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
223610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
223710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
223810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
223910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
224010e230b6Smaya
224110e230b6Smaya   dw[1] =
224210e230b6Smaya      __gen_uint(values->PolygonStippleYOffset, 0, 4) |
224310e230b6Smaya      __gen_uint(values->PolygonStippleXOffset, 8, 12);
224410e230b6Smaya}
224510e230b6Smaya
224610e230b6Smaya#define GEN6_3DSTATE_POLY_STIPPLE_PATTERN_length     33
224710e230b6Smaya#define GEN6_3DSTATE_POLY_STIPPLE_PATTERN_length_bias      2
224810e230b6Smaya#define GEN6_3DSTATE_POLY_STIPPLE_PATTERN_header\
224910e230b6Smaya   .DWordLength                         =     31,  \
225010e230b6Smaya   ._3DCommandSubOpcode                 =      7,  \
225110e230b6Smaya   ._3DCommandOpcode                    =      1,  \
225210e230b6Smaya   .CommandSubType                      =      3,  \
225310e230b6Smaya   .CommandType                         =      3
225410e230b6Smaya
225510e230b6Smayastruct GEN6_3DSTATE_POLY_STIPPLE_PATTERN {
225610e230b6Smaya   uint32_t                             DWordLength;
225710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
225810e230b6Smaya   uint32_t                             _3DCommandOpcode;
225910e230b6Smaya   uint32_t                             CommandSubType;
226010e230b6Smaya   uint32_t                             CommandType;
226110e230b6Smaya   uint32_t                             PatternRow[32];
226210e230b6Smaya};
226310e230b6Smaya
226410e230b6Smayastatic inline void
226510e230b6SmayaGEN6_3DSTATE_POLY_STIPPLE_PATTERN_pack(__attribute__((unused)) __gen_user_data *data,
226610e230b6Smaya                                       __attribute__((unused)) void * restrict dst,
226710e230b6Smaya                                       __attribute__((unused)) const struct GEN6_3DSTATE_POLY_STIPPLE_PATTERN * restrict values)
226810e230b6Smaya{
226910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
227010e230b6Smaya
227110e230b6Smaya   dw[0] =
227210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
227310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
227410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
227510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
227610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
227710e230b6Smaya
227810e230b6Smaya   dw[1] =
227910e230b6Smaya      __gen_uint(values->PatternRow[0], 0, 31);
228010e230b6Smaya
228110e230b6Smaya   dw[2] =
228210e230b6Smaya      __gen_uint(values->PatternRow[1], 0, 31);
228310e230b6Smaya
228410e230b6Smaya   dw[3] =
228510e230b6Smaya      __gen_uint(values->PatternRow[2], 0, 31);
228610e230b6Smaya
228710e230b6Smaya   dw[4] =
228810e230b6Smaya      __gen_uint(values->PatternRow[3], 0, 31);
228910e230b6Smaya
229010e230b6Smaya   dw[5] =
229110e230b6Smaya      __gen_uint(values->PatternRow[4], 0, 31);
229210e230b6Smaya
229310e230b6Smaya   dw[6] =
229410e230b6Smaya      __gen_uint(values->PatternRow[5], 0, 31);
229510e230b6Smaya
229610e230b6Smaya   dw[7] =
229710e230b6Smaya      __gen_uint(values->PatternRow[6], 0, 31);
229810e230b6Smaya
229910e230b6Smaya   dw[8] =
230010e230b6Smaya      __gen_uint(values->PatternRow[7], 0, 31);
230110e230b6Smaya
230210e230b6Smaya   dw[9] =
230310e230b6Smaya      __gen_uint(values->PatternRow[8], 0, 31);
230410e230b6Smaya
230510e230b6Smaya   dw[10] =
230610e230b6Smaya      __gen_uint(values->PatternRow[9], 0, 31);
230710e230b6Smaya
230810e230b6Smaya   dw[11] =
230910e230b6Smaya      __gen_uint(values->PatternRow[10], 0, 31);
231010e230b6Smaya
231110e230b6Smaya   dw[12] =
231210e230b6Smaya      __gen_uint(values->PatternRow[11], 0, 31);
231310e230b6Smaya
231410e230b6Smaya   dw[13] =
231510e230b6Smaya      __gen_uint(values->PatternRow[12], 0, 31);
231610e230b6Smaya
231710e230b6Smaya   dw[14] =
231810e230b6Smaya      __gen_uint(values->PatternRow[13], 0, 31);
231910e230b6Smaya
232010e230b6Smaya   dw[15] =
232110e230b6Smaya      __gen_uint(values->PatternRow[14], 0, 31);
232210e230b6Smaya
232310e230b6Smaya   dw[16] =
232410e230b6Smaya      __gen_uint(values->PatternRow[15], 0, 31);
232510e230b6Smaya
232610e230b6Smaya   dw[17] =
232710e230b6Smaya      __gen_uint(values->PatternRow[16], 0, 31);
232810e230b6Smaya
232910e230b6Smaya   dw[18] =
233010e230b6Smaya      __gen_uint(values->PatternRow[17], 0, 31);
233110e230b6Smaya
233210e230b6Smaya   dw[19] =
233310e230b6Smaya      __gen_uint(values->PatternRow[18], 0, 31);
233410e230b6Smaya
233510e230b6Smaya   dw[20] =
233610e230b6Smaya      __gen_uint(values->PatternRow[19], 0, 31);
233710e230b6Smaya
233810e230b6Smaya   dw[21] =
233910e230b6Smaya      __gen_uint(values->PatternRow[20], 0, 31);
234010e230b6Smaya
234110e230b6Smaya   dw[22] =
234210e230b6Smaya      __gen_uint(values->PatternRow[21], 0, 31);
234310e230b6Smaya
234410e230b6Smaya   dw[23] =
234510e230b6Smaya      __gen_uint(values->PatternRow[22], 0, 31);
234610e230b6Smaya
234710e230b6Smaya   dw[24] =
234810e230b6Smaya      __gen_uint(values->PatternRow[23], 0, 31);
234910e230b6Smaya
235010e230b6Smaya   dw[25] =
235110e230b6Smaya      __gen_uint(values->PatternRow[24], 0, 31);
235210e230b6Smaya
235310e230b6Smaya   dw[26] =
235410e230b6Smaya      __gen_uint(values->PatternRow[25], 0, 31);
235510e230b6Smaya
235610e230b6Smaya   dw[27] =
235710e230b6Smaya      __gen_uint(values->PatternRow[26], 0, 31);
235810e230b6Smaya
235910e230b6Smaya   dw[28] =
236010e230b6Smaya      __gen_uint(values->PatternRow[27], 0, 31);
236110e230b6Smaya
236210e230b6Smaya   dw[29] =
236310e230b6Smaya      __gen_uint(values->PatternRow[28], 0, 31);
236410e230b6Smaya
236510e230b6Smaya   dw[30] =
236610e230b6Smaya      __gen_uint(values->PatternRow[29], 0, 31);
236710e230b6Smaya
236810e230b6Smaya   dw[31] =
236910e230b6Smaya      __gen_uint(values->PatternRow[30], 0, 31);
237010e230b6Smaya
237110e230b6Smaya   dw[32] =
237210e230b6Smaya      __gen_uint(values->PatternRow[31], 0, 31);
237310e230b6Smaya}
237410e230b6Smaya
237510e230b6Smaya#define GEN6_3DSTATE_SAMPLER_PALETTE_LOAD0_length_bias      2
237610e230b6Smaya#define GEN6_3DSTATE_SAMPLER_PALETTE_LOAD0_header\
237710e230b6Smaya   ._3DCommandSubOpcode                 =      2,  \
237810e230b6Smaya   ._3DCommandOpcode                    =      1,  \
237910e230b6Smaya   .CommandSubType                      =      3,  \
238010e230b6Smaya   .CommandType                         =      3
238110e230b6Smaya
238210e230b6Smayastruct GEN6_3DSTATE_SAMPLER_PALETTE_LOAD0 {
238310e230b6Smaya   uint32_t                             DWordLength;
238410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
238510e230b6Smaya   uint32_t                             _3DCommandOpcode;
238610e230b6Smaya   uint32_t                             CommandSubType;
238710e230b6Smaya   uint32_t                             CommandType;
238810e230b6Smaya   /* variable length fields follow */
238910e230b6Smaya};
239010e230b6Smaya
239110e230b6Smayastatic inline void
239210e230b6SmayaGEN6_3DSTATE_SAMPLER_PALETTE_LOAD0_pack(__attribute__((unused)) __gen_user_data *data,
239310e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
239410e230b6Smaya                                        __attribute__((unused)) const struct GEN6_3DSTATE_SAMPLER_PALETTE_LOAD0 * restrict values)
239510e230b6Smaya{
239610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
239710e230b6Smaya
239810e230b6Smaya   dw[0] =
239910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
240010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
240110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
240210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
240310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
240410e230b6Smaya}
240510e230b6Smaya
240610e230b6Smaya#define GEN6_3DSTATE_SAMPLER_PALETTE_LOAD1_length_bias      2
240710e230b6Smaya#define GEN6_3DSTATE_SAMPLER_PALETTE_LOAD1_header\
240810e230b6Smaya   .DWordLength                         =      0,  \
240910e230b6Smaya   ._3DCommandSubOpcode                 =     12,  \
241010e230b6Smaya   ._3DCommandOpcode                    =      1,  \
241110e230b6Smaya   .CommandSubType                      =      3,  \
241210e230b6Smaya   .CommandType                         =      3
241310e230b6Smaya
241410e230b6Smayastruct GEN6_3DSTATE_SAMPLER_PALETTE_LOAD1 {
241510e230b6Smaya   uint32_t                             DWordLength;
241610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
241710e230b6Smaya   uint32_t                             _3DCommandOpcode;
241810e230b6Smaya   uint32_t                             CommandSubType;
241910e230b6Smaya   uint32_t                             CommandType;
242010e230b6Smaya   /* variable length fields follow */
242110e230b6Smaya};
242210e230b6Smaya
242310e230b6Smayastatic inline void
242410e230b6SmayaGEN6_3DSTATE_SAMPLER_PALETTE_LOAD1_pack(__attribute__((unused)) __gen_user_data *data,
242510e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
242610e230b6Smaya                                        __attribute__((unused)) const struct GEN6_3DSTATE_SAMPLER_PALETTE_LOAD1 * restrict values)
242710e230b6Smaya{
242810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
242910e230b6Smaya
243010e230b6Smaya   dw[0] =
243110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
243210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
243310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
243410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
243510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
243610e230b6Smaya}
243710e230b6Smaya
243810e230b6Smaya#define GEN6_3DSTATE_SAMPLER_STATE_POINTERS_length      4
243910e230b6Smaya#define GEN6_3DSTATE_SAMPLER_STATE_POINTERS_length_bias      2
244010e230b6Smaya#define GEN6_3DSTATE_SAMPLER_STATE_POINTERS_header\
244110e230b6Smaya   .DWordLength                         =      2,  \
244210e230b6Smaya   ._3DCommandSubOpcode                 =      2,  \
244310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
244410e230b6Smaya   .CommandSubType                      =      3,  \
244510e230b6Smaya   .CommandType                         =      3
244610e230b6Smaya
244710e230b6Smayastruct GEN6_3DSTATE_SAMPLER_STATE_POINTERS {
244810e230b6Smaya   uint32_t                             DWordLength;
244910e230b6Smaya   uint32_t                             VSSamplerStateChange;
245010e230b6Smaya   uint32_t                             GSSamplerStateChange;
245110e230b6Smaya   uint32_t                             PSSamplerStateChange;
245210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
245310e230b6Smaya   uint32_t                             _3DCommandOpcode;
245410e230b6Smaya   uint32_t                             CommandSubType;
245510e230b6Smaya   uint32_t                             CommandType;
245610e230b6Smaya   uint64_t                             PointertoVSSamplerState;
245710e230b6Smaya   uint64_t                             PointertoGSSamplerState;
245810e230b6Smaya   uint64_t                             PointertoPSSamplerState;
245910e230b6Smaya};
246010e230b6Smaya
246110e230b6Smayastatic inline void
246210e230b6SmayaGEN6_3DSTATE_SAMPLER_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
246310e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
246410e230b6Smaya                                         __attribute__((unused)) const struct GEN6_3DSTATE_SAMPLER_STATE_POINTERS * restrict values)
246510e230b6Smaya{
246610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
246710e230b6Smaya
246810e230b6Smaya   dw[0] =
246910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
247010e230b6Smaya      __gen_uint(values->VSSamplerStateChange, 8, 8) |
247110e230b6Smaya      __gen_uint(values->GSSamplerStateChange, 9, 9) |
247210e230b6Smaya      __gen_uint(values->PSSamplerStateChange, 12, 12) |
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_offset(values->PointertoVSSamplerState, 5, 31);
248010e230b6Smaya
248110e230b6Smaya   dw[2] =
248210e230b6Smaya      __gen_offset(values->PointertoGSSamplerState, 5, 31);
248310e230b6Smaya
248410e230b6Smaya   dw[3] =
248510e230b6Smaya      __gen_offset(values->PointertoPSSamplerState, 5, 31);
248610e230b6Smaya}
248710e230b6Smaya
248810e230b6Smaya#define GEN6_3DSTATE_SAMPLE_MASK_length        2
248910e230b6Smaya#define GEN6_3DSTATE_SAMPLE_MASK_length_bias      2
249010e230b6Smaya#define GEN6_3DSTATE_SAMPLE_MASK_header         \
249110e230b6Smaya   .DWordLength                         =      0,  \
249210e230b6Smaya   ._3DCommandSubOpcode                 =     24,  \
249310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
249410e230b6Smaya   .CommandSubType                      =      3,  \
249510e230b6Smaya   .CommandType                         =      3
249610e230b6Smaya
249710e230b6Smayastruct GEN6_3DSTATE_SAMPLE_MASK {
249810e230b6Smaya   uint32_t                             DWordLength;
249910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
250010e230b6Smaya   uint32_t                             _3DCommandOpcode;
250110e230b6Smaya   uint32_t                             CommandSubType;
250210e230b6Smaya   uint32_t                             CommandType;
250310e230b6Smaya   uint32_t                             SampleMask;
250410e230b6Smaya};
250510e230b6Smaya
250610e230b6Smayastatic inline void
250710e230b6SmayaGEN6_3DSTATE_SAMPLE_MASK_pack(__attribute__((unused)) __gen_user_data *data,
250810e230b6Smaya                              __attribute__((unused)) void * restrict dst,
250910e230b6Smaya                              __attribute__((unused)) const struct GEN6_3DSTATE_SAMPLE_MASK * restrict values)
251010e230b6Smaya{
251110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
251210e230b6Smaya
251310e230b6Smaya   dw[0] =
251410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
251510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
251610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
251710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
251810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
251910e230b6Smaya
252010e230b6Smaya   dw[1] =
252110e230b6Smaya      __gen_uint(values->SampleMask, 0, 3);
252210e230b6Smaya}
252310e230b6Smaya
252410e230b6Smaya#define GEN6_3DSTATE_SCISSOR_STATE_POINTERS_length      2
252510e230b6Smaya#define GEN6_3DSTATE_SCISSOR_STATE_POINTERS_length_bias      2
252610e230b6Smaya#define GEN6_3DSTATE_SCISSOR_STATE_POINTERS_header\
252710e230b6Smaya   .DWordLength                         =      0,  \
252810e230b6Smaya   ._3DCommandSubOpcode                 =     15,  \
252910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
253010e230b6Smaya   .CommandSubType                      =      3,  \
253110e230b6Smaya   .CommandType                         =      3
253210e230b6Smaya
253310e230b6Smayastruct GEN6_3DSTATE_SCISSOR_STATE_POINTERS {
253410e230b6Smaya   uint32_t                             DWordLength;
253510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
253610e230b6Smaya   uint32_t                             _3DCommandOpcode;
253710e230b6Smaya   uint32_t                             CommandSubType;
253810e230b6Smaya   uint32_t                             CommandType;
253910e230b6Smaya   uint64_t                             ScissorRectPointer;
254010e230b6Smaya};
254110e230b6Smaya
254210e230b6Smayastatic inline void
254310e230b6SmayaGEN6_3DSTATE_SCISSOR_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
254410e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
254510e230b6Smaya                                         __attribute__((unused)) const struct GEN6_3DSTATE_SCISSOR_STATE_POINTERS * restrict values)
254610e230b6Smaya{
254710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
254810e230b6Smaya
254910e230b6Smaya   dw[0] =
255010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
255110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
255210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
255310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
255410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
255510e230b6Smaya
255610e230b6Smaya   dw[1] =
255710e230b6Smaya      __gen_offset(values->ScissorRectPointer, 5, 31);
255810e230b6Smaya}
255910e230b6Smaya
256010e230b6Smaya#define GEN6_3DSTATE_SF_length                20
256110e230b6Smaya#define GEN6_3DSTATE_SF_length_bias            2
256210e230b6Smaya#define GEN6_3DSTATE_SF_header                  \
256310e230b6Smaya   .DWordLength                         =     18,  \
256410e230b6Smaya   ._3DCommandSubOpcode                 =     19,  \
256510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
256610e230b6Smaya   .CommandSubType                      =      3,  \
256710e230b6Smaya   .CommandType                         =      3
256810e230b6Smaya
256910e230b6Smayastruct GEN6_3DSTATE_SF {
257010e230b6Smaya   uint32_t                             DWordLength;
257110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
257210e230b6Smaya   uint32_t                             _3DCommandOpcode;
257310e230b6Smaya   uint32_t                             CommandSubType;
257410e230b6Smaya   uint32_t                             CommandType;
257510e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
257610e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
257710e230b6Smaya   uint32_t                             PointSpriteTextureCoordinateOrigin;
257810e230b6Smaya#define UPPERLEFT                                0
257910e230b6Smaya#define LOWERLEFT                                1
258010e230b6Smaya   bool                                 AttributeSwizzleEnable;
258110e230b6Smaya   uint32_t                             NumberofSFOutputAttributes;
258210e230b6Smaya   uint32_t                             FrontWinding;
258310e230b6Smaya#define FRONTWINDING_CW                          0
258410e230b6Smaya#define FRONTWINDING_CCW                         1
258510e230b6Smaya   bool                                 ViewportTransformEnable;
258610e230b6Smaya   uint32_t                             BackFaceFillMode;
258710e230b6Smaya#define FILL_MODE_SOLID                          0
258810e230b6Smaya#define FILL_MODE_WIREFRAME                      1
258910e230b6Smaya#define FILL_MODE_POINT                          2
259010e230b6Smaya   uint32_t                             FrontFaceFillMode;
259110e230b6Smaya#define FILL_MODE_SOLID                          0
259210e230b6Smaya#define FILL_MODE_WIREFRAME                      1
259310e230b6Smaya#define FILL_MODE_POINT                          2
259410e230b6Smaya   bool                                 GlobalDepthOffsetEnablePoint;
259510e230b6Smaya   bool                                 GlobalDepthOffsetEnableWireframe;
259610e230b6Smaya   bool                                 GlobalDepthOffsetEnableSolid;
259710e230b6Smaya   bool                                 StatisticsEnable;
259810e230b6Smaya   bool                                 LegacyGlobalDepthBiasEnable;
259910e230b6Smaya   uint32_t                             MultisampleRasterizationMode;
260010e230b6Smaya#define MSRASTMODE_OFF_PIXEL                     0
260110e230b6Smaya#define MSRASTMODE_OFF_PATTERN                   1
260210e230b6Smaya#define MSRASTMODE_ON_PIXEL                      2
260310e230b6Smaya#define MSRASTMODE_ON_PATTERN                    3
260410e230b6Smaya   bool                                 ScissorRectangleEnable;
260510e230b6Smaya   uint32_t                             LineEndCapAntialiasingRegionWidth;
260610e230b6Smaya#define _05pixels                                0
260710e230b6Smaya#define _10pixels                                1
260810e230b6Smaya#define _20pixels                                2
260910e230b6Smaya#define _40pixels                                3
261010e230b6Smaya   float                                LineWidth;
261110e230b6Smaya   uint32_t                             CullMode;
261210e230b6Smaya#define CULLMODE_BOTH                            0
261310e230b6Smaya#define CULLMODE_NONE                            1
261410e230b6Smaya#define CULLMODE_FRONT                           2
261510e230b6Smaya#define CULLMODE_BACK                            3
261610e230b6Smaya   bool                                 AntiAliasingEnable;
261710e230b6Smaya   float                                PointWidth;
261810e230b6Smaya   uint32_t                             PointWidthSource;
261910e230b6Smaya#define Vertex                                   0
262010e230b6Smaya#define State                                    1
262110e230b6Smaya   uint32_t                             VertexSubPixelPrecisionSelect;
262210e230b6Smaya#define _8SubPixelPrecisionBits                  0
262310e230b6Smaya#define _4SubPixelPrecisionBits                  1
262410e230b6Smaya   uint32_t                             AALineDistanceMode;
262510e230b6Smaya#define AALINEDISTANCE_TRUE                      1
262610e230b6Smaya   uint32_t                             TriangleFanProvokingVertexSelect;
262710e230b6Smaya#define Vertex0                                  0
262810e230b6Smaya#define Vertex1                                  1
262910e230b6Smaya#define Vertex2                                  2
263010e230b6Smaya   uint32_t                             LineStripListProvokingVertexSelect;
263110e230b6Smaya#define Vertex0                                  0
263210e230b6Smaya#define Vertex1                                  1
263310e230b6Smaya   uint32_t                             TriangleStripListProvokingVertexSelect;
263410e230b6Smaya#define Vertex0                                  0
263510e230b6Smaya#define Vertex1                                  1
263610e230b6Smaya#define Vertex2                                  2
263710e230b6Smaya   bool                                 LastPixelEnable;
263810e230b6Smaya   float                                GlobalDepthOffsetConstant;
263910e230b6Smaya   float                                GlobalDepthOffsetScale;
264010e230b6Smaya   float                                GlobalDepthOffsetClamp;
264110e230b6Smaya   struct GEN6_SF_OUTPUT_ATTRIBUTE_DETAIL Attribute[16];
264210e230b6Smaya   uint32_t                             PointSpriteTextureCoordinateEnable;
264310e230b6Smaya   uint32_t                             ConstantInterpolationEnable;
264410e230b6Smaya   uint32_t                             Attribute0WrapShortestEnables;
264510e230b6Smaya   uint32_t                             Attribute1WrapShortestEnables;
264610e230b6Smaya   uint32_t                             Attribute2WrapShortestEnables;
264710e230b6Smaya   uint32_t                             Attribute3WrapShortestEnables;
264810e230b6Smaya   uint32_t                             Attribute4WrapShortestEnables;
264910e230b6Smaya   uint32_t                             Attribute5WrapShortestEnables;
265010e230b6Smaya   uint32_t                             Attribute6WrapShortestEnables;
265110e230b6Smaya   uint32_t                             Attribute7WrapShortestEnables;
265210e230b6Smaya   uint32_t                             Attribute8WrapShortestEnables;
265310e230b6Smaya   uint32_t                             Attribute9WrapShortestEnables;
265410e230b6Smaya   uint32_t                             Attribute10WrapShortestEnables;
265510e230b6Smaya   uint32_t                             Attribute11WrapShortestEnables;
265610e230b6Smaya   uint32_t                             Attribute12WrapShortestEnables;
265710e230b6Smaya   uint32_t                             Attribute13WrapShortestEnables;
265810e230b6Smaya   uint32_t                             Attribute14WrapShortestEnables;
265910e230b6Smaya   uint32_t                             Attribute15WrapShortestEnables;
266010e230b6Smaya};
266110e230b6Smaya
266210e230b6Smayastatic inline void
266310e230b6SmayaGEN6_3DSTATE_SF_pack(__attribute__((unused)) __gen_user_data *data,
266410e230b6Smaya                     __attribute__((unused)) void * restrict dst,
266510e230b6Smaya                     __attribute__((unused)) const struct GEN6_3DSTATE_SF * restrict values)
266610e230b6Smaya{
266710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
266810e230b6Smaya
266910e230b6Smaya   dw[0] =
267010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
267110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
267210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
267310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
267410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
267510e230b6Smaya
267610e230b6Smaya   dw[1] =
267710e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
267810e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 15) |
267910e230b6Smaya      __gen_uint(values->PointSpriteTextureCoordinateOrigin, 20, 20) |
268010e230b6Smaya      __gen_uint(values->AttributeSwizzleEnable, 21, 21) |
268110e230b6Smaya      __gen_uint(values->NumberofSFOutputAttributes, 22, 27);
268210e230b6Smaya
268310e230b6Smaya   dw[2] =
268410e230b6Smaya      __gen_uint(values->FrontWinding, 0, 0) |
268510e230b6Smaya      __gen_uint(values->ViewportTransformEnable, 1, 1) |
268610e230b6Smaya      __gen_uint(values->BackFaceFillMode, 3, 4) |
268710e230b6Smaya      __gen_uint(values->FrontFaceFillMode, 5, 6) |
268810e230b6Smaya      __gen_uint(values->GlobalDepthOffsetEnablePoint, 7, 7) |
268910e230b6Smaya      __gen_uint(values->GlobalDepthOffsetEnableWireframe, 8, 8) |
269010e230b6Smaya      __gen_uint(values->GlobalDepthOffsetEnableSolid, 9, 9) |
269110e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
269210e230b6Smaya      __gen_uint(values->LegacyGlobalDepthBiasEnable, 11, 11);
269310e230b6Smaya
269410e230b6Smaya   dw[3] =
269510e230b6Smaya      __gen_uint(values->MultisampleRasterizationMode, 8, 9) |
269610e230b6Smaya      __gen_uint(values->ScissorRectangleEnable, 11, 11) |
269710e230b6Smaya      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 16, 17) |
269810e230b6Smaya      __gen_ufixed(values->LineWidth, 18, 27, 7) |
269910e230b6Smaya      __gen_uint(values->CullMode, 29, 30) |
270010e230b6Smaya      __gen_uint(values->AntiAliasingEnable, 31, 31);
270110e230b6Smaya
270210e230b6Smaya   dw[4] =
270310e230b6Smaya      __gen_ufixed(values->PointWidth, 0, 10, 3) |
270410e230b6Smaya      __gen_uint(values->PointWidthSource, 11, 11) |
270510e230b6Smaya      __gen_uint(values->VertexSubPixelPrecisionSelect, 12, 12) |
270610e230b6Smaya      __gen_uint(values->AALineDistanceMode, 14, 14) |
270710e230b6Smaya      __gen_uint(values->TriangleFanProvokingVertexSelect, 25, 26) |
270810e230b6Smaya      __gen_uint(values->LineStripListProvokingVertexSelect, 27, 28) |
270910e230b6Smaya      __gen_uint(values->TriangleStripListProvokingVertexSelect, 29, 30) |
271010e230b6Smaya      __gen_uint(values->LastPixelEnable, 31, 31);
271110e230b6Smaya
271210e230b6Smaya   dw[5] =
271310e230b6Smaya      __gen_float(values->GlobalDepthOffsetConstant);
271410e230b6Smaya
271510e230b6Smaya   dw[6] =
271610e230b6Smaya      __gen_float(values->GlobalDepthOffsetScale);
271710e230b6Smaya
271810e230b6Smaya   dw[7] =
271910e230b6Smaya      __gen_float(values->GlobalDepthOffsetClamp);
272010e230b6Smaya
272110e230b6Smaya   uint32_t v8_0;
272210e230b6Smaya   GEN6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_0, &values->Attribute[0]);
272310e230b6Smaya
272410e230b6Smaya   uint32_t v8_1;
272510e230b6Smaya   GEN6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_1, &values->Attribute[1]);
272610e230b6Smaya
272710e230b6Smaya   dw[8] =
272810e230b6Smaya      __gen_uint(v8_0, 0, 15) |
272910e230b6Smaya      __gen_uint(v8_1, 16, 31);
273010e230b6Smaya
273110e230b6Smaya   uint32_t v9_0;
273210e230b6Smaya   GEN6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v9_0, &values->Attribute[2]);
273310e230b6Smaya
273410e230b6Smaya   uint32_t v9_1;
273510e230b6Smaya   GEN6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v9_1, &values->Attribute[3]);
273610e230b6Smaya
273710e230b6Smaya   dw[9] =
273810e230b6Smaya      __gen_uint(v9_0, 0, 15) |
273910e230b6Smaya      __gen_uint(v9_1, 16, 31);
274010e230b6Smaya
274110e230b6Smaya   uint32_t v10_0;
274210e230b6Smaya   GEN6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v10_0, &values->Attribute[4]);
274310e230b6Smaya
274410e230b6Smaya   uint32_t v10_1;
274510e230b6Smaya   GEN6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v10_1, &values->Attribute[5]);
274610e230b6Smaya
274710e230b6Smaya   dw[10] =
274810e230b6Smaya      __gen_uint(v10_0, 0, 15) |
274910e230b6Smaya      __gen_uint(v10_1, 16, 31);
275010e230b6Smaya
275110e230b6Smaya   uint32_t v11_0;
275210e230b6Smaya   GEN6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v11_0, &values->Attribute[6]);
275310e230b6Smaya
275410e230b6Smaya   uint32_t v11_1;
275510e230b6Smaya   GEN6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v11_1, &values->Attribute[7]);
275610e230b6Smaya
275710e230b6Smaya   dw[11] =
275810e230b6Smaya      __gen_uint(v11_0, 0, 15) |
275910e230b6Smaya      __gen_uint(v11_1, 16, 31);
276010e230b6Smaya
276110e230b6Smaya   uint32_t v12_0;
276210e230b6Smaya   GEN6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v12_0, &values->Attribute[8]);
276310e230b6Smaya
276410e230b6Smaya   uint32_t v12_1;
276510e230b6Smaya   GEN6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v12_1, &values->Attribute[9]);
276610e230b6Smaya
276710e230b6Smaya   dw[12] =
276810e230b6Smaya      __gen_uint(v12_0, 0, 15) |
276910e230b6Smaya      __gen_uint(v12_1, 16, 31);
277010e230b6Smaya
277110e230b6Smaya   uint32_t v13_0;
277210e230b6Smaya   GEN6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v13_0, &values->Attribute[10]);
277310e230b6Smaya
277410e230b6Smaya   uint32_t v13_1;
277510e230b6Smaya   GEN6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v13_1, &values->Attribute[11]);
277610e230b6Smaya
277710e230b6Smaya   dw[13] =
277810e230b6Smaya      __gen_uint(v13_0, 0, 15) |
277910e230b6Smaya      __gen_uint(v13_1, 16, 31);
278010e230b6Smaya
278110e230b6Smaya   uint32_t v14_0;
278210e230b6Smaya   GEN6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v14_0, &values->Attribute[12]);
278310e230b6Smaya
278410e230b6Smaya   uint32_t v14_1;
278510e230b6Smaya   GEN6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v14_1, &values->Attribute[13]);
278610e230b6Smaya
278710e230b6Smaya   dw[14] =
278810e230b6Smaya      __gen_uint(v14_0, 0, 15) |
278910e230b6Smaya      __gen_uint(v14_1, 16, 31);
279010e230b6Smaya
279110e230b6Smaya   uint32_t v15_0;
279210e230b6Smaya   GEN6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v15_0, &values->Attribute[14]);
279310e230b6Smaya
279410e230b6Smaya   uint32_t v15_1;
279510e230b6Smaya   GEN6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v15_1, &values->Attribute[15]);
279610e230b6Smaya
279710e230b6Smaya   dw[15] =
279810e230b6Smaya      __gen_uint(v15_0, 0, 15) |
279910e230b6Smaya      __gen_uint(v15_1, 16, 31);
280010e230b6Smaya
280110e230b6Smaya   dw[16] =
280210e230b6Smaya      __gen_uint(values->PointSpriteTextureCoordinateEnable, 0, 31);
280310e230b6Smaya
280410e230b6Smaya   dw[17] =
280510e230b6Smaya      __gen_uint(values->ConstantInterpolationEnable, 0, 31);
280610e230b6Smaya
280710e230b6Smaya   dw[18] =
280810e230b6Smaya      __gen_uint(values->Attribute0WrapShortestEnables, 0, 3) |
280910e230b6Smaya      __gen_uint(values->Attribute1WrapShortestEnables, 4, 7) |
281010e230b6Smaya      __gen_uint(values->Attribute2WrapShortestEnables, 8, 11) |
281110e230b6Smaya      __gen_uint(values->Attribute3WrapShortestEnables, 12, 15) |
281210e230b6Smaya      __gen_uint(values->Attribute4WrapShortestEnables, 16, 19) |
281310e230b6Smaya      __gen_uint(values->Attribute5WrapShortestEnables, 20, 23) |
281410e230b6Smaya      __gen_uint(values->Attribute6WrapShortestEnables, 24, 27) |
281510e230b6Smaya      __gen_uint(values->Attribute7WrapShortestEnables, 28, 31);
281610e230b6Smaya
281710e230b6Smaya   dw[19] =
281810e230b6Smaya      __gen_uint(values->Attribute8WrapShortestEnables, 0, 3) |
281910e230b6Smaya      __gen_uint(values->Attribute9WrapShortestEnables, 4, 7) |
282010e230b6Smaya      __gen_uint(values->Attribute10WrapShortestEnables, 8, 11) |
282110e230b6Smaya      __gen_uint(values->Attribute11WrapShortestEnables, 12, 15) |
282210e230b6Smaya      __gen_uint(values->Attribute12WrapShortestEnables, 16, 19) |
282310e230b6Smaya      __gen_uint(values->Attribute13WrapShortestEnables, 20, 23) |
282410e230b6Smaya      __gen_uint(values->Attribute14WrapShortestEnables, 24, 27) |
282510e230b6Smaya      __gen_uint(values->Attribute15WrapShortestEnables, 28, 31);
282610e230b6Smaya}
282710e230b6Smaya
282810e230b6Smaya#define GEN6_3DSTATE_STENCIL_BUFFER_length      3
282910e230b6Smaya#define GEN6_3DSTATE_STENCIL_BUFFER_length_bias      2
283010e230b6Smaya#define GEN6_3DSTATE_STENCIL_BUFFER_header      \
283110e230b6Smaya   .DWordLength                         =      1,  \
283210e230b6Smaya   ._3DCommandSubOpcode                 =     14,  \
283310e230b6Smaya   ._3DCommandOpcode                    =      1,  \
283410e230b6Smaya   .CommandSubType                      =      3,  \
283510e230b6Smaya   .CommandType                         =      3
283610e230b6Smaya
283710e230b6Smayastruct GEN6_3DSTATE_STENCIL_BUFFER {
283810e230b6Smaya   uint32_t                             DWordLength;
283910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
284010e230b6Smaya   uint32_t                             _3DCommandOpcode;
284110e230b6Smaya   uint32_t                             CommandSubType;
284210e230b6Smaya   uint32_t                             CommandType;
284310e230b6Smaya   uint32_t                             SurfacePitch;
284410e230b6Smaya   uint32_t                             MOCS;
284510e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
284610e230b6Smaya};
284710e230b6Smaya
284810e230b6Smayastatic inline void
284910e230b6SmayaGEN6_3DSTATE_STENCIL_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
285010e230b6Smaya                                 __attribute__((unused)) void * restrict dst,
285110e230b6Smaya                                 __attribute__((unused)) const struct GEN6_3DSTATE_STENCIL_BUFFER * restrict values)
285210e230b6Smaya{
285310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
285410e230b6Smaya
285510e230b6Smaya   dw[0] =
285610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
285710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
285810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
285910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
286010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
286110e230b6Smaya
286210e230b6Smaya   dw[1] =
286310e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 16) |
286410e230b6Smaya      __gen_uint(values->MOCS, 25, 28);
286510e230b6Smaya
286610e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
286710e230b6Smaya}
286810e230b6Smaya
286910e230b6Smaya#define GEN6_3DSTATE_URB_length                3
287010e230b6Smaya#define GEN6_3DSTATE_URB_length_bias           2
287110e230b6Smaya#define GEN6_3DSTATE_URB_header                 \
287210e230b6Smaya   .DWordLength                         =      1,  \
287310e230b6Smaya   ._3DCommandSubOpcode                 =      5,  \
287410e230b6Smaya   ._3DCommandOpcode                    =      0,  \
287510e230b6Smaya   .CommandSubType                      =      3,  \
287610e230b6Smaya   .CommandType                         =      3
287710e230b6Smaya
287810e230b6Smayastruct GEN6_3DSTATE_URB {
287910e230b6Smaya   uint32_t                             DWordLength;
288010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
288110e230b6Smaya   uint32_t                             _3DCommandOpcode;
288210e230b6Smaya   uint32_t                             CommandSubType;
288310e230b6Smaya   uint32_t                             CommandType;
288410e230b6Smaya   uint32_t                             VSNumberofURBEntries;
288510e230b6Smaya   uint32_t                             VSURBEntryAllocationSize;
288610e230b6Smaya   uint32_t                             GSURBEntryAllocationSize;
288710e230b6Smaya   uint32_t                             GSNumberofURBEntries;
288810e230b6Smaya};
288910e230b6Smaya
289010e230b6Smayastatic inline void
289110e230b6SmayaGEN6_3DSTATE_URB_pack(__attribute__((unused)) __gen_user_data *data,
289210e230b6Smaya                      __attribute__((unused)) void * restrict dst,
289310e230b6Smaya                      __attribute__((unused)) const struct GEN6_3DSTATE_URB * restrict values)
289410e230b6Smaya{
289510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
289610e230b6Smaya
289710e230b6Smaya   dw[0] =
289810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
289910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
290010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
290110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
290210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
290310e230b6Smaya
290410e230b6Smaya   dw[1] =
290510e230b6Smaya      __gen_uint(values->VSNumberofURBEntries, 0, 15) |
290610e230b6Smaya      __gen_uint(values->VSURBEntryAllocationSize, 16, 23);
290710e230b6Smaya
290810e230b6Smaya   dw[2] =
290910e230b6Smaya      __gen_uint(values->GSURBEntryAllocationSize, 0, 2) |
291010e230b6Smaya      __gen_uint(values->GSNumberofURBEntries, 8, 17);
291110e230b6Smaya}
291210e230b6Smaya
291310e230b6Smaya#define GEN6_3DSTATE_VERTEX_BUFFERS_length_bias      2
291410e230b6Smaya#define GEN6_3DSTATE_VERTEX_BUFFERS_header      \
291510e230b6Smaya   .DWordLength                         =      3,  \
291610e230b6Smaya   ._3DCommandSubOpcode                 =      8,  \
291710e230b6Smaya   ._3DCommandOpcode                    =      0,  \
291810e230b6Smaya   .CommandSubType                      =      3,  \
291910e230b6Smaya   .CommandType                         =      3
292010e230b6Smaya
292110e230b6Smayastruct GEN6_3DSTATE_VERTEX_BUFFERS {
292210e230b6Smaya   uint32_t                             DWordLength;
292310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
292410e230b6Smaya   uint32_t                             _3DCommandOpcode;
292510e230b6Smaya   uint32_t                             CommandSubType;
292610e230b6Smaya   uint32_t                             CommandType;
292710e230b6Smaya   /* variable length fields follow */
292810e230b6Smaya};
292910e230b6Smaya
293010e230b6Smayastatic inline void
293110e230b6SmayaGEN6_3DSTATE_VERTEX_BUFFERS_pack(__attribute__((unused)) __gen_user_data *data,
293210e230b6Smaya                                 __attribute__((unused)) void * restrict dst,
293310e230b6Smaya                                 __attribute__((unused)) const struct GEN6_3DSTATE_VERTEX_BUFFERS * restrict values)
293410e230b6Smaya{
293510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
293610e230b6Smaya
293710e230b6Smaya   dw[0] =
293810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
293910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
294010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
294110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
294210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
294310e230b6Smaya}
294410e230b6Smaya
294510e230b6Smaya#define GEN6_3DSTATE_VERTEX_ELEMENTS_length_bias      2
294610e230b6Smaya#define GEN6_3DSTATE_VERTEX_ELEMENTS_header     \
294710e230b6Smaya   .DWordLength                         =      1,  \
294810e230b6Smaya   ._3DCommandSubOpcode                 =      9,  \
294910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
295010e230b6Smaya   .CommandSubType                      =      3,  \
295110e230b6Smaya   .CommandType                         =      3
295210e230b6Smaya
295310e230b6Smayastruct GEN6_3DSTATE_VERTEX_ELEMENTS {
295410e230b6Smaya   uint32_t                             DWordLength;
295510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
295610e230b6Smaya   uint32_t                             _3DCommandOpcode;
295710e230b6Smaya   uint32_t                             CommandSubType;
295810e230b6Smaya   uint32_t                             CommandType;
295910e230b6Smaya   /* variable length fields follow */
296010e230b6Smaya};
296110e230b6Smaya
296210e230b6Smayastatic inline void
296310e230b6SmayaGEN6_3DSTATE_VERTEX_ELEMENTS_pack(__attribute__((unused)) __gen_user_data *data,
296410e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
296510e230b6Smaya                                  __attribute__((unused)) const struct GEN6_3DSTATE_VERTEX_ELEMENTS * restrict values)
296610e230b6Smaya{
296710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
296810e230b6Smaya
296910e230b6Smaya   dw[0] =
297010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
297110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
297210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
297310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
297410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
297510e230b6Smaya}
297610e230b6Smaya
297710e230b6Smaya#define GEN6_3DSTATE_VF_STATISTICS_length      1
297810e230b6Smaya#define GEN6_3DSTATE_VF_STATISTICS_length_bias      1
297910e230b6Smaya#define GEN6_3DSTATE_VF_STATISTICS_header       \
298010e230b6Smaya   ._3DCommandSubOpcode                 =     11,  \
298110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
298210e230b6Smaya   .CommandSubType                      =      1,  \
298310e230b6Smaya   .CommandType                         =      3
298410e230b6Smaya
298510e230b6Smayastruct GEN6_3DSTATE_VF_STATISTICS {
298610e230b6Smaya   bool                                 StatisticsEnable;
298710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
298810e230b6Smaya   uint32_t                             _3DCommandOpcode;
298910e230b6Smaya   uint32_t                             CommandSubType;
299010e230b6Smaya   uint32_t                             CommandType;
299110e230b6Smaya};
299210e230b6Smaya
299310e230b6Smayastatic inline void
299410e230b6SmayaGEN6_3DSTATE_VF_STATISTICS_pack(__attribute__((unused)) __gen_user_data *data,
299510e230b6Smaya                                __attribute__((unused)) void * restrict dst,
299610e230b6Smaya                                __attribute__((unused)) const struct GEN6_3DSTATE_VF_STATISTICS * restrict values)
299710e230b6Smaya{
299810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
299910e230b6Smaya
300010e230b6Smaya   dw[0] =
300110e230b6Smaya      __gen_uint(values->StatisticsEnable, 0, 0) |
300210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
300310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
300410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
300510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
300610e230b6Smaya}
300710e230b6Smaya
300810e230b6Smaya#define GEN6_3DSTATE_VIEWPORT_STATE_POINTERS_length      4
300910e230b6Smaya#define GEN6_3DSTATE_VIEWPORT_STATE_POINTERS_length_bias      2
301010e230b6Smaya#define GEN6_3DSTATE_VIEWPORT_STATE_POINTERS_header\
301110e230b6Smaya   .DWordLength                         =      2,  \
301210e230b6Smaya   ._3DCommandSubOpcode                 =     13,  \
301310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
301410e230b6Smaya   .CommandSubType                      =      3,  \
301510e230b6Smaya   .CommandType                         =      3
301610e230b6Smaya
301710e230b6Smayastruct GEN6_3DSTATE_VIEWPORT_STATE_POINTERS {
301810e230b6Smaya   uint32_t                             DWordLength;
301910e230b6Smaya   uint32_t                             CLIPViewportStateChange;
302010e230b6Smaya   uint32_t                             SFViewportStateChange;
302110e230b6Smaya   uint32_t                             CCViewportStateChange;
302210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
302310e230b6Smaya   uint32_t                             _3DCommandOpcode;
302410e230b6Smaya   uint32_t                             CommandSubType;
302510e230b6Smaya   uint32_t                             CommandType;
302610e230b6Smaya   uint64_t                             PointertoCLIP_VIEWPORT;
302710e230b6Smaya   uint64_t                             PointertoSF_VIEWPORT;
302810e230b6Smaya   uint64_t                             PointertoCC_VIEWPORT;
302910e230b6Smaya};
303010e230b6Smaya
303110e230b6Smayastatic inline void
303210e230b6SmayaGEN6_3DSTATE_VIEWPORT_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
303310e230b6Smaya                                          __attribute__((unused)) void * restrict dst,
303410e230b6Smaya                                          __attribute__((unused)) const struct GEN6_3DSTATE_VIEWPORT_STATE_POINTERS * restrict values)
303510e230b6Smaya{
303610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
303710e230b6Smaya
303810e230b6Smaya   dw[0] =
303910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
304010e230b6Smaya      __gen_uint(values->CLIPViewportStateChange, 10, 10) |
304110e230b6Smaya      __gen_uint(values->SFViewportStateChange, 11, 11) |
304210e230b6Smaya      __gen_uint(values->CCViewportStateChange, 12, 12) |
304310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
304410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
304510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
304610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
304710e230b6Smaya
304810e230b6Smaya   dw[1] =
304910e230b6Smaya      __gen_offset(values->PointertoCLIP_VIEWPORT, 5, 31);
305010e230b6Smaya
305110e230b6Smaya   dw[2] =
305210e230b6Smaya      __gen_offset(values->PointertoSF_VIEWPORT, 5, 31);
305310e230b6Smaya
305410e230b6Smaya   dw[3] =
305510e230b6Smaya      __gen_offset(values->PointertoCC_VIEWPORT, 5, 31);
305610e230b6Smaya}
305710e230b6Smaya
305810e230b6Smaya#define GEN6_3DSTATE_VS_length                 6
305910e230b6Smaya#define GEN6_3DSTATE_VS_length_bias            2
306010e230b6Smaya#define GEN6_3DSTATE_VS_header                  \
306110e230b6Smaya   .DWordLength                         =      4,  \
306210e230b6Smaya   ._3DCommandSubOpcode                 =     16,  \
306310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
306410e230b6Smaya   .CommandSubType                      =      3,  \
306510e230b6Smaya   .CommandType                         =      3
306610e230b6Smaya
306710e230b6Smayastruct GEN6_3DSTATE_VS {
306810e230b6Smaya   uint32_t                             DWordLength;
306910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
307010e230b6Smaya   uint32_t                             _3DCommandOpcode;
307110e230b6Smaya   uint32_t                             CommandSubType;
307210e230b6Smaya   uint32_t                             CommandType;
307310e230b6Smaya   uint64_t                             KernelStartPointer;
307410e230b6Smaya   bool                                 SoftwareExceptionEnable;
307510e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
307610e230b6Smaya   uint32_t                             FloatingPointMode;
307710e230b6Smaya#define IEEE754                                  0
307810e230b6Smaya#define Alternate                                1
307910e230b6Smaya   uint32_t                             BindingTableEntryCount;
308010e230b6Smaya   uint32_t                             SamplerCount;
308110e230b6Smaya#define NoSamplers                               0
308210e230b6Smaya#define _14Samplers                              1
308310e230b6Smaya#define _58Samplers                              2
308410e230b6Smaya#define _912Samplers                             3
308510e230b6Smaya#define _1316Samplers                            4
308610e230b6Smaya   bool                                 VectorMaskEnable;
308710e230b6Smaya   bool                                 SingleVertexDispatch;
308810e230b6Smaya   uint32_t                             PerThreadScratchSpace;
308910e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
309010e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
309110e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
309210e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData;
309310e230b6Smaya   bool                                 Enable;
309410e230b6Smaya   bool                                 VertexCacheDisable;
309510e230b6Smaya   bool                                 StatisticsEnable;
309610e230b6Smaya   uint32_t                             MaximumNumberofThreads;
309710e230b6Smaya};
309810e230b6Smaya
309910e230b6Smayastatic inline void
310010e230b6SmayaGEN6_3DSTATE_VS_pack(__attribute__((unused)) __gen_user_data *data,
310110e230b6Smaya                     __attribute__((unused)) void * restrict dst,
310210e230b6Smaya                     __attribute__((unused)) const struct GEN6_3DSTATE_VS * restrict values)
310310e230b6Smaya{
310410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
310510e230b6Smaya
310610e230b6Smaya   dw[0] =
310710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
310810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
310910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
311010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
311110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
311210e230b6Smaya
311310e230b6Smaya   dw[1] =
311410e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 31);
311510e230b6Smaya
311610e230b6Smaya   dw[2] =
311710e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
311810e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
311910e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
312010e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
312110e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
312210e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
312310e230b6Smaya      __gen_uint(values->SingleVertexDispatch, 31, 31);
312410e230b6Smaya
312510e230b6Smaya   const uint32_t v3 =
312610e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
312710e230b6Smaya   dw[3] = __gen_combine_address(data, &dw[3], values->ScratchSpaceBasePointer, v3);
312810e230b6Smaya
312910e230b6Smaya   dw[4] =
313010e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
313110e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
313210e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
313310e230b6Smaya
313410e230b6Smaya   dw[5] =
313510e230b6Smaya      __gen_uint(values->Enable, 0, 0) |
313610e230b6Smaya      __gen_uint(values->VertexCacheDisable, 1, 1) |
313710e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
313810e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 25, 31);
313910e230b6Smaya}
314010e230b6Smaya
314110e230b6Smaya#define GEN6_3DSTATE_WM_length                 9
314210e230b6Smaya#define GEN6_3DSTATE_WM_length_bias            2
314310e230b6Smaya#define GEN6_3DSTATE_WM_header                  \
314410e230b6Smaya   .DWordLength                         =      7,  \
314510e230b6Smaya   ._3DCommandSubOpcode                 =     20,  \
314610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
314710e230b6Smaya   .CommandSubType                      =      3,  \
314810e230b6Smaya   .CommandType                         =      3
314910e230b6Smaya
315010e230b6Smayastruct GEN6_3DSTATE_WM {
315110e230b6Smaya   uint32_t                             DWordLength;
315210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
315310e230b6Smaya   uint32_t                             _3DCommandOpcode;
315410e230b6Smaya   uint32_t                             CommandSubType;
315510e230b6Smaya   uint32_t                             CommandType;
315610e230b6Smaya   uint64_t                             KernelStartPointer0;
315710e230b6Smaya   bool                                 SoftwareExceptionEnable;
315810e230b6Smaya   bool                                 MaskStackExceptionEnable;
315910e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
316010e230b6Smaya   uint32_t                             FloatingPointMode;
316110e230b6Smaya#define FLOATING_POINT_MODE_IEEE745              0
316210e230b6Smaya#define FLOATING_POINT_MODE_Alternate            1
316310e230b6Smaya   uint32_t                             ThreadPriority;
316410e230b6Smaya#define High                                     1
316510e230b6Smaya   uint32_t                             BindingTableEntryCount;
316610e230b6Smaya   uint32_t                             SamplerCount;
316710e230b6Smaya   bool                                 VectorMaskEnable;
316810e230b6Smaya   bool                                 SingleProgramFlow;
316910e230b6Smaya   uint32_t                             PerThreadScratchSpace;
317010e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
317110e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForConstantSetupData2;
317210e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForConstantSetupData1;
317310e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForConstantSetupData0;
317410e230b6Smaya   bool                                 HierarchicalDepthBufferResolveEnable;
317510e230b6Smaya   bool                                 DepthBufferResolveEnable;
317610e230b6Smaya   bool                                 DepthBufferClear;
317710e230b6Smaya   bool                                 StatisticsEnable;
317810e230b6Smaya   bool                                 _8PixelDispatchEnable;
317910e230b6Smaya   bool                                 _16PixelDispatchEnable;
318010e230b6Smaya   bool                                 _32PixelDispatchEnable;
318110e230b6Smaya   bool                                 DualSourceBlendEnable;
318210e230b6Smaya   bool                                 PixelShaderUsesSourceW;
318310e230b6Smaya   bool                                 oMaskPresenttoRenderTarget;
318410e230b6Smaya   bool                                 LineStippleEnable;
318510e230b6Smaya   bool                                 PolygonStippleEnable;
318610e230b6Smaya   uint32_t                             LineAntialiasingRegionWidth;
318710e230b6Smaya#define _05pixels                                0
318810e230b6Smaya#define _10pixels                                1
318910e230b6Smaya#define _20pixels                                2
319010e230b6Smaya#define _40pixels                                3
319110e230b6Smaya   uint32_t                             LineEndCapAntialiasingRegionWidth;
319210e230b6Smaya#define _05pixels                                0
319310e230b6Smaya#define _10pixels                                1
319410e230b6Smaya#define _20pixels                                2
319510e230b6Smaya#define _40pixels                                3
319610e230b6Smaya   bool                                 ThreadDispatchEnable;
319710e230b6Smaya   bool                                 PixelShaderUsesSourceDepth;
319810e230b6Smaya   bool                                 PixelShaderComputedDepth;
319910e230b6Smaya   bool                                 PixelShaderKillsPixel;
320010e230b6Smaya   bool                                 LegacyDiamondLineRasterization;
320110e230b6Smaya   uint32_t                             MaximumNumberofThreads;
320210e230b6Smaya   uint32_t                             MultisampleDispatchMode;
320310e230b6Smaya#define MSDISPMODE_PERSAMPLE                     0
320410e230b6Smaya#define MSDISPMODE_PERPIXEL                      1
320510e230b6Smaya   uint32_t                             MultisampleRasterizationMode;
320610e230b6Smaya#define MSRASTMODE_OFF_PIXEL                     0
320710e230b6Smaya#define MSRASTMODE_OFF_PATTERN                   1
320810e230b6Smaya#define MSRASTMODE_ON_PIXEL                      2
320910e230b6Smaya#define MSRASTMODE_ON_PATTERN                    3
321010e230b6Smaya   uint32_t                             PointRasterizationRule;
321110e230b6Smaya#define RASTRULE_UPPER_LEFT                      0
321210e230b6Smaya#define RASTRULE_UPPER_RIGHT                     1
321310e230b6Smaya   uint32_t                             BarycentricInterpolationMode;
321410e230b6Smaya#define BIM_PERSPECTIVE_PIXEL                    1
321510e230b6Smaya#define BIM_PERSPECTIVE_CENTROID                 2
321610e230b6Smaya#define BIM_PERSPECTIVE_SAMPLE                   4
321710e230b6Smaya#define BIM_LINEAR_PIXEL                         8
321810e230b6Smaya#define BIM_LINEAR_CENTROID                      16
321910e230b6Smaya#define BIM_LINEAR_SAMPLE                        32
322010e230b6Smaya   uint32_t                             PositionZWInterpolationMode;
322110e230b6Smaya#define INTERP_PIXEL                             0
322210e230b6Smaya#define INTERP_CENTROID                          2
322310e230b6Smaya#define INTERP_SAMPLE                            3
322410e230b6Smaya   uint32_t                             PositionXYOffsetSelect;
322510e230b6Smaya#define POSOFFSET_NONE                           0
322610e230b6Smaya#define POSOFFSET_CENTROID                       2
322710e230b6Smaya#define POSOFFSET_SAMPLE                         3
322810e230b6Smaya   uint32_t                             NumberofSFOutputAttributes;
322910e230b6Smaya   uint64_t                             KernelStartPointer1;
323010e230b6Smaya   uint64_t                             KernelStartPointer2;
323110e230b6Smaya};
323210e230b6Smaya
323310e230b6Smayastatic inline void
323410e230b6SmayaGEN6_3DSTATE_WM_pack(__attribute__((unused)) __gen_user_data *data,
323510e230b6Smaya                     __attribute__((unused)) void * restrict dst,
323610e230b6Smaya                     __attribute__((unused)) const struct GEN6_3DSTATE_WM * restrict values)
323710e230b6Smaya{
323810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
323910e230b6Smaya
324010e230b6Smaya   dw[0] =
324110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
324210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
324310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
324410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
324510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
324610e230b6Smaya
324710e230b6Smaya   dw[1] =
324810e230b6Smaya      __gen_offset(values->KernelStartPointer0, 6, 31);
324910e230b6Smaya
325010e230b6Smaya   dw[2] =
325110e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
325210e230b6Smaya      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
325310e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
325410e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
325510e230b6Smaya      __gen_uint(values->ThreadPriority, 17, 17) |
325610e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
325710e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
325810e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
325910e230b6Smaya      __gen_uint(values->SingleProgramFlow, 31, 31);
326010e230b6Smaya
326110e230b6Smaya   const uint32_t v3 =
326210e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
326310e230b6Smaya   dw[3] = __gen_combine_address(data, &dw[3], values->ScratchSpaceBasePointer, v3);
326410e230b6Smaya
326510e230b6Smaya   dw[4] =
326610e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData2, 0, 6) |
326710e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData1, 8, 14) |
326810e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData0, 16, 22) |
326910e230b6Smaya      __gen_uint(values->HierarchicalDepthBufferResolveEnable, 27, 27) |
327010e230b6Smaya      __gen_uint(values->DepthBufferResolveEnable, 28, 28) |
327110e230b6Smaya      __gen_uint(values->DepthBufferClear, 30, 30) |
327210e230b6Smaya      __gen_uint(values->StatisticsEnable, 31, 31);
327310e230b6Smaya
327410e230b6Smaya   dw[5] =
327510e230b6Smaya      __gen_uint(values->_8PixelDispatchEnable, 0, 0) |
327610e230b6Smaya      __gen_uint(values->_16PixelDispatchEnable, 1, 1) |
327710e230b6Smaya      __gen_uint(values->_32PixelDispatchEnable, 2, 2) |
327810e230b6Smaya      __gen_uint(values->DualSourceBlendEnable, 7, 7) |
327910e230b6Smaya      __gen_uint(values->PixelShaderUsesSourceW, 8, 8) |
328010e230b6Smaya      __gen_uint(values->oMaskPresenttoRenderTarget, 9, 9) |
328110e230b6Smaya      __gen_uint(values->LineStippleEnable, 11, 11) |
328210e230b6Smaya      __gen_uint(values->PolygonStippleEnable, 13, 13) |
328310e230b6Smaya      __gen_uint(values->LineAntialiasingRegionWidth, 14, 15) |
328410e230b6Smaya      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 16, 17) |
328510e230b6Smaya      __gen_uint(values->ThreadDispatchEnable, 19, 19) |
328610e230b6Smaya      __gen_uint(values->PixelShaderUsesSourceDepth, 20, 20) |
328710e230b6Smaya      __gen_uint(values->PixelShaderComputedDepth, 21, 21) |
328810e230b6Smaya      __gen_uint(values->PixelShaderKillsPixel, 22, 22) |
328910e230b6Smaya      __gen_uint(values->LegacyDiamondLineRasterization, 23, 23) |
329010e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 25, 31);
329110e230b6Smaya
329210e230b6Smaya   dw[6] =
329310e230b6Smaya      __gen_uint(values->MultisampleDispatchMode, 0, 0) |
329410e230b6Smaya      __gen_uint(values->MultisampleRasterizationMode, 1, 2) |
329510e230b6Smaya      __gen_uint(values->PointRasterizationRule, 9, 9) |
329610e230b6Smaya      __gen_uint(values->BarycentricInterpolationMode, 10, 15) |
329710e230b6Smaya      __gen_uint(values->PositionZWInterpolationMode, 16, 17) |
329810e230b6Smaya      __gen_uint(values->PositionXYOffsetSelect, 18, 19) |
329910e230b6Smaya      __gen_uint(values->NumberofSFOutputAttributes, 20, 25);
330010e230b6Smaya
330110e230b6Smaya   dw[7] =
330210e230b6Smaya      __gen_offset(values->KernelStartPointer1, 6, 31);
330310e230b6Smaya
330410e230b6Smaya   dw[8] =
330510e230b6Smaya      __gen_offset(values->KernelStartPointer2, 6, 31);
330610e230b6Smaya}
330710e230b6Smaya
330810e230b6Smaya#define GEN6_MEDIA_CURBE_LOAD_length           4
330910e230b6Smaya#define GEN6_MEDIA_CURBE_LOAD_length_bias      2
331010e230b6Smaya#define GEN6_MEDIA_CURBE_LOAD_header            \
331110e230b6Smaya   .DWordLength                         =      2,  \
331210e230b6Smaya   .SubOpcode                           =      1,  \
331310e230b6Smaya   .MediaCommandOpcode                  =      0,  \
331410e230b6Smaya   .Pipeline                            =      2,  \
331510e230b6Smaya   .CommandType                         =      3
331610e230b6Smaya
331710e230b6Smayastruct GEN6_MEDIA_CURBE_LOAD {
331810e230b6Smaya   uint32_t                             DWordLength;
331910e230b6Smaya   uint32_t                             SubOpcode;
332010e230b6Smaya   uint32_t                             MediaCommandOpcode;
332110e230b6Smaya   uint32_t                             Pipeline;
332210e230b6Smaya   uint32_t                             CommandType;
332310e230b6Smaya   uint32_t                             CURBETotalDataLength;
332410e230b6Smaya   uint32_t                             CURBEDataStartAddress;
332510e230b6Smaya};
332610e230b6Smaya
332710e230b6Smayastatic inline void
332810e230b6SmayaGEN6_MEDIA_CURBE_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
332910e230b6Smaya                           __attribute__((unused)) void * restrict dst,
333010e230b6Smaya                           __attribute__((unused)) const struct GEN6_MEDIA_CURBE_LOAD * restrict values)
333110e230b6Smaya{
333210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
333310e230b6Smaya
333410e230b6Smaya   dw[0] =
333510e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
333610e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
333710e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
333810e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
333910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
334010e230b6Smaya
334110e230b6Smaya   dw[1] = 0;
334210e230b6Smaya
334310e230b6Smaya   dw[2] =
334410e230b6Smaya      __gen_uint(values->CURBETotalDataLength, 0, 16);
334510e230b6Smaya
334610e230b6Smaya   dw[3] =
334710e230b6Smaya      __gen_uint(values->CURBEDataStartAddress, 0, 31);
334810e230b6Smaya}
334910e230b6Smaya
335010e230b6Smaya#define GEN6_MEDIA_GATEWAY_STATE_length        2
335110e230b6Smaya#define GEN6_MEDIA_GATEWAY_STATE_length_bias      2
335210e230b6Smaya#define GEN6_MEDIA_GATEWAY_STATE_header         \
335310e230b6Smaya   .DWordLength                         =      0,  \
335410e230b6Smaya   .SubOpcode                           =      3,  \
335510e230b6Smaya   .MediaCommandOpcode                  =      0,  \
335610e230b6Smaya   .Pipeline                            =      2,  \
335710e230b6Smaya   .CommandType                         =      3
335810e230b6Smaya
335910e230b6Smayastruct GEN6_MEDIA_GATEWAY_STATE {
336010e230b6Smaya   uint32_t                             DWordLength;
336110e230b6Smaya   uint32_t                             SubOpcode;
336210e230b6Smaya   uint32_t                             MediaCommandOpcode;
336310e230b6Smaya   uint32_t                             Pipeline;
336410e230b6Smaya   uint32_t                             CommandType;
336510e230b6Smaya   uint32_t                             BarrierThreadCount;
336610e230b6Smaya   uint32_t                             BarrierByte;
336710e230b6Smaya   uint32_t                             BarrierID;
336810e230b6Smaya};
336910e230b6Smaya
337010e230b6Smayastatic inline void
337110e230b6SmayaGEN6_MEDIA_GATEWAY_STATE_pack(__attribute__((unused)) __gen_user_data *data,
337210e230b6Smaya                              __attribute__((unused)) void * restrict dst,
337310e230b6Smaya                              __attribute__((unused)) const struct GEN6_MEDIA_GATEWAY_STATE * restrict values)
337410e230b6Smaya{
337510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
337610e230b6Smaya
337710e230b6Smaya   dw[0] =
337810e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
337910e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
338010e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
338110e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
338210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
338310e230b6Smaya
338410e230b6Smaya   dw[1] =
338510e230b6Smaya      __gen_uint(values->BarrierThreadCount, 0, 7) |
338610e230b6Smaya      __gen_uint(values->BarrierByte, 8, 15) |
338710e230b6Smaya      __gen_uint(values->BarrierID, 16, 23);
338810e230b6Smaya}
338910e230b6Smaya
339010e230b6Smaya#define GEN6_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length      4
339110e230b6Smaya#define GEN6_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length_bias      2
339210e230b6Smaya#define GEN6_MEDIA_INTERFACE_DESCRIPTOR_LOAD_header\
339310e230b6Smaya   .DWordLength                         =      2,  \
339410e230b6Smaya   .SubOpcode                           =      2,  \
339510e230b6Smaya   .MediaCommandOpcode                  =      0,  \
339610e230b6Smaya   .Pipeline                            =      2,  \
339710e230b6Smaya   .CommandType                         =      3
339810e230b6Smaya
339910e230b6Smayastruct GEN6_MEDIA_INTERFACE_DESCRIPTOR_LOAD {
340010e230b6Smaya   uint32_t                             DWordLength;
340110e230b6Smaya   uint32_t                             SubOpcode;
340210e230b6Smaya   uint32_t                             MediaCommandOpcode;
340310e230b6Smaya   uint32_t                             Pipeline;
340410e230b6Smaya   uint32_t                             CommandType;
340510e230b6Smaya   uint32_t                             InterfaceDescriptorTotalLength;
340610e230b6Smaya   uint64_t                             InterfaceDescriptorDataStartAddress;
340710e230b6Smaya};
340810e230b6Smaya
340910e230b6Smayastatic inline void
341010e230b6SmayaGEN6_MEDIA_INTERFACE_DESCRIPTOR_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
341110e230b6Smaya                                          __attribute__((unused)) void * restrict dst,
341210e230b6Smaya                                          __attribute__((unused)) const struct GEN6_MEDIA_INTERFACE_DESCRIPTOR_LOAD * restrict values)
341310e230b6Smaya{
341410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
341510e230b6Smaya
341610e230b6Smaya   dw[0] =
341710e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
341810e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
341910e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
342010e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
342110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
342210e230b6Smaya
342310e230b6Smaya   dw[1] = 0;
342410e230b6Smaya
342510e230b6Smaya   dw[2] =
342610e230b6Smaya      __gen_uint(values->InterfaceDescriptorTotalLength, 0, 16);
342710e230b6Smaya
342810e230b6Smaya   dw[3] =
342910e230b6Smaya      __gen_offset(values->InterfaceDescriptorDataStartAddress, 0, 31);
343010e230b6Smaya}
343110e230b6Smaya
343210e230b6Smaya#define GEN6_MEDIA_OBJECT_length_bias          2
343310e230b6Smaya#define GEN6_MEDIA_OBJECT_header                \
343410e230b6Smaya   .DWordLength                         =      4,  \
343510e230b6Smaya   .MediaCommandSubOpcode               =      0,  \
343610e230b6Smaya   .MediaCommandOpcode                  =      1,  \
343710e230b6Smaya   .MediaCommandPipeline                =      2,  \
343810e230b6Smaya   .CommandType                         =      3
343910e230b6Smaya
344010e230b6Smayastruct GEN6_MEDIA_OBJECT {
344110e230b6Smaya   uint32_t                             DWordLength;
344210e230b6Smaya   uint32_t                             MediaCommandSubOpcode;
344310e230b6Smaya   uint32_t                             MediaCommandOpcode;
344410e230b6Smaya   uint32_t                             MediaCommandPipeline;
344510e230b6Smaya   uint32_t                             CommandType;
344610e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
344710e230b6Smaya   uint32_t                             IndirectDataLength;
344810e230b6Smaya   uint32_t                             UseScoreboard;
344910e230b6Smaya#define Notusingscoreboard                       0
345010e230b6Smaya#define Usingscoreboard                          1
345110e230b6Smaya   uint32_t                             ThreadSynchronization;
345210e230b6Smaya#define Nothreadsynchronization                  0
345310e230b6Smaya#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
345410e230b6Smaya   bool                                 ChildrenPresent;
345510e230b6Smaya   __gen_address_type                   IndirectDataStartAddress;
345610e230b6Smaya   uint32_t                             ScoreboardX;
345710e230b6Smaya   uint32_t                             ScoredboardY;
345810e230b6Smaya   uint32_t                             ScoreboardMask;
345910e230b6Smaya   uint32_t                             ScoreboardColor;
346010e230b6Smaya   /* variable length fields follow */
346110e230b6Smaya};
346210e230b6Smaya
346310e230b6Smayastatic inline void
346410e230b6SmayaGEN6_MEDIA_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
346510e230b6Smaya                       __attribute__((unused)) void * restrict dst,
346610e230b6Smaya                       __attribute__((unused)) const struct GEN6_MEDIA_OBJECT * restrict values)
346710e230b6Smaya{
346810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
346910e230b6Smaya
347010e230b6Smaya   dw[0] =
347110e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
347210e230b6Smaya      __gen_uint(values->MediaCommandSubOpcode, 16, 23) |
347310e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
347410e230b6Smaya      __gen_uint(values->MediaCommandPipeline, 27, 28) |
347510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
347610e230b6Smaya
347710e230b6Smaya   dw[1] =
347810e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
347910e230b6Smaya
348010e230b6Smaya   dw[2] =
348110e230b6Smaya      __gen_uint(values->IndirectDataLength, 0, 16) |
348210e230b6Smaya      __gen_uint(values->UseScoreboard, 21, 21) |
348310e230b6Smaya      __gen_uint(values->ThreadSynchronization, 24, 24) |
348410e230b6Smaya      __gen_uint(values->ChildrenPresent, 31, 31);
348510e230b6Smaya
348610e230b6Smaya   dw[3] = __gen_combine_address(data, &dw[3], values->IndirectDataStartAddress, 0);
348710e230b6Smaya
348810e230b6Smaya   dw[4] =
348910e230b6Smaya      __gen_uint(values->ScoreboardX, 0, 8) |
349010e230b6Smaya      __gen_uint(values->ScoredboardY, 16, 24);
349110e230b6Smaya
349210e230b6Smaya   dw[5] =
349310e230b6Smaya      __gen_uint(values->ScoreboardMask, 0, 7) |
349410e230b6Smaya      __gen_uint(values->ScoreboardColor, 16, 19);
349510e230b6Smaya}
349610e230b6Smaya
349710e230b6Smaya#define GEN6_MEDIA_OBJECT_PRT_length          16
349810e230b6Smaya#define GEN6_MEDIA_OBJECT_PRT_length_bias      2
349910e230b6Smaya#define GEN6_MEDIA_OBJECT_PRT_header            \
350010e230b6Smaya   .DWordLength                         =     14,  \
350110e230b6Smaya   .SubOpcode                           =      2,  \
350210e230b6Smaya   .MediaCommandOpcode                  =      1,  \
350310e230b6Smaya   .Pipeline                            =      2,  \
350410e230b6Smaya   .CommandType                         =      3
350510e230b6Smaya
350610e230b6Smayastruct GEN6_MEDIA_OBJECT_PRT {
350710e230b6Smaya   uint32_t                             DWordLength;
350810e230b6Smaya   uint32_t                             SubOpcode;
350910e230b6Smaya   uint32_t                             MediaCommandOpcode;
351010e230b6Smaya   uint32_t                             Pipeline;
351110e230b6Smaya   uint32_t                             CommandType;
351210e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
351310e230b6Smaya   uint32_t                             PRT_FenceType;
351410e230b6Smaya#define Rootthreadqueue                          0
351510e230b6Smaya#define VFEstateflush                            1
351610e230b6Smaya   bool                                 PRT_FenceNeeded;
351710e230b6Smaya   bool                                 ChildrenPresent;
351810e230b6Smaya   uint32_t                             InlineData[12];
351910e230b6Smaya};
352010e230b6Smaya
352110e230b6Smayastatic inline void
352210e230b6SmayaGEN6_MEDIA_OBJECT_PRT_pack(__attribute__((unused)) __gen_user_data *data,
352310e230b6Smaya                           __attribute__((unused)) void * restrict dst,
352410e230b6Smaya                           __attribute__((unused)) const struct GEN6_MEDIA_OBJECT_PRT * restrict values)
352510e230b6Smaya{
352610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
352710e230b6Smaya
352810e230b6Smaya   dw[0] =
352910e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
353010e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
353110e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
353210e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
353310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
353410e230b6Smaya
353510e230b6Smaya   dw[1] =
353610e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
353710e230b6Smaya
353810e230b6Smaya   dw[2] =
353910e230b6Smaya      __gen_uint(values->PRT_FenceType, 22, 22) |
354010e230b6Smaya      __gen_uint(values->PRT_FenceNeeded, 23, 23) |
354110e230b6Smaya      __gen_uint(values->ChildrenPresent, 31, 31);
354210e230b6Smaya
354310e230b6Smaya   dw[3] = 0;
354410e230b6Smaya
354510e230b6Smaya   dw[4] =
354610e230b6Smaya      __gen_uint(values->InlineData[0], 0, 31);
354710e230b6Smaya
354810e230b6Smaya   dw[5] =
354910e230b6Smaya      __gen_uint(values->InlineData[1], 0, 31);
355010e230b6Smaya
355110e230b6Smaya   dw[6] =
355210e230b6Smaya      __gen_uint(values->InlineData[2], 0, 31);
355310e230b6Smaya
355410e230b6Smaya   dw[7] =
355510e230b6Smaya      __gen_uint(values->InlineData[3], 0, 31);
355610e230b6Smaya
355710e230b6Smaya   dw[8] =
355810e230b6Smaya      __gen_uint(values->InlineData[4], 0, 31);
355910e230b6Smaya
356010e230b6Smaya   dw[9] =
356110e230b6Smaya      __gen_uint(values->InlineData[5], 0, 31);
356210e230b6Smaya
356310e230b6Smaya   dw[10] =
356410e230b6Smaya      __gen_uint(values->InlineData[6], 0, 31);
356510e230b6Smaya
356610e230b6Smaya   dw[11] =
356710e230b6Smaya      __gen_uint(values->InlineData[7], 0, 31);
356810e230b6Smaya
356910e230b6Smaya   dw[12] =
357010e230b6Smaya      __gen_uint(values->InlineData[8], 0, 31);
357110e230b6Smaya
357210e230b6Smaya   dw[13] =
357310e230b6Smaya      __gen_uint(values->InlineData[9], 0, 31);
357410e230b6Smaya
357510e230b6Smaya   dw[14] =
357610e230b6Smaya      __gen_uint(values->InlineData[10], 0, 31);
357710e230b6Smaya
357810e230b6Smaya   dw[15] =
357910e230b6Smaya      __gen_uint(values->InlineData[11], 0, 31);
358010e230b6Smaya}
358110e230b6Smaya
358210e230b6Smaya#define GEN6_MEDIA_OBJECT_WALKER_length_bias      2
358310e230b6Smaya#define GEN6_MEDIA_OBJECT_WALKER_header         \
358410e230b6Smaya   .DWordLength                         =     15,  \
358510e230b6Smaya   .SubOpcode                           =      3,  \
358610e230b6Smaya   .MediaCommandOpcode                  =      1,  \
358710e230b6Smaya   .Pipeline                            =      2,  \
358810e230b6Smaya   .CommandType                         =      3
358910e230b6Smaya
359010e230b6Smayastruct GEN6_MEDIA_OBJECT_WALKER {
359110e230b6Smaya   uint32_t                             DWordLength;
359210e230b6Smaya   uint32_t                             SubOpcode;
359310e230b6Smaya   uint32_t                             MediaCommandOpcode;
359410e230b6Smaya   uint32_t                             Pipeline;
359510e230b6Smaya   uint32_t                             CommandType;
359610e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
359710e230b6Smaya   uint32_t                             IndirectDataLength;
359810e230b6Smaya   uint32_t                             UseScoreboard;
359910e230b6Smaya#define Notusingscoreboard                       0
360010e230b6Smaya#define Usingscoreboard                          1
360110e230b6Smaya   uint32_t                             ThreadSynchronization;
360210e230b6Smaya#define Nothreadsynchronization                  0
360310e230b6Smaya#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
360410e230b6Smaya   uint32_t                             ChildrenPresent;
360510e230b6Smaya   uint64_t                             IndirectDataStartAddress;
360610e230b6Smaya   uint32_t                             ScoreboardMask;
360710e230b6Smaya   int32_t                              MidLoopUnitX;
360810e230b6Smaya   int32_t                              LocalMidLoopUnitY;
360910e230b6Smaya   uint32_t                             MiddleLoopExtraSteps;
361010e230b6Smaya   uint32_t                             ColorCountMinusOne;
361110e230b6Smaya   uint32_t                             Repel;
361210e230b6Smaya   uint32_t                             DualMode;
361310e230b6Smaya   uint32_t                             LocalLoopExecCount;
361410e230b6Smaya   uint32_t                             GlobalLoopExecCount;
361510e230b6Smaya   uint32_t                             BlockResolutionX;
361610e230b6Smaya   uint32_t                             BlockResolutionY;
361710e230b6Smaya   uint32_t                             LocalStartX;
361810e230b6Smaya   uint32_t                             LocalStartY;
361910e230b6Smaya   uint32_t                             LocalEndX;
362010e230b6Smaya   uint32_t                             LocalEndY;
362110e230b6Smaya   int32_t                              LocalOuterLoopStrideX;
362210e230b6Smaya   int32_t                              LocalOuterLoopStrideY;
362310e230b6Smaya   int32_t                              LocalInnerLoopUnitX;
362410e230b6Smaya   int32_t                              LocalInnerLoopUnitY;
362510e230b6Smaya   uint32_t                             GlobalResolutionX;
362610e230b6Smaya   uint32_t                             GlobalResolutionY;
362710e230b6Smaya   int32_t                              GlobalStartX;
362810e230b6Smaya   int32_t                              GlobalStartY;
362910e230b6Smaya   int32_t                              GlobalOuterLoopStrideX;
363010e230b6Smaya   int32_t                              GlobalOuterLoopStrideY;
363110e230b6Smaya   int32_t                              GlobalInnerLoopUnitX;
363210e230b6Smaya   int32_t                              GlobalInnerLoopUnitY;
363310e230b6Smaya   /* variable length fields follow */
363410e230b6Smaya};
363510e230b6Smaya
363610e230b6Smayastatic inline void
363710e230b6SmayaGEN6_MEDIA_OBJECT_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
363810e230b6Smaya                              __attribute__((unused)) void * restrict dst,
363910e230b6Smaya                              __attribute__((unused)) const struct GEN6_MEDIA_OBJECT_WALKER * restrict values)
364010e230b6Smaya{
364110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
364210e230b6Smaya
364310e230b6Smaya   dw[0] =
364410e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
364510e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
364610e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
364710e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
364810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
364910e230b6Smaya
365010e230b6Smaya   dw[1] =
365110e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
365210e230b6Smaya
365310e230b6Smaya   dw[2] =
365410e230b6Smaya      __gen_uint(values->IndirectDataLength, 0, 16) |
365510e230b6Smaya      __gen_uint(values->UseScoreboard, 21, 21) |
365610e230b6Smaya      __gen_uint(values->ThreadSynchronization, 24, 24) |
365710e230b6Smaya      __gen_uint(values->ChildrenPresent, 31, 31);
365810e230b6Smaya
365910e230b6Smaya   dw[3] =
366010e230b6Smaya      __gen_offset(values->IndirectDataStartAddress, 0, 31);
366110e230b6Smaya
366210e230b6Smaya   dw[4] = 0;
366310e230b6Smaya
366410e230b6Smaya   dw[5] =
366510e230b6Smaya      __gen_uint(values->ScoreboardMask, 0, 7);
366610e230b6Smaya
366710e230b6Smaya   dw[6] =
366810e230b6Smaya      __gen_sint(values->MidLoopUnitX, 8, 9) |
366910e230b6Smaya      __gen_sint(values->LocalMidLoopUnitY, 12, 13) |
367010e230b6Smaya      __gen_uint(values->MiddleLoopExtraSteps, 16, 20) |
367110e230b6Smaya      __gen_uint(values->ColorCountMinusOne, 24, 27) |
367210e230b6Smaya      __gen_uint(values->Repel, 30, 30) |
367310e230b6Smaya      __gen_uint(values->DualMode, 31, 31);
367410e230b6Smaya
367510e230b6Smaya   dw[7] =
367610e230b6Smaya      __gen_uint(values->LocalLoopExecCount, 0, 9) |
367710e230b6Smaya      __gen_uint(values->GlobalLoopExecCount, 16, 25);
367810e230b6Smaya
367910e230b6Smaya   dw[8] =
368010e230b6Smaya      __gen_uint(values->BlockResolutionX, 0, 8) |
368110e230b6Smaya      __gen_uint(values->BlockResolutionY, 16, 24);
368210e230b6Smaya
368310e230b6Smaya   dw[9] =
368410e230b6Smaya      __gen_uint(values->LocalStartX, 0, 8) |
368510e230b6Smaya      __gen_uint(values->LocalStartY, 16, 24);
368610e230b6Smaya
368710e230b6Smaya   dw[10] =
368810e230b6Smaya      __gen_uint(values->LocalEndX, 0, 8) |
368910e230b6Smaya      __gen_uint(values->LocalEndY, 16, 24);
369010e230b6Smaya
369110e230b6Smaya   dw[11] =
369210e230b6Smaya      __gen_sint(values->LocalOuterLoopStrideX, 0, 9) |
369310e230b6Smaya      __gen_sint(values->LocalOuterLoopStrideY, 16, 25);
369410e230b6Smaya
369510e230b6Smaya   dw[12] =
369610e230b6Smaya      __gen_sint(values->LocalInnerLoopUnitX, 0, 9) |
369710e230b6Smaya      __gen_sint(values->LocalInnerLoopUnitY, 16, 25);
369810e230b6Smaya
369910e230b6Smaya   dw[13] =
370010e230b6Smaya      __gen_uint(values->GlobalResolutionX, 0, 8) |
370110e230b6Smaya      __gen_uint(values->GlobalResolutionY, 16, 24);
370210e230b6Smaya
370310e230b6Smaya   dw[14] =
370410e230b6Smaya      __gen_sint(values->GlobalStartX, 0, 9) |
370510e230b6Smaya      __gen_sint(values->GlobalStartY, 16, 25);
370610e230b6Smaya
370710e230b6Smaya   dw[15] =
370810e230b6Smaya      __gen_sint(values->GlobalOuterLoopStrideX, 0, 9) |
370910e230b6Smaya      __gen_sint(values->GlobalOuterLoopStrideY, 16, 25);
371010e230b6Smaya
371110e230b6Smaya   dw[16] =
371210e230b6Smaya      __gen_sint(values->GlobalInnerLoopUnitX, 0, 9) |
371310e230b6Smaya      __gen_sint(values->GlobalInnerLoopUnitY, 16, 25);
371410e230b6Smaya}
371510e230b6Smaya
371610e230b6Smaya#define GEN6_MEDIA_STATE_FLUSH_length          2
371710e230b6Smaya#define GEN6_MEDIA_STATE_FLUSH_length_bias      2
371810e230b6Smaya#define GEN6_MEDIA_STATE_FLUSH_header           \
371910e230b6Smaya   .DWordLength                         =      0,  \
372010e230b6Smaya   .SubOpcode                           =      4,  \
372110e230b6Smaya   .MediaCommandOpcode                  =      0,  \
372210e230b6Smaya   .Pipeline                            =      2,  \
372310e230b6Smaya   .CommandType                         =      3
372410e230b6Smaya
372510e230b6Smayastruct GEN6_MEDIA_STATE_FLUSH {
372610e230b6Smaya   uint32_t                             DWordLength;
372710e230b6Smaya   uint32_t                             SubOpcode;
372810e230b6Smaya   uint32_t                             MediaCommandOpcode;
372910e230b6Smaya   uint32_t                             Pipeline;
373010e230b6Smaya   uint32_t                             CommandType;
373110e230b6Smaya   uint32_t                             BarrierMask;
373210e230b6Smaya#define NotWaiting                               0
373310e230b6Smaya#define Waiting                                  1
373410e230b6Smaya   uint32_t                             ThreadCountWaterMark;
373510e230b6Smaya};
373610e230b6Smaya
373710e230b6Smayastatic inline void
373810e230b6SmayaGEN6_MEDIA_STATE_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
373910e230b6Smaya                            __attribute__((unused)) void * restrict dst,
374010e230b6Smaya                            __attribute__((unused)) const struct GEN6_MEDIA_STATE_FLUSH * restrict values)
374110e230b6Smaya{
374210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
374310e230b6Smaya
374410e230b6Smaya   dw[0] =
374510e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
374610e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
374710e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
374810e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
374910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
375010e230b6Smaya
375110e230b6Smaya   dw[1] =
375210e230b6Smaya      __gen_uint(values->BarrierMask, 0, 15) |
375310e230b6Smaya      __gen_uint(values->ThreadCountWaterMark, 16, 23);
375410e230b6Smaya}
375510e230b6Smaya
375610e230b6Smaya#define GEN6_MEDIA_VFE_STATE_length            8
375710e230b6Smaya#define GEN6_MEDIA_VFE_STATE_length_bias       2
375810e230b6Smaya#define GEN6_MEDIA_VFE_STATE_header             \
375910e230b6Smaya   .DWordLength                         =      6,  \
376010e230b6Smaya   .SubOpcode                           =      0,  \
376110e230b6Smaya   .MediaCommandOpcode                  =      0,  \
376210e230b6Smaya   .Pipeline                            =      2,  \
376310e230b6Smaya   .CommandType                         =      3
376410e230b6Smaya
376510e230b6Smayastruct GEN6_MEDIA_VFE_STATE {
376610e230b6Smaya   uint32_t                             DWordLength;
376710e230b6Smaya   uint32_t                             SubOpcode;
376810e230b6Smaya   uint32_t                             MediaCommandOpcode;
376910e230b6Smaya   uint32_t                             Pipeline;
377010e230b6Smaya   uint32_t                             CommandType;
377110e230b6Smaya   uint32_t                             PerThreadScratchSpace;
377210e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
377310e230b6Smaya   uint32_t                             FastPreempt;
377410e230b6Smaya#define Preemptonly_PRT                          0
377510e230b6Smaya   uint32_t                             BypassGatewayControl;
377610e230b6Smaya#define MaintainingOpenGatewayForwardMsgCloseGatewayprotocollegacymode 0
377710e230b6Smaya#define BypassingOpenGatewayCloseGatewayprotocol 1
377810e230b6Smaya   uint32_t                             ResetGatewayTimer;
377910e230b6Smaya#define Maintainingtheexistingtimestampstate     0
378010e230b6Smaya#define Resettingrelativetimerandlatchingtheglobaltimestamp 1
378110e230b6Smaya   uint32_t                             NumberofURBEntries;
378210e230b6Smaya   uint32_t                             MaximumNumberofThreads;
378310e230b6Smaya   uint32_t                             CURBEAllocationSize;
378410e230b6Smaya   uint32_t                             URBEntryAllocationSize;
378510e230b6Smaya   uint32_t                             ScoreboardMask;
378610e230b6Smaya   uint32_t                             ScoreboardType;
378710e230b6Smaya#define StallingScoreboard                       0
378810e230b6Smaya   uint32_t                             ScoreboardEnable;
378910e230b6Smaya#define Scoreboarddisabled                       0
379010e230b6Smaya#define Scoreboardenabled                        1
379110e230b6Smaya   int32_t                              Scoreboard0DeltaX;
379210e230b6Smaya   int32_t                              Scoreboard0DeltaY;
379310e230b6Smaya   int32_t                              Scoreboard1DeltaX;
379410e230b6Smaya   int32_t                              Scoreboard1DeltaY;
379510e230b6Smaya   int32_t                              Scoreboard2DeltaX;
379610e230b6Smaya   int32_t                              Scoreboard2DeltaY;
379710e230b6Smaya   int32_t                              Scoreboard3DeltaX;
379810e230b6Smaya   int32_t                              Scoreboard3DeltaY;
379910e230b6Smaya   int32_t                              Scoreboard4DeltaX;
380010e230b6Smaya   int32_t                              Scoreboard4DeltaY;
380110e230b6Smaya   int32_t                              Scoreboard5DeltaX;
380210e230b6Smaya   int32_t                              Scoreboard5DeltaY;
380310e230b6Smaya   int32_t                              Scoreboard6DeltaX;
380410e230b6Smaya   int32_t                              Scoreboard6DeltaY;
380510e230b6Smaya   int32_t                              Scoreboard7DeltaX;
380610e230b6Smaya   int32_t                              Scoreboard7DeltaY;
380710e230b6Smaya};
380810e230b6Smaya
380910e230b6Smayastatic inline void
381010e230b6SmayaGEN6_MEDIA_VFE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
381110e230b6Smaya                          __attribute__((unused)) void * restrict dst,
381210e230b6Smaya                          __attribute__((unused)) const struct GEN6_MEDIA_VFE_STATE * restrict values)
381310e230b6Smaya{
381410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
381510e230b6Smaya
381610e230b6Smaya   dw[0] =
381710e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
381810e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
381910e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
382010e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
382110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
382210e230b6Smaya
382310e230b6Smaya   const uint32_t v1 =
382410e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
382510e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->ScratchSpaceBasePointer, v1);
382610e230b6Smaya
382710e230b6Smaya   dw[2] =
382810e230b6Smaya      __gen_uint(values->FastPreempt, 5, 5) |
382910e230b6Smaya      __gen_uint(values->BypassGatewayControl, 6, 6) |
383010e230b6Smaya      __gen_uint(values->ResetGatewayTimer, 7, 7) |
383110e230b6Smaya      __gen_uint(values->NumberofURBEntries, 8, 15) |
383210e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 16, 31);
383310e230b6Smaya
383410e230b6Smaya   dw[3] = 0;
383510e230b6Smaya
383610e230b6Smaya   dw[4] =
383710e230b6Smaya      __gen_uint(values->CURBEAllocationSize, 0, 15) |
383810e230b6Smaya      __gen_uint(values->URBEntryAllocationSize, 16, 31);
383910e230b6Smaya
384010e230b6Smaya   dw[5] =
384110e230b6Smaya      __gen_uint(values->ScoreboardMask, 0, 7) |
384210e230b6Smaya      __gen_uint(values->ScoreboardType, 30, 30) |
384310e230b6Smaya      __gen_uint(values->ScoreboardEnable, 31, 31);
384410e230b6Smaya
384510e230b6Smaya   dw[6] =
384610e230b6Smaya      __gen_sint(values->Scoreboard0DeltaX, 0, 3) |
384710e230b6Smaya      __gen_sint(values->Scoreboard0DeltaY, 4, 7) |
384810e230b6Smaya      __gen_sint(values->Scoreboard1DeltaX, 8, 11) |
384910e230b6Smaya      __gen_sint(values->Scoreboard1DeltaY, 12, 15) |
385010e230b6Smaya      __gen_sint(values->Scoreboard2DeltaX, 16, 19) |
385110e230b6Smaya      __gen_sint(values->Scoreboard2DeltaY, 20, 23) |
385210e230b6Smaya      __gen_sint(values->Scoreboard3DeltaX, 24, 27) |
385310e230b6Smaya      __gen_sint(values->Scoreboard3DeltaY, 28, 31);
385410e230b6Smaya
385510e230b6Smaya   dw[7] =
385610e230b6Smaya      __gen_sint(values->Scoreboard4DeltaX, 0, 3) |
385710e230b6Smaya      __gen_sint(values->Scoreboard4DeltaY, 4, 7) |
385810e230b6Smaya      __gen_sint(values->Scoreboard5DeltaX, 8, 11) |
385910e230b6Smaya      __gen_sint(values->Scoreboard5DeltaY, 12, 15) |
386010e230b6Smaya      __gen_sint(values->Scoreboard6DeltaX, 16, 19) |
386110e230b6Smaya      __gen_sint(values->Scoreboard6DeltaY, 20, 23) |
386210e230b6Smaya      __gen_sint(values->Scoreboard7DeltaX, 24, 27) |
386310e230b6Smaya      __gen_sint(values->Scoreboard7DeltaY, 28, 31);
386410e230b6Smaya}
386510e230b6Smaya
386610e230b6Smaya#define GEN6_MI_ARB_CHECK_length               1
386710e230b6Smaya#define GEN6_MI_ARB_CHECK_length_bias          1
386810e230b6Smaya#define GEN6_MI_ARB_CHECK_header                \
386910e230b6Smaya   .MICommandOpcode                     =      5,  \
387010e230b6Smaya   .CommandType                         =      0
387110e230b6Smaya
387210e230b6Smayastruct GEN6_MI_ARB_CHECK {
387310e230b6Smaya   uint32_t                             MICommandOpcode;
387410e230b6Smaya   uint32_t                             CommandType;
387510e230b6Smaya};
387610e230b6Smaya
387710e230b6Smayastatic inline void
387810e230b6SmayaGEN6_MI_ARB_CHECK_pack(__attribute__((unused)) __gen_user_data *data,
387910e230b6Smaya                       __attribute__((unused)) void * restrict dst,
388010e230b6Smaya                       __attribute__((unused)) const struct GEN6_MI_ARB_CHECK * restrict values)
388110e230b6Smaya{
388210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
388310e230b6Smaya
388410e230b6Smaya   dw[0] =
388510e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
388610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
388710e230b6Smaya}
388810e230b6Smaya
388910e230b6Smaya#define GEN6_MI_ARB_ON_OFF_length              1
389010e230b6Smaya#define GEN6_MI_ARB_ON_OFF_length_bias         1
389110e230b6Smaya#define GEN6_MI_ARB_ON_OFF_header               \
389210e230b6Smaya   .MICommandOpcode                     =      8,  \
389310e230b6Smaya   .CommandType                         =      0
389410e230b6Smaya
389510e230b6Smayastruct GEN6_MI_ARB_ON_OFF {
389610e230b6Smaya   bool                                 ArbitrationEnable;
389710e230b6Smaya   uint32_t                             MICommandOpcode;
389810e230b6Smaya   uint32_t                             CommandType;
389910e230b6Smaya};
390010e230b6Smaya
390110e230b6Smayastatic inline void
390210e230b6SmayaGEN6_MI_ARB_ON_OFF_pack(__attribute__((unused)) __gen_user_data *data,
390310e230b6Smaya                        __attribute__((unused)) void * restrict dst,
390410e230b6Smaya                        __attribute__((unused)) const struct GEN6_MI_ARB_ON_OFF * restrict values)
390510e230b6Smaya{
390610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
390710e230b6Smaya
390810e230b6Smaya   dw[0] =
390910e230b6Smaya      __gen_uint(values->ArbitrationEnable, 0, 0) |
391010e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
391110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
391210e230b6Smaya}
391310e230b6Smaya
391410e230b6Smaya#define GEN6_MI_BATCH_BUFFER_END_length        1
391510e230b6Smaya#define GEN6_MI_BATCH_BUFFER_END_length_bias      1
391610e230b6Smaya#define GEN6_MI_BATCH_BUFFER_END_header         \
391710e230b6Smaya   .MICommandOpcode                     =     10,  \
391810e230b6Smaya   .CommandType                         =      0
391910e230b6Smaya
392010e230b6Smayastruct GEN6_MI_BATCH_BUFFER_END {
392110e230b6Smaya   uint32_t                             MICommandOpcode;
392210e230b6Smaya   uint32_t                             CommandType;
392310e230b6Smaya};
392410e230b6Smaya
392510e230b6Smayastatic inline void
392610e230b6SmayaGEN6_MI_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
392710e230b6Smaya                              __attribute__((unused)) void * restrict dst,
392810e230b6Smaya                              __attribute__((unused)) const struct GEN6_MI_BATCH_BUFFER_END * restrict values)
392910e230b6Smaya{
393010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
393110e230b6Smaya
393210e230b6Smaya   dw[0] =
393310e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
393410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
393510e230b6Smaya}
393610e230b6Smaya
393710e230b6Smaya#define GEN6_MI_BATCH_BUFFER_START_length      2
393810e230b6Smaya#define GEN6_MI_BATCH_BUFFER_START_length_bias      2
393910e230b6Smaya#define GEN6_MI_BATCH_BUFFER_START_header       \
394010e230b6Smaya   .DWordLength                         =      0,  \
394110e230b6Smaya   .MICommandOpcode                     =     49,  \
394210e230b6Smaya   .CommandType                         =      0
394310e230b6Smaya
394410e230b6Smayastruct GEN6_MI_BATCH_BUFFER_START {
394510e230b6Smaya   uint32_t                             DWordLength;
394610e230b6Smaya   uint32_t                             AddressSpaceIndicator;
394710e230b6Smaya#define ASI_GGTT                                 0
394810e230b6Smaya#define ASI_PPGTT                                1
394910e230b6Smaya   bool                                 ClearCommandBufferEnable;
395010e230b6Smaya   uint32_t                             MICommandOpcode;
395110e230b6Smaya   uint32_t                             CommandType;
395210e230b6Smaya   __gen_address_type                   BatchBufferStartAddress;
395310e230b6Smaya};
395410e230b6Smaya
395510e230b6Smayastatic inline void
395610e230b6SmayaGEN6_MI_BATCH_BUFFER_START_pack(__attribute__((unused)) __gen_user_data *data,
395710e230b6Smaya                                __attribute__((unused)) void * restrict dst,
395810e230b6Smaya                                __attribute__((unused)) const struct GEN6_MI_BATCH_BUFFER_START * restrict values)
395910e230b6Smaya{
396010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
396110e230b6Smaya
396210e230b6Smaya   dw[0] =
396310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
396410e230b6Smaya      __gen_uint(values->AddressSpaceIndicator, 8, 8) |
396510e230b6Smaya      __gen_uint(values->ClearCommandBufferEnable, 11, 11) |
396610e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
396710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
396810e230b6Smaya
396910e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->BatchBufferStartAddress, 0);
397010e230b6Smaya}
397110e230b6Smaya
397210e230b6Smaya#define GEN6_MI_CLFLUSH_length_bias            2
397310e230b6Smaya#define GEN6_MI_CLFLUSH_header                  \
397410e230b6Smaya   .DWordLength                         =      0,  \
397510e230b6Smaya   .MICommandOpcode                     =     39,  \
397610e230b6Smaya   .CommandType                         =      0
397710e230b6Smaya
397810e230b6Smayastruct GEN6_MI_CLFLUSH {
397910e230b6Smaya   uint32_t                             DWordLength;
398010e230b6Smaya   bool                                 UseGlobalGTT;
398110e230b6Smaya   uint32_t                             MICommandOpcode;
398210e230b6Smaya   uint32_t                             CommandType;
398310e230b6Smaya   uint32_t                             StartingCachelineOffset;
398410e230b6Smaya   __gen_address_type                   PageBaseAddress;
398510e230b6Smaya   /* variable length fields follow */
398610e230b6Smaya};
398710e230b6Smaya
398810e230b6Smayastatic inline void
398910e230b6SmayaGEN6_MI_CLFLUSH_pack(__attribute__((unused)) __gen_user_data *data,
399010e230b6Smaya                     __attribute__((unused)) void * restrict dst,
399110e230b6Smaya                     __attribute__((unused)) const struct GEN6_MI_CLFLUSH * restrict values)
399210e230b6Smaya{
399310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
399410e230b6Smaya
399510e230b6Smaya   dw[0] =
399610e230b6Smaya      __gen_uint(values->DWordLength, 0, 5) |
399710e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
399810e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
399910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
400010e230b6Smaya
400110e230b6Smaya   const uint32_t v1 =
400210e230b6Smaya      __gen_uint(values->StartingCachelineOffset, 6, 11);
400310e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->PageBaseAddress, v1);
400410e230b6Smaya}
400510e230b6Smaya
400610e230b6Smaya#define GEN6_MI_CONDITIONAL_BATCH_BUFFER_END_length      2
400710e230b6Smaya#define GEN6_MI_CONDITIONAL_BATCH_BUFFER_END_length_bias      2
400810e230b6Smaya#define GEN6_MI_CONDITIONAL_BATCH_BUFFER_END_header\
400910e230b6Smaya   .DWordLength                         =      0,  \
401010e230b6Smaya   .CompareSemaphore                    =      0,  \
401110e230b6Smaya   .MICommandOpcode                     =     54,  \
401210e230b6Smaya   .CommandType                         =      0
401310e230b6Smaya
401410e230b6Smayastruct GEN6_MI_CONDITIONAL_BATCH_BUFFER_END {
401510e230b6Smaya   uint32_t                             DWordLength;
401610e230b6Smaya   uint32_t                             CompareSemaphore;
401710e230b6Smaya   bool                                 UseGlobalGTT;
401810e230b6Smaya   uint32_t                             MICommandOpcode;
401910e230b6Smaya   uint32_t                             CommandType;
402010e230b6Smaya   uint32_t                             CompareDataDword;
402110e230b6Smaya   __gen_address_type                   CompareAddress;
402210e230b6Smaya};
402310e230b6Smaya
402410e230b6Smayastatic inline void
402510e230b6SmayaGEN6_MI_CONDITIONAL_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
402610e230b6Smaya                                          __attribute__((unused)) void * restrict dst,
402710e230b6Smaya                                          __attribute__((unused)) const struct GEN6_MI_CONDITIONAL_BATCH_BUFFER_END * restrict values)
402810e230b6Smaya{
402910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
403010e230b6Smaya
403110e230b6Smaya   dw[0] =
403210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
403310e230b6Smaya      __gen_uint(values->CompareSemaphore, 21, 21) |
403410e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
403510e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
403610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
403710e230b6Smaya
403810e230b6Smaya   dw[1] =
403910e230b6Smaya      __gen_uint(values->CompareDataDword, 0, 31);
404010e230b6Smaya}
404110e230b6Smaya
404210e230b6Smaya#define GEN6_MI_FLUSH_length                   1
404310e230b6Smaya#define GEN6_MI_FLUSH_length_bias              1
404410e230b6Smaya#define GEN6_MI_FLUSH_header                    \
404510e230b6Smaya   .MICommandOpcode                     =      4,  \
404610e230b6Smaya   .CommandType                         =      0
404710e230b6Smaya
404810e230b6Smayastruct GEN6_MI_FLUSH {
404910e230b6Smaya   uint32_t                             StateInstructionCacheInvalidate;
405010e230b6Smaya#define DontInvalidate                           0
405110e230b6Smaya#define Invalidate                               1
405210e230b6Smaya   uint32_t                             RenderCacheFlushInhibit;
405310e230b6Smaya#define Flush                                    0
405410e230b6Smaya#define DontFlush                                1
405510e230b6Smaya   uint32_t                             GlobalSnapshotCountReset;
405610e230b6Smaya#define DontReset                                0
405710e230b6Smaya#define Reset                                    1
405810e230b6Smaya   bool                                 GenericMediaStateClear;
405910e230b6Smaya   bool                                 IndirectStatePointersDisable;
406010e230b6Smaya   uint32_t                             MICommandOpcode;
406110e230b6Smaya   uint32_t                             CommandType;
406210e230b6Smaya};
406310e230b6Smaya
406410e230b6Smayastatic inline void
406510e230b6SmayaGEN6_MI_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
406610e230b6Smaya                   __attribute__((unused)) void * restrict dst,
406710e230b6Smaya                   __attribute__((unused)) const struct GEN6_MI_FLUSH * restrict values)
406810e230b6Smaya{
406910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
407010e230b6Smaya
407110e230b6Smaya   dw[0] =
407210e230b6Smaya      __gen_uint(values->StateInstructionCacheInvalidate, 1, 1) |
407310e230b6Smaya      __gen_uint(values->RenderCacheFlushInhibit, 2, 2) |
407410e230b6Smaya      __gen_uint(values->GlobalSnapshotCountReset, 3, 3) |
407510e230b6Smaya      __gen_uint(values->GenericMediaStateClear, 4, 4) |
407610e230b6Smaya      __gen_uint(values->IndirectStatePointersDisable, 5, 5) |
407710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
407810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
407910e230b6Smaya}
408010e230b6Smaya
408110e230b6Smaya#define GEN6_MI_LOAD_REGISTER_IMM_length       3
408210e230b6Smaya#define GEN6_MI_LOAD_REGISTER_IMM_length_bias      2
408310e230b6Smaya#define GEN6_MI_LOAD_REGISTER_IMM_header        \
408410e230b6Smaya   .DWordLength                         =      1,  \
408510e230b6Smaya   .MICommandOpcode                     =     34,  \
408610e230b6Smaya   .CommandType                         =      0
408710e230b6Smaya
408810e230b6Smayastruct GEN6_MI_LOAD_REGISTER_IMM {
408910e230b6Smaya   uint32_t                             DWordLength;
409010e230b6Smaya   uint32_t                             ByteWriteDisables;
409110e230b6Smaya   uint32_t                             MICommandOpcode;
409210e230b6Smaya   uint32_t                             CommandType;
409310e230b6Smaya   uint64_t                             RegisterOffset;
409410e230b6Smaya   uint32_t                             DataDWord;
409510e230b6Smaya   /* variable length fields follow */
409610e230b6Smaya};
409710e230b6Smaya
409810e230b6Smayastatic inline void
409910e230b6SmayaGEN6_MI_LOAD_REGISTER_IMM_pack(__attribute__((unused)) __gen_user_data *data,
410010e230b6Smaya                               __attribute__((unused)) void * restrict dst,
410110e230b6Smaya                               __attribute__((unused)) const struct GEN6_MI_LOAD_REGISTER_IMM * restrict values)
410210e230b6Smaya{
410310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
410410e230b6Smaya
410510e230b6Smaya   dw[0] =
410610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
410710e230b6Smaya      __gen_uint(values->ByteWriteDisables, 8, 11) |
410810e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
410910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
411010e230b6Smaya
411110e230b6Smaya   dw[1] =
411210e230b6Smaya      __gen_offset(values->RegisterOffset, 2, 22);
411310e230b6Smaya
411410e230b6Smaya   dw[2] =
411510e230b6Smaya      __gen_uint(values->DataDWord, 0, 31);
411610e230b6Smaya}
411710e230b6Smaya
411810e230b6Smaya#define GEN6_MI_LOAD_SCAN_LINES_EXCL_length      2
411910e230b6Smaya#define GEN6_MI_LOAD_SCAN_LINES_EXCL_length_bias      2
412010e230b6Smaya#define GEN6_MI_LOAD_SCAN_LINES_EXCL_header     \
412110e230b6Smaya   .DWordLength                         =      0,  \
412210e230b6Smaya   .MICommandOpcode                     =     19,  \
412310e230b6Smaya   .CommandType                         =      0
412410e230b6Smaya
412510e230b6Smayastruct GEN6_MI_LOAD_SCAN_LINES_EXCL {
412610e230b6Smaya   uint32_t                             DWordLength;
412710e230b6Smaya   uint32_t                             DisplayPlaneSelect;
412810e230b6Smaya#define DisplayPlaneA                            0
412910e230b6Smaya#define DisplayPlaneB                            1
413010e230b6Smaya#define DisplayPlaneC                            4
413110e230b6Smaya   uint32_t                             MICommandOpcode;
413210e230b6Smaya   uint32_t                             CommandType;
413310e230b6Smaya   uint32_t                             EndScanLineNumber;
413410e230b6Smaya   uint32_t                             StartScanLineNumber;
413510e230b6Smaya};
413610e230b6Smaya
413710e230b6Smayastatic inline void
413810e230b6SmayaGEN6_MI_LOAD_SCAN_LINES_EXCL_pack(__attribute__((unused)) __gen_user_data *data,
413910e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
414010e230b6Smaya                                  __attribute__((unused)) const struct GEN6_MI_LOAD_SCAN_LINES_EXCL * restrict values)
414110e230b6Smaya{
414210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
414310e230b6Smaya
414410e230b6Smaya   dw[0] =
414510e230b6Smaya      __gen_uint(values->DWordLength, 0, 5) |
414610e230b6Smaya      __gen_uint(values->DisplayPlaneSelect, 19, 21) |
414710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
414810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
414910e230b6Smaya
415010e230b6Smaya   dw[1] =
415110e230b6Smaya      __gen_uint(values->EndScanLineNumber, 0, 12) |
415210e230b6Smaya      __gen_uint(values->StartScanLineNumber, 16, 28);
415310e230b6Smaya}
415410e230b6Smaya
415510e230b6Smaya#define GEN6_MI_NOOP_length                    1
415610e230b6Smaya#define GEN6_MI_NOOP_length_bias               1
415710e230b6Smaya#define GEN6_MI_NOOP_header                     \
415810e230b6Smaya   .MICommandOpcode                     =      0,  \
415910e230b6Smaya   .CommandType                         =      0
416010e230b6Smaya
416110e230b6Smayastruct GEN6_MI_NOOP {
416210e230b6Smaya   uint32_t                             IdentificationNumber;
416310e230b6Smaya   bool                                 IdentificationNumberRegisterWriteEnable;
416410e230b6Smaya   uint32_t                             MICommandOpcode;
416510e230b6Smaya   uint32_t                             CommandType;
416610e230b6Smaya};
416710e230b6Smaya
416810e230b6Smayastatic inline void
416910e230b6SmayaGEN6_MI_NOOP_pack(__attribute__((unused)) __gen_user_data *data,
417010e230b6Smaya                  __attribute__((unused)) void * restrict dst,
417110e230b6Smaya                  __attribute__((unused)) const struct GEN6_MI_NOOP * restrict values)
417210e230b6Smaya{
417310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
417410e230b6Smaya
417510e230b6Smaya   dw[0] =
417610e230b6Smaya      __gen_uint(values->IdentificationNumber, 0, 21) |
417710e230b6Smaya      __gen_uint(values->IdentificationNumberRegisterWriteEnable, 22, 22) |
417810e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
417910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
418010e230b6Smaya}
418110e230b6Smaya
418210e230b6Smaya#define GEN6_MI_REPORT_HEAD_length             1
418310e230b6Smaya#define GEN6_MI_REPORT_HEAD_length_bias        1
418410e230b6Smaya#define GEN6_MI_REPORT_HEAD_header              \
418510e230b6Smaya   .MICommandOpcode                     =      7,  \
418610e230b6Smaya   .CommandType                         =      0
418710e230b6Smaya
418810e230b6Smayastruct GEN6_MI_REPORT_HEAD {
418910e230b6Smaya   uint32_t                             MICommandOpcode;
419010e230b6Smaya   uint32_t                             CommandType;
419110e230b6Smaya};
419210e230b6Smaya
419310e230b6Smayastatic inline void
419410e230b6SmayaGEN6_MI_REPORT_HEAD_pack(__attribute__((unused)) __gen_user_data *data,
419510e230b6Smaya                         __attribute__((unused)) void * restrict dst,
419610e230b6Smaya                         __attribute__((unused)) const struct GEN6_MI_REPORT_HEAD * restrict values)
419710e230b6Smaya{
419810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
419910e230b6Smaya
420010e230b6Smaya   dw[0] =
420110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
420210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
420310e230b6Smaya}
420410e230b6Smaya
420510e230b6Smaya#define GEN6_MI_SEMAPHORE_MBOX_length          3
420610e230b6Smaya#define GEN6_MI_SEMAPHORE_MBOX_length_bias      2
420710e230b6Smaya#define GEN6_MI_SEMAPHORE_MBOX_header           \
420810e230b6Smaya   .DWordLength                         =      1,  \
420910e230b6Smaya   .MICommandOpcode                     =     22,  \
421010e230b6Smaya   .CommandType                         =      0
421110e230b6Smaya
421210e230b6Smayastruct GEN6_MI_SEMAPHORE_MBOX {
421310e230b6Smaya   uint32_t                             DWordLength;
421410e230b6Smaya   uint32_t                             RegisterSelect;
421510e230b6Smaya#define RVSYNC                                   0
421610e230b6Smaya#define RBSYNC                                   2
421710e230b6Smaya#define UseGeneralRegisterSelect                 3
421810e230b6Smaya   uint32_t                             MICommandOpcode;
421910e230b6Smaya   uint32_t                             CommandType;
422010e230b6Smaya   uint32_t                             SemaphoreDataDword;
422110e230b6Smaya};
422210e230b6Smaya
422310e230b6Smayastatic inline void
422410e230b6SmayaGEN6_MI_SEMAPHORE_MBOX_pack(__attribute__((unused)) __gen_user_data *data,
422510e230b6Smaya                            __attribute__((unused)) void * restrict dst,
422610e230b6Smaya                            __attribute__((unused)) const struct GEN6_MI_SEMAPHORE_MBOX * restrict values)
422710e230b6Smaya{
422810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
422910e230b6Smaya
423010e230b6Smaya   dw[0] =
423110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
423210e230b6Smaya      __gen_uint(values->RegisterSelect, 16, 17) |
423310e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
423410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
423510e230b6Smaya
423610e230b6Smaya   dw[1] =
423710e230b6Smaya      __gen_uint(values->SemaphoreDataDword, 0, 31);
423810e230b6Smaya
423910e230b6Smaya   dw[2] = 0;
424010e230b6Smaya}
424110e230b6Smaya
424210e230b6Smaya#define GEN6_MI_SET_CONTEXT_length             2
424310e230b6Smaya#define GEN6_MI_SET_CONTEXT_length_bias        2
424410e230b6Smaya#define GEN6_MI_SET_CONTEXT_header              \
424510e230b6Smaya   .DWordLength                         =      0,  \
424610e230b6Smaya   .MICommandOpcode                     =     24,  \
424710e230b6Smaya   .CommandType                         =      0
424810e230b6Smaya
424910e230b6Smayastruct GEN6_MI_SET_CONTEXT {
425010e230b6Smaya   uint32_t                             DWordLength;
425110e230b6Smaya   uint32_t                             MICommandOpcode;
425210e230b6Smaya   uint32_t                             CommandType;
425310e230b6Smaya   uint32_t                             RestoreInhibit;
425410e230b6Smaya   uint32_t                             ForceRestore;
425510e230b6Smaya   bool                                 ExtendedStateRestoreEnable;
425610e230b6Smaya   bool                                 ExtendedStateSaveEnable;
425710e230b6Smaya   uint32_t                             ReservedMustbe1;
425810e230b6Smaya   bool                                 HDDVDContext;
425910e230b6Smaya   __gen_address_type                   LogicalContextAddress;
426010e230b6Smaya};
426110e230b6Smaya
426210e230b6Smayastatic inline void
426310e230b6SmayaGEN6_MI_SET_CONTEXT_pack(__attribute__((unused)) __gen_user_data *data,
426410e230b6Smaya                         __attribute__((unused)) void * restrict dst,
426510e230b6Smaya                         __attribute__((unused)) const struct GEN6_MI_SET_CONTEXT * restrict values)
426610e230b6Smaya{
426710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
426810e230b6Smaya
426910e230b6Smaya   dw[0] =
427010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
427110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
427210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
427310e230b6Smaya
427410e230b6Smaya   const uint32_t v1 =
427510e230b6Smaya      __gen_uint(values->RestoreInhibit, 0, 0) |
427610e230b6Smaya      __gen_uint(values->ForceRestore, 1, 1) |
427710e230b6Smaya      __gen_uint(values->ExtendedStateRestoreEnable, 2, 2) |
427810e230b6Smaya      __gen_uint(values->ExtendedStateSaveEnable, 3, 3) |
427910e230b6Smaya      __gen_uint(values->ReservedMustbe1, 8, 8) |
428010e230b6Smaya      __gen_uint(values->HDDVDContext, 9, 9);
428110e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->LogicalContextAddress, v1);
428210e230b6Smaya}
428310e230b6Smaya
428410e230b6Smaya#define GEN6_MI_STORE_DATA_IMM_length          4
428510e230b6Smaya#define GEN6_MI_STORE_DATA_IMM_length_bias      2
428610e230b6Smaya#define GEN6_MI_STORE_DATA_IMM_header           \
428710e230b6Smaya   .DWordLength                         =      2,  \
428810e230b6Smaya   .MICommandOpcode                     =     32,  \
428910e230b6Smaya   .CommandType                         =      0
429010e230b6Smaya
429110e230b6Smayastruct GEN6_MI_STORE_DATA_IMM {
429210e230b6Smaya   uint32_t                             DWordLength;
429310e230b6Smaya   bool                                 UseGlobalGTT;
429410e230b6Smaya   uint32_t                             MICommandOpcode;
429510e230b6Smaya   uint32_t                             CommandType;
429610e230b6Smaya   uint32_t                             CoreModeEnable;
429710e230b6Smaya   __gen_address_type                   Address;
429810e230b6Smaya   uint64_t                             ImmediateData;
429910e230b6Smaya};
430010e230b6Smaya
430110e230b6Smayastatic inline void
430210e230b6SmayaGEN6_MI_STORE_DATA_IMM_pack(__attribute__((unused)) __gen_user_data *data,
430310e230b6Smaya                            __attribute__((unused)) void * restrict dst,
430410e230b6Smaya                            __attribute__((unused)) const struct GEN6_MI_STORE_DATA_IMM * restrict values)
430510e230b6Smaya{
430610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
430710e230b6Smaya
430810e230b6Smaya   dw[0] =
430910e230b6Smaya      __gen_uint(values->DWordLength, 0, 5) |
431010e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
431110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
431210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
431310e230b6Smaya
431410e230b6Smaya   dw[1] = 0;
431510e230b6Smaya
431610e230b6Smaya   const uint32_t v2 =
431710e230b6Smaya      __gen_uint(values->CoreModeEnable, 0, 0);
431810e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->Address, v2);
431910e230b6Smaya
432010e230b6Smaya   const uint64_t v3 =
432110e230b6Smaya      __gen_uint(values->ImmediateData, 0, 63);
432210e230b6Smaya   dw[3] = v3;
432310e230b6Smaya   dw[4] = v3 >> 32;
432410e230b6Smaya}
432510e230b6Smaya
432610e230b6Smaya#define GEN6_MI_STORE_DATA_INDEX_length        3
432710e230b6Smaya#define GEN6_MI_STORE_DATA_INDEX_length_bias      2
432810e230b6Smaya#define GEN6_MI_STORE_DATA_INDEX_header         \
432910e230b6Smaya   .DWordLength                         =      1,  \
433010e230b6Smaya   .MICommandOpcode                     =     33,  \
433110e230b6Smaya   .CommandType                         =      0
433210e230b6Smaya
433310e230b6Smayastruct GEN6_MI_STORE_DATA_INDEX {
433410e230b6Smaya   uint32_t                             DWordLength;
433510e230b6Smaya   uint32_t                             MICommandOpcode;
433610e230b6Smaya   uint32_t                             CommandType;
433710e230b6Smaya   uint32_t                             Offset;
433810e230b6Smaya   uint32_t                             DataDWord0;
433910e230b6Smaya   uint32_t                             DataDWord1;
434010e230b6Smaya};
434110e230b6Smaya
434210e230b6Smayastatic inline void
434310e230b6SmayaGEN6_MI_STORE_DATA_INDEX_pack(__attribute__((unused)) __gen_user_data *data,
434410e230b6Smaya                              __attribute__((unused)) void * restrict dst,
434510e230b6Smaya                              __attribute__((unused)) const struct GEN6_MI_STORE_DATA_INDEX * restrict values)
434610e230b6Smaya{
434710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
434810e230b6Smaya
434910e230b6Smaya   dw[0] =
435010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
435110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
435210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
435310e230b6Smaya
435410e230b6Smaya   dw[1] =
435510e230b6Smaya      __gen_uint(values->Offset, 2, 11);
435610e230b6Smaya
435710e230b6Smaya   dw[2] =
435810e230b6Smaya      __gen_uint(values->DataDWord0, 0, 31);
435910e230b6Smaya}
436010e230b6Smaya
436110e230b6Smaya#define GEN6_MI_STORE_REGISTER_MEM_length      3
436210e230b6Smaya#define GEN6_MI_STORE_REGISTER_MEM_length_bias      2
436310e230b6Smaya#define GEN6_MI_STORE_REGISTER_MEM_header       \
436410e230b6Smaya   .DWordLength                         =      1,  \
436510e230b6Smaya   .MICommandOpcode                     =     36,  \
436610e230b6Smaya   .CommandType                         =      0
436710e230b6Smaya
436810e230b6Smayastruct GEN6_MI_STORE_REGISTER_MEM {
436910e230b6Smaya   uint32_t                             DWordLength;
437010e230b6Smaya   bool                                 UseGlobalGTT;
437110e230b6Smaya   uint32_t                             MICommandOpcode;
437210e230b6Smaya   uint32_t                             CommandType;
437310e230b6Smaya   uint64_t                             RegisterAddress;
437410e230b6Smaya   __gen_address_type                   MemoryAddress;
437510e230b6Smaya};
437610e230b6Smaya
437710e230b6Smayastatic inline void
437810e230b6SmayaGEN6_MI_STORE_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
437910e230b6Smaya                                __attribute__((unused)) void * restrict dst,
438010e230b6Smaya                                __attribute__((unused)) const struct GEN6_MI_STORE_REGISTER_MEM * restrict values)
438110e230b6Smaya{
438210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
438310e230b6Smaya
438410e230b6Smaya   dw[0] =
438510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
438610e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
438710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
438810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
438910e230b6Smaya
439010e230b6Smaya   dw[1] =
439110e230b6Smaya      __gen_offset(values->RegisterAddress, 2, 22);
439210e230b6Smaya
439310e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->MemoryAddress, 0);
439410e230b6Smaya}
439510e230b6Smaya
439610e230b6Smaya#define GEN6_MI_SUSPEND_FLUSH_length           1
439710e230b6Smaya#define GEN6_MI_SUSPEND_FLUSH_length_bias      1
439810e230b6Smaya#define GEN6_MI_SUSPEND_FLUSH_header            \
439910e230b6Smaya   .MICommandOpcode                     =     11,  \
440010e230b6Smaya   .CommandType                         =      0
440110e230b6Smaya
440210e230b6Smayastruct GEN6_MI_SUSPEND_FLUSH {
440310e230b6Smaya   bool                                 SuspendFlush;
440410e230b6Smaya   uint32_t                             MICommandOpcode;
440510e230b6Smaya   uint32_t                             CommandType;
440610e230b6Smaya};
440710e230b6Smaya
440810e230b6Smayastatic inline void
440910e230b6SmayaGEN6_MI_SUSPEND_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
441010e230b6Smaya                           __attribute__((unused)) void * restrict dst,
441110e230b6Smaya                           __attribute__((unused)) const struct GEN6_MI_SUSPEND_FLUSH * restrict values)
441210e230b6Smaya{
441310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
441410e230b6Smaya
441510e230b6Smaya   dw[0] =
441610e230b6Smaya      __gen_uint(values->SuspendFlush, 0, 0) |
441710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
441810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
441910e230b6Smaya}
442010e230b6Smaya
442110e230b6Smaya#define GEN6_MI_URB_CLEAR_length               2
442210e230b6Smaya#define GEN6_MI_URB_CLEAR_length_bias          2
442310e230b6Smaya#define GEN6_MI_URB_CLEAR_header                \
442410e230b6Smaya   .DWordLength                         =      0,  \
442510e230b6Smaya   .MICommandOpcode                     =     25,  \
442610e230b6Smaya   .CommandType                         =      0
442710e230b6Smaya
442810e230b6Smayastruct GEN6_MI_URB_CLEAR {
442910e230b6Smaya   uint32_t                             DWordLength;
443010e230b6Smaya   uint32_t                             MICommandOpcode;
443110e230b6Smaya   uint32_t                             CommandType;
443210e230b6Smaya   uint64_t                             URBAddress;
443310e230b6Smaya   uint32_t                             URBClearLength;
443410e230b6Smaya};
443510e230b6Smaya
443610e230b6Smayastatic inline void
443710e230b6SmayaGEN6_MI_URB_CLEAR_pack(__attribute__((unused)) __gen_user_data *data,
443810e230b6Smaya                       __attribute__((unused)) void * restrict dst,
443910e230b6Smaya                       __attribute__((unused)) const struct GEN6_MI_URB_CLEAR * restrict values)
444010e230b6Smaya{
444110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
444210e230b6Smaya
444310e230b6Smaya   dw[0] =
444410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
444510e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
444610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
444710e230b6Smaya
444810e230b6Smaya   dw[1] =
444910e230b6Smaya      __gen_offset(values->URBAddress, 0, 13) |
445010e230b6Smaya      __gen_uint(values->URBClearLength, 16, 28);
445110e230b6Smaya}
445210e230b6Smaya
445310e230b6Smaya#define GEN6_MI_USER_INTERRUPT_length          1
445410e230b6Smaya#define GEN6_MI_USER_INTERRUPT_length_bias      1
445510e230b6Smaya#define GEN6_MI_USER_INTERRUPT_header           \
445610e230b6Smaya   .MICommandOpcode                     =      2,  \
445710e230b6Smaya   .CommandType                         =      0
445810e230b6Smaya
445910e230b6Smayastruct GEN6_MI_USER_INTERRUPT {
446010e230b6Smaya   uint32_t                             MICommandOpcode;
446110e230b6Smaya   uint32_t                             CommandType;
446210e230b6Smaya};
446310e230b6Smaya
446410e230b6Smayastatic inline void
446510e230b6SmayaGEN6_MI_USER_INTERRUPT_pack(__attribute__((unused)) __gen_user_data *data,
446610e230b6Smaya                            __attribute__((unused)) void * restrict dst,
446710e230b6Smaya                            __attribute__((unused)) const struct GEN6_MI_USER_INTERRUPT * restrict values)
446810e230b6Smaya{
446910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
447010e230b6Smaya
447110e230b6Smaya   dw[0] =
447210e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
447310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
447410e230b6Smaya}
447510e230b6Smaya
447610e230b6Smaya#define GEN6_MI_WAIT_FOR_EVENT_length          1
447710e230b6Smaya#define GEN6_MI_WAIT_FOR_EVENT_length_bias      1
447810e230b6Smaya#define GEN6_MI_WAIT_FOR_EVENT_header           \
447910e230b6Smaya   .MICommandOpcode                     =      3,  \
448010e230b6Smaya   .CommandType                         =      0
448110e230b6Smaya
448210e230b6Smayastruct GEN6_MI_WAIT_FOR_EVENT {
448310e230b6Smaya   bool                                 DisplayPipeAScanLineWaitEnable;
448410e230b6Smaya   bool                                 DisplayPlaneAFlipPendingWaitEnable;
448510e230b6Smaya   bool                                 DisplaySpriteAFlipPendingWaitEnable;
448610e230b6Smaya   bool                                 DisplayPipeAVerticalBlankWaitEnable;
448710e230b6Smaya   bool                                 DisplayPipeAHorizontalBlankWaitEnable;
448810e230b6Smaya   bool                                 DisplayPipeBScanLineWaitEnable;
448910e230b6Smaya   bool                                 DisplayPlaneBFlipPendingWaitEnable;
449010e230b6Smaya   bool                                 DisplaySpriteBFlipPendingWaitEnable;
449110e230b6Smaya   bool                                 DisplayPipeBVerticalBlankWaitEnable;
449210e230b6Smaya   bool                                 DisplayPipeBHorizontalBlankWaitEnable;
449310e230b6Smaya   uint32_t                             ConditionCodeWaitSelect;
449410e230b6Smaya#define Notenabled                               0
449510e230b6Smaya   uint32_t                             MICommandOpcode;
449610e230b6Smaya   uint32_t                             CommandType;
449710e230b6Smaya};
449810e230b6Smaya
449910e230b6Smayastatic inline void
450010e230b6SmayaGEN6_MI_WAIT_FOR_EVENT_pack(__attribute__((unused)) __gen_user_data *data,
450110e230b6Smaya                            __attribute__((unused)) void * restrict dst,
450210e230b6Smaya                            __attribute__((unused)) const struct GEN6_MI_WAIT_FOR_EVENT * restrict values)
450310e230b6Smaya{
450410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
450510e230b6Smaya
450610e230b6Smaya   dw[0] =
450710e230b6Smaya      __gen_uint(values->DisplayPipeAScanLineWaitEnable, 0, 0) |
450810e230b6Smaya      __gen_uint(values->DisplayPlaneAFlipPendingWaitEnable, 1, 1) |
450910e230b6Smaya      __gen_uint(values->DisplaySpriteAFlipPendingWaitEnable, 2, 2) |
451010e230b6Smaya      __gen_uint(values->DisplayPipeAVerticalBlankWaitEnable, 3, 3) |
451110e230b6Smaya      __gen_uint(values->DisplayPipeAHorizontalBlankWaitEnable, 5, 5) |
451210e230b6Smaya      __gen_uint(values->DisplayPipeBScanLineWaitEnable, 8, 8) |
451310e230b6Smaya      __gen_uint(values->DisplayPlaneBFlipPendingWaitEnable, 9, 9) |
451410e230b6Smaya      __gen_uint(values->DisplaySpriteBFlipPendingWaitEnable, 10, 10) |
451510e230b6Smaya      __gen_uint(values->DisplayPipeBVerticalBlankWaitEnable, 11, 11) |
451610e230b6Smaya      __gen_uint(values->DisplayPipeBHorizontalBlankWaitEnable, 13, 13) |
451710e230b6Smaya      __gen_uint(values->ConditionCodeWaitSelect, 16, 19) |
451810e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
451910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
452010e230b6Smaya}
452110e230b6Smaya
452210e230b6Smaya#define GEN6_PIPELINE_SELECT_length            1
452310e230b6Smaya#define GEN6_PIPELINE_SELECT_length_bias       1
452410e230b6Smaya#define GEN6_PIPELINE_SELECT_header             \
452510e230b6Smaya   ._3DCommandSubOpcode                 =      4,  \
452610e230b6Smaya   ._3DCommandOpcode                    =      1,  \
452710e230b6Smaya   .CommandSubType                      =      1,  \
452810e230b6Smaya   .CommandType                         =      3
452910e230b6Smaya
453010e230b6Smayastruct GEN6_PIPELINE_SELECT {
453110e230b6Smaya   uint32_t                             PipelineSelection;
453210e230b6Smaya#define _3D                                      0
453310e230b6Smaya#define Media                                    1
453410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
453510e230b6Smaya   uint32_t                             _3DCommandOpcode;
453610e230b6Smaya   uint32_t                             CommandSubType;
453710e230b6Smaya   uint32_t                             CommandType;
453810e230b6Smaya};
453910e230b6Smaya
454010e230b6Smayastatic inline void
454110e230b6SmayaGEN6_PIPELINE_SELECT_pack(__attribute__((unused)) __gen_user_data *data,
454210e230b6Smaya                          __attribute__((unused)) void * restrict dst,
454310e230b6Smaya                          __attribute__((unused)) const struct GEN6_PIPELINE_SELECT * restrict values)
454410e230b6Smaya{
454510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
454610e230b6Smaya
454710e230b6Smaya   dw[0] =
454810e230b6Smaya      __gen_uint(values->PipelineSelection, 0, 1) |
454910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
455010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
455110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
455210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
455310e230b6Smaya}
455410e230b6Smaya
455510e230b6Smaya#define GEN6_PIPE_CONTROL_length               5
455610e230b6Smaya#define GEN6_PIPE_CONTROL_length_bias          2
455710e230b6Smaya#define GEN6_PIPE_CONTROL_header                \
455810e230b6Smaya   .DWordLength                         =      3,  \
455910e230b6Smaya   ._3DCommandSubOpcode                 =      0,  \
456010e230b6Smaya   ._3DCommandOpcode                    =      2,  \
456110e230b6Smaya   .CommandSubType                      =      3,  \
456210e230b6Smaya   .CommandType                         =      3
456310e230b6Smaya
456410e230b6Smayastruct GEN6_PIPE_CONTROL {
456510e230b6Smaya   uint32_t                             DWordLength;
456610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
456710e230b6Smaya   uint32_t                             _3DCommandOpcode;
456810e230b6Smaya   uint32_t                             CommandSubType;
456910e230b6Smaya   uint32_t                             CommandType;
457010e230b6Smaya   bool                                 DepthCacheFlushEnable;
457110e230b6Smaya   bool                                 StallAtPixelScoreboard;
457210e230b6Smaya   bool                                 StateCacheInvalidationEnable;
457310e230b6Smaya   bool                                 ConstantCacheInvalidationEnable;
457410e230b6Smaya   bool                                 VFCacheInvalidationEnable;
457510e230b6Smaya   bool                                 NotifyEnable;
457610e230b6Smaya   bool                                 IndirectStatePointersDisable;
457710e230b6Smaya   bool                                 TextureCacheInvalidationEnable;
457810e230b6Smaya   bool                                 InstructionCacheInvalidateEnable;
457910e230b6Smaya   bool                                 RenderTargetCacheFlushEnable;
458010e230b6Smaya   bool                                 DepthStallEnable;
458110e230b6Smaya   uint32_t                             PostSyncOperation;
458210e230b6Smaya#define NoWrite                                  0
458310e230b6Smaya#define WriteImmediateData                       1
458410e230b6Smaya#define WritePSDepthCount                        2
458510e230b6Smaya#define WriteTimestamp                           3
458610e230b6Smaya   bool                                 GenericMediaStateClear;
458710e230b6Smaya   bool                                 SynchronizeGFDTSurface;
458810e230b6Smaya   bool                                 TLBInvalidate;
458910e230b6Smaya   bool                                 GlobalSnapshotCountReset;
459010e230b6Smaya   bool                                 CommandStreamerStallEnable;
459110e230b6Smaya   uint32_t                             StoreDataIndex;
459210e230b6Smaya   uint32_t                             DestinationAddressType;
459310e230b6Smaya#define DAT_GGTT                                 1
459410e230b6Smaya   __gen_address_type                   Address;
459510e230b6Smaya   uint64_t                             ImmediateData;
459610e230b6Smaya};
459710e230b6Smaya
459810e230b6Smayastatic inline void
459910e230b6SmayaGEN6_PIPE_CONTROL_pack(__attribute__((unused)) __gen_user_data *data,
460010e230b6Smaya                       __attribute__((unused)) void * restrict dst,
460110e230b6Smaya                       __attribute__((unused)) const struct GEN6_PIPE_CONTROL * restrict values)
460210e230b6Smaya{
460310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
460410e230b6Smaya
460510e230b6Smaya   dw[0] =
460610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
460710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
460810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
460910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
461010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
461110e230b6Smaya
461210e230b6Smaya   dw[1] =
461310e230b6Smaya      __gen_uint(values->DepthCacheFlushEnable, 0, 0) |
461410e230b6Smaya      __gen_uint(values->StallAtPixelScoreboard, 1, 1) |
461510e230b6Smaya      __gen_uint(values->StateCacheInvalidationEnable, 2, 2) |
461610e230b6Smaya      __gen_uint(values->ConstantCacheInvalidationEnable, 3, 3) |
461710e230b6Smaya      __gen_uint(values->VFCacheInvalidationEnable, 4, 4) |
461810e230b6Smaya      __gen_uint(values->NotifyEnable, 8, 8) |
461910e230b6Smaya      __gen_uint(values->IndirectStatePointersDisable, 9, 9) |
462010e230b6Smaya      __gen_uint(values->TextureCacheInvalidationEnable, 10, 10) |
462110e230b6Smaya      __gen_uint(values->InstructionCacheInvalidateEnable, 11, 11) |
462210e230b6Smaya      __gen_uint(values->RenderTargetCacheFlushEnable, 12, 12) |
462310e230b6Smaya      __gen_uint(values->DepthStallEnable, 13, 13) |
462410e230b6Smaya      __gen_uint(values->PostSyncOperation, 14, 15) |
462510e230b6Smaya      __gen_uint(values->GenericMediaStateClear, 16, 16) |
462610e230b6Smaya      __gen_uint(values->SynchronizeGFDTSurface, 17, 17) |
462710e230b6Smaya      __gen_uint(values->TLBInvalidate, 18, 18) |
462810e230b6Smaya      __gen_uint(values->GlobalSnapshotCountReset, 19, 19) |
462910e230b6Smaya      __gen_uint(values->CommandStreamerStallEnable, 20, 20) |
463010e230b6Smaya      __gen_uint(values->StoreDataIndex, 21, 21);
463110e230b6Smaya
463210e230b6Smaya   const uint32_t v2 =
463310e230b6Smaya      __gen_uint(values->DestinationAddressType, 2, 2);
463410e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->Address, v2);
463510e230b6Smaya
463610e230b6Smaya   const uint64_t v3 =
463710e230b6Smaya      __gen_uint(values->ImmediateData, 0, 63);
463810e230b6Smaya   dw[3] = v3;
463910e230b6Smaya   dw[4] = v3 >> 32;
464010e230b6Smaya}
464110e230b6Smaya
464210e230b6Smaya#define GEN6_STATE_BASE_ADDRESS_length        10
464310e230b6Smaya#define GEN6_STATE_BASE_ADDRESS_length_bias      2
464410e230b6Smaya#define GEN6_STATE_BASE_ADDRESS_header          \
464510e230b6Smaya   .DWordLength                         =      8,  \
464610e230b6Smaya   ._3DCommandSubOpcode                 =      1,  \
464710e230b6Smaya   ._3DCommandOpcode                    =      1,  \
464810e230b6Smaya   .CommandSubType                      =      0,  \
464910e230b6Smaya   .CommandType                         =      3
465010e230b6Smaya
465110e230b6Smayastruct GEN6_STATE_BASE_ADDRESS {
465210e230b6Smaya   uint32_t                             DWordLength;
465310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
465410e230b6Smaya   uint32_t                             _3DCommandOpcode;
465510e230b6Smaya   uint32_t                             CommandSubType;
465610e230b6Smaya   uint32_t                             CommandType;
465710e230b6Smaya   bool                                 GeneralStateBaseAddressModifyEnable;
465810e230b6Smaya   uint32_t                             StatelessDataPortAccessForceWriteThru;
465910e230b6Smaya   uint32_t                             StatelessDataPortAccessMOCS;
466010e230b6Smaya   uint32_t                             GeneralStateMOCS;
466110e230b6Smaya   __gen_address_type                   GeneralStateBaseAddress;
466210e230b6Smaya   bool                                 SurfaceStateBaseAddressModifyEnable;
466310e230b6Smaya   uint32_t                             SurfaceStateMOCS;
466410e230b6Smaya   __gen_address_type                   SurfaceStateBaseAddress;
466510e230b6Smaya   bool                                 DynamicStateBaseAddressModifyEnable;
466610e230b6Smaya   uint32_t                             DynamicStateMOCS;
466710e230b6Smaya   __gen_address_type                   DynamicStateBaseAddress;
466810e230b6Smaya   bool                                 IndirectObjectBaseAddressModifyEnable;
466910e230b6Smaya   uint32_t                             IndirectObjectMOCS;
467010e230b6Smaya   __gen_address_type                   IndirectObjectBaseAddress;
467110e230b6Smaya   bool                                 InstructionBaseAddressModifyEnable;
467210e230b6Smaya   uint32_t                             InstructionMOCS;
467310e230b6Smaya   __gen_address_type                   InstructionBaseAddress;
467410e230b6Smaya   bool                                 GeneralStateAccessUpperBoundModifyEnable;
467510e230b6Smaya   __gen_address_type                   GeneralStateAccessUpperBound;
467610e230b6Smaya   bool                                 DynamicStateAccessUpperBoundModifyEnable;
467710e230b6Smaya   __gen_address_type                   DynamicStateAccessUpperBound;
467810e230b6Smaya   bool                                 IndirectObjectAccessUpperBoundModifyEnable;
467910e230b6Smaya   __gen_address_type                   IndirectObjectAccessUpperBound;
468010e230b6Smaya   bool                                 InstructionAccessUpperBoundModifyEnable;
468110e230b6Smaya   __gen_address_type                   InstructionAccessUpperBound;
468210e230b6Smaya};
468310e230b6Smaya
468410e230b6Smayastatic inline void
468510e230b6SmayaGEN6_STATE_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
468610e230b6Smaya                             __attribute__((unused)) void * restrict dst,
468710e230b6Smaya                             __attribute__((unused)) const struct GEN6_STATE_BASE_ADDRESS * restrict values)
468810e230b6Smaya{
468910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
469010e230b6Smaya
469110e230b6Smaya   dw[0] =
469210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
469310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
469410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
469510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
469610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
469710e230b6Smaya
469810e230b6Smaya   const uint32_t v1 =
469910e230b6Smaya      __gen_uint(values->GeneralStateBaseAddressModifyEnable, 0, 0) |
470010e230b6Smaya      __gen_uint(values->StatelessDataPortAccessForceWriteThru, 3, 3) |
470110e230b6Smaya      __gen_uint(values->StatelessDataPortAccessMOCS, 4, 7) |
470210e230b6Smaya      __gen_uint(values->GeneralStateMOCS, 8, 11);
470310e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->GeneralStateBaseAddress, v1);
470410e230b6Smaya
470510e230b6Smaya   const uint32_t v2 =
470610e230b6Smaya      __gen_uint(values->SurfaceStateBaseAddressModifyEnable, 0, 0) |
470710e230b6Smaya      __gen_uint(values->SurfaceStateMOCS, 8, 11);
470810e230b6Smaya   dw[2] = __gen_combine_address(data, &dw[2], values->SurfaceStateBaseAddress, v2);
470910e230b6Smaya
471010e230b6Smaya   const uint32_t v3 =
471110e230b6Smaya      __gen_uint(values->DynamicStateBaseAddressModifyEnable, 0, 0) |
471210e230b6Smaya      __gen_uint(values->DynamicStateMOCS, 8, 11);
471310e230b6Smaya   dw[3] = __gen_combine_address(data, &dw[3], values->DynamicStateBaseAddress, v3);
471410e230b6Smaya
471510e230b6Smaya   const uint32_t v4 =
471610e230b6Smaya      __gen_uint(values->IndirectObjectBaseAddressModifyEnable, 0, 0) |
471710e230b6Smaya      __gen_uint(values->IndirectObjectMOCS, 8, 11);
471810e230b6Smaya   dw[4] = __gen_combine_address(data, &dw[4], values->IndirectObjectBaseAddress, v4);
471910e230b6Smaya
472010e230b6Smaya   const uint32_t v5 =
472110e230b6Smaya      __gen_uint(values->InstructionBaseAddressModifyEnable, 0, 0) |
472210e230b6Smaya      __gen_uint(values->InstructionMOCS, 8, 11);
472310e230b6Smaya   dw[5] = __gen_combine_address(data, &dw[5], values->InstructionBaseAddress, v5);
472410e230b6Smaya
472510e230b6Smaya   const uint32_t v6 =
472610e230b6Smaya      __gen_uint(values->GeneralStateAccessUpperBoundModifyEnable, 0, 0);
472710e230b6Smaya   dw[6] = __gen_combine_address(data, &dw[6], values->GeneralStateAccessUpperBound, v6);
472810e230b6Smaya
472910e230b6Smaya   const uint32_t v7 =
473010e230b6Smaya      __gen_uint(values->DynamicStateAccessUpperBoundModifyEnable, 0, 0);
473110e230b6Smaya   dw[7] = __gen_combine_address(data, &dw[7], values->DynamicStateAccessUpperBound, v7);
473210e230b6Smaya
473310e230b6Smaya   const uint32_t v8 =
473410e230b6Smaya      __gen_uint(values->IndirectObjectAccessUpperBoundModifyEnable, 0, 0);
473510e230b6Smaya   dw[8] = __gen_combine_address(data, &dw[8], values->IndirectObjectAccessUpperBound, v8);
473610e230b6Smaya
473710e230b6Smaya   const uint32_t v9 =
473810e230b6Smaya      __gen_uint(values->InstructionAccessUpperBoundModifyEnable, 0, 0);
473910e230b6Smaya   dw[9] = __gen_combine_address(data, &dw[9], values->InstructionAccessUpperBound, v9);
474010e230b6Smaya}
474110e230b6Smaya
474210e230b6Smaya#define GEN6_STATE_PREFETCH_length             2
474310e230b6Smaya#define GEN6_STATE_PREFETCH_length_bias        2
474410e230b6Smaya#define GEN6_STATE_PREFETCH_header              \
474510e230b6Smaya   .DWordLength                         =      0,  \
474610e230b6Smaya   ._3DCommandSubOpcode                 =      3,  \
474710e230b6Smaya   ._3DCommandOpcode                    =      0,  \
474810e230b6Smaya   .CommandSubType                      =      0,  \
474910e230b6Smaya   .CommandType                         =      3
475010e230b6Smaya
475110e230b6Smayastruct GEN6_STATE_PREFETCH {
475210e230b6Smaya   uint32_t                             DWordLength;
475310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
475410e230b6Smaya   uint32_t                             _3DCommandOpcode;
475510e230b6Smaya   uint32_t                             CommandSubType;
475610e230b6Smaya   uint32_t                             CommandType;
475710e230b6Smaya   uint32_t                             PrefetchCount;
475810e230b6Smaya   __gen_address_type                   PrefetchPointer;
475910e230b6Smaya};
476010e230b6Smaya
476110e230b6Smayastatic inline void
476210e230b6SmayaGEN6_STATE_PREFETCH_pack(__attribute__((unused)) __gen_user_data *data,
476310e230b6Smaya                         __attribute__((unused)) void * restrict dst,
476410e230b6Smaya                         __attribute__((unused)) const struct GEN6_STATE_PREFETCH * restrict values)
476510e230b6Smaya{
476610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
476710e230b6Smaya
476810e230b6Smaya   dw[0] =
476910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
477010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
477110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
477210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
477310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
477410e230b6Smaya
477510e230b6Smaya   const uint32_t v1 =
477610e230b6Smaya      __gen_uint(values->PrefetchCount, 0, 2);
477710e230b6Smaya   dw[1] = __gen_combine_address(data, &dw[1], values->PrefetchPointer, v1);
477810e230b6Smaya}
477910e230b6Smaya
478010e230b6Smaya#define GEN6_STATE_SIP_length                  2
478110e230b6Smaya#define GEN6_STATE_SIP_length_bias             2
478210e230b6Smaya#define GEN6_STATE_SIP_header                   \
478310e230b6Smaya   .DWordLength                         =      0,  \
478410e230b6Smaya   ._3DCommandSubOpcode                 =      2,  \
478510e230b6Smaya   ._3DCommandOpcode                    =      1,  \
478610e230b6Smaya   .CommandSubType                      =      0,  \
478710e230b6Smaya   .CommandType                         =      3
478810e230b6Smaya
478910e230b6Smayastruct GEN6_STATE_SIP {
479010e230b6Smaya   uint32_t                             DWordLength;
479110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
479210e230b6Smaya   uint32_t                             _3DCommandOpcode;
479310e230b6Smaya   uint32_t                             CommandSubType;
479410e230b6Smaya   uint32_t                             CommandType;
479510e230b6Smaya   uint64_t                             SystemInstructionPointer;
479610e230b6Smaya};
479710e230b6Smaya
479810e230b6Smayastatic inline void
479910e230b6SmayaGEN6_STATE_SIP_pack(__attribute__((unused)) __gen_user_data *data,
480010e230b6Smaya                    __attribute__((unused)) void * restrict dst,
480110e230b6Smaya                    __attribute__((unused)) const struct GEN6_STATE_SIP * restrict values)
480210e230b6Smaya{
480310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
480410e230b6Smaya
480510e230b6Smaya   dw[0] =
480610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
480710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
480810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
480910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
481010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
481110e230b6Smaya
481210e230b6Smaya   dw[1] =
481310e230b6Smaya      __gen_offset(values->SystemInstructionPointer, 4, 31);
481410e230b6Smaya}
481510e230b6Smaya
481610e230b6Smaya#define GEN6_BCS_FAULT_REG_num            0x4294
481710e230b6Smaya#define GEN6_BCS_FAULT_REG_length              1
481810e230b6Smayastruct GEN6_BCS_FAULT_REG {
481910e230b6Smaya   bool                                 ValidBit;
482010e230b6Smaya   uint32_t                             FaultType;
482110e230b6Smaya#define PageFault                                0
482210e230b6Smaya#define InvalidPDFault                           1
482310e230b6Smaya#define UnloadedPDFault                          2
482410e230b6Smaya#define InvalidandUnloadedPDfault                3
482510e230b6Smaya   uint32_t                             SRCIDofFault;
482610e230b6Smaya   uint32_t                             GTTSEL;
482710e230b6Smaya#define PPGTT                                    0
482810e230b6Smaya#define GGTT                                     1
482910e230b6Smaya   __gen_address_type                   VirtualAddressofFault;
483010e230b6Smaya};
483110e230b6Smaya
483210e230b6Smayastatic inline void
483310e230b6SmayaGEN6_BCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
483410e230b6Smaya                        __attribute__((unused)) void * restrict dst,
483510e230b6Smaya                        __attribute__((unused)) const struct GEN6_BCS_FAULT_REG * restrict values)
483610e230b6Smaya{
483710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
483810e230b6Smaya
483910e230b6Smaya   const uint32_t v0 =
484010e230b6Smaya      __gen_uint(values->ValidBit, 0, 0) |
484110e230b6Smaya      __gen_uint(values->FaultType, 1, 2) |
484210e230b6Smaya      __gen_uint(values->SRCIDofFault, 3, 10) |
484310e230b6Smaya      __gen_uint(values->GTTSEL, 11, 11);
484410e230b6Smaya   dw[0] = __gen_combine_address(data, &dw[0], values->VirtualAddressofFault, v0);
484510e230b6Smaya}
484610e230b6Smaya
484710e230b6Smaya#define GEN6_BCS_INSTDONE_num             0x2206c
484810e230b6Smaya#define GEN6_BCS_INSTDONE_length               1
484910e230b6Smayastruct GEN6_BCS_INSTDONE {
485010e230b6Smaya   bool                                 RingEnable;
485110e230b6Smaya   bool                                 BlitterIDLE;
485210e230b6Smaya   bool                                 GABIDLE;
485310e230b6Smaya   bool                                 BCSDone;
485410e230b6Smaya};
485510e230b6Smaya
485610e230b6Smayastatic inline void
485710e230b6SmayaGEN6_BCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
485810e230b6Smaya                       __attribute__((unused)) void * restrict dst,
485910e230b6Smaya                       __attribute__((unused)) const struct GEN6_BCS_INSTDONE * restrict values)
486010e230b6Smaya{
486110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
486210e230b6Smaya
486310e230b6Smaya   dw[0] =
486410e230b6Smaya      __gen_uint(values->RingEnable, 0, 0) |
486510e230b6Smaya      __gen_uint(values->BlitterIDLE, 1, 1) |
486610e230b6Smaya      __gen_uint(values->GABIDLE, 2, 2) |
486710e230b6Smaya      __gen_uint(values->BCSDone, 3, 3);
486810e230b6Smaya}
486910e230b6Smaya
487010e230b6Smaya#define GEN6_BCS_RING_BUFFER_CTL_num      0x2203c
487110e230b6Smaya#define GEN6_BCS_RING_BUFFER_CTL_length        1
487210e230b6Smayastruct GEN6_BCS_RING_BUFFER_CTL {
487310e230b6Smaya   bool                                 RingBufferEnable;
487410e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
487510e230b6Smaya#define MI_AUTOREPORT_OFF                        0
487610e230b6Smaya#define MI_AUTOREPORT_64KB                       1
487710e230b6Smaya#define MI_AUTOREPORT_4KB                        2
487810e230b6Smaya#define MI_AUTOREPORT_128KB                      3
487910e230b6Smaya   bool                                 DisableRegisterAccesses;
488010e230b6Smaya   bool                                 SemaphoreWait;
488110e230b6Smaya   bool                                 RBWait;
488210e230b6Smaya   uint32_t                             BufferLengthinpages1;
488310e230b6Smaya};
488410e230b6Smaya
488510e230b6Smayastatic inline void
488610e230b6SmayaGEN6_BCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
488710e230b6Smaya                              __attribute__((unused)) void * restrict dst,
488810e230b6Smaya                              __attribute__((unused)) const struct GEN6_BCS_RING_BUFFER_CTL * restrict values)
488910e230b6Smaya{
489010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
489110e230b6Smaya
489210e230b6Smaya   dw[0] =
489310e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
489410e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
489510e230b6Smaya      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
489610e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
489710e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
489810e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
489910e230b6Smaya}
490010e230b6Smaya
490110e230b6Smaya#define GEN6_GFX_ARB_ERROR_RPT_num        0x40a0
490210e230b6Smaya#define GEN6_GFX_ARB_ERROR_RPT_length          1
490310e230b6Smayastruct GEN6_GFX_ARB_ERROR_RPT {
490410e230b6Smaya   bool                                 TLBPageFaultError;
490510e230b6Smaya   bool                                 ContextPageFaultError;
490610e230b6Smaya   bool                                 InvalidPageDirectoryentryerror;
490710e230b6Smaya   bool                                 HardwareStatusPageFaultError;
490810e230b6Smaya   bool                                 TLBPageVTDTranslationError;
490910e230b6Smaya   bool                                 ContextPageVTDTranslationError;
491010e230b6Smaya   bool                                 PageDirectoryEntryVTDTranslationError;
491110e230b6Smaya   bool                                 HardwareStatusPageVTDTranslationError;
491210e230b6Smaya   bool                                 UnloadedPDError;
491310e230b6Smaya};
491410e230b6Smaya
491510e230b6Smayastatic inline void
491610e230b6SmayaGEN6_GFX_ARB_ERROR_RPT_pack(__attribute__((unused)) __gen_user_data *data,
491710e230b6Smaya                            __attribute__((unused)) void * restrict dst,
491810e230b6Smaya                            __attribute__((unused)) const struct GEN6_GFX_ARB_ERROR_RPT * restrict values)
491910e230b6Smaya{
492010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
492110e230b6Smaya
492210e230b6Smaya   dw[0] =
492310e230b6Smaya      __gen_uint(values->TLBPageFaultError, 0, 0) |
492410e230b6Smaya      __gen_uint(values->ContextPageFaultError, 1, 1) |
492510e230b6Smaya      __gen_uint(values->InvalidPageDirectoryentryerror, 2, 2) |
492610e230b6Smaya      __gen_uint(values->HardwareStatusPageFaultError, 3, 3) |
492710e230b6Smaya      __gen_uint(values->TLBPageVTDTranslationError, 4, 4) |
492810e230b6Smaya      __gen_uint(values->ContextPageVTDTranslationError, 5, 5) |
492910e230b6Smaya      __gen_uint(values->PageDirectoryEntryVTDTranslationError, 6, 6) |
493010e230b6Smaya      __gen_uint(values->HardwareStatusPageVTDTranslationError, 7, 7) |
493110e230b6Smaya      __gen_uint(values->UnloadedPDError, 8, 8);
493210e230b6Smaya}
493310e230b6Smaya
493410e230b6Smaya#define GEN6_INSTDONE_1_num               0x206c
493510e230b6Smaya#define GEN6_INSTDONE_1_length                 1
493610e230b6Smayastruct GEN6_INSTDONE_1 {
493710e230b6Smaya   bool                                 PRB0RingEnable;
493810e230b6Smaya   bool                                 AVSDone;
493910e230b6Smaya   bool                                 HIZDone;
494010e230b6Smaya   bool                                 GWDone;
494110e230b6Smaya   bool                                 TSDone;
494210e230b6Smaya   bool                                 TDDone;
494310e230b6Smaya   bool                                 VFEDone;
494410e230b6Smaya   bool                                 IEFDone;
494510e230b6Smaya   bool                                 VSCDone;
494610e230b6Smaya   bool                                 ISC23Done;
494710e230b6Smaya   bool                                 ISC10Done;
494810e230b6Smaya   bool                                 IC0Done;
494910e230b6Smaya   bool                                 IC1Done;
495010e230b6Smaya   bool                                 IC2Done;
495110e230b6Smaya   bool                                 IC3Done;
495210e230b6Smaya   bool                                 EU00Done;
495310e230b6Smaya   bool                                 EU01Done;
495410e230b6Smaya   bool                                 EU02Done;
495510e230b6Smaya   bool                                 MA0Done;
495610e230b6Smaya   bool                                 EU10Done;
495710e230b6Smaya   bool                                 EU11Done;
495810e230b6Smaya   bool                                 EU12Done;
495910e230b6Smaya   bool                                 MA1Done;
496010e230b6Smaya   bool                                 EU20Done;
496110e230b6Smaya   bool                                 EU21Done;
496210e230b6Smaya   bool                                 EU22Done;
496310e230b6Smaya   bool                                 MA2Done;
496410e230b6Smaya   bool                                 EU30Done;
496510e230b6Smaya   bool                                 EU31Done;
496610e230b6Smaya   bool                                 EU32Done;
496710e230b6Smaya   bool                                 MA3Done;
496810e230b6Smaya};
496910e230b6Smaya
497010e230b6Smayastatic inline void
497110e230b6SmayaGEN6_INSTDONE_1_pack(__attribute__((unused)) __gen_user_data *data,
497210e230b6Smaya                     __attribute__((unused)) void * restrict dst,
497310e230b6Smaya                     __attribute__((unused)) const struct GEN6_INSTDONE_1 * restrict values)
497410e230b6Smaya{
497510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
497610e230b6Smaya
497710e230b6Smaya   dw[0] =
497810e230b6Smaya      __gen_uint(values->PRB0RingEnable, 0, 0) |
497910e230b6Smaya      __gen_uint(values->AVSDone, 1, 1) |
498010e230b6Smaya      __gen_uint(values->HIZDone, 2, 2) |
498110e230b6Smaya      __gen_uint(values->GWDone, 3, 3) |
498210e230b6Smaya      __gen_uint(values->TSDone, 4, 4) |
498310e230b6Smaya      __gen_uint(values->TDDone, 6, 6) |
498410e230b6Smaya      __gen_uint(values->VFEDone, 7, 7) |
498510e230b6Smaya      __gen_uint(values->IEFDone, 8, 8) |
498610e230b6Smaya      __gen_uint(values->VSCDone, 9, 9) |
498710e230b6Smaya      __gen_uint(values->ISC23Done, 10, 10) |
498810e230b6Smaya      __gen_uint(values->ISC10Done, 11, 11) |
498910e230b6Smaya      __gen_uint(values->IC0Done, 12, 12) |
499010e230b6Smaya      __gen_uint(values->IC1Done, 13, 13) |
499110e230b6Smaya      __gen_uint(values->IC2Done, 14, 14) |
499210e230b6Smaya      __gen_uint(values->IC3Done, 15, 15) |
499310e230b6Smaya      __gen_uint(values->EU00Done, 16, 16) |
499410e230b6Smaya      __gen_uint(values->EU01Done, 17, 17) |
499510e230b6Smaya      __gen_uint(values->EU02Done, 18, 18) |
499610e230b6Smaya      __gen_uint(values->MA0Done, 19, 19) |
499710e230b6Smaya      __gen_uint(values->EU10Done, 20, 20) |
499810e230b6Smaya      __gen_uint(values->EU11Done, 21, 21) |
499910e230b6Smaya      __gen_uint(values->EU12Done, 22, 22) |
500010e230b6Smaya      __gen_uint(values->MA1Done, 23, 23) |
500110e230b6Smaya      __gen_uint(values->EU20Done, 24, 24) |
500210e230b6Smaya      __gen_uint(values->EU21Done, 25, 25) |
500310e230b6Smaya      __gen_uint(values->EU22Done, 26, 26) |
500410e230b6Smaya      __gen_uint(values->MA2Done, 27, 27) |
500510e230b6Smaya      __gen_uint(values->EU30Done, 28, 28) |
500610e230b6Smaya      __gen_uint(values->EU31Done, 29, 29) |
500710e230b6Smaya      __gen_uint(values->EU32Done, 30, 30) |
500810e230b6Smaya      __gen_uint(values->MA3Done, 31, 31);
500910e230b6Smaya}
501010e230b6Smaya
501110e230b6Smaya#define GEN6_INSTDONE_2_num               0x207c
501210e230b6Smaya#define GEN6_INSTDONE_2_length                 1
501310e230b6Smayastruct GEN6_INSTDONE_2 {
501410e230b6Smaya   bool                                 VFDone;
501510e230b6Smaya   bool                                 VS0Done;
501610e230b6Smaya   bool                                 GSDone;
501710e230b6Smaya   bool                                 CLDone;
501810e230b6Smaya   bool                                 SFDone;
501910e230b6Smaya   bool                                 VMEDone;
502010e230b6Smaya   bool                                 PLDone;
502110e230b6Smaya   bool                                 SODone;
502210e230b6Smaya   bool                                 SIDone;
502310e230b6Smaya   bool                                 DGDone;
502410e230b6Smaya   bool                                 FTDone;
502510e230b6Smaya   bool                                 DMDone;
502610e230b6Smaya   bool                                 SCDone;
502710e230b6Smaya   bool                                 FLDone;
502810e230b6Smaya   bool                                 QCDone;
502910e230b6Smaya   bool                                 SVSMDone;
503010e230b6Smaya   bool                                 WMFEDone;
503110e230b6Smaya   bool                                 IZDone;
503210e230b6Smaya   bool                                 PSDDone;
503310e230b6Smaya   bool                                 DAPDone;
503410e230b6Smaya   bool                                 RCZDone;
503510e230b6Smaya   bool                                 VDIDone;
503610e230b6Smaya   bool                                 RCPBEDone;
503710e230b6Smaya   bool                                 RCPFEDone;
503810e230b6Smaya   bool                                 MTDone;
503910e230b6Smaya   bool                                 ISCDone;
504010e230b6Smaya   bool                                 SVGDone;
504110e230b6Smaya   bool                                 RCCDone;
504210e230b6Smaya   bool                                 SVRWDone;
504310e230b6Smaya   bool                                 WMBEDone;
504410e230b6Smaya   bool                                 CSDone;
504510e230b6Smaya   bool                                 GAMDone;
504610e230b6Smaya};
504710e230b6Smaya
504810e230b6Smayastatic inline void
504910e230b6SmayaGEN6_INSTDONE_2_pack(__attribute__((unused)) __gen_user_data *data,
505010e230b6Smaya                     __attribute__((unused)) void * restrict dst,
505110e230b6Smaya                     __attribute__((unused)) const struct GEN6_INSTDONE_2 * restrict values)
505210e230b6Smaya{
505310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
505410e230b6Smaya
505510e230b6Smaya   dw[0] =
505610e230b6Smaya      __gen_uint(values->VFDone, 0, 0) |
505710e230b6Smaya      __gen_uint(values->VS0Done, 1, 1) |
505810e230b6Smaya      __gen_uint(values->GSDone, 2, 2) |
505910e230b6Smaya      __gen_uint(values->CLDone, 3, 3) |
506010e230b6Smaya      __gen_uint(values->SFDone, 4, 4) |
506110e230b6Smaya      __gen_uint(values->VMEDone, 5, 5) |
506210e230b6Smaya      __gen_uint(values->PLDone, 6, 6) |
506310e230b6Smaya      __gen_uint(values->SODone, 7, 7) |
506410e230b6Smaya      __gen_uint(values->SIDone, 8, 8) |
506510e230b6Smaya      __gen_uint(values->DGDone, 9, 9) |
506610e230b6Smaya      __gen_uint(values->FTDone, 10, 10) |
506710e230b6Smaya      __gen_uint(values->DMDone, 11, 11) |
506810e230b6Smaya      __gen_uint(values->SCDone, 12, 12) |
506910e230b6Smaya      __gen_uint(values->FLDone, 13, 13) |
507010e230b6Smaya      __gen_uint(values->QCDone, 14, 14) |
507110e230b6Smaya      __gen_uint(values->SVSMDone, 15, 15) |
507210e230b6Smaya      __gen_uint(values->WMFEDone, 16, 16) |
507310e230b6Smaya      __gen_uint(values->IZDone, 17, 17) |
507410e230b6Smaya      __gen_uint(values->PSDDone, 18, 18) |
507510e230b6Smaya      __gen_uint(values->DAPDone, 19, 19) |
507610e230b6Smaya      __gen_uint(values->RCZDone, 20, 20) |
507710e230b6Smaya      __gen_uint(values->VDIDone, 21, 21) |
507810e230b6Smaya      __gen_uint(values->RCPBEDone, 22, 22) |
507910e230b6Smaya      __gen_uint(values->RCPFEDone, 23, 23) |
508010e230b6Smaya      __gen_uint(values->MTDone, 24, 24) |
508110e230b6Smaya      __gen_uint(values->ISCDone, 25, 25) |
508210e230b6Smaya      __gen_uint(values->SVGDone, 26, 26) |
508310e230b6Smaya      __gen_uint(values->RCCDone, 27, 27) |
508410e230b6Smaya      __gen_uint(values->SVRWDone, 28, 28) |
508510e230b6Smaya      __gen_uint(values->WMBEDone, 29, 29) |
508610e230b6Smaya      __gen_uint(values->CSDone, 30, 30) |
508710e230b6Smaya      __gen_uint(values->GAMDone, 31, 31);
508810e230b6Smaya}
508910e230b6Smaya
509010e230b6Smaya#define GEN6_INSTPM_num                   0x20c0
509110e230b6Smaya#define GEN6_INSTPM_length                     1
509210e230b6Smayastruct GEN6_INSTPM {
509310e230b6Smaya   bool                                 _3DStateInstructionDisable;
509410e230b6Smaya   bool                                 _3DRenderingInstructionDisable;
509510e230b6Smaya   bool                                 MediaInstructionDisable;
509610e230b6Smaya   bool                                 CONSTANT_BUFFERAddressOffsetDisable;
509710e230b6Smaya   bool                                 _3DStateInstructionDisableMask;
509810e230b6Smaya   bool                                 _3DRenderingInstructionDisableMask;
509910e230b6Smaya   bool                                 MediaInstructionDisableMask;
510010e230b6Smaya   bool                                 CONSTANT_BUFFERAddressOffsetDisableMask;
510110e230b6Smaya};
510210e230b6Smaya
510310e230b6Smayastatic inline void
510410e230b6SmayaGEN6_INSTPM_pack(__attribute__((unused)) __gen_user_data *data,
510510e230b6Smaya                 __attribute__((unused)) void * restrict dst,
510610e230b6Smaya                 __attribute__((unused)) const struct GEN6_INSTPM * restrict values)
510710e230b6Smaya{
510810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
510910e230b6Smaya
511010e230b6Smaya   dw[0] =
511110e230b6Smaya      __gen_uint(values->_3DStateInstructionDisable, 1, 1) |
511210e230b6Smaya      __gen_uint(values->_3DRenderingInstructionDisable, 2, 2) |
511310e230b6Smaya      __gen_uint(values->MediaInstructionDisable, 3, 3) |
511410e230b6Smaya      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisable, 6, 6) |
511510e230b6Smaya      __gen_uint(values->_3DStateInstructionDisableMask, 17, 17) |
511610e230b6Smaya      __gen_uint(values->_3DRenderingInstructionDisableMask, 18, 18) |
511710e230b6Smaya      __gen_uint(values->MediaInstructionDisableMask, 19, 19) |
511810e230b6Smaya      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisableMask, 22, 22);
511910e230b6Smaya}
512010e230b6Smaya
512110e230b6Smaya#define GEN6_RCS_FAULT_REG_num            0x4094
512210e230b6Smaya#define GEN6_RCS_FAULT_REG_length              1
512310e230b6Smayastruct GEN6_RCS_FAULT_REG {
512410e230b6Smaya   bool                                 ValidBit;
512510e230b6Smaya   uint32_t                             FaultType;
512610e230b6Smaya#define PageFault                                0
512710e230b6Smaya#define InvalidPDFault                           1
512810e230b6Smaya#define UnloadedPDFault                          2
512910e230b6Smaya#define InvalidandUnloadedPDfault                3
513010e230b6Smaya   uint32_t                             SRCIDofFault;
513110e230b6Smaya   uint32_t                             GTTSEL;
513210e230b6Smaya#define PPGTT                                    0
513310e230b6Smaya#define GGTT                                     1
513410e230b6Smaya   __gen_address_type                   VirtualAddressofFault;
513510e230b6Smaya};
513610e230b6Smaya
513710e230b6Smayastatic inline void
513810e230b6SmayaGEN6_RCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
513910e230b6Smaya                        __attribute__((unused)) void * restrict dst,
514010e230b6Smaya                        __attribute__((unused)) const struct GEN6_RCS_FAULT_REG * restrict values)
514110e230b6Smaya{
514210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
514310e230b6Smaya
514410e230b6Smaya   const uint32_t v0 =
514510e230b6Smaya      __gen_uint(values->ValidBit, 0, 0) |
514610e230b6Smaya      __gen_uint(values->FaultType, 1, 2) |
514710e230b6Smaya      __gen_uint(values->SRCIDofFault, 3, 10) |
514810e230b6Smaya      __gen_uint(values->GTTSEL, 11, 11);
514910e230b6Smaya   dw[0] = __gen_combine_address(data, &dw[0], values->VirtualAddressofFault, v0);
515010e230b6Smaya}
515110e230b6Smaya
515210e230b6Smaya#define GEN6_RCS_RING_BUFFER_CTL_num      0x203c
515310e230b6Smaya#define GEN6_RCS_RING_BUFFER_CTL_length        1
515410e230b6Smayastruct GEN6_RCS_RING_BUFFER_CTL {
515510e230b6Smaya   bool                                 RingBufferEnable;
515610e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
515710e230b6Smaya#define MI_AUTOREPORT_OFF                        0
515810e230b6Smaya#define MI_AUTOREPORT_64KBMI_AUTOREPORT_4KB      1
515910e230b6Smaya#define MI_AUTOREPORT_128KB                      3
516010e230b6Smaya   bool                                 SemaphoreWait;
516110e230b6Smaya   bool                                 RBWait;
516210e230b6Smaya   uint32_t                             BufferLengthinpages1;
516310e230b6Smaya};
516410e230b6Smaya
516510e230b6Smayastatic inline void
516610e230b6SmayaGEN6_RCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
516710e230b6Smaya                              __attribute__((unused)) void * restrict dst,
516810e230b6Smaya                              __attribute__((unused)) const struct GEN6_RCS_RING_BUFFER_CTL * restrict values)
516910e230b6Smaya{
517010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
517110e230b6Smaya
517210e230b6Smaya   dw[0] =
517310e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
517410e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
517510e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
517610e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
517710e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
517810e230b6Smaya}
517910e230b6Smaya
518010e230b6Smaya#define GEN6_VCS_FAULT_REG_num            0x4194
518110e230b6Smaya#define GEN6_VCS_FAULT_REG_length              1
518210e230b6Smayastruct GEN6_VCS_FAULT_REG {
518310e230b6Smaya   bool                                 ValidBit;
518410e230b6Smaya   uint32_t                             FaultType;
518510e230b6Smaya#define PageFault                                0
518610e230b6Smaya#define InvalidPDFault                           1
518710e230b6Smaya#define UnloadedPDFault                          2
518810e230b6Smaya#define InvalidandUnloadedPDfault                3
518910e230b6Smaya   uint32_t                             SRCIDofFault;
519010e230b6Smaya   uint32_t                             GTTSEL;
519110e230b6Smaya#define PPGTT                                    0
519210e230b6Smaya#define GGTT                                     1
519310e230b6Smaya   __gen_address_type                   VirtualAddressofFault;
519410e230b6Smaya};
519510e230b6Smaya
519610e230b6Smayastatic inline void
519710e230b6SmayaGEN6_VCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
519810e230b6Smaya                        __attribute__((unused)) void * restrict dst,
519910e230b6Smaya                        __attribute__((unused)) const struct GEN6_VCS_FAULT_REG * restrict values)
520010e230b6Smaya{
520110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
520210e230b6Smaya
520310e230b6Smaya   const uint32_t v0 =
520410e230b6Smaya      __gen_uint(values->ValidBit, 0, 0) |
520510e230b6Smaya      __gen_uint(values->FaultType, 1, 2) |
520610e230b6Smaya      __gen_uint(values->SRCIDofFault, 3, 10) |
520710e230b6Smaya      __gen_uint(values->GTTSEL, 11, 11);
520810e230b6Smaya   dw[0] = __gen_combine_address(data, &dw[0], values->VirtualAddressofFault, v0);
520910e230b6Smaya}
521010e230b6Smaya
521110e230b6Smaya#define GEN6_VCS_INSTDONE_num             0x1206c
521210e230b6Smaya#define GEN6_VCS_INSTDONE_length               1
521310e230b6Smayastruct GEN6_VCS_INSTDONE {
521410e230b6Smaya   bool                                 RingEnable;
521510e230b6Smaya   bool                                 USBDone;
521610e230b6Smaya   bool                                 QRCDone;
521710e230b6Smaya   bool                                 SECDone;
521810e230b6Smaya   bool                                 MPCDone;
521910e230b6Smaya   bool                                 VFTDone;
522010e230b6Smaya   bool                                 BSPDone;
522110e230b6Smaya   bool                                 VLFDone;
522210e230b6Smaya   bool                                 VOPDone;
522310e230b6Smaya   bool                                 VMCDone;
522410e230b6Smaya   bool                                 VIPDone;
522510e230b6Smaya   bool                                 VITDone;
522610e230b6Smaya   bool                                 VDSDone;
522710e230b6Smaya   bool                                 VMXDone;
522810e230b6Smaya   bool                                 VCPDone;
522910e230b6Smaya   bool                                 VCDDone;
523010e230b6Smaya   bool                                 VADDone;
523110e230b6Smaya   bool                                 VMDDone;
523210e230b6Smaya   bool                                 VISDone;
523310e230b6Smaya   bool                                 VACDone;
523410e230b6Smaya   bool                                 VAMDone;
523510e230b6Smaya   bool                                 JPGDone;
523610e230b6Smaya   bool                                 VBPDone;
523710e230b6Smaya   bool                                 VHRDone;
523810e230b6Smaya   bool                                 VCIDone;
523910e230b6Smaya   bool                                 VCRDone;
524010e230b6Smaya   bool                                 VINDone;
524110e230b6Smaya   bool                                 VPRDone;
524210e230b6Smaya   bool                                 VTQDone;
524310e230b6Smaya   bool                                 VCSDone;
524410e230b6Smaya   bool                                 GACDone;
524510e230b6Smaya};
524610e230b6Smaya
524710e230b6Smayastatic inline void
524810e230b6SmayaGEN6_VCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
524910e230b6Smaya                       __attribute__((unused)) void * restrict dst,
525010e230b6Smaya                       __attribute__((unused)) const struct GEN6_VCS_INSTDONE * restrict values)
525110e230b6Smaya{
525210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
525310e230b6Smaya
525410e230b6Smaya   dw[0] =
525510e230b6Smaya      __gen_uint(values->RingEnable, 0, 0) |
525610e230b6Smaya      __gen_uint(values->USBDone, 1, 1) |
525710e230b6Smaya      __gen_uint(values->QRCDone, 2, 2) |
525810e230b6Smaya      __gen_uint(values->SECDone, 3, 3) |
525910e230b6Smaya      __gen_uint(values->MPCDone, 4, 4) |
526010e230b6Smaya      __gen_uint(values->VFTDone, 5, 5) |
526110e230b6Smaya      __gen_uint(values->BSPDone, 6, 6) |
526210e230b6Smaya      __gen_uint(values->VLFDone, 7, 7) |
526310e230b6Smaya      __gen_uint(values->VOPDone, 8, 8) |
526410e230b6Smaya      __gen_uint(values->VMCDone, 9, 9) |
526510e230b6Smaya      __gen_uint(values->VIPDone, 10, 10) |
526610e230b6Smaya      __gen_uint(values->VITDone, 11, 11) |
526710e230b6Smaya      __gen_uint(values->VDSDone, 12, 12) |
526810e230b6Smaya      __gen_uint(values->VMXDone, 13, 13) |
526910e230b6Smaya      __gen_uint(values->VCPDone, 14, 14) |
527010e230b6Smaya      __gen_uint(values->VCDDone, 15, 15) |
527110e230b6Smaya      __gen_uint(values->VADDone, 16, 16) |
527210e230b6Smaya      __gen_uint(values->VMDDone, 17, 17) |
527310e230b6Smaya      __gen_uint(values->VISDone, 18, 18) |
527410e230b6Smaya      __gen_uint(values->VACDone, 19, 19) |
527510e230b6Smaya      __gen_uint(values->VAMDone, 20, 20) |
527610e230b6Smaya      __gen_uint(values->JPGDone, 21, 21) |
527710e230b6Smaya      __gen_uint(values->VBPDone, 22, 22) |
527810e230b6Smaya      __gen_uint(values->VHRDone, 23, 23) |
527910e230b6Smaya      __gen_uint(values->VCIDone, 24, 24) |
528010e230b6Smaya      __gen_uint(values->VCRDone, 25, 25) |
528110e230b6Smaya      __gen_uint(values->VINDone, 26, 26) |
528210e230b6Smaya      __gen_uint(values->VPRDone, 27, 27) |
528310e230b6Smaya      __gen_uint(values->VTQDone, 28, 28) |
528410e230b6Smaya      __gen_uint(values->VCSDone, 30, 30) |
528510e230b6Smaya      __gen_uint(values->GACDone, 31, 31);
528610e230b6Smaya}
528710e230b6Smaya
528810e230b6Smaya#define GEN6_VCS_RING_BUFFER_CTL_num      0x1203c
528910e230b6Smaya#define GEN6_VCS_RING_BUFFER_CTL_length        1
529010e230b6Smayastruct GEN6_VCS_RING_BUFFER_CTL {
529110e230b6Smaya   bool                                 RingBufferEnable;
529210e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
529310e230b6Smaya#define MI_AUTOREPORT_OFF                        0
529410e230b6Smaya#define MI_AUTOREPORT_64KB                       1
529510e230b6Smaya#define MI_AUTOREPORT_4KB                        2
529610e230b6Smaya#define MI_AUTOREPORT_128KB                      3
529710e230b6Smaya   bool                                 DisableRegisterAccesses;
529810e230b6Smaya   bool                                 SemaphoreWait;
529910e230b6Smaya   bool                                 RBWait;
530010e230b6Smaya   uint32_t                             BufferLengthinpages1;
530110e230b6Smaya};
530210e230b6Smaya
530310e230b6Smayastatic inline void
530410e230b6SmayaGEN6_VCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
530510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
530610e230b6Smaya                              __attribute__((unused)) const struct GEN6_VCS_RING_BUFFER_CTL * restrict values)
530710e230b6Smaya{
530810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
530910e230b6Smaya
531010e230b6Smaya   dw[0] =
531110e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
531210e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
531310e230b6Smaya      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
531410e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
531510e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
531610e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
531710e230b6Smaya}
531810e230b6Smaya
531910e230b6Smaya#endif /* GEN6_PACK_H */
5320