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
3096c5ddc4Srjs#ifndef GFX6_PACK_H
3196c5ddc4Srjs#define GFX6_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
4396c5ddc4Srjs#ifndef __intel_field_functions
4496c5ddc4Srjs#define __intel_field_functions
4510e230b6Smaya
4610e230b6Smaya#ifdef NDEBUG
4710e230b6Smaya#define NDEBUG_UNUSED __attribute__((unused))
4810e230b6Smaya#else
4910e230b6Smaya#define NDEBUG_UNUSED
5010e230b6Smaya#endif
5110e230b6Smaya
5296c5ddc4Srjsunion __intel_value {
5310e230b6Smaya   float f;
5410e230b6Smaya   uint32_t dw;
5510e230b6Smaya};
5610e230b6Smaya
5796c5ddc4Srjsstatic inline __attribute__((always_inline)) uint64_t
5810e230b6Smaya__gen_mbo(uint32_t start, uint32_t end)
5910e230b6Smaya{
6010e230b6Smaya   return (~0ull >> (64 - (end - start + 1))) << start;
6110e230b6Smaya}
6210e230b6Smaya
6396c5ddc4Srjsstatic inline __attribute__((always_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
7996c5ddc4Srjsstatic inline __attribute__((always_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
9996c5ddc4Srjsstatic inline __attribute__((always_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
11296c5ddc4Srjsstatic inline __attribute__((always_inline)) uint64_t
11396c5ddc4Srjs__gen_address(__gen_user_data *data, void *location,
11496c5ddc4Srjs              __gen_address_type address, uint32_t delta,
11596c5ddc4Srjs              __attribute__((unused)) uint32_t start, uint32_t end)
11696c5ddc4Srjs{
11796c5ddc4Srjs   uint64_t addr_u64 = __gen_combine_address(data, location, address, delta);
11896c5ddc4Srjs   if (end == 31) {
11996c5ddc4Srjs      return addr_u64;
12096c5ddc4Srjs   } else if (end < 63) {
12196c5ddc4Srjs      const unsigned shift = 63 - end;
12296c5ddc4Srjs      return (addr_u64 << shift) >> shift;
12396c5ddc4Srjs   } else {
12496c5ddc4Srjs      return addr_u64;
12596c5ddc4Srjs   }
12696c5ddc4Srjs}
12796c5ddc4Srjs
12896c5ddc4Srjsstatic inline __attribute__((always_inline)) uint32_t
12910e230b6Smaya__gen_float(float v)
13010e230b6Smaya{
13110e230b6Smaya   __gen_validate_value(v);
13296c5ddc4Srjs   return ((union __intel_value) { .f = (v) }).dw;
13310e230b6Smaya}
13410e230b6Smaya
13596c5ddc4Srjsstatic inline __attribute__((always_inline)) uint64_t
13610e230b6Smaya__gen_sfixed(float v, uint32_t start, uint32_t end, uint32_t fract_bits)
13710e230b6Smaya{
13810e230b6Smaya   __gen_validate_value(v);
13910e230b6Smaya
14010e230b6Smaya   const float factor = (1 << fract_bits);
14110e230b6Smaya
14210e230b6Smaya#ifndef NDEBUG
14310e230b6Smaya   const float max = ((1 << (end - start)) - 1) / factor;
14410e230b6Smaya   const float min = -(1 << (end - start)) / factor;
14510e230b6Smaya   assert(min <= v && v <= max);
14610e230b6Smaya#endif
14710e230b6Smaya
14810e230b6Smaya   const int64_t int_val = llroundf(v * factor);
14910e230b6Smaya   const uint64_t mask = ~0ull >> (64 - (end - start + 1));
15010e230b6Smaya
15110e230b6Smaya   return (int_val & mask) << start;
15210e230b6Smaya}
15310e230b6Smaya
15496c5ddc4Srjsstatic inline __attribute__((always_inline)) uint64_t
15510e230b6Smaya__gen_ufixed(float v, uint32_t start, NDEBUG_UNUSED uint32_t end, uint32_t fract_bits)
15610e230b6Smaya{
15710e230b6Smaya   __gen_validate_value(v);
15810e230b6Smaya
15910e230b6Smaya   const float factor = (1 << fract_bits);
16010e230b6Smaya
16110e230b6Smaya#ifndef NDEBUG
16210e230b6Smaya   const float max = ((1 << (end - start + 1)) - 1) / factor;
16310e230b6Smaya   const float min = 0.0f;
16410e230b6Smaya   assert(min <= v && v <= max);
16510e230b6Smaya#endif
16610e230b6Smaya
16710e230b6Smaya   const uint64_t uint_val = llroundf(v * factor);
16810e230b6Smaya
16910e230b6Smaya   return uint_val << start;
17010e230b6Smaya}
17110e230b6Smaya
17210e230b6Smaya#ifndef __gen_address_type
17310e230b6Smaya#error #define __gen_address_type before including this file
17410e230b6Smaya#endif
17510e230b6Smaya
17610e230b6Smaya#ifndef __gen_user_data
17710e230b6Smaya#error #define __gen_combine_address before including this file
17810e230b6Smaya#endif
17910e230b6Smaya
18010e230b6Smaya#undef NDEBUG_UNUSED
18110e230b6Smaya
18210e230b6Smaya#endif
18310e230b6Smaya
18410e230b6Smaya
18596c5ddc4Srjsenum GFX6_3D_Color_Buffer_Blend_Factor {
18610e230b6Smaya   BLENDFACTOR_ONE                      =      1,
18710e230b6Smaya   BLENDFACTOR_SRC_COLOR                =      2,
18810e230b6Smaya   BLENDFACTOR_SRC_ALPHA                =      3,
18910e230b6Smaya   BLENDFACTOR_DST_ALPHA                =      4,
19010e230b6Smaya   BLENDFACTOR_DST_COLOR                =      5,
19110e230b6Smaya   BLENDFACTOR_SRC_ALPHA_SATURATE       =      6,
19210e230b6Smaya   BLENDFACTOR_CONST_COLOR              =      7,
19310e230b6Smaya   BLENDFACTOR_CONST_ALPHA              =      8,
19410e230b6Smaya   BLENDFACTOR_SRC1_COLOR               =      9,
19510e230b6Smaya   BLENDFACTOR_SRC1_ALPHA               =     10,
19610e230b6Smaya   BLENDFACTOR_ZERO                     =     17,
19710e230b6Smaya   BLENDFACTOR_INV_SRC_COLOR            =     18,
19810e230b6Smaya   BLENDFACTOR_INV_SRC_ALPHA            =     19,
19910e230b6Smaya   BLENDFACTOR_INV_DST_ALPHA            =     20,
20010e230b6Smaya   BLENDFACTOR_INV_DST_COLOR            =     21,
20110e230b6Smaya   BLENDFACTOR_INV_CONST_COLOR          =     23,
20210e230b6Smaya   BLENDFACTOR_INV_CONST_ALPHA          =     24,
20310e230b6Smaya   BLENDFACTOR_INV_SRC1_COLOR           =     25,
20410e230b6Smaya   BLENDFACTOR_INV_SRC1_ALPHA           =     26,
20510e230b6Smaya};
20610e230b6Smaya
20796c5ddc4Srjsenum GFX6_3D_Color_Buffer_Blend_Function {
20810e230b6Smaya   BLENDFUNCTION_ADD                    =      0,
20910e230b6Smaya   BLENDFUNCTION_SUBTRACT               =      1,
21010e230b6Smaya   BLENDFUNCTION_REVERSE_SUBTRACT       =      2,
21110e230b6Smaya   BLENDFUNCTION_MIN                    =      3,
21210e230b6Smaya   BLENDFUNCTION_MAX                    =      4,
21310e230b6Smaya};
21410e230b6Smaya
21596c5ddc4Srjsenum GFX6_3D_Compare_Function {
21610e230b6Smaya   COMPAREFUNCTION_ALWAYS               =      0,
21710e230b6Smaya   COMPAREFUNCTION_NEVER                =      1,
21810e230b6Smaya   COMPAREFUNCTION_LESS                 =      2,
21910e230b6Smaya   COMPAREFUNCTION_EQUAL                =      3,
22010e230b6Smaya   COMPAREFUNCTION_LEQUAL               =      4,
22110e230b6Smaya   COMPAREFUNCTION_GREATER              =      5,
22210e230b6Smaya   COMPAREFUNCTION_NOTEQUAL             =      6,
22310e230b6Smaya   COMPAREFUNCTION_GEQUAL               =      7,
22410e230b6Smaya};
22510e230b6Smaya
22696c5ddc4Srjsenum GFX6_3D_Logic_Op_Function {
22710e230b6Smaya   LOGICOP_CLEAR                        =      0,
22810e230b6Smaya   LOGICOP_NOR                          =      1,
22910e230b6Smaya   LOGICOP_AND_INVERTED                 =      2,
23010e230b6Smaya   LOGICOP_COPY_INVERTED                =      3,
23110e230b6Smaya   LOGICOP_AND_REVERSE                  =      4,
23210e230b6Smaya   LOGICOP_INVERT                       =      5,
23310e230b6Smaya   LOGICOP_XOR                          =      6,
23410e230b6Smaya   LOGICOP_NAND                         =      7,
23510e230b6Smaya   LOGICOP_AND                          =      8,
23610e230b6Smaya   LOGICOP_EQUIV                        =      9,
23710e230b6Smaya   LOGICOP_NOOP                         =     10,
23810e230b6Smaya   LOGICOP_OR_INVERTED                  =     11,
23910e230b6Smaya   LOGICOP_COPY                         =     12,
24010e230b6Smaya   LOGICOP_OR_REVERSE                   =     13,
24110e230b6Smaya   LOGICOP_OR                           =     14,
24210e230b6Smaya   LOGICOP_SET                          =     15,
24310e230b6Smaya};
24410e230b6Smaya
24596c5ddc4Srjsenum GFX6_3D_Prim_Topo_Type {
24610e230b6Smaya   _3DPRIM_POINTLIST                    =      1,
24710e230b6Smaya   _3DPRIM_LINELIST                     =      2,
24810e230b6Smaya   _3DPRIM_LINESTRIP                    =      3,
24910e230b6Smaya   _3DPRIM_TRILIST                      =      4,
25010e230b6Smaya   _3DPRIM_TRISTRIP                     =      5,
25110e230b6Smaya   _3DPRIM_TRIFAN                       =      6,
25210e230b6Smaya   _3DPRIM_QUADLIST                     =      7,
25310e230b6Smaya   _3DPRIM_QUADSTRIP                    =      8,
25410e230b6Smaya   _3DPRIM_LINELIST_ADJ                 =      9,
25510e230b6Smaya   _3DPRIM_LINESTRIP_ADJ                =     10,
25610e230b6Smaya   _3DPRIM_TRILIST_ADJ                  =     11,
25710e230b6Smaya   _3DPRIM_TRISTRIP_ADJ                 =     12,
25810e230b6Smaya   _3DPRIM_TRISTRIP_REVERSE             =     13,
25910e230b6Smaya   _3DPRIM_POLYGON                      =     14,
26010e230b6Smaya   _3DPRIM_RECTLIST                     =     15,
26110e230b6Smaya   _3DPRIM_LINELOOP                     =     16,
26210e230b6Smaya   _3DPRIM_POINTLIST_BF                 =     17,
26310e230b6Smaya   _3DPRIM_LINESTRIP_CONT               =     18,
26410e230b6Smaya   _3DPRIM_LINESTRIP_BF                 =     19,
26510e230b6Smaya   _3DPRIM_LINESTRIP_CONT_BF            =     20,
26610e230b6Smaya   _3DPRIM_TRIFAN_NOSTIPPLE             =     22,
26710e230b6Smaya};
26810e230b6Smaya
26996c5ddc4Srjsenum GFX6_3D_Stencil_Operation {
27010e230b6Smaya   STENCILOP_KEEP                       =      0,
27110e230b6Smaya   STENCILOP_ZERO                       =      1,
27210e230b6Smaya   STENCILOP_REPLACE                    =      2,
27310e230b6Smaya   STENCILOP_INCRSAT                    =      3,
27410e230b6Smaya   STENCILOP_DECRSAT                    =      4,
27510e230b6Smaya   STENCILOP_INCR                       =      5,
27610e230b6Smaya   STENCILOP_DECR                       =      6,
27710e230b6Smaya   STENCILOP_INVERT                     =      7,
27810e230b6Smaya};
27910e230b6Smaya
28096c5ddc4Srjsenum GFX6_3D_Vertex_Component_Control {
28110e230b6Smaya   VFCOMP_NOSTORE                       =      0,
28210e230b6Smaya   VFCOMP_STORE_SRC                     =      1,
28310e230b6Smaya   VFCOMP_STORE_0                       =      2,
28410e230b6Smaya   VFCOMP_STORE_1_FP                    =      3,
28510e230b6Smaya   VFCOMP_STORE_1_INT                   =      4,
28610e230b6Smaya   VFCOMP_STORE_VID                     =      5,
28710e230b6Smaya   VFCOMP_STORE_IID                     =      6,
28810e230b6Smaya   VFCOMP_STORE_PID                     =      7,
28910e230b6Smaya};
29010e230b6Smaya
29196c5ddc4Srjsenum GFX6_TextureCoordinateMode {
29210e230b6Smaya   TCM_WRAP                             =      0,
29310e230b6Smaya   TCM_MIRROR                           =      1,
29410e230b6Smaya   TCM_CLAMP                            =      2,
29510e230b6Smaya   TCM_CUBE                             =      3,
29610e230b6Smaya   TCM_CLAMP_BORDER                     =      4,
29710e230b6Smaya   TCM_MIRROR_ONCE                      =      5,
29810e230b6Smaya};
29910e230b6Smaya
30096c5ddc4Srjs#define GFX6_3DSTATE_CONSTANT_BODY_length      4
30196c5ddc4Srjsstruct GFX6_3DSTATE_CONSTANT_BODY {
30210e230b6Smaya   uint32_t                             ConstantBuffer0ReadLength;
30310e230b6Smaya   uint64_t                             PointertoConstantBuffer0;
30410e230b6Smaya   uint32_t                             ConstantBuffer1ReadLength;
30510e230b6Smaya   __gen_address_type                   PointertoConstantBuffer1;
30610e230b6Smaya   uint32_t                             ConstantBuffer2ReadLength;
30710e230b6Smaya   __gen_address_type                   PointertoConstantBuffer2;
30810e230b6Smaya   uint32_t                             ConstantBuffer3ReadLength;
30910e230b6Smaya   __gen_address_type                   PointertoConstantBuffer3;
31010e230b6Smaya};
31110e230b6Smaya
31296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
31396c5ddc4SrjsGFX6_3DSTATE_CONSTANT_BODY_pack(__attribute__((unused)) __gen_user_data *data,
31410e230b6Smaya                                __attribute__((unused)) void * restrict dst,
31596c5ddc4Srjs                                __attribute__((unused)) const struct GFX6_3DSTATE_CONSTANT_BODY * restrict values)
31610e230b6Smaya{
31710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
31810e230b6Smaya
31910e230b6Smaya   dw[0] =
32010e230b6Smaya      __gen_uint(values->ConstantBuffer0ReadLength, 0, 4) |
32110e230b6Smaya      __gen_offset(values->PointertoConstantBuffer0, 5, 31);
32210e230b6Smaya
32310e230b6Smaya   const uint32_t v1 =
32410e230b6Smaya      __gen_uint(values->ConstantBuffer1ReadLength, 0, 4);
32596c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->PointertoConstantBuffer1, v1, 5, 31);
32610e230b6Smaya
32710e230b6Smaya   const uint32_t v2 =
32810e230b6Smaya      __gen_uint(values->ConstantBuffer2ReadLength, 0, 4);
32996c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->PointertoConstantBuffer2, v2, 5, 31);
33010e230b6Smaya
33110e230b6Smaya   const uint32_t v3 =
33210e230b6Smaya      __gen_uint(values->ConstantBuffer3ReadLength, 0, 4);
33396c5ddc4Srjs   dw[3] = __gen_address(data, &dw[3], values->PointertoConstantBuffer3, v3, 5, 31);
33410e230b6Smaya}
33510e230b6Smaya
33696c5ddc4Srjs#define GFX6_BINDING_TABLE_STATE_length        1
33796c5ddc4Srjsstruct GFX6_BINDING_TABLE_STATE {
33810e230b6Smaya   uint64_t                             SurfaceStatePointer;
33910e230b6Smaya};
34010e230b6Smaya
34196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
34296c5ddc4SrjsGFX6_BINDING_TABLE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
34310e230b6Smaya                              __attribute__((unused)) void * restrict dst,
34496c5ddc4Srjs                              __attribute__((unused)) const struct GFX6_BINDING_TABLE_STATE * restrict values)
34510e230b6Smaya{
34610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
34710e230b6Smaya
34810e230b6Smaya   dw[0] =
34910e230b6Smaya      __gen_offset(values->SurfaceStatePointer, 5, 31);
35010e230b6Smaya}
35110e230b6Smaya
35296c5ddc4Srjs#define GFX6_BLEND_STATE_ENTRY_length          2
35396c5ddc4Srjsstruct GFX6_BLEND_STATE_ENTRY {
35496c5ddc4Srjs   enum GFX6_3D_Color_Buffer_Blend_Factor DestinationBlendFactor;
35596c5ddc4Srjs   enum GFX6_3D_Color_Buffer_Blend_Factor SourceBlendFactor;
35696c5ddc4Srjs   enum GFX6_3D_Color_Buffer_Blend_Function ColorBlendFunction;
35796c5ddc4Srjs   enum GFX6_3D_Color_Buffer_Blend_Factor DestinationAlphaBlendFactor;
35896c5ddc4Srjs   enum GFX6_3D_Color_Buffer_Blend_Factor SourceAlphaBlendFactor;
35996c5ddc4Srjs   enum GFX6_3D_Color_Buffer_Blend_Function AlphaBlendFunction;
36010e230b6Smaya   bool                                 IndependentAlphaBlendEnable;
36110e230b6Smaya   bool                                 ColorBufferBlendEnable;
36210e230b6Smaya   bool                                 PostBlendColorClampEnable;
36310e230b6Smaya   bool                                 PreBlendColorClampEnable;
36410e230b6Smaya   uint32_t                             ColorClampRange;
36510e230b6Smaya#define COLORCLAMP_UNORM                         0
36610e230b6Smaya#define COLORCLAMP_SNORM                         1
36710e230b6Smaya#define COLORCLAMP_RTFORMAT                      2
36810e230b6Smaya   uint32_t                             YDitherOffset;
36910e230b6Smaya   uint32_t                             XDitherOffset;
37010e230b6Smaya   bool                                 ColorDitherEnable;
37196c5ddc4Srjs   enum GFX6_3D_Compare_Function        AlphaTestFunction;
37210e230b6Smaya   bool                                 AlphaTestEnable;
37396c5ddc4Srjs   enum GFX6_3D_Logic_Op_Function       LogicOpFunction;
37410e230b6Smaya   bool                                 LogicOpEnable;
37510e230b6Smaya   bool                                 WriteDisableBlue;
37610e230b6Smaya   bool                                 WriteDisableGreen;
37710e230b6Smaya   bool                                 WriteDisableRed;
37810e230b6Smaya   bool                                 WriteDisableAlpha;
37910e230b6Smaya   bool                                 AlphaToCoverageDitherEnable;
38010e230b6Smaya   bool                                 AlphaToOneEnable;
38110e230b6Smaya   bool                                 AlphaToCoverageEnable;
38210e230b6Smaya};
38310e230b6Smaya
38496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
38596c5ddc4SrjsGFX6_BLEND_STATE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
38610e230b6Smaya                            __attribute__((unused)) void * restrict dst,
38796c5ddc4Srjs                            __attribute__((unused)) const struct GFX6_BLEND_STATE_ENTRY * restrict values)
38810e230b6Smaya{
38910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
39010e230b6Smaya
39110e230b6Smaya   dw[0] =
39210e230b6Smaya      __gen_uint(values->DestinationBlendFactor, 0, 4) |
39310e230b6Smaya      __gen_uint(values->SourceBlendFactor, 5, 9) |
39410e230b6Smaya      __gen_uint(values->ColorBlendFunction, 11, 13) |
39510e230b6Smaya      __gen_uint(values->DestinationAlphaBlendFactor, 15, 19) |
39610e230b6Smaya      __gen_uint(values->SourceAlphaBlendFactor, 20, 24) |
39710e230b6Smaya      __gen_uint(values->AlphaBlendFunction, 26, 28) |
39810e230b6Smaya      __gen_uint(values->IndependentAlphaBlendEnable, 30, 30) |
39910e230b6Smaya      __gen_uint(values->ColorBufferBlendEnable, 31, 31);
40010e230b6Smaya
40110e230b6Smaya   dw[1] =
40210e230b6Smaya      __gen_uint(values->PostBlendColorClampEnable, 0, 0) |
40310e230b6Smaya      __gen_uint(values->PreBlendColorClampEnable, 1, 1) |
40410e230b6Smaya      __gen_uint(values->ColorClampRange, 2, 3) |
40510e230b6Smaya      __gen_uint(values->YDitherOffset, 8, 9) |
40610e230b6Smaya      __gen_uint(values->XDitherOffset, 10, 11) |
40710e230b6Smaya      __gen_uint(values->ColorDitherEnable, 12, 12) |
40810e230b6Smaya      __gen_uint(values->AlphaTestFunction, 13, 15) |
40910e230b6Smaya      __gen_uint(values->AlphaTestEnable, 16, 16) |
41010e230b6Smaya      __gen_uint(values->LogicOpFunction, 18, 21) |
41110e230b6Smaya      __gen_uint(values->LogicOpEnable, 22, 22) |
41210e230b6Smaya      __gen_uint(values->WriteDisableBlue, 24, 24) |
41310e230b6Smaya      __gen_uint(values->WriteDisableGreen, 25, 25) |
41410e230b6Smaya      __gen_uint(values->WriteDisableRed, 26, 26) |
41510e230b6Smaya      __gen_uint(values->WriteDisableAlpha, 27, 27) |
41610e230b6Smaya      __gen_uint(values->AlphaToCoverageDitherEnable, 29, 29) |
41710e230b6Smaya      __gen_uint(values->AlphaToOneEnable, 30, 30) |
41810e230b6Smaya      __gen_uint(values->AlphaToCoverageEnable, 31, 31);
41910e230b6Smaya}
42010e230b6Smaya
42196c5ddc4Srjs#define GFX6_BLEND_STATE_length                0
42296c5ddc4Srjsstruct GFX6_BLEND_STATE {
42310e230b6Smaya   /* variable length fields follow */
42410e230b6Smaya};
42510e230b6Smaya
42696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
42796c5ddc4SrjsGFX6_BLEND_STATE_pack(__attribute__((unused)) __gen_user_data *data,
42810e230b6Smaya                      __attribute__((unused)) void * restrict dst,
42996c5ddc4Srjs                      __attribute__((unused)) const struct GFX6_BLEND_STATE * restrict values)
43010e230b6Smaya{
43110e230b6Smaya}
43210e230b6Smaya
43396c5ddc4Srjs#define GFX6_CC_VIEWPORT_length                2
43496c5ddc4Srjsstruct GFX6_CC_VIEWPORT {
43510e230b6Smaya   float                                MinimumDepth;
43610e230b6Smaya   float                                MaximumDepth;
43710e230b6Smaya};
43810e230b6Smaya
43996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
44096c5ddc4SrjsGFX6_CC_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
44110e230b6Smaya                      __attribute__((unused)) void * restrict dst,
44296c5ddc4Srjs                      __attribute__((unused)) const struct GFX6_CC_VIEWPORT * restrict values)
44310e230b6Smaya{
44410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
44510e230b6Smaya
44610e230b6Smaya   dw[0] =
44710e230b6Smaya      __gen_float(values->MinimumDepth);
44810e230b6Smaya
44910e230b6Smaya   dw[1] =
45010e230b6Smaya      __gen_float(values->MaximumDepth);
45110e230b6Smaya}
45210e230b6Smaya
45396c5ddc4Srjs#define GFX6_CLIP_VIEWPORT_length              4
45496c5ddc4Srjsstruct GFX6_CLIP_VIEWPORT {
45510e230b6Smaya   float                                XMinClipGuardband;
45610e230b6Smaya   float                                XMaxClipGuardband;
45710e230b6Smaya   float                                YMinClipGuardband;
45810e230b6Smaya   float                                YMaxClipGuardband;
45910e230b6Smaya};
46010e230b6Smaya
46196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
46296c5ddc4SrjsGFX6_CLIP_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
46310e230b6Smaya                        __attribute__((unused)) void * restrict dst,
46496c5ddc4Srjs                        __attribute__((unused)) const struct GFX6_CLIP_VIEWPORT * restrict values)
46510e230b6Smaya{
46610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
46710e230b6Smaya
46810e230b6Smaya   dw[0] =
46910e230b6Smaya      __gen_float(values->XMinClipGuardband);
47010e230b6Smaya
47110e230b6Smaya   dw[1] =
47210e230b6Smaya      __gen_float(values->XMaxClipGuardband);
47310e230b6Smaya
47410e230b6Smaya   dw[2] =
47510e230b6Smaya      __gen_float(values->YMinClipGuardband);
47610e230b6Smaya
47710e230b6Smaya   dw[3] =
47810e230b6Smaya      __gen_float(values->YMaxClipGuardband);
47910e230b6Smaya}
48010e230b6Smaya
48196c5ddc4Srjs#define GFX6_COLOR_CALC_STATE_length           6
48296c5ddc4Srjsstruct GFX6_COLOR_CALC_STATE {
48310e230b6Smaya   uint32_t                             AlphaTestFormat;
48410e230b6Smaya#define ALPHATEST_UNORM8                         0
48510e230b6Smaya#define ALPHATEST_FLOAT32                        1
48610e230b6Smaya   bool                                 RoundDisableFunctionDisable;
48710e230b6Smaya   uint32_t                             BackfaceStencilReferenceValue;
48810e230b6Smaya   uint32_t                             StencilReferenceValue;
48910e230b6Smaya   uint32_t                             AlphaReferenceValueAsUNORM8;
49010e230b6Smaya   float                                AlphaReferenceValueAsFLOAT32;
49110e230b6Smaya   float                                BlendConstantColorRed;
49210e230b6Smaya   float                                BlendConstantColorGreen;
49310e230b6Smaya   float                                BlendConstantColorBlue;
49410e230b6Smaya   float                                BlendConstantColorAlpha;
49510e230b6Smaya};
49610e230b6Smaya
49796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
49896c5ddc4SrjsGFX6_COLOR_CALC_STATE_pack(__attribute__((unused)) __gen_user_data *data,
49910e230b6Smaya                           __attribute__((unused)) void * restrict dst,
50096c5ddc4Srjs                           __attribute__((unused)) const struct GFX6_COLOR_CALC_STATE * restrict values)
50110e230b6Smaya{
50210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
50310e230b6Smaya
50410e230b6Smaya   dw[0] =
50510e230b6Smaya      __gen_uint(values->AlphaTestFormat, 0, 0) |
50610e230b6Smaya      __gen_uint(values->RoundDisableFunctionDisable, 15, 15) |
50710e230b6Smaya      __gen_uint(values->BackfaceStencilReferenceValue, 16, 23) |
50810e230b6Smaya      __gen_uint(values->StencilReferenceValue, 24, 31);
50910e230b6Smaya
51010e230b6Smaya   dw[1] =
51110e230b6Smaya      __gen_uint(values->AlphaReferenceValueAsUNORM8, 0, 31) |
51210e230b6Smaya      __gen_float(values->AlphaReferenceValueAsFLOAT32);
51310e230b6Smaya
51410e230b6Smaya   dw[2] =
51510e230b6Smaya      __gen_float(values->BlendConstantColorRed);
51610e230b6Smaya
51710e230b6Smaya   dw[3] =
51810e230b6Smaya      __gen_float(values->BlendConstantColorGreen);
51910e230b6Smaya
52010e230b6Smaya   dw[4] =
52110e230b6Smaya      __gen_float(values->BlendConstantColorBlue);
52210e230b6Smaya
52310e230b6Smaya   dw[5] =
52410e230b6Smaya      __gen_float(values->BlendConstantColorAlpha);
52510e230b6Smaya}
52610e230b6Smaya
52796c5ddc4Srjs#define GFX6_DEPTH_STENCIL_STATE_length        3
52896c5ddc4Srjsstruct GFX6_DEPTH_STENCIL_STATE {
52996c5ddc4Srjs   enum GFX6_3D_Stencil_Operation       BackfaceStencilPassDepthPassOp;
53096c5ddc4Srjs   enum GFX6_3D_Stencil_Operation       BackfaceStencilPassDepthFailOp;
53196c5ddc4Srjs   enum GFX6_3D_Stencil_Operation       BackfaceStencilFailOp;
53296c5ddc4Srjs   enum GFX6_3D_Compare_Function        BackfaceStencilTestFunction;
53310e230b6Smaya   bool                                 DoubleSidedStencilEnable;
53410e230b6Smaya   bool                                 StencilBufferWriteEnable;
53596c5ddc4Srjs   enum GFX6_3D_Stencil_Operation       StencilPassDepthPassOp;
53696c5ddc4Srjs   enum GFX6_3D_Stencil_Operation       StencilPassDepthFailOp;
53796c5ddc4Srjs   enum GFX6_3D_Stencil_Operation       StencilFailOp;
53896c5ddc4Srjs   enum GFX6_3D_Compare_Function        StencilTestFunction;
53910e230b6Smaya   bool                                 StencilTestEnable;
54010e230b6Smaya   uint32_t                             BackfaceStencilWriteMask;
54110e230b6Smaya   uint32_t                             BackfaceStencilTestMask;
54210e230b6Smaya   uint32_t                             StencilWriteMask;
54310e230b6Smaya   uint32_t                             StencilTestMask;
54410e230b6Smaya   bool                                 DepthBufferWriteEnable;
54596c5ddc4Srjs   enum GFX6_3D_Compare_Function        DepthTestFunction;
54610e230b6Smaya   bool                                 DepthTestEnable;
54710e230b6Smaya};
54810e230b6Smaya
54996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
55096c5ddc4SrjsGFX6_DEPTH_STENCIL_STATE_pack(__attribute__((unused)) __gen_user_data *data,
55110e230b6Smaya                              __attribute__((unused)) void * restrict dst,
55296c5ddc4Srjs                              __attribute__((unused)) const struct GFX6_DEPTH_STENCIL_STATE * restrict values)
55310e230b6Smaya{
55410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
55510e230b6Smaya
55610e230b6Smaya   dw[0] =
55710e230b6Smaya      __gen_uint(values->BackfaceStencilPassDepthPassOp, 3, 5) |
55810e230b6Smaya      __gen_uint(values->BackfaceStencilPassDepthFailOp, 6, 8) |
55910e230b6Smaya      __gen_uint(values->BackfaceStencilFailOp, 9, 11) |
56010e230b6Smaya      __gen_uint(values->BackfaceStencilTestFunction, 12, 14) |
56110e230b6Smaya      __gen_uint(values->DoubleSidedStencilEnable, 15, 15) |
56210e230b6Smaya      __gen_uint(values->StencilBufferWriteEnable, 18, 18) |
56310e230b6Smaya      __gen_uint(values->StencilPassDepthPassOp, 19, 21) |
56410e230b6Smaya      __gen_uint(values->StencilPassDepthFailOp, 22, 24) |
56510e230b6Smaya      __gen_uint(values->StencilFailOp, 25, 27) |
56610e230b6Smaya      __gen_uint(values->StencilTestFunction, 28, 30) |
56710e230b6Smaya      __gen_uint(values->StencilTestEnable, 31, 31);
56810e230b6Smaya
56910e230b6Smaya   dw[1] =
57010e230b6Smaya      __gen_uint(values->BackfaceStencilWriteMask, 0, 7) |
57110e230b6Smaya      __gen_uint(values->BackfaceStencilTestMask, 8, 15) |
57210e230b6Smaya      __gen_uint(values->StencilWriteMask, 16, 23) |
57310e230b6Smaya      __gen_uint(values->StencilTestMask, 24, 31);
57410e230b6Smaya
57510e230b6Smaya   dw[2] =
57610e230b6Smaya      __gen_uint(values->DepthBufferWriteEnable, 26, 26) |
57710e230b6Smaya      __gen_uint(values->DepthTestFunction, 27, 29) |
57810e230b6Smaya      __gen_uint(values->DepthTestEnable, 31, 31);
57910e230b6Smaya}
58010e230b6Smaya
58196c5ddc4Srjs#define GFX6_INTERFACE_DESCRIPTOR_DATA_length      8
58296c5ddc4Srjsstruct GFX6_INTERFACE_DESCRIPTOR_DATA {
58310e230b6Smaya   uint64_t                             KernelStartPointer;
58410e230b6Smaya   bool                                 SoftwareExceptionEnable;
58510e230b6Smaya   bool                                 MaskStackExceptionEnable;
58610e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
58710e230b6Smaya   uint32_t                             FloatingPointMode;
58810e230b6Smaya#define IEEE754                                  0
58910e230b6Smaya#define Alternate                                1
59010e230b6Smaya   uint32_t                             ThreadPriority;
59110e230b6Smaya#define NormalPriority                           0
59210e230b6Smaya#define HighPriority                             1
59310e230b6Smaya   bool                                 SingleProgramFlow;
59410e230b6Smaya   uint32_t                             SamplerCount;
59510e230b6Smaya#define Nosamplersused                           0
59610e230b6Smaya#define Between1and4samplersused                 1
59710e230b6Smaya#define Between5and8samplersused                 2
59810e230b6Smaya#define Between9and12samplersused                3
59910e230b6Smaya#define Between13and16samplersused               4
60010e230b6Smaya   uint64_t                             SamplerStatePointer;
60110e230b6Smaya   uint32_t                             BindingTableEntryCount;
60210e230b6Smaya   uint64_t                             BindingTablePointer;
60310e230b6Smaya   uint32_t                             ConstantURBEntryReadOffset;
60410e230b6Smaya   uint32_t                             ConstantURBEntryReadLength;
60510e230b6Smaya   uint32_t                             BarrierID;
60610e230b6Smaya   uint32_t                             BarrierReturnByte;
60710e230b6Smaya   uint32_t                             BarrierReturnGRFOffset;
60810e230b6Smaya};
60910e230b6Smaya
61096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
61196c5ddc4SrjsGFX6_INTERFACE_DESCRIPTOR_DATA_pack(__attribute__((unused)) __gen_user_data *data,
61210e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
61396c5ddc4Srjs                                    __attribute__((unused)) const struct GFX6_INTERFACE_DESCRIPTOR_DATA * restrict values)
61410e230b6Smaya{
61510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
61610e230b6Smaya
61710e230b6Smaya   dw[0] =
61810e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 31);
61910e230b6Smaya
62010e230b6Smaya   dw[1] =
62110e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
62210e230b6Smaya      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
62310e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
62410e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
62510e230b6Smaya      __gen_uint(values->ThreadPriority, 17, 17) |
62610e230b6Smaya      __gen_uint(values->SingleProgramFlow, 18, 18);
62710e230b6Smaya
62810e230b6Smaya   dw[2] =
62910e230b6Smaya      __gen_uint(values->SamplerCount, 2, 4) |
63010e230b6Smaya      __gen_offset(values->SamplerStatePointer, 5, 31);
63110e230b6Smaya
63210e230b6Smaya   dw[3] =
63310e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 0, 4) |
63410e230b6Smaya      __gen_offset(values->BindingTablePointer, 5, 31);
63510e230b6Smaya
63610e230b6Smaya   dw[4] =
63710e230b6Smaya      __gen_uint(values->ConstantURBEntryReadOffset, 0, 15) |
63810e230b6Smaya      __gen_uint(values->ConstantURBEntryReadLength, 16, 31);
63910e230b6Smaya
64010e230b6Smaya   dw[5] =
64110e230b6Smaya      __gen_uint(values->BarrierID, 0, 3) |
64210e230b6Smaya      __gen_uint(values->BarrierReturnByte, 8, 15) |
64310e230b6Smaya      __gen_uint(values->BarrierReturnGRFOffset, 24, 31);
64410e230b6Smaya
64510e230b6Smaya   dw[6] = 0;
64610e230b6Smaya
64710e230b6Smaya   dw[7] = 0;
64810e230b6Smaya}
64910e230b6Smaya
65096c5ddc4Srjs#define GFX6_MEMORY_OBJECT_CONTROL_STATE_length      1
65196c5ddc4Srjsstruct GFX6_MEMORY_OBJECT_CONTROL_STATE {
65210e230b6Smaya   uint32_t                             CacheabilityControl;
65310e230b6Smaya   uint32_t                             GraphicsDataTypeGFDT;
65410e230b6Smaya};
65510e230b6Smaya
65696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
65796c5ddc4SrjsGFX6_MEMORY_OBJECT_CONTROL_STATE_pack(__attribute__((unused)) __gen_user_data *data,
65810e230b6Smaya                                      __attribute__((unused)) void * restrict dst,
65996c5ddc4Srjs                                      __attribute__((unused)) const struct GFX6_MEMORY_OBJECT_CONTROL_STATE * restrict values)
66010e230b6Smaya{
66110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
66210e230b6Smaya
66310e230b6Smaya   dw[0] =
66410e230b6Smaya      __gen_uint(values->CacheabilityControl, 0, 1) |
66510e230b6Smaya      __gen_uint(values->GraphicsDataTypeGFDT, 2, 2);
66610e230b6Smaya}
66710e230b6Smaya
66896c5ddc4Srjs#define GFX6_PALETTE_ENTRY_length              1
66996c5ddc4Srjsstruct GFX6_PALETTE_ENTRY {
67010e230b6Smaya   uint32_t                             Blue;
67110e230b6Smaya   uint32_t                             Green;
67210e230b6Smaya   uint32_t                             Red;
67310e230b6Smaya   uint32_t                             Alpha;
67410e230b6Smaya};
67510e230b6Smaya
67696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
67796c5ddc4SrjsGFX6_PALETTE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
67810e230b6Smaya                        __attribute__((unused)) void * restrict dst,
67996c5ddc4Srjs                        __attribute__((unused)) const struct GFX6_PALETTE_ENTRY * restrict values)
68010e230b6Smaya{
68110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
68210e230b6Smaya
68310e230b6Smaya   dw[0] =
68410e230b6Smaya      __gen_uint(values->Blue, 0, 7) |
68510e230b6Smaya      __gen_uint(values->Green, 8, 15) |
68610e230b6Smaya      __gen_uint(values->Red, 16, 23) |
68710e230b6Smaya      __gen_uint(values->Alpha, 24, 31);
68810e230b6Smaya}
68910e230b6Smaya
69096c5ddc4Srjs#define GFX6_RENDER_SURFACE_STATE_length       6
69196c5ddc4Srjsstruct GFX6_RENDER_SURFACE_STATE {
69210e230b6Smaya   bool                                 CubeFaceEnablePositiveZ;
69310e230b6Smaya   bool                                 CubeFaceEnableNegativeZ;
69410e230b6Smaya   bool                                 CubeFaceEnablePositiveY;
69510e230b6Smaya   bool                                 CubeFaceEnableNegativeY;
69610e230b6Smaya   bool                                 CubeFaceEnablePositiveX;
69710e230b6Smaya   bool                                 CubeFaceEnableNegativeX;
69810e230b6Smaya   uint32_t                             MediaBoundaryPixelMode;
69910e230b6Smaya#define NORMAL_MODE                              0
70010e230b6Smaya#define PROGRESSIVE_FRAME                        2
70110e230b6Smaya#define INTERLACED_FRAME                         3
70210e230b6Smaya   uint32_t                             RenderCacheReadWriteMode;
70310e230b6Smaya#define WRITE_ONLY                               0
70410e230b6Smaya#define READ_WRITE                               1
70510e230b6Smaya   uint32_t                             CubeMapCornerMode;
70610e230b6Smaya#define CUBE_REPLICATE                           0
70710e230b6Smaya#define CUBE_AVERAGE                             1
70810e230b6Smaya   uint32_t                             MIPMapLayoutMode;
70910e230b6Smaya#define MIPLAYOUT_BELOW                          0
71010e230b6Smaya#define MIPLAYOUT_RIGHT                          1
71110e230b6Smaya   uint32_t                             VerticalLineStrideOffset;
71210e230b6Smaya   uint32_t                             VerticalLineStride;
71310e230b6Smaya   uint32_t                             SurfaceFormat;
71410e230b6Smaya   uint32_t                             DataReturnFormat;
71510e230b6Smaya#define DATA_RETURN_FLOAT32                      0
71610e230b6Smaya   uint32_t                             SurfaceType;
71710e230b6Smaya#define SURFTYPE_1D                              0
71810e230b6Smaya#define SURFTYPE_2D                              1
71910e230b6Smaya#define SURFTYPE_3D                              2
72010e230b6Smaya#define SURFTYPE_CUBE                            3
72110e230b6Smaya#define SURFTYPE_BUFFER                          4
72210e230b6Smaya#define SURFTYPE_NULL                            7
72310e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
72410e230b6Smaya   uint32_t                             RenderTargetRotation;
72510e230b6Smaya#define RTROTATE_0DEG                            0
72610e230b6Smaya#define RTROTATE_90DEG                           1
72710e230b6Smaya#define RTROTATE_270DEG                          3
72810e230b6Smaya   uint32_t                             MIPCountLOD;
72910e230b6Smaya   uint32_t                             Width;
73010e230b6Smaya   uint32_t                             Height;
73110e230b6Smaya   uint32_t                             TileWalk;
73210e230b6Smaya#define TILEWALK_XMAJOR                          0
73310e230b6Smaya#define TILEWALK_YMAJOR                          1
73410e230b6Smaya   bool                                 TiledSurface;
73510e230b6Smaya   uint32_t                             SurfacePitch;
73610e230b6Smaya   uint32_t                             Depth;
73710e230b6Smaya   uint32_t                             MultisamplePositionPaletteIndex;
73810e230b6Smaya   uint32_t                             NumberofMultisamples;
73910e230b6Smaya#define MULTISAMPLECOUNT_1                       0
74010e230b6Smaya#define MULTISAMPLECOUNT_4                       2
74110e230b6Smaya   uint32_t                             RenderTargetViewExtent;
74210e230b6Smaya   uint32_t                             MinimumArrayElement;
74310e230b6Smaya   uint32_t                             SurfaceMinLOD;
74410e230b6Smaya   uint32_t                             MOCS;
74510e230b6Smaya   uint32_t                             YOffset;
74610e230b6Smaya   uint32_t                             SurfaceVerticalAlignment;
74710e230b6Smaya#define VALIGN_2                                 0
74810e230b6Smaya#define VALIGN_4                                 1
74910e230b6Smaya   uint32_t                             XOffset;
75010e230b6Smaya};
75110e230b6Smaya
75296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
75396c5ddc4SrjsGFX6_RENDER_SURFACE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
75410e230b6Smaya                               __attribute__((unused)) void * restrict dst,
75596c5ddc4Srjs                               __attribute__((unused)) const struct GFX6_RENDER_SURFACE_STATE * restrict values)
75610e230b6Smaya{
75710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
75810e230b6Smaya
75910e230b6Smaya   dw[0] =
76010e230b6Smaya      __gen_uint(values->CubeFaceEnablePositiveZ, 0, 0) |
76110e230b6Smaya      __gen_uint(values->CubeFaceEnableNegativeZ, 1, 1) |
76210e230b6Smaya      __gen_uint(values->CubeFaceEnablePositiveY, 2, 2) |
76310e230b6Smaya      __gen_uint(values->CubeFaceEnableNegativeY, 3, 3) |
76410e230b6Smaya      __gen_uint(values->CubeFaceEnablePositiveX, 4, 4) |
76510e230b6Smaya      __gen_uint(values->CubeFaceEnableNegativeX, 5, 5) |
76610e230b6Smaya      __gen_uint(values->MediaBoundaryPixelMode, 6, 7) |
76710e230b6Smaya      __gen_uint(values->RenderCacheReadWriteMode, 8, 8) |
76810e230b6Smaya      __gen_uint(values->CubeMapCornerMode, 9, 9) |
76910e230b6Smaya      __gen_uint(values->MIPMapLayoutMode, 10, 10) |
77010e230b6Smaya      __gen_uint(values->VerticalLineStrideOffset, 11, 11) |
77110e230b6Smaya      __gen_uint(values->VerticalLineStride, 12, 12) |
77210e230b6Smaya      __gen_uint(values->SurfaceFormat, 18, 26) |
77310e230b6Smaya      __gen_uint(values->DataReturnFormat, 27, 27) |
77410e230b6Smaya      __gen_uint(values->SurfaceType, 29, 31);
77510e230b6Smaya
77696c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->SurfaceBaseAddress, 0, 0, 31);
77710e230b6Smaya
77810e230b6Smaya   dw[2] =
77910e230b6Smaya      __gen_uint(values->RenderTargetRotation, 0, 1) |
78010e230b6Smaya      __gen_uint(values->MIPCountLOD, 2, 5) |
78110e230b6Smaya      __gen_uint(values->Width, 6, 18) |
78210e230b6Smaya      __gen_uint(values->Height, 19, 31);
78310e230b6Smaya
78410e230b6Smaya   dw[3] =
78510e230b6Smaya      __gen_uint(values->TileWalk, 0, 0) |
78610e230b6Smaya      __gen_uint(values->TiledSurface, 1, 1) |
78710e230b6Smaya      __gen_uint(values->SurfacePitch, 3, 19) |
78810e230b6Smaya      __gen_uint(values->Depth, 21, 31);
78910e230b6Smaya
79010e230b6Smaya   dw[4] =
79110e230b6Smaya      __gen_uint(values->MultisamplePositionPaletteIndex, 0, 2) |
79210e230b6Smaya      __gen_uint(values->NumberofMultisamples, 4, 6) |
79310e230b6Smaya      __gen_uint(values->RenderTargetViewExtent, 8, 16) |
79410e230b6Smaya      __gen_uint(values->MinimumArrayElement, 17, 27) |
79510e230b6Smaya      __gen_uint(values->SurfaceMinLOD, 28, 31);
79610e230b6Smaya
79710e230b6Smaya   dw[5] =
79810e230b6Smaya      __gen_uint(values->MOCS, 16, 19) |
79910e230b6Smaya      __gen_uint(values->YOffset, 20, 23) |
80010e230b6Smaya      __gen_uint(values->SurfaceVerticalAlignment, 24, 24) |
80110e230b6Smaya      __gen_uint(values->XOffset, 25, 31);
80210e230b6Smaya}
80310e230b6Smaya
80496c5ddc4Srjs#define GFX6_SAMPLER_BORDER_COLOR_STATE_length     12
80596c5ddc4Srjsstruct GFX6_SAMPLER_BORDER_COLOR_STATE {
80610e230b6Smaya   uint32_t                             BorderColorUnormRed;
80710e230b6Smaya   uint32_t                             BorderColorUnormGreen;
80810e230b6Smaya   uint32_t                             BorderColorUnormBlue;
80910e230b6Smaya   uint32_t                             BorderColorUnormAlpha;
81010e230b6Smaya   float                                BorderColorFloatRed;
81110e230b6Smaya   float                                BorderColorFloatGreen;
81210e230b6Smaya   float                                BorderColorFloatBlue;
81310e230b6Smaya   float                                BorderColorFloatAlpha;
81410e230b6Smaya   uint32_t                             BorderColorFloat16Red;
81510e230b6Smaya   uint32_t                             BorderColorFloat16Green;
81610e230b6Smaya   uint32_t                             BorderColorFloat16Blue;
81710e230b6Smaya   uint32_t                             BorderColorFloat16Alpha;
81810e230b6Smaya   uint32_t                             BorderColorUnorm16Red;
81910e230b6Smaya   uint32_t                             BorderColorUnorm16Green;
82010e230b6Smaya   uint32_t                             BorderColorUnorm16Blue;
82110e230b6Smaya   uint32_t                             BorderColorUnorm16Alpha;
82210e230b6Smaya   int32_t                              BorderColorSnorm16Red;
82310e230b6Smaya   int32_t                              BorderColorSnorm16Green;
82410e230b6Smaya   int32_t                              BorderColorSnorm16Blue;
82510e230b6Smaya   int32_t                              BorderColorSnorm16Alpha;
82610e230b6Smaya   int32_t                              BorderColorSnorm8Red;
82710e230b6Smaya   int32_t                              BorderColorSnorm8Green;
82810e230b6Smaya   int32_t                              BorderColorSnorm8Blue;
82910e230b6Smaya   int32_t                              BorderColorSnorm8Alpha;
83010e230b6Smaya};
83110e230b6Smaya
83296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
83396c5ddc4SrjsGFX6_SAMPLER_BORDER_COLOR_STATE_pack(__attribute__((unused)) __gen_user_data *data,
83410e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
83596c5ddc4Srjs                                     __attribute__((unused)) const struct GFX6_SAMPLER_BORDER_COLOR_STATE * restrict values)
83610e230b6Smaya{
83710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
83810e230b6Smaya
83910e230b6Smaya   dw[0] =
84010e230b6Smaya      __gen_uint(values->BorderColorUnormRed, 0, 7) |
84110e230b6Smaya      __gen_uint(values->BorderColorUnormGreen, 8, 15) |
84210e230b6Smaya      __gen_uint(values->BorderColorUnormBlue, 16, 23) |
84310e230b6Smaya      __gen_uint(values->BorderColorUnormAlpha, 24, 31);
84410e230b6Smaya
84510e230b6Smaya   dw[1] =
84610e230b6Smaya      __gen_float(values->BorderColorFloatRed);
84710e230b6Smaya
84810e230b6Smaya   dw[2] =
84910e230b6Smaya      __gen_float(values->BorderColorFloatGreen);
85010e230b6Smaya
85110e230b6Smaya   dw[3] =
85210e230b6Smaya      __gen_float(values->BorderColorFloatBlue);
85310e230b6Smaya
85410e230b6Smaya   dw[4] =
85510e230b6Smaya      __gen_float(values->BorderColorFloatAlpha);
85610e230b6Smaya
85710e230b6Smaya   dw[5] =
85810e230b6Smaya      __gen_uint(values->BorderColorFloat16Red, 0, 15) |
85910e230b6Smaya      __gen_uint(values->BorderColorFloat16Green, 16, 31);
86010e230b6Smaya
86110e230b6Smaya   dw[6] =
86210e230b6Smaya      __gen_uint(values->BorderColorFloat16Blue, 0, 15) |
86310e230b6Smaya      __gen_uint(values->BorderColorFloat16Alpha, 16, 31);
86410e230b6Smaya
86510e230b6Smaya   dw[7] =
86610e230b6Smaya      __gen_uint(values->BorderColorUnorm16Red, 0, 15) |
86710e230b6Smaya      __gen_uint(values->BorderColorUnorm16Green, 16, 31);
86810e230b6Smaya
86910e230b6Smaya   dw[8] =
87010e230b6Smaya      __gen_uint(values->BorderColorUnorm16Blue, 0, 15) |
87110e230b6Smaya      __gen_uint(values->BorderColorUnorm16Alpha, 16, 31);
87210e230b6Smaya
87310e230b6Smaya   dw[9] =
87410e230b6Smaya      __gen_sint(values->BorderColorSnorm16Red, 0, 15) |
87510e230b6Smaya      __gen_sint(values->BorderColorSnorm16Green, 16, 31);
87610e230b6Smaya
87710e230b6Smaya   dw[10] =
87810e230b6Smaya      __gen_sint(values->BorderColorSnorm16Blue, 0, 15) |
87910e230b6Smaya      __gen_sint(values->BorderColorSnorm16Alpha, 16, 31);
88010e230b6Smaya
88110e230b6Smaya   dw[11] =
88210e230b6Smaya      __gen_sint(values->BorderColorSnorm8Red, 0, 7) |
88310e230b6Smaya      __gen_sint(values->BorderColorSnorm8Green, 8, 15) |
88410e230b6Smaya      __gen_sint(values->BorderColorSnorm8Blue, 16, 23) |
88510e230b6Smaya      __gen_sint(values->BorderColorSnorm8Alpha, 24, 31);
88610e230b6Smaya}
88710e230b6Smaya
88896c5ddc4Srjs#define GFX6_SAMPLER_STATE_length              4
88996c5ddc4Srjsstruct GFX6_SAMPLER_STATE {
89010e230b6Smaya   uint32_t                             ShadowFunction;
89110e230b6Smaya#define PREFILTEROP_ALWAYS                       0
89210e230b6Smaya#define PREFILTEROP_NEVER                        1
89310e230b6Smaya#define PREFILTEROP_LESS                         2
89410e230b6Smaya#define PREFILTEROP_EQUAL                        3
89510e230b6Smaya#define PREFILTEROP_LEQUAL                       4
89610e230b6Smaya#define PREFILTEROP_GREATER                      5
89710e230b6Smaya#define PREFILTEROP_NOTEQUAL                     6
89810e230b6Smaya#define PREFILTEROP_GEQUAL                       7
89910e230b6Smaya   float                                TextureLODBias;
90010e230b6Smaya   uint32_t                             MinModeFilter;
90110e230b6Smaya   uint32_t                             MagModeFilter;
90210e230b6Smaya#define MAPFILTER_NEAREST                        0
90310e230b6Smaya#define MAPFILTER_LINEAR                         1
90410e230b6Smaya#define MAPFILTER_ANISOTROPIC                    2
90510e230b6Smaya#define MAPFILTER_MONO                           6
90610e230b6Smaya   uint32_t                             MipModeFilter;
90710e230b6Smaya#define MIPFILTER_NONE                           0
90810e230b6Smaya#define MIPFILTER_NEAREST                        1
90910e230b6Smaya#define MIPFILTER_LINEAR                         3
91010e230b6Smaya   float                                BaseMipLevel;
91110e230b6Smaya   uint32_t                             MinandMagStateNotEqual;
91210e230b6Smaya#define MIN_MAG_EQ                               0
91310e230b6Smaya#define MIN_MAG_NEQ                              1
91410e230b6Smaya   uint32_t                             LODPreClampEnable;
91510e230b6Smaya#define CLAMP_ENABLE_OGL                         1
91610e230b6Smaya   uint32_t                             TextureBorderColorMode;
91710e230b6Smaya#define DX10OGL                                  0
91810e230b6Smaya#define DX9                                      1
91910e230b6Smaya   bool                                 SamplerDisable;
92096c5ddc4Srjs   enum GFX6_TextureCoordinateMode      TCZAddressControlMode;
92196c5ddc4Srjs   enum GFX6_TextureCoordinateMode      TCYAddressControlMode;
92296c5ddc4Srjs   enum GFX6_TextureCoordinateMode      TCXAddressControlMode;
92310e230b6Smaya   uint32_t                             CubeSurfaceControlMode;
92410e230b6Smaya#define CUBECTRLMODE_PROGRAMMED                  0
92510e230b6Smaya#define CUBECTRLMODE_OVERRIDE                    1
92610e230b6Smaya   float                                MaxLOD;
92710e230b6Smaya   float                                MinLOD;
92810e230b6Smaya   uint64_t                             BorderColorPointer;
92910e230b6Smaya   bool                                 NonnormalizedCoordinateEnable;
93010e230b6Smaya   bool                                 RAddressMinFilterRoundingEnable;
93110e230b6Smaya   bool                                 RAddressMagFilterRoundingEnable;
93210e230b6Smaya   bool                                 VAddressMinFilterRoundingEnable;
93310e230b6Smaya   bool                                 VAddressMagFilterRoundingEnable;
93410e230b6Smaya   bool                                 UAddressMinFilterRoundingEnable;
93510e230b6Smaya   bool                                 UAddressMagFilterRoundingEnable;
93610e230b6Smaya   uint32_t                             MaximumAnisotropy;
93710e230b6Smaya#define RATIO21                                  0
93810e230b6Smaya#define RATIO41                                  1
93910e230b6Smaya#define RATIO61                                  2
94010e230b6Smaya#define RATIO81                                  3
94110e230b6Smaya#define RATIO101                                 4
94210e230b6Smaya#define RATIO121                                 5
94310e230b6Smaya#define RATIO141                                 6
94410e230b6Smaya#define RATIO161                                 7
94510e230b6Smaya   uint32_t                             ChromaKeyMode;
94610e230b6Smaya#define KEYFILTER_KILL_ON_ANY_MATCH              0
94710e230b6Smaya#define KEYFILTER_REPLACE_BLACK                  1
94810e230b6Smaya   uint32_t                             ChromaKeyIndex;
94910e230b6Smaya   bool                                 ChromaKeyEnable;
95010e230b6Smaya   uint32_t                             MonochromeFilterWidth;
95110e230b6Smaya   uint32_t                             MonochromeFilterHeightReserved;
95210e230b6Smaya};
95310e230b6Smaya
95496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
95596c5ddc4SrjsGFX6_SAMPLER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
95610e230b6Smaya                        __attribute__((unused)) void * restrict dst,
95796c5ddc4Srjs                        __attribute__((unused)) const struct GFX6_SAMPLER_STATE * restrict values)
95810e230b6Smaya{
95910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
96010e230b6Smaya
96110e230b6Smaya   dw[0] =
96210e230b6Smaya      __gen_uint(values->ShadowFunction, 0, 2) |
96310e230b6Smaya      __gen_sfixed(values->TextureLODBias, 3, 13, 6) |
96410e230b6Smaya      __gen_uint(values->MinModeFilter, 14, 16) |
96510e230b6Smaya      __gen_uint(values->MagModeFilter, 17, 19) |
96610e230b6Smaya      __gen_uint(values->MipModeFilter, 20, 21) |
96710e230b6Smaya      __gen_ufixed(values->BaseMipLevel, 22, 26, 1) |
96810e230b6Smaya      __gen_uint(values->MinandMagStateNotEqual, 27, 27) |
96910e230b6Smaya      __gen_uint(values->LODPreClampEnable, 28, 28) |
97010e230b6Smaya      __gen_uint(values->TextureBorderColorMode, 29, 29) |
97110e230b6Smaya      __gen_uint(values->SamplerDisable, 31, 31);
97210e230b6Smaya
97310e230b6Smaya   dw[1] =
97410e230b6Smaya      __gen_uint(values->TCZAddressControlMode, 0, 2) |
97510e230b6Smaya      __gen_uint(values->TCYAddressControlMode, 3, 5) |
97610e230b6Smaya      __gen_uint(values->TCXAddressControlMode, 6, 8) |
97710e230b6Smaya      __gen_uint(values->CubeSurfaceControlMode, 9, 9) |
97810e230b6Smaya      __gen_ufixed(values->MaxLOD, 12, 21, 6) |
97910e230b6Smaya      __gen_ufixed(values->MinLOD, 22, 31, 6);
98010e230b6Smaya
98110e230b6Smaya   dw[2] =
98210e230b6Smaya      __gen_offset(values->BorderColorPointer, 5, 31);
98310e230b6Smaya
98410e230b6Smaya   dw[3] =
98510e230b6Smaya      __gen_uint(values->NonnormalizedCoordinateEnable, 0, 0) |
98610e230b6Smaya      __gen_uint(values->RAddressMinFilterRoundingEnable, 13, 13) |
98710e230b6Smaya      __gen_uint(values->RAddressMagFilterRoundingEnable, 14, 14) |
98810e230b6Smaya      __gen_uint(values->VAddressMinFilterRoundingEnable, 15, 15) |
98910e230b6Smaya      __gen_uint(values->VAddressMagFilterRoundingEnable, 16, 16) |
99010e230b6Smaya      __gen_uint(values->UAddressMinFilterRoundingEnable, 17, 17) |
99110e230b6Smaya      __gen_uint(values->UAddressMagFilterRoundingEnable, 18, 18) |
99210e230b6Smaya      __gen_uint(values->MaximumAnisotropy, 19, 21) |
99310e230b6Smaya      __gen_uint(values->ChromaKeyMode, 22, 22) |
99410e230b6Smaya      __gen_uint(values->ChromaKeyIndex, 23, 24) |
99510e230b6Smaya      __gen_uint(values->ChromaKeyEnable, 25, 25) |
99610e230b6Smaya      __gen_uint(values->MonochromeFilterWidth, 26, 28) |
99710e230b6Smaya      __gen_uint(values->MonochromeFilterHeightReserved, 29, 31);
99810e230b6Smaya}
99910e230b6Smaya
100096c5ddc4Srjs#define GFX6_SCISSOR_RECT_length               2
100196c5ddc4Srjsstruct GFX6_SCISSOR_RECT {
100210e230b6Smaya   uint32_t                             ScissorRectangleXMin;
100310e230b6Smaya   uint32_t                             ScissorRectangleYMin;
100410e230b6Smaya   uint32_t                             ScissorRectangleXMax;
100510e230b6Smaya   uint32_t                             ScissorRectangleYMax;
100610e230b6Smaya};
100710e230b6Smaya
100896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
100996c5ddc4SrjsGFX6_SCISSOR_RECT_pack(__attribute__((unused)) __gen_user_data *data,
101010e230b6Smaya                       __attribute__((unused)) void * restrict dst,
101196c5ddc4Srjs                       __attribute__((unused)) const struct GFX6_SCISSOR_RECT * restrict values)
101210e230b6Smaya{
101310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
101410e230b6Smaya
101510e230b6Smaya   dw[0] =
101610e230b6Smaya      __gen_uint(values->ScissorRectangleXMin, 0, 15) |
101710e230b6Smaya      __gen_uint(values->ScissorRectangleYMin, 16, 31);
101810e230b6Smaya
101910e230b6Smaya   dw[1] =
102010e230b6Smaya      __gen_uint(values->ScissorRectangleXMax, 0, 15) |
102110e230b6Smaya      __gen_uint(values->ScissorRectangleYMax, 16, 31);
102210e230b6Smaya}
102310e230b6Smaya
102496c5ddc4Srjs#define GFX6_SF_OUTPUT_ATTRIBUTE_DETAIL_length      1
102596c5ddc4Srjsstruct GFX6_SF_OUTPUT_ATTRIBUTE_DETAIL {
102610e230b6Smaya   uint32_t                             SourceAttribute;
102710e230b6Smaya   uint32_t                             SwizzleSelect;
102810e230b6Smaya#define INPUTATTR                                0
102910e230b6Smaya#define INPUTATTR_FACING                         1
103010e230b6Smaya#define INPUTATTR_W                              2
103110e230b6Smaya#define INPUTATTR_FACING_W                       3
103210e230b6Smaya   uint32_t                             ConstantSource;
103310e230b6Smaya#define CONST_0000                               0
103410e230b6Smaya#define CONST_0001_FLOAT                         1
103510e230b6Smaya#define CONST_1111_FLOAT                         2
103610e230b6Smaya#define PRIM_ID                                  3
103710e230b6Smaya   uint32_t                             SwizzleControlMode;
103810e230b6Smaya   bool                                 ComponentOverrideX;
103910e230b6Smaya   bool                                 ComponentOverrideY;
104010e230b6Smaya   bool                                 ComponentOverrideZ;
104110e230b6Smaya   bool                                 ComponentOverrideW;
104210e230b6Smaya};
104310e230b6Smaya
104496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
104596c5ddc4SrjsGFX6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(__attribute__((unused)) __gen_user_data *data,
104610e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
104796c5ddc4Srjs                                     __attribute__((unused)) const struct GFX6_SF_OUTPUT_ATTRIBUTE_DETAIL * restrict values)
104810e230b6Smaya{
104910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
105010e230b6Smaya
105110e230b6Smaya   dw[0] =
105210e230b6Smaya      __gen_uint(values->SourceAttribute, 0, 4) |
105310e230b6Smaya      __gen_uint(values->SwizzleSelect, 6, 7) |
105410e230b6Smaya      __gen_uint(values->ConstantSource, 9, 10) |
105510e230b6Smaya      __gen_uint(values->SwizzleControlMode, 11, 11) |
105610e230b6Smaya      __gen_uint(values->ComponentOverrideX, 12, 12) |
105710e230b6Smaya      __gen_uint(values->ComponentOverrideY, 13, 13) |
105810e230b6Smaya      __gen_uint(values->ComponentOverrideZ, 14, 14) |
105910e230b6Smaya      __gen_uint(values->ComponentOverrideW, 15, 15);
106010e230b6Smaya}
106110e230b6Smaya
106296c5ddc4Srjs#define GFX6_SF_VIEWPORT_length                8
106396c5ddc4Srjsstruct GFX6_SF_VIEWPORT {
106410e230b6Smaya   float                                ViewportMatrixElementm00;
106510e230b6Smaya   float                                ViewportMatrixElementm11;
106610e230b6Smaya   float                                ViewportMatrixElementm22;
106710e230b6Smaya#define ExcludesDWord01                          0
106810e230b6Smaya   float                                ViewportMatrixElementm30;
106910e230b6Smaya   float                                ViewportMatrixElementm31;
107010e230b6Smaya   float                                ViewportMatrixElementm32;
107110e230b6Smaya};
107210e230b6Smaya
107396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
107496c5ddc4SrjsGFX6_SF_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
107510e230b6Smaya                      __attribute__((unused)) void * restrict dst,
107696c5ddc4Srjs                      __attribute__((unused)) const struct GFX6_SF_VIEWPORT * restrict values)
107710e230b6Smaya{
107810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
107910e230b6Smaya
108010e230b6Smaya   dw[0] =
108110e230b6Smaya      __gen_float(values->ViewportMatrixElementm00);
108210e230b6Smaya
108310e230b6Smaya   dw[1] =
108410e230b6Smaya      __gen_float(values->ViewportMatrixElementm11);
108510e230b6Smaya
108610e230b6Smaya   dw[2] =
108710e230b6Smaya      __gen_float(values->ViewportMatrixElementm22);
108810e230b6Smaya
108910e230b6Smaya   dw[3] =
109010e230b6Smaya      __gen_float(values->ViewportMatrixElementm30);
109110e230b6Smaya
109210e230b6Smaya   dw[4] =
109310e230b6Smaya      __gen_float(values->ViewportMatrixElementm31);
109410e230b6Smaya
109510e230b6Smaya   dw[5] =
109610e230b6Smaya      __gen_float(values->ViewportMatrixElementm32);
109710e230b6Smaya
109810e230b6Smaya   dw[6] = 0;
109910e230b6Smaya
110010e230b6Smaya   dw[7] = 0;
110110e230b6Smaya}
110210e230b6Smaya
110396c5ddc4Srjs#define GFX6_VERTEX_BUFFER_STATE_length        4
110496c5ddc4Srjsstruct GFX6_VERTEX_BUFFER_STATE {
110510e230b6Smaya   uint32_t                             BufferPitch;
110610e230b6Smaya   bool                                 VertexFetchInvalidate;
110710e230b6Smaya   bool                                 NullVertexBuffer;
110810e230b6Smaya   uint32_t                             MOCS;
110910e230b6Smaya   uint32_t                             BufferAccessType;
111010e230b6Smaya#define VERTEXDATA                               0
111110e230b6Smaya#define INSTANCEDATA                             1
111210e230b6Smaya   uint32_t                             VertexBufferIndex;
111310e230b6Smaya   __gen_address_type                   BufferStartingAddress;
111410e230b6Smaya   __gen_address_type                   EndAddress;
111510e230b6Smaya   uint32_t                             InstanceDataStepRate;
111610e230b6Smaya};
111710e230b6Smaya
111896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
111996c5ddc4SrjsGFX6_VERTEX_BUFFER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
112010e230b6Smaya                              __attribute__((unused)) void * restrict dst,
112196c5ddc4Srjs                              __attribute__((unused)) const struct GFX6_VERTEX_BUFFER_STATE * restrict values)
112210e230b6Smaya{
112310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
112410e230b6Smaya
112510e230b6Smaya   dw[0] =
112610e230b6Smaya      __gen_uint(values->BufferPitch, 0, 11) |
112710e230b6Smaya      __gen_uint(values->VertexFetchInvalidate, 12, 12) |
112810e230b6Smaya      __gen_uint(values->NullVertexBuffer, 13, 13) |
112910e230b6Smaya      __gen_uint(values->MOCS, 16, 19) |
113010e230b6Smaya      __gen_uint(values->BufferAccessType, 20, 20) |
113110e230b6Smaya      __gen_uint(values->VertexBufferIndex, 26, 31);
113210e230b6Smaya
113396c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->BufferStartingAddress, 0, 0, 31);
113410e230b6Smaya
113596c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->EndAddress, 0, 0, 31);
113610e230b6Smaya
113710e230b6Smaya   dw[3] =
113810e230b6Smaya      __gen_uint(values->InstanceDataStepRate, 0, 31);
113910e230b6Smaya}
114010e230b6Smaya
114196c5ddc4Srjs#define GFX6_VERTEX_ELEMENT_STATE_length       2
114296c5ddc4Srjsstruct GFX6_VERTEX_ELEMENT_STATE {
114310e230b6Smaya   uint32_t                             SourceElementOffset;
114410e230b6Smaya   bool                                 EdgeFlagEnable;
114510e230b6Smaya   uint32_t                             SourceElementFormat;
114610e230b6Smaya   bool                                 Valid;
114710e230b6Smaya   uint32_t                             VertexBufferIndex;
114896c5ddc4Srjs   enum GFX6_3D_Vertex_Component_Control Component3Control;
114996c5ddc4Srjs   enum GFX6_3D_Vertex_Component_Control Component2Control;
115096c5ddc4Srjs   enum GFX6_3D_Vertex_Component_Control Component1Control;
115196c5ddc4Srjs   enum GFX6_3D_Vertex_Component_Control Component0Control;
115210e230b6Smaya};
115310e230b6Smaya
115496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
115596c5ddc4SrjsGFX6_VERTEX_ELEMENT_STATE_pack(__attribute__((unused)) __gen_user_data *data,
115610e230b6Smaya                               __attribute__((unused)) void * restrict dst,
115796c5ddc4Srjs                               __attribute__((unused)) const struct GFX6_VERTEX_ELEMENT_STATE * restrict values)
115810e230b6Smaya{
115910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
116010e230b6Smaya
116110e230b6Smaya   dw[0] =
116210e230b6Smaya      __gen_uint(values->SourceElementOffset, 0, 11) |
116310e230b6Smaya      __gen_uint(values->EdgeFlagEnable, 15, 15) |
116410e230b6Smaya      __gen_uint(values->SourceElementFormat, 16, 24) |
116510e230b6Smaya      __gen_uint(values->Valid, 25, 25) |
116610e230b6Smaya      __gen_uint(values->VertexBufferIndex, 26, 31);
116710e230b6Smaya
116810e230b6Smaya   dw[1] =
116910e230b6Smaya      __gen_uint(values->Component3Control, 16, 18) |
117010e230b6Smaya      __gen_uint(values->Component2Control, 20, 22) |
117110e230b6Smaya      __gen_uint(values->Component1Control, 24, 26) |
117210e230b6Smaya      __gen_uint(values->Component0Control, 28, 30);
117310e230b6Smaya}
117410e230b6Smaya
117596c5ddc4Srjs#define GFX6_3DPRIMITIVE_length                6
117696c5ddc4Srjs#define GFX6_3DPRIMITIVE_length_bias           2
117796c5ddc4Srjs#define GFX6_3DPRIMITIVE_header                 \
117810e230b6Smaya   .DWordLength                         =      4,  \
117910e230b6Smaya   ._3DCommandSubOpcode                 =      0,  \
118010e230b6Smaya   ._3DCommandOpcode                    =      3,  \
118110e230b6Smaya   .CommandSubType                      =      3,  \
118210e230b6Smaya   .CommandType                         =      3
118310e230b6Smaya
118496c5ddc4Srjsstruct GFX6_3DPRIMITIVE {
118510e230b6Smaya   uint32_t                             DWordLength;
118610e230b6Smaya   uint32_t                             InternalVertexCount;
118796c5ddc4Srjs   enum GFX6_3D_Prim_Topo_Type          PrimitiveTopologyType;
118810e230b6Smaya   uint32_t                             VertexAccessType;
118910e230b6Smaya#define SEQUENTIAL                               0
119010e230b6Smaya#define RANDOM                                   1
119110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
119210e230b6Smaya   uint32_t                             _3DCommandOpcode;
119310e230b6Smaya   uint32_t                             CommandSubType;
119410e230b6Smaya   uint32_t                             CommandType;
119510e230b6Smaya   uint32_t                             VertexCountPerInstance;
119610e230b6Smaya   uint32_t                             StartVertexLocation;
119710e230b6Smaya   uint32_t                             InstanceCount;
119810e230b6Smaya#define UNDEFINED                                0
119910e230b6Smaya#define noninstancedoperation                    1
120010e230b6Smaya   uint32_t                             StartInstanceLocation;
120110e230b6Smaya   int32_t                              BaseVertexLocation;
120210e230b6Smaya};
120310e230b6Smaya
120496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
120596c5ddc4SrjsGFX6_3DPRIMITIVE_pack(__attribute__((unused)) __gen_user_data *data,
120610e230b6Smaya                      __attribute__((unused)) void * restrict dst,
120796c5ddc4Srjs                      __attribute__((unused)) const struct GFX6_3DPRIMITIVE * restrict values)
120810e230b6Smaya{
120910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
121010e230b6Smaya
121110e230b6Smaya   dw[0] =
121210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
121310e230b6Smaya      __gen_uint(values->InternalVertexCount, 9, 9) |
121410e230b6Smaya      __gen_uint(values->PrimitiveTopologyType, 10, 14) |
121510e230b6Smaya      __gen_uint(values->VertexAccessType, 15, 15) |
121610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
121710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
121810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
121910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
122010e230b6Smaya
122110e230b6Smaya   dw[1] =
122210e230b6Smaya      __gen_uint(values->VertexCountPerInstance, 0, 31);
122310e230b6Smaya
122410e230b6Smaya   dw[2] =
122510e230b6Smaya      __gen_uint(values->StartVertexLocation, 0, 31);
122610e230b6Smaya
122710e230b6Smaya   dw[3] =
122810e230b6Smaya      __gen_uint(values->InstanceCount, 0, 31);
122910e230b6Smaya
123010e230b6Smaya   dw[4] =
123110e230b6Smaya      __gen_uint(values->StartInstanceLocation, 0, 31);
123210e230b6Smaya
123310e230b6Smaya   dw[5] =
123410e230b6Smaya      __gen_sint(values->BaseVertexLocation, 0, 31);
123510e230b6Smaya}
123610e230b6Smaya
123796c5ddc4Srjs#define GFX6_3DSTATE_AA_LINE_PARAMETERS_length      3
123896c5ddc4Srjs#define GFX6_3DSTATE_AA_LINE_PARAMETERS_length_bias      2
123996c5ddc4Srjs#define GFX6_3DSTATE_AA_LINE_PARAMETERS_header  \
124010e230b6Smaya   .DWordLength                         =      1,  \
124110e230b6Smaya   ._3DCommandSubOpcode                 =     10,  \
124210e230b6Smaya   ._3DCommandOpcode                    =      1,  \
124310e230b6Smaya   .CommandSubType                      =      3,  \
124410e230b6Smaya   .CommandType                         =      3
124510e230b6Smaya
124696c5ddc4Srjsstruct GFX6_3DSTATE_AA_LINE_PARAMETERS {
124710e230b6Smaya   uint32_t                             DWordLength;
124810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
124910e230b6Smaya   uint32_t                             _3DCommandOpcode;
125010e230b6Smaya   uint32_t                             CommandSubType;
125110e230b6Smaya   uint32_t                             CommandType;
125210e230b6Smaya   float                                AACoverageSlope;
125310e230b6Smaya   float                                AACoverageBias;
125410e230b6Smaya   float                                AACoverageEndCapSlope;
125510e230b6Smaya   float                                AACoverageEndCapBias;
125610e230b6Smaya};
125710e230b6Smaya
125896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
125996c5ddc4SrjsGFX6_3DSTATE_AA_LINE_PARAMETERS_pack(__attribute__((unused)) __gen_user_data *data,
126010e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
126196c5ddc4Srjs                                     __attribute__((unused)) const struct GFX6_3DSTATE_AA_LINE_PARAMETERS * restrict values)
126210e230b6Smaya{
126310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
126410e230b6Smaya
126510e230b6Smaya   dw[0] =
126610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
126710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
126810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
126910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
127010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
127110e230b6Smaya
127210e230b6Smaya   dw[1] =
127310e230b6Smaya      __gen_ufixed(values->AACoverageSlope, 0, 7, 8) |
127410e230b6Smaya      __gen_ufixed(values->AACoverageBias, 16, 23, 8);
127510e230b6Smaya
127610e230b6Smaya   dw[2] =
127710e230b6Smaya      __gen_ufixed(values->AACoverageEndCapSlope, 0, 7, 8) |
127810e230b6Smaya      __gen_ufixed(values->AACoverageEndCapBias, 16, 23, 8);
127910e230b6Smaya}
128010e230b6Smaya
128196c5ddc4Srjs#define GFX6_3DSTATE_BINDING_TABLE_POINTERS_length      4
128296c5ddc4Srjs#define GFX6_3DSTATE_BINDING_TABLE_POINTERS_length_bias      2
128396c5ddc4Srjs#define GFX6_3DSTATE_BINDING_TABLE_POINTERS_header\
128410e230b6Smaya   .DWordLength                         =      2,  \
128510e230b6Smaya   ._3DCommandSubOpcode                 =      1,  \
128610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
128710e230b6Smaya   .CommandSubType                      =      3,  \
128810e230b6Smaya   .CommandType                         =      3
128910e230b6Smaya
129096c5ddc4Srjsstruct GFX6_3DSTATE_BINDING_TABLE_POINTERS {
129110e230b6Smaya   uint32_t                             DWordLength;
129210e230b6Smaya   bool                                 VSBindingTableChange;
129310e230b6Smaya   bool                                 GSBindingTableChange;
129410e230b6Smaya   bool                                 PSBindingTableChange;
129510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
129610e230b6Smaya   uint32_t                             _3DCommandOpcode;
129710e230b6Smaya   uint32_t                             CommandSubType;
129810e230b6Smaya   uint32_t                             CommandType;
129910e230b6Smaya   uint64_t                             PointertoVSBindingTable;
130010e230b6Smaya   uint64_t                             PointertoGSBindingTable;
130110e230b6Smaya   uint64_t                             PointertoPSBindingTable;
130210e230b6Smaya};
130310e230b6Smaya
130496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
130596c5ddc4SrjsGFX6_3DSTATE_BINDING_TABLE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
130610e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
130796c5ddc4Srjs                                         __attribute__((unused)) const struct GFX6_3DSTATE_BINDING_TABLE_POINTERS * restrict values)
130810e230b6Smaya{
130910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
131010e230b6Smaya
131110e230b6Smaya   dw[0] =
131210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
131310e230b6Smaya      __gen_uint(values->VSBindingTableChange, 8, 8) |
131410e230b6Smaya      __gen_uint(values->GSBindingTableChange, 9, 9) |
131510e230b6Smaya      __gen_uint(values->PSBindingTableChange, 12, 12) |
131610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
131710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
131810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
131910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
132010e230b6Smaya
132110e230b6Smaya   dw[1] =
132210e230b6Smaya      __gen_offset(values->PointertoVSBindingTable, 5, 31);
132310e230b6Smaya
132410e230b6Smaya   dw[2] =
132510e230b6Smaya      __gen_offset(values->PointertoGSBindingTable, 5, 31);
132610e230b6Smaya
132710e230b6Smaya   dw[3] =
132810e230b6Smaya      __gen_offset(values->PointertoPSBindingTable, 5, 31);
132910e230b6Smaya}
133010e230b6Smaya
133196c5ddc4Srjs#define GFX6_3DSTATE_CC_STATE_POINTERS_length      4
133296c5ddc4Srjs#define GFX6_3DSTATE_CC_STATE_POINTERS_length_bias      2
133396c5ddc4Srjs#define GFX6_3DSTATE_CC_STATE_POINTERS_header   \
133410e230b6Smaya   .DWordLength                         =      2,  \
133510e230b6Smaya   ._3DCommandSubOpcode                 =     14,  \
133610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
133710e230b6Smaya   .CommandSubType                      =      3,  \
133810e230b6Smaya   .CommandType                         =      3
133910e230b6Smaya
134096c5ddc4Srjsstruct GFX6_3DSTATE_CC_STATE_POINTERS {
134110e230b6Smaya   uint32_t                             DWordLength;
134210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
134310e230b6Smaya   uint32_t                             _3DCommandOpcode;
134410e230b6Smaya   uint32_t                             CommandSubType;
134510e230b6Smaya   uint32_t                             CommandType;
134610e230b6Smaya   bool                                 BLEND_STATEChange;
134710e230b6Smaya   uint64_t                             PointertoBLEND_STATE;
134810e230b6Smaya   bool                                 DEPTH_STENCIL_STATEChange;
134910e230b6Smaya   uint64_t                             PointertoDEPTH_STENCIL_STATE;
135010e230b6Smaya   bool                                 ColorCalcStatePointerValid;
135110e230b6Smaya   uint64_t                             ColorCalcStatePointer;
135210e230b6Smaya};
135310e230b6Smaya
135496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
135596c5ddc4SrjsGFX6_3DSTATE_CC_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
135610e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
135796c5ddc4Srjs                                    __attribute__((unused)) const struct GFX6_3DSTATE_CC_STATE_POINTERS * restrict values)
135810e230b6Smaya{
135910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
136010e230b6Smaya
136110e230b6Smaya   dw[0] =
136210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
136310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
136410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
136510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
136610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
136710e230b6Smaya
136810e230b6Smaya   dw[1] =
136910e230b6Smaya      __gen_uint(values->BLEND_STATEChange, 0, 0) |
137010e230b6Smaya      __gen_offset(values->PointertoBLEND_STATE, 6, 31);
137110e230b6Smaya
137210e230b6Smaya   dw[2] =
137310e230b6Smaya      __gen_uint(values->DEPTH_STENCIL_STATEChange, 0, 0) |
137410e230b6Smaya      __gen_offset(values->PointertoDEPTH_STENCIL_STATE, 6, 31);
137510e230b6Smaya
137610e230b6Smaya   dw[3] =
137710e230b6Smaya      __gen_uint(values->ColorCalcStatePointerValid, 0, 0) |
137810e230b6Smaya      __gen_offset(values->ColorCalcStatePointer, 6, 31);
137910e230b6Smaya}
138010e230b6Smaya
138196c5ddc4Srjs#define GFX6_3DSTATE_CHROMA_KEY_length         4
138296c5ddc4Srjs#define GFX6_3DSTATE_CHROMA_KEY_length_bias      2
138396c5ddc4Srjs#define GFX6_3DSTATE_CHROMA_KEY_header          \
138410e230b6Smaya   .DWordLength                         =      2,  \
138510e230b6Smaya   ._3DCommandSubOpcode                 =      4,  \
138610e230b6Smaya   ._3DCommandOpcode                    =      1,  \
138710e230b6Smaya   .CommandSubType                      =      3,  \
138810e230b6Smaya   .CommandType                         =      3
138910e230b6Smaya
139096c5ddc4Srjsstruct GFX6_3DSTATE_CHROMA_KEY {
139110e230b6Smaya   uint32_t                             DWordLength;
139210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
139310e230b6Smaya   uint32_t                             _3DCommandOpcode;
139410e230b6Smaya   uint32_t                             CommandSubType;
139510e230b6Smaya   uint32_t                             CommandType;
139610e230b6Smaya   uint32_t                             ChromaKeyTableIndex;
139710e230b6Smaya   uint32_t                             ChromaKeyLowValue;
139810e230b6Smaya   uint32_t                             ChromaKeyHighValue;
139910e230b6Smaya};
140010e230b6Smaya
140196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
140296c5ddc4SrjsGFX6_3DSTATE_CHROMA_KEY_pack(__attribute__((unused)) __gen_user_data *data,
140310e230b6Smaya                             __attribute__((unused)) void * restrict dst,
140496c5ddc4Srjs                             __attribute__((unused)) const struct GFX6_3DSTATE_CHROMA_KEY * restrict values)
140510e230b6Smaya{
140610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
140710e230b6Smaya
140810e230b6Smaya   dw[0] =
140910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
141010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
141110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
141210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
141310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
141410e230b6Smaya
141510e230b6Smaya   dw[1] =
141610e230b6Smaya      __gen_uint(values->ChromaKeyTableIndex, 30, 31);
141710e230b6Smaya
141810e230b6Smaya   dw[2] =
141910e230b6Smaya      __gen_uint(values->ChromaKeyLowValue, 0, 31);
142010e230b6Smaya
142110e230b6Smaya   dw[3] =
142210e230b6Smaya      __gen_uint(values->ChromaKeyHighValue, 0, 31);
142310e230b6Smaya}
142410e230b6Smaya
142596c5ddc4Srjs#define GFX6_3DSTATE_CLEAR_PARAMS_length       2
142696c5ddc4Srjs#define GFX6_3DSTATE_CLEAR_PARAMS_length_bias      2
142796c5ddc4Srjs#define GFX6_3DSTATE_CLEAR_PARAMS_header        \
142810e230b6Smaya   .DWordLength                         =      0,  \
142910e230b6Smaya   ._3DCommandSubOpcode                 =     16,  \
143010e230b6Smaya   ._3DCommandOpcode                    =      1,  \
143110e230b6Smaya   .CommandSubType                      =      3,  \
143210e230b6Smaya   .CommandType                         =      3
143310e230b6Smaya
143496c5ddc4Srjsstruct GFX6_3DSTATE_CLEAR_PARAMS {
143510e230b6Smaya   uint32_t                             DWordLength;
143610e230b6Smaya   bool                                 DepthClearValueValid;
143710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
143810e230b6Smaya   uint32_t                             _3DCommandOpcode;
143910e230b6Smaya   uint32_t                             CommandSubType;
144010e230b6Smaya   uint32_t                             CommandType;
144110e230b6Smaya   uint32_t                             DepthClearValue;
144210e230b6Smaya};
144310e230b6Smaya
144496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
144596c5ddc4SrjsGFX6_3DSTATE_CLEAR_PARAMS_pack(__attribute__((unused)) __gen_user_data *data,
144610e230b6Smaya                               __attribute__((unused)) void * restrict dst,
144796c5ddc4Srjs                               __attribute__((unused)) const struct GFX6_3DSTATE_CLEAR_PARAMS * restrict values)
144810e230b6Smaya{
144910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
145010e230b6Smaya
145110e230b6Smaya   dw[0] =
145210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
145310e230b6Smaya      __gen_uint(values->DepthClearValueValid, 15, 15) |
145410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
145510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
145610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
145710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
145810e230b6Smaya
145910e230b6Smaya   dw[1] =
146010e230b6Smaya      __gen_uint(values->DepthClearValue, 0, 31);
146110e230b6Smaya}
146210e230b6Smaya
146396c5ddc4Srjs#define GFX6_3DSTATE_CLIP_length               4
146496c5ddc4Srjs#define GFX6_3DSTATE_CLIP_length_bias          2
146596c5ddc4Srjs#define GFX6_3DSTATE_CLIP_header                \
146610e230b6Smaya   .DWordLength                         =      2,  \
146710e230b6Smaya   ._3DCommandSubOpcode                 =     18,  \
146810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
146910e230b6Smaya   .CommandSubType                      =      3,  \
147010e230b6Smaya   .CommandType                         =      3
147110e230b6Smaya
147296c5ddc4Srjsstruct GFX6_3DSTATE_CLIP {
147310e230b6Smaya   uint32_t                             DWordLength;
147410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
147510e230b6Smaya   uint32_t                             _3DCommandOpcode;
147610e230b6Smaya   uint32_t                             CommandSubType;
147710e230b6Smaya   uint32_t                             CommandType;
147810e230b6Smaya   uint32_t                             UserClipDistanceCullTestEnableBitmask;
147910e230b6Smaya   bool                                 StatisticsEnable;
148010e230b6Smaya   uint32_t                             TriangleFanProvokingVertexSelect;
148110e230b6Smaya#define Vertex0                                  0
148210e230b6Smaya#define Vertex1                                  1
148310e230b6Smaya#define Vertex2                                  2
148410e230b6Smaya   uint32_t                             LineStripListProvokingVertexSelect;
148510e230b6Smaya#define Vertex0                                  0
148610e230b6Smaya#define Vertex1                                  1
148710e230b6Smaya   uint32_t                             TriangleStripListProvokingVertexSelect;
148810e230b6Smaya#define Vertex0                                  0
148910e230b6Smaya#define Vertex1                                  1
149010e230b6Smaya#define Vertex2                                  2
149110e230b6Smaya   bool                                 NonPerspectiveBarycentricEnable;
149210e230b6Smaya   bool                                 PerspectiveDivideDisable;
149310e230b6Smaya   uint32_t                             ClipMode;
149410e230b6Smaya#define CLIPMODE_NORMAL                          0
149510e230b6Smaya#define CLIPMODE_REJECT_ALL                      3
149610e230b6Smaya#define CLIPMODE_ACCEPT_ALL                      4
149710e230b6Smaya   uint32_t                             UserClipDistanceClipTestEnableBitmask;
149810e230b6Smaya   bool                                 GuardbandClipTestEnable;
149910e230b6Smaya   bool                                 ViewportZClipTestEnable;
150010e230b6Smaya   bool                                 ViewportXYClipTestEnable;
150110e230b6Smaya   uint32_t                             APIMode;
150210e230b6Smaya#define APIMODE_OGL                              0
150310e230b6Smaya#define APIMODE_D3D                              1
150410e230b6Smaya   bool                                 ClipEnable;
150510e230b6Smaya   uint32_t                             MaximumVPIndex;
150610e230b6Smaya   bool                                 ForceZeroRTAIndexEnable;
150710e230b6Smaya   float                                MaximumPointWidth;
150810e230b6Smaya   float                                MinimumPointWidth;
150910e230b6Smaya};
151010e230b6Smaya
151196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
151296c5ddc4SrjsGFX6_3DSTATE_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
151310e230b6Smaya                       __attribute__((unused)) void * restrict dst,
151496c5ddc4Srjs                       __attribute__((unused)) const struct GFX6_3DSTATE_CLIP * restrict values)
151510e230b6Smaya{
151610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
151710e230b6Smaya
151810e230b6Smaya   dw[0] =
151910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
152010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
152110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
152210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
152310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
152410e230b6Smaya
152510e230b6Smaya   dw[1] =
152610e230b6Smaya      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
152710e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10);
152810e230b6Smaya
152910e230b6Smaya   dw[2] =
153010e230b6Smaya      __gen_uint(values->TriangleFanProvokingVertexSelect, 0, 1) |
153110e230b6Smaya      __gen_uint(values->LineStripListProvokingVertexSelect, 2, 3) |
153210e230b6Smaya      __gen_uint(values->TriangleStripListProvokingVertexSelect, 4, 5) |
153310e230b6Smaya      __gen_uint(values->NonPerspectiveBarycentricEnable, 8, 8) |
153410e230b6Smaya      __gen_uint(values->PerspectiveDivideDisable, 9, 9) |
153510e230b6Smaya      __gen_uint(values->ClipMode, 13, 15) |
153610e230b6Smaya      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 16, 23) |
153710e230b6Smaya      __gen_uint(values->GuardbandClipTestEnable, 26, 26) |
153810e230b6Smaya      __gen_uint(values->ViewportZClipTestEnable, 27, 27) |
153910e230b6Smaya      __gen_uint(values->ViewportXYClipTestEnable, 28, 28) |
154010e230b6Smaya      __gen_uint(values->APIMode, 30, 30) |
154110e230b6Smaya      __gen_uint(values->ClipEnable, 31, 31);
154210e230b6Smaya
154310e230b6Smaya   dw[3] =
154410e230b6Smaya      __gen_uint(values->MaximumVPIndex, 0, 3) |
154510e230b6Smaya      __gen_uint(values->ForceZeroRTAIndexEnable, 5, 5) |
154610e230b6Smaya      __gen_ufixed(values->MaximumPointWidth, 6, 16, 3) |
154710e230b6Smaya      __gen_ufixed(values->MinimumPointWidth, 17, 27, 3);
154810e230b6Smaya}
154910e230b6Smaya
155096c5ddc4Srjs#define GFX6_3DSTATE_CONSTANT_GS_length        5
155196c5ddc4Srjs#define GFX6_3DSTATE_CONSTANT_GS_length_bias      2
155296c5ddc4Srjs#define GFX6_3DSTATE_CONSTANT_GS_header         \
155310e230b6Smaya   .DWordLength                         =      3,  \
155410e230b6Smaya   ._3DCommandSubOpcode                 =     22,  \
155510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
155610e230b6Smaya   .CommandSubType                      =      3,  \
155710e230b6Smaya   .CommandType                         =      3
155810e230b6Smaya
155996c5ddc4Srjsstruct GFX6_3DSTATE_CONSTANT_GS {
156010e230b6Smaya   uint32_t                             DWordLength;
156110e230b6Smaya   uint32_t                             MOCS;
156210e230b6Smaya   bool                                 Buffer0Valid;
156310e230b6Smaya   bool                                 Buffer1Valid;
156410e230b6Smaya   bool                                 Buffer2Valid;
156510e230b6Smaya   bool                                 Buffer3Valid;
156610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
156710e230b6Smaya   uint32_t                             _3DCommandOpcode;
156810e230b6Smaya   uint32_t                             CommandSubType;
156910e230b6Smaya   uint32_t                             CommandType;
157096c5ddc4Srjs   struct GFX6_3DSTATE_CONSTANT_BODY    ConstantBody;
157110e230b6Smaya};
157210e230b6Smaya
157396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
157496c5ddc4SrjsGFX6_3DSTATE_CONSTANT_GS_pack(__attribute__((unused)) __gen_user_data *data,
157510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
157696c5ddc4Srjs                              __attribute__((unused)) const struct GFX6_3DSTATE_CONSTANT_GS * restrict values)
157710e230b6Smaya{
157810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
157910e230b6Smaya
158010e230b6Smaya   dw[0] =
158110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
158210e230b6Smaya      __gen_uint(values->MOCS, 8, 11) |
158310e230b6Smaya      __gen_uint(values->Buffer0Valid, 12, 12) |
158410e230b6Smaya      __gen_uint(values->Buffer1Valid, 13, 13) |
158510e230b6Smaya      __gen_uint(values->Buffer2Valid, 14, 14) |
158610e230b6Smaya      __gen_uint(values->Buffer3Valid, 15, 15) |
158710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
158810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
158910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
159010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
159110e230b6Smaya
159296c5ddc4Srjs   GFX6_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
159310e230b6Smaya}
159410e230b6Smaya
159596c5ddc4Srjs#define GFX6_3DSTATE_CONSTANT_PS_length        5
159696c5ddc4Srjs#define GFX6_3DSTATE_CONSTANT_PS_length_bias      2
159796c5ddc4Srjs#define GFX6_3DSTATE_CONSTANT_PS_header         \
159810e230b6Smaya   .DWordLength                         =      3,  \
159910e230b6Smaya   ._3DCommandSubOpcode                 =     23,  \
160010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
160110e230b6Smaya   .CommandSubType                      =      3,  \
160210e230b6Smaya   .CommandType                         =      3
160310e230b6Smaya
160496c5ddc4Srjsstruct GFX6_3DSTATE_CONSTANT_PS {
160510e230b6Smaya   uint32_t                             DWordLength;
160610e230b6Smaya   uint32_t                             MOCS;
160710e230b6Smaya   bool                                 Buffer0Valid;
160810e230b6Smaya   bool                                 Buffer1Valid;
160910e230b6Smaya   bool                                 Buffer2Valid;
161010e230b6Smaya   bool                                 Buffer3Valid;
161110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
161210e230b6Smaya   uint32_t                             _3DCommandOpcode;
161310e230b6Smaya   uint32_t                             CommandSubType;
161410e230b6Smaya   uint32_t                             CommandType;
161596c5ddc4Srjs   struct GFX6_3DSTATE_CONSTANT_BODY    ConstantBody;
161610e230b6Smaya};
161710e230b6Smaya
161896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
161996c5ddc4SrjsGFX6_3DSTATE_CONSTANT_PS_pack(__attribute__((unused)) __gen_user_data *data,
162010e230b6Smaya                              __attribute__((unused)) void * restrict dst,
162196c5ddc4Srjs                              __attribute__((unused)) const struct GFX6_3DSTATE_CONSTANT_PS * restrict values)
162210e230b6Smaya{
162310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
162410e230b6Smaya
162510e230b6Smaya   dw[0] =
162610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
162710e230b6Smaya      __gen_uint(values->MOCS, 8, 11) |
162810e230b6Smaya      __gen_uint(values->Buffer0Valid, 12, 12) |
162910e230b6Smaya      __gen_uint(values->Buffer1Valid, 13, 13) |
163010e230b6Smaya      __gen_uint(values->Buffer2Valid, 14, 14) |
163110e230b6Smaya      __gen_uint(values->Buffer3Valid, 15, 15) |
163210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
163310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
163410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
163510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
163610e230b6Smaya
163796c5ddc4Srjs   GFX6_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
163810e230b6Smaya}
163910e230b6Smaya
164096c5ddc4Srjs#define GFX6_3DSTATE_CONSTANT_VS_length        5
164196c5ddc4Srjs#define GFX6_3DSTATE_CONSTANT_VS_length_bias      2
164296c5ddc4Srjs#define GFX6_3DSTATE_CONSTANT_VS_header         \
164310e230b6Smaya   .DWordLength                         =      3,  \
164410e230b6Smaya   ._3DCommandSubOpcode                 =     21,  \
164510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
164610e230b6Smaya   .CommandSubType                      =      3,  \
164710e230b6Smaya   .CommandType                         =      3
164810e230b6Smaya
164996c5ddc4Srjsstruct GFX6_3DSTATE_CONSTANT_VS {
165010e230b6Smaya   uint32_t                             DWordLength;
165110e230b6Smaya   uint32_t                             MOCS;
165210e230b6Smaya   bool                                 Buffer0Valid;
165310e230b6Smaya   bool                                 Buffer1Valid;
165410e230b6Smaya   bool                                 Buffer2Valid;
165510e230b6Smaya   bool                                 Buffer3Valid;
165610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
165710e230b6Smaya   uint32_t                             _3DCommandOpcode;
165810e230b6Smaya   uint32_t                             CommandSubType;
165910e230b6Smaya   uint32_t                             CommandType;
166096c5ddc4Srjs   struct GFX6_3DSTATE_CONSTANT_BODY    ConstantBody;
166110e230b6Smaya};
166210e230b6Smaya
166396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
166496c5ddc4SrjsGFX6_3DSTATE_CONSTANT_VS_pack(__attribute__((unused)) __gen_user_data *data,
166510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
166696c5ddc4Srjs                              __attribute__((unused)) const struct GFX6_3DSTATE_CONSTANT_VS * restrict values)
166710e230b6Smaya{
166810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
166910e230b6Smaya
167010e230b6Smaya   dw[0] =
167110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
167210e230b6Smaya      __gen_uint(values->MOCS, 8, 11) |
167310e230b6Smaya      __gen_uint(values->Buffer0Valid, 12, 12) |
167410e230b6Smaya      __gen_uint(values->Buffer1Valid, 13, 13) |
167510e230b6Smaya      __gen_uint(values->Buffer2Valid, 14, 14) |
167610e230b6Smaya      __gen_uint(values->Buffer3Valid, 15, 15) |
167710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
167810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
167910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
168010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
168110e230b6Smaya
168296c5ddc4Srjs   GFX6_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
168310e230b6Smaya}
168410e230b6Smaya
168596c5ddc4Srjs#define GFX6_3DSTATE_DEPTH_BUFFER_length       7
168696c5ddc4Srjs#define GFX6_3DSTATE_DEPTH_BUFFER_length_bias      2
168796c5ddc4Srjs#define GFX6_3DSTATE_DEPTH_BUFFER_header        \
168810e230b6Smaya   .DWordLength                         =      5,  \
168910e230b6Smaya   ._3DCommandSubOpcode                 =      5,  \
169010e230b6Smaya   ._3DCommandOpcode                    =      1,  \
169110e230b6Smaya   .CommandSubType                      =      3,  \
169210e230b6Smaya   .CommandType                         =      3
169310e230b6Smaya
169496c5ddc4Srjsstruct GFX6_3DSTATE_DEPTH_BUFFER {
169510e230b6Smaya   uint32_t                             DWordLength;
169610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
169710e230b6Smaya   uint32_t                             _3DCommandOpcode;
169810e230b6Smaya   uint32_t                             CommandSubType;
169910e230b6Smaya   uint32_t                             CommandType;
170010e230b6Smaya   uint32_t                             SurfacePitch;
170110e230b6Smaya   uint32_t                             SurfaceFormat;
170210e230b6Smaya#define D32_FLOAT_S8X24_UINT                     0
170310e230b6Smaya#define D32_FLOAT                                1
170410e230b6Smaya#define D24_UNORM_S8_UINT                        2
170510e230b6Smaya#define D24_UNORM_X8_UINT                        3
170610e230b6Smaya#define D16_UNORM                                5
170710e230b6Smaya   bool                                 SeparateStencilBufferEnable;
170810e230b6Smaya   bool                                 HierarchicalDepthBufferEnable;
170910e230b6Smaya   uint32_t                             SoftwareTiledRenderingMode;
171010e230b6Smaya#define NORMAL                                   0
171110e230b6Smaya#define STR1                                     1
171210e230b6Smaya#define STR2                                     3
171310e230b6Smaya   uint32_t                             TileWalk;
171410e230b6Smaya#define TILEWALK_YMAJOR                          1
171510e230b6Smaya   bool                                 TiledSurface;
171610e230b6Smaya   uint32_t                             SurfaceType;
171710e230b6Smaya#define SURFTYPE_1D                              0
171810e230b6Smaya#define SURFTYPE_2D                              1
171910e230b6Smaya#define SURFTYPE_3D                              2
172010e230b6Smaya#define SURFTYPE_CUBE                            3
172110e230b6Smaya#define SURFTYPE_NULL                            7
172210e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
172310e230b6Smaya   uint32_t                             MIPMapLayoutMode;
172410e230b6Smaya#define MIPLAYOUT_BELOW                          0
172510e230b6Smaya#define MIPLAYOUT_RIGHT                          1
172610e230b6Smaya   uint32_t                             LOD;
172710e230b6Smaya   uint32_t                             Width;
172810e230b6Smaya   uint32_t                             Height;
172910e230b6Smaya   uint32_t                             RenderTargetViewExtent;
173010e230b6Smaya   uint32_t                             MinimumArrayElement;
173110e230b6Smaya   uint32_t                             Depth;
173210e230b6Smaya   int32_t                              DepthCoordinateOffsetX;
173310e230b6Smaya   int32_t                              DepthCoordinateOffsetY;
173410e230b6Smaya   uint32_t                             MOCS;
173510e230b6Smaya};
173610e230b6Smaya
173796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
173896c5ddc4SrjsGFX6_3DSTATE_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
173910e230b6Smaya                               __attribute__((unused)) void * restrict dst,
174096c5ddc4Srjs                               __attribute__((unused)) const struct GFX6_3DSTATE_DEPTH_BUFFER * restrict values)
174110e230b6Smaya{
174210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
174310e230b6Smaya
174410e230b6Smaya   dw[0] =
174510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
174610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
174710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
174810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
174910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
175010e230b6Smaya
175110e230b6Smaya   dw[1] =
175210e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 16) |
175310e230b6Smaya      __gen_uint(values->SurfaceFormat, 18, 20) |
175410e230b6Smaya      __gen_uint(values->SeparateStencilBufferEnable, 21, 21) |
175510e230b6Smaya      __gen_uint(values->HierarchicalDepthBufferEnable, 22, 22) |
175610e230b6Smaya      __gen_uint(values->SoftwareTiledRenderingMode, 23, 24) |
175710e230b6Smaya      __gen_uint(values->TileWalk, 26, 26) |
175810e230b6Smaya      __gen_uint(values->TiledSurface, 27, 27) |
175910e230b6Smaya      __gen_uint(values->SurfaceType, 29, 31);
176010e230b6Smaya
176196c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 0, 31);
176210e230b6Smaya
176310e230b6Smaya   dw[3] =
176410e230b6Smaya      __gen_uint(values->MIPMapLayoutMode, 1, 1) |
176510e230b6Smaya      __gen_uint(values->LOD, 2, 5) |
176610e230b6Smaya      __gen_uint(values->Width, 6, 18) |
176710e230b6Smaya      __gen_uint(values->Height, 19, 31);
176810e230b6Smaya
176910e230b6Smaya   dw[4] =
177010e230b6Smaya      __gen_uint(values->RenderTargetViewExtent, 1, 9) |
177110e230b6Smaya      __gen_uint(values->MinimumArrayElement, 10, 20) |
177210e230b6Smaya      __gen_uint(values->Depth, 21, 31);
177310e230b6Smaya
177410e230b6Smaya   dw[5] =
177510e230b6Smaya      __gen_sint(values->DepthCoordinateOffsetX, 0, 15) |
177610e230b6Smaya      __gen_sint(values->DepthCoordinateOffsetY, 16, 31);
177710e230b6Smaya
177810e230b6Smaya   dw[6] =
177910e230b6Smaya      __gen_uint(values->MOCS, 27, 31);
178010e230b6Smaya}
178110e230b6Smaya
178296c5ddc4Srjs#define GFX6_3DSTATE_DRAWING_RECTANGLE_length      4
178396c5ddc4Srjs#define GFX6_3DSTATE_DRAWING_RECTANGLE_length_bias      2
178496c5ddc4Srjs#define GFX6_3DSTATE_DRAWING_RECTANGLE_header   \
178510e230b6Smaya   .DWordLength                         =      2,  \
178610e230b6Smaya   ._3DCommandSubOpcode                 =      0,  \
178710e230b6Smaya   ._3DCommandOpcode                    =      1,  \
178810e230b6Smaya   .CommandSubType                      =      3,  \
178910e230b6Smaya   .CommandType                         =      3
179010e230b6Smaya
179196c5ddc4Srjsstruct GFX6_3DSTATE_DRAWING_RECTANGLE {
179210e230b6Smaya   uint32_t                             DWordLength;
179310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
179410e230b6Smaya   uint32_t                             _3DCommandOpcode;
179510e230b6Smaya   uint32_t                             CommandSubType;
179610e230b6Smaya   uint32_t                             CommandType;
179710e230b6Smaya   uint32_t                             ClippedDrawingRectangleXMin;
179810e230b6Smaya   uint32_t                             ClippedDrawingRectangleYMin;
179910e230b6Smaya   uint32_t                             ClippedDrawingRectangleXMax;
180010e230b6Smaya   uint32_t                             ClippedDrawingRectangleYMax;
180110e230b6Smaya   int32_t                              DrawingRectangleOriginX;
180210e230b6Smaya   int32_t                              DrawingRectangleOriginY;
180310e230b6Smaya};
180410e230b6Smaya
180596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
180696c5ddc4SrjsGFX6_3DSTATE_DRAWING_RECTANGLE_pack(__attribute__((unused)) __gen_user_data *data,
180710e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
180896c5ddc4Srjs                                    __attribute__((unused)) const struct GFX6_3DSTATE_DRAWING_RECTANGLE * restrict values)
180910e230b6Smaya{
181010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
181110e230b6Smaya
181210e230b6Smaya   dw[0] =
181310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
181410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
181510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
181610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
181710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
181810e230b6Smaya
181910e230b6Smaya   dw[1] =
182010e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleXMin, 0, 15) |
182110e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleYMin, 16, 31);
182210e230b6Smaya
182310e230b6Smaya   dw[2] =
182410e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleXMax, 0, 15) |
182510e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleYMax, 16, 31);
182610e230b6Smaya
182710e230b6Smaya   dw[3] =
182810e230b6Smaya      __gen_sint(values->DrawingRectangleOriginX, 0, 15) |
182910e230b6Smaya      __gen_sint(values->DrawingRectangleOriginY, 16, 31);
183010e230b6Smaya}
183110e230b6Smaya
183296c5ddc4Srjs#define GFX6_3DSTATE_GS_length                 7
183396c5ddc4Srjs#define GFX6_3DSTATE_GS_length_bias            2
183496c5ddc4Srjs#define GFX6_3DSTATE_GS_header                  \
183510e230b6Smaya   .DWordLength                         =      5,  \
183610e230b6Smaya   ._3DCommandSubOpcode                 =     17,  \
183710e230b6Smaya   ._3DCommandOpcode                    =      0,  \
183810e230b6Smaya   .CommandSubType                      =      3,  \
183910e230b6Smaya   .CommandType                         =      3
184010e230b6Smaya
184196c5ddc4Srjsstruct GFX6_3DSTATE_GS {
184210e230b6Smaya   uint32_t                             DWordLength;
184310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
184410e230b6Smaya   uint32_t                             _3DCommandOpcode;
184510e230b6Smaya   uint32_t                             CommandSubType;
184610e230b6Smaya   uint32_t                             CommandType;
184710e230b6Smaya   uint64_t                             KernelStartPointer;
184810e230b6Smaya   bool                                 SoftwareExceptionEnable;
184910e230b6Smaya   bool                                 MaskStackExceptionEnable;
185010e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
185110e230b6Smaya   uint32_t                             FloatingPointMode;
185210e230b6Smaya#define IEEE754                                  0
185310e230b6Smaya#define Alternate                                1
185410e230b6Smaya   uint32_t                             ThreadPriority;
185510e230b6Smaya#define NormalPriority                           0
185610e230b6Smaya#define HighPriority                             1
185710e230b6Smaya   uint32_t                             BindingTableEntryCount;
185810e230b6Smaya   uint32_t                             SamplerCount;
185910e230b6Smaya#define NoSamplers                               0
186010e230b6Smaya#define _14Samplers                              1
186110e230b6Smaya#define _58Samplers                              2
186210e230b6Smaya#define _912Samplers                             3
186310e230b6Smaya#define _1316Samplers                            4
186410e230b6Smaya   bool                                 VectorMaskEnable;
186510e230b6Smaya   bool                                 SingleProgramFlow;
186610e230b6Smaya   uint32_t                             PerThreadScratchSpace;
186710e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
186810e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData;
186910e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
187010e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
187110e230b6Smaya   uint32_t                             RenderingEnabled;
187210e230b6Smaya   bool                                 SOStatisticsEnable;
187310e230b6Smaya   bool                                 StatisticsEnable;
187410e230b6Smaya   uint32_t                             MaximumNumberofThreads;
187510e230b6Smaya   bool                                 Enable;
187610e230b6Smaya   uint32_t                             SVBIPostIncrementValue;
187710e230b6Smaya   bool                                 SVBIPostIncrementEnable;
187810e230b6Smaya   bool                                 SVBIPayloadEnable;
187910e230b6Smaya   bool                                 DiscardAdjacency;
188010e230b6Smaya   uint32_t                             ReorderMode;
188110e230b6Smaya#define LEADING                                  0
188210e230b6Smaya#define TRAILING                                 1
188310e230b6Smaya};
188410e230b6Smaya
188596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
188696c5ddc4SrjsGFX6_3DSTATE_GS_pack(__attribute__((unused)) __gen_user_data *data,
188710e230b6Smaya                     __attribute__((unused)) void * restrict dst,
188896c5ddc4Srjs                     __attribute__((unused)) const struct GFX6_3DSTATE_GS * restrict values)
188910e230b6Smaya{
189010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
189110e230b6Smaya
189210e230b6Smaya   dw[0] =
189310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
189410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
189510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
189610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
189710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
189810e230b6Smaya
189910e230b6Smaya   dw[1] =
190010e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 31);
190110e230b6Smaya
190210e230b6Smaya   dw[2] =
190310e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
190410e230b6Smaya      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
190510e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
190610e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
190710e230b6Smaya      __gen_uint(values->ThreadPriority, 17, 17) |
190810e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
190910e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
191010e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
191110e230b6Smaya      __gen_uint(values->SingleProgramFlow, 31, 31);
191210e230b6Smaya
191310e230b6Smaya   const uint32_t v3 =
191410e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
191596c5ddc4Srjs   dw[3] = __gen_address(data, &dw[3], values->ScratchSpaceBasePointer, v3, 10, 31);
191610e230b6Smaya
191710e230b6Smaya   dw[4] =
191810e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData, 0, 3) |
191910e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
192010e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 16);
192110e230b6Smaya
192210e230b6Smaya   dw[5] =
192310e230b6Smaya      __gen_uint(values->RenderingEnabled, 8, 8) |
192410e230b6Smaya      __gen_uint(values->SOStatisticsEnable, 9, 9) |
192510e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
192610e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 25, 31);
192710e230b6Smaya
192810e230b6Smaya   dw[6] =
192910e230b6Smaya      __gen_uint(values->Enable, 15, 15) |
193010e230b6Smaya      __gen_uint(values->SVBIPostIncrementValue, 16, 25) |
193110e230b6Smaya      __gen_uint(values->SVBIPostIncrementEnable, 27, 27) |
193210e230b6Smaya      __gen_uint(values->SVBIPayloadEnable, 28, 28) |
193310e230b6Smaya      __gen_uint(values->DiscardAdjacency, 29, 29) |
193410e230b6Smaya      __gen_uint(values->ReorderMode, 30, 30);
193510e230b6Smaya}
193610e230b6Smaya
193796c5ddc4Srjs#define GFX6_3DSTATE_GS_SVB_INDEX_length       4
193896c5ddc4Srjs#define GFX6_3DSTATE_GS_SVB_INDEX_length_bias      2
193996c5ddc4Srjs#define GFX6_3DSTATE_GS_SVB_INDEX_header        \
194096c5ddc4Srjs   .DWordLength                         =      2,  \
194110e230b6Smaya   ._3DCommandSubOpcode                 =     11,  \
194210e230b6Smaya   ._3DCommandOpcode                    =      1,  \
194310e230b6Smaya   .CommandSubType                      =      3,  \
194410e230b6Smaya   .CommandType                         =      3
194510e230b6Smaya
194696c5ddc4Srjsstruct GFX6_3DSTATE_GS_SVB_INDEX {
194710e230b6Smaya   uint32_t                             DWordLength;
194810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
194910e230b6Smaya   uint32_t                             _3DCommandOpcode;
195010e230b6Smaya   uint32_t                             CommandSubType;
195110e230b6Smaya   uint32_t                             CommandType;
195210e230b6Smaya   uint32_t                             LoadInternalVertexCount;
195310e230b6Smaya   uint32_t                             IndexNumber;
195410e230b6Smaya   uint32_t                             StreamedVertexBufferIndex;
195510e230b6Smaya   uint32_t                             MaximumIndex;
195610e230b6Smaya};
195710e230b6Smaya
195896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
195996c5ddc4SrjsGFX6_3DSTATE_GS_SVB_INDEX_pack(__attribute__((unused)) __gen_user_data *data,
196010e230b6Smaya                               __attribute__((unused)) void * restrict dst,
196196c5ddc4Srjs                               __attribute__((unused)) const struct GFX6_3DSTATE_GS_SVB_INDEX * restrict values)
196210e230b6Smaya{
196310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
196410e230b6Smaya
196510e230b6Smaya   dw[0] =
196610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
196710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
196810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
196910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
197010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
197110e230b6Smaya
197210e230b6Smaya   dw[1] =
197310e230b6Smaya      __gen_uint(values->LoadInternalVertexCount, 0, 0) |
197410e230b6Smaya      __gen_uint(values->IndexNumber, 29, 30);
197510e230b6Smaya
197610e230b6Smaya   dw[2] =
197710e230b6Smaya      __gen_uint(values->StreamedVertexBufferIndex, 0, 31);
197810e230b6Smaya
197910e230b6Smaya   dw[3] =
198010e230b6Smaya      __gen_uint(values->MaximumIndex, 0, 31);
198110e230b6Smaya}
198210e230b6Smaya
198396c5ddc4Srjs#define GFX6_3DSTATE_HIER_DEPTH_BUFFER_length      3
198496c5ddc4Srjs#define GFX6_3DSTATE_HIER_DEPTH_BUFFER_length_bias      2
198596c5ddc4Srjs#define GFX6_3DSTATE_HIER_DEPTH_BUFFER_header   \
198610e230b6Smaya   .DWordLength                         =      1,  \
198710e230b6Smaya   ._3DCommandSubOpcode                 =     15,  \
198810e230b6Smaya   ._3DCommandOpcode                    =      1,  \
198910e230b6Smaya   .CommandSubType                      =      3,  \
199010e230b6Smaya   .CommandType                         =      3
199110e230b6Smaya
199296c5ddc4Srjsstruct GFX6_3DSTATE_HIER_DEPTH_BUFFER {
199310e230b6Smaya   uint32_t                             DWordLength;
199410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
199510e230b6Smaya   uint32_t                             _3DCommandOpcode;
199610e230b6Smaya   uint32_t                             CommandSubType;
199710e230b6Smaya   uint32_t                             CommandType;
199810e230b6Smaya   uint32_t                             SurfacePitch;
199910e230b6Smaya   uint32_t                             MOCS;
200010e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
200110e230b6Smaya};
200210e230b6Smaya
200396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
200496c5ddc4SrjsGFX6_3DSTATE_HIER_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
200510e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
200696c5ddc4Srjs                                    __attribute__((unused)) const struct GFX6_3DSTATE_HIER_DEPTH_BUFFER * restrict values)
200710e230b6Smaya{
200810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
200910e230b6Smaya
201010e230b6Smaya   dw[0] =
201110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
201210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
201310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
201410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
201510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
201610e230b6Smaya
201710e230b6Smaya   dw[1] =
201810e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 16) |
201910e230b6Smaya      __gen_uint(values->MOCS, 25, 28);
202010e230b6Smaya
202196c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 0, 31);
202210e230b6Smaya}
202310e230b6Smaya
202496c5ddc4Srjs#define GFX6_3DSTATE_INDEX_BUFFER_length       3
202596c5ddc4Srjs#define GFX6_3DSTATE_INDEX_BUFFER_length_bias      2
202696c5ddc4Srjs#define GFX6_3DSTATE_INDEX_BUFFER_header        \
202710e230b6Smaya   .DWordLength                         =      1,  \
202810e230b6Smaya   ._3DCommandSubOpcode                 =     10,  \
202910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
203010e230b6Smaya   .CommandSubType                      =      3,  \
203110e230b6Smaya   .CommandType                         =      3
203210e230b6Smaya
203396c5ddc4Srjsstruct GFX6_3DSTATE_INDEX_BUFFER {
203410e230b6Smaya   uint32_t                             DWordLength;
203510e230b6Smaya   uint32_t                             IndexFormat;
203610e230b6Smaya#define INDEX_BYTE                               0
203710e230b6Smaya#define INDEX_WORD                               1
203810e230b6Smaya#define INDEX_DWORD                              2
203910e230b6Smaya   bool                                 CutIndexEnable;
204010e230b6Smaya   uint32_t                             MOCS;
204110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
204210e230b6Smaya   uint32_t                             _3DCommandOpcode;
204310e230b6Smaya   uint32_t                             CommandSubType;
204410e230b6Smaya   uint32_t                             CommandType;
204510e230b6Smaya   __gen_address_type                   BufferStartingAddress;
204610e230b6Smaya   __gen_address_type                   BufferEndingAddress;
204710e230b6Smaya};
204810e230b6Smaya
204996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
205096c5ddc4SrjsGFX6_3DSTATE_INDEX_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
205110e230b6Smaya                               __attribute__((unused)) void * restrict dst,
205296c5ddc4Srjs                               __attribute__((unused)) const struct GFX6_3DSTATE_INDEX_BUFFER * restrict values)
205310e230b6Smaya{
205410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
205510e230b6Smaya
205610e230b6Smaya   dw[0] =
205710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
205810e230b6Smaya      __gen_uint(values->IndexFormat, 8, 9) |
205910e230b6Smaya      __gen_uint(values->CutIndexEnable, 10, 10) |
206010e230b6Smaya      __gen_uint(values->MOCS, 12, 15) |
206110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
206210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
206310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
206410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
206510e230b6Smaya
206696c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->BufferStartingAddress, 0, 0, 31);
206710e230b6Smaya
206896c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->BufferEndingAddress, 0, 0, 31);
206910e230b6Smaya}
207010e230b6Smaya
207196c5ddc4Srjs#define GFX6_3DSTATE_LINE_STIPPLE_length       3
207296c5ddc4Srjs#define GFX6_3DSTATE_LINE_STIPPLE_length_bias      2
207396c5ddc4Srjs#define GFX6_3DSTATE_LINE_STIPPLE_header        \
207410e230b6Smaya   .DWordLength                         =      1,  \
207510e230b6Smaya   ._3DCommandSubOpcode                 =      8,  \
207610e230b6Smaya   ._3DCommandOpcode                    =      1,  \
207710e230b6Smaya   .CommandSubType                      =      3,  \
207810e230b6Smaya   .CommandType                         =      3
207910e230b6Smaya
208096c5ddc4Srjsstruct GFX6_3DSTATE_LINE_STIPPLE {
208110e230b6Smaya   uint32_t                             DWordLength;
208210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
208310e230b6Smaya   uint32_t                             _3DCommandOpcode;
208410e230b6Smaya   uint32_t                             CommandSubType;
208510e230b6Smaya   uint32_t                             CommandType;
208610e230b6Smaya   uint32_t                             LineStipplePattern;
208710e230b6Smaya   uint32_t                             CurrentStippleIndex;
208810e230b6Smaya   uint32_t                             CurrentRepeatCounter;
208910e230b6Smaya   bool                                 ModifyEnableCurrentRepeatCounterCurrentStippleIndex;
209010e230b6Smaya   uint32_t                             LineStippleRepeatCount;
209110e230b6Smaya   float                                LineStippleInverseRepeatCount;
209210e230b6Smaya};
209310e230b6Smaya
209496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
209596c5ddc4SrjsGFX6_3DSTATE_LINE_STIPPLE_pack(__attribute__((unused)) __gen_user_data *data,
209610e230b6Smaya                               __attribute__((unused)) void * restrict dst,
209796c5ddc4Srjs                               __attribute__((unused)) const struct GFX6_3DSTATE_LINE_STIPPLE * restrict values)
209810e230b6Smaya{
209910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
210010e230b6Smaya
210110e230b6Smaya   dw[0] =
210210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
210310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
210410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
210510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
210610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
210710e230b6Smaya
210810e230b6Smaya   dw[1] =
210910e230b6Smaya      __gen_uint(values->LineStipplePattern, 0, 15) |
211010e230b6Smaya      __gen_uint(values->CurrentStippleIndex, 16, 19) |
211110e230b6Smaya      __gen_uint(values->CurrentRepeatCounter, 21, 29) |
211210e230b6Smaya      __gen_uint(values->ModifyEnableCurrentRepeatCounterCurrentStippleIndex, 31, 31);
211310e230b6Smaya
211410e230b6Smaya   dw[2] =
211510e230b6Smaya      __gen_uint(values->LineStippleRepeatCount, 0, 8) |
211610e230b6Smaya      __gen_ufixed(values->LineStippleInverseRepeatCount, 16, 31, 13);
211710e230b6Smaya}
211810e230b6Smaya
211996c5ddc4Srjs#define GFX6_3DSTATE_MONOFILTER_SIZE_length      2
212096c5ddc4Srjs#define GFX6_3DSTATE_MONOFILTER_SIZE_length_bias      2
212196c5ddc4Srjs#define GFX6_3DSTATE_MONOFILTER_SIZE_header     \
212210e230b6Smaya   .DWordLength                         =      0,  \
212310e230b6Smaya   ._3DCommandSubOpcode                 =     17,  \
212410e230b6Smaya   ._3DCommandOpcode                    =      1,  \
212510e230b6Smaya   .CommandSubType                      =      3,  \
212610e230b6Smaya   .CommandType                         =      3
212710e230b6Smaya
212896c5ddc4Srjsstruct GFX6_3DSTATE_MONOFILTER_SIZE {
212910e230b6Smaya   uint32_t                             DWordLength;
213010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
213110e230b6Smaya   uint32_t                             _3DCommandOpcode;
213210e230b6Smaya   uint32_t                             CommandSubType;
213310e230b6Smaya   uint32_t                             CommandType;
213410e230b6Smaya   uint32_t                             MonochromeFilterHeight;
213510e230b6Smaya   uint32_t                             MonochromeFilterWidth;
213610e230b6Smaya};
213710e230b6Smaya
213896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
213996c5ddc4SrjsGFX6_3DSTATE_MONOFILTER_SIZE_pack(__attribute__((unused)) __gen_user_data *data,
214010e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
214196c5ddc4Srjs                                  __attribute__((unused)) const struct GFX6_3DSTATE_MONOFILTER_SIZE * restrict values)
214210e230b6Smaya{
214310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
214410e230b6Smaya
214510e230b6Smaya   dw[0] =
214610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
214710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
214810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
214910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
215010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
215110e230b6Smaya
215210e230b6Smaya   dw[1] =
215310e230b6Smaya      __gen_uint(values->MonochromeFilterHeight, 0, 2) |
215410e230b6Smaya      __gen_uint(values->MonochromeFilterWidth, 3, 5);
215510e230b6Smaya}
215610e230b6Smaya
215796c5ddc4Srjs#define GFX6_3DSTATE_MULTISAMPLE_length        3
215896c5ddc4Srjs#define GFX6_3DSTATE_MULTISAMPLE_length_bias      2
215996c5ddc4Srjs#define GFX6_3DSTATE_MULTISAMPLE_header         \
216010e230b6Smaya   .DWordLength                         =      1,  \
216110e230b6Smaya   ._3DCommandSubOpcode                 =     13,  \
216210e230b6Smaya   ._3DCommandOpcode                    =      1,  \
216310e230b6Smaya   .CommandSubType                      =      3,  \
216410e230b6Smaya   .CommandType                         =      3
216510e230b6Smaya
216696c5ddc4Srjsstruct GFX6_3DSTATE_MULTISAMPLE {
216710e230b6Smaya   uint32_t                             DWordLength;
216810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
216910e230b6Smaya   uint32_t                             _3DCommandOpcode;
217010e230b6Smaya   uint32_t                             CommandSubType;
217110e230b6Smaya   uint32_t                             CommandType;
217210e230b6Smaya   uint32_t                             NumberofMultisamples;
217310e230b6Smaya#define NUMSAMPLES_1                             0
217410e230b6Smaya#define NUMSAMPLES_4                             2
217510e230b6Smaya   uint32_t                             PixelLocation;
217610e230b6Smaya#define CENTER                                   0
217710e230b6Smaya#define UL_CORNER                                1
217810e230b6Smaya   float                                Sample0YOffset;
217910e230b6Smaya   float                                Sample0XOffset;
218010e230b6Smaya   float                                Sample1YOffset;
218110e230b6Smaya   float                                Sample1XOffset;
218210e230b6Smaya   float                                Sample2YOffset;
218310e230b6Smaya   float                                Sample2XOffset;
218410e230b6Smaya   float                                Sample3YOffset;
218510e230b6Smaya   float                                Sample3XOffset;
218610e230b6Smaya};
218710e230b6Smaya
218896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
218996c5ddc4SrjsGFX6_3DSTATE_MULTISAMPLE_pack(__attribute__((unused)) __gen_user_data *data,
219010e230b6Smaya                              __attribute__((unused)) void * restrict dst,
219196c5ddc4Srjs                              __attribute__((unused)) const struct GFX6_3DSTATE_MULTISAMPLE * restrict values)
219210e230b6Smaya{
219310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
219410e230b6Smaya
219510e230b6Smaya   dw[0] =
219610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
219710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
219810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
219910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
220010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
220110e230b6Smaya
220210e230b6Smaya   dw[1] =
220310e230b6Smaya      __gen_uint(values->NumberofMultisamples, 1, 3) |
220410e230b6Smaya      __gen_uint(values->PixelLocation, 4, 4);
220510e230b6Smaya
220610e230b6Smaya   dw[2] =
220710e230b6Smaya      __gen_ufixed(values->Sample0YOffset, 0, 3, 4) |
220810e230b6Smaya      __gen_ufixed(values->Sample0XOffset, 4, 7, 4) |
220910e230b6Smaya      __gen_ufixed(values->Sample1YOffset, 8, 11, 4) |
221010e230b6Smaya      __gen_ufixed(values->Sample1XOffset, 12, 15, 4) |
221110e230b6Smaya      __gen_ufixed(values->Sample2YOffset, 16, 19, 4) |
221210e230b6Smaya      __gen_ufixed(values->Sample2XOffset, 20, 23, 4) |
221310e230b6Smaya      __gen_ufixed(values->Sample3YOffset, 24, 27, 4) |
221410e230b6Smaya      __gen_ufixed(values->Sample3XOffset, 28, 31, 4);
221510e230b6Smaya}
221610e230b6Smaya
221796c5ddc4Srjs#define GFX6_3DSTATE_POLY_STIPPLE_OFFSET_length      2
221896c5ddc4Srjs#define GFX6_3DSTATE_POLY_STIPPLE_OFFSET_length_bias      2
221996c5ddc4Srjs#define GFX6_3DSTATE_POLY_STIPPLE_OFFSET_header \
222010e230b6Smaya   .DWordLength                         =      0,  \
222110e230b6Smaya   ._3DCommandSubOpcode                 =      6,  \
222210e230b6Smaya   ._3DCommandOpcode                    =      1,  \
222310e230b6Smaya   .CommandSubType                      =      3,  \
222410e230b6Smaya   .CommandType                         =      3
222510e230b6Smaya
222696c5ddc4Srjsstruct GFX6_3DSTATE_POLY_STIPPLE_OFFSET {
222710e230b6Smaya   uint32_t                             DWordLength;
222810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
222910e230b6Smaya   uint32_t                             _3DCommandOpcode;
223010e230b6Smaya   uint32_t                             CommandSubType;
223110e230b6Smaya   uint32_t                             CommandType;
223210e230b6Smaya   uint32_t                             PolygonStippleYOffset;
223310e230b6Smaya   uint32_t                             PolygonStippleXOffset;
223410e230b6Smaya};
223510e230b6Smaya
223696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
223796c5ddc4SrjsGFX6_3DSTATE_POLY_STIPPLE_OFFSET_pack(__attribute__((unused)) __gen_user_data *data,
223810e230b6Smaya                                      __attribute__((unused)) void * restrict dst,
223996c5ddc4Srjs                                      __attribute__((unused)) const struct GFX6_3DSTATE_POLY_STIPPLE_OFFSET * restrict values)
224010e230b6Smaya{
224110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
224210e230b6Smaya
224310e230b6Smaya   dw[0] =
224410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
224510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
224610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
224710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
224810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
224910e230b6Smaya
225010e230b6Smaya   dw[1] =
225110e230b6Smaya      __gen_uint(values->PolygonStippleYOffset, 0, 4) |
225210e230b6Smaya      __gen_uint(values->PolygonStippleXOffset, 8, 12);
225310e230b6Smaya}
225410e230b6Smaya
225596c5ddc4Srjs#define GFX6_3DSTATE_POLY_STIPPLE_PATTERN_length     33
225696c5ddc4Srjs#define GFX6_3DSTATE_POLY_STIPPLE_PATTERN_length_bias      2
225796c5ddc4Srjs#define GFX6_3DSTATE_POLY_STIPPLE_PATTERN_header\
225810e230b6Smaya   .DWordLength                         =     31,  \
225910e230b6Smaya   ._3DCommandSubOpcode                 =      7,  \
226010e230b6Smaya   ._3DCommandOpcode                    =      1,  \
226110e230b6Smaya   .CommandSubType                      =      3,  \
226210e230b6Smaya   .CommandType                         =      3
226310e230b6Smaya
226496c5ddc4Srjsstruct GFX6_3DSTATE_POLY_STIPPLE_PATTERN {
226510e230b6Smaya   uint32_t                             DWordLength;
226610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
226710e230b6Smaya   uint32_t                             _3DCommandOpcode;
226810e230b6Smaya   uint32_t                             CommandSubType;
226910e230b6Smaya   uint32_t                             CommandType;
227010e230b6Smaya   uint32_t                             PatternRow[32];
227110e230b6Smaya};
227210e230b6Smaya
227396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
227496c5ddc4SrjsGFX6_3DSTATE_POLY_STIPPLE_PATTERN_pack(__attribute__((unused)) __gen_user_data *data,
227510e230b6Smaya                                       __attribute__((unused)) void * restrict dst,
227696c5ddc4Srjs                                       __attribute__((unused)) const struct GFX6_3DSTATE_POLY_STIPPLE_PATTERN * restrict values)
227710e230b6Smaya{
227810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
227910e230b6Smaya
228010e230b6Smaya   dw[0] =
228110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
228210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
228310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
228410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
228510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
228610e230b6Smaya
228710e230b6Smaya   dw[1] =
228810e230b6Smaya      __gen_uint(values->PatternRow[0], 0, 31);
228910e230b6Smaya
229010e230b6Smaya   dw[2] =
229110e230b6Smaya      __gen_uint(values->PatternRow[1], 0, 31);
229210e230b6Smaya
229310e230b6Smaya   dw[3] =
229410e230b6Smaya      __gen_uint(values->PatternRow[2], 0, 31);
229510e230b6Smaya
229610e230b6Smaya   dw[4] =
229710e230b6Smaya      __gen_uint(values->PatternRow[3], 0, 31);
229810e230b6Smaya
229910e230b6Smaya   dw[5] =
230010e230b6Smaya      __gen_uint(values->PatternRow[4], 0, 31);
230110e230b6Smaya
230210e230b6Smaya   dw[6] =
230310e230b6Smaya      __gen_uint(values->PatternRow[5], 0, 31);
230410e230b6Smaya
230510e230b6Smaya   dw[7] =
230610e230b6Smaya      __gen_uint(values->PatternRow[6], 0, 31);
230710e230b6Smaya
230810e230b6Smaya   dw[8] =
230910e230b6Smaya      __gen_uint(values->PatternRow[7], 0, 31);
231010e230b6Smaya
231110e230b6Smaya   dw[9] =
231210e230b6Smaya      __gen_uint(values->PatternRow[8], 0, 31);
231310e230b6Smaya
231410e230b6Smaya   dw[10] =
231510e230b6Smaya      __gen_uint(values->PatternRow[9], 0, 31);
231610e230b6Smaya
231710e230b6Smaya   dw[11] =
231810e230b6Smaya      __gen_uint(values->PatternRow[10], 0, 31);
231910e230b6Smaya
232010e230b6Smaya   dw[12] =
232110e230b6Smaya      __gen_uint(values->PatternRow[11], 0, 31);
232210e230b6Smaya
232310e230b6Smaya   dw[13] =
232410e230b6Smaya      __gen_uint(values->PatternRow[12], 0, 31);
232510e230b6Smaya
232610e230b6Smaya   dw[14] =
232710e230b6Smaya      __gen_uint(values->PatternRow[13], 0, 31);
232810e230b6Smaya
232910e230b6Smaya   dw[15] =
233010e230b6Smaya      __gen_uint(values->PatternRow[14], 0, 31);
233110e230b6Smaya
233210e230b6Smaya   dw[16] =
233310e230b6Smaya      __gen_uint(values->PatternRow[15], 0, 31);
233410e230b6Smaya
233510e230b6Smaya   dw[17] =
233610e230b6Smaya      __gen_uint(values->PatternRow[16], 0, 31);
233710e230b6Smaya
233810e230b6Smaya   dw[18] =
233910e230b6Smaya      __gen_uint(values->PatternRow[17], 0, 31);
234010e230b6Smaya
234110e230b6Smaya   dw[19] =
234210e230b6Smaya      __gen_uint(values->PatternRow[18], 0, 31);
234310e230b6Smaya
234410e230b6Smaya   dw[20] =
234510e230b6Smaya      __gen_uint(values->PatternRow[19], 0, 31);
234610e230b6Smaya
234710e230b6Smaya   dw[21] =
234810e230b6Smaya      __gen_uint(values->PatternRow[20], 0, 31);
234910e230b6Smaya
235010e230b6Smaya   dw[22] =
235110e230b6Smaya      __gen_uint(values->PatternRow[21], 0, 31);
235210e230b6Smaya
235310e230b6Smaya   dw[23] =
235410e230b6Smaya      __gen_uint(values->PatternRow[22], 0, 31);
235510e230b6Smaya
235610e230b6Smaya   dw[24] =
235710e230b6Smaya      __gen_uint(values->PatternRow[23], 0, 31);
235810e230b6Smaya
235910e230b6Smaya   dw[25] =
236010e230b6Smaya      __gen_uint(values->PatternRow[24], 0, 31);
236110e230b6Smaya
236210e230b6Smaya   dw[26] =
236310e230b6Smaya      __gen_uint(values->PatternRow[25], 0, 31);
236410e230b6Smaya
236510e230b6Smaya   dw[27] =
236610e230b6Smaya      __gen_uint(values->PatternRow[26], 0, 31);
236710e230b6Smaya
236810e230b6Smaya   dw[28] =
236910e230b6Smaya      __gen_uint(values->PatternRow[27], 0, 31);
237010e230b6Smaya
237110e230b6Smaya   dw[29] =
237210e230b6Smaya      __gen_uint(values->PatternRow[28], 0, 31);
237310e230b6Smaya
237410e230b6Smaya   dw[30] =
237510e230b6Smaya      __gen_uint(values->PatternRow[29], 0, 31);
237610e230b6Smaya
237710e230b6Smaya   dw[31] =
237810e230b6Smaya      __gen_uint(values->PatternRow[30], 0, 31);
237910e230b6Smaya
238010e230b6Smaya   dw[32] =
238110e230b6Smaya      __gen_uint(values->PatternRow[31], 0, 31);
238210e230b6Smaya}
238310e230b6Smaya
238496c5ddc4Srjs#define GFX6_3DSTATE_SAMPLER_PALETTE_LOAD0_length_bias      2
238596c5ddc4Srjs#define GFX6_3DSTATE_SAMPLER_PALETTE_LOAD0_header\
238610e230b6Smaya   ._3DCommandSubOpcode                 =      2,  \
238710e230b6Smaya   ._3DCommandOpcode                    =      1,  \
238810e230b6Smaya   .CommandSubType                      =      3,  \
238910e230b6Smaya   .CommandType                         =      3
239010e230b6Smaya
239196c5ddc4Srjsstruct GFX6_3DSTATE_SAMPLER_PALETTE_LOAD0 {
239210e230b6Smaya   uint32_t                             DWordLength;
239310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
239410e230b6Smaya   uint32_t                             _3DCommandOpcode;
239510e230b6Smaya   uint32_t                             CommandSubType;
239610e230b6Smaya   uint32_t                             CommandType;
239710e230b6Smaya   /* variable length fields follow */
239810e230b6Smaya};
239910e230b6Smaya
240096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
240196c5ddc4SrjsGFX6_3DSTATE_SAMPLER_PALETTE_LOAD0_pack(__attribute__((unused)) __gen_user_data *data,
240210e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
240396c5ddc4Srjs                                        __attribute__((unused)) const struct GFX6_3DSTATE_SAMPLER_PALETTE_LOAD0 * restrict values)
240410e230b6Smaya{
240510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
240610e230b6Smaya
240710e230b6Smaya   dw[0] =
240810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
240910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
241010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
241110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
241210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
241310e230b6Smaya}
241410e230b6Smaya
241596c5ddc4Srjs#define GFX6_3DSTATE_SAMPLER_PALETTE_LOAD1_length_bias      2
241696c5ddc4Srjs#define GFX6_3DSTATE_SAMPLER_PALETTE_LOAD1_header\
241710e230b6Smaya   .DWordLength                         =      0,  \
241810e230b6Smaya   ._3DCommandSubOpcode                 =     12,  \
241910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
242010e230b6Smaya   .CommandSubType                      =      3,  \
242110e230b6Smaya   .CommandType                         =      3
242210e230b6Smaya
242396c5ddc4Srjsstruct GFX6_3DSTATE_SAMPLER_PALETTE_LOAD1 {
242410e230b6Smaya   uint32_t                             DWordLength;
242510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
242610e230b6Smaya   uint32_t                             _3DCommandOpcode;
242710e230b6Smaya   uint32_t                             CommandSubType;
242810e230b6Smaya   uint32_t                             CommandType;
242910e230b6Smaya   /* variable length fields follow */
243010e230b6Smaya};
243110e230b6Smaya
243296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
243396c5ddc4SrjsGFX6_3DSTATE_SAMPLER_PALETTE_LOAD1_pack(__attribute__((unused)) __gen_user_data *data,
243410e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
243596c5ddc4Srjs                                        __attribute__((unused)) const struct GFX6_3DSTATE_SAMPLER_PALETTE_LOAD1 * restrict values)
243610e230b6Smaya{
243710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
243810e230b6Smaya
243910e230b6Smaya   dw[0] =
244010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
244110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
244210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
244310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
244410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
244510e230b6Smaya}
244610e230b6Smaya
244796c5ddc4Srjs#define GFX6_3DSTATE_SAMPLER_STATE_POINTERS_length      4
244896c5ddc4Srjs#define GFX6_3DSTATE_SAMPLER_STATE_POINTERS_length_bias      2
244996c5ddc4Srjs#define GFX6_3DSTATE_SAMPLER_STATE_POINTERS_header\
245010e230b6Smaya   .DWordLength                         =      2,  \
245110e230b6Smaya   ._3DCommandSubOpcode                 =      2,  \
245210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
245310e230b6Smaya   .CommandSubType                      =      3,  \
245410e230b6Smaya   .CommandType                         =      3
245510e230b6Smaya
245696c5ddc4Srjsstruct GFX6_3DSTATE_SAMPLER_STATE_POINTERS {
245710e230b6Smaya   uint32_t                             DWordLength;
245810e230b6Smaya   uint32_t                             VSSamplerStateChange;
245910e230b6Smaya   uint32_t                             GSSamplerStateChange;
246010e230b6Smaya   uint32_t                             PSSamplerStateChange;
246110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
246210e230b6Smaya   uint32_t                             _3DCommandOpcode;
246310e230b6Smaya   uint32_t                             CommandSubType;
246410e230b6Smaya   uint32_t                             CommandType;
246510e230b6Smaya   uint64_t                             PointertoVSSamplerState;
246610e230b6Smaya   uint64_t                             PointertoGSSamplerState;
246710e230b6Smaya   uint64_t                             PointertoPSSamplerState;
246810e230b6Smaya};
246910e230b6Smaya
247096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
247196c5ddc4SrjsGFX6_3DSTATE_SAMPLER_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
247210e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
247396c5ddc4Srjs                                         __attribute__((unused)) const struct GFX6_3DSTATE_SAMPLER_STATE_POINTERS * restrict values)
247410e230b6Smaya{
247510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
247610e230b6Smaya
247710e230b6Smaya   dw[0] =
247810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
247910e230b6Smaya      __gen_uint(values->VSSamplerStateChange, 8, 8) |
248010e230b6Smaya      __gen_uint(values->GSSamplerStateChange, 9, 9) |
248110e230b6Smaya      __gen_uint(values->PSSamplerStateChange, 12, 12) |
248210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
248310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
248410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
248510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
248610e230b6Smaya
248710e230b6Smaya   dw[1] =
248810e230b6Smaya      __gen_offset(values->PointertoVSSamplerState, 5, 31);
248910e230b6Smaya
249010e230b6Smaya   dw[2] =
249110e230b6Smaya      __gen_offset(values->PointertoGSSamplerState, 5, 31);
249210e230b6Smaya
249310e230b6Smaya   dw[3] =
249410e230b6Smaya      __gen_offset(values->PointertoPSSamplerState, 5, 31);
249510e230b6Smaya}
249610e230b6Smaya
249796c5ddc4Srjs#define GFX6_3DSTATE_SAMPLE_MASK_length        2
249896c5ddc4Srjs#define GFX6_3DSTATE_SAMPLE_MASK_length_bias      2
249996c5ddc4Srjs#define GFX6_3DSTATE_SAMPLE_MASK_header         \
250010e230b6Smaya   .DWordLength                         =      0,  \
250110e230b6Smaya   ._3DCommandSubOpcode                 =     24,  \
250210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
250310e230b6Smaya   .CommandSubType                      =      3,  \
250410e230b6Smaya   .CommandType                         =      3
250510e230b6Smaya
250696c5ddc4Srjsstruct GFX6_3DSTATE_SAMPLE_MASK {
250710e230b6Smaya   uint32_t                             DWordLength;
250810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
250910e230b6Smaya   uint32_t                             _3DCommandOpcode;
251010e230b6Smaya   uint32_t                             CommandSubType;
251110e230b6Smaya   uint32_t                             CommandType;
251210e230b6Smaya   uint32_t                             SampleMask;
251310e230b6Smaya};
251410e230b6Smaya
251596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
251696c5ddc4SrjsGFX6_3DSTATE_SAMPLE_MASK_pack(__attribute__((unused)) __gen_user_data *data,
251710e230b6Smaya                              __attribute__((unused)) void * restrict dst,
251896c5ddc4Srjs                              __attribute__((unused)) const struct GFX6_3DSTATE_SAMPLE_MASK * restrict values)
251910e230b6Smaya{
252010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
252110e230b6Smaya
252210e230b6Smaya   dw[0] =
252310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
252410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
252510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
252610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
252710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
252810e230b6Smaya
252910e230b6Smaya   dw[1] =
253010e230b6Smaya      __gen_uint(values->SampleMask, 0, 3);
253110e230b6Smaya}
253210e230b6Smaya
253396c5ddc4Srjs#define GFX6_3DSTATE_SCISSOR_STATE_POINTERS_length      2
253496c5ddc4Srjs#define GFX6_3DSTATE_SCISSOR_STATE_POINTERS_length_bias      2
253596c5ddc4Srjs#define GFX6_3DSTATE_SCISSOR_STATE_POINTERS_header\
253610e230b6Smaya   .DWordLength                         =      0,  \
253710e230b6Smaya   ._3DCommandSubOpcode                 =     15,  \
253810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
253910e230b6Smaya   .CommandSubType                      =      3,  \
254010e230b6Smaya   .CommandType                         =      3
254110e230b6Smaya
254296c5ddc4Srjsstruct GFX6_3DSTATE_SCISSOR_STATE_POINTERS {
254310e230b6Smaya   uint32_t                             DWordLength;
254410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
254510e230b6Smaya   uint32_t                             _3DCommandOpcode;
254610e230b6Smaya   uint32_t                             CommandSubType;
254710e230b6Smaya   uint32_t                             CommandType;
254810e230b6Smaya   uint64_t                             ScissorRectPointer;
254910e230b6Smaya};
255010e230b6Smaya
255196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
255296c5ddc4SrjsGFX6_3DSTATE_SCISSOR_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
255310e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
255496c5ddc4Srjs                                         __attribute__((unused)) const struct GFX6_3DSTATE_SCISSOR_STATE_POINTERS * restrict values)
255510e230b6Smaya{
255610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
255710e230b6Smaya
255810e230b6Smaya   dw[0] =
255910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
256010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
256110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
256210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
256310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
256410e230b6Smaya
256510e230b6Smaya   dw[1] =
256610e230b6Smaya      __gen_offset(values->ScissorRectPointer, 5, 31);
256710e230b6Smaya}
256810e230b6Smaya
256996c5ddc4Srjs#define GFX6_3DSTATE_SF_length                20
257096c5ddc4Srjs#define GFX6_3DSTATE_SF_length_bias            2
257196c5ddc4Srjs#define GFX6_3DSTATE_SF_header                  \
257210e230b6Smaya   .DWordLength                         =     18,  \
257310e230b6Smaya   ._3DCommandSubOpcode                 =     19,  \
257410e230b6Smaya   ._3DCommandOpcode                    =      0,  \
257510e230b6Smaya   .CommandSubType                      =      3,  \
257610e230b6Smaya   .CommandType                         =      3
257710e230b6Smaya
257896c5ddc4Srjsstruct GFX6_3DSTATE_SF {
257910e230b6Smaya   uint32_t                             DWordLength;
258010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
258110e230b6Smaya   uint32_t                             _3DCommandOpcode;
258210e230b6Smaya   uint32_t                             CommandSubType;
258310e230b6Smaya   uint32_t                             CommandType;
258410e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
258510e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
258610e230b6Smaya   uint32_t                             PointSpriteTextureCoordinateOrigin;
258710e230b6Smaya#define UPPERLEFT                                0
258810e230b6Smaya#define LOWERLEFT                                1
258910e230b6Smaya   bool                                 AttributeSwizzleEnable;
259010e230b6Smaya   uint32_t                             NumberofSFOutputAttributes;
259110e230b6Smaya   uint32_t                             FrontWinding;
259210e230b6Smaya#define FRONTWINDING_CW                          0
259310e230b6Smaya#define FRONTWINDING_CCW                         1
259410e230b6Smaya   bool                                 ViewportTransformEnable;
259510e230b6Smaya   uint32_t                             BackFaceFillMode;
259610e230b6Smaya#define FILL_MODE_SOLID                          0
259710e230b6Smaya#define FILL_MODE_WIREFRAME                      1
259810e230b6Smaya#define FILL_MODE_POINT                          2
259910e230b6Smaya   uint32_t                             FrontFaceFillMode;
260010e230b6Smaya#define FILL_MODE_SOLID                          0
260110e230b6Smaya#define FILL_MODE_WIREFRAME                      1
260210e230b6Smaya#define FILL_MODE_POINT                          2
260310e230b6Smaya   bool                                 GlobalDepthOffsetEnablePoint;
260410e230b6Smaya   bool                                 GlobalDepthOffsetEnableWireframe;
260510e230b6Smaya   bool                                 GlobalDepthOffsetEnableSolid;
260610e230b6Smaya   bool                                 StatisticsEnable;
260710e230b6Smaya   bool                                 LegacyGlobalDepthBiasEnable;
260810e230b6Smaya   uint32_t                             MultisampleRasterizationMode;
260910e230b6Smaya#define MSRASTMODE_OFF_PIXEL                     0
261010e230b6Smaya#define MSRASTMODE_OFF_PATTERN                   1
261110e230b6Smaya#define MSRASTMODE_ON_PIXEL                      2
261210e230b6Smaya#define MSRASTMODE_ON_PATTERN                    3
261310e230b6Smaya   bool                                 ScissorRectangleEnable;
261410e230b6Smaya   uint32_t                             LineEndCapAntialiasingRegionWidth;
261510e230b6Smaya#define _05pixels                                0
261610e230b6Smaya#define _10pixels                                1
261710e230b6Smaya#define _20pixels                                2
261810e230b6Smaya#define _40pixels                                3
261910e230b6Smaya   float                                LineWidth;
262010e230b6Smaya   uint32_t                             CullMode;
262110e230b6Smaya#define CULLMODE_BOTH                            0
262210e230b6Smaya#define CULLMODE_NONE                            1
262310e230b6Smaya#define CULLMODE_FRONT                           2
262410e230b6Smaya#define CULLMODE_BACK                            3
262596c5ddc4Srjs   bool                                 AntialiasingEnable;
262610e230b6Smaya   float                                PointWidth;
262710e230b6Smaya   uint32_t                             PointWidthSource;
262810e230b6Smaya#define Vertex                                   0
262910e230b6Smaya#define State                                    1
263010e230b6Smaya   uint32_t                             VertexSubPixelPrecisionSelect;
263110e230b6Smaya#define _8SubPixelPrecisionBits                  0
263210e230b6Smaya#define _4SubPixelPrecisionBits                  1
263310e230b6Smaya   uint32_t                             AALineDistanceMode;
263410e230b6Smaya#define AALINEDISTANCE_TRUE                      1
263510e230b6Smaya   uint32_t                             TriangleFanProvokingVertexSelect;
263610e230b6Smaya#define Vertex0                                  0
263710e230b6Smaya#define Vertex1                                  1
263810e230b6Smaya#define Vertex2                                  2
263910e230b6Smaya   uint32_t                             LineStripListProvokingVertexSelect;
264010e230b6Smaya#define Vertex0                                  0
264110e230b6Smaya#define Vertex1                                  1
264210e230b6Smaya   uint32_t                             TriangleStripListProvokingVertexSelect;
264310e230b6Smaya#define Vertex0                                  0
264410e230b6Smaya#define Vertex1                                  1
264510e230b6Smaya#define Vertex2                                  2
264610e230b6Smaya   bool                                 LastPixelEnable;
264710e230b6Smaya   float                                GlobalDepthOffsetConstant;
264810e230b6Smaya   float                                GlobalDepthOffsetScale;
264910e230b6Smaya   float                                GlobalDepthOffsetClamp;
265096c5ddc4Srjs   struct GFX6_SF_OUTPUT_ATTRIBUTE_DETAIL Attribute[16];
265110e230b6Smaya   uint32_t                             PointSpriteTextureCoordinateEnable;
265210e230b6Smaya   uint32_t                             ConstantInterpolationEnable;
265310e230b6Smaya   uint32_t                             Attribute0WrapShortestEnables;
265410e230b6Smaya   uint32_t                             Attribute1WrapShortestEnables;
265510e230b6Smaya   uint32_t                             Attribute2WrapShortestEnables;
265610e230b6Smaya   uint32_t                             Attribute3WrapShortestEnables;
265710e230b6Smaya   uint32_t                             Attribute4WrapShortestEnables;
265810e230b6Smaya   uint32_t                             Attribute5WrapShortestEnables;
265910e230b6Smaya   uint32_t                             Attribute6WrapShortestEnables;
266010e230b6Smaya   uint32_t                             Attribute7WrapShortestEnables;
266110e230b6Smaya   uint32_t                             Attribute8WrapShortestEnables;
266210e230b6Smaya   uint32_t                             Attribute9WrapShortestEnables;
266310e230b6Smaya   uint32_t                             Attribute10WrapShortestEnables;
266410e230b6Smaya   uint32_t                             Attribute11WrapShortestEnables;
266510e230b6Smaya   uint32_t                             Attribute12WrapShortestEnables;
266610e230b6Smaya   uint32_t                             Attribute13WrapShortestEnables;
266710e230b6Smaya   uint32_t                             Attribute14WrapShortestEnables;
266810e230b6Smaya   uint32_t                             Attribute15WrapShortestEnables;
266910e230b6Smaya};
267010e230b6Smaya
267196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
267296c5ddc4SrjsGFX6_3DSTATE_SF_pack(__attribute__((unused)) __gen_user_data *data,
267310e230b6Smaya                     __attribute__((unused)) void * restrict dst,
267496c5ddc4Srjs                     __attribute__((unused)) const struct GFX6_3DSTATE_SF * restrict values)
267510e230b6Smaya{
267610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
267710e230b6Smaya
267810e230b6Smaya   dw[0] =
267910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
268010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
268110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
268210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
268310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
268410e230b6Smaya
268510e230b6Smaya   dw[1] =
268610e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
268710e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 15) |
268810e230b6Smaya      __gen_uint(values->PointSpriteTextureCoordinateOrigin, 20, 20) |
268910e230b6Smaya      __gen_uint(values->AttributeSwizzleEnable, 21, 21) |
269010e230b6Smaya      __gen_uint(values->NumberofSFOutputAttributes, 22, 27);
269110e230b6Smaya
269210e230b6Smaya   dw[2] =
269310e230b6Smaya      __gen_uint(values->FrontWinding, 0, 0) |
269410e230b6Smaya      __gen_uint(values->ViewportTransformEnable, 1, 1) |
269510e230b6Smaya      __gen_uint(values->BackFaceFillMode, 3, 4) |
269610e230b6Smaya      __gen_uint(values->FrontFaceFillMode, 5, 6) |
269710e230b6Smaya      __gen_uint(values->GlobalDepthOffsetEnablePoint, 7, 7) |
269810e230b6Smaya      __gen_uint(values->GlobalDepthOffsetEnableWireframe, 8, 8) |
269910e230b6Smaya      __gen_uint(values->GlobalDepthOffsetEnableSolid, 9, 9) |
270010e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
270110e230b6Smaya      __gen_uint(values->LegacyGlobalDepthBiasEnable, 11, 11);
270210e230b6Smaya
270310e230b6Smaya   dw[3] =
270410e230b6Smaya      __gen_uint(values->MultisampleRasterizationMode, 8, 9) |
270510e230b6Smaya      __gen_uint(values->ScissorRectangleEnable, 11, 11) |
270610e230b6Smaya      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 16, 17) |
270710e230b6Smaya      __gen_ufixed(values->LineWidth, 18, 27, 7) |
270810e230b6Smaya      __gen_uint(values->CullMode, 29, 30) |
270996c5ddc4Srjs      __gen_uint(values->AntialiasingEnable, 31, 31);
271010e230b6Smaya
271110e230b6Smaya   dw[4] =
271210e230b6Smaya      __gen_ufixed(values->PointWidth, 0, 10, 3) |
271310e230b6Smaya      __gen_uint(values->PointWidthSource, 11, 11) |
271410e230b6Smaya      __gen_uint(values->VertexSubPixelPrecisionSelect, 12, 12) |
271510e230b6Smaya      __gen_uint(values->AALineDistanceMode, 14, 14) |
271610e230b6Smaya      __gen_uint(values->TriangleFanProvokingVertexSelect, 25, 26) |
271710e230b6Smaya      __gen_uint(values->LineStripListProvokingVertexSelect, 27, 28) |
271810e230b6Smaya      __gen_uint(values->TriangleStripListProvokingVertexSelect, 29, 30) |
271910e230b6Smaya      __gen_uint(values->LastPixelEnable, 31, 31);
272010e230b6Smaya
272110e230b6Smaya   dw[5] =
272210e230b6Smaya      __gen_float(values->GlobalDepthOffsetConstant);
272310e230b6Smaya
272410e230b6Smaya   dw[6] =
272510e230b6Smaya      __gen_float(values->GlobalDepthOffsetScale);
272610e230b6Smaya
272710e230b6Smaya   dw[7] =
272810e230b6Smaya      __gen_float(values->GlobalDepthOffsetClamp);
272910e230b6Smaya
273010e230b6Smaya   uint32_t v8_0;
273196c5ddc4Srjs   GFX6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_0, &values->Attribute[0]);
273210e230b6Smaya
273310e230b6Smaya   uint32_t v8_1;
273496c5ddc4Srjs   GFX6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_1, &values->Attribute[1]);
273510e230b6Smaya
273610e230b6Smaya   dw[8] =
273710e230b6Smaya      __gen_uint(v8_0, 0, 15) |
273810e230b6Smaya      __gen_uint(v8_1, 16, 31);
273910e230b6Smaya
274010e230b6Smaya   uint32_t v9_0;
274196c5ddc4Srjs   GFX6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v9_0, &values->Attribute[2]);
274210e230b6Smaya
274310e230b6Smaya   uint32_t v9_1;
274496c5ddc4Srjs   GFX6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v9_1, &values->Attribute[3]);
274510e230b6Smaya
274610e230b6Smaya   dw[9] =
274710e230b6Smaya      __gen_uint(v9_0, 0, 15) |
274810e230b6Smaya      __gen_uint(v9_1, 16, 31);
274910e230b6Smaya
275010e230b6Smaya   uint32_t v10_0;
275196c5ddc4Srjs   GFX6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v10_0, &values->Attribute[4]);
275210e230b6Smaya
275310e230b6Smaya   uint32_t v10_1;
275496c5ddc4Srjs   GFX6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v10_1, &values->Attribute[5]);
275510e230b6Smaya
275610e230b6Smaya   dw[10] =
275710e230b6Smaya      __gen_uint(v10_0, 0, 15) |
275810e230b6Smaya      __gen_uint(v10_1, 16, 31);
275910e230b6Smaya
276010e230b6Smaya   uint32_t v11_0;
276196c5ddc4Srjs   GFX6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v11_0, &values->Attribute[6]);
276210e230b6Smaya
276310e230b6Smaya   uint32_t v11_1;
276496c5ddc4Srjs   GFX6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v11_1, &values->Attribute[7]);
276510e230b6Smaya
276610e230b6Smaya   dw[11] =
276710e230b6Smaya      __gen_uint(v11_0, 0, 15) |
276810e230b6Smaya      __gen_uint(v11_1, 16, 31);
276910e230b6Smaya
277010e230b6Smaya   uint32_t v12_0;
277196c5ddc4Srjs   GFX6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v12_0, &values->Attribute[8]);
277210e230b6Smaya
277310e230b6Smaya   uint32_t v12_1;
277496c5ddc4Srjs   GFX6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v12_1, &values->Attribute[9]);
277510e230b6Smaya
277610e230b6Smaya   dw[12] =
277710e230b6Smaya      __gen_uint(v12_0, 0, 15) |
277810e230b6Smaya      __gen_uint(v12_1, 16, 31);
277910e230b6Smaya
278010e230b6Smaya   uint32_t v13_0;
278196c5ddc4Srjs   GFX6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v13_0, &values->Attribute[10]);
278210e230b6Smaya
278310e230b6Smaya   uint32_t v13_1;
278496c5ddc4Srjs   GFX6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v13_1, &values->Attribute[11]);
278510e230b6Smaya
278610e230b6Smaya   dw[13] =
278710e230b6Smaya      __gen_uint(v13_0, 0, 15) |
278810e230b6Smaya      __gen_uint(v13_1, 16, 31);
278910e230b6Smaya
279010e230b6Smaya   uint32_t v14_0;
279196c5ddc4Srjs   GFX6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v14_0, &values->Attribute[12]);
279210e230b6Smaya
279310e230b6Smaya   uint32_t v14_1;
279496c5ddc4Srjs   GFX6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v14_1, &values->Attribute[13]);
279510e230b6Smaya
279610e230b6Smaya   dw[14] =
279710e230b6Smaya      __gen_uint(v14_0, 0, 15) |
279810e230b6Smaya      __gen_uint(v14_1, 16, 31);
279910e230b6Smaya
280010e230b6Smaya   uint32_t v15_0;
280196c5ddc4Srjs   GFX6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v15_0, &values->Attribute[14]);
280210e230b6Smaya
280310e230b6Smaya   uint32_t v15_1;
280496c5ddc4Srjs   GFX6_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v15_1, &values->Attribute[15]);
280510e230b6Smaya
280610e230b6Smaya   dw[15] =
280710e230b6Smaya      __gen_uint(v15_0, 0, 15) |
280810e230b6Smaya      __gen_uint(v15_1, 16, 31);
280910e230b6Smaya
281010e230b6Smaya   dw[16] =
281110e230b6Smaya      __gen_uint(values->PointSpriteTextureCoordinateEnable, 0, 31);
281210e230b6Smaya
281310e230b6Smaya   dw[17] =
281410e230b6Smaya      __gen_uint(values->ConstantInterpolationEnable, 0, 31);
281510e230b6Smaya
281610e230b6Smaya   dw[18] =
281710e230b6Smaya      __gen_uint(values->Attribute0WrapShortestEnables, 0, 3) |
281810e230b6Smaya      __gen_uint(values->Attribute1WrapShortestEnables, 4, 7) |
281910e230b6Smaya      __gen_uint(values->Attribute2WrapShortestEnables, 8, 11) |
282010e230b6Smaya      __gen_uint(values->Attribute3WrapShortestEnables, 12, 15) |
282110e230b6Smaya      __gen_uint(values->Attribute4WrapShortestEnables, 16, 19) |
282210e230b6Smaya      __gen_uint(values->Attribute5WrapShortestEnables, 20, 23) |
282310e230b6Smaya      __gen_uint(values->Attribute6WrapShortestEnables, 24, 27) |
282410e230b6Smaya      __gen_uint(values->Attribute7WrapShortestEnables, 28, 31);
282510e230b6Smaya
282610e230b6Smaya   dw[19] =
282710e230b6Smaya      __gen_uint(values->Attribute8WrapShortestEnables, 0, 3) |
282810e230b6Smaya      __gen_uint(values->Attribute9WrapShortestEnables, 4, 7) |
282910e230b6Smaya      __gen_uint(values->Attribute10WrapShortestEnables, 8, 11) |
283010e230b6Smaya      __gen_uint(values->Attribute11WrapShortestEnables, 12, 15) |
283110e230b6Smaya      __gen_uint(values->Attribute12WrapShortestEnables, 16, 19) |
283210e230b6Smaya      __gen_uint(values->Attribute13WrapShortestEnables, 20, 23) |
283310e230b6Smaya      __gen_uint(values->Attribute14WrapShortestEnables, 24, 27) |
283410e230b6Smaya      __gen_uint(values->Attribute15WrapShortestEnables, 28, 31);
283510e230b6Smaya}
283610e230b6Smaya
283796c5ddc4Srjs#define GFX6_3DSTATE_STENCIL_BUFFER_length      3
283896c5ddc4Srjs#define GFX6_3DSTATE_STENCIL_BUFFER_length_bias      2
283996c5ddc4Srjs#define GFX6_3DSTATE_STENCIL_BUFFER_header      \
284010e230b6Smaya   .DWordLength                         =      1,  \
284110e230b6Smaya   ._3DCommandSubOpcode                 =     14,  \
284210e230b6Smaya   ._3DCommandOpcode                    =      1,  \
284310e230b6Smaya   .CommandSubType                      =      3,  \
284410e230b6Smaya   .CommandType                         =      3
284510e230b6Smaya
284696c5ddc4Srjsstruct GFX6_3DSTATE_STENCIL_BUFFER {
284710e230b6Smaya   uint32_t                             DWordLength;
284810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
284910e230b6Smaya   uint32_t                             _3DCommandOpcode;
285010e230b6Smaya   uint32_t                             CommandSubType;
285110e230b6Smaya   uint32_t                             CommandType;
285210e230b6Smaya   uint32_t                             SurfacePitch;
285310e230b6Smaya   uint32_t                             MOCS;
285410e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
285510e230b6Smaya};
285610e230b6Smaya
285796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
285896c5ddc4SrjsGFX6_3DSTATE_STENCIL_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
285910e230b6Smaya                                 __attribute__((unused)) void * restrict dst,
286096c5ddc4Srjs                                 __attribute__((unused)) const struct GFX6_3DSTATE_STENCIL_BUFFER * restrict values)
286110e230b6Smaya{
286210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
286310e230b6Smaya
286410e230b6Smaya   dw[0] =
286510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
286610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
286710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
286810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
286910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
287010e230b6Smaya
287110e230b6Smaya   dw[1] =
287210e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 16) |
287310e230b6Smaya      __gen_uint(values->MOCS, 25, 28);
287410e230b6Smaya
287596c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 0, 31);
287610e230b6Smaya}
287710e230b6Smaya
287896c5ddc4Srjs#define GFX6_3DSTATE_URB_length                3
287996c5ddc4Srjs#define GFX6_3DSTATE_URB_length_bias           2
288096c5ddc4Srjs#define GFX6_3DSTATE_URB_header                 \
288110e230b6Smaya   .DWordLength                         =      1,  \
288210e230b6Smaya   ._3DCommandSubOpcode                 =      5,  \
288310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
288410e230b6Smaya   .CommandSubType                      =      3,  \
288510e230b6Smaya   .CommandType                         =      3
288610e230b6Smaya
288796c5ddc4Srjsstruct GFX6_3DSTATE_URB {
288810e230b6Smaya   uint32_t                             DWordLength;
288910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
289010e230b6Smaya   uint32_t                             _3DCommandOpcode;
289110e230b6Smaya   uint32_t                             CommandSubType;
289210e230b6Smaya   uint32_t                             CommandType;
289310e230b6Smaya   uint32_t                             VSNumberofURBEntries;
289410e230b6Smaya   uint32_t                             VSURBEntryAllocationSize;
289510e230b6Smaya   uint32_t                             GSURBEntryAllocationSize;
289610e230b6Smaya   uint32_t                             GSNumberofURBEntries;
289710e230b6Smaya};
289810e230b6Smaya
289996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
290096c5ddc4SrjsGFX6_3DSTATE_URB_pack(__attribute__((unused)) __gen_user_data *data,
290110e230b6Smaya                      __attribute__((unused)) void * restrict dst,
290296c5ddc4Srjs                      __attribute__((unused)) const struct GFX6_3DSTATE_URB * restrict values)
290310e230b6Smaya{
290410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
290510e230b6Smaya
290610e230b6Smaya   dw[0] =
290710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
290810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
290910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
291010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
291110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
291210e230b6Smaya
291310e230b6Smaya   dw[1] =
291410e230b6Smaya      __gen_uint(values->VSNumberofURBEntries, 0, 15) |
291510e230b6Smaya      __gen_uint(values->VSURBEntryAllocationSize, 16, 23);
291610e230b6Smaya
291710e230b6Smaya   dw[2] =
291810e230b6Smaya      __gen_uint(values->GSURBEntryAllocationSize, 0, 2) |
291910e230b6Smaya      __gen_uint(values->GSNumberofURBEntries, 8, 17);
292010e230b6Smaya}
292110e230b6Smaya
292296c5ddc4Srjs#define GFX6_3DSTATE_VERTEX_BUFFERS_length_bias      2
292396c5ddc4Srjs#define GFX6_3DSTATE_VERTEX_BUFFERS_header      \
292410e230b6Smaya   .DWordLength                         =      3,  \
292510e230b6Smaya   ._3DCommandSubOpcode                 =      8,  \
292610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
292710e230b6Smaya   .CommandSubType                      =      3,  \
292810e230b6Smaya   .CommandType                         =      3
292910e230b6Smaya
293096c5ddc4Srjsstruct GFX6_3DSTATE_VERTEX_BUFFERS {
293110e230b6Smaya   uint32_t                             DWordLength;
293210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
293310e230b6Smaya   uint32_t                             _3DCommandOpcode;
293410e230b6Smaya   uint32_t                             CommandSubType;
293510e230b6Smaya   uint32_t                             CommandType;
293610e230b6Smaya   /* variable length fields follow */
293710e230b6Smaya};
293810e230b6Smaya
293996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
294096c5ddc4SrjsGFX6_3DSTATE_VERTEX_BUFFERS_pack(__attribute__((unused)) __gen_user_data *data,
294110e230b6Smaya                                 __attribute__((unused)) void * restrict dst,
294296c5ddc4Srjs                                 __attribute__((unused)) const struct GFX6_3DSTATE_VERTEX_BUFFERS * restrict values)
294310e230b6Smaya{
294410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
294510e230b6Smaya
294610e230b6Smaya   dw[0] =
294710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
294810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
294910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
295010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
295110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
295210e230b6Smaya}
295310e230b6Smaya
295496c5ddc4Srjs#define GFX6_3DSTATE_VERTEX_ELEMENTS_length_bias      2
295596c5ddc4Srjs#define GFX6_3DSTATE_VERTEX_ELEMENTS_header     \
295610e230b6Smaya   .DWordLength                         =      1,  \
295710e230b6Smaya   ._3DCommandSubOpcode                 =      9,  \
295810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
295910e230b6Smaya   .CommandSubType                      =      3,  \
296010e230b6Smaya   .CommandType                         =      3
296110e230b6Smaya
296296c5ddc4Srjsstruct GFX6_3DSTATE_VERTEX_ELEMENTS {
296310e230b6Smaya   uint32_t                             DWordLength;
296410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
296510e230b6Smaya   uint32_t                             _3DCommandOpcode;
296610e230b6Smaya   uint32_t                             CommandSubType;
296710e230b6Smaya   uint32_t                             CommandType;
296810e230b6Smaya   /* variable length fields follow */
296910e230b6Smaya};
297010e230b6Smaya
297196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
297296c5ddc4SrjsGFX6_3DSTATE_VERTEX_ELEMENTS_pack(__attribute__((unused)) __gen_user_data *data,
297310e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
297496c5ddc4Srjs                                  __attribute__((unused)) const struct GFX6_3DSTATE_VERTEX_ELEMENTS * restrict values)
297510e230b6Smaya{
297610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
297710e230b6Smaya
297810e230b6Smaya   dw[0] =
297910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
298010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
298110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
298210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
298310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
298410e230b6Smaya}
298510e230b6Smaya
298696c5ddc4Srjs#define GFX6_3DSTATE_VF_STATISTICS_length      1
298796c5ddc4Srjs#define GFX6_3DSTATE_VF_STATISTICS_length_bias      1
298896c5ddc4Srjs#define GFX6_3DSTATE_VF_STATISTICS_header       \
298910e230b6Smaya   ._3DCommandSubOpcode                 =     11,  \
299010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
299110e230b6Smaya   .CommandSubType                      =      1,  \
299210e230b6Smaya   .CommandType                         =      3
299310e230b6Smaya
299496c5ddc4Srjsstruct GFX6_3DSTATE_VF_STATISTICS {
299510e230b6Smaya   bool                                 StatisticsEnable;
299610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
299710e230b6Smaya   uint32_t                             _3DCommandOpcode;
299810e230b6Smaya   uint32_t                             CommandSubType;
299910e230b6Smaya   uint32_t                             CommandType;
300010e230b6Smaya};
300110e230b6Smaya
300296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
300396c5ddc4SrjsGFX6_3DSTATE_VF_STATISTICS_pack(__attribute__((unused)) __gen_user_data *data,
300410e230b6Smaya                                __attribute__((unused)) void * restrict dst,
300596c5ddc4Srjs                                __attribute__((unused)) const struct GFX6_3DSTATE_VF_STATISTICS * restrict values)
300610e230b6Smaya{
300710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
300810e230b6Smaya
300910e230b6Smaya   dw[0] =
301010e230b6Smaya      __gen_uint(values->StatisticsEnable, 0, 0) |
301110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
301210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
301310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
301410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
301510e230b6Smaya}
301610e230b6Smaya
301796c5ddc4Srjs#define GFX6_3DSTATE_VIEWPORT_STATE_POINTERS_length      4
301896c5ddc4Srjs#define GFX6_3DSTATE_VIEWPORT_STATE_POINTERS_length_bias      2
301996c5ddc4Srjs#define GFX6_3DSTATE_VIEWPORT_STATE_POINTERS_header\
302010e230b6Smaya   .DWordLength                         =      2,  \
302110e230b6Smaya   ._3DCommandSubOpcode                 =     13,  \
302210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
302310e230b6Smaya   .CommandSubType                      =      3,  \
302410e230b6Smaya   .CommandType                         =      3
302510e230b6Smaya
302696c5ddc4Srjsstruct GFX6_3DSTATE_VIEWPORT_STATE_POINTERS {
302710e230b6Smaya   uint32_t                             DWordLength;
302810e230b6Smaya   uint32_t                             CLIPViewportStateChange;
302910e230b6Smaya   uint32_t                             SFViewportStateChange;
303010e230b6Smaya   uint32_t                             CCViewportStateChange;
303110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
303210e230b6Smaya   uint32_t                             _3DCommandOpcode;
303310e230b6Smaya   uint32_t                             CommandSubType;
303410e230b6Smaya   uint32_t                             CommandType;
303510e230b6Smaya   uint64_t                             PointertoCLIP_VIEWPORT;
303610e230b6Smaya   uint64_t                             PointertoSF_VIEWPORT;
303710e230b6Smaya   uint64_t                             PointertoCC_VIEWPORT;
303810e230b6Smaya};
303910e230b6Smaya
304096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
304196c5ddc4SrjsGFX6_3DSTATE_VIEWPORT_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
304210e230b6Smaya                                          __attribute__((unused)) void * restrict dst,
304396c5ddc4Srjs                                          __attribute__((unused)) const struct GFX6_3DSTATE_VIEWPORT_STATE_POINTERS * restrict values)
304410e230b6Smaya{
304510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
304610e230b6Smaya
304710e230b6Smaya   dw[0] =
304810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
304910e230b6Smaya      __gen_uint(values->CLIPViewportStateChange, 10, 10) |
305010e230b6Smaya      __gen_uint(values->SFViewportStateChange, 11, 11) |
305110e230b6Smaya      __gen_uint(values->CCViewportStateChange, 12, 12) |
305210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
305310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
305410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
305510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
305610e230b6Smaya
305710e230b6Smaya   dw[1] =
305810e230b6Smaya      __gen_offset(values->PointertoCLIP_VIEWPORT, 5, 31);
305910e230b6Smaya
306010e230b6Smaya   dw[2] =
306110e230b6Smaya      __gen_offset(values->PointertoSF_VIEWPORT, 5, 31);
306210e230b6Smaya
306310e230b6Smaya   dw[3] =
306410e230b6Smaya      __gen_offset(values->PointertoCC_VIEWPORT, 5, 31);
306510e230b6Smaya}
306610e230b6Smaya
306796c5ddc4Srjs#define GFX6_3DSTATE_VS_length                 6
306896c5ddc4Srjs#define GFX6_3DSTATE_VS_length_bias            2
306996c5ddc4Srjs#define GFX6_3DSTATE_VS_header                  \
307010e230b6Smaya   .DWordLength                         =      4,  \
307110e230b6Smaya   ._3DCommandSubOpcode                 =     16,  \
307210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
307310e230b6Smaya   .CommandSubType                      =      3,  \
307410e230b6Smaya   .CommandType                         =      3
307510e230b6Smaya
307696c5ddc4Srjsstruct GFX6_3DSTATE_VS {
307710e230b6Smaya   uint32_t                             DWordLength;
307810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
307910e230b6Smaya   uint32_t                             _3DCommandOpcode;
308010e230b6Smaya   uint32_t                             CommandSubType;
308110e230b6Smaya   uint32_t                             CommandType;
308210e230b6Smaya   uint64_t                             KernelStartPointer;
308310e230b6Smaya   bool                                 SoftwareExceptionEnable;
308410e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
308510e230b6Smaya   uint32_t                             FloatingPointMode;
308610e230b6Smaya#define IEEE754                                  0
308710e230b6Smaya#define Alternate                                1
308810e230b6Smaya   uint32_t                             BindingTableEntryCount;
308910e230b6Smaya   uint32_t                             SamplerCount;
309010e230b6Smaya#define NoSamplers                               0
309110e230b6Smaya#define _14Samplers                              1
309210e230b6Smaya#define _58Samplers                              2
309310e230b6Smaya#define _912Samplers                             3
309410e230b6Smaya#define _1316Samplers                            4
309510e230b6Smaya   bool                                 VectorMaskEnable;
309610e230b6Smaya   bool                                 SingleVertexDispatch;
309710e230b6Smaya   uint32_t                             PerThreadScratchSpace;
309810e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
309910e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
310010e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
310110e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData;
310210e230b6Smaya   bool                                 Enable;
310310e230b6Smaya   bool                                 VertexCacheDisable;
310410e230b6Smaya   bool                                 StatisticsEnable;
310510e230b6Smaya   uint32_t                             MaximumNumberofThreads;
310610e230b6Smaya};
310710e230b6Smaya
310896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
310996c5ddc4SrjsGFX6_3DSTATE_VS_pack(__attribute__((unused)) __gen_user_data *data,
311010e230b6Smaya                     __attribute__((unused)) void * restrict dst,
311196c5ddc4Srjs                     __attribute__((unused)) const struct GFX6_3DSTATE_VS * restrict values)
311210e230b6Smaya{
311310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
311410e230b6Smaya
311510e230b6Smaya   dw[0] =
311610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
311710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
311810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
311910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
312010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
312110e230b6Smaya
312210e230b6Smaya   dw[1] =
312310e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 31);
312410e230b6Smaya
312510e230b6Smaya   dw[2] =
312610e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
312710e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
312810e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
312910e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
313010e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
313110e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
313210e230b6Smaya      __gen_uint(values->SingleVertexDispatch, 31, 31);
313310e230b6Smaya
313410e230b6Smaya   const uint32_t v3 =
313510e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
313696c5ddc4Srjs   dw[3] = __gen_address(data, &dw[3], values->ScratchSpaceBasePointer, v3, 10, 31);
313710e230b6Smaya
313810e230b6Smaya   dw[4] =
313910e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
314010e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
314110e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
314210e230b6Smaya
314310e230b6Smaya   dw[5] =
314410e230b6Smaya      __gen_uint(values->Enable, 0, 0) |
314510e230b6Smaya      __gen_uint(values->VertexCacheDisable, 1, 1) |
314610e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
314710e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 25, 31);
314810e230b6Smaya}
314910e230b6Smaya
315096c5ddc4Srjs#define GFX6_3DSTATE_WM_length                 9
315196c5ddc4Srjs#define GFX6_3DSTATE_WM_length_bias            2
315296c5ddc4Srjs#define GFX6_3DSTATE_WM_header                  \
315310e230b6Smaya   .DWordLength                         =      7,  \
315410e230b6Smaya   ._3DCommandSubOpcode                 =     20,  \
315510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
315610e230b6Smaya   .CommandSubType                      =      3,  \
315710e230b6Smaya   .CommandType                         =      3
315810e230b6Smaya
315996c5ddc4Srjsstruct GFX6_3DSTATE_WM {
316010e230b6Smaya   uint32_t                             DWordLength;
316110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
316210e230b6Smaya   uint32_t                             _3DCommandOpcode;
316310e230b6Smaya   uint32_t                             CommandSubType;
316410e230b6Smaya   uint32_t                             CommandType;
316510e230b6Smaya   uint64_t                             KernelStartPointer0;
316610e230b6Smaya   bool                                 SoftwareExceptionEnable;
316710e230b6Smaya   bool                                 MaskStackExceptionEnable;
316810e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
316910e230b6Smaya   uint32_t                             FloatingPointMode;
317010e230b6Smaya#define FLOATING_POINT_MODE_IEEE745              0
317110e230b6Smaya#define FLOATING_POINT_MODE_Alternate            1
317210e230b6Smaya   uint32_t                             ThreadPriority;
317310e230b6Smaya#define High                                     1
317410e230b6Smaya   uint32_t                             BindingTableEntryCount;
317510e230b6Smaya   uint32_t                             SamplerCount;
317610e230b6Smaya   bool                                 VectorMaskEnable;
317710e230b6Smaya   bool                                 SingleProgramFlow;
317810e230b6Smaya   uint32_t                             PerThreadScratchSpace;
317910e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
318010e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForConstantSetupData2;
318110e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForConstantSetupData1;
318210e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForConstantSetupData0;
318310e230b6Smaya   bool                                 HierarchicalDepthBufferResolveEnable;
318410e230b6Smaya   bool                                 DepthBufferResolveEnable;
318510e230b6Smaya   bool                                 DepthBufferClear;
318610e230b6Smaya   bool                                 StatisticsEnable;
318710e230b6Smaya   bool                                 _8PixelDispatchEnable;
318810e230b6Smaya   bool                                 _16PixelDispatchEnable;
318910e230b6Smaya   bool                                 _32PixelDispatchEnable;
319010e230b6Smaya   bool                                 DualSourceBlendEnable;
319110e230b6Smaya   bool                                 PixelShaderUsesSourceW;
319210e230b6Smaya   bool                                 oMaskPresenttoRenderTarget;
319310e230b6Smaya   bool                                 LineStippleEnable;
319410e230b6Smaya   bool                                 PolygonStippleEnable;
319510e230b6Smaya   uint32_t                             LineAntialiasingRegionWidth;
319610e230b6Smaya#define _05pixels                                0
319710e230b6Smaya#define _10pixels                                1
319810e230b6Smaya#define _20pixels                                2
319910e230b6Smaya#define _40pixels                                3
320010e230b6Smaya   uint32_t                             LineEndCapAntialiasingRegionWidth;
320110e230b6Smaya#define _05pixels                                0
320210e230b6Smaya#define _10pixels                                1
320310e230b6Smaya#define _20pixels                                2
320410e230b6Smaya#define _40pixels                                3
320510e230b6Smaya   bool                                 ThreadDispatchEnable;
320610e230b6Smaya   bool                                 PixelShaderUsesSourceDepth;
320710e230b6Smaya   bool                                 PixelShaderComputedDepth;
320810e230b6Smaya   bool                                 PixelShaderKillsPixel;
320910e230b6Smaya   bool                                 LegacyDiamondLineRasterization;
321010e230b6Smaya   uint32_t                             MaximumNumberofThreads;
321110e230b6Smaya   uint32_t                             MultisampleDispatchMode;
321210e230b6Smaya#define MSDISPMODE_PERSAMPLE                     0
321310e230b6Smaya#define MSDISPMODE_PERPIXEL                      1
321410e230b6Smaya   uint32_t                             MultisampleRasterizationMode;
321510e230b6Smaya#define MSRASTMODE_OFF_PIXEL                     0
321610e230b6Smaya#define MSRASTMODE_OFF_PATTERN                   1
321710e230b6Smaya#define MSRASTMODE_ON_PIXEL                      2
321810e230b6Smaya#define MSRASTMODE_ON_PATTERN                    3
321910e230b6Smaya   uint32_t                             PointRasterizationRule;
322010e230b6Smaya#define RASTRULE_UPPER_LEFT                      0
322110e230b6Smaya#define RASTRULE_UPPER_RIGHT                     1
322210e230b6Smaya   uint32_t                             BarycentricInterpolationMode;
322310e230b6Smaya#define BIM_PERSPECTIVE_PIXEL                    1
322410e230b6Smaya#define BIM_PERSPECTIVE_CENTROID                 2
322510e230b6Smaya#define BIM_PERSPECTIVE_SAMPLE                   4
322610e230b6Smaya#define BIM_LINEAR_PIXEL                         8
322710e230b6Smaya#define BIM_LINEAR_CENTROID                      16
322810e230b6Smaya#define BIM_LINEAR_SAMPLE                        32
322910e230b6Smaya   uint32_t                             PositionZWInterpolationMode;
323010e230b6Smaya#define INTERP_PIXEL                             0
323110e230b6Smaya#define INTERP_CENTROID                          2
323210e230b6Smaya#define INTERP_SAMPLE                            3
323310e230b6Smaya   uint32_t                             PositionXYOffsetSelect;
323410e230b6Smaya#define POSOFFSET_NONE                           0
323510e230b6Smaya#define POSOFFSET_CENTROID                       2
323610e230b6Smaya#define POSOFFSET_SAMPLE                         3
323710e230b6Smaya   uint32_t                             NumberofSFOutputAttributes;
323810e230b6Smaya   uint64_t                             KernelStartPointer1;
323910e230b6Smaya   uint64_t                             KernelStartPointer2;
324010e230b6Smaya};
324110e230b6Smaya
324296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
324396c5ddc4SrjsGFX6_3DSTATE_WM_pack(__attribute__((unused)) __gen_user_data *data,
324410e230b6Smaya                     __attribute__((unused)) void * restrict dst,
324596c5ddc4Srjs                     __attribute__((unused)) const struct GFX6_3DSTATE_WM * restrict values)
324610e230b6Smaya{
324710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
324810e230b6Smaya
324910e230b6Smaya   dw[0] =
325010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
325110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
325210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
325310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
325410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
325510e230b6Smaya
325610e230b6Smaya   dw[1] =
325710e230b6Smaya      __gen_offset(values->KernelStartPointer0, 6, 31);
325810e230b6Smaya
325910e230b6Smaya   dw[2] =
326010e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
326110e230b6Smaya      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
326210e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
326310e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
326410e230b6Smaya      __gen_uint(values->ThreadPriority, 17, 17) |
326510e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
326610e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
326710e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
326810e230b6Smaya      __gen_uint(values->SingleProgramFlow, 31, 31);
326910e230b6Smaya
327010e230b6Smaya   const uint32_t v3 =
327110e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
327296c5ddc4Srjs   dw[3] = __gen_address(data, &dw[3], values->ScratchSpaceBasePointer, v3, 10, 31);
327310e230b6Smaya
327410e230b6Smaya   dw[4] =
327510e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData2, 0, 6) |
327610e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData1, 8, 14) |
327710e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData0, 16, 22) |
327810e230b6Smaya      __gen_uint(values->HierarchicalDepthBufferResolveEnable, 27, 27) |
327910e230b6Smaya      __gen_uint(values->DepthBufferResolveEnable, 28, 28) |
328010e230b6Smaya      __gen_uint(values->DepthBufferClear, 30, 30) |
328110e230b6Smaya      __gen_uint(values->StatisticsEnable, 31, 31);
328210e230b6Smaya
328310e230b6Smaya   dw[5] =
328410e230b6Smaya      __gen_uint(values->_8PixelDispatchEnable, 0, 0) |
328510e230b6Smaya      __gen_uint(values->_16PixelDispatchEnable, 1, 1) |
328610e230b6Smaya      __gen_uint(values->_32PixelDispatchEnable, 2, 2) |
328710e230b6Smaya      __gen_uint(values->DualSourceBlendEnable, 7, 7) |
328810e230b6Smaya      __gen_uint(values->PixelShaderUsesSourceW, 8, 8) |
328910e230b6Smaya      __gen_uint(values->oMaskPresenttoRenderTarget, 9, 9) |
329010e230b6Smaya      __gen_uint(values->LineStippleEnable, 11, 11) |
329110e230b6Smaya      __gen_uint(values->PolygonStippleEnable, 13, 13) |
329210e230b6Smaya      __gen_uint(values->LineAntialiasingRegionWidth, 14, 15) |
329310e230b6Smaya      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 16, 17) |
329410e230b6Smaya      __gen_uint(values->ThreadDispatchEnable, 19, 19) |
329510e230b6Smaya      __gen_uint(values->PixelShaderUsesSourceDepth, 20, 20) |
329610e230b6Smaya      __gen_uint(values->PixelShaderComputedDepth, 21, 21) |
329710e230b6Smaya      __gen_uint(values->PixelShaderKillsPixel, 22, 22) |
329810e230b6Smaya      __gen_uint(values->LegacyDiamondLineRasterization, 23, 23) |
329910e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 25, 31);
330010e230b6Smaya
330110e230b6Smaya   dw[6] =
330210e230b6Smaya      __gen_uint(values->MultisampleDispatchMode, 0, 0) |
330310e230b6Smaya      __gen_uint(values->MultisampleRasterizationMode, 1, 2) |
330410e230b6Smaya      __gen_uint(values->PointRasterizationRule, 9, 9) |
330510e230b6Smaya      __gen_uint(values->BarycentricInterpolationMode, 10, 15) |
330610e230b6Smaya      __gen_uint(values->PositionZWInterpolationMode, 16, 17) |
330710e230b6Smaya      __gen_uint(values->PositionXYOffsetSelect, 18, 19) |
330810e230b6Smaya      __gen_uint(values->NumberofSFOutputAttributes, 20, 25);
330910e230b6Smaya
331010e230b6Smaya   dw[7] =
331110e230b6Smaya      __gen_offset(values->KernelStartPointer1, 6, 31);
331210e230b6Smaya
331310e230b6Smaya   dw[8] =
331410e230b6Smaya      __gen_offset(values->KernelStartPointer2, 6, 31);
331510e230b6Smaya}
331610e230b6Smaya
331796c5ddc4Srjs#define GFX6_MEDIA_CURBE_LOAD_length           4
331896c5ddc4Srjs#define GFX6_MEDIA_CURBE_LOAD_length_bias      2
331996c5ddc4Srjs#define GFX6_MEDIA_CURBE_LOAD_header            \
332010e230b6Smaya   .DWordLength                         =      2,  \
332110e230b6Smaya   .SubOpcode                           =      1,  \
332210e230b6Smaya   .MediaCommandOpcode                  =      0,  \
332310e230b6Smaya   .Pipeline                            =      2,  \
332410e230b6Smaya   .CommandType                         =      3
332510e230b6Smaya
332696c5ddc4Srjsstruct GFX6_MEDIA_CURBE_LOAD {
332710e230b6Smaya   uint32_t                             DWordLength;
332810e230b6Smaya   uint32_t                             SubOpcode;
332910e230b6Smaya   uint32_t                             MediaCommandOpcode;
333010e230b6Smaya   uint32_t                             Pipeline;
333110e230b6Smaya   uint32_t                             CommandType;
333210e230b6Smaya   uint32_t                             CURBETotalDataLength;
333310e230b6Smaya   uint32_t                             CURBEDataStartAddress;
333410e230b6Smaya};
333510e230b6Smaya
333696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
333796c5ddc4SrjsGFX6_MEDIA_CURBE_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
333810e230b6Smaya                           __attribute__((unused)) void * restrict dst,
333996c5ddc4Srjs                           __attribute__((unused)) const struct GFX6_MEDIA_CURBE_LOAD * restrict values)
334010e230b6Smaya{
334110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
334210e230b6Smaya
334310e230b6Smaya   dw[0] =
334410e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
334510e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
334610e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
334710e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
334810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
334910e230b6Smaya
335010e230b6Smaya   dw[1] = 0;
335110e230b6Smaya
335210e230b6Smaya   dw[2] =
335310e230b6Smaya      __gen_uint(values->CURBETotalDataLength, 0, 16);
335410e230b6Smaya
335510e230b6Smaya   dw[3] =
335610e230b6Smaya      __gen_uint(values->CURBEDataStartAddress, 0, 31);
335710e230b6Smaya}
335810e230b6Smaya
335996c5ddc4Srjs#define GFX6_MEDIA_GATEWAY_STATE_length        2
336096c5ddc4Srjs#define GFX6_MEDIA_GATEWAY_STATE_length_bias      2
336196c5ddc4Srjs#define GFX6_MEDIA_GATEWAY_STATE_header         \
336210e230b6Smaya   .DWordLength                         =      0,  \
336310e230b6Smaya   .SubOpcode                           =      3,  \
336410e230b6Smaya   .MediaCommandOpcode                  =      0,  \
336510e230b6Smaya   .Pipeline                            =      2,  \
336610e230b6Smaya   .CommandType                         =      3
336710e230b6Smaya
336896c5ddc4Srjsstruct GFX6_MEDIA_GATEWAY_STATE {
336910e230b6Smaya   uint32_t                             DWordLength;
337010e230b6Smaya   uint32_t                             SubOpcode;
337110e230b6Smaya   uint32_t                             MediaCommandOpcode;
337210e230b6Smaya   uint32_t                             Pipeline;
337310e230b6Smaya   uint32_t                             CommandType;
337410e230b6Smaya   uint32_t                             BarrierThreadCount;
337510e230b6Smaya   uint32_t                             BarrierByte;
337610e230b6Smaya   uint32_t                             BarrierID;
337710e230b6Smaya};
337810e230b6Smaya
337996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
338096c5ddc4SrjsGFX6_MEDIA_GATEWAY_STATE_pack(__attribute__((unused)) __gen_user_data *data,
338110e230b6Smaya                              __attribute__((unused)) void * restrict dst,
338296c5ddc4Srjs                              __attribute__((unused)) const struct GFX6_MEDIA_GATEWAY_STATE * restrict values)
338310e230b6Smaya{
338410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
338510e230b6Smaya
338610e230b6Smaya   dw[0] =
338710e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
338810e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
338910e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
339010e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
339110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
339210e230b6Smaya
339310e230b6Smaya   dw[1] =
339410e230b6Smaya      __gen_uint(values->BarrierThreadCount, 0, 7) |
339510e230b6Smaya      __gen_uint(values->BarrierByte, 8, 15) |
339610e230b6Smaya      __gen_uint(values->BarrierID, 16, 23);
339710e230b6Smaya}
339810e230b6Smaya
339996c5ddc4Srjs#define GFX6_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length      4
340096c5ddc4Srjs#define GFX6_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length_bias      2
340196c5ddc4Srjs#define GFX6_MEDIA_INTERFACE_DESCRIPTOR_LOAD_header\
340210e230b6Smaya   .DWordLength                         =      2,  \
340310e230b6Smaya   .SubOpcode                           =      2,  \
340410e230b6Smaya   .MediaCommandOpcode                  =      0,  \
340510e230b6Smaya   .Pipeline                            =      2,  \
340610e230b6Smaya   .CommandType                         =      3
340710e230b6Smaya
340896c5ddc4Srjsstruct GFX6_MEDIA_INTERFACE_DESCRIPTOR_LOAD {
340910e230b6Smaya   uint32_t                             DWordLength;
341010e230b6Smaya   uint32_t                             SubOpcode;
341110e230b6Smaya   uint32_t                             MediaCommandOpcode;
341210e230b6Smaya   uint32_t                             Pipeline;
341310e230b6Smaya   uint32_t                             CommandType;
341410e230b6Smaya   uint32_t                             InterfaceDescriptorTotalLength;
341510e230b6Smaya   uint64_t                             InterfaceDescriptorDataStartAddress;
341610e230b6Smaya};
341710e230b6Smaya
341896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
341996c5ddc4SrjsGFX6_MEDIA_INTERFACE_DESCRIPTOR_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
342010e230b6Smaya                                          __attribute__((unused)) void * restrict dst,
342196c5ddc4Srjs                                          __attribute__((unused)) const struct GFX6_MEDIA_INTERFACE_DESCRIPTOR_LOAD * restrict values)
342210e230b6Smaya{
342310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
342410e230b6Smaya
342510e230b6Smaya   dw[0] =
342610e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
342710e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
342810e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
342910e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
343010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
343110e230b6Smaya
343210e230b6Smaya   dw[1] = 0;
343310e230b6Smaya
343410e230b6Smaya   dw[2] =
343510e230b6Smaya      __gen_uint(values->InterfaceDescriptorTotalLength, 0, 16);
343610e230b6Smaya
343710e230b6Smaya   dw[3] =
343810e230b6Smaya      __gen_offset(values->InterfaceDescriptorDataStartAddress, 0, 31);
343910e230b6Smaya}
344010e230b6Smaya
344196c5ddc4Srjs#define GFX6_MEDIA_OBJECT_length_bias          2
344296c5ddc4Srjs#define GFX6_MEDIA_OBJECT_header                \
344310e230b6Smaya   .DWordLength                         =      4,  \
344410e230b6Smaya   .MediaCommandSubOpcode               =      0,  \
344510e230b6Smaya   .MediaCommandOpcode                  =      1,  \
344610e230b6Smaya   .MediaCommandPipeline                =      2,  \
344710e230b6Smaya   .CommandType                         =      3
344810e230b6Smaya
344996c5ddc4Srjsstruct GFX6_MEDIA_OBJECT {
345010e230b6Smaya   uint32_t                             DWordLength;
345110e230b6Smaya   uint32_t                             MediaCommandSubOpcode;
345210e230b6Smaya   uint32_t                             MediaCommandOpcode;
345310e230b6Smaya   uint32_t                             MediaCommandPipeline;
345410e230b6Smaya   uint32_t                             CommandType;
345510e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
345610e230b6Smaya   uint32_t                             IndirectDataLength;
345710e230b6Smaya   uint32_t                             UseScoreboard;
345810e230b6Smaya#define Notusingscoreboard                       0
345910e230b6Smaya#define Usingscoreboard                          1
346010e230b6Smaya   uint32_t                             ThreadSynchronization;
346110e230b6Smaya#define Nothreadsynchronization                  0
346210e230b6Smaya#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
346310e230b6Smaya   bool                                 ChildrenPresent;
346410e230b6Smaya   __gen_address_type                   IndirectDataStartAddress;
346510e230b6Smaya   uint32_t                             ScoreboardX;
346610e230b6Smaya   uint32_t                             ScoredboardY;
346710e230b6Smaya   uint32_t                             ScoreboardMask;
346810e230b6Smaya   uint32_t                             ScoreboardColor;
346910e230b6Smaya   /* variable length fields follow */
347010e230b6Smaya};
347110e230b6Smaya
347296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
347396c5ddc4SrjsGFX6_MEDIA_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
347410e230b6Smaya                       __attribute__((unused)) void * restrict dst,
347596c5ddc4Srjs                       __attribute__((unused)) const struct GFX6_MEDIA_OBJECT * restrict values)
347610e230b6Smaya{
347710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
347810e230b6Smaya
347910e230b6Smaya   dw[0] =
348010e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
348110e230b6Smaya      __gen_uint(values->MediaCommandSubOpcode, 16, 23) |
348210e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
348310e230b6Smaya      __gen_uint(values->MediaCommandPipeline, 27, 28) |
348410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
348510e230b6Smaya
348610e230b6Smaya   dw[1] =
348710e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
348810e230b6Smaya
348910e230b6Smaya   dw[2] =
349010e230b6Smaya      __gen_uint(values->IndirectDataLength, 0, 16) |
349110e230b6Smaya      __gen_uint(values->UseScoreboard, 21, 21) |
349210e230b6Smaya      __gen_uint(values->ThreadSynchronization, 24, 24) |
349310e230b6Smaya      __gen_uint(values->ChildrenPresent, 31, 31);
349410e230b6Smaya
349596c5ddc4Srjs   dw[3] = __gen_address(data, &dw[3], values->IndirectDataStartAddress, 0, 0, 31);
349610e230b6Smaya
349710e230b6Smaya   dw[4] =
349810e230b6Smaya      __gen_uint(values->ScoreboardX, 0, 8) |
349910e230b6Smaya      __gen_uint(values->ScoredboardY, 16, 24);
350010e230b6Smaya
350110e230b6Smaya   dw[5] =
350210e230b6Smaya      __gen_uint(values->ScoreboardMask, 0, 7) |
350310e230b6Smaya      __gen_uint(values->ScoreboardColor, 16, 19);
350410e230b6Smaya}
350510e230b6Smaya
350696c5ddc4Srjs#define GFX6_MEDIA_OBJECT_PRT_length          16
350796c5ddc4Srjs#define GFX6_MEDIA_OBJECT_PRT_length_bias      2
350896c5ddc4Srjs#define GFX6_MEDIA_OBJECT_PRT_header            \
350910e230b6Smaya   .DWordLength                         =     14,  \
351010e230b6Smaya   .SubOpcode                           =      2,  \
351110e230b6Smaya   .MediaCommandOpcode                  =      1,  \
351210e230b6Smaya   .Pipeline                            =      2,  \
351310e230b6Smaya   .CommandType                         =      3
351410e230b6Smaya
351596c5ddc4Srjsstruct GFX6_MEDIA_OBJECT_PRT {
351610e230b6Smaya   uint32_t                             DWordLength;
351710e230b6Smaya   uint32_t                             SubOpcode;
351810e230b6Smaya   uint32_t                             MediaCommandOpcode;
351910e230b6Smaya   uint32_t                             Pipeline;
352010e230b6Smaya   uint32_t                             CommandType;
352110e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
352210e230b6Smaya   uint32_t                             PRT_FenceType;
352310e230b6Smaya#define Rootthreadqueue                          0
352410e230b6Smaya#define VFEstateflush                            1
352510e230b6Smaya   bool                                 PRT_FenceNeeded;
352610e230b6Smaya   bool                                 ChildrenPresent;
352710e230b6Smaya   uint32_t                             InlineData[12];
352810e230b6Smaya};
352910e230b6Smaya
353096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
353196c5ddc4SrjsGFX6_MEDIA_OBJECT_PRT_pack(__attribute__((unused)) __gen_user_data *data,
353210e230b6Smaya                           __attribute__((unused)) void * restrict dst,
353396c5ddc4Srjs                           __attribute__((unused)) const struct GFX6_MEDIA_OBJECT_PRT * restrict values)
353410e230b6Smaya{
353510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
353610e230b6Smaya
353710e230b6Smaya   dw[0] =
353810e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
353910e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
354010e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
354110e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
354210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
354310e230b6Smaya
354410e230b6Smaya   dw[1] =
354510e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
354610e230b6Smaya
354710e230b6Smaya   dw[2] =
354810e230b6Smaya      __gen_uint(values->PRT_FenceType, 22, 22) |
354910e230b6Smaya      __gen_uint(values->PRT_FenceNeeded, 23, 23) |
355010e230b6Smaya      __gen_uint(values->ChildrenPresent, 31, 31);
355110e230b6Smaya
355210e230b6Smaya   dw[3] = 0;
355310e230b6Smaya
355410e230b6Smaya   dw[4] =
355510e230b6Smaya      __gen_uint(values->InlineData[0], 0, 31);
355610e230b6Smaya
355710e230b6Smaya   dw[5] =
355810e230b6Smaya      __gen_uint(values->InlineData[1], 0, 31);
355910e230b6Smaya
356010e230b6Smaya   dw[6] =
356110e230b6Smaya      __gen_uint(values->InlineData[2], 0, 31);
356210e230b6Smaya
356310e230b6Smaya   dw[7] =
356410e230b6Smaya      __gen_uint(values->InlineData[3], 0, 31);
356510e230b6Smaya
356610e230b6Smaya   dw[8] =
356710e230b6Smaya      __gen_uint(values->InlineData[4], 0, 31);
356810e230b6Smaya
356910e230b6Smaya   dw[9] =
357010e230b6Smaya      __gen_uint(values->InlineData[5], 0, 31);
357110e230b6Smaya
357210e230b6Smaya   dw[10] =
357310e230b6Smaya      __gen_uint(values->InlineData[6], 0, 31);
357410e230b6Smaya
357510e230b6Smaya   dw[11] =
357610e230b6Smaya      __gen_uint(values->InlineData[7], 0, 31);
357710e230b6Smaya
357810e230b6Smaya   dw[12] =
357910e230b6Smaya      __gen_uint(values->InlineData[8], 0, 31);
358010e230b6Smaya
358110e230b6Smaya   dw[13] =
358210e230b6Smaya      __gen_uint(values->InlineData[9], 0, 31);
358310e230b6Smaya
358410e230b6Smaya   dw[14] =
358510e230b6Smaya      __gen_uint(values->InlineData[10], 0, 31);
358610e230b6Smaya
358710e230b6Smaya   dw[15] =
358810e230b6Smaya      __gen_uint(values->InlineData[11], 0, 31);
358910e230b6Smaya}
359010e230b6Smaya
359196c5ddc4Srjs#define GFX6_MEDIA_OBJECT_WALKER_length_bias      2
359296c5ddc4Srjs#define GFX6_MEDIA_OBJECT_WALKER_header         \
359310e230b6Smaya   .DWordLength                         =     15,  \
359410e230b6Smaya   .SubOpcode                           =      3,  \
359510e230b6Smaya   .MediaCommandOpcode                  =      1,  \
359610e230b6Smaya   .Pipeline                            =      2,  \
359710e230b6Smaya   .CommandType                         =      3
359810e230b6Smaya
359996c5ddc4Srjsstruct GFX6_MEDIA_OBJECT_WALKER {
360010e230b6Smaya   uint32_t                             DWordLength;
360110e230b6Smaya   uint32_t                             SubOpcode;
360210e230b6Smaya   uint32_t                             MediaCommandOpcode;
360310e230b6Smaya   uint32_t                             Pipeline;
360410e230b6Smaya   uint32_t                             CommandType;
360510e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
360610e230b6Smaya   uint32_t                             IndirectDataLength;
360710e230b6Smaya   uint32_t                             UseScoreboard;
360810e230b6Smaya#define Notusingscoreboard                       0
360910e230b6Smaya#define Usingscoreboard                          1
361010e230b6Smaya   uint32_t                             ThreadSynchronization;
361110e230b6Smaya#define Nothreadsynchronization                  0
361210e230b6Smaya#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
361310e230b6Smaya   uint32_t                             ChildrenPresent;
361410e230b6Smaya   uint64_t                             IndirectDataStartAddress;
361510e230b6Smaya   uint32_t                             ScoreboardMask;
361610e230b6Smaya   int32_t                              MidLoopUnitX;
361710e230b6Smaya   int32_t                              LocalMidLoopUnitY;
361810e230b6Smaya   uint32_t                             MiddleLoopExtraSteps;
361910e230b6Smaya   uint32_t                             ColorCountMinusOne;
362010e230b6Smaya   uint32_t                             Repel;
362110e230b6Smaya   uint32_t                             DualMode;
362210e230b6Smaya   uint32_t                             LocalLoopExecCount;
362310e230b6Smaya   uint32_t                             GlobalLoopExecCount;
362410e230b6Smaya   uint32_t                             BlockResolutionX;
362510e230b6Smaya   uint32_t                             BlockResolutionY;
362610e230b6Smaya   uint32_t                             LocalStartX;
362710e230b6Smaya   uint32_t                             LocalStartY;
362810e230b6Smaya   uint32_t                             LocalEndX;
362910e230b6Smaya   uint32_t                             LocalEndY;
363010e230b6Smaya   int32_t                              LocalOuterLoopStrideX;
363110e230b6Smaya   int32_t                              LocalOuterLoopStrideY;
363210e230b6Smaya   int32_t                              LocalInnerLoopUnitX;
363310e230b6Smaya   int32_t                              LocalInnerLoopUnitY;
363410e230b6Smaya   uint32_t                             GlobalResolutionX;
363510e230b6Smaya   uint32_t                             GlobalResolutionY;
363610e230b6Smaya   int32_t                              GlobalStartX;
363710e230b6Smaya   int32_t                              GlobalStartY;
363810e230b6Smaya   int32_t                              GlobalOuterLoopStrideX;
363910e230b6Smaya   int32_t                              GlobalOuterLoopStrideY;
364010e230b6Smaya   int32_t                              GlobalInnerLoopUnitX;
364110e230b6Smaya   int32_t                              GlobalInnerLoopUnitY;
364210e230b6Smaya   /* variable length fields follow */
364310e230b6Smaya};
364410e230b6Smaya
364596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
364696c5ddc4SrjsGFX6_MEDIA_OBJECT_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
364710e230b6Smaya                              __attribute__((unused)) void * restrict dst,
364896c5ddc4Srjs                              __attribute__((unused)) const struct GFX6_MEDIA_OBJECT_WALKER * restrict values)
364910e230b6Smaya{
365010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
365110e230b6Smaya
365210e230b6Smaya   dw[0] =
365310e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
365410e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
365510e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
365610e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
365710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
365810e230b6Smaya
365910e230b6Smaya   dw[1] =
366010e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
366110e230b6Smaya
366210e230b6Smaya   dw[2] =
366310e230b6Smaya      __gen_uint(values->IndirectDataLength, 0, 16) |
366410e230b6Smaya      __gen_uint(values->UseScoreboard, 21, 21) |
366510e230b6Smaya      __gen_uint(values->ThreadSynchronization, 24, 24) |
366610e230b6Smaya      __gen_uint(values->ChildrenPresent, 31, 31);
366710e230b6Smaya
366810e230b6Smaya   dw[3] =
366910e230b6Smaya      __gen_offset(values->IndirectDataStartAddress, 0, 31);
367010e230b6Smaya
367110e230b6Smaya   dw[4] = 0;
367210e230b6Smaya
367310e230b6Smaya   dw[5] =
367410e230b6Smaya      __gen_uint(values->ScoreboardMask, 0, 7);
367510e230b6Smaya
367610e230b6Smaya   dw[6] =
367710e230b6Smaya      __gen_sint(values->MidLoopUnitX, 8, 9) |
367810e230b6Smaya      __gen_sint(values->LocalMidLoopUnitY, 12, 13) |
367910e230b6Smaya      __gen_uint(values->MiddleLoopExtraSteps, 16, 20) |
368010e230b6Smaya      __gen_uint(values->ColorCountMinusOne, 24, 27) |
368110e230b6Smaya      __gen_uint(values->Repel, 30, 30) |
368210e230b6Smaya      __gen_uint(values->DualMode, 31, 31);
368310e230b6Smaya
368410e230b6Smaya   dw[7] =
368510e230b6Smaya      __gen_uint(values->LocalLoopExecCount, 0, 9) |
368610e230b6Smaya      __gen_uint(values->GlobalLoopExecCount, 16, 25);
368710e230b6Smaya
368810e230b6Smaya   dw[8] =
368910e230b6Smaya      __gen_uint(values->BlockResolutionX, 0, 8) |
369010e230b6Smaya      __gen_uint(values->BlockResolutionY, 16, 24);
369110e230b6Smaya
369210e230b6Smaya   dw[9] =
369310e230b6Smaya      __gen_uint(values->LocalStartX, 0, 8) |
369410e230b6Smaya      __gen_uint(values->LocalStartY, 16, 24);
369510e230b6Smaya
369610e230b6Smaya   dw[10] =
369710e230b6Smaya      __gen_uint(values->LocalEndX, 0, 8) |
369810e230b6Smaya      __gen_uint(values->LocalEndY, 16, 24);
369910e230b6Smaya
370010e230b6Smaya   dw[11] =
370110e230b6Smaya      __gen_sint(values->LocalOuterLoopStrideX, 0, 9) |
370210e230b6Smaya      __gen_sint(values->LocalOuterLoopStrideY, 16, 25);
370310e230b6Smaya
370410e230b6Smaya   dw[12] =
370510e230b6Smaya      __gen_sint(values->LocalInnerLoopUnitX, 0, 9) |
370610e230b6Smaya      __gen_sint(values->LocalInnerLoopUnitY, 16, 25);
370710e230b6Smaya
370810e230b6Smaya   dw[13] =
370910e230b6Smaya      __gen_uint(values->GlobalResolutionX, 0, 8) |
371010e230b6Smaya      __gen_uint(values->GlobalResolutionY, 16, 24);
371110e230b6Smaya
371210e230b6Smaya   dw[14] =
371310e230b6Smaya      __gen_sint(values->GlobalStartX, 0, 9) |
371410e230b6Smaya      __gen_sint(values->GlobalStartY, 16, 25);
371510e230b6Smaya
371610e230b6Smaya   dw[15] =
371710e230b6Smaya      __gen_sint(values->GlobalOuterLoopStrideX, 0, 9) |
371810e230b6Smaya      __gen_sint(values->GlobalOuterLoopStrideY, 16, 25);
371910e230b6Smaya
372010e230b6Smaya   dw[16] =
372110e230b6Smaya      __gen_sint(values->GlobalInnerLoopUnitX, 0, 9) |
372210e230b6Smaya      __gen_sint(values->GlobalInnerLoopUnitY, 16, 25);
372310e230b6Smaya}
372410e230b6Smaya
372596c5ddc4Srjs#define GFX6_MEDIA_STATE_FLUSH_length          2
372696c5ddc4Srjs#define GFX6_MEDIA_STATE_FLUSH_length_bias      2
372796c5ddc4Srjs#define GFX6_MEDIA_STATE_FLUSH_header           \
372810e230b6Smaya   .DWordLength                         =      0,  \
372910e230b6Smaya   .SubOpcode                           =      4,  \
373010e230b6Smaya   .MediaCommandOpcode                  =      0,  \
373110e230b6Smaya   .Pipeline                            =      2,  \
373210e230b6Smaya   .CommandType                         =      3
373310e230b6Smaya
373496c5ddc4Srjsstruct GFX6_MEDIA_STATE_FLUSH {
373510e230b6Smaya   uint32_t                             DWordLength;
373610e230b6Smaya   uint32_t                             SubOpcode;
373710e230b6Smaya   uint32_t                             MediaCommandOpcode;
373810e230b6Smaya   uint32_t                             Pipeline;
373910e230b6Smaya   uint32_t                             CommandType;
374010e230b6Smaya   uint32_t                             BarrierMask;
374110e230b6Smaya#define NotWaiting                               0
374210e230b6Smaya#define Waiting                                  1
374310e230b6Smaya   uint32_t                             ThreadCountWaterMark;
374410e230b6Smaya};
374510e230b6Smaya
374696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
374796c5ddc4SrjsGFX6_MEDIA_STATE_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
374810e230b6Smaya                            __attribute__((unused)) void * restrict dst,
374996c5ddc4Srjs                            __attribute__((unused)) const struct GFX6_MEDIA_STATE_FLUSH * restrict values)
375010e230b6Smaya{
375110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
375210e230b6Smaya
375310e230b6Smaya   dw[0] =
375410e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
375510e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
375610e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
375710e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
375810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
375910e230b6Smaya
376010e230b6Smaya   dw[1] =
376110e230b6Smaya      __gen_uint(values->BarrierMask, 0, 15) |
376210e230b6Smaya      __gen_uint(values->ThreadCountWaterMark, 16, 23);
376310e230b6Smaya}
376410e230b6Smaya
376596c5ddc4Srjs#define GFX6_MEDIA_VFE_STATE_length            8
376696c5ddc4Srjs#define GFX6_MEDIA_VFE_STATE_length_bias       2
376796c5ddc4Srjs#define GFX6_MEDIA_VFE_STATE_header             \
376810e230b6Smaya   .DWordLength                         =      6,  \
376910e230b6Smaya   .SubOpcode                           =      0,  \
377010e230b6Smaya   .MediaCommandOpcode                  =      0,  \
377110e230b6Smaya   .Pipeline                            =      2,  \
377210e230b6Smaya   .CommandType                         =      3
377310e230b6Smaya
377496c5ddc4Srjsstruct GFX6_MEDIA_VFE_STATE {
377510e230b6Smaya   uint32_t                             DWordLength;
377610e230b6Smaya   uint32_t                             SubOpcode;
377710e230b6Smaya   uint32_t                             MediaCommandOpcode;
377810e230b6Smaya   uint32_t                             Pipeline;
377910e230b6Smaya   uint32_t                             CommandType;
378010e230b6Smaya   uint32_t                             PerThreadScratchSpace;
378110e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
378210e230b6Smaya   uint32_t                             FastPreempt;
378310e230b6Smaya#define Preemptonly_PRT                          0
378410e230b6Smaya   uint32_t                             BypassGatewayControl;
378510e230b6Smaya#define MaintainingOpenGatewayForwardMsgCloseGatewayprotocollegacymode 0
378610e230b6Smaya#define BypassingOpenGatewayCloseGatewayprotocol 1
378710e230b6Smaya   uint32_t                             ResetGatewayTimer;
378810e230b6Smaya#define Maintainingtheexistingtimestampstate     0
378910e230b6Smaya#define Resettingrelativetimerandlatchingtheglobaltimestamp 1
379010e230b6Smaya   uint32_t                             NumberofURBEntries;
379110e230b6Smaya   uint32_t                             MaximumNumberofThreads;
379210e230b6Smaya   uint32_t                             CURBEAllocationSize;
379310e230b6Smaya   uint32_t                             URBEntryAllocationSize;
379410e230b6Smaya   uint32_t                             ScoreboardMask;
379510e230b6Smaya   uint32_t                             ScoreboardType;
379610e230b6Smaya#define StallingScoreboard                       0
379710e230b6Smaya   uint32_t                             ScoreboardEnable;
379810e230b6Smaya#define Scoreboarddisabled                       0
379910e230b6Smaya#define Scoreboardenabled                        1
380010e230b6Smaya   int32_t                              Scoreboard0DeltaX;
380110e230b6Smaya   int32_t                              Scoreboard0DeltaY;
380210e230b6Smaya   int32_t                              Scoreboard1DeltaX;
380310e230b6Smaya   int32_t                              Scoreboard1DeltaY;
380410e230b6Smaya   int32_t                              Scoreboard2DeltaX;
380510e230b6Smaya   int32_t                              Scoreboard2DeltaY;
380610e230b6Smaya   int32_t                              Scoreboard3DeltaX;
380710e230b6Smaya   int32_t                              Scoreboard3DeltaY;
380810e230b6Smaya   int32_t                              Scoreboard4DeltaX;
380910e230b6Smaya   int32_t                              Scoreboard4DeltaY;
381010e230b6Smaya   int32_t                              Scoreboard5DeltaX;
381110e230b6Smaya   int32_t                              Scoreboard5DeltaY;
381210e230b6Smaya   int32_t                              Scoreboard6DeltaX;
381310e230b6Smaya   int32_t                              Scoreboard6DeltaY;
381410e230b6Smaya   int32_t                              Scoreboard7DeltaX;
381510e230b6Smaya   int32_t                              Scoreboard7DeltaY;
381610e230b6Smaya};
381710e230b6Smaya
381896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
381996c5ddc4SrjsGFX6_MEDIA_VFE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
382010e230b6Smaya                          __attribute__((unused)) void * restrict dst,
382196c5ddc4Srjs                          __attribute__((unused)) const struct GFX6_MEDIA_VFE_STATE * restrict values)
382210e230b6Smaya{
382310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
382410e230b6Smaya
382510e230b6Smaya   dw[0] =
382610e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
382710e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
382810e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
382910e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
383010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
383110e230b6Smaya
383210e230b6Smaya   const uint32_t v1 =
383310e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
383496c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->ScratchSpaceBasePointer, v1, 10, 31);
383510e230b6Smaya
383610e230b6Smaya   dw[2] =
383710e230b6Smaya      __gen_uint(values->FastPreempt, 5, 5) |
383810e230b6Smaya      __gen_uint(values->BypassGatewayControl, 6, 6) |
383910e230b6Smaya      __gen_uint(values->ResetGatewayTimer, 7, 7) |
384010e230b6Smaya      __gen_uint(values->NumberofURBEntries, 8, 15) |
384110e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 16, 31);
384210e230b6Smaya
384310e230b6Smaya   dw[3] = 0;
384410e230b6Smaya
384510e230b6Smaya   dw[4] =
384610e230b6Smaya      __gen_uint(values->CURBEAllocationSize, 0, 15) |
384710e230b6Smaya      __gen_uint(values->URBEntryAllocationSize, 16, 31);
384810e230b6Smaya
384910e230b6Smaya   dw[5] =
385010e230b6Smaya      __gen_uint(values->ScoreboardMask, 0, 7) |
385110e230b6Smaya      __gen_uint(values->ScoreboardType, 30, 30) |
385210e230b6Smaya      __gen_uint(values->ScoreboardEnable, 31, 31);
385310e230b6Smaya
385410e230b6Smaya   dw[6] =
385510e230b6Smaya      __gen_sint(values->Scoreboard0DeltaX, 0, 3) |
385610e230b6Smaya      __gen_sint(values->Scoreboard0DeltaY, 4, 7) |
385710e230b6Smaya      __gen_sint(values->Scoreboard1DeltaX, 8, 11) |
385810e230b6Smaya      __gen_sint(values->Scoreboard1DeltaY, 12, 15) |
385910e230b6Smaya      __gen_sint(values->Scoreboard2DeltaX, 16, 19) |
386010e230b6Smaya      __gen_sint(values->Scoreboard2DeltaY, 20, 23) |
386110e230b6Smaya      __gen_sint(values->Scoreboard3DeltaX, 24, 27) |
386210e230b6Smaya      __gen_sint(values->Scoreboard3DeltaY, 28, 31);
386310e230b6Smaya
386410e230b6Smaya   dw[7] =
386510e230b6Smaya      __gen_sint(values->Scoreboard4DeltaX, 0, 3) |
386610e230b6Smaya      __gen_sint(values->Scoreboard4DeltaY, 4, 7) |
386710e230b6Smaya      __gen_sint(values->Scoreboard5DeltaX, 8, 11) |
386810e230b6Smaya      __gen_sint(values->Scoreboard5DeltaY, 12, 15) |
386910e230b6Smaya      __gen_sint(values->Scoreboard6DeltaX, 16, 19) |
387010e230b6Smaya      __gen_sint(values->Scoreboard6DeltaY, 20, 23) |
387110e230b6Smaya      __gen_sint(values->Scoreboard7DeltaX, 24, 27) |
387210e230b6Smaya      __gen_sint(values->Scoreboard7DeltaY, 28, 31);
387310e230b6Smaya}
387410e230b6Smaya
387596c5ddc4Srjs#define GFX6_MI_ARB_CHECK_length               1
387696c5ddc4Srjs#define GFX6_MI_ARB_CHECK_length_bias          1
387796c5ddc4Srjs#define GFX6_MI_ARB_CHECK_header                \
387810e230b6Smaya   .MICommandOpcode                     =      5,  \
387910e230b6Smaya   .CommandType                         =      0
388010e230b6Smaya
388196c5ddc4Srjsstruct GFX6_MI_ARB_CHECK {
388210e230b6Smaya   uint32_t                             MICommandOpcode;
388310e230b6Smaya   uint32_t                             CommandType;
388410e230b6Smaya};
388510e230b6Smaya
388696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
388796c5ddc4SrjsGFX6_MI_ARB_CHECK_pack(__attribute__((unused)) __gen_user_data *data,
388810e230b6Smaya                       __attribute__((unused)) void * restrict dst,
388996c5ddc4Srjs                       __attribute__((unused)) const struct GFX6_MI_ARB_CHECK * restrict values)
389010e230b6Smaya{
389110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
389210e230b6Smaya
389310e230b6Smaya   dw[0] =
389410e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
389510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
389610e230b6Smaya}
389710e230b6Smaya
389896c5ddc4Srjs#define GFX6_MI_ARB_ON_OFF_length              1
389996c5ddc4Srjs#define GFX6_MI_ARB_ON_OFF_length_bias         1
390096c5ddc4Srjs#define GFX6_MI_ARB_ON_OFF_header               \
390110e230b6Smaya   .MICommandOpcode                     =      8,  \
390210e230b6Smaya   .CommandType                         =      0
390310e230b6Smaya
390496c5ddc4Srjsstruct GFX6_MI_ARB_ON_OFF {
390510e230b6Smaya   bool                                 ArbitrationEnable;
390610e230b6Smaya   uint32_t                             MICommandOpcode;
390710e230b6Smaya   uint32_t                             CommandType;
390810e230b6Smaya};
390910e230b6Smaya
391096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
391196c5ddc4SrjsGFX6_MI_ARB_ON_OFF_pack(__attribute__((unused)) __gen_user_data *data,
391210e230b6Smaya                        __attribute__((unused)) void * restrict dst,
391396c5ddc4Srjs                        __attribute__((unused)) const struct GFX6_MI_ARB_ON_OFF * restrict values)
391410e230b6Smaya{
391510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
391610e230b6Smaya
391710e230b6Smaya   dw[0] =
391810e230b6Smaya      __gen_uint(values->ArbitrationEnable, 0, 0) |
391910e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
392010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
392110e230b6Smaya}
392210e230b6Smaya
392396c5ddc4Srjs#define GFX6_MI_BATCH_BUFFER_END_length        1
392496c5ddc4Srjs#define GFX6_MI_BATCH_BUFFER_END_length_bias      1
392596c5ddc4Srjs#define GFX6_MI_BATCH_BUFFER_END_header         \
392610e230b6Smaya   .MICommandOpcode                     =     10,  \
392710e230b6Smaya   .CommandType                         =      0
392810e230b6Smaya
392996c5ddc4Srjsstruct GFX6_MI_BATCH_BUFFER_END {
393010e230b6Smaya   uint32_t                             MICommandOpcode;
393110e230b6Smaya   uint32_t                             CommandType;
393210e230b6Smaya};
393310e230b6Smaya
393496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
393596c5ddc4SrjsGFX6_MI_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
393610e230b6Smaya                              __attribute__((unused)) void * restrict dst,
393796c5ddc4Srjs                              __attribute__((unused)) const struct GFX6_MI_BATCH_BUFFER_END * restrict values)
393810e230b6Smaya{
393910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
394010e230b6Smaya
394110e230b6Smaya   dw[0] =
394210e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
394310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
394410e230b6Smaya}
394510e230b6Smaya
394696c5ddc4Srjs#define GFX6_MI_BATCH_BUFFER_START_length      2
394796c5ddc4Srjs#define GFX6_MI_BATCH_BUFFER_START_length_bias      2
394896c5ddc4Srjs#define GFX6_MI_BATCH_BUFFER_START_header       \
394910e230b6Smaya   .DWordLength                         =      0,  \
395010e230b6Smaya   .MICommandOpcode                     =     49,  \
395110e230b6Smaya   .CommandType                         =      0
395210e230b6Smaya
395396c5ddc4Srjsstruct GFX6_MI_BATCH_BUFFER_START {
395410e230b6Smaya   uint32_t                             DWordLength;
395510e230b6Smaya   uint32_t                             AddressSpaceIndicator;
395610e230b6Smaya#define ASI_GGTT                                 0
395710e230b6Smaya#define ASI_PPGTT                                1
395810e230b6Smaya   bool                                 ClearCommandBufferEnable;
395910e230b6Smaya   uint32_t                             MICommandOpcode;
396010e230b6Smaya   uint32_t                             CommandType;
396110e230b6Smaya   __gen_address_type                   BatchBufferStartAddress;
396210e230b6Smaya};
396310e230b6Smaya
396496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
396596c5ddc4SrjsGFX6_MI_BATCH_BUFFER_START_pack(__attribute__((unused)) __gen_user_data *data,
396610e230b6Smaya                                __attribute__((unused)) void * restrict dst,
396796c5ddc4Srjs                                __attribute__((unused)) const struct GFX6_MI_BATCH_BUFFER_START * restrict values)
396810e230b6Smaya{
396910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
397010e230b6Smaya
397110e230b6Smaya   dw[0] =
397210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
397310e230b6Smaya      __gen_uint(values->AddressSpaceIndicator, 8, 8) |
397410e230b6Smaya      __gen_uint(values->ClearCommandBufferEnable, 11, 11) |
397510e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
397610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
397710e230b6Smaya
397896c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->BatchBufferStartAddress, 0, 2, 31);
397910e230b6Smaya}
398010e230b6Smaya
398196c5ddc4Srjs#define GFX6_MI_CLFLUSH_length_bias            2
398296c5ddc4Srjs#define GFX6_MI_CLFLUSH_header                  \
398310e230b6Smaya   .DWordLength                         =      0,  \
398410e230b6Smaya   .MICommandOpcode                     =     39,  \
398510e230b6Smaya   .CommandType                         =      0
398610e230b6Smaya
398796c5ddc4Srjsstruct GFX6_MI_CLFLUSH {
398810e230b6Smaya   uint32_t                             DWordLength;
398910e230b6Smaya   bool                                 UseGlobalGTT;
399010e230b6Smaya   uint32_t                             MICommandOpcode;
399110e230b6Smaya   uint32_t                             CommandType;
399210e230b6Smaya   uint32_t                             StartingCachelineOffset;
399310e230b6Smaya   __gen_address_type                   PageBaseAddress;
399410e230b6Smaya   /* variable length fields follow */
399510e230b6Smaya};
399610e230b6Smaya
399796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
399896c5ddc4SrjsGFX6_MI_CLFLUSH_pack(__attribute__((unused)) __gen_user_data *data,
399910e230b6Smaya                     __attribute__((unused)) void * restrict dst,
400096c5ddc4Srjs                     __attribute__((unused)) const struct GFX6_MI_CLFLUSH * restrict values)
400110e230b6Smaya{
400210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
400310e230b6Smaya
400410e230b6Smaya   dw[0] =
400510e230b6Smaya      __gen_uint(values->DWordLength, 0, 5) |
400610e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
400710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
400810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
400910e230b6Smaya
401010e230b6Smaya   const uint32_t v1 =
401110e230b6Smaya      __gen_uint(values->StartingCachelineOffset, 6, 11);
401296c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->PageBaseAddress, v1, 12, 31);
401310e230b6Smaya}
401410e230b6Smaya
401596c5ddc4Srjs#define GFX6_MI_CONDITIONAL_BATCH_BUFFER_END_length      2
401696c5ddc4Srjs#define GFX6_MI_CONDITIONAL_BATCH_BUFFER_END_length_bias      2
401796c5ddc4Srjs#define GFX6_MI_CONDITIONAL_BATCH_BUFFER_END_header\
401810e230b6Smaya   .DWordLength                         =      0,  \
401910e230b6Smaya   .CompareSemaphore                    =      0,  \
402010e230b6Smaya   .MICommandOpcode                     =     54,  \
402110e230b6Smaya   .CommandType                         =      0
402210e230b6Smaya
402396c5ddc4Srjsstruct GFX6_MI_CONDITIONAL_BATCH_BUFFER_END {
402410e230b6Smaya   uint32_t                             DWordLength;
402510e230b6Smaya   uint32_t                             CompareSemaphore;
402610e230b6Smaya   bool                                 UseGlobalGTT;
402710e230b6Smaya   uint32_t                             MICommandOpcode;
402810e230b6Smaya   uint32_t                             CommandType;
402910e230b6Smaya   uint32_t                             CompareDataDword;
403010e230b6Smaya   __gen_address_type                   CompareAddress;
403110e230b6Smaya};
403210e230b6Smaya
403396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
403496c5ddc4SrjsGFX6_MI_CONDITIONAL_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
403510e230b6Smaya                                          __attribute__((unused)) void * restrict dst,
403696c5ddc4Srjs                                          __attribute__((unused)) const struct GFX6_MI_CONDITIONAL_BATCH_BUFFER_END * restrict values)
403710e230b6Smaya{
403810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
403910e230b6Smaya
404010e230b6Smaya   dw[0] =
404110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
404210e230b6Smaya      __gen_uint(values->CompareSemaphore, 21, 21) |
404310e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
404410e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
404510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
404610e230b6Smaya
404710e230b6Smaya   dw[1] =
404810e230b6Smaya      __gen_uint(values->CompareDataDword, 0, 31);
404910e230b6Smaya}
405010e230b6Smaya
405196c5ddc4Srjs#define GFX6_MI_FLUSH_length                   1
405296c5ddc4Srjs#define GFX6_MI_FLUSH_length_bias              1
405396c5ddc4Srjs#define GFX6_MI_FLUSH_header                    \
405410e230b6Smaya   .MICommandOpcode                     =      4,  \
405510e230b6Smaya   .CommandType                         =      0
405610e230b6Smaya
405796c5ddc4Srjsstruct GFX6_MI_FLUSH {
405810e230b6Smaya   uint32_t                             StateInstructionCacheInvalidate;
405910e230b6Smaya#define DontInvalidate                           0
406010e230b6Smaya#define Invalidate                               1
406110e230b6Smaya   uint32_t                             RenderCacheFlushInhibit;
406210e230b6Smaya#define Flush                                    0
406310e230b6Smaya#define DontFlush                                1
406410e230b6Smaya   uint32_t                             GlobalSnapshotCountReset;
406510e230b6Smaya#define DontReset                                0
406610e230b6Smaya#define Reset                                    1
406710e230b6Smaya   bool                                 GenericMediaStateClear;
406810e230b6Smaya   bool                                 IndirectStatePointersDisable;
406910e230b6Smaya   uint32_t                             MICommandOpcode;
407010e230b6Smaya   uint32_t                             CommandType;
407110e230b6Smaya};
407210e230b6Smaya
407396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
407496c5ddc4SrjsGFX6_MI_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
407510e230b6Smaya                   __attribute__((unused)) void * restrict dst,
407696c5ddc4Srjs                   __attribute__((unused)) const struct GFX6_MI_FLUSH * restrict values)
407710e230b6Smaya{
407810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
407910e230b6Smaya
408010e230b6Smaya   dw[0] =
408110e230b6Smaya      __gen_uint(values->StateInstructionCacheInvalidate, 1, 1) |
408210e230b6Smaya      __gen_uint(values->RenderCacheFlushInhibit, 2, 2) |
408310e230b6Smaya      __gen_uint(values->GlobalSnapshotCountReset, 3, 3) |
408410e230b6Smaya      __gen_uint(values->GenericMediaStateClear, 4, 4) |
408510e230b6Smaya      __gen_uint(values->IndirectStatePointersDisable, 5, 5) |
408610e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
408710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
408810e230b6Smaya}
408910e230b6Smaya
409096c5ddc4Srjs#define GFX6_MI_LOAD_REGISTER_IMM_length       3
409196c5ddc4Srjs#define GFX6_MI_LOAD_REGISTER_IMM_length_bias      2
409296c5ddc4Srjs#define GFX6_MI_LOAD_REGISTER_IMM_header        \
409310e230b6Smaya   .DWordLength                         =      1,  \
409410e230b6Smaya   .MICommandOpcode                     =     34,  \
409510e230b6Smaya   .CommandType                         =      0
409610e230b6Smaya
409796c5ddc4Srjsstruct GFX6_MI_LOAD_REGISTER_IMM {
409810e230b6Smaya   uint32_t                             DWordLength;
409910e230b6Smaya   uint32_t                             ByteWriteDisables;
410010e230b6Smaya   uint32_t                             MICommandOpcode;
410110e230b6Smaya   uint32_t                             CommandType;
410210e230b6Smaya   uint64_t                             RegisterOffset;
410310e230b6Smaya   uint32_t                             DataDWord;
410410e230b6Smaya   /* variable length fields follow */
410510e230b6Smaya};
410610e230b6Smaya
410796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
410896c5ddc4SrjsGFX6_MI_LOAD_REGISTER_IMM_pack(__attribute__((unused)) __gen_user_data *data,
410910e230b6Smaya                               __attribute__((unused)) void * restrict dst,
411096c5ddc4Srjs                               __attribute__((unused)) const struct GFX6_MI_LOAD_REGISTER_IMM * restrict values)
411110e230b6Smaya{
411210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
411310e230b6Smaya
411410e230b6Smaya   dw[0] =
411510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
411610e230b6Smaya      __gen_uint(values->ByteWriteDisables, 8, 11) |
411710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
411810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
411910e230b6Smaya
412010e230b6Smaya   dw[1] =
412110e230b6Smaya      __gen_offset(values->RegisterOffset, 2, 22);
412210e230b6Smaya
412310e230b6Smaya   dw[2] =
412410e230b6Smaya      __gen_uint(values->DataDWord, 0, 31);
412510e230b6Smaya}
412610e230b6Smaya
412796c5ddc4Srjs#define GFX6_MI_LOAD_SCAN_LINES_EXCL_length      2
412896c5ddc4Srjs#define GFX6_MI_LOAD_SCAN_LINES_EXCL_length_bias      2
412996c5ddc4Srjs#define GFX6_MI_LOAD_SCAN_LINES_EXCL_header     \
413010e230b6Smaya   .DWordLength                         =      0,  \
413110e230b6Smaya   .MICommandOpcode                     =     19,  \
413210e230b6Smaya   .CommandType                         =      0
413310e230b6Smaya
413496c5ddc4Srjsstruct GFX6_MI_LOAD_SCAN_LINES_EXCL {
413510e230b6Smaya   uint32_t                             DWordLength;
413610e230b6Smaya   uint32_t                             DisplayPlaneSelect;
413710e230b6Smaya#define DisplayPlaneA                            0
413810e230b6Smaya#define DisplayPlaneB                            1
413910e230b6Smaya#define DisplayPlaneC                            4
414010e230b6Smaya   uint32_t                             MICommandOpcode;
414110e230b6Smaya   uint32_t                             CommandType;
414210e230b6Smaya   uint32_t                             EndScanLineNumber;
414310e230b6Smaya   uint32_t                             StartScanLineNumber;
414410e230b6Smaya};
414510e230b6Smaya
414696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
414796c5ddc4SrjsGFX6_MI_LOAD_SCAN_LINES_EXCL_pack(__attribute__((unused)) __gen_user_data *data,
414810e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
414996c5ddc4Srjs                                  __attribute__((unused)) const struct GFX6_MI_LOAD_SCAN_LINES_EXCL * restrict values)
415010e230b6Smaya{
415110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
415210e230b6Smaya
415310e230b6Smaya   dw[0] =
415410e230b6Smaya      __gen_uint(values->DWordLength, 0, 5) |
415510e230b6Smaya      __gen_uint(values->DisplayPlaneSelect, 19, 21) |
415610e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
415710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
415810e230b6Smaya
415910e230b6Smaya   dw[1] =
416010e230b6Smaya      __gen_uint(values->EndScanLineNumber, 0, 12) |
416110e230b6Smaya      __gen_uint(values->StartScanLineNumber, 16, 28);
416210e230b6Smaya}
416310e230b6Smaya
416496c5ddc4Srjs#define GFX6_MI_NOOP_length                    1
416596c5ddc4Srjs#define GFX6_MI_NOOP_length_bias               1
416696c5ddc4Srjs#define GFX6_MI_NOOP_header                     \
416710e230b6Smaya   .MICommandOpcode                     =      0,  \
416810e230b6Smaya   .CommandType                         =      0
416910e230b6Smaya
417096c5ddc4Srjsstruct GFX6_MI_NOOP {
417110e230b6Smaya   uint32_t                             IdentificationNumber;
417210e230b6Smaya   bool                                 IdentificationNumberRegisterWriteEnable;
417310e230b6Smaya   uint32_t                             MICommandOpcode;
417410e230b6Smaya   uint32_t                             CommandType;
417510e230b6Smaya};
417610e230b6Smaya
417796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
417896c5ddc4SrjsGFX6_MI_NOOP_pack(__attribute__((unused)) __gen_user_data *data,
417910e230b6Smaya                  __attribute__((unused)) void * restrict dst,
418096c5ddc4Srjs                  __attribute__((unused)) const struct GFX6_MI_NOOP * restrict values)
418110e230b6Smaya{
418210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
418310e230b6Smaya
418410e230b6Smaya   dw[0] =
418510e230b6Smaya      __gen_uint(values->IdentificationNumber, 0, 21) |
418610e230b6Smaya      __gen_uint(values->IdentificationNumberRegisterWriteEnable, 22, 22) |
418710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
418810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
418910e230b6Smaya}
419010e230b6Smaya
419196c5ddc4Srjs#define GFX6_MI_REPORT_HEAD_length             1
419296c5ddc4Srjs#define GFX6_MI_REPORT_HEAD_length_bias        1
419396c5ddc4Srjs#define GFX6_MI_REPORT_HEAD_header              \
419410e230b6Smaya   .MICommandOpcode                     =      7,  \
419510e230b6Smaya   .CommandType                         =      0
419610e230b6Smaya
419796c5ddc4Srjsstruct GFX6_MI_REPORT_HEAD {
419810e230b6Smaya   uint32_t                             MICommandOpcode;
419910e230b6Smaya   uint32_t                             CommandType;
420010e230b6Smaya};
420110e230b6Smaya
420296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
420396c5ddc4SrjsGFX6_MI_REPORT_HEAD_pack(__attribute__((unused)) __gen_user_data *data,
420410e230b6Smaya                         __attribute__((unused)) void * restrict dst,
420596c5ddc4Srjs                         __attribute__((unused)) const struct GFX6_MI_REPORT_HEAD * restrict values)
420610e230b6Smaya{
420710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
420810e230b6Smaya
420910e230b6Smaya   dw[0] =
421010e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
421110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
421210e230b6Smaya}
421310e230b6Smaya
421496c5ddc4Srjs#define GFX6_MI_SEMAPHORE_MBOX_length          3
421596c5ddc4Srjs#define GFX6_MI_SEMAPHORE_MBOX_length_bias      2
421696c5ddc4Srjs#define GFX6_MI_SEMAPHORE_MBOX_header           \
421710e230b6Smaya   .DWordLength                         =      1,  \
421810e230b6Smaya   .MICommandOpcode                     =     22,  \
421910e230b6Smaya   .CommandType                         =      0
422010e230b6Smaya
422196c5ddc4Srjsstruct GFX6_MI_SEMAPHORE_MBOX {
422210e230b6Smaya   uint32_t                             DWordLength;
422310e230b6Smaya   uint32_t                             RegisterSelect;
422410e230b6Smaya#define RVSYNC                                   0
422510e230b6Smaya#define RBSYNC                                   2
422610e230b6Smaya#define UseGeneralRegisterSelect                 3
422710e230b6Smaya   uint32_t                             MICommandOpcode;
422810e230b6Smaya   uint32_t                             CommandType;
422910e230b6Smaya   uint32_t                             SemaphoreDataDword;
423010e230b6Smaya};
423110e230b6Smaya
423296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
423396c5ddc4SrjsGFX6_MI_SEMAPHORE_MBOX_pack(__attribute__((unused)) __gen_user_data *data,
423410e230b6Smaya                            __attribute__((unused)) void * restrict dst,
423596c5ddc4Srjs                            __attribute__((unused)) const struct GFX6_MI_SEMAPHORE_MBOX * restrict values)
423610e230b6Smaya{
423710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
423810e230b6Smaya
423910e230b6Smaya   dw[0] =
424010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
424110e230b6Smaya      __gen_uint(values->RegisterSelect, 16, 17) |
424210e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
424310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
424410e230b6Smaya
424510e230b6Smaya   dw[1] =
424610e230b6Smaya      __gen_uint(values->SemaphoreDataDword, 0, 31);
424710e230b6Smaya
424810e230b6Smaya   dw[2] = 0;
424910e230b6Smaya}
425010e230b6Smaya
425196c5ddc4Srjs#define GFX6_MI_SET_CONTEXT_length             2
425296c5ddc4Srjs#define GFX6_MI_SET_CONTEXT_length_bias        2
425396c5ddc4Srjs#define GFX6_MI_SET_CONTEXT_header              \
425410e230b6Smaya   .DWordLength                         =      0,  \
425510e230b6Smaya   .MICommandOpcode                     =     24,  \
425610e230b6Smaya   .CommandType                         =      0
425710e230b6Smaya
425896c5ddc4Srjsstruct GFX6_MI_SET_CONTEXT {
425910e230b6Smaya   uint32_t                             DWordLength;
426010e230b6Smaya   uint32_t                             MICommandOpcode;
426110e230b6Smaya   uint32_t                             CommandType;
426210e230b6Smaya   uint32_t                             RestoreInhibit;
426310e230b6Smaya   uint32_t                             ForceRestore;
426410e230b6Smaya   bool                                 ExtendedStateRestoreEnable;
426510e230b6Smaya   bool                                 ExtendedStateSaveEnable;
426610e230b6Smaya   uint32_t                             ReservedMustbe1;
426710e230b6Smaya   bool                                 HDDVDContext;
426810e230b6Smaya   __gen_address_type                   LogicalContextAddress;
426910e230b6Smaya};
427010e230b6Smaya
427196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
427296c5ddc4SrjsGFX6_MI_SET_CONTEXT_pack(__attribute__((unused)) __gen_user_data *data,
427310e230b6Smaya                         __attribute__((unused)) void * restrict dst,
427496c5ddc4Srjs                         __attribute__((unused)) const struct GFX6_MI_SET_CONTEXT * restrict values)
427510e230b6Smaya{
427610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
427710e230b6Smaya
427810e230b6Smaya   dw[0] =
427910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
428010e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
428110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
428210e230b6Smaya
428310e230b6Smaya   const uint32_t v1 =
428410e230b6Smaya      __gen_uint(values->RestoreInhibit, 0, 0) |
428510e230b6Smaya      __gen_uint(values->ForceRestore, 1, 1) |
428610e230b6Smaya      __gen_uint(values->ExtendedStateRestoreEnable, 2, 2) |
428710e230b6Smaya      __gen_uint(values->ExtendedStateSaveEnable, 3, 3) |
428810e230b6Smaya      __gen_uint(values->ReservedMustbe1, 8, 8) |
428910e230b6Smaya      __gen_uint(values->HDDVDContext, 9, 9);
429096c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->LogicalContextAddress, v1, 12, 31);
429110e230b6Smaya}
429210e230b6Smaya
429396c5ddc4Srjs#define GFX6_MI_STORE_DATA_IMM_length          4
429496c5ddc4Srjs#define GFX6_MI_STORE_DATA_IMM_length_bias      2
429596c5ddc4Srjs#define GFX6_MI_STORE_DATA_IMM_header           \
429610e230b6Smaya   .DWordLength                         =      2,  \
429710e230b6Smaya   .MICommandOpcode                     =     32,  \
429810e230b6Smaya   .CommandType                         =      0
429910e230b6Smaya
430096c5ddc4Srjsstruct GFX6_MI_STORE_DATA_IMM {
430110e230b6Smaya   uint32_t                             DWordLength;
430210e230b6Smaya   bool                                 UseGlobalGTT;
430310e230b6Smaya   uint32_t                             MICommandOpcode;
430410e230b6Smaya   uint32_t                             CommandType;
430510e230b6Smaya   uint32_t                             CoreModeEnable;
430610e230b6Smaya   __gen_address_type                   Address;
430710e230b6Smaya   uint64_t                             ImmediateData;
430810e230b6Smaya};
430910e230b6Smaya
431096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
431196c5ddc4SrjsGFX6_MI_STORE_DATA_IMM_pack(__attribute__((unused)) __gen_user_data *data,
431210e230b6Smaya                            __attribute__((unused)) void * restrict dst,
431396c5ddc4Srjs                            __attribute__((unused)) const struct GFX6_MI_STORE_DATA_IMM * restrict values)
431410e230b6Smaya{
431510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
431610e230b6Smaya
431710e230b6Smaya   dw[0] =
431810e230b6Smaya      __gen_uint(values->DWordLength, 0, 5) |
431910e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
432010e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
432110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
432210e230b6Smaya
432310e230b6Smaya   dw[1] = 0;
432410e230b6Smaya
432510e230b6Smaya   const uint32_t v2 =
432610e230b6Smaya      __gen_uint(values->CoreModeEnable, 0, 0);
432796c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->Address, v2, 2, 31);
432810e230b6Smaya
432910e230b6Smaya   const uint64_t v3 =
433010e230b6Smaya      __gen_uint(values->ImmediateData, 0, 63);
433110e230b6Smaya   dw[3] = v3;
433210e230b6Smaya   dw[4] = v3 >> 32;
433310e230b6Smaya}
433410e230b6Smaya
433596c5ddc4Srjs#define GFX6_MI_STORE_DATA_INDEX_length        3
433696c5ddc4Srjs#define GFX6_MI_STORE_DATA_INDEX_length_bias      2
433796c5ddc4Srjs#define GFX6_MI_STORE_DATA_INDEX_header         \
433810e230b6Smaya   .DWordLength                         =      1,  \
433910e230b6Smaya   .MICommandOpcode                     =     33,  \
434010e230b6Smaya   .CommandType                         =      0
434110e230b6Smaya
434296c5ddc4Srjsstruct GFX6_MI_STORE_DATA_INDEX {
434310e230b6Smaya   uint32_t                             DWordLength;
434410e230b6Smaya   uint32_t                             MICommandOpcode;
434510e230b6Smaya   uint32_t                             CommandType;
434610e230b6Smaya   uint32_t                             Offset;
434710e230b6Smaya   uint32_t                             DataDWord0;
434810e230b6Smaya   uint32_t                             DataDWord1;
434910e230b6Smaya};
435010e230b6Smaya
435196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
435296c5ddc4SrjsGFX6_MI_STORE_DATA_INDEX_pack(__attribute__((unused)) __gen_user_data *data,
435310e230b6Smaya                              __attribute__((unused)) void * restrict dst,
435496c5ddc4Srjs                              __attribute__((unused)) const struct GFX6_MI_STORE_DATA_INDEX * restrict values)
435510e230b6Smaya{
435610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
435710e230b6Smaya
435810e230b6Smaya   dw[0] =
435910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
436010e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
436110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
436210e230b6Smaya
436310e230b6Smaya   dw[1] =
436410e230b6Smaya      __gen_uint(values->Offset, 2, 11);
436510e230b6Smaya
436610e230b6Smaya   dw[2] =
436710e230b6Smaya      __gen_uint(values->DataDWord0, 0, 31);
436810e230b6Smaya}
436910e230b6Smaya
437096c5ddc4Srjs#define GFX6_MI_STORE_REGISTER_MEM_length      3
437196c5ddc4Srjs#define GFX6_MI_STORE_REGISTER_MEM_length_bias      2
437296c5ddc4Srjs#define GFX6_MI_STORE_REGISTER_MEM_header       \
437310e230b6Smaya   .DWordLength                         =      1,  \
437410e230b6Smaya   .MICommandOpcode                     =     36,  \
437510e230b6Smaya   .CommandType                         =      0
437610e230b6Smaya
437796c5ddc4Srjsstruct GFX6_MI_STORE_REGISTER_MEM {
437810e230b6Smaya   uint32_t                             DWordLength;
437910e230b6Smaya   bool                                 UseGlobalGTT;
438010e230b6Smaya   uint32_t                             MICommandOpcode;
438110e230b6Smaya   uint32_t                             CommandType;
438210e230b6Smaya   uint64_t                             RegisterAddress;
438310e230b6Smaya   __gen_address_type                   MemoryAddress;
438410e230b6Smaya};
438510e230b6Smaya
438696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
438796c5ddc4SrjsGFX6_MI_STORE_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
438810e230b6Smaya                                __attribute__((unused)) void * restrict dst,
438996c5ddc4Srjs                                __attribute__((unused)) const struct GFX6_MI_STORE_REGISTER_MEM * restrict values)
439010e230b6Smaya{
439110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
439210e230b6Smaya
439310e230b6Smaya   dw[0] =
439410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
439510e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
439610e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
439710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
439810e230b6Smaya
439910e230b6Smaya   dw[1] =
440010e230b6Smaya      __gen_offset(values->RegisterAddress, 2, 22);
440110e230b6Smaya
440296c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->MemoryAddress, 0, 2, 31);
440310e230b6Smaya}
440410e230b6Smaya
440596c5ddc4Srjs#define GFX6_MI_SUSPEND_FLUSH_length           1
440696c5ddc4Srjs#define GFX6_MI_SUSPEND_FLUSH_length_bias      1
440796c5ddc4Srjs#define GFX6_MI_SUSPEND_FLUSH_header            \
440810e230b6Smaya   .MICommandOpcode                     =     11,  \
440910e230b6Smaya   .CommandType                         =      0
441010e230b6Smaya
441196c5ddc4Srjsstruct GFX6_MI_SUSPEND_FLUSH {
441210e230b6Smaya   bool                                 SuspendFlush;
441310e230b6Smaya   uint32_t                             MICommandOpcode;
441410e230b6Smaya   uint32_t                             CommandType;
441510e230b6Smaya};
441610e230b6Smaya
441796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
441896c5ddc4SrjsGFX6_MI_SUSPEND_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
441910e230b6Smaya                           __attribute__((unused)) void * restrict dst,
442096c5ddc4Srjs                           __attribute__((unused)) const struct GFX6_MI_SUSPEND_FLUSH * restrict values)
442110e230b6Smaya{
442210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
442310e230b6Smaya
442410e230b6Smaya   dw[0] =
442510e230b6Smaya      __gen_uint(values->SuspendFlush, 0, 0) |
442610e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
442710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
442810e230b6Smaya}
442910e230b6Smaya
443096c5ddc4Srjs#define GFX6_MI_URB_CLEAR_length               2
443196c5ddc4Srjs#define GFX6_MI_URB_CLEAR_length_bias          2
443296c5ddc4Srjs#define GFX6_MI_URB_CLEAR_header                \
443310e230b6Smaya   .DWordLength                         =      0,  \
443410e230b6Smaya   .MICommandOpcode                     =     25,  \
443510e230b6Smaya   .CommandType                         =      0
443610e230b6Smaya
443796c5ddc4Srjsstruct GFX6_MI_URB_CLEAR {
443810e230b6Smaya   uint32_t                             DWordLength;
443910e230b6Smaya   uint32_t                             MICommandOpcode;
444010e230b6Smaya   uint32_t                             CommandType;
444110e230b6Smaya   uint64_t                             URBAddress;
444210e230b6Smaya   uint32_t                             URBClearLength;
444310e230b6Smaya};
444410e230b6Smaya
444596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
444696c5ddc4SrjsGFX6_MI_URB_CLEAR_pack(__attribute__((unused)) __gen_user_data *data,
444710e230b6Smaya                       __attribute__((unused)) void * restrict dst,
444896c5ddc4Srjs                       __attribute__((unused)) const struct GFX6_MI_URB_CLEAR * restrict values)
444910e230b6Smaya{
445010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
445110e230b6Smaya
445210e230b6Smaya   dw[0] =
445310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
445410e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
445510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
445610e230b6Smaya
445710e230b6Smaya   dw[1] =
445810e230b6Smaya      __gen_offset(values->URBAddress, 0, 13) |
445910e230b6Smaya      __gen_uint(values->URBClearLength, 16, 28);
446010e230b6Smaya}
446110e230b6Smaya
446296c5ddc4Srjs#define GFX6_MI_USER_INTERRUPT_length          1
446396c5ddc4Srjs#define GFX6_MI_USER_INTERRUPT_length_bias      1
446496c5ddc4Srjs#define GFX6_MI_USER_INTERRUPT_header           \
446510e230b6Smaya   .MICommandOpcode                     =      2,  \
446610e230b6Smaya   .CommandType                         =      0
446710e230b6Smaya
446896c5ddc4Srjsstruct GFX6_MI_USER_INTERRUPT {
446910e230b6Smaya   uint32_t                             MICommandOpcode;
447010e230b6Smaya   uint32_t                             CommandType;
447110e230b6Smaya};
447210e230b6Smaya
447396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
447496c5ddc4SrjsGFX6_MI_USER_INTERRUPT_pack(__attribute__((unused)) __gen_user_data *data,
447510e230b6Smaya                            __attribute__((unused)) void * restrict dst,
447696c5ddc4Srjs                            __attribute__((unused)) const struct GFX6_MI_USER_INTERRUPT * restrict values)
447710e230b6Smaya{
447810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
447910e230b6Smaya
448010e230b6Smaya   dw[0] =
448110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
448210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
448310e230b6Smaya}
448410e230b6Smaya
448596c5ddc4Srjs#define GFX6_MI_WAIT_FOR_EVENT_length          1
448696c5ddc4Srjs#define GFX6_MI_WAIT_FOR_EVENT_length_bias      1
448796c5ddc4Srjs#define GFX6_MI_WAIT_FOR_EVENT_header           \
448810e230b6Smaya   .MICommandOpcode                     =      3,  \
448910e230b6Smaya   .CommandType                         =      0
449010e230b6Smaya
449196c5ddc4Srjsstruct GFX6_MI_WAIT_FOR_EVENT {
449210e230b6Smaya   bool                                 DisplayPipeAScanLineWaitEnable;
449310e230b6Smaya   bool                                 DisplayPlaneAFlipPendingWaitEnable;
449410e230b6Smaya   bool                                 DisplaySpriteAFlipPendingWaitEnable;
449510e230b6Smaya   bool                                 DisplayPipeAVerticalBlankWaitEnable;
449610e230b6Smaya   bool                                 DisplayPipeAHorizontalBlankWaitEnable;
449710e230b6Smaya   bool                                 DisplayPipeBScanLineWaitEnable;
449810e230b6Smaya   bool                                 DisplayPlaneBFlipPendingWaitEnable;
449910e230b6Smaya   bool                                 DisplaySpriteBFlipPendingWaitEnable;
450010e230b6Smaya   bool                                 DisplayPipeBVerticalBlankWaitEnable;
450110e230b6Smaya   bool                                 DisplayPipeBHorizontalBlankWaitEnable;
450210e230b6Smaya   uint32_t                             ConditionCodeWaitSelect;
450310e230b6Smaya#define Notenabled                               0
450410e230b6Smaya   uint32_t                             MICommandOpcode;
450510e230b6Smaya   uint32_t                             CommandType;
450610e230b6Smaya};
450710e230b6Smaya
450896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
450996c5ddc4SrjsGFX6_MI_WAIT_FOR_EVENT_pack(__attribute__((unused)) __gen_user_data *data,
451010e230b6Smaya                            __attribute__((unused)) void * restrict dst,
451196c5ddc4Srjs                            __attribute__((unused)) const struct GFX6_MI_WAIT_FOR_EVENT * restrict values)
451210e230b6Smaya{
451310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
451410e230b6Smaya
451510e230b6Smaya   dw[0] =
451610e230b6Smaya      __gen_uint(values->DisplayPipeAScanLineWaitEnable, 0, 0) |
451710e230b6Smaya      __gen_uint(values->DisplayPlaneAFlipPendingWaitEnable, 1, 1) |
451810e230b6Smaya      __gen_uint(values->DisplaySpriteAFlipPendingWaitEnable, 2, 2) |
451910e230b6Smaya      __gen_uint(values->DisplayPipeAVerticalBlankWaitEnable, 3, 3) |
452010e230b6Smaya      __gen_uint(values->DisplayPipeAHorizontalBlankWaitEnable, 5, 5) |
452110e230b6Smaya      __gen_uint(values->DisplayPipeBScanLineWaitEnable, 8, 8) |
452210e230b6Smaya      __gen_uint(values->DisplayPlaneBFlipPendingWaitEnable, 9, 9) |
452310e230b6Smaya      __gen_uint(values->DisplaySpriteBFlipPendingWaitEnable, 10, 10) |
452410e230b6Smaya      __gen_uint(values->DisplayPipeBVerticalBlankWaitEnable, 11, 11) |
452510e230b6Smaya      __gen_uint(values->DisplayPipeBHorizontalBlankWaitEnable, 13, 13) |
452610e230b6Smaya      __gen_uint(values->ConditionCodeWaitSelect, 16, 19) |
452710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
452810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
452910e230b6Smaya}
453010e230b6Smaya
453196c5ddc4Srjs#define GFX6_PIPELINE_SELECT_length            1
453296c5ddc4Srjs#define GFX6_PIPELINE_SELECT_length_bias       1
453396c5ddc4Srjs#define GFX6_PIPELINE_SELECT_header             \
453410e230b6Smaya   ._3DCommandSubOpcode                 =      4,  \
453510e230b6Smaya   ._3DCommandOpcode                    =      1,  \
453610e230b6Smaya   .CommandSubType                      =      1,  \
453710e230b6Smaya   .CommandType                         =      3
453810e230b6Smaya
453996c5ddc4Srjsstruct GFX6_PIPELINE_SELECT {
454010e230b6Smaya   uint32_t                             PipelineSelection;
454110e230b6Smaya#define _3D                                      0
454210e230b6Smaya#define Media                                    1
454310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
454410e230b6Smaya   uint32_t                             _3DCommandOpcode;
454510e230b6Smaya   uint32_t                             CommandSubType;
454610e230b6Smaya   uint32_t                             CommandType;
454710e230b6Smaya};
454810e230b6Smaya
454996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
455096c5ddc4SrjsGFX6_PIPELINE_SELECT_pack(__attribute__((unused)) __gen_user_data *data,
455110e230b6Smaya                          __attribute__((unused)) void * restrict dst,
455296c5ddc4Srjs                          __attribute__((unused)) const struct GFX6_PIPELINE_SELECT * restrict values)
455310e230b6Smaya{
455410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
455510e230b6Smaya
455610e230b6Smaya   dw[0] =
455710e230b6Smaya      __gen_uint(values->PipelineSelection, 0, 1) |
455810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
455910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
456010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
456110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
456210e230b6Smaya}
456310e230b6Smaya
456496c5ddc4Srjs#define GFX6_PIPE_CONTROL_length               5
456596c5ddc4Srjs#define GFX6_PIPE_CONTROL_length_bias          2
456696c5ddc4Srjs#define GFX6_PIPE_CONTROL_header                \
456710e230b6Smaya   .DWordLength                         =      3,  \
456810e230b6Smaya   ._3DCommandSubOpcode                 =      0,  \
456910e230b6Smaya   ._3DCommandOpcode                    =      2,  \
457010e230b6Smaya   .CommandSubType                      =      3,  \
457110e230b6Smaya   .CommandType                         =      3
457210e230b6Smaya
457396c5ddc4Srjsstruct GFX6_PIPE_CONTROL {
457410e230b6Smaya   uint32_t                             DWordLength;
457510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
457610e230b6Smaya   uint32_t                             _3DCommandOpcode;
457710e230b6Smaya   uint32_t                             CommandSubType;
457810e230b6Smaya   uint32_t                             CommandType;
457910e230b6Smaya   bool                                 DepthCacheFlushEnable;
458010e230b6Smaya   bool                                 StallAtPixelScoreboard;
458110e230b6Smaya   bool                                 StateCacheInvalidationEnable;
458210e230b6Smaya   bool                                 ConstantCacheInvalidationEnable;
458310e230b6Smaya   bool                                 VFCacheInvalidationEnable;
458410e230b6Smaya   bool                                 NotifyEnable;
458510e230b6Smaya   bool                                 IndirectStatePointersDisable;
458610e230b6Smaya   bool                                 TextureCacheInvalidationEnable;
458710e230b6Smaya   bool                                 InstructionCacheInvalidateEnable;
458810e230b6Smaya   bool                                 RenderTargetCacheFlushEnable;
458910e230b6Smaya   bool                                 DepthStallEnable;
459010e230b6Smaya   uint32_t                             PostSyncOperation;
459110e230b6Smaya#define NoWrite                                  0
459210e230b6Smaya#define WriteImmediateData                       1
459310e230b6Smaya#define WritePSDepthCount                        2
459410e230b6Smaya#define WriteTimestamp                           3
459510e230b6Smaya   bool                                 GenericMediaStateClear;
459610e230b6Smaya   bool                                 SynchronizeGFDTSurface;
459710e230b6Smaya   bool                                 TLBInvalidate;
459810e230b6Smaya   bool                                 GlobalSnapshotCountReset;
459910e230b6Smaya   bool                                 CommandStreamerStallEnable;
460010e230b6Smaya   uint32_t                             StoreDataIndex;
460110e230b6Smaya   uint32_t                             DestinationAddressType;
460210e230b6Smaya#define DAT_GGTT                                 1
460310e230b6Smaya   __gen_address_type                   Address;
460410e230b6Smaya   uint64_t                             ImmediateData;
460510e230b6Smaya};
460610e230b6Smaya
460796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
460896c5ddc4SrjsGFX6_PIPE_CONTROL_pack(__attribute__((unused)) __gen_user_data *data,
460910e230b6Smaya                       __attribute__((unused)) void * restrict dst,
461096c5ddc4Srjs                       __attribute__((unused)) const struct GFX6_PIPE_CONTROL * restrict values)
461110e230b6Smaya{
461210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
461310e230b6Smaya
461410e230b6Smaya   dw[0] =
461510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
461610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
461710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
461810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
461910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
462010e230b6Smaya
462110e230b6Smaya   dw[1] =
462210e230b6Smaya      __gen_uint(values->DepthCacheFlushEnable, 0, 0) |
462310e230b6Smaya      __gen_uint(values->StallAtPixelScoreboard, 1, 1) |
462410e230b6Smaya      __gen_uint(values->StateCacheInvalidationEnable, 2, 2) |
462510e230b6Smaya      __gen_uint(values->ConstantCacheInvalidationEnable, 3, 3) |
462610e230b6Smaya      __gen_uint(values->VFCacheInvalidationEnable, 4, 4) |
462710e230b6Smaya      __gen_uint(values->NotifyEnable, 8, 8) |
462810e230b6Smaya      __gen_uint(values->IndirectStatePointersDisable, 9, 9) |
462910e230b6Smaya      __gen_uint(values->TextureCacheInvalidationEnable, 10, 10) |
463010e230b6Smaya      __gen_uint(values->InstructionCacheInvalidateEnable, 11, 11) |
463110e230b6Smaya      __gen_uint(values->RenderTargetCacheFlushEnable, 12, 12) |
463210e230b6Smaya      __gen_uint(values->DepthStallEnable, 13, 13) |
463310e230b6Smaya      __gen_uint(values->PostSyncOperation, 14, 15) |
463410e230b6Smaya      __gen_uint(values->GenericMediaStateClear, 16, 16) |
463510e230b6Smaya      __gen_uint(values->SynchronizeGFDTSurface, 17, 17) |
463610e230b6Smaya      __gen_uint(values->TLBInvalidate, 18, 18) |
463710e230b6Smaya      __gen_uint(values->GlobalSnapshotCountReset, 19, 19) |
463810e230b6Smaya      __gen_uint(values->CommandStreamerStallEnable, 20, 20) |
463910e230b6Smaya      __gen_uint(values->StoreDataIndex, 21, 21);
464010e230b6Smaya
464110e230b6Smaya   const uint32_t v2 =
464210e230b6Smaya      __gen_uint(values->DestinationAddressType, 2, 2);
464396c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->Address, v2, 3, 31);
464410e230b6Smaya
464510e230b6Smaya   const uint64_t v3 =
464610e230b6Smaya      __gen_uint(values->ImmediateData, 0, 63);
464710e230b6Smaya   dw[3] = v3;
464810e230b6Smaya   dw[4] = v3 >> 32;
464910e230b6Smaya}
465010e230b6Smaya
465196c5ddc4Srjs#define GFX6_STATE_BASE_ADDRESS_length        10
465296c5ddc4Srjs#define GFX6_STATE_BASE_ADDRESS_length_bias      2
465396c5ddc4Srjs#define GFX6_STATE_BASE_ADDRESS_header          \
465410e230b6Smaya   .DWordLength                         =      8,  \
465510e230b6Smaya   ._3DCommandSubOpcode                 =      1,  \
465610e230b6Smaya   ._3DCommandOpcode                    =      1,  \
465710e230b6Smaya   .CommandSubType                      =      0,  \
465810e230b6Smaya   .CommandType                         =      3
465910e230b6Smaya
466096c5ddc4Srjsstruct GFX6_STATE_BASE_ADDRESS {
466110e230b6Smaya   uint32_t                             DWordLength;
466210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
466310e230b6Smaya   uint32_t                             _3DCommandOpcode;
466410e230b6Smaya   uint32_t                             CommandSubType;
466510e230b6Smaya   uint32_t                             CommandType;
466610e230b6Smaya   bool                                 GeneralStateBaseAddressModifyEnable;
466710e230b6Smaya   uint32_t                             StatelessDataPortAccessForceWriteThru;
466810e230b6Smaya   uint32_t                             StatelessDataPortAccessMOCS;
466910e230b6Smaya   uint32_t                             GeneralStateMOCS;
467010e230b6Smaya   __gen_address_type                   GeneralStateBaseAddress;
467110e230b6Smaya   bool                                 SurfaceStateBaseAddressModifyEnable;
467210e230b6Smaya   uint32_t                             SurfaceStateMOCS;
467310e230b6Smaya   __gen_address_type                   SurfaceStateBaseAddress;
467410e230b6Smaya   bool                                 DynamicStateBaseAddressModifyEnable;
467510e230b6Smaya   uint32_t                             DynamicStateMOCS;
467610e230b6Smaya   __gen_address_type                   DynamicStateBaseAddress;
467710e230b6Smaya   bool                                 IndirectObjectBaseAddressModifyEnable;
467810e230b6Smaya   uint32_t                             IndirectObjectMOCS;
467910e230b6Smaya   __gen_address_type                   IndirectObjectBaseAddress;
468010e230b6Smaya   bool                                 InstructionBaseAddressModifyEnable;
468110e230b6Smaya   uint32_t                             InstructionMOCS;
468210e230b6Smaya   __gen_address_type                   InstructionBaseAddress;
468310e230b6Smaya   bool                                 GeneralStateAccessUpperBoundModifyEnable;
468410e230b6Smaya   __gen_address_type                   GeneralStateAccessUpperBound;
468510e230b6Smaya   bool                                 DynamicStateAccessUpperBoundModifyEnable;
468610e230b6Smaya   __gen_address_type                   DynamicStateAccessUpperBound;
468710e230b6Smaya   bool                                 IndirectObjectAccessUpperBoundModifyEnable;
468810e230b6Smaya   __gen_address_type                   IndirectObjectAccessUpperBound;
468910e230b6Smaya   bool                                 InstructionAccessUpperBoundModifyEnable;
469010e230b6Smaya   __gen_address_type                   InstructionAccessUpperBound;
469110e230b6Smaya};
469210e230b6Smaya
469396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
469496c5ddc4SrjsGFX6_STATE_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
469510e230b6Smaya                             __attribute__((unused)) void * restrict dst,
469696c5ddc4Srjs                             __attribute__((unused)) const struct GFX6_STATE_BASE_ADDRESS * restrict values)
469710e230b6Smaya{
469810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
469910e230b6Smaya
470010e230b6Smaya   dw[0] =
470110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
470210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
470310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
470410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
470510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
470610e230b6Smaya
470710e230b6Smaya   const uint32_t v1 =
470810e230b6Smaya      __gen_uint(values->GeneralStateBaseAddressModifyEnable, 0, 0) |
470910e230b6Smaya      __gen_uint(values->StatelessDataPortAccessForceWriteThru, 3, 3) |
471010e230b6Smaya      __gen_uint(values->StatelessDataPortAccessMOCS, 4, 7) |
471110e230b6Smaya      __gen_uint(values->GeneralStateMOCS, 8, 11);
471296c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->GeneralStateBaseAddress, v1, 12, 31);
471310e230b6Smaya
471410e230b6Smaya   const uint32_t v2 =
471510e230b6Smaya      __gen_uint(values->SurfaceStateBaseAddressModifyEnable, 0, 0) |
471610e230b6Smaya      __gen_uint(values->SurfaceStateMOCS, 8, 11);
471796c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->SurfaceStateBaseAddress, v2, 12, 31);
471810e230b6Smaya
471910e230b6Smaya   const uint32_t v3 =
472010e230b6Smaya      __gen_uint(values->DynamicStateBaseAddressModifyEnable, 0, 0) |
472110e230b6Smaya      __gen_uint(values->DynamicStateMOCS, 8, 11);
472296c5ddc4Srjs   dw[3] = __gen_address(data, &dw[3], values->DynamicStateBaseAddress, v3, 12, 31);
472310e230b6Smaya
472410e230b6Smaya   const uint32_t v4 =
472510e230b6Smaya      __gen_uint(values->IndirectObjectBaseAddressModifyEnable, 0, 0) |
472610e230b6Smaya      __gen_uint(values->IndirectObjectMOCS, 8, 11);
472796c5ddc4Srjs   dw[4] = __gen_address(data, &dw[4], values->IndirectObjectBaseAddress, v4, 12, 31);
472810e230b6Smaya
472910e230b6Smaya   const uint32_t v5 =
473010e230b6Smaya      __gen_uint(values->InstructionBaseAddressModifyEnable, 0, 0) |
473110e230b6Smaya      __gen_uint(values->InstructionMOCS, 8, 11);
473296c5ddc4Srjs   dw[5] = __gen_address(data, &dw[5], values->InstructionBaseAddress, v5, 12, 31);
473310e230b6Smaya
473410e230b6Smaya   const uint32_t v6 =
473510e230b6Smaya      __gen_uint(values->GeneralStateAccessUpperBoundModifyEnable, 0, 0);
473696c5ddc4Srjs   dw[6] = __gen_address(data, &dw[6], values->GeneralStateAccessUpperBound, v6, 12, 31);
473710e230b6Smaya
473810e230b6Smaya   const uint32_t v7 =
473910e230b6Smaya      __gen_uint(values->DynamicStateAccessUpperBoundModifyEnable, 0, 0);
474096c5ddc4Srjs   dw[7] = __gen_address(data, &dw[7], values->DynamicStateAccessUpperBound, v7, 12, 31);
474110e230b6Smaya
474210e230b6Smaya   const uint32_t v8 =
474310e230b6Smaya      __gen_uint(values->IndirectObjectAccessUpperBoundModifyEnable, 0, 0);
474496c5ddc4Srjs   dw[8] = __gen_address(data, &dw[8], values->IndirectObjectAccessUpperBound, v8, 12, 31);
474510e230b6Smaya
474610e230b6Smaya   const uint32_t v9 =
474710e230b6Smaya      __gen_uint(values->InstructionAccessUpperBoundModifyEnable, 0, 0);
474896c5ddc4Srjs   dw[9] = __gen_address(data, &dw[9], values->InstructionAccessUpperBound, v9, 12, 31);
474910e230b6Smaya}
475010e230b6Smaya
475196c5ddc4Srjs#define GFX6_STATE_PREFETCH_length             2
475296c5ddc4Srjs#define GFX6_STATE_PREFETCH_length_bias        2
475396c5ddc4Srjs#define GFX6_STATE_PREFETCH_header              \
475410e230b6Smaya   .DWordLength                         =      0,  \
475510e230b6Smaya   ._3DCommandSubOpcode                 =      3,  \
475610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
475710e230b6Smaya   .CommandSubType                      =      0,  \
475810e230b6Smaya   .CommandType                         =      3
475910e230b6Smaya
476096c5ddc4Srjsstruct GFX6_STATE_PREFETCH {
476110e230b6Smaya   uint32_t                             DWordLength;
476210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
476310e230b6Smaya   uint32_t                             _3DCommandOpcode;
476410e230b6Smaya   uint32_t                             CommandSubType;
476510e230b6Smaya   uint32_t                             CommandType;
476610e230b6Smaya   uint32_t                             PrefetchCount;
476710e230b6Smaya   __gen_address_type                   PrefetchPointer;
476810e230b6Smaya};
476910e230b6Smaya
477096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
477196c5ddc4SrjsGFX6_STATE_PREFETCH_pack(__attribute__((unused)) __gen_user_data *data,
477210e230b6Smaya                         __attribute__((unused)) void * restrict dst,
477396c5ddc4Srjs                         __attribute__((unused)) const struct GFX6_STATE_PREFETCH * restrict values)
477410e230b6Smaya{
477510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
477610e230b6Smaya
477710e230b6Smaya   dw[0] =
477810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
477910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
478010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
478110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
478210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
478310e230b6Smaya
478410e230b6Smaya   const uint32_t v1 =
478510e230b6Smaya      __gen_uint(values->PrefetchCount, 0, 2);
478696c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->PrefetchPointer, v1, 6, 31);
478710e230b6Smaya}
478810e230b6Smaya
478996c5ddc4Srjs#define GFX6_STATE_SIP_length                  2
479096c5ddc4Srjs#define GFX6_STATE_SIP_length_bias             2
479196c5ddc4Srjs#define GFX6_STATE_SIP_header                   \
479210e230b6Smaya   .DWordLength                         =      0,  \
479310e230b6Smaya   ._3DCommandSubOpcode                 =      2,  \
479410e230b6Smaya   ._3DCommandOpcode                    =      1,  \
479510e230b6Smaya   .CommandSubType                      =      0,  \
479610e230b6Smaya   .CommandType                         =      3
479710e230b6Smaya
479896c5ddc4Srjsstruct GFX6_STATE_SIP {
479910e230b6Smaya   uint32_t                             DWordLength;
480010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
480110e230b6Smaya   uint32_t                             _3DCommandOpcode;
480210e230b6Smaya   uint32_t                             CommandSubType;
480310e230b6Smaya   uint32_t                             CommandType;
480410e230b6Smaya   uint64_t                             SystemInstructionPointer;
480510e230b6Smaya};
480610e230b6Smaya
480796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
480896c5ddc4SrjsGFX6_STATE_SIP_pack(__attribute__((unused)) __gen_user_data *data,
480910e230b6Smaya                    __attribute__((unused)) void * restrict dst,
481096c5ddc4Srjs                    __attribute__((unused)) const struct GFX6_STATE_SIP * restrict values)
481110e230b6Smaya{
481210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
481310e230b6Smaya
481410e230b6Smaya   dw[0] =
481510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
481610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
481710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
481810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
481910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
482010e230b6Smaya
482110e230b6Smaya   dw[1] =
482210e230b6Smaya      __gen_offset(values->SystemInstructionPointer, 4, 31);
482310e230b6Smaya}
482410e230b6Smaya
482596c5ddc4Srjs#define GFX6_BCS_FAULT_REG_num            0x4294
482696c5ddc4Srjs#define GFX6_BCS_FAULT_REG_length              1
482796c5ddc4Srjsstruct GFX6_BCS_FAULT_REG {
482810e230b6Smaya   bool                                 ValidBit;
482910e230b6Smaya   uint32_t                             FaultType;
483010e230b6Smaya#define PageFault                                0
483110e230b6Smaya#define InvalidPDFault                           1
483210e230b6Smaya#define UnloadedPDFault                          2
483310e230b6Smaya#define InvalidandUnloadedPDfault                3
483410e230b6Smaya   uint32_t                             SRCIDofFault;
483510e230b6Smaya   uint32_t                             GTTSEL;
483610e230b6Smaya#define PPGTT                                    0
483710e230b6Smaya#define GGTT                                     1
483810e230b6Smaya   __gen_address_type                   VirtualAddressofFault;
483910e230b6Smaya};
484010e230b6Smaya
484196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
484296c5ddc4SrjsGFX6_BCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
484310e230b6Smaya                        __attribute__((unused)) void * restrict dst,
484496c5ddc4Srjs                        __attribute__((unused)) const struct GFX6_BCS_FAULT_REG * restrict values)
484510e230b6Smaya{
484610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
484710e230b6Smaya
484810e230b6Smaya   const uint32_t v0 =
484910e230b6Smaya      __gen_uint(values->ValidBit, 0, 0) |
485010e230b6Smaya      __gen_uint(values->FaultType, 1, 2) |
485110e230b6Smaya      __gen_uint(values->SRCIDofFault, 3, 10) |
485210e230b6Smaya      __gen_uint(values->GTTSEL, 11, 11);
485396c5ddc4Srjs   dw[0] = __gen_address(data, &dw[0], values->VirtualAddressofFault, v0, 12, 31);
485410e230b6Smaya}
485510e230b6Smaya
485696c5ddc4Srjs#define GFX6_BCS_INSTDONE_num             0x2206c
485796c5ddc4Srjs#define GFX6_BCS_INSTDONE_length               1
485896c5ddc4Srjsstruct GFX6_BCS_INSTDONE {
485910e230b6Smaya   bool                                 RingEnable;
486010e230b6Smaya   bool                                 BlitterIDLE;
486110e230b6Smaya   bool                                 GABIDLE;
486210e230b6Smaya   bool                                 BCSDone;
486310e230b6Smaya};
486410e230b6Smaya
486596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
486696c5ddc4SrjsGFX6_BCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
486710e230b6Smaya                       __attribute__((unused)) void * restrict dst,
486896c5ddc4Srjs                       __attribute__((unused)) const struct GFX6_BCS_INSTDONE * restrict values)
486910e230b6Smaya{
487010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
487110e230b6Smaya
487210e230b6Smaya   dw[0] =
487310e230b6Smaya      __gen_uint(values->RingEnable, 0, 0) |
487410e230b6Smaya      __gen_uint(values->BlitterIDLE, 1, 1) |
487510e230b6Smaya      __gen_uint(values->GABIDLE, 2, 2) |
487610e230b6Smaya      __gen_uint(values->BCSDone, 3, 3);
487710e230b6Smaya}
487810e230b6Smaya
487996c5ddc4Srjs#define GFX6_BCS_RING_BUFFER_CTL_num      0x2203c
488096c5ddc4Srjs#define GFX6_BCS_RING_BUFFER_CTL_length        1
488196c5ddc4Srjsstruct GFX6_BCS_RING_BUFFER_CTL {
488210e230b6Smaya   bool                                 RingBufferEnable;
488310e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
488410e230b6Smaya#define MI_AUTOREPORT_OFF                        0
488510e230b6Smaya#define MI_AUTOREPORT_64KB                       1
488610e230b6Smaya#define MI_AUTOREPORT_4KB                        2
488710e230b6Smaya#define MI_AUTOREPORT_128KB                      3
488810e230b6Smaya   bool                                 DisableRegisterAccesses;
488910e230b6Smaya   bool                                 SemaphoreWait;
489010e230b6Smaya   bool                                 RBWait;
489110e230b6Smaya   uint32_t                             BufferLengthinpages1;
489210e230b6Smaya};
489310e230b6Smaya
489496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
489596c5ddc4SrjsGFX6_BCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
489610e230b6Smaya                              __attribute__((unused)) void * restrict dst,
489796c5ddc4Srjs                              __attribute__((unused)) const struct GFX6_BCS_RING_BUFFER_CTL * restrict values)
489810e230b6Smaya{
489910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
490010e230b6Smaya
490110e230b6Smaya   dw[0] =
490210e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
490310e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
490410e230b6Smaya      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
490510e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
490610e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
490710e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
490810e230b6Smaya}
490910e230b6Smaya
491096c5ddc4Srjs#define GFX6_GFX_ARB_ERROR_RPT_num        0x40a0
491196c5ddc4Srjs#define GFX6_GFX_ARB_ERROR_RPT_length          1
491296c5ddc4Srjsstruct GFX6_GFX_ARB_ERROR_RPT {
491310e230b6Smaya   bool                                 TLBPageFaultError;
491410e230b6Smaya   bool                                 ContextPageFaultError;
491510e230b6Smaya   bool                                 InvalidPageDirectoryentryerror;
491610e230b6Smaya   bool                                 HardwareStatusPageFaultError;
491710e230b6Smaya   bool                                 TLBPageVTDTranslationError;
491810e230b6Smaya   bool                                 ContextPageVTDTranslationError;
491910e230b6Smaya   bool                                 PageDirectoryEntryVTDTranslationError;
492010e230b6Smaya   bool                                 HardwareStatusPageVTDTranslationError;
492110e230b6Smaya   bool                                 UnloadedPDError;
492210e230b6Smaya};
492310e230b6Smaya
492496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
492596c5ddc4SrjsGFX6_GFX_ARB_ERROR_RPT_pack(__attribute__((unused)) __gen_user_data *data,
492610e230b6Smaya                            __attribute__((unused)) void * restrict dst,
492796c5ddc4Srjs                            __attribute__((unused)) const struct GFX6_GFX_ARB_ERROR_RPT * restrict values)
492810e230b6Smaya{
492910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
493010e230b6Smaya
493110e230b6Smaya   dw[0] =
493210e230b6Smaya      __gen_uint(values->TLBPageFaultError, 0, 0) |
493310e230b6Smaya      __gen_uint(values->ContextPageFaultError, 1, 1) |
493410e230b6Smaya      __gen_uint(values->InvalidPageDirectoryentryerror, 2, 2) |
493510e230b6Smaya      __gen_uint(values->HardwareStatusPageFaultError, 3, 3) |
493610e230b6Smaya      __gen_uint(values->TLBPageVTDTranslationError, 4, 4) |
493710e230b6Smaya      __gen_uint(values->ContextPageVTDTranslationError, 5, 5) |
493810e230b6Smaya      __gen_uint(values->PageDirectoryEntryVTDTranslationError, 6, 6) |
493910e230b6Smaya      __gen_uint(values->HardwareStatusPageVTDTranslationError, 7, 7) |
494010e230b6Smaya      __gen_uint(values->UnloadedPDError, 8, 8);
494110e230b6Smaya}
494210e230b6Smaya
494396c5ddc4Srjs#define GFX6_INSTDONE_1_num               0x206c
494496c5ddc4Srjs#define GFX6_INSTDONE_1_length                 1
494596c5ddc4Srjsstruct GFX6_INSTDONE_1 {
494610e230b6Smaya   bool                                 PRB0RingEnable;
494710e230b6Smaya   bool                                 AVSDone;
494810e230b6Smaya   bool                                 HIZDone;
494910e230b6Smaya   bool                                 GWDone;
495010e230b6Smaya   bool                                 TSDone;
495110e230b6Smaya   bool                                 TDDone;
495210e230b6Smaya   bool                                 VFEDone;
495310e230b6Smaya   bool                                 IEFDone;
495410e230b6Smaya   bool                                 VSCDone;
495510e230b6Smaya   bool                                 ISC23Done;
495610e230b6Smaya   bool                                 ISC10Done;
495710e230b6Smaya   bool                                 IC0Done;
495810e230b6Smaya   bool                                 IC1Done;
495910e230b6Smaya   bool                                 IC2Done;
496010e230b6Smaya   bool                                 IC3Done;
496110e230b6Smaya   bool                                 EU00Done;
496210e230b6Smaya   bool                                 EU01Done;
496310e230b6Smaya   bool                                 EU02Done;
496410e230b6Smaya   bool                                 MA0Done;
496510e230b6Smaya   bool                                 EU10Done;
496610e230b6Smaya   bool                                 EU11Done;
496710e230b6Smaya   bool                                 EU12Done;
496810e230b6Smaya   bool                                 MA1Done;
496910e230b6Smaya   bool                                 EU20Done;
497010e230b6Smaya   bool                                 EU21Done;
497110e230b6Smaya   bool                                 EU22Done;
497210e230b6Smaya   bool                                 MA2Done;
497310e230b6Smaya   bool                                 EU30Done;
497410e230b6Smaya   bool                                 EU31Done;
497510e230b6Smaya   bool                                 EU32Done;
497610e230b6Smaya   bool                                 MA3Done;
497710e230b6Smaya};
497810e230b6Smaya
497996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
498096c5ddc4SrjsGFX6_INSTDONE_1_pack(__attribute__((unused)) __gen_user_data *data,
498110e230b6Smaya                     __attribute__((unused)) void * restrict dst,
498296c5ddc4Srjs                     __attribute__((unused)) const struct GFX6_INSTDONE_1 * restrict values)
498310e230b6Smaya{
498410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
498510e230b6Smaya
498610e230b6Smaya   dw[0] =
498710e230b6Smaya      __gen_uint(values->PRB0RingEnable, 0, 0) |
498810e230b6Smaya      __gen_uint(values->AVSDone, 1, 1) |
498910e230b6Smaya      __gen_uint(values->HIZDone, 2, 2) |
499010e230b6Smaya      __gen_uint(values->GWDone, 3, 3) |
499110e230b6Smaya      __gen_uint(values->TSDone, 4, 4) |
499210e230b6Smaya      __gen_uint(values->TDDone, 6, 6) |
499310e230b6Smaya      __gen_uint(values->VFEDone, 7, 7) |
499410e230b6Smaya      __gen_uint(values->IEFDone, 8, 8) |
499510e230b6Smaya      __gen_uint(values->VSCDone, 9, 9) |
499610e230b6Smaya      __gen_uint(values->ISC23Done, 10, 10) |
499710e230b6Smaya      __gen_uint(values->ISC10Done, 11, 11) |
499810e230b6Smaya      __gen_uint(values->IC0Done, 12, 12) |
499910e230b6Smaya      __gen_uint(values->IC1Done, 13, 13) |
500010e230b6Smaya      __gen_uint(values->IC2Done, 14, 14) |
500110e230b6Smaya      __gen_uint(values->IC3Done, 15, 15) |
500210e230b6Smaya      __gen_uint(values->EU00Done, 16, 16) |
500310e230b6Smaya      __gen_uint(values->EU01Done, 17, 17) |
500410e230b6Smaya      __gen_uint(values->EU02Done, 18, 18) |
500510e230b6Smaya      __gen_uint(values->MA0Done, 19, 19) |
500610e230b6Smaya      __gen_uint(values->EU10Done, 20, 20) |
500710e230b6Smaya      __gen_uint(values->EU11Done, 21, 21) |
500810e230b6Smaya      __gen_uint(values->EU12Done, 22, 22) |
500910e230b6Smaya      __gen_uint(values->MA1Done, 23, 23) |
501010e230b6Smaya      __gen_uint(values->EU20Done, 24, 24) |
501110e230b6Smaya      __gen_uint(values->EU21Done, 25, 25) |
501210e230b6Smaya      __gen_uint(values->EU22Done, 26, 26) |
501310e230b6Smaya      __gen_uint(values->MA2Done, 27, 27) |
501410e230b6Smaya      __gen_uint(values->EU30Done, 28, 28) |
501510e230b6Smaya      __gen_uint(values->EU31Done, 29, 29) |
501610e230b6Smaya      __gen_uint(values->EU32Done, 30, 30) |
501710e230b6Smaya      __gen_uint(values->MA3Done, 31, 31);
501810e230b6Smaya}
501910e230b6Smaya
502096c5ddc4Srjs#define GFX6_INSTDONE_2_num               0x207c
502196c5ddc4Srjs#define GFX6_INSTDONE_2_length                 1
502296c5ddc4Srjsstruct GFX6_INSTDONE_2 {
502310e230b6Smaya   bool                                 VFDone;
502410e230b6Smaya   bool                                 VS0Done;
502510e230b6Smaya   bool                                 GSDone;
502610e230b6Smaya   bool                                 CLDone;
502710e230b6Smaya   bool                                 SFDone;
502810e230b6Smaya   bool                                 VMEDone;
502910e230b6Smaya   bool                                 PLDone;
503010e230b6Smaya   bool                                 SODone;
503110e230b6Smaya   bool                                 SIDone;
503210e230b6Smaya   bool                                 DGDone;
503310e230b6Smaya   bool                                 FTDone;
503410e230b6Smaya   bool                                 DMDone;
503510e230b6Smaya   bool                                 SCDone;
503610e230b6Smaya   bool                                 FLDone;
503710e230b6Smaya   bool                                 QCDone;
503810e230b6Smaya   bool                                 SVSMDone;
503910e230b6Smaya   bool                                 WMFEDone;
504010e230b6Smaya   bool                                 IZDone;
504110e230b6Smaya   bool                                 PSDDone;
504210e230b6Smaya   bool                                 DAPDone;
504310e230b6Smaya   bool                                 RCZDone;
504410e230b6Smaya   bool                                 VDIDone;
504510e230b6Smaya   bool                                 RCPBEDone;
504610e230b6Smaya   bool                                 RCPFEDone;
504710e230b6Smaya   bool                                 MTDone;
504810e230b6Smaya   bool                                 ISCDone;
504910e230b6Smaya   bool                                 SVGDone;
505010e230b6Smaya   bool                                 RCCDone;
505110e230b6Smaya   bool                                 SVRWDone;
505210e230b6Smaya   bool                                 WMBEDone;
505310e230b6Smaya   bool                                 CSDone;
505410e230b6Smaya   bool                                 GAMDone;
505510e230b6Smaya};
505610e230b6Smaya
505796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
505896c5ddc4SrjsGFX6_INSTDONE_2_pack(__attribute__((unused)) __gen_user_data *data,
505910e230b6Smaya                     __attribute__((unused)) void * restrict dst,
506096c5ddc4Srjs                     __attribute__((unused)) const struct GFX6_INSTDONE_2 * restrict values)
506110e230b6Smaya{
506210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
506310e230b6Smaya
506410e230b6Smaya   dw[0] =
506510e230b6Smaya      __gen_uint(values->VFDone, 0, 0) |
506610e230b6Smaya      __gen_uint(values->VS0Done, 1, 1) |
506710e230b6Smaya      __gen_uint(values->GSDone, 2, 2) |
506810e230b6Smaya      __gen_uint(values->CLDone, 3, 3) |
506910e230b6Smaya      __gen_uint(values->SFDone, 4, 4) |
507010e230b6Smaya      __gen_uint(values->VMEDone, 5, 5) |
507110e230b6Smaya      __gen_uint(values->PLDone, 6, 6) |
507210e230b6Smaya      __gen_uint(values->SODone, 7, 7) |
507310e230b6Smaya      __gen_uint(values->SIDone, 8, 8) |
507410e230b6Smaya      __gen_uint(values->DGDone, 9, 9) |
507510e230b6Smaya      __gen_uint(values->FTDone, 10, 10) |
507610e230b6Smaya      __gen_uint(values->DMDone, 11, 11) |
507710e230b6Smaya      __gen_uint(values->SCDone, 12, 12) |
507810e230b6Smaya      __gen_uint(values->FLDone, 13, 13) |
507910e230b6Smaya      __gen_uint(values->QCDone, 14, 14) |
508010e230b6Smaya      __gen_uint(values->SVSMDone, 15, 15) |
508110e230b6Smaya      __gen_uint(values->WMFEDone, 16, 16) |
508210e230b6Smaya      __gen_uint(values->IZDone, 17, 17) |
508310e230b6Smaya      __gen_uint(values->PSDDone, 18, 18) |
508410e230b6Smaya      __gen_uint(values->DAPDone, 19, 19) |
508510e230b6Smaya      __gen_uint(values->RCZDone, 20, 20) |
508610e230b6Smaya      __gen_uint(values->VDIDone, 21, 21) |
508710e230b6Smaya      __gen_uint(values->RCPBEDone, 22, 22) |
508810e230b6Smaya      __gen_uint(values->RCPFEDone, 23, 23) |
508910e230b6Smaya      __gen_uint(values->MTDone, 24, 24) |
509010e230b6Smaya      __gen_uint(values->ISCDone, 25, 25) |
509110e230b6Smaya      __gen_uint(values->SVGDone, 26, 26) |
509210e230b6Smaya      __gen_uint(values->RCCDone, 27, 27) |
509310e230b6Smaya      __gen_uint(values->SVRWDone, 28, 28) |
509410e230b6Smaya      __gen_uint(values->WMBEDone, 29, 29) |
509510e230b6Smaya      __gen_uint(values->CSDone, 30, 30) |
509610e230b6Smaya      __gen_uint(values->GAMDone, 31, 31);
509710e230b6Smaya}
509810e230b6Smaya
509996c5ddc4Srjs#define GFX6_INSTPM_num                   0x20c0
510096c5ddc4Srjs#define GFX6_INSTPM_length                     1
510196c5ddc4Srjsstruct GFX6_INSTPM {
510210e230b6Smaya   bool                                 _3DStateInstructionDisable;
510310e230b6Smaya   bool                                 _3DRenderingInstructionDisable;
510410e230b6Smaya   bool                                 MediaInstructionDisable;
510510e230b6Smaya   bool                                 CONSTANT_BUFFERAddressOffsetDisable;
510610e230b6Smaya   bool                                 _3DStateInstructionDisableMask;
510710e230b6Smaya   bool                                 _3DRenderingInstructionDisableMask;
510810e230b6Smaya   bool                                 MediaInstructionDisableMask;
510910e230b6Smaya   bool                                 CONSTANT_BUFFERAddressOffsetDisableMask;
511010e230b6Smaya};
511110e230b6Smaya
511296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
511396c5ddc4SrjsGFX6_INSTPM_pack(__attribute__((unused)) __gen_user_data *data,
511410e230b6Smaya                 __attribute__((unused)) void * restrict dst,
511596c5ddc4Srjs                 __attribute__((unused)) const struct GFX6_INSTPM * restrict values)
511610e230b6Smaya{
511710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
511810e230b6Smaya
511910e230b6Smaya   dw[0] =
512010e230b6Smaya      __gen_uint(values->_3DStateInstructionDisable, 1, 1) |
512110e230b6Smaya      __gen_uint(values->_3DRenderingInstructionDisable, 2, 2) |
512210e230b6Smaya      __gen_uint(values->MediaInstructionDisable, 3, 3) |
512310e230b6Smaya      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisable, 6, 6) |
512410e230b6Smaya      __gen_uint(values->_3DStateInstructionDisableMask, 17, 17) |
512510e230b6Smaya      __gen_uint(values->_3DRenderingInstructionDisableMask, 18, 18) |
512610e230b6Smaya      __gen_uint(values->MediaInstructionDisableMask, 19, 19) |
512710e230b6Smaya      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisableMask, 22, 22);
512810e230b6Smaya}
512910e230b6Smaya
513096c5ddc4Srjs#define GFX6_RCS_FAULT_REG_num            0x4094
513196c5ddc4Srjs#define GFX6_RCS_FAULT_REG_length              1
513296c5ddc4Srjsstruct GFX6_RCS_FAULT_REG {
513310e230b6Smaya   bool                                 ValidBit;
513410e230b6Smaya   uint32_t                             FaultType;
513510e230b6Smaya#define PageFault                                0
513610e230b6Smaya#define InvalidPDFault                           1
513710e230b6Smaya#define UnloadedPDFault                          2
513810e230b6Smaya#define InvalidandUnloadedPDfault                3
513910e230b6Smaya   uint32_t                             SRCIDofFault;
514010e230b6Smaya   uint32_t                             GTTSEL;
514110e230b6Smaya#define PPGTT                                    0
514210e230b6Smaya#define GGTT                                     1
514310e230b6Smaya   __gen_address_type                   VirtualAddressofFault;
514410e230b6Smaya};
514510e230b6Smaya
514696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
514796c5ddc4SrjsGFX6_RCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
514810e230b6Smaya                        __attribute__((unused)) void * restrict dst,
514996c5ddc4Srjs                        __attribute__((unused)) const struct GFX6_RCS_FAULT_REG * restrict values)
515010e230b6Smaya{
515110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
515210e230b6Smaya
515310e230b6Smaya   const uint32_t v0 =
515410e230b6Smaya      __gen_uint(values->ValidBit, 0, 0) |
515510e230b6Smaya      __gen_uint(values->FaultType, 1, 2) |
515610e230b6Smaya      __gen_uint(values->SRCIDofFault, 3, 10) |
515710e230b6Smaya      __gen_uint(values->GTTSEL, 11, 11);
515896c5ddc4Srjs   dw[0] = __gen_address(data, &dw[0], values->VirtualAddressofFault, v0, 12, 31);
515910e230b6Smaya}
516010e230b6Smaya
516196c5ddc4Srjs#define GFX6_RCS_RING_BUFFER_CTL_num      0x203c
516296c5ddc4Srjs#define GFX6_RCS_RING_BUFFER_CTL_length        1
516396c5ddc4Srjsstruct GFX6_RCS_RING_BUFFER_CTL {
516410e230b6Smaya   bool                                 RingBufferEnable;
516510e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
516610e230b6Smaya#define MI_AUTOREPORT_OFF                        0
516710e230b6Smaya#define MI_AUTOREPORT_64KBMI_AUTOREPORT_4KB      1
516810e230b6Smaya#define MI_AUTOREPORT_128KB                      3
516910e230b6Smaya   bool                                 SemaphoreWait;
517010e230b6Smaya   bool                                 RBWait;
517110e230b6Smaya   uint32_t                             BufferLengthinpages1;
517210e230b6Smaya};
517310e230b6Smaya
517496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
517596c5ddc4SrjsGFX6_RCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
517610e230b6Smaya                              __attribute__((unused)) void * restrict dst,
517796c5ddc4Srjs                              __attribute__((unused)) const struct GFX6_RCS_RING_BUFFER_CTL * restrict values)
517810e230b6Smaya{
517910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
518010e230b6Smaya
518110e230b6Smaya   dw[0] =
518210e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
518310e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
518410e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
518510e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
518610e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
518710e230b6Smaya}
518810e230b6Smaya
518996c5ddc4Srjs#define GFX6_RPSTAT1_num                  0xa01c
519096c5ddc4Srjs#define GFX6_RPSTAT1_length                    1
519196c5ddc4Srjsstruct GFX6_RPSTAT1 {
519296c5ddc4Srjs   uint32_t                             PreviousGTFrequency;
519396c5ddc4Srjs   uint32_t                             CurrentGTFrequency;
519496c5ddc4Srjs};
519596c5ddc4Srjs
519696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
519796c5ddc4SrjsGFX6_RPSTAT1_pack(__attribute__((unused)) __gen_user_data *data,
519896c5ddc4Srjs                  __attribute__((unused)) void * restrict dst,
519996c5ddc4Srjs                  __attribute__((unused)) const struct GFX6_RPSTAT1 * restrict values)
520096c5ddc4Srjs{
520196c5ddc4Srjs   uint32_t * restrict dw = (uint32_t * restrict) dst;
520296c5ddc4Srjs
520396c5ddc4Srjs   dw[0] =
520496c5ddc4Srjs      __gen_uint(values->PreviousGTFrequency, 0, 6) |
520596c5ddc4Srjs      __gen_uint(values->CurrentGTFrequency, 7, 14);
520696c5ddc4Srjs}
520796c5ddc4Srjs
520896c5ddc4Srjs#define GFX6_VCS_FAULT_REG_num            0x4194
520996c5ddc4Srjs#define GFX6_VCS_FAULT_REG_length              1
521096c5ddc4Srjsstruct GFX6_VCS_FAULT_REG {
521110e230b6Smaya   bool                                 ValidBit;
521210e230b6Smaya   uint32_t                             FaultType;
521310e230b6Smaya#define PageFault                                0
521410e230b6Smaya#define InvalidPDFault                           1
521510e230b6Smaya#define UnloadedPDFault                          2
521610e230b6Smaya#define InvalidandUnloadedPDfault                3
521710e230b6Smaya   uint32_t                             SRCIDofFault;
521810e230b6Smaya   uint32_t                             GTTSEL;
521910e230b6Smaya#define PPGTT                                    0
522010e230b6Smaya#define GGTT                                     1
522110e230b6Smaya   __gen_address_type                   VirtualAddressofFault;
522210e230b6Smaya};
522310e230b6Smaya
522496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
522596c5ddc4SrjsGFX6_VCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
522610e230b6Smaya                        __attribute__((unused)) void * restrict dst,
522796c5ddc4Srjs                        __attribute__((unused)) const struct GFX6_VCS_FAULT_REG * restrict values)
522810e230b6Smaya{
522910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
523010e230b6Smaya
523110e230b6Smaya   const uint32_t v0 =
523210e230b6Smaya      __gen_uint(values->ValidBit, 0, 0) |
523310e230b6Smaya      __gen_uint(values->FaultType, 1, 2) |
523410e230b6Smaya      __gen_uint(values->SRCIDofFault, 3, 10) |
523510e230b6Smaya      __gen_uint(values->GTTSEL, 11, 11);
523696c5ddc4Srjs   dw[0] = __gen_address(data, &dw[0], values->VirtualAddressofFault, v0, 12, 31);
523710e230b6Smaya}
523810e230b6Smaya
523996c5ddc4Srjs#define GFX6_VCS_INSTDONE_num             0x1206c
524096c5ddc4Srjs#define GFX6_VCS_INSTDONE_length               1
524196c5ddc4Srjsstruct GFX6_VCS_INSTDONE {
524210e230b6Smaya   bool                                 RingEnable;
524310e230b6Smaya   bool                                 USBDone;
524410e230b6Smaya   bool                                 QRCDone;
524510e230b6Smaya   bool                                 SECDone;
524610e230b6Smaya   bool                                 MPCDone;
524710e230b6Smaya   bool                                 VFTDone;
524810e230b6Smaya   bool                                 BSPDone;
524910e230b6Smaya   bool                                 VLFDone;
525010e230b6Smaya   bool                                 VOPDone;
525110e230b6Smaya   bool                                 VMCDone;
525210e230b6Smaya   bool                                 VIPDone;
525310e230b6Smaya   bool                                 VITDone;
525410e230b6Smaya   bool                                 VDSDone;
525510e230b6Smaya   bool                                 VMXDone;
525610e230b6Smaya   bool                                 VCPDone;
525710e230b6Smaya   bool                                 VCDDone;
525810e230b6Smaya   bool                                 VADDone;
525910e230b6Smaya   bool                                 VMDDone;
526010e230b6Smaya   bool                                 VISDone;
526110e230b6Smaya   bool                                 VACDone;
526210e230b6Smaya   bool                                 VAMDone;
526310e230b6Smaya   bool                                 JPGDone;
526410e230b6Smaya   bool                                 VBPDone;
526510e230b6Smaya   bool                                 VHRDone;
526610e230b6Smaya   bool                                 VCIDone;
526710e230b6Smaya   bool                                 VCRDone;
526810e230b6Smaya   bool                                 VINDone;
526910e230b6Smaya   bool                                 VPRDone;
527010e230b6Smaya   bool                                 VTQDone;
527110e230b6Smaya   bool                                 VCSDone;
527210e230b6Smaya   bool                                 GACDone;
527310e230b6Smaya};
527410e230b6Smaya
527596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
527696c5ddc4SrjsGFX6_VCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
527710e230b6Smaya                       __attribute__((unused)) void * restrict dst,
527896c5ddc4Srjs                       __attribute__((unused)) const struct GFX6_VCS_INSTDONE * restrict values)
527910e230b6Smaya{
528010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
528110e230b6Smaya
528210e230b6Smaya   dw[0] =
528310e230b6Smaya      __gen_uint(values->RingEnable, 0, 0) |
528410e230b6Smaya      __gen_uint(values->USBDone, 1, 1) |
528510e230b6Smaya      __gen_uint(values->QRCDone, 2, 2) |
528610e230b6Smaya      __gen_uint(values->SECDone, 3, 3) |
528710e230b6Smaya      __gen_uint(values->MPCDone, 4, 4) |
528810e230b6Smaya      __gen_uint(values->VFTDone, 5, 5) |
528910e230b6Smaya      __gen_uint(values->BSPDone, 6, 6) |
529010e230b6Smaya      __gen_uint(values->VLFDone, 7, 7) |
529110e230b6Smaya      __gen_uint(values->VOPDone, 8, 8) |
529210e230b6Smaya      __gen_uint(values->VMCDone, 9, 9) |
529310e230b6Smaya      __gen_uint(values->VIPDone, 10, 10) |
529410e230b6Smaya      __gen_uint(values->VITDone, 11, 11) |
529510e230b6Smaya      __gen_uint(values->VDSDone, 12, 12) |
529610e230b6Smaya      __gen_uint(values->VMXDone, 13, 13) |
529710e230b6Smaya      __gen_uint(values->VCPDone, 14, 14) |
529810e230b6Smaya      __gen_uint(values->VCDDone, 15, 15) |
529910e230b6Smaya      __gen_uint(values->VADDone, 16, 16) |
530010e230b6Smaya      __gen_uint(values->VMDDone, 17, 17) |
530110e230b6Smaya      __gen_uint(values->VISDone, 18, 18) |
530210e230b6Smaya      __gen_uint(values->VACDone, 19, 19) |
530310e230b6Smaya      __gen_uint(values->VAMDone, 20, 20) |
530410e230b6Smaya      __gen_uint(values->JPGDone, 21, 21) |
530510e230b6Smaya      __gen_uint(values->VBPDone, 22, 22) |
530610e230b6Smaya      __gen_uint(values->VHRDone, 23, 23) |
530710e230b6Smaya      __gen_uint(values->VCIDone, 24, 24) |
530810e230b6Smaya      __gen_uint(values->VCRDone, 25, 25) |
530910e230b6Smaya      __gen_uint(values->VINDone, 26, 26) |
531010e230b6Smaya      __gen_uint(values->VPRDone, 27, 27) |
531110e230b6Smaya      __gen_uint(values->VTQDone, 28, 28) |
531210e230b6Smaya      __gen_uint(values->VCSDone, 30, 30) |
531310e230b6Smaya      __gen_uint(values->GACDone, 31, 31);
531410e230b6Smaya}
531510e230b6Smaya
531696c5ddc4Srjs#define GFX6_VCS_RING_BUFFER_CTL_num      0x1203c
531796c5ddc4Srjs#define GFX6_VCS_RING_BUFFER_CTL_length        1
531896c5ddc4Srjsstruct GFX6_VCS_RING_BUFFER_CTL {
531910e230b6Smaya   bool                                 RingBufferEnable;
532010e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
532110e230b6Smaya#define MI_AUTOREPORT_OFF                        0
532210e230b6Smaya#define MI_AUTOREPORT_64KB                       1
532310e230b6Smaya#define MI_AUTOREPORT_4KB                        2
532410e230b6Smaya#define MI_AUTOREPORT_128KB                      3
532510e230b6Smaya   bool                                 DisableRegisterAccesses;
532610e230b6Smaya   bool                                 SemaphoreWait;
532710e230b6Smaya   bool                                 RBWait;
532810e230b6Smaya   uint32_t                             BufferLengthinpages1;
532910e230b6Smaya};
533010e230b6Smaya
533196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
533296c5ddc4SrjsGFX6_VCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
533310e230b6Smaya                              __attribute__((unused)) void * restrict dst,
533496c5ddc4Srjs                              __attribute__((unused)) const struct GFX6_VCS_RING_BUFFER_CTL * restrict values)
533510e230b6Smaya{
533610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
533710e230b6Smaya
533810e230b6Smaya   dw[0] =
533910e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
534010e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
534110e230b6Smaya      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
534210e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
534310e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
534410e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
534510e230b6Smaya}
534610e230b6Smaya
534796c5ddc4Srjs#endif /* GFX6_PACK_H */
5348