110e230b6Smaya/*
210e230b6Smaya * Copyright (C) 2016 Intel Corporation
310e230b6Smaya *
410e230b6Smaya * Permission is hereby granted, free of charge, to any person obtaining a
510e230b6Smaya * copy of this software and associated documentation files (the "Software"),
610e230b6Smaya * to deal in the Software without restriction, including without limitation
710e230b6Smaya * the rights to use, copy, modify, merge, publish, distribute, sublicense,
810e230b6Smaya * and/or sell copies of the Software, and to permit persons to whom the
910e230b6Smaya * Software is furnished to do so, subject to the following conditions:
1010e230b6Smaya *
1110e230b6Smaya * The above copyright notice and this permission notice (including the next
1210e230b6Smaya * paragraph) shall be included in all copies or substantial portions of the
1310e230b6Smaya * Software.
1410e230b6Smaya *
1510e230b6Smaya * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1610e230b6Smaya * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1710e230b6Smaya * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1810e230b6Smaya * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1910e230b6Smaya * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
2010e230b6Smaya * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2110e230b6Smaya * IN THE SOFTWARE.
2210e230b6Smaya */
2310e230b6Smaya
2410e230b6Smaya
2510e230b6Smaya/* Instructions, enums and structures for IVB.
2610e230b6Smaya *
2710e230b6Smaya * This file has been generated, do not hand edit.
2810e230b6Smaya */
2910e230b6Smaya
3096c5ddc4Srjs#ifndef GFX7_PACK_H
3196c5ddc4Srjs#define GFX7_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 GFX7_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 GFX7_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 GFX7_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 GFX7_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 GFX7_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   _3DPRIM_PATCHLIST_1                  =     32,
26810e230b6Smaya   _3DPRIM_PATCHLIST_2                  =     33,
26910e230b6Smaya   _3DPRIM_PATCHLIST_3                  =     34,
27010e230b6Smaya   _3DPRIM_PATCHLIST_4                  =     35,
27110e230b6Smaya   _3DPRIM_PATCHLIST_5                  =     36,
27210e230b6Smaya   _3DPRIM_PATCHLIST_6                  =     37,
27310e230b6Smaya   _3DPRIM_PATCHLIST_7                  =     38,
27410e230b6Smaya   _3DPRIM_PATCHLIST_8                  =     39,
27510e230b6Smaya   _3DPRIM_PATCHLIST_9                  =     40,
27610e230b6Smaya   _3DPRIM_PATCHLIST_10                 =     41,
27710e230b6Smaya   _3DPRIM_PATCHLIST_11                 =     42,
27810e230b6Smaya   _3DPRIM_PATCHLIST_12                 =     43,
27910e230b6Smaya   _3DPRIM_PATCHLIST_13                 =     44,
28010e230b6Smaya   _3DPRIM_PATCHLIST_14                 =     45,
28110e230b6Smaya   _3DPRIM_PATCHLIST_15                 =     46,
28210e230b6Smaya   _3DPRIM_PATCHLIST_16                 =     47,
28310e230b6Smaya   _3DPRIM_PATCHLIST_17                 =     48,
28410e230b6Smaya   _3DPRIM_PATCHLIST_18                 =     49,
28510e230b6Smaya   _3DPRIM_PATCHLIST_19                 =     50,
28610e230b6Smaya   _3DPRIM_PATCHLIST_20                 =     51,
28710e230b6Smaya   _3DPRIM_PATCHLIST_21                 =     52,
28810e230b6Smaya   _3DPRIM_PATCHLIST_22                 =     53,
28910e230b6Smaya   _3DPRIM_PATCHLIST_23                 =     54,
29010e230b6Smaya   _3DPRIM_PATCHLIST_24                 =     55,
29110e230b6Smaya   _3DPRIM_PATCHLIST_25                 =     56,
29210e230b6Smaya   _3DPRIM_PATCHLIST_26                 =     57,
29310e230b6Smaya   _3DPRIM_PATCHLIST_27                 =     58,
29410e230b6Smaya   _3DPRIM_PATCHLIST_28                 =     59,
29510e230b6Smaya   _3DPRIM_PATCHLIST_29                 =     60,
29610e230b6Smaya   _3DPRIM_PATCHLIST_30                 =     61,
29710e230b6Smaya   _3DPRIM_PATCHLIST_31                 =     62,
29810e230b6Smaya   _3DPRIM_PATCHLIST_32                 =     63,
29910e230b6Smaya};
30010e230b6Smaya
30196c5ddc4Srjsenum GFX7_3D_Stencil_Operation {
30210e230b6Smaya   STENCILOP_KEEP                       =      0,
30310e230b6Smaya   STENCILOP_ZERO                       =      1,
30410e230b6Smaya   STENCILOP_REPLACE                    =      2,
30510e230b6Smaya   STENCILOP_INCRSAT                    =      3,
30610e230b6Smaya   STENCILOP_DECRSAT                    =      4,
30710e230b6Smaya   STENCILOP_INCR                       =      5,
30810e230b6Smaya   STENCILOP_DECR                       =      6,
30910e230b6Smaya   STENCILOP_INVERT                     =      7,
31010e230b6Smaya};
31110e230b6Smaya
31296c5ddc4Srjsenum GFX7_3D_Vertex_Component_Control {
31310e230b6Smaya   VFCOMP_NOSTORE                       =      0,
31410e230b6Smaya   VFCOMP_STORE_SRC                     =      1,
31510e230b6Smaya   VFCOMP_STORE_0                       =      2,
31610e230b6Smaya   VFCOMP_STORE_1_FP                    =      3,
31710e230b6Smaya   VFCOMP_STORE_1_INT                   =      4,
31810e230b6Smaya   VFCOMP_STORE_VID                     =      5,
31910e230b6Smaya   VFCOMP_STORE_IID                     =      6,
32010e230b6Smaya   VFCOMP_STORE_PID                     =      7,
32110e230b6Smaya};
32210e230b6Smaya
32396c5ddc4Srjsenum GFX7_TextureCoordinateMode {
32410e230b6Smaya   TCM_WRAP                             =      0,
32510e230b6Smaya   TCM_MIRROR                           =      1,
32610e230b6Smaya   TCM_CLAMP                            =      2,
32710e230b6Smaya   TCM_CUBE                             =      3,
32810e230b6Smaya   TCM_CLAMP_BORDER                     =      4,
32910e230b6Smaya   TCM_MIRROR_ONCE                      =      5,
33010e230b6Smaya};
33110e230b6Smaya
33296c5ddc4Srjs#define GFX7_3DSTATE_CONSTANT_BODY_length      6
33396c5ddc4Srjsstruct GFX7_3DSTATE_CONSTANT_BODY {
33410e230b6Smaya   uint32_t                             ReadLength[4];
33510e230b6Smaya   uint32_t                             MOCS;
33610e230b6Smaya   __gen_address_type                   Buffer[4];
33710e230b6Smaya};
33810e230b6Smaya
33996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
34096c5ddc4SrjsGFX7_3DSTATE_CONSTANT_BODY_pack(__attribute__((unused)) __gen_user_data *data,
34110e230b6Smaya                                __attribute__((unused)) void * restrict dst,
34296c5ddc4Srjs                                __attribute__((unused)) const struct GFX7_3DSTATE_CONSTANT_BODY * restrict values)
34310e230b6Smaya{
34410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
34510e230b6Smaya
34610e230b6Smaya   dw[0] =
34710e230b6Smaya      __gen_uint(values->ReadLength[0], 0, 15) |
34810e230b6Smaya      __gen_uint(values->ReadLength[1], 16, 31);
34910e230b6Smaya
35010e230b6Smaya   dw[1] =
35110e230b6Smaya      __gen_uint(values->ReadLength[2], 0, 15) |
35210e230b6Smaya      __gen_uint(values->ReadLength[3], 16, 31);
35310e230b6Smaya
35410e230b6Smaya   const uint32_t v2 =
35510e230b6Smaya      __gen_uint(values->MOCS, 0, 4);
35696c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->Buffer[0], v2, 5, 31);
35710e230b6Smaya
35896c5ddc4Srjs   dw[3] = __gen_address(data, &dw[3], values->Buffer[1], 0, 5, 31);
35910e230b6Smaya
36096c5ddc4Srjs   dw[4] = __gen_address(data, &dw[4], values->Buffer[2], 0, 5, 31);
36110e230b6Smaya
36296c5ddc4Srjs   dw[5] = __gen_address(data, &dw[5], values->Buffer[3], 0, 5, 31);
36310e230b6Smaya}
36410e230b6Smaya
36596c5ddc4Srjs#define GFX7_BINDING_TABLE_STATE_length        1
36696c5ddc4Srjsstruct GFX7_BINDING_TABLE_STATE {
36710e230b6Smaya   uint64_t                             SurfaceStatePointer;
36810e230b6Smaya};
36910e230b6Smaya
37096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
37196c5ddc4SrjsGFX7_BINDING_TABLE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
37210e230b6Smaya                              __attribute__((unused)) void * restrict dst,
37396c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_BINDING_TABLE_STATE * restrict values)
37410e230b6Smaya{
37510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
37610e230b6Smaya
37710e230b6Smaya   dw[0] =
37810e230b6Smaya      __gen_offset(values->SurfaceStatePointer, 5, 31);
37910e230b6Smaya}
38010e230b6Smaya
38196c5ddc4Srjs#define GFX7_BLEND_STATE_ENTRY_length          2
38296c5ddc4Srjsstruct GFX7_BLEND_STATE_ENTRY {
38396c5ddc4Srjs   enum GFX7_3D_Color_Buffer_Blend_Factor DestinationBlendFactor;
38496c5ddc4Srjs   enum GFX7_3D_Color_Buffer_Blend_Factor SourceBlendFactor;
38596c5ddc4Srjs   enum GFX7_3D_Color_Buffer_Blend_Function ColorBlendFunction;
38696c5ddc4Srjs   enum GFX7_3D_Color_Buffer_Blend_Factor DestinationAlphaBlendFactor;
38796c5ddc4Srjs   enum GFX7_3D_Color_Buffer_Blend_Factor SourceAlphaBlendFactor;
38896c5ddc4Srjs   enum GFX7_3D_Color_Buffer_Blend_Function AlphaBlendFunction;
38910e230b6Smaya   bool                                 IndependentAlphaBlendEnable;
39010e230b6Smaya   bool                                 ColorBufferBlendEnable;
39110e230b6Smaya   bool                                 PostBlendColorClampEnable;
39210e230b6Smaya   bool                                 PreBlendColorClampEnable;
39310e230b6Smaya   uint32_t                             ColorClampRange;
39410e230b6Smaya#define COLORCLAMP_UNORM                         0
39510e230b6Smaya#define COLORCLAMP_SNORM                         1
39610e230b6Smaya#define COLORCLAMP_RTFORMAT                      2
39710e230b6Smaya   uint32_t                             YDitherOffset;
39810e230b6Smaya   uint32_t                             XDitherOffset;
39910e230b6Smaya   bool                                 ColorDitherEnable;
40096c5ddc4Srjs   enum GFX7_3D_Compare_Function        AlphaTestFunction;
40110e230b6Smaya   bool                                 AlphaTestEnable;
40296c5ddc4Srjs   enum GFX7_3D_Logic_Op_Function       LogicOpFunction;
40310e230b6Smaya   bool                                 LogicOpEnable;
40410e230b6Smaya   bool                                 WriteDisableBlue;
40510e230b6Smaya   bool                                 WriteDisableGreen;
40610e230b6Smaya   bool                                 WriteDisableRed;
40710e230b6Smaya   bool                                 WriteDisableAlpha;
40810e230b6Smaya   bool                                 AlphaToCoverageDitherEnable;
40910e230b6Smaya   bool                                 AlphaToOneEnable;
41010e230b6Smaya   bool                                 AlphaToCoverageEnable;
41110e230b6Smaya};
41210e230b6Smaya
41396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
41496c5ddc4SrjsGFX7_BLEND_STATE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
41510e230b6Smaya                            __attribute__((unused)) void * restrict dst,
41696c5ddc4Srjs                            __attribute__((unused)) const struct GFX7_BLEND_STATE_ENTRY * restrict values)
41710e230b6Smaya{
41810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
41910e230b6Smaya
42010e230b6Smaya   dw[0] =
42110e230b6Smaya      __gen_uint(values->DestinationBlendFactor, 0, 4) |
42210e230b6Smaya      __gen_uint(values->SourceBlendFactor, 5, 9) |
42310e230b6Smaya      __gen_uint(values->ColorBlendFunction, 11, 13) |
42410e230b6Smaya      __gen_uint(values->DestinationAlphaBlendFactor, 15, 19) |
42510e230b6Smaya      __gen_uint(values->SourceAlphaBlendFactor, 20, 24) |
42610e230b6Smaya      __gen_uint(values->AlphaBlendFunction, 26, 28) |
42710e230b6Smaya      __gen_uint(values->IndependentAlphaBlendEnable, 30, 30) |
42810e230b6Smaya      __gen_uint(values->ColorBufferBlendEnable, 31, 31);
42910e230b6Smaya
43010e230b6Smaya   dw[1] =
43110e230b6Smaya      __gen_uint(values->PostBlendColorClampEnable, 0, 0) |
43210e230b6Smaya      __gen_uint(values->PreBlendColorClampEnable, 1, 1) |
43310e230b6Smaya      __gen_uint(values->ColorClampRange, 2, 3) |
43410e230b6Smaya      __gen_uint(values->YDitherOffset, 8, 9) |
43510e230b6Smaya      __gen_uint(values->XDitherOffset, 10, 11) |
43610e230b6Smaya      __gen_uint(values->ColorDitherEnable, 12, 12) |
43710e230b6Smaya      __gen_uint(values->AlphaTestFunction, 13, 15) |
43810e230b6Smaya      __gen_uint(values->AlphaTestEnable, 16, 16) |
43910e230b6Smaya      __gen_uint(values->LogicOpFunction, 18, 21) |
44010e230b6Smaya      __gen_uint(values->LogicOpEnable, 22, 22) |
44110e230b6Smaya      __gen_uint(values->WriteDisableBlue, 24, 24) |
44210e230b6Smaya      __gen_uint(values->WriteDisableGreen, 25, 25) |
44310e230b6Smaya      __gen_uint(values->WriteDisableRed, 26, 26) |
44410e230b6Smaya      __gen_uint(values->WriteDisableAlpha, 27, 27) |
44510e230b6Smaya      __gen_uint(values->AlphaToCoverageDitherEnable, 29, 29) |
44610e230b6Smaya      __gen_uint(values->AlphaToOneEnable, 30, 30) |
44710e230b6Smaya      __gen_uint(values->AlphaToCoverageEnable, 31, 31);
44810e230b6Smaya}
44910e230b6Smaya
45096c5ddc4Srjs#define GFX7_BLEND_STATE_length                0
45196c5ddc4Srjsstruct GFX7_BLEND_STATE {
45210e230b6Smaya   /* variable length fields follow */
45310e230b6Smaya};
45410e230b6Smaya
45596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
45696c5ddc4SrjsGFX7_BLEND_STATE_pack(__attribute__((unused)) __gen_user_data *data,
45710e230b6Smaya                      __attribute__((unused)) void * restrict dst,
45896c5ddc4Srjs                      __attribute__((unused)) const struct GFX7_BLEND_STATE * restrict values)
45910e230b6Smaya{
46010e230b6Smaya}
46110e230b6Smaya
46296c5ddc4Srjs#define GFX7_CC_VIEWPORT_length                2
46396c5ddc4Srjsstruct GFX7_CC_VIEWPORT {
46410e230b6Smaya   float                                MinimumDepth;
46510e230b6Smaya   float                                MaximumDepth;
46610e230b6Smaya};
46710e230b6Smaya
46896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
46996c5ddc4SrjsGFX7_CC_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
47010e230b6Smaya                      __attribute__((unused)) void * restrict dst,
47196c5ddc4Srjs                      __attribute__((unused)) const struct GFX7_CC_VIEWPORT * restrict values)
47210e230b6Smaya{
47310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
47410e230b6Smaya
47510e230b6Smaya   dw[0] =
47610e230b6Smaya      __gen_float(values->MinimumDepth);
47710e230b6Smaya
47810e230b6Smaya   dw[1] =
47910e230b6Smaya      __gen_float(values->MaximumDepth);
48010e230b6Smaya}
48110e230b6Smaya
48296c5ddc4Srjs#define GFX7_COLOR_CALC_STATE_length           6
48396c5ddc4Srjsstruct GFX7_COLOR_CALC_STATE {
48410e230b6Smaya   uint32_t                             AlphaTestFormat;
48510e230b6Smaya#define ALPHATEST_UNORM8                         0
48610e230b6Smaya#define ALPHATEST_FLOAT32                        1
48710e230b6Smaya   bool                                 RoundDisableFunctionDisable;
48810e230b6Smaya   uint32_t                             BackfaceStencilReferenceValue;
48910e230b6Smaya   uint32_t                             StencilReferenceValue;
49010e230b6Smaya   uint32_t                             AlphaReferenceValueAsUNORM8;
49110e230b6Smaya   float                                AlphaReferenceValueAsFLOAT32;
49210e230b6Smaya   float                                BlendConstantColorRed;
49310e230b6Smaya   float                                BlendConstantColorGreen;
49410e230b6Smaya   float                                BlendConstantColorBlue;
49510e230b6Smaya   float                                BlendConstantColorAlpha;
49610e230b6Smaya};
49710e230b6Smaya
49896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
49996c5ddc4SrjsGFX7_COLOR_CALC_STATE_pack(__attribute__((unused)) __gen_user_data *data,
50010e230b6Smaya                           __attribute__((unused)) void * restrict dst,
50196c5ddc4Srjs                           __attribute__((unused)) const struct GFX7_COLOR_CALC_STATE * restrict values)
50210e230b6Smaya{
50310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
50410e230b6Smaya
50510e230b6Smaya   dw[0] =
50610e230b6Smaya      __gen_uint(values->AlphaTestFormat, 0, 0) |
50710e230b6Smaya      __gen_uint(values->RoundDisableFunctionDisable, 15, 15) |
50810e230b6Smaya      __gen_uint(values->BackfaceStencilReferenceValue, 16, 23) |
50910e230b6Smaya      __gen_uint(values->StencilReferenceValue, 24, 31);
51010e230b6Smaya
51110e230b6Smaya   dw[1] =
51210e230b6Smaya      __gen_uint(values->AlphaReferenceValueAsUNORM8, 0, 31) |
51310e230b6Smaya      __gen_float(values->AlphaReferenceValueAsFLOAT32);
51410e230b6Smaya
51510e230b6Smaya   dw[2] =
51610e230b6Smaya      __gen_float(values->BlendConstantColorRed);
51710e230b6Smaya
51810e230b6Smaya   dw[3] =
51910e230b6Smaya      __gen_float(values->BlendConstantColorGreen);
52010e230b6Smaya
52110e230b6Smaya   dw[4] =
52210e230b6Smaya      __gen_float(values->BlendConstantColorBlue);
52310e230b6Smaya
52410e230b6Smaya   dw[5] =
52510e230b6Smaya      __gen_float(values->BlendConstantColorAlpha);
52610e230b6Smaya}
52710e230b6Smaya
52896c5ddc4Srjs#define GFX7_DEPTH_STENCIL_STATE_length        3
52996c5ddc4Srjsstruct GFX7_DEPTH_STENCIL_STATE {
53096c5ddc4Srjs   enum GFX7_3D_Stencil_Operation       BackfaceStencilPassDepthPassOp;
53196c5ddc4Srjs   enum GFX7_3D_Stencil_Operation       BackfaceStencilPassDepthFailOp;
53296c5ddc4Srjs   enum GFX7_3D_Stencil_Operation       BackfaceStencilFailOp;
53396c5ddc4Srjs   enum GFX7_3D_Compare_Function        BackfaceStencilTestFunction;
53410e230b6Smaya   bool                                 DoubleSidedStencilEnable;
53510e230b6Smaya   bool                                 StencilBufferWriteEnable;
53696c5ddc4Srjs   enum GFX7_3D_Stencil_Operation       StencilPassDepthPassOp;
53796c5ddc4Srjs   enum GFX7_3D_Stencil_Operation       StencilPassDepthFailOp;
53896c5ddc4Srjs   enum GFX7_3D_Stencil_Operation       StencilFailOp;
53996c5ddc4Srjs   enum GFX7_3D_Compare_Function        StencilTestFunction;
54010e230b6Smaya   bool                                 StencilTestEnable;
54110e230b6Smaya   uint32_t                             BackfaceStencilWriteMask;
54210e230b6Smaya   uint32_t                             BackfaceStencilTestMask;
54310e230b6Smaya   uint32_t                             StencilWriteMask;
54410e230b6Smaya   uint32_t                             StencilTestMask;
54510e230b6Smaya   bool                                 DepthBufferWriteEnable;
54696c5ddc4Srjs   enum GFX7_3D_Compare_Function        DepthTestFunction;
54710e230b6Smaya   bool                                 DepthTestEnable;
54810e230b6Smaya};
54910e230b6Smaya
55096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
55196c5ddc4SrjsGFX7_DEPTH_STENCIL_STATE_pack(__attribute__((unused)) __gen_user_data *data,
55210e230b6Smaya                              __attribute__((unused)) void * restrict dst,
55396c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_DEPTH_STENCIL_STATE * restrict values)
55410e230b6Smaya{
55510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
55610e230b6Smaya
55710e230b6Smaya   dw[0] =
55810e230b6Smaya      __gen_uint(values->BackfaceStencilPassDepthPassOp, 3, 5) |
55910e230b6Smaya      __gen_uint(values->BackfaceStencilPassDepthFailOp, 6, 8) |
56010e230b6Smaya      __gen_uint(values->BackfaceStencilFailOp, 9, 11) |
56110e230b6Smaya      __gen_uint(values->BackfaceStencilTestFunction, 12, 14) |
56210e230b6Smaya      __gen_uint(values->DoubleSidedStencilEnable, 15, 15) |
56310e230b6Smaya      __gen_uint(values->StencilBufferWriteEnable, 18, 18) |
56410e230b6Smaya      __gen_uint(values->StencilPassDepthPassOp, 19, 21) |
56510e230b6Smaya      __gen_uint(values->StencilPassDepthFailOp, 22, 24) |
56610e230b6Smaya      __gen_uint(values->StencilFailOp, 25, 27) |
56710e230b6Smaya      __gen_uint(values->StencilTestFunction, 28, 30) |
56810e230b6Smaya      __gen_uint(values->StencilTestEnable, 31, 31);
56910e230b6Smaya
57010e230b6Smaya   dw[1] =
57110e230b6Smaya      __gen_uint(values->BackfaceStencilWriteMask, 0, 7) |
57210e230b6Smaya      __gen_uint(values->BackfaceStencilTestMask, 8, 15) |
57310e230b6Smaya      __gen_uint(values->StencilWriteMask, 16, 23) |
57410e230b6Smaya      __gen_uint(values->StencilTestMask, 24, 31);
57510e230b6Smaya
57610e230b6Smaya   dw[2] =
57710e230b6Smaya      __gen_uint(values->DepthBufferWriteEnable, 26, 26) |
57810e230b6Smaya      __gen_uint(values->DepthTestFunction, 27, 29) |
57910e230b6Smaya      __gen_uint(values->DepthTestEnable, 31, 31);
58010e230b6Smaya}
58110e230b6Smaya
58296c5ddc4Srjs#define GFX7_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT_length      2
58396c5ddc4Srjsstruct GFX7_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT {
58410e230b6Smaya   bool                                 MBErrorConcealmentPSliceWeightPredictionDisable;
58510e230b6Smaya   bool                                 MBErrorConcealmentPSliceMotionVectorsOverrideDisable;
58610e230b6Smaya   bool                                 MBErrorConcealmentPSliceReferenceIndexOverrideDisable;
58710e230b6Smaya   bool                                 MBErrorConcealmentBSpatialWeightPredictionDisable;
58810e230b6Smaya   bool                                 MBErrorConcealmentBSpatialMotionVectorsOverrideDisable;
58910e230b6Smaya   bool                                 MBErrorConcealmentBSpatialReferenceIndexOverrideDisable;
59010e230b6Smaya   uint32_t                             MBErrorConcealmentBSpatialPredictionMode;
59110e230b6Smaya   bool                                 MBHeaderErrorHandling;
59210e230b6Smaya   bool                                 EntropyErrorHandling;
59310e230b6Smaya   bool                                 MPRErrorHandling;
59410e230b6Smaya   bool                                 BSDPrematureCompleteErrorHandling;
59510e230b6Smaya   uint32_t                             ConcealmentPictureID;
59610e230b6Smaya   bool                                 MBErrorConcealmentBTemporalWeightPredictionDisable;
59710e230b6Smaya   bool                                 MBErrorConcealmentBTemporalMotionVectorsOverrideEnable;
59810e230b6Smaya   bool                                 MBErrorConcealmentBTemporalReferenceIndexOverrideEnable;
59910e230b6Smaya   uint32_t                             MBErrorConcealmentBTemporalPredictionMode;
60010e230b6Smaya   bool                                 InitCurrentMBNumber;
60110e230b6Smaya   uint32_t                             ConcealmentMethod;
60210e230b6Smaya   uint32_t                             FirstMBBitOffset;
60310e230b6Smaya   bool                                 LastSlice;
60410e230b6Smaya   bool                                 EmulationPreventionBytePresent;
60510e230b6Smaya   bool                                 FixPrevMBSkipped;
60610e230b6Smaya   uint32_t                             FirstMBByteOffsetofSliceDataorSliceHeader;
60710e230b6Smaya};
60810e230b6Smaya
60996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
61096c5ddc4SrjsGFX7_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
61110e230b6Smaya                                                         __attribute__((unused)) void * restrict dst,
61296c5ddc4Srjs                                                         __attribute__((unused)) const struct GFX7_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT * restrict values)
61310e230b6Smaya{
61410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
61510e230b6Smaya
61610e230b6Smaya   dw[0] =
61710e230b6Smaya      __gen_uint(values->MBErrorConcealmentPSliceWeightPredictionDisable, 0, 0) |
61810e230b6Smaya      __gen_uint(values->MBErrorConcealmentPSliceMotionVectorsOverrideDisable, 1, 1) |
61910e230b6Smaya      __gen_uint(values->MBErrorConcealmentPSliceReferenceIndexOverrideDisable, 2, 2) |
62010e230b6Smaya      __gen_uint(values->MBErrorConcealmentBSpatialWeightPredictionDisable, 3, 3) |
62110e230b6Smaya      __gen_uint(values->MBErrorConcealmentBSpatialMotionVectorsOverrideDisable, 4, 4) |
62210e230b6Smaya      __gen_uint(values->MBErrorConcealmentBSpatialReferenceIndexOverrideDisable, 5, 5) |
62310e230b6Smaya      __gen_uint(values->MBErrorConcealmentBSpatialPredictionMode, 6, 7) |
62410e230b6Smaya      __gen_uint(values->MBHeaderErrorHandling, 8, 8) |
62510e230b6Smaya      __gen_uint(values->EntropyErrorHandling, 10, 10) |
62610e230b6Smaya      __gen_uint(values->MPRErrorHandling, 12, 12) |
62710e230b6Smaya      __gen_uint(values->BSDPrematureCompleteErrorHandling, 14, 14) |
62810e230b6Smaya      __gen_uint(values->ConcealmentPictureID, 16, 21) |
62910e230b6Smaya      __gen_uint(values->MBErrorConcealmentBTemporalWeightPredictionDisable, 24, 24) |
63010e230b6Smaya      __gen_uint(values->MBErrorConcealmentBTemporalMotionVectorsOverrideEnable, 25, 25) |
63110e230b6Smaya      __gen_uint(values->MBErrorConcealmentBTemporalReferenceIndexOverrideEnable, 26, 26) |
63210e230b6Smaya      __gen_uint(values->MBErrorConcealmentBTemporalPredictionMode, 27, 28) |
63310e230b6Smaya      __gen_uint(values->InitCurrentMBNumber, 30, 30) |
63410e230b6Smaya      __gen_uint(values->ConcealmentMethod, 31, 31);
63510e230b6Smaya
63610e230b6Smaya   dw[1] =
63710e230b6Smaya      __gen_uint(values->FirstMBBitOffset, 0, 2) |
63810e230b6Smaya      __gen_uint(values->LastSlice, 3, 3) |
63910e230b6Smaya      __gen_uint(values->EmulationPreventionBytePresent, 4, 4) |
64010e230b6Smaya      __gen_uint(values->FixPrevMBSkipped, 7, 7) |
64110e230b6Smaya      __gen_uint(values->FirstMBByteOffsetofSliceDataorSliceHeader, 16, 31);
64210e230b6Smaya}
64310e230b6Smaya
64496c5ddc4Srjs#define GFX7_INTERFACE_DESCRIPTOR_DATA_length      8
64596c5ddc4Srjsstruct GFX7_INTERFACE_DESCRIPTOR_DATA {
64610e230b6Smaya   uint64_t                             KernelStartPointer;
64710e230b6Smaya   bool                                 SoftwareExceptionEnable;
64810e230b6Smaya   bool                                 MaskStackExceptionEnable;
64910e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
65010e230b6Smaya   uint32_t                             FloatingPointMode;
65110e230b6Smaya#define IEEE754                                  0
65210e230b6Smaya#define Alternate                                1
65310e230b6Smaya   uint32_t                             ThreadPriority;
65410e230b6Smaya#define NormalPriority                           0
65510e230b6Smaya#define HighPriority                             1
65610e230b6Smaya   bool                                 SingleProgramFlow;
65710e230b6Smaya   uint32_t                             SamplerCount;
65810e230b6Smaya#define Nosamplersused                           0
65910e230b6Smaya#define Between1and4samplersused                 1
66010e230b6Smaya#define Between5and8samplersused                 2
66110e230b6Smaya#define Between9and12samplersused                3
66210e230b6Smaya#define Between13and16samplersused               4
66310e230b6Smaya   uint64_t                             SamplerStatePointer;
66410e230b6Smaya   uint32_t                             BindingTableEntryCount;
66510e230b6Smaya   uint64_t                             BindingTablePointer;
66610e230b6Smaya   uint32_t                             ConstantURBEntryReadOffset;
66710e230b6Smaya   uint32_t                             ConstantURBEntryReadLength;
66810e230b6Smaya   uint32_t                             NumberofThreadsinGPGPUThreadGroup;
66910e230b6Smaya   uint32_t                             SharedLocalMemorySize;
67010e230b6Smaya   bool                                 BarrierEnable;
67110e230b6Smaya   uint32_t                             RoundingMode;
67210e230b6Smaya#define RTNE                                     0
67310e230b6Smaya#define RU                                       1
67410e230b6Smaya#define RD                                       2
67510e230b6Smaya#define RTZ                                      3
67610e230b6Smaya};
67710e230b6Smaya
67896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
67996c5ddc4SrjsGFX7_INTERFACE_DESCRIPTOR_DATA_pack(__attribute__((unused)) __gen_user_data *data,
68010e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
68196c5ddc4Srjs                                    __attribute__((unused)) const struct GFX7_INTERFACE_DESCRIPTOR_DATA * restrict values)
68210e230b6Smaya{
68310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
68410e230b6Smaya
68510e230b6Smaya   dw[0] =
68610e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 31);
68710e230b6Smaya
68810e230b6Smaya   dw[1] =
68910e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
69010e230b6Smaya      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
69110e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
69210e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
69310e230b6Smaya      __gen_uint(values->ThreadPriority, 17, 17) |
69410e230b6Smaya      __gen_uint(values->SingleProgramFlow, 18, 18);
69510e230b6Smaya
69610e230b6Smaya   dw[2] =
69710e230b6Smaya      __gen_uint(values->SamplerCount, 2, 4) |
69810e230b6Smaya      __gen_offset(values->SamplerStatePointer, 5, 31);
69910e230b6Smaya
70010e230b6Smaya   dw[3] =
70110e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 0, 4) |
70210e230b6Smaya      __gen_offset(values->BindingTablePointer, 5, 15);
70310e230b6Smaya
70410e230b6Smaya   dw[4] =
70510e230b6Smaya      __gen_uint(values->ConstantURBEntryReadOffset, 0, 15) |
70610e230b6Smaya      __gen_uint(values->ConstantURBEntryReadLength, 16, 31);
70710e230b6Smaya
70810e230b6Smaya   dw[5] =
70910e230b6Smaya      __gen_uint(values->NumberofThreadsinGPGPUThreadGroup, 0, 7) |
71010e230b6Smaya      __gen_uint(values->SharedLocalMemorySize, 16, 20) |
71110e230b6Smaya      __gen_uint(values->BarrierEnable, 21, 21) |
71210e230b6Smaya      __gen_uint(values->RoundingMode, 22, 23);
71310e230b6Smaya
71410e230b6Smaya   dw[6] = 0;
71510e230b6Smaya
71610e230b6Smaya   dw[7] = 0;
71710e230b6Smaya}
71810e230b6Smaya
71996c5ddc4Srjs#define GFX7_MEMORY_OBJECT_CONTROL_STATE_length      1
72096c5ddc4Srjsstruct GFX7_MEMORY_OBJECT_CONTROL_STATE {
72110e230b6Smaya   uint32_t                             L3CacheabilityControlL3CC;
72210e230b6Smaya   uint32_t                             LLCCacheabilityControlLLCCC;
72310e230b6Smaya   uint32_t                             GraphicsDataTypeGFDT;
72410e230b6Smaya};
72510e230b6Smaya
72696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
72796c5ddc4SrjsGFX7_MEMORY_OBJECT_CONTROL_STATE_pack(__attribute__((unused)) __gen_user_data *data,
72810e230b6Smaya                                      __attribute__((unused)) void * restrict dst,
72996c5ddc4Srjs                                      __attribute__((unused)) const struct GFX7_MEMORY_OBJECT_CONTROL_STATE * restrict values)
73010e230b6Smaya{
73110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
73210e230b6Smaya
73310e230b6Smaya   dw[0] =
73410e230b6Smaya      __gen_uint(values->L3CacheabilityControlL3CC, 0, 0) |
73510e230b6Smaya      __gen_uint(values->LLCCacheabilityControlLLCCC, 1, 1) |
73610e230b6Smaya      __gen_uint(values->GraphicsDataTypeGFDT, 2, 2);
73710e230b6Smaya}
73810e230b6Smaya
73996c5ddc4Srjs#define GFX7_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION_length      2
74096c5ddc4Srjsstruct GFX7_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION {
74110e230b6Smaya   uint32_t                             FirstMBBitOffset;
74210e230b6Smaya   bool                                 LastMB;
74310e230b6Smaya   bool                                 LastPicSlice;
74410e230b6Smaya   uint32_t                             MBCount;
74510e230b6Smaya   uint32_t                             SliceVerticalPosition;
74610e230b6Smaya   uint32_t                             SliceHorizontalPosition;
74710e230b6Smaya   uint32_t                             QuantizerScaleCode;
74810e230b6Smaya};
74910e230b6Smaya
75096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
75196c5ddc4SrjsGFX7_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION_pack(__attribute__((unused)) __gen_user_data *data,
75210e230b6Smaya                                                       __attribute__((unused)) void * restrict dst,
75396c5ddc4Srjs                                                       __attribute__((unused)) const struct GFX7_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION * restrict values)
75410e230b6Smaya{
75510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
75610e230b6Smaya
75710e230b6Smaya   dw[0] =
75810e230b6Smaya      __gen_uint(values->FirstMBBitOffset, 0, 2) |
75910e230b6Smaya      __gen_uint(values->LastMB, 3, 3) |
76010e230b6Smaya      __gen_uint(values->LastPicSlice, 5, 5) |
76110e230b6Smaya      __gen_uint(values->MBCount, 8, 14) |
76210e230b6Smaya      __gen_uint(values->SliceVerticalPosition, 16, 22) |
76310e230b6Smaya      __gen_uint(values->SliceHorizontalPosition, 24, 30);
76410e230b6Smaya
76510e230b6Smaya   dw[1] =
76610e230b6Smaya      __gen_uint(values->QuantizerScaleCode, 24, 28);
76710e230b6Smaya}
76810e230b6Smaya
76996c5ddc4Srjs#define GFX7_PALETTE_ENTRY_length              1
77096c5ddc4Srjsstruct GFX7_PALETTE_ENTRY {
77110e230b6Smaya   uint32_t                             Blue;
77210e230b6Smaya   uint32_t                             Green;
77310e230b6Smaya   uint32_t                             Red;
77410e230b6Smaya   uint32_t                             Alpha;
77510e230b6Smaya};
77610e230b6Smaya
77796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
77896c5ddc4SrjsGFX7_PALETTE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
77910e230b6Smaya                        __attribute__((unused)) void * restrict dst,
78096c5ddc4Srjs                        __attribute__((unused)) const struct GFX7_PALETTE_ENTRY * restrict values)
78110e230b6Smaya{
78210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
78310e230b6Smaya
78410e230b6Smaya   dw[0] =
78510e230b6Smaya      __gen_uint(values->Blue, 0, 7) |
78610e230b6Smaya      __gen_uint(values->Green, 8, 15) |
78710e230b6Smaya      __gen_uint(values->Red, 16, 23) |
78810e230b6Smaya      __gen_uint(values->Alpha, 24, 31);
78910e230b6Smaya}
79010e230b6Smaya
79196c5ddc4Srjs#define GFX7_RENDER_SURFACE_STATE_length       8
79296c5ddc4Srjsstruct GFX7_RENDER_SURFACE_STATE {
79310e230b6Smaya   bool                                 CubeFaceEnablePositiveZ;
79410e230b6Smaya   bool                                 CubeFaceEnableNegativeZ;
79510e230b6Smaya   bool                                 CubeFaceEnablePositiveY;
79610e230b6Smaya   bool                                 CubeFaceEnableNegativeY;
79710e230b6Smaya   bool                                 CubeFaceEnablePositiveX;
79810e230b6Smaya   bool                                 CubeFaceEnableNegativeX;
79910e230b6Smaya   uint32_t                             MediaBoundaryPixelMode;
80010e230b6Smaya#define NORMAL_MODE                              0
80110e230b6Smaya#define PROGRESSIVE_FRAME                        2
80210e230b6Smaya#define INTERLACED_FRAME                         3
80310e230b6Smaya   uint32_t                             RenderCacheReadWriteMode;
80410e230b6Smaya   uint32_t                             SurfaceArraySpacing;
80510e230b6Smaya#define ARYSPC_FULL                              0
80610e230b6Smaya#define ARYSPC_LOD0                              1
80710e230b6Smaya   uint32_t                             VerticalLineStrideOffset;
80810e230b6Smaya   uint32_t                             VerticalLineStride;
80910e230b6Smaya   uint32_t                             TileWalk;
81010e230b6Smaya#define TILEWALK_XMAJOR                          0
81110e230b6Smaya#define TILEWALK_YMAJOR                          1
81210e230b6Smaya   bool                                 TiledSurface;
81310e230b6Smaya   uint32_t                             SurfaceHorizontalAlignment;
81410e230b6Smaya#define HALIGN_4                                 0
81510e230b6Smaya#define HALIGN_8                                 1
81610e230b6Smaya   uint32_t                             SurfaceVerticalAlignment;
81710e230b6Smaya#define VALIGN_2                                 0
81810e230b6Smaya#define VALIGN_4                                 1
81910e230b6Smaya   uint32_t                             SurfaceFormat;
82010e230b6Smaya   bool                                 SurfaceArray;
82110e230b6Smaya   uint32_t                             SurfaceType;
82210e230b6Smaya#define SURFTYPE_1D                              0
82310e230b6Smaya#define SURFTYPE_2D                              1
82410e230b6Smaya#define SURFTYPE_3D                              2
82510e230b6Smaya#define SURFTYPE_CUBE                            3
82610e230b6Smaya#define SURFTYPE_BUFFER                          4
82710e230b6Smaya#define SURFTYPE_STRBUF                          5
82810e230b6Smaya#define SURFTYPE_NULL                            7
82910e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
83010e230b6Smaya   uint32_t                             Width;
83110e230b6Smaya   uint32_t                             Height;
83210e230b6Smaya   uint32_t                             SurfacePitch;
83310e230b6Smaya   uint32_t                             Depth;
83410e230b6Smaya   uint32_t                             MultisamplePositionPaletteIndex;
83510e230b6Smaya   uint32_t                             StrbufMinimumArrayElement;
83610e230b6Smaya   uint32_t                             NumberofMultisamples;
83710e230b6Smaya#define MULTISAMPLECOUNT_1                       0
83810e230b6Smaya#define MULTISAMPLECOUNT_4                       2
83910e230b6Smaya#define MULTISAMPLECOUNT_8                       3
84010e230b6Smaya   uint32_t                             MultisampledSurfaceStorageFormat;
84110e230b6Smaya#define MSFMT_MSS                                0
84210e230b6Smaya#define MSFMT_DEPTH_STENCIL                      1
84310e230b6Smaya   uint32_t                             RenderTargetViewExtent;
84410e230b6Smaya   uint32_t                             MinimumArrayElement;
84510e230b6Smaya   uint32_t                             RenderTargetRotation;
84610e230b6Smaya#define RTROTATE_0DEG                            0
84710e230b6Smaya#define RTROTATE_90DEG                           1
84810e230b6Smaya#define RTROTATE_270DEG                          3
84910e230b6Smaya   uint32_t                             MIPCountLOD;
85010e230b6Smaya   uint32_t                             SurfaceMinLOD;
85110e230b6Smaya   uint32_t                             MOCS;
85210e230b6Smaya   uint32_t                             YOffset;
85310e230b6Smaya   uint32_t                             XOffset;
85410e230b6Smaya   bool                                 MCSEnable;
85510e230b6Smaya   uint32_t                             YOffsetforUVPlane;
85610e230b6Smaya   bool                                 AppendCounterEnable;
85710e230b6Smaya   uint32_t                             AuxiliarySurfacePitch;
85810e230b6Smaya   __gen_address_type                   AppendCounterAddress;
85910e230b6Smaya   __gen_address_type                   AuxiliarySurfaceBaseAddress;
86010e230b6Smaya   uint32_t                             XOffsetforUVPlane;
86110e230b6Smaya   uint32_t                             ReservedMBZ;
86210e230b6Smaya   float                                ResourceMinLOD;
86310e230b6Smaya   uint32_t                             AlphaClearColor;
86410e230b6Smaya#define CC_ZERO                                  0
86510e230b6Smaya#define CC_ONE                                   1
86610e230b6Smaya   uint32_t                             BlueClearColor;
86710e230b6Smaya#define CC_ZERO                                  0
86810e230b6Smaya#define CC_ONE                                   1
86910e230b6Smaya   uint32_t                             GreenClearColor;
87010e230b6Smaya#define CC_ZERO                                  0
87110e230b6Smaya#define CC_ONE                                   1
87210e230b6Smaya   uint32_t                             RedClearColor;
87310e230b6Smaya#define CC_ZERO                                  0
87410e230b6Smaya#define CC_ONE                                   1
87510e230b6Smaya};
87610e230b6Smaya
87796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
87896c5ddc4SrjsGFX7_RENDER_SURFACE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
87910e230b6Smaya                               __attribute__((unused)) void * restrict dst,
88096c5ddc4Srjs                               __attribute__((unused)) const struct GFX7_RENDER_SURFACE_STATE * restrict values)
88110e230b6Smaya{
88210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
88310e230b6Smaya
88410e230b6Smaya   dw[0] =
88510e230b6Smaya      __gen_uint(values->CubeFaceEnablePositiveZ, 0, 0) |
88610e230b6Smaya      __gen_uint(values->CubeFaceEnableNegativeZ, 1, 1) |
88710e230b6Smaya      __gen_uint(values->CubeFaceEnablePositiveY, 2, 2) |
88810e230b6Smaya      __gen_uint(values->CubeFaceEnableNegativeY, 3, 3) |
88910e230b6Smaya      __gen_uint(values->CubeFaceEnablePositiveX, 4, 4) |
89010e230b6Smaya      __gen_uint(values->CubeFaceEnableNegativeX, 5, 5) |
89110e230b6Smaya      __gen_uint(values->MediaBoundaryPixelMode, 6, 7) |
89210e230b6Smaya      __gen_uint(values->RenderCacheReadWriteMode, 8, 8) |
89310e230b6Smaya      __gen_uint(values->SurfaceArraySpacing, 10, 10) |
89410e230b6Smaya      __gen_uint(values->VerticalLineStrideOffset, 11, 11) |
89510e230b6Smaya      __gen_uint(values->VerticalLineStride, 12, 12) |
89610e230b6Smaya      __gen_uint(values->TileWalk, 13, 13) |
89710e230b6Smaya      __gen_uint(values->TiledSurface, 14, 14) |
89810e230b6Smaya      __gen_uint(values->SurfaceHorizontalAlignment, 15, 15) |
89910e230b6Smaya      __gen_uint(values->SurfaceVerticalAlignment, 16, 17) |
90010e230b6Smaya      __gen_uint(values->SurfaceFormat, 18, 26) |
90110e230b6Smaya      __gen_uint(values->SurfaceArray, 28, 28) |
90210e230b6Smaya      __gen_uint(values->SurfaceType, 29, 31);
90310e230b6Smaya
90496c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->SurfaceBaseAddress, 0, 0, 31);
90510e230b6Smaya
90610e230b6Smaya   dw[2] =
90710e230b6Smaya      __gen_uint(values->Width, 0, 13) |
90810e230b6Smaya      __gen_uint(values->Height, 16, 29);
90910e230b6Smaya
91010e230b6Smaya   dw[3] =
91110e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 17) |
91210e230b6Smaya      __gen_uint(values->Depth, 21, 31);
91310e230b6Smaya
91410e230b6Smaya   dw[4] =
91510e230b6Smaya      __gen_uint(values->MultisamplePositionPaletteIndex, 0, 2) |
91610e230b6Smaya      __gen_uint(values->StrbufMinimumArrayElement, 0, 26) |
91710e230b6Smaya      __gen_uint(values->NumberofMultisamples, 3, 5) |
91810e230b6Smaya      __gen_uint(values->MultisampledSurfaceStorageFormat, 6, 6) |
91910e230b6Smaya      __gen_uint(values->RenderTargetViewExtent, 7, 17) |
92010e230b6Smaya      __gen_uint(values->MinimumArrayElement, 18, 28) |
92110e230b6Smaya      __gen_uint(values->RenderTargetRotation, 29, 30);
92210e230b6Smaya
92310e230b6Smaya   dw[5] =
92410e230b6Smaya      __gen_uint(values->MIPCountLOD, 0, 3) |
92510e230b6Smaya      __gen_uint(values->SurfaceMinLOD, 4, 7) |
92610e230b6Smaya      __gen_uint(values->MOCS, 16, 19) |
92710e230b6Smaya      __gen_uint(values->YOffset, 20, 23) |
92810e230b6Smaya      __gen_uint(values->XOffset, 25, 31);
92910e230b6Smaya
93010e230b6Smaya   const uint32_t v6 =
93110e230b6Smaya      __gen_uint(values->MCSEnable, 0, 0) |
93210e230b6Smaya      __gen_uint(values->YOffsetforUVPlane, 0, 13) |
93310e230b6Smaya      __gen_uint(values->AppendCounterEnable, 1, 1) |
93410e230b6Smaya      __gen_uint(values->AuxiliarySurfacePitch, 3, 11) |
93510e230b6Smaya      __gen_uint(values->XOffsetforUVPlane, 16, 29) |
93610e230b6Smaya      __gen_uint(values->ReservedMBZ, 30, 31);
93796c5ddc4Srjs   dw[6] = __gen_address(data, &dw[6], values->AuxiliarySurfaceBaseAddress, v6, 12, 31);
93810e230b6Smaya
93910e230b6Smaya   dw[7] =
94010e230b6Smaya      __gen_ufixed(values->ResourceMinLOD, 0, 11, 8) |
94110e230b6Smaya      __gen_uint(values->AlphaClearColor, 28, 28) |
94210e230b6Smaya      __gen_uint(values->BlueClearColor, 29, 29) |
94310e230b6Smaya      __gen_uint(values->GreenClearColor, 30, 30) |
94410e230b6Smaya      __gen_uint(values->RedClearColor, 31, 31);
94510e230b6Smaya}
94610e230b6Smaya
94796c5ddc4Srjs#define GFX7_SAMPLER_BORDER_COLOR_STATE_length      4
94896c5ddc4Srjsstruct GFX7_SAMPLER_BORDER_COLOR_STATE {
94910e230b6Smaya   uint32_t                             BorderColorUnormRed;
95010e230b6Smaya   float                                BorderColorFloatRed;
95110e230b6Smaya   uint32_t                             BorderColorUnormGreen;
95210e230b6Smaya   uint32_t                             BorderColorUnormBlue;
95310e230b6Smaya   uint32_t                             BorderColorUnormAlpha;
95410e230b6Smaya   float                                BorderColorFloatGreen;
95510e230b6Smaya   float                                BorderColorFloatBlue;
95610e230b6Smaya   float                                BorderColorFloatAlpha;
95710e230b6Smaya};
95810e230b6Smaya
95996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
96096c5ddc4SrjsGFX7_SAMPLER_BORDER_COLOR_STATE_pack(__attribute__((unused)) __gen_user_data *data,
96110e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
96296c5ddc4Srjs                                     __attribute__((unused)) const struct GFX7_SAMPLER_BORDER_COLOR_STATE * restrict values)
96310e230b6Smaya{
96410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
96510e230b6Smaya
96610e230b6Smaya   dw[0] =
96710e230b6Smaya      __gen_uint(values->BorderColorUnormRed, 0, 7) |
96810e230b6Smaya      __gen_float(values->BorderColorFloatRed) |
96910e230b6Smaya      __gen_uint(values->BorderColorUnormGreen, 8, 15) |
97010e230b6Smaya      __gen_uint(values->BorderColorUnormBlue, 16, 23) |
97110e230b6Smaya      __gen_uint(values->BorderColorUnormAlpha, 24, 31);
97210e230b6Smaya
97310e230b6Smaya   dw[1] =
97410e230b6Smaya      __gen_float(values->BorderColorFloatGreen);
97510e230b6Smaya
97610e230b6Smaya   dw[2] =
97710e230b6Smaya      __gen_float(values->BorderColorFloatBlue);
97810e230b6Smaya
97910e230b6Smaya   dw[3] =
98010e230b6Smaya      __gen_float(values->BorderColorFloatAlpha);
98110e230b6Smaya}
98210e230b6Smaya
98396c5ddc4Srjs#define GFX7_SAMPLER_STATE_length              4
98496c5ddc4Srjsstruct GFX7_SAMPLER_STATE {
98510e230b6Smaya   uint32_t                             AnisotropicAlgorithm;
98610e230b6Smaya#define LEGACY                                   0
98710e230b6Smaya#define EWAApproximation                         1
98810e230b6Smaya   float                                TextureLODBias;
98910e230b6Smaya   uint32_t                             MinModeFilter;
99010e230b6Smaya#define MAPFILTER_NEAREST                        0
99110e230b6Smaya#define MAPFILTER_LINEAR                         1
99210e230b6Smaya#define MAPFILTER_ANISOTROPIC                    2
99310e230b6Smaya#define MAPFILTER_MONO                           6
99410e230b6Smaya   uint32_t                             MagModeFilter;
99510e230b6Smaya#define MAPFILTER_NEAREST                        0
99610e230b6Smaya#define MAPFILTER_LINEAR                         1
99710e230b6Smaya#define MAPFILTER_ANISOTROPIC                    2
99810e230b6Smaya#define MAPFILTER_MONO                           6
99910e230b6Smaya   uint32_t                             MipModeFilter;
100010e230b6Smaya#define MIPFILTER_NONE                           0
100110e230b6Smaya#define MIPFILTER_NEAREST                        1
100210e230b6Smaya#define MIPFILTER_LINEAR                         3
100310e230b6Smaya   float                                BaseMipLevel;
100410e230b6Smaya   uint32_t                             LODPreClampEnable;
100510e230b6Smaya#define CLAMP_ENABLE_OGL                         1
100610e230b6Smaya   uint32_t                             TextureBorderColorMode;
100710e230b6Smaya#define DX10OGL                                  0
100810e230b6Smaya#define DX9                                      1
100910e230b6Smaya   bool                                 SamplerDisable;
101010e230b6Smaya   uint32_t                             CubeSurfaceControlMode;
101110e230b6Smaya#define PROGRAMMED                               0
101210e230b6Smaya#define OVERRIDE                                 1
101310e230b6Smaya   uint32_t                             ShadowFunction;
101496c5ddc4Srjs#define PREFILTEROP_ALWAYS                       0
101596c5ddc4Srjs#define PREFILTEROP_NEVER                        1
101696c5ddc4Srjs#define PREFILTEROP_LESS                         2
101796c5ddc4Srjs#define PREFILTEROP_EQUAL                        3
101896c5ddc4Srjs#define PREFILTEROP_LEQUAL                       4
101996c5ddc4Srjs#define PREFILTEROP_GREATER                      5
102096c5ddc4Srjs#define PREFILTEROP_NOTEQUAL                     6
102196c5ddc4Srjs#define PREFILTEROP_GEQUAL                       7
102210e230b6Smaya   float                                MaxLOD;
102310e230b6Smaya   float                                MinLOD;
102410e230b6Smaya   uint64_t                             BorderColorPointer;
102596c5ddc4Srjs   enum GFX7_TextureCoordinateMode      TCZAddressControlMode;
102696c5ddc4Srjs   enum GFX7_TextureCoordinateMode      TCYAddressControlMode;
102796c5ddc4Srjs   enum GFX7_TextureCoordinateMode      TCXAddressControlMode;
102810e230b6Smaya   bool                                 NonnormalizedCoordinateEnable;
102910e230b6Smaya   uint32_t                             TrilinearFilterQuality;
103010e230b6Smaya#define FULL                                     0
103110e230b6Smaya#define MED                                      2
103210e230b6Smaya#define LOW                                      3
103310e230b6Smaya   bool                                 RAddressMinFilterRoundingEnable;
103410e230b6Smaya   bool                                 RAddressMagFilterRoundingEnable;
103510e230b6Smaya   bool                                 VAddressMinFilterRoundingEnable;
103610e230b6Smaya   bool                                 VAddressMagFilterRoundingEnable;
103710e230b6Smaya   bool                                 UAddressMinFilterRoundingEnable;
103810e230b6Smaya   bool                                 UAddressMagFilterRoundingEnable;
103910e230b6Smaya   uint32_t                             MaximumAnisotropy;
104010e230b6Smaya#define RATIO21                                  0
104110e230b6Smaya#define RATIO41                                  1
104210e230b6Smaya#define RATIO61                                  2
104310e230b6Smaya#define RATIO81                                  3
104410e230b6Smaya#define RATIO101                                 4
104510e230b6Smaya#define RATIO121                                 5
104610e230b6Smaya#define RATIO141                                 6
104710e230b6Smaya#define RATIO161                                 7
104810e230b6Smaya   uint32_t                             ChromaKeyMode;
104910e230b6Smaya#define KEYFILTER_KILL_ON_ANY_MATCH              0
105010e230b6Smaya#define KEYFILTER_REPLACE_BLACK                  1
105110e230b6Smaya   uint32_t                             ChromaKeyIndex;
105210e230b6Smaya   bool                                 ChromaKeyEnable;
105310e230b6Smaya};
105410e230b6Smaya
105596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
105696c5ddc4SrjsGFX7_SAMPLER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
105710e230b6Smaya                        __attribute__((unused)) void * restrict dst,
105896c5ddc4Srjs                        __attribute__((unused)) const struct GFX7_SAMPLER_STATE * restrict values)
105910e230b6Smaya{
106010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
106110e230b6Smaya
106210e230b6Smaya   dw[0] =
106310e230b6Smaya      __gen_uint(values->AnisotropicAlgorithm, 0, 0) |
106410e230b6Smaya      __gen_sfixed(values->TextureLODBias, 1, 13, 8) |
106510e230b6Smaya      __gen_uint(values->MinModeFilter, 14, 16) |
106610e230b6Smaya      __gen_uint(values->MagModeFilter, 17, 19) |
106710e230b6Smaya      __gen_uint(values->MipModeFilter, 20, 21) |
106810e230b6Smaya      __gen_ufixed(values->BaseMipLevel, 22, 26, 1) |
106910e230b6Smaya      __gen_uint(values->LODPreClampEnable, 28, 28) |
107010e230b6Smaya      __gen_uint(values->TextureBorderColorMode, 29, 29) |
107110e230b6Smaya      __gen_uint(values->SamplerDisable, 31, 31);
107210e230b6Smaya
107310e230b6Smaya   dw[1] =
107410e230b6Smaya      __gen_uint(values->CubeSurfaceControlMode, 0, 0) |
107510e230b6Smaya      __gen_uint(values->ShadowFunction, 1, 3) |
107610e230b6Smaya      __gen_ufixed(values->MaxLOD, 8, 19, 8) |
107710e230b6Smaya      __gen_ufixed(values->MinLOD, 20, 31, 8);
107810e230b6Smaya
107910e230b6Smaya   dw[2] =
108010e230b6Smaya      __gen_offset(values->BorderColorPointer, 5, 31);
108110e230b6Smaya
108210e230b6Smaya   dw[3] =
108310e230b6Smaya      __gen_uint(values->TCZAddressControlMode, 0, 2) |
108410e230b6Smaya      __gen_uint(values->TCYAddressControlMode, 3, 5) |
108510e230b6Smaya      __gen_uint(values->TCXAddressControlMode, 6, 8) |
108610e230b6Smaya      __gen_uint(values->NonnormalizedCoordinateEnable, 10, 10) |
108710e230b6Smaya      __gen_uint(values->TrilinearFilterQuality, 11, 12) |
108810e230b6Smaya      __gen_uint(values->RAddressMinFilterRoundingEnable, 13, 13) |
108910e230b6Smaya      __gen_uint(values->RAddressMagFilterRoundingEnable, 14, 14) |
109010e230b6Smaya      __gen_uint(values->VAddressMinFilterRoundingEnable, 15, 15) |
109110e230b6Smaya      __gen_uint(values->VAddressMagFilterRoundingEnable, 16, 16) |
109210e230b6Smaya      __gen_uint(values->UAddressMinFilterRoundingEnable, 17, 17) |
109310e230b6Smaya      __gen_uint(values->UAddressMagFilterRoundingEnable, 18, 18) |
109410e230b6Smaya      __gen_uint(values->MaximumAnisotropy, 19, 21) |
109510e230b6Smaya      __gen_uint(values->ChromaKeyMode, 22, 22) |
109610e230b6Smaya      __gen_uint(values->ChromaKeyIndex, 23, 24) |
109710e230b6Smaya      __gen_uint(values->ChromaKeyEnable, 25, 25);
109810e230b6Smaya}
109910e230b6Smaya
110096c5ddc4Srjs#define GFX7_SCISSOR_RECT_length               2
110196c5ddc4Srjsstruct GFX7_SCISSOR_RECT {
110210e230b6Smaya   uint32_t                             ScissorRectangleXMin;
110310e230b6Smaya   uint32_t                             ScissorRectangleYMin;
110410e230b6Smaya   uint32_t                             ScissorRectangleXMax;
110510e230b6Smaya   uint32_t                             ScissorRectangleYMax;
110610e230b6Smaya};
110710e230b6Smaya
110896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
110996c5ddc4SrjsGFX7_SCISSOR_RECT_pack(__attribute__((unused)) __gen_user_data *data,
111010e230b6Smaya                       __attribute__((unused)) void * restrict dst,
111196c5ddc4Srjs                       __attribute__((unused)) const struct GFX7_SCISSOR_RECT * restrict values)
111210e230b6Smaya{
111310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
111410e230b6Smaya
111510e230b6Smaya   dw[0] =
111610e230b6Smaya      __gen_uint(values->ScissorRectangleXMin, 0, 15) |
111710e230b6Smaya      __gen_uint(values->ScissorRectangleYMin, 16, 31);
111810e230b6Smaya
111910e230b6Smaya   dw[1] =
112010e230b6Smaya      __gen_uint(values->ScissorRectangleXMax, 0, 15) |
112110e230b6Smaya      __gen_uint(values->ScissorRectangleYMax, 16, 31);
112210e230b6Smaya}
112310e230b6Smaya
112496c5ddc4Srjs#define GFX7_SF_CLIP_VIEWPORT_length          16
112596c5ddc4Srjsstruct GFX7_SF_CLIP_VIEWPORT {
112610e230b6Smaya   float                                ViewportMatrixElementm00;
112710e230b6Smaya   float                                ViewportMatrixElementm11;
112810e230b6Smaya   float                                ViewportMatrixElementm22;
112910e230b6Smaya   float                                ViewportMatrixElementm30;
113010e230b6Smaya   float                                ViewportMatrixElementm31;
113110e230b6Smaya   float                                ViewportMatrixElementm32;
113210e230b6Smaya   float                                XMinClipGuardband;
113310e230b6Smaya   float                                XMaxClipGuardband;
113410e230b6Smaya   float                                YMinClipGuardband;
113510e230b6Smaya   float                                YMaxClipGuardband;
113610e230b6Smaya};
113710e230b6Smaya
113896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
113996c5ddc4SrjsGFX7_SF_CLIP_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
114010e230b6Smaya                           __attribute__((unused)) void * restrict dst,
114196c5ddc4Srjs                           __attribute__((unused)) const struct GFX7_SF_CLIP_VIEWPORT * restrict values)
114210e230b6Smaya{
114310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
114410e230b6Smaya
114510e230b6Smaya   dw[0] =
114610e230b6Smaya      __gen_float(values->ViewportMatrixElementm00);
114710e230b6Smaya
114810e230b6Smaya   dw[1] =
114910e230b6Smaya      __gen_float(values->ViewportMatrixElementm11);
115010e230b6Smaya
115110e230b6Smaya   dw[2] =
115210e230b6Smaya      __gen_float(values->ViewportMatrixElementm22);
115310e230b6Smaya
115410e230b6Smaya   dw[3] =
115510e230b6Smaya      __gen_float(values->ViewportMatrixElementm30);
115610e230b6Smaya
115710e230b6Smaya   dw[4] =
115810e230b6Smaya      __gen_float(values->ViewportMatrixElementm31);
115910e230b6Smaya
116010e230b6Smaya   dw[5] =
116110e230b6Smaya      __gen_float(values->ViewportMatrixElementm32);
116210e230b6Smaya
116310e230b6Smaya   dw[6] = 0;
116410e230b6Smaya
116510e230b6Smaya   dw[7] = 0;
116610e230b6Smaya
116710e230b6Smaya   dw[8] =
116810e230b6Smaya      __gen_float(values->XMinClipGuardband);
116910e230b6Smaya
117010e230b6Smaya   dw[9] =
117110e230b6Smaya      __gen_float(values->XMaxClipGuardband);
117210e230b6Smaya
117310e230b6Smaya   dw[10] =
117410e230b6Smaya      __gen_float(values->YMinClipGuardband);
117510e230b6Smaya
117610e230b6Smaya   dw[11] =
117710e230b6Smaya      __gen_float(values->YMaxClipGuardband);
117810e230b6Smaya
117910e230b6Smaya   dw[12] = 0;
118010e230b6Smaya
118110e230b6Smaya   dw[13] = 0;
118210e230b6Smaya
118310e230b6Smaya   dw[14] = 0;
118410e230b6Smaya
118510e230b6Smaya   dw[15] = 0;
118610e230b6Smaya}
118710e230b6Smaya
118896c5ddc4Srjs#define GFX7_SF_OUTPUT_ATTRIBUTE_DETAIL_length      1
118996c5ddc4Srjsstruct GFX7_SF_OUTPUT_ATTRIBUTE_DETAIL {
119010e230b6Smaya   uint32_t                             SourceAttribute;
119110e230b6Smaya   uint32_t                             SwizzleSelect;
119210e230b6Smaya#define INPUTATTR                                0
119310e230b6Smaya#define INPUTATTR_FACING                         1
119410e230b6Smaya#define INPUTATTR_W                              2
119510e230b6Smaya#define INPUTATTR_FACING_W                       3
119610e230b6Smaya   uint32_t                             ConstantSource;
119710e230b6Smaya#define CONST_0000                               0
119810e230b6Smaya#define CONST_0001_FLOAT                         1
119910e230b6Smaya#define CONST_1111_FLOAT                         2
120010e230b6Smaya#define PRIM_ID                                  3
120110e230b6Smaya   uint32_t                             SwizzleControlMode;
120210e230b6Smaya   bool                                 ComponentOverrideX;
120310e230b6Smaya   bool                                 ComponentOverrideY;
120410e230b6Smaya   bool                                 ComponentOverrideZ;
120510e230b6Smaya   bool                                 ComponentOverrideW;
120610e230b6Smaya};
120710e230b6Smaya
120896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
120996c5ddc4SrjsGFX7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(__attribute__((unused)) __gen_user_data *data,
121010e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
121196c5ddc4Srjs                                     __attribute__((unused)) const struct GFX7_SF_OUTPUT_ATTRIBUTE_DETAIL * restrict values)
121210e230b6Smaya{
121310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
121410e230b6Smaya
121510e230b6Smaya   dw[0] =
121610e230b6Smaya      __gen_uint(values->SourceAttribute, 0, 4) |
121710e230b6Smaya      __gen_uint(values->SwizzleSelect, 6, 7) |
121810e230b6Smaya      __gen_uint(values->ConstantSource, 9, 10) |
121910e230b6Smaya      __gen_uint(values->SwizzleControlMode, 11, 11) |
122010e230b6Smaya      __gen_uint(values->ComponentOverrideX, 12, 12) |
122110e230b6Smaya      __gen_uint(values->ComponentOverrideY, 13, 13) |
122210e230b6Smaya      __gen_uint(values->ComponentOverrideZ, 14, 14) |
122310e230b6Smaya      __gen_uint(values->ComponentOverrideW, 15, 15);
122410e230b6Smaya}
122510e230b6Smaya
122696c5ddc4Srjs#define GFX7_SO_DECL_length                    1
122796c5ddc4Srjsstruct GFX7_SO_DECL {
122810e230b6Smaya   uint32_t                             ComponentMask;
122910e230b6Smaya   uint32_t                             RegisterIndex;
123096c5ddc4Srjs   bool                                 HoleFlag;
123110e230b6Smaya   uint32_t                             OutputBufferSlot;
123210e230b6Smaya};
123310e230b6Smaya
123496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
123596c5ddc4SrjsGFX7_SO_DECL_pack(__attribute__((unused)) __gen_user_data *data,
123610e230b6Smaya                  __attribute__((unused)) void * restrict dst,
123796c5ddc4Srjs                  __attribute__((unused)) const struct GFX7_SO_DECL * restrict values)
123810e230b6Smaya{
123910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
124010e230b6Smaya
124110e230b6Smaya   dw[0] =
124210e230b6Smaya      __gen_uint(values->ComponentMask, 0, 3) |
124310e230b6Smaya      __gen_uint(values->RegisterIndex, 4, 9) |
124410e230b6Smaya      __gen_uint(values->HoleFlag, 11, 11) |
124510e230b6Smaya      __gen_uint(values->OutputBufferSlot, 12, 13);
124610e230b6Smaya}
124710e230b6Smaya
124896c5ddc4Srjs#define GFX7_SO_DECL_ENTRY_length              2
124996c5ddc4Srjsstruct GFX7_SO_DECL_ENTRY {
125096c5ddc4Srjs   struct GFX7_SO_DECL                  Stream0Decl;
125196c5ddc4Srjs   struct GFX7_SO_DECL                  Stream1Decl;
125296c5ddc4Srjs   struct GFX7_SO_DECL                  Stream2Decl;
125396c5ddc4Srjs   struct GFX7_SO_DECL                  Stream3Decl;
125410e230b6Smaya};
125510e230b6Smaya
125696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
125796c5ddc4SrjsGFX7_SO_DECL_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
125810e230b6Smaya                        __attribute__((unused)) void * restrict dst,
125996c5ddc4Srjs                        __attribute__((unused)) const struct GFX7_SO_DECL_ENTRY * restrict values)
126010e230b6Smaya{
126110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
126210e230b6Smaya
126310e230b6Smaya   uint32_t v0_0;
126496c5ddc4Srjs   GFX7_SO_DECL_pack(data, &v0_0, &values->Stream0Decl);
126510e230b6Smaya
126610e230b6Smaya   uint32_t v0_1;
126796c5ddc4Srjs   GFX7_SO_DECL_pack(data, &v0_1, &values->Stream1Decl);
126810e230b6Smaya
126910e230b6Smaya   dw[0] =
127010e230b6Smaya      __gen_uint(v0_0, 0, 15) |
127110e230b6Smaya      __gen_uint(v0_1, 16, 31);
127210e230b6Smaya
127310e230b6Smaya   uint32_t v1_0;
127496c5ddc4Srjs   GFX7_SO_DECL_pack(data, &v1_0, &values->Stream2Decl);
127510e230b6Smaya
127610e230b6Smaya   uint32_t v1_1;
127796c5ddc4Srjs   GFX7_SO_DECL_pack(data, &v1_1, &values->Stream3Decl);
127810e230b6Smaya
127910e230b6Smaya   dw[1] =
128010e230b6Smaya      __gen_uint(v1_0, 0, 15) |
128110e230b6Smaya      __gen_uint(v1_1, 16, 31);
128210e230b6Smaya}
128310e230b6Smaya
128496c5ddc4Srjs#define GFX7_VERTEX_BUFFER_STATE_length        4
128596c5ddc4Srjsstruct GFX7_VERTEX_BUFFER_STATE {
128610e230b6Smaya   uint32_t                             BufferPitch;
128710e230b6Smaya   bool                                 VertexFetchInvalidate;
128810e230b6Smaya   bool                                 NullVertexBuffer;
128910e230b6Smaya   bool                                 AddressModifyEnable;
129010e230b6Smaya   uint32_t                             MOCS;
129110e230b6Smaya   uint32_t                             BufferAccessType;
129210e230b6Smaya#define VERTEXDATA                               0
129310e230b6Smaya#define INSTANCEDATA                             1
129410e230b6Smaya   uint32_t                             VertexBufferIndex;
129510e230b6Smaya   __gen_address_type                   BufferStartingAddress;
129610e230b6Smaya   __gen_address_type                   EndAddress;
129710e230b6Smaya   uint32_t                             InstanceDataStepRate;
129810e230b6Smaya};
129910e230b6Smaya
130096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
130196c5ddc4SrjsGFX7_VERTEX_BUFFER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
130210e230b6Smaya                              __attribute__((unused)) void * restrict dst,
130396c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_VERTEX_BUFFER_STATE * restrict values)
130410e230b6Smaya{
130510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
130610e230b6Smaya
130710e230b6Smaya   dw[0] =
130810e230b6Smaya      __gen_uint(values->BufferPitch, 0, 11) |
130910e230b6Smaya      __gen_uint(values->VertexFetchInvalidate, 12, 12) |
131010e230b6Smaya      __gen_uint(values->NullVertexBuffer, 13, 13) |
131110e230b6Smaya      __gen_uint(values->AddressModifyEnable, 14, 14) |
131210e230b6Smaya      __gen_uint(values->MOCS, 16, 19) |
131310e230b6Smaya      __gen_uint(values->BufferAccessType, 20, 20) |
131410e230b6Smaya      __gen_uint(values->VertexBufferIndex, 26, 31);
131510e230b6Smaya
131696c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->BufferStartingAddress, 0, 0, 31);
131710e230b6Smaya
131896c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->EndAddress, 0, 0, 31);
131910e230b6Smaya
132010e230b6Smaya   dw[3] =
132110e230b6Smaya      __gen_uint(values->InstanceDataStepRate, 0, 31);
132210e230b6Smaya}
132310e230b6Smaya
132496c5ddc4Srjs#define GFX7_VERTEX_ELEMENT_STATE_length       2
132596c5ddc4Srjsstruct GFX7_VERTEX_ELEMENT_STATE {
132610e230b6Smaya   uint32_t                             SourceElementOffset;
132710e230b6Smaya   bool                                 EdgeFlagEnable;
132810e230b6Smaya   uint32_t                             SourceElementFormat;
132910e230b6Smaya   bool                                 Valid;
133010e230b6Smaya   uint32_t                             VertexBufferIndex;
133196c5ddc4Srjs   enum GFX7_3D_Vertex_Component_Control Component3Control;
133296c5ddc4Srjs   enum GFX7_3D_Vertex_Component_Control Component2Control;
133396c5ddc4Srjs   enum GFX7_3D_Vertex_Component_Control Component1Control;
133496c5ddc4Srjs   enum GFX7_3D_Vertex_Component_Control Component0Control;
133510e230b6Smaya};
133610e230b6Smaya
133796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
133896c5ddc4SrjsGFX7_VERTEX_ELEMENT_STATE_pack(__attribute__((unused)) __gen_user_data *data,
133910e230b6Smaya                               __attribute__((unused)) void * restrict dst,
134096c5ddc4Srjs                               __attribute__((unused)) const struct GFX7_VERTEX_ELEMENT_STATE * restrict values)
134110e230b6Smaya{
134210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
134310e230b6Smaya
134410e230b6Smaya   dw[0] =
134510e230b6Smaya      __gen_uint(values->SourceElementOffset, 0, 11) |
134610e230b6Smaya      __gen_uint(values->EdgeFlagEnable, 15, 15) |
134710e230b6Smaya      __gen_uint(values->SourceElementFormat, 16, 24) |
134810e230b6Smaya      __gen_uint(values->Valid, 25, 25) |
134910e230b6Smaya      __gen_uint(values->VertexBufferIndex, 26, 31);
135010e230b6Smaya
135110e230b6Smaya   dw[1] =
135210e230b6Smaya      __gen_uint(values->Component3Control, 16, 18) |
135310e230b6Smaya      __gen_uint(values->Component2Control, 20, 22) |
135410e230b6Smaya      __gen_uint(values->Component1Control, 24, 26) |
135510e230b6Smaya      __gen_uint(values->Component0Control, 28, 30);
135610e230b6Smaya}
135710e230b6Smaya
135896c5ddc4Srjs#define GFX7_3DPRIMITIVE_length                7
135996c5ddc4Srjs#define GFX7_3DPRIMITIVE_length_bias           2
136096c5ddc4Srjs#define GFX7_3DPRIMITIVE_header                 \
136110e230b6Smaya   .DWordLength                         =      5,  \
136210e230b6Smaya   ._3DCommandSubOpcode                 =      0,  \
136310e230b6Smaya   ._3DCommandOpcode                    =      3,  \
136410e230b6Smaya   .CommandSubType                      =      3,  \
136510e230b6Smaya   .CommandType                         =      3
136610e230b6Smaya
136796c5ddc4Srjsstruct GFX7_3DPRIMITIVE {
136810e230b6Smaya   uint32_t                             DWordLength;
136910e230b6Smaya   bool                                 PredicateEnable;
137010e230b6Smaya   bool                                 IndirectParameterEnable;
137110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
137210e230b6Smaya   uint32_t                             _3DCommandOpcode;
137310e230b6Smaya   uint32_t                             CommandSubType;
137410e230b6Smaya   uint32_t                             CommandType;
137596c5ddc4Srjs   enum GFX7_3D_Prim_Topo_Type          PrimitiveTopologyType;
137610e230b6Smaya   uint32_t                             VertexAccessType;
137710e230b6Smaya#define SEQUENTIAL                               0
137810e230b6Smaya#define RANDOM                                   1
137910e230b6Smaya   bool                                 EndOffsetEnable;
138010e230b6Smaya   uint32_t                             VertexCountPerInstance;
138110e230b6Smaya   uint32_t                             StartVertexLocation;
138210e230b6Smaya   uint32_t                             InstanceCount;
138310e230b6Smaya   uint32_t                             StartInstanceLocation;
138410e230b6Smaya   int32_t                              BaseVertexLocation;
138510e230b6Smaya};
138610e230b6Smaya
138796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
138896c5ddc4SrjsGFX7_3DPRIMITIVE_pack(__attribute__((unused)) __gen_user_data *data,
138910e230b6Smaya                      __attribute__((unused)) void * restrict dst,
139096c5ddc4Srjs                      __attribute__((unused)) const struct GFX7_3DPRIMITIVE * restrict values)
139110e230b6Smaya{
139210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
139310e230b6Smaya
139410e230b6Smaya   dw[0] =
139510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
139610e230b6Smaya      __gen_uint(values->PredicateEnable, 8, 8) |
139710e230b6Smaya      __gen_uint(values->IndirectParameterEnable, 10, 10) |
139810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
139910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
140010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
140110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
140210e230b6Smaya
140310e230b6Smaya   dw[1] =
140410e230b6Smaya      __gen_uint(values->PrimitiveTopologyType, 0, 5) |
140510e230b6Smaya      __gen_uint(values->VertexAccessType, 8, 8) |
140610e230b6Smaya      __gen_uint(values->EndOffsetEnable, 9, 9);
140710e230b6Smaya
140810e230b6Smaya   dw[2] =
140910e230b6Smaya      __gen_uint(values->VertexCountPerInstance, 0, 31);
141010e230b6Smaya
141110e230b6Smaya   dw[3] =
141210e230b6Smaya      __gen_uint(values->StartVertexLocation, 0, 31);
141310e230b6Smaya
141410e230b6Smaya   dw[4] =
141510e230b6Smaya      __gen_uint(values->InstanceCount, 0, 31);
141610e230b6Smaya
141710e230b6Smaya   dw[5] =
141810e230b6Smaya      __gen_uint(values->StartInstanceLocation, 0, 31);
141910e230b6Smaya
142010e230b6Smaya   dw[6] =
142110e230b6Smaya      __gen_sint(values->BaseVertexLocation, 0, 31);
142210e230b6Smaya}
142310e230b6Smaya
142496c5ddc4Srjs#define GFX7_3DSTATE_AA_LINE_PARAMETERS_length      3
142596c5ddc4Srjs#define GFX7_3DSTATE_AA_LINE_PARAMETERS_length_bias      2
142696c5ddc4Srjs#define GFX7_3DSTATE_AA_LINE_PARAMETERS_header  \
142710e230b6Smaya   .DWordLength                         =      1,  \
142810e230b6Smaya   ._3DCommandSubOpcode                 =     10,  \
142910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
143010e230b6Smaya   .CommandSubType                      =      3,  \
143110e230b6Smaya   .CommandType                         =      3
143210e230b6Smaya
143396c5ddc4Srjsstruct GFX7_3DSTATE_AA_LINE_PARAMETERS {
143410e230b6Smaya   uint32_t                             DWordLength;
143510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
143610e230b6Smaya   uint32_t                             _3DCommandOpcode;
143710e230b6Smaya   uint32_t                             CommandSubType;
143810e230b6Smaya   uint32_t                             CommandType;
143910e230b6Smaya   float                                AACoverageSlope;
144010e230b6Smaya   float                                AACoverageBias;
144110e230b6Smaya   float                                AACoverageEndCapSlope;
144210e230b6Smaya   float                                AACoverageEndCapBias;
144310e230b6Smaya};
144410e230b6Smaya
144596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
144696c5ddc4SrjsGFX7_3DSTATE_AA_LINE_PARAMETERS_pack(__attribute__((unused)) __gen_user_data *data,
144710e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
144896c5ddc4Srjs                                     __attribute__((unused)) const struct GFX7_3DSTATE_AA_LINE_PARAMETERS * restrict values)
144910e230b6Smaya{
145010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
145110e230b6Smaya
145210e230b6Smaya   dw[0] =
145310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
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_ufixed(values->AACoverageSlope, 0, 7, 8) |
146110e230b6Smaya      __gen_ufixed(values->AACoverageBias, 16, 23, 8);
146210e230b6Smaya
146310e230b6Smaya   dw[2] =
146410e230b6Smaya      __gen_ufixed(values->AACoverageEndCapSlope, 0, 7, 8) |
146510e230b6Smaya      __gen_ufixed(values->AACoverageEndCapBias, 16, 23, 8);
146610e230b6Smaya}
146710e230b6Smaya
146896c5ddc4Srjs#define GFX7_3DSTATE_BINDING_TABLE_POINTERS_DS_length      2
146996c5ddc4Srjs#define GFX7_3DSTATE_BINDING_TABLE_POINTERS_DS_length_bias      2
147096c5ddc4Srjs#define GFX7_3DSTATE_BINDING_TABLE_POINTERS_DS_header\
147110e230b6Smaya   .DWordLength                         =      0,  \
147210e230b6Smaya   ._3DCommandSubOpcode                 =     40,  \
147310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
147410e230b6Smaya   .CommandSubType                      =      3,  \
147510e230b6Smaya   .CommandType                         =      3
147610e230b6Smaya
147796c5ddc4Srjsstruct GFX7_3DSTATE_BINDING_TABLE_POINTERS_DS {
147810e230b6Smaya   uint32_t                             DWordLength;
147910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
148010e230b6Smaya   uint32_t                             _3DCommandOpcode;
148110e230b6Smaya   uint32_t                             CommandSubType;
148210e230b6Smaya   uint32_t                             CommandType;
148310e230b6Smaya   uint64_t                             PointertoDSBindingTable;
148410e230b6Smaya};
148510e230b6Smaya
148696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
148796c5ddc4SrjsGFX7_3DSTATE_BINDING_TABLE_POINTERS_DS_pack(__attribute__((unused)) __gen_user_data *data,
148810e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
148996c5ddc4Srjs                                            __attribute__((unused)) const struct GFX7_3DSTATE_BINDING_TABLE_POINTERS_DS * restrict values)
149010e230b6Smaya{
149110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
149210e230b6Smaya
149310e230b6Smaya   dw[0] =
149410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
149510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
149610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
149710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
149810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
149910e230b6Smaya
150010e230b6Smaya   dw[1] =
150110e230b6Smaya      __gen_offset(values->PointertoDSBindingTable, 5, 15);
150210e230b6Smaya}
150310e230b6Smaya
150496c5ddc4Srjs#define GFX7_3DSTATE_BINDING_TABLE_POINTERS_GS_length      2
150596c5ddc4Srjs#define GFX7_3DSTATE_BINDING_TABLE_POINTERS_GS_length_bias      2
150696c5ddc4Srjs#define GFX7_3DSTATE_BINDING_TABLE_POINTERS_GS_header\
150710e230b6Smaya   .DWordLength                         =      0,  \
150810e230b6Smaya   ._3DCommandSubOpcode                 =     41,  \
150910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
151010e230b6Smaya   .CommandSubType                      =      3,  \
151110e230b6Smaya   .CommandType                         =      3
151210e230b6Smaya
151396c5ddc4Srjsstruct GFX7_3DSTATE_BINDING_TABLE_POINTERS_GS {
151410e230b6Smaya   uint32_t                             DWordLength;
151510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
151610e230b6Smaya   uint32_t                             _3DCommandOpcode;
151710e230b6Smaya   uint32_t                             CommandSubType;
151810e230b6Smaya   uint32_t                             CommandType;
151910e230b6Smaya   uint64_t                             PointertoGSBindingTable;
152010e230b6Smaya};
152110e230b6Smaya
152296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
152396c5ddc4SrjsGFX7_3DSTATE_BINDING_TABLE_POINTERS_GS_pack(__attribute__((unused)) __gen_user_data *data,
152410e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
152596c5ddc4Srjs                                            __attribute__((unused)) const struct GFX7_3DSTATE_BINDING_TABLE_POINTERS_GS * restrict values)
152610e230b6Smaya{
152710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
152810e230b6Smaya
152910e230b6Smaya   dw[0] =
153010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
153110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
153210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
153310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
153410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
153510e230b6Smaya
153610e230b6Smaya   dw[1] =
153710e230b6Smaya      __gen_offset(values->PointertoGSBindingTable, 5, 15);
153810e230b6Smaya}
153910e230b6Smaya
154096c5ddc4Srjs#define GFX7_3DSTATE_BINDING_TABLE_POINTERS_HS_length      2
154196c5ddc4Srjs#define GFX7_3DSTATE_BINDING_TABLE_POINTERS_HS_length_bias      2
154296c5ddc4Srjs#define GFX7_3DSTATE_BINDING_TABLE_POINTERS_HS_header\
154310e230b6Smaya   .DWordLength                         =      0,  \
154410e230b6Smaya   ._3DCommandSubOpcode                 =     39,  \
154510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
154610e230b6Smaya   .CommandSubType                      =      3,  \
154710e230b6Smaya   .CommandType                         =      3
154810e230b6Smaya
154996c5ddc4Srjsstruct GFX7_3DSTATE_BINDING_TABLE_POINTERS_HS {
155010e230b6Smaya   uint32_t                             DWordLength;
155110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
155210e230b6Smaya   uint32_t                             _3DCommandOpcode;
155310e230b6Smaya   uint32_t                             CommandSubType;
155410e230b6Smaya   uint32_t                             CommandType;
155510e230b6Smaya   uint64_t                             PointertoHSBindingTable;
155610e230b6Smaya};
155710e230b6Smaya
155896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
155996c5ddc4SrjsGFX7_3DSTATE_BINDING_TABLE_POINTERS_HS_pack(__attribute__((unused)) __gen_user_data *data,
156010e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
156196c5ddc4Srjs                                            __attribute__((unused)) const struct GFX7_3DSTATE_BINDING_TABLE_POINTERS_HS * restrict values)
156210e230b6Smaya{
156310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
156410e230b6Smaya
156510e230b6Smaya   dw[0] =
156610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
156710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
156810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
156910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
157010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
157110e230b6Smaya
157210e230b6Smaya   dw[1] =
157310e230b6Smaya      __gen_offset(values->PointertoHSBindingTable, 5, 15);
157410e230b6Smaya}
157510e230b6Smaya
157696c5ddc4Srjs#define GFX7_3DSTATE_BINDING_TABLE_POINTERS_PS_length      2
157796c5ddc4Srjs#define GFX7_3DSTATE_BINDING_TABLE_POINTERS_PS_length_bias      2
157896c5ddc4Srjs#define GFX7_3DSTATE_BINDING_TABLE_POINTERS_PS_header\
157910e230b6Smaya   .DWordLength                         =      0,  \
158010e230b6Smaya   ._3DCommandSubOpcode                 =     42,  \
158110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
158210e230b6Smaya   .CommandSubType                      =      3,  \
158310e230b6Smaya   .CommandType                         =      3
158410e230b6Smaya
158596c5ddc4Srjsstruct GFX7_3DSTATE_BINDING_TABLE_POINTERS_PS {
158610e230b6Smaya   uint32_t                             DWordLength;
158710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
158810e230b6Smaya   uint32_t                             _3DCommandOpcode;
158910e230b6Smaya   uint32_t                             CommandSubType;
159010e230b6Smaya   uint32_t                             CommandType;
159110e230b6Smaya   uint64_t                             PointertoPSBindingTable;
159210e230b6Smaya};
159310e230b6Smaya
159496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
159596c5ddc4SrjsGFX7_3DSTATE_BINDING_TABLE_POINTERS_PS_pack(__attribute__((unused)) __gen_user_data *data,
159610e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
159796c5ddc4Srjs                                            __attribute__((unused)) const struct GFX7_3DSTATE_BINDING_TABLE_POINTERS_PS * restrict values)
159810e230b6Smaya{
159910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
160010e230b6Smaya
160110e230b6Smaya   dw[0] =
160210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
160310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
160410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
160510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
160610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
160710e230b6Smaya
160810e230b6Smaya   dw[1] =
160910e230b6Smaya      __gen_offset(values->PointertoPSBindingTable, 5, 15);
161010e230b6Smaya}
161110e230b6Smaya
161296c5ddc4Srjs#define GFX7_3DSTATE_BINDING_TABLE_POINTERS_VS_length      2
161396c5ddc4Srjs#define GFX7_3DSTATE_BINDING_TABLE_POINTERS_VS_length_bias      2
161496c5ddc4Srjs#define GFX7_3DSTATE_BINDING_TABLE_POINTERS_VS_header\
161510e230b6Smaya   .DWordLength                         =      0,  \
161610e230b6Smaya   ._3DCommandSubOpcode                 =     38,  \
161710e230b6Smaya   ._3DCommandOpcode                    =      0,  \
161810e230b6Smaya   .CommandSubType                      =      3,  \
161910e230b6Smaya   .CommandType                         =      3
162010e230b6Smaya
162196c5ddc4Srjsstruct GFX7_3DSTATE_BINDING_TABLE_POINTERS_VS {
162210e230b6Smaya   uint32_t                             DWordLength;
162310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
162410e230b6Smaya   uint32_t                             _3DCommandOpcode;
162510e230b6Smaya   uint32_t                             CommandSubType;
162610e230b6Smaya   uint32_t                             CommandType;
162710e230b6Smaya   uint64_t                             PointertoVSBindingTable;
162810e230b6Smaya};
162910e230b6Smaya
163096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
163196c5ddc4SrjsGFX7_3DSTATE_BINDING_TABLE_POINTERS_VS_pack(__attribute__((unused)) __gen_user_data *data,
163210e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
163396c5ddc4Srjs                                            __attribute__((unused)) const struct GFX7_3DSTATE_BINDING_TABLE_POINTERS_VS * restrict values)
163410e230b6Smaya{
163510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
163610e230b6Smaya
163710e230b6Smaya   dw[0] =
163810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
163910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
164010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
164110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
164210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
164310e230b6Smaya
164410e230b6Smaya   dw[1] =
164510e230b6Smaya      __gen_offset(values->PointertoVSBindingTable, 5, 15);
164610e230b6Smaya}
164710e230b6Smaya
164896c5ddc4Srjs#define GFX7_3DSTATE_BLEND_STATE_POINTERS_length      2
164996c5ddc4Srjs#define GFX7_3DSTATE_BLEND_STATE_POINTERS_length_bias      2
165096c5ddc4Srjs#define GFX7_3DSTATE_BLEND_STATE_POINTERS_header\
165110e230b6Smaya   .DWordLength                         =      0,  \
165210e230b6Smaya   ._3DCommandSubOpcode                 =     36,  \
165310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
165410e230b6Smaya   .CommandSubType                      =      3,  \
165510e230b6Smaya   .CommandType                         =      3
165610e230b6Smaya
165796c5ddc4Srjsstruct GFX7_3DSTATE_BLEND_STATE_POINTERS {
165810e230b6Smaya   uint32_t                             DWordLength;
165910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
166010e230b6Smaya   uint32_t                             _3DCommandOpcode;
166110e230b6Smaya   uint32_t                             CommandSubType;
166210e230b6Smaya   uint32_t                             CommandType;
166310e230b6Smaya   uint64_t                             BlendStatePointer;
166410e230b6Smaya};
166510e230b6Smaya
166696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
166796c5ddc4SrjsGFX7_3DSTATE_BLEND_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
166810e230b6Smaya                                       __attribute__((unused)) void * restrict dst,
166996c5ddc4Srjs                                       __attribute__((unused)) const struct GFX7_3DSTATE_BLEND_STATE_POINTERS * restrict values)
167010e230b6Smaya{
167110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
167210e230b6Smaya
167310e230b6Smaya   dw[0] =
167410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
167510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
167610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
167710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
167810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
167910e230b6Smaya
168010e230b6Smaya   dw[1] =
168110e230b6Smaya      __gen_mbo(0, 0) |
168210e230b6Smaya      __gen_offset(values->BlendStatePointer, 6, 31);
168310e230b6Smaya}
168410e230b6Smaya
168596c5ddc4Srjs#define GFX7_3DSTATE_CC_STATE_POINTERS_length      2
168696c5ddc4Srjs#define GFX7_3DSTATE_CC_STATE_POINTERS_length_bias      2
168796c5ddc4Srjs#define GFX7_3DSTATE_CC_STATE_POINTERS_header   \
168810e230b6Smaya   .DWordLength                         =      0,  \
168910e230b6Smaya   ._3DCommandSubOpcode                 =     14,  \
169010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
169110e230b6Smaya   .CommandSubType                      =      3,  \
169210e230b6Smaya   .CommandType                         =      3
169310e230b6Smaya
169496c5ddc4Srjsstruct GFX7_3DSTATE_CC_STATE_POINTERS {
169510e230b6Smaya   uint32_t                             DWordLength;
169610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
169710e230b6Smaya   uint32_t                             _3DCommandOpcode;
169810e230b6Smaya   uint32_t                             CommandSubType;
169910e230b6Smaya   uint32_t                             CommandType;
170010e230b6Smaya   uint64_t                             ColorCalcStatePointer;
170110e230b6Smaya};
170210e230b6Smaya
170396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
170496c5ddc4SrjsGFX7_3DSTATE_CC_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
170510e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
170696c5ddc4Srjs                                    __attribute__((unused)) const struct GFX7_3DSTATE_CC_STATE_POINTERS * restrict values)
170710e230b6Smaya{
170810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
170910e230b6Smaya
171010e230b6Smaya   dw[0] =
171110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
171210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
171310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
171410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
171510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
171610e230b6Smaya
171710e230b6Smaya   dw[1] =
171810e230b6Smaya      __gen_mbo(0, 0) |
171910e230b6Smaya      __gen_offset(values->ColorCalcStatePointer, 6, 31);
172010e230b6Smaya}
172110e230b6Smaya
172296c5ddc4Srjs#define GFX7_3DSTATE_CHROMA_KEY_length         4
172396c5ddc4Srjs#define GFX7_3DSTATE_CHROMA_KEY_length_bias      2
172496c5ddc4Srjs#define GFX7_3DSTATE_CHROMA_KEY_header          \
172510e230b6Smaya   .DWordLength                         =      2,  \
172610e230b6Smaya   ._3DCommandSubOpcode                 =      4,  \
172710e230b6Smaya   ._3DCommandOpcode                    =      1,  \
172810e230b6Smaya   .CommandSubType                      =      3,  \
172910e230b6Smaya   .CommandType                         =      3
173010e230b6Smaya
173196c5ddc4Srjsstruct GFX7_3DSTATE_CHROMA_KEY {
173210e230b6Smaya   uint32_t                             DWordLength;
173310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
173410e230b6Smaya   uint32_t                             _3DCommandOpcode;
173510e230b6Smaya   uint32_t                             CommandSubType;
173610e230b6Smaya   uint32_t                             CommandType;
173710e230b6Smaya   uint32_t                             ChromaKeyTableIndex;
173810e230b6Smaya   uint32_t                             ChromaKeyLowValue;
173910e230b6Smaya   uint32_t                             ChromaKeyHighValue;
174010e230b6Smaya};
174110e230b6Smaya
174296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
174396c5ddc4SrjsGFX7_3DSTATE_CHROMA_KEY_pack(__attribute__((unused)) __gen_user_data *data,
174410e230b6Smaya                             __attribute__((unused)) void * restrict dst,
174596c5ddc4Srjs                             __attribute__((unused)) const struct GFX7_3DSTATE_CHROMA_KEY * restrict values)
174610e230b6Smaya{
174710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
174810e230b6Smaya
174910e230b6Smaya   dw[0] =
175010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
175110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
175210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
175310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
175410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
175510e230b6Smaya
175610e230b6Smaya   dw[1] =
175710e230b6Smaya      __gen_uint(values->ChromaKeyTableIndex, 30, 31);
175810e230b6Smaya
175910e230b6Smaya   dw[2] =
176010e230b6Smaya      __gen_uint(values->ChromaKeyLowValue, 0, 31);
176110e230b6Smaya
176210e230b6Smaya   dw[3] =
176310e230b6Smaya      __gen_uint(values->ChromaKeyHighValue, 0, 31);
176410e230b6Smaya}
176510e230b6Smaya
176696c5ddc4Srjs#define GFX7_3DSTATE_CLEAR_PARAMS_length       3
176796c5ddc4Srjs#define GFX7_3DSTATE_CLEAR_PARAMS_length_bias      2
176896c5ddc4Srjs#define GFX7_3DSTATE_CLEAR_PARAMS_header        \
176910e230b6Smaya   .DWordLength                         =      1,  \
177010e230b6Smaya   ._3DCommandSubOpcode                 =      4,  \
177110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
177210e230b6Smaya   .CommandSubType                      =      3,  \
177310e230b6Smaya   .CommandType                         =      3
177410e230b6Smaya
177596c5ddc4Srjsstruct GFX7_3DSTATE_CLEAR_PARAMS {
177610e230b6Smaya   uint32_t                             DWordLength;
177710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
177810e230b6Smaya   uint32_t                             _3DCommandOpcode;
177910e230b6Smaya   uint32_t                             CommandSubType;
178010e230b6Smaya   uint32_t                             CommandType;
178110e230b6Smaya   uint32_t                             DepthClearValue;
178210e230b6Smaya   bool                                 DepthClearValueValid;
178310e230b6Smaya};
178410e230b6Smaya
178596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
178696c5ddc4SrjsGFX7_3DSTATE_CLEAR_PARAMS_pack(__attribute__((unused)) __gen_user_data *data,
178710e230b6Smaya                               __attribute__((unused)) void * restrict dst,
178896c5ddc4Srjs                               __attribute__((unused)) const struct GFX7_3DSTATE_CLEAR_PARAMS * restrict values)
178910e230b6Smaya{
179010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
179110e230b6Smaya
179210e230b6Smaya   dw[0] =
179310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
179410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
179510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
179610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
179710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
179810e230b6Smaya
179910e230b6Smaya   dw[1] =
180010e230b6Smaya      __gen_uint(values->DepthClearValue, 0, 31);
180110e230b6Smaya
180210e230b6Smaya   dw[2] =
180310e230b6Smaya      __gen_uint(values->DepthClearValueValid, 0, 0);
180410e230b6Smaya}
180510e230b6Smaya
180696c5ddc4Srjs#define GFX7_3DSTATE_CLIP_length               4
180796c5ddc4Srjs#define GFX7_3DSTATE_CLIP_length_bias          2
180896c5ddc4Srjs#define GFX7_3DSTATE_CLIP_header                \
180910e230b6Smaya   .DWordLength                         =      2,  \
181010e230b6Smaya   ._3DCommandSubOpcode                 =     18,  \
181110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
181210e230b6Smaya   .CommandSubType                      =      3,  \
181310e230b6Smaya   .CommandType                         =      3
181410e230b6Smaya
181596c5ddc4Srjsstruct GFX7_3DSTATE_CLIP {
181610e230b6Smaya   uint32_t                             DWordLength;
181710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
181810e230b6Smaya   uint32_t                             _3DCommandOpcode;
181910e230b6Smaya   uint32_t                             CommandSubType;
182010e230b6Smaya   uint32_t                             CommandType;
182110e230b6Smaya   uint32_t                             UserClipDistanceCullTestEnableBitmask;
182210e230b6Smaya   bool                                 StatisticsEnable;
182310e230b6Smaya   uint32_t                             CullMode;
182410e230b6Smaya#define CULLMODE_BOTH                            0
182510e230b6Smaya#define CULLMODE_NONE                            1
182610e230b6Smaya#define CULLMODE_FRONT                           2
182710e230b6Smaya#define CULLMODE_BACK                            3
182810e230b6Smaya   bool                                 EarlyCullEnable;
182910e230b6Smaya   uint32_t                             VertexSubPixelPrecisionSelect;
183010e230b6Smaya   uint32_t                             FrontWinding;
183110e230b6Smaya   uint32_t                             TriangleFanProvokingVertexSelect;
183210e230b6Smaya#define Vertex0                                  0
183310e230b6Smaya#define Vertex1                                  1
183410e230b6Smaya#define Vertex2                                  2
183510e230b6Smaya   uint32_t                             LineStripListProvokingVertexSelect;
183610e230b6Smaya#define Vertex0                                  0
183710e230b6Smaya#define Vertex1                                  1
183810e230b6Smaya   uint32_t                             TriangleStripListProvokingVertexSelect;
183910e230b6Smaya#define Vertex0                                  0
184010e230b6Smaya#define Vertex1                                  1
184110e230b6Smaya#define Vertex2                                  2
184210e230b6Smaya   bool                                 NonPerspectiveBarycentricEnable;
184310e230b6Smaya   bool                                 PerspectiveDivideDisable;
184410e230b6Smaya   uint32_t                             ClipMode;
184510e230b6Smaya#define CLIPMODE_NORMAL                          0
184610e230b6Smaya#define CLIPMODE_REJECT_ALL                      3
184710e230b6Smaya#define CLIPMODE_ACCEPT_ALL                      4
184810e230b6Smaya   uint32_t                             UserClipDistanceClipTestEnableBitmask;
184910e230b6Smaya   bool                                 GuardbandClipTestEnable;
185010e230b6Smaya   bool                                 ViewportZClipTestEnable;
185110e230b6Smaya   bool                                 ViewportXYClipTestEnable;
185210e230b6Smaya   uint32_t                             APIMode;
185310e230b6Smaya#define APIMODE_OGL                              0
185410e230b6Smaya#define APIMODE_D3D                              1
185510e230b6Smaya   bool                                 ClipEnable;
185610e230b6Smaya   uint32_t                             MaximumVPIndex;
185710e230b6Smaya   bool                                 ForceZeroRTAIndexEnable;
185810e230b6Smaya   float                                MaximumPointWidth;
185910e230b6Smaya   float                                MinimumPointWidth;
186010e230b6Smaya};
186110e230b6Smaya
186296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
186396c5ddc4SrjsGFX7_3DSTATE_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
186410e230b6Smaya                       __attribute__((unused)) void * restrict dst,
186596c5ddc4Srjs                       __attribute__((unused)) const struct GFX7_3DSTATE_CLIP * restrict values)
186610e230b6Smaya{
186710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
186810e230b6Smaya
186910e230b6Smaya   dw[0] =
187010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
187110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
187210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
187310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
187410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
187510e230b6Smaya
187610e230b6Smaya   dw[1] =
187710e230b6Smaya      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
187810e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
187910e230b6Smaya      __gen_uint(values->CullMode, 16, 17) |
188010e230b6Smaya      __gen_uint(values->EarlyCullEnable, 18, 18) |
188110e230b6Smaya      __gen_uint(values->VertexSubPixelPrecisionSelect, 19, 19) |
188210e230b6Smaya      __gen_uint(values->FrontWinding, 20, 20);
188310e230b6Smaya
188410e230b6Smaya   dw[2] =
188510e230b6Smaya      __gen_uint(values->TriangleFanProvokingVertexSelect, 0, 1) |
188610e230b6Smaya      __gen_uint(values->LineStripListProvokingVertexSelect, 2, 3) |
188710e230b6Smaya      __gen_uint(values->TriangleStripListProvokingVertexSelect, 4, 5) |
188810e230b6Smaya      __gen_uint(values->NonPerspectiveBarycentricEnable, 8, 8) |
188910e230b6Smaya      __gen_uint(values->PerspectiveDivideDisable, 9, 9) |
189010e230b6Smaya      __gen_uint(values->ClipMode, 13, 15) |
189110e230b6Smaya      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 16, 23) |
189210e230b6Smaya      __gen_uint(values->GuardbandClipTestEnable, 26, 26) |
189310e230b6Smaya      __gen_uint(values->ViewportZClipTestEnable, 27, 27) |
189410e230b6Smaya      __gen_uint(values->ViewportXYClipTestEnable, 28, 28) |
189510e230b6Smaya      __gen_uint(values->APIMode, 30, 30) |
189610e230b6Smaya      __gen_uint(values->ClipEnable, 31, 31);
189710e230b6Smaya
189810e230b6Smaya   dw[3] =
189910e230b6Smaya      __gen_uint(values->MaximumVPIndex, 0, 3) |
190010e230b6Smaya      __gen_uint(values->ForceZeroRTAIndexEnable, 5, 5) |
190110e230b6Smaya      __gen_ufixed(values->MaximumPointWidth, 6, 16, 3) |
190210e230b6Smaya      __gen_ufixed(values->MinimumPointWidth, 17, 27, 3);
190310e230b6Smaya}
190410e230b6Smaya
190596c5ddc4Srjs#define GFX7_3DSTATE_CONSTANT_DS_length        7
190696c5ddc4Srjs#define GFX7_3DSTATE_CONSTANT_DS_length_bias      2
190796c5ddc4Srjs#define GFX7_3DSTATE_CONSTANT_DS_header         \
190810e230b6Smaya   .DWordLength                         =      5,  \
190910e230b6Smaya   ._3DCommandSubOpcode                 =     26,  \
191010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
191110e230b6Smaya   .CommandSubType                      =      3,  \
191210e230b6Smaya   .CommandType                         =      3
191310e230b6Smaya
191496c5ddc4Srjsstruct GFX7_3DSTATE_CONSTANT_DS {
191510e230b6Smaya   uint32_t                             DWordLength;
191610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
191710e230b6Smaya   uint32_t                             _3DCommandOpcode;
191810e230b6Smaya   uint32_t                             CommandSubType;
191910e230b6Smaya   uint32_t                             CommandType;
192096c5ddc4Srjs   struct GFX7_3DSTATE_CONSTANT_BODY    ConstantBody;
192110e230b6Smaya};
192210e230b6Smaya
192396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
192496c5ddc4SrjsGFX7_3DSTATE_CONSTANT_DS_pack(__attribute__((unused)) __gen_user_data *data,
192510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
192696c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_3DSTATE_CONSTANT_DS * restrict values)
192710e230b6Smaya{
192810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
192910e230b6Smaya
193010e230b6Smaya   dw[0] =
193110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
193210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
193310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
193410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
193510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
193610e230b6Smaya
193796c5ddc4Srjs   GFX7_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
193810e230b6Smaya}
193910e230b6Smaya
194096c5ddc4Srjs#define GFX7_3DSTATE_CONSTANT_GS_length        7
194196c5ddc4Srjs#define GFX7_3DSTATE_CONSTANT_GS_length_bias      2
194296c5ddc4Srjs#define GFX7_3DSTATE_CONSTANT_GS_header         \
194310e230b6Smaya   .DWordLength                         =      5,  \
194410e230b6Smaya   ._3DCommandSubOpcode                 =     22,  \
194510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
194610e230b6Smaya   .CommandSubType                      =      3,  \
194710e230b6Smaya   .CommandType                         =      3
194810e230b6Smaya
194996c5ddc4Srjsstruct GFX7_3DSTATE_CONSTANT_GS {
195010e230b6Smaya   uint32_t                             DWordLength;
195110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
195210e230b6Smaya   uint32_t                             _3DCommandOpcode;
195310e230b6Smaya   uint32_t                             CommandSubType;
195410e230b6Smaya   uint32_t                             CommandType;
195596c5ddc4Srjs   struct GFX7_3DSTATE_CONSTANT_BODY    ConstantBody;
195610e230b6Smaya};
195710e230b6Smaya
195896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
195996c5ddc4SrjsGFX7_3DSTATE_CONSTANT_GS_pack(__attribute__((unused)) __gen_user_data *data,
196010e230b6Smaya                              __attribute__((unused)) void * restrict dst,
196196c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_3DSTATE_CONSTANT_GS * 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
197296c5ddc4Srjs   GFX7_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
197310e230b6Smaya}
197410e230b6Smaya
197596c5ddc4Srjs#define GFX7_3DSTATE_CONSTANT_HS_length        7
197696c5ddc4Srjs#define GFX7_3DSTATE_CONSTANT_HS_length_bias      2
197796c5ddc4Srjs#define GFX7_3DSTATE_CONSTANT_HS_header         \
197810e230b6Smaya   .DWordLength                         =      5,  \
197910e230b6Smaya   ._3DCommandSubOpcode                 =     25,  \
198010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
198110e230b6Smaya   .CommandSubType                      =      3,  \
198210e230b6Smaya   .CommandType                         =      3
198310e230b6Smaya
198496c5ddc4Srjsstruct GFX7_3DSTATE_CONSTANT_HS {
198510e230b6Smaya   uint32_t                             DWordLength;
198610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
198710e230b6Smaya   uint32_t                             _3DCommandOpcode;
198810e230b6Smaya   uint32_t                             CommandSubType;
198910e230b6Smaya   uint32_t                             CommandType;
199096c5ddc4Srjs   struct GFX7_3DSTATE_CONSTANT_BODY    ConstantBody;
199110e230b6Smaya};
199210e230b6Smaya
199396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
199496c5ddc4SrjsGFX7_3DSTATE_CONSTANT_HS_pack(__attribute__((unused)) __gen_user_data *data,
199510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
199696c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_3DSTATE_CONSTANT_HS * restrict values)
199710e230b6Smaya{
199810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
199910e230b6Smaya
200010e230b6Smaya   dw[0] =
200110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
200210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
200310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
200410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
200510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
200610e230b6Smaya
200796c5ddc4Srjs   GFX7_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
200810e230b6Smaya}
200910e230b6Smaya
201096c5ddc4Srjs#define GFX7_3DSTATE_CONSTANT_PS_length        7
201196c5ddc4Srjs#define GFX7_3DSTATE_CONSTANT_PS_length_bias      2
201296c5ddc4Srjs#define GFX7_3DSTATE_CONSTANT_PS_header         \
201310e230b6Smaya   .DWordLength                         =      5,  \
201410e230b6Smaya   ._3DCommandSubOpcode                 =     23,  \
201510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
201610e230b6Smaya   .CommandSubType                      =      3,  \
201710e230b6Smaya   .CommandType                         =      3
201810e230b6Smaya
201996c5ddc4Srjsstruct GFX7_3DSTATE_CONSTANT_PS {
202010e230b6Smaya   uint32_t                             DWordLength;
202110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
202210e230b6Smaya   uint32_t                             _3DCommandOpcode;
202310e230b6Smaya   uint32_t                             CommandSubType;
202410e230b6Smaya   uint32_t                             CommandType;
202596c5ddc4Srjs   struct GFX7_3DSTATE_CONSTANT_BODY    ConstantBody;
202610e230b6Smaya};
202710e230b6Smaya
202896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
202996c5ddc4SrjsGFX7_3DSTATE_CONSTANT_PS_pack(__attribute__((unused)) __gen_user_data *data,
203010e230b6Smaya                              __attribute__((unused)) void * restrict dst,
203196c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_3DSTATE_CONSTANT_PS * restrict values)
203210e230b6Smaya{
203310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
203410e230b6Smaya
203510e230b6Smaya   dw[0] =
203610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
203710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
203810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
203910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
204010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
204110e230b6Smaya
204296c5ddc4Srjs   GFX7_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
204310e230b6Smaya}
204410e230b6Smaya
204596c5ddc4Srjs#define GFX7_3DSTATE_CONSTANT_VS_length        7
204696c5ddc4Srjs#define GFX7_3DSTATE_CONSTANT_VS_length_bias      2
204796c5ddc4Srjs#define GFX7_3DSTATE_CONSTANT_VS_header         \
204810e230b6Smaya   .DWordLength                         =      5,  \
204910e230b6Smaya   ._3DCommandSubOpcode                 =     21,  \
205010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
205110e230b6Smaya   .CommandSubType                      =      3,  \
205210e230b6Smaya   .CommandType                         =      3
205310e230b6Smaya
205496c5ddc4Srjsstruct GFX7_3DSTATE_CONSTANT_VS {
205510e230b6Smaya   uint32_t                             DWordLength;
205610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
205710e230b6Smaya   uint32_t                             _3DCommandOpcode;
205810e230b6Smaya   uint32_t                             CommandSubType;
205910e230b6Smaya   uint32_t                             CommandType;
206096c5ddc4Srjs   struct GFX7_3DSTATE_CONSTANT_BODY    ConstantBody;
206110e230b6Smaya};
206210e230b6Smaya
206396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
206496c5ddc4SrjsGFX7_3DSTATE_CONSTANT_VS_pack(__attribute__((unused)) __gen_user_data *data,
206510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
206696c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_3DSTATE_CONSTANT_VS * restrict values)
206710e230b6Smaya{
206810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
206910e230b6Smaya
207010e230b6Smaya   dw[0] =
207110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
207210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
207310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
207410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
207510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
207610e230b6Smaya
207796c5ddc4Srjs   GFX7_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
207810e230b6Smaya}
207910e230b6Smaya
208096c5ddc4Srjs#define GFX7_3DSTATE_DEPTH_BUFFER_length       7
208196c5ddc4Srjs#define GFX7_3DSTATE_DEPTH_BUFFER_length_bias      2
208296c5ddc4Srjs#define GFX7_3DSTATE_DEPTH_BUFFER_header        \
208310e230b6Smaya   .DWordLength                         =      5,  \
208410e230b6Smaya   ._3DCommandSubOpcode                 =      5,  \
208510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
208610e230b6Smaya   .CommandSubType                      =      3,  \
208710e230b6Smaya   .CommandType                         =      3
208810e230b6Smaya
208996c5ddc4Srjsstruct GFX7_3DSTATE_DEPTH_BUFFER {
209010e230b6Smaya   uint32_t                             DWordLength;
209110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
209210e230b6Smaya   uint32_t                             _3DCommandOpcode;
209310e230b6Smaya   uint32_t                             CommandSubType;
209410e230b6Smaya   uint32_t                             CommandType;
209510e230b6Smaya   uint32_t                             SurfacePitch;
209610e230b6Smaya   uint32_t                             SurfaceFormat;
209710e230b6Smaya#define D32_FLOAT                                1
209810e230b6Smaya#define D24_UNORM_X8_UINT                        3
209910e230b6Smaya#define D16_UNORM                                5
210010e230b6Smaya   bool                                 HierarchicalDepthBufferEnable;
210110e230b6Smaya   bool                                 StencilWriteEnable;
210210e230b6Smaya   bool                                 DepthWriteEnable;
210310e230b6Smaya   uint32_t                             SurfaceType;
210410e230b6Smaya#define SURFTYPE_1D                              0
210510e230b6Smaya#define SURFTYPE_2D                              1
210610e230b6Smaya#define SURFTYPE_3D                              2
210710e230b6Smaya#define SURFTYPE_CUBE                            3
210810e230b6Smaya#define SURFTYPE_NULL                            7
210910e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
211010e230b6Smaya   uint32_t                             LOD;
211110e230b6Smaya   uint32_t                             Width;
211210e230b6Smaya   uint32_t                             Height;
211310e230b6Smaya   uint32_t                             MOCS;
211410e230b6Smaya   uint32_t                             MinimumArrayElement;
211510e230b6Smaya   uint32_t                             Depth;
211610e230b6Smaya#define SURFTYPE_CUBEmustbezero                  0
211710e230b6Smaya   int32_t                              DepthCoordinateOffsetX;
211810e230b6Smaya   int32_t                              DepthCoordinateOffsetY;
211910e230b6Smaya   uint32_t                             RenderTargetViewExtent;
212010e230b6Smaya};
212110e230b6Smaya
212296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
212396c5ddc4SrjsGFX7_3DSTATE_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
212410e230b6Smaya                               __attribute__((unused)) void * restrict dst,
212596c5ddc4Srjs                               __attribute__((unused)) const struct GFX7_3DSTATE_DEPTH_BUFFER * restrict values)
212610e230b6Smaya{
212710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
212810e230b6Smaya
212910e230b6Smaya   dw[0] =
213010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
213110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
213210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
213310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
213410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
213510e230b6Smaya
213610e230b6Smaya   dw[1] =
213710e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 17) |
213810e230b6Smaya      __gen_uint(values->SurfaceFormat, 18, 20) |
213910e230b6Smaya      __gen_uint(values->HierarchicalDepthBufferEnable, 22, 22) |
214010e230b6Smaya      __gen_uint(values->StencilWriteEnable, 27, 27) |
214110e230b6Smaya      __gen_uint(values->DepthWriteEnable, 28, 28) |
214210e230b6Smaya      __gen_uint(values->SurfaceType, 29, 31);
214310e230b6Smaya
214496c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 0, 31);
214510e230b6Smaya
214610e230b6Smaya   dw[3] =
214710e230b6Smaya      __gen_uint(values->LOD, 0, 3) |
214810e230b6Smaya      __gen_uint(values->Width, 4, 17) |
214910e230b6Smaya      __gen_uint(values->Height, 18, 31);
215010e230b6Smaya
215110e230b6Smaya   dw[4] =
215210e230b6Smaya      __gen_uint(values->MOCS, 0, 3) |
215310e230b6Smaya      __gen_uint(values->MinimumArrayElement, 10, 20) |
215410e230b6Smaya      __gen_uint(values->Depth, 21, 31);
215510e230b6Smaya
215610e230b6Smaya   dw[5] =
215710e230b6Smaya      __gen_sint(values->DepthCoordinateOffsetX, 0, 15) |
215810e230b6Smaya      __gen_sint(values->DepthCoordinateOffsetY, 16, 31);
215910e230b6Smaya
216010e230b6Smaya   dw[6] =
216110e230b6Smaya      __gen_uint(values->RenderTargetViewExtent, 21, 31);
216210e230b6Smaya}
216310e230b6Smaya
216496c5ddc4Srjs#define GFX7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS_length      2
216596c5ddc4Srjs#define GFX7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS_length_bias      2
216696c5ddc4Srjs#define GFX7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS_header\
216710e230b6Smaya   .DWordLength                         =      0,  \
216810e230b6Smaya   ._3DCommandSubOpcode                 =     37,  \
216910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
217010e230b6Smaya   .CommandSubType                      =      3,  \
217110e230b6Smaya   .CommandType                         =      3
217210e230b6Smaya
217396c5ddc4Srjsstruct GFX7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS {
217410e230b6Smaya   uint32_t                             DWordLength;
217510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
217610e230b6Smaya   uint32_t                             _3DCommandOpcode;
217710e230b6Smaya   uint32_t                             CommandSubType;
217810e230b6Smaya   uint32_t                             CommandType;
217910e230b6Smaya   uint64_t                             PointertoDEPTH_STENCIL_STATE;
218010e230b6Smaya};
218110e230b6Smaya
218296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
218396c5ddc4SrjsGFX7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
218410e230b6Smaya                                               __attribute__((unused)) void * restrict dst,
218596c5ddc4Srjs                                               __attribute__((unused)) const struct GFX7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS * restrict values)
218610e230b6Smaya{
218710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
218810e230b6Smaya
218910e230b6Smaya   dw[0] =
219010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
219110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
219210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
219310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
219410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
219510e230b6Smaya
219610e230b6Smaya   dw[1] =
219710e230b6Smaya      __gen_mbo(0, 0) |
219810e230b6Smaya      __gen_offset(values->PointertoDEPTH_STENCIL_STATE, 6, 31);
219910e230b6Smaya}
220010e230b6Smaya
220196c5ddc4Srjs#define GFX7_3DSTATE_DRAWING_RECTANGLE_length      4
220296c5ddc4Srjs#define GFX7_3DSTATE_DRAWING_RECTANGLE_length_bias      2
220396c5ddc4Srjs#define GFX7_3DSTATE_DRAWING_RECTANGLE_header   \
220410e230b6Smaya   .DWordLength                         =      2,  \
220510e230b6Smaya   ._3DCommandSubOpcode                 =      0,  \
220610e230b6Smaya   ._3DCommandOpcode                    =      1,  \
220710e230b6Smaya   .CommandSubType                      =      3,  \
220810e230b6Smaya   .CommandType                         =      3
220910e230b6Smaya
221096c5ddc4Srjsstruct GFX7_3DSTATE_DRAWING_RECTANGLE {
221110e230b6Smaya   uint32_t                             DWordLength;
221210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
221310e230b6Smaya   uint32_t                             _3DCommandOpcode;
221410e230b6Smaya   uint32_t                             CommandSubType;
221510e230b6Smaya   uint32_t                             CommandType;
221610e230b6Smaya   uint32_t                             ClippedDrawingRectangleXMin;
221710e230b6Smaya   uint32_t                             ClippedDrawingRectangleYMin;
221810e230b6Smaya   uint32_t                             ClippedDrawingRectangleXMax;
221910e230b6Smaya   uint32_t                             ClippedDrawingRectangleYMax;
222010e230b6Smaya   int32_t                              DrawingRectangleOriginX;
222110e230b6Smaya   int32_t                              DrawingRectangleOriginY;
222210e230b6Smaya};
222310e230b6Smaya
222496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
222596c5ddc4SrjsGFX7_3DSTATE_DRAWING_RECTANGLE_pack(__attribute__((unused)) __gen_user_data *data,
222610e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
222796c5ddc4Srjs                                    __attribute__((unused)) const struct GFX7_3DSTATE_DRAWING_RECTANGLE * restrict values)
222810e230b6Smaya{
222910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
223010e230b6Smaya
223110e230b6Smaya   dw[0] =
223210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
223310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
223410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
223510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
223610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
223710e230b6Smaya
223810e230b6Smaya   dw[1] =
223910e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleXMin, 0, 15) |
224010e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleYMin, 16, 31);
224110e230b6Smaya
224210e230b6Smaya   dw[2] =
224310e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleXMax, 0, 15) |
224410e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleYMax, 16, 31);
224510e230b6Smaya
224610e230b6Smaya   dw[3] =
224710e230b6Smaya      __gen_sint(values->DrawingRectangleOriginX, 0, 15) |
224810e230b6Smaya      __gen_sint(values->DrawingRectangleOriginY, 16, 31);
224910e230b6Smaya}
225010e230b6Smaya
225196c5ddc4Srjs#define GFX7_3DSTATE_DS_length                 6
225296c5ddc4Srjs#define GFX7_3DSTATE_DS_length_bias            2
225396c5ddc4Srjs#define GFX7_3DSTATE_DS_header                  \
225410e230b6Smaya   .DWordLength                         =      4,  \
225510e230b6Smaya   ._3DCommandSubOpcode                 =     29,  \
225610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
225710e230b6Smaya   .CommandSubType                      =      3,  \
225810e230b6Smaya   .CommandType                         =      3
225910e230b6Smaya
226096c5ddc4Srjsstruct GFX7_3DSTATE_DS {
226110e230b6Smaya   uint32_t                             DWordLength;
226210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
226310e230b6Smaya   uint32_t                             _3DCommandOpcode;
226410e230b6Smaya   uint32_t                             CommandSubType;
226510e230b6Smaya   uint32_t                             CommandType;
226610e230b6Smaya   uint64_t                             KernelStartPointer;
226710e230b6Smaya   bool                                 SoftwareExceptionEnable;
226810e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
226910e230b6Smaya   uint32_t                             FloatingPointMode;
227010e230b6Smaya#define IEEE754                                  0
227110e230b6Smaya#define Alternate                                1
227210e230b6Smaya   uint32_t                             BindingTableEntryCount;
227310e230b6Smaya   uint32_t                             SamplerCount;
227410e230b6Smaya#define NoSamplers                               0
227510e230b6Smaya#define _14Samplers                              1
227610e230b6Smaya#define _58Samplers                              2
227710e230b6Smaya#define _912Samplers                             3
227810e230b6Smaya#define _1316Samplers                            4
227910e230b6Smaya   bool                                 VectorMaskEnable;
228010e230b6Smaya   uint32_t                             SingleDomainPointDispatch;
228110e230b6Smaya   uint32_t                             PerThreadScratchSpace;
228210e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
228310e230b6Smaya   uint32_t                             PatchURBEntryReadOffset;
228410e230b6Smaya   uint32_t                             PatchURBEntryReadLength;
228510e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData;
228610e230b6Smaya   bool                                 Enable;
228710e230b6Smaya   bool                                 DSCacheDisable;
228810e230b6Smaya   bool                                 ComputeWCoordinateEnable;
228910e230b6Smaya   bool                                 StatisticsEnable;
229010e230b6Smaya   uint32_t                             MaximumNumberofThreads;
229110e230b6Smaya};
229210e230b6Smaya
229396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
229496c5ddc4SrjsGFX7_3DSTATE_DS_pack(__attribute__((unused)) __gen_user_data *data,
229510e230b6Smaya                     __attribute__((unused)) void * restrict dst,
229696c5ddc4Srjs                     __attribute__((unused)) const struct GFX7_3DSTATE_DS * restrict values)
229710e230b6Smaya{
229810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
229910e230b6Smaya
230010e230b6Smaya   dw[0] =
230110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
230210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
230310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
230410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
230510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
230610e230b6Smaya
230710e230b6Smaya   dw[1] =
230810e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 31);
230910e230b6Smaya
231010e230b6Smaya   dw[2] =
231110e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
231210e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
231310e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
231410e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
231510e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
231610e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
231710e230b6Smaya      __gen_uint(values->SingleDomainPointDispatch, 31, 31);
231810e230b6Smaya
231910e230b6Smaya   const uint32_t v3 =
232010e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
232196c5ddc4Srjs   dw[3] = __gen_address(data, &dw[3], values->ScratchSpaceBasePointer, v3, 10, 31);
232210e230b6Smaya
232310e230b6Smaya   dw[4] =
232410e230b6Smaya      __gen_uint(values->PatchURBEntryReadOffset, 4, 9) |
232510e230b6Smaya      __gen_uint(values->PatchURBEntryReadLength, 11, 17) |
232610e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
232710e230b6Smaya
232810e230b6Smaya   dw[5] =
232910e230b6Smaya      __gen_uint(values->Enable, 0, 0) |
233010e230b6Smaya      __gen_uint(values->DSCacheDisable, 1, 1) |
233110e230b6Smaya      __gen_uint(values->ComputeWCoordinateEnable, 2, 2) |
233210e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
233310e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 25, 31);
233410e230b6Smaya}
233510e230b6Smaya
233696c5ddc4Srjs#define GFX7_3DSTATE_GS_length                 7
233796c5ddc4Srjs#define GFX7_3DSTATE_GS_length_bias            2
233896c5ddc4Srjs#define GFX7_3DSTATE_GS_header                  \
233910e230b6Smaya   .DWordLength                         =      5,  \
234010e230b6Smaya   ._3DCommandSubOpcode                 =     17,  \
234110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
234210e230b6Smaya   .CommandSubType                      =      3,  \
234310e230b6Smaya   .CommandType                         =      3
234410e230b6Smaya
234596c5ddc4Srjsstruct GFX7_3DSTATE_GS {
234610e230b6Smaya   uint32_t                             DWordLength;
234710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
234810e230b6Smaya   uint32_t                             _3DCommandOpcode;
234910e230b6Smaya   uint32_t                             CommandSubType;
235010e230b6Smaya   uint32_t                             CommandType;
235110e230b6Smaya   uint64_t                             KernelStartPointer;
235210e230b6Smaya   bool                                 SoftwareExceptionEnable;
235310e230b6Smaya   bool                                 MaskStackExceptionEnable;
235410e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
235510e230b6Smaya   uint32_t                             FloatingPointMode;
235610e230b6Smaya#define IEEE754                                  0
235710e230b6Smaya#define alternate                                1
235810e230b6Smaya   uint32_t                             ThreadPriority;
235910e230b6Smaya#define NormalPriority                           0
236010e230b6Smaya#define HighPriority                             1
236110e230b6Smaya   uint32_t                             BindingTableEntryCount;
236210e230b6Smaya   uint32_t                             SamplerCount;
236310e230b6Smaya#define NoSamplers                               0
236410e230b6Smaya#define _14Samplers                              1
236510e230b6Smaya#define _58Samplers                              2
236610e230b6Smaya#define _912Samplers                             3
236710e230b6Smaya#define _1316Samplers                            4
236810e230b6Smaya   bool                                 VectorMaskEnable;
236910e230b6Smaya   bool                                 SingleProgramFlow;
237010e230b6Smaya   uint32_t                             PerThreadScratchSpace;
237110e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
237210e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData;
237310e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
237410e230b6Smaya   bool                                 IncludeVertexHandles;
237510e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
237696c5ddc4Srjs   enum GFX7_3D_Prim_Topo_Type          OutputTopology;
237710e230b6Smaya   uint32_t                             OutputVertexSize;
237810e230b6Smaya   bool                                 Enable;
237910e230b6Smaya   bool                                 DiscardAdjacency;
238010e230b6Smaya   uint32_t                             ReorderMode;
238110e230b6Smaya#define LEADING                                  0
238210e230b6Smaya#define TRAILING                                 1
238310e230b6Smaya   uint32_t                             Hint;
238410e230b6Smaya   bool                                 IncludePrimitiveID;
238510e230b6Smaya   uint32_t                             GSInvocationsIncrementValue;
238610e230b6Smaya   uint32_t                             StatisticsEnable;
238710e230b6Smaya   uint32_t                             DispatchMode;
238810e230b6Smaya#define DISPATCH_MODE_SINGLE                     0
238910e230b6Smaya#define DISPATCH_MODE_DUAL_INSTANCE              1
239010e230b6Smaya#define DISPATCH_MODE_DUAL_OBJECT                2
239110e230b6Smaya   uint32_t                             DefaultStreamID;
239210e230b6Smaya   uint32_t                             InstanceControl;
239310e230b6Smaya   uint32_t                             ControlDataHeaderSize;
239410e230b6Smaya   uint32_t                             ControlDataFormat;
239510e230b6Smaya#define GSCTL_CUT                                0
239610e230b6Smaya#define GSCTL_SID                                1
239710e230b6Smaya   uint32_t                             MaximumNumberofThreads;
239810e230b6Smaya   uint64_t                             SemaphoreHandle;
239910e230b6Smaya};
240010e230b6Smaya
240196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
240296c5ddc4SrjsGFX7_3DSTATE_GS_pack(__attribute__((unused)) __gen_user_data *data,
240310e230b6Smaya                     __attribute__((unused)) void * restrict dst,
240496c5ddc4Srjs                     __attribute__((unused)) const struct GFX7_3DSTATE_GS * restrict values)
240510e230b6Smaya{
240610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
240710e230b6Smaya
240810e230b6Smaya   dw[0] =
240910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
241010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
241110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
241210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
241310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
241410e230b6Smaya
241510e230b6Smaya   dw[1] =
241610e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 31);
241710e230b6Smaya
241810e230b6Smaya   dw[2] =
241910e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
242010e230b6Smaya      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
242110e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
242210e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
242310e230b6Smaya      __gen_uint(values->ThreadPriority, 17, 17) |
242410e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
242510e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
242610e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
242710e230b6Smaya      __gen_uint(values->SingleProgramFlow, 31, 31);
242810e230b6Smaya
242910e230b6Smaya   const uint32_t v3 =
243010e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
243196c5ddc4Srjs   dw[3] = __gen_address(data, &dw[3], values->ScratchSpaceBasePointer, v3, 10, 31);
243210e230b6Smaya
243310e230b6Smaya   dw[4] =
243410e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData, 0, 3) |
243510e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
243610e230b6Smaya      __gen_uint(values->IncludeVertexHandles, 10, 10) |
243710e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
243810e230b6Smaya      __gen_uint(values->OutputTopology, 17, 22) |
243910e230b6Smaya      __gen_uint(values->OutputVertexSize, 23, 28);
244010e230b6Smaya
244110e230b6Smaya   dw[5] =
244210e230b6Smaya      __gen_uint(values->Enable, 0, 0) |
244310e230b6Smaya      __gen_uint(values->DiscardAdjacency, 1, 1) |
244410e230b6Smaya      __gen_uint(values->ReorderMode, 2, 2) |
244510e230b6Smaya      __gen_uint(values->Hint, 3, 3) |
244610e230b6Smaya      __gen_uint(values->IncludePrimitiveID, 4, 4) |
244710e230b6Smaya      __gen_uint(values->GSInvocationsIncrementValue, 5, 9) |
244810e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
244910e230b6Smaya      __gen_uint(values->DispatchMode, 11, 12) |
245010e230b6Smaya      __gen_uint(values->DefaultStreamID, 13, 14) |
245110e230b6Smaya      __gen_uint(values->InstanceControl, 15, 19) |
245210e230b6Smaya      __gen_uint(values->ControlDataHeaderSize, 20, 23) |
245310e230b6Smaya      __gen_uint(values->ControlDataFormat, 24, 24) |
245410e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 25, 31);
245510e230b6Smaya
245610e230b6Smaya   dw[6] =
245710e230b6Smaya      __gen_offset(values->SemaphoreHandle, 0, 11);
245810e230b6Smaya}
245910e230b6Smaya
246096c5ddc4Srjs#define GFX7_3DSTATE_HIER_DEPTH_BUFFER_length      3
246196c5ddc4Srjs#define GFX7_3DSTATE_HIER_DEPTH_BUFFER_length_bias      2
246296c5ddc4Srjs#define GFX7_3DSTATE_HIER_DEPTH_BUFFER_header   \
246310e230b6Smaya   .DWordLength                         =      1,  \
246410e230b6Smaya   ._3DCommandSubOpcode                 =      7,  \
246510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
246610e230b6Smaya   .CommandSubType                      =      3,  \
246710e230b6Smaya   .CommandType                         =      3
246810e230b6Smaya
246996c5ddc4Srjsstruct GFX7_3DSTATE_HIER_DEPTH_BUFFER {
247010e230b6Smaya   uint32_t                             DWordLength;
247110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
247210e230b6Smaya   uint32_t                             _3DCommandOpcode;
247310e230b6Smaya   uint32_t                             CommandSubType;
247410e230b6Smaya   uint32_t                             CommandType;
247510e230b6Smaya   uint32_t                             SurfacePitch;
247610e230b6Smaya   uint32_t                             MOCS;
247710e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
247810e230b6Smaya};
247910e230b6Smaya
248096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
248196c5ddc4SrjsGFX7_3DSTATE_HIER_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
248210e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
248396c5ddc4Srjs                                    __attribute__((unused)) const struct GFX7_3DSTATE_HIER_DEPTH_BUFFER * restrict values)
248410e230b6Smaya{
248510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
248610e230b6Smaya
248710e230b6Smaya   dw[0] =
248810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
248910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
249010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
249110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
249210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
249310e230b6Smaya
249410e230b6Smaya   dw[1] =
249510e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 16) |
249610e230b6Smaya      __gen_uint(values->MOCS, 25, 28);
249710e230b6Smaya
249896c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 0, 31);
249910e230b6Smaya}
250010e230b6Smaya
250196c5ddc4Srjs#define GFX7_3DSTATE_HS_length                 7
250296c5ddc4Srjs#define GFX7_3DSTATE_HS_length_bias            2
250396c5ddc4Srjs#define GFX7_3DSTATE_HS_header                  \
250410e230b6Smaya   .DWordLength                         =      5,  \
250510e230b6Smaya   ._3DCommandSubOpcode                 =     27,  \
250610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
250710e230b6Smaya   .CommandSubType                      =      3,  \
250810e230b6Smaya   .CommandType                         =      3
250910e230b6Smaya
251096c5ddc4Srjsstruct GFX7_3DSTATE_HS {
251110e230b6Smaya   uint32_t                             DWordLength;
251210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
251310e230b6Smaya   uint32_t                             _3DCommandOpcode;
251410e230b6Smaya   uint32_t                             CommandSubType;
251510e230b6Smaya   uint32_t                             CommandType;
251610e230b6Smaya   uint32_t                             MaximumNumberofThreads;
251710e230b6Smaya   bool                                 SoftwareExceptionEnable;
251810e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
251910e230b6Smaya   uint32_t                             FloatingPointMode;
252010e230b6Smaya#define IEEE754                                  0
252110e230b6Smaya#define alternate                                1
252210e230b6Smaya   uint32_t                             BindingTableEntryCount;
252310e230b6Smaya   uint32_t                             SamplerCount;
252410e230b6Smaya#define NoSamplers                               0
252510e230b6Smaya#define _14Samplers                              1
252610e230b6Smaya#define _58Samplers                              2
252710e230b6Smaya#define _912Samplers                             3
252810e230b6Smaya#define _1316Samplers                            4
252910e230b6Smaya   uint32_t                             InstanceCount;
253010e230b6Smaya   bool                                 StatisticsEnable;
253110e230b6Smaya   bool                                 Enable;
253210e230b6Smaya   uint64_t                             KernelStartPointer;
253310e230b6Smaya   uint32_t                             PerThreadScratchSpace;
253410e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
253510e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
253610e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
253710e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData;
253810e230b6Smaya   bool                                 IncludeVertexHandles;
253910e230b6Smaya   bool                                 VectorMaskEnable;
254010e230b6Smaya   bool                                 SingleProgramFlow;
254110e230b6Smaya   uint64_t                             SemaphoreHandle;
254210e230b6Smaya};
254310e230b6Smaya
254496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
254596c5ddc4SrjsGFX7_3DSTATE_HS_pack(__attribute__((unused)) __gen_user_data *data,
254610e230b6Smaya                     __attribute__((unused)) void * restrict dst,
254796c5ddc4Srjs                     __attribute__((unused)) const struct GFX7_3DSTATE_HS * restrict values)
254810e230b6Smaya{
254910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
255010e230b6Smaya
255110e230b6Smaya   dw[0] =
255210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
255310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
255410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
255510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
255610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
255710e230b6Smaya
255810e230b6Smaya   dw[1] =
255910e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 0, 6) |
256010e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
256110e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
256210e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
256310e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
256410e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29);
256510e230b6Smaya
256610e230b6Smaya   dw[2] =
256710e230b6Smaya      __gen_uint(values->InstanceCount, 0, 3) |
256810e230b6Smaya      __gen_uint(values->StatisticsEnable, 29, 29) |
256910e230b6Smaya      __gen_uint(values->Enable, 31, 31);
257010e230b6Smaya
257110e230b6Smaya   dw[3] =
257210e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 31);
257310e230b6Smaya
257410e230b6Smaya   const uint32_t v4 =
257510e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
257696c5ddc4Srjs   dw[4] = __gen_address(data, &dw[4], values->ScratchSpaceBasePointer, v4, 10, 31);
257710e230b6Smaya
257810e230b6Smaya   dw[5] =
257910e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
258010e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
258110e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData, 19, 23) |
258210e230b6Smaya      __gen_uint(values->IncludeVertexHandles, 24, 24) |
258310e230b6Smaya      __gen_uint(values->VectorMaskEnable, 26, 26) |
258410e230b6Smaya      __gen_uint(values->SingleProgramFlow, 27, 27);
258510e230b6Smaya
258610e230b6Smaya   dw[6] =
258710e230b6Smaya      __gen_offset(values->SemaphoreHandle, 0, 11);
258810e230b6Smaya}
258910e230b6Smaya
259096c5ddc4Srjs#define GFX7_3DSTATE_INDEX_BUFFER_length       3
259196c5ddc4Srjs#define GFX7_3DSTATE_INDEX_BUFFER_length_bias      2
259296c5ddc4Srjs#define GFX7_3DSTATE_INDEX_BUFFER_header        \
259310e230b6Smaya   .DWordLength                         =      1,  \
259410e230b6Smaya   ._3DCommandSubOpcode                 =     10,  \
259510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
259610e230b6Smaya   .CommandSubType                      =      3,  \
259710e230b6Smaya   .CommandType                         =      3
259810e230b6Smaya
259996c5ddc4Srjsstruct GFX7_3DSTATE_INDEX_BUFFER {
260010e230b6Smaya   uint32_t                             DWordLength;
260110e230b6Smaya   uint32_t                             IndexFormat;
260210e230b6Smaya#define INDEX_BYTE                               0
260310e230b6Smaya#define INDEX_WORD                               1
260410e230b6Smaya#define INDEX_DWORD                              2
260510e230b6Smaya   bool                                 CutIndexEnable;
260610e230b6Smaya   uint32_t                             MOCS;
260710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
260810e230b6Smaya   uint32_t                             _3DCommandOpcode;
260910e230b6Smaya   uint32_t                             CommandSubType;
261010e230b6Smaya   uint32_t                             CommandType;
261110e230b6Smaya   __gen_address_type                   BufferStartingAddress;
261210e230b6Smaya   __gen_address_type                   BufferEndingAddress;
261310e230b6Smaya};
261410e230b6Smaya
261596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
261696c5ddc4SrjsGFX7_3DSTATE_INDEX_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
261710e230b6Smaya                               __attribute__((unused)) void * restrict dst,
261896c5ddc4Srjs                               __attribute__((unused)) const struct GFX7_3DSTATE_INDEX_BUFFER * restrict values)
261910e230b6Smaya{
262010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
262110e230b6Smaya
262210e230b6Smaya   dw[0] =
262310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
262410e230b6Smaya      __gen_uint(values->IndexFormat, 8, 9) |
262510e230b6Smaya      __gen_uint(values->CutIndexEnable, 10, 10) |
262610e230b6Smaya      __gen_uint(values->MOCS, 12, 15) |
262710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
262810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
262910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
263010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
263110e230b6Smaya
263296c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->BufferStartingAddress, 0, 0, 31);
263310e230b6Smaya
263496c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->BufferEndingAddress, 0, 0, 31);
263510e230b6Smaya}
263610e230b6Smaya
263796c5ddc4Srjs#define GFX7_3DSTATE_LINE_STIPPLE_length       3
263896c5ddc4Srjs#define GFX7_3DSTATE_LINE_STIPPLE_length_bias      2
263996c5ddc4Srjs#define GFX7_3DSTATE_LINE_STIPPLE_header        \
264010e230b6Smaya   .DWordLength                         =      1,  \
264110e230b6Smaya   ._3DCommandSubOpcode                 =      8,  \
264210e230b6Smaya   ._3DCommandOpcode                    =      1,  \
264310e230b6Smaya   .CommandSubType                      =      3,  \
264410e230b6Smaya   .CommandType                         =      3
264510e230b6Smaya
264696c5ddc4Srjsstruct GFX7_3DSTATE_LINE_STIPPLE {
264710e230b6Smaya   uint32_t                             DWordLength;
264810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
264910e230b6Smaya   uint32_t                             _3DCommandOpcode;
265010e230b6Smaya   uint32_t                             CommandSubType;
265110e230b6Smaya   uint32_t                             CommandType;
265210e230b6Smaya   uint32_t                             LineStipplePattern;
265310e230b6Smaya   uint32_t                             CurrentStippleIndex;
265410e230b6Smaya   uint32_t                             CurrentRepeatCounter;
265510e230b6Smaya   bool                                 ModifyEnableCurrentRepeatCounterCurrentStippleIndex;
265610e230b6Smaya   uint32_t                             LineStippleRepeatCount;
265710e230b6Smaya   float                                LineStippleInverseRepeatCount;
265810e230b6Smaya};
265910e230b6Smaya
266096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
266196c5ddc4SrjsGFX7_3DSTATE_LINE_STIPPLE_pack(__attribute__((unused)) __gen_user_data *data,
266210e230b6Smaya                               __attribute__((unused)) void * restrict dst,
266396c5ddc4Srjs                               __attribute__((unused)) const struct GFX7_3DSTATE_LINE_STIPPLE * restrict values)
266410e230b6Smaya{
266510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
266610e230b6Smaya
266710e230b6Smaya   dw[0] =
266810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
266910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
267010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
267110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
267210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
267310e230b6Smaya
267410e230b6Smaya   dw[1] =
267510e230b6Smaya      __gen_uint(values->LineStipplePattern, 0, 15) |
267610e230b6Smaya      __gen_uint(values->CurrentStippleIndex, 16, 19) |
267710e230b6Smaya      __gen_uint(values->CurrentRepeatCounter, 21, 29) |
267810e230b6Smaya      __gen_uint(values->ModifyEnableCurrentRepeatCounterCurrentStippleIndex, 31, 31);
267910e230b6Smaya
268010e230b6Smaya   dw[2] =
268110e230b6Smaya      __gen_uint(values->LineStippleRepeatCount, 0, 8) |
268210e230b6Smaya      __gen_ufixed(values->LineStippleInverseRepeatCount, 15, 31, 16);
268310e230b6Smaya}
268410e230b6Smaya
268596c5ddc4Srjs#define GFX7_3DSTATE_MONOFILTER_SIZE_length      2
268696c5ddc4Srjs#define GFX7_3DSTATE_MONOFILTER_SIZE_length_bias      2
268796c5ddc4Srjs#define GFX7_3DSTATE_MONOFILTER_SIZE_header     \
268810e230b6Smaya   .DWordLength                         =      0,  \
268910e230b6Smaya   ._3DCommandSubOpcode                 =     17,  \
269010e230b6Smaya   ._3DCommandOpcode                    =      1,  \
269110e230b6Smaya   .CommandSubType                      =      3,  \
269210e230b6Smaya   .CommandType                         =      3
269310e230b6Smaya
269496c5ddc4Srjsstruct GFX7_3DSTATE_MONOFILTER_SIZE {
269510e230b6Smaya   uint32_t                             DWordLength;
269610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
269710e230b6Smaya   uint32_t                             _3DCommandOpcode;
269810e230b6Smaya   uint32_t                             CommandSubType;
269910e230b6Smaya   uint32_t                             CommandType;
270010e230b6Smaya   uint32_t                             MonochromeFilterHeight;
270110e230b6Smaya   uint32_t                             MonochromeFilterWidth;
270210e230b6Smaya};
270310e230b6Smaya
270496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
270596c5ddc4SrjsGFX7_3DSTATE_MONOFILTER_SIZE_pack(__attribute__((unused)) __gen_user_data *data,
270610e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
270796c5ddc4Srjs                                  __attribute__((unused)) const struct GFX7_3DSTATE_MONOFILTER_SIZE * restrict values)
270810e230b6Smaya{
270910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
271010e230b6Smaya
271110e230b6Smaya   dw[0] =
271210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
271310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
271410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
271510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
271610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
271710e230b6Smaya
271810e230b6Smaya   dw[1] =
271910e230b6Smaya      __gen_uint(values->MonochromeFilterHeight, 0, 2) |
272010e230b6Smaya      __gen_uint(values->MonochromeFilterWidth, 3, 5);
272110e230b6Smaya}
272210e230b6Smaya
272396c5ddc4Srjs#define GFX7_3DSTATE_MULTISAMPLE_length        4
272496c5ddc4Srjs#define GFX7_3DSTATE_MULTISAMPLE_length_bias      2
272596c5ddc4Srjs#define GFX7_3DSTATE_MULTISAMPLE_header         \
272610e230b6Smaya   .DWordLength                         =      2,  \
272710e230b6Smaya   ._3DCommandSubOpcode                 =     13,  \
272810e230b6Smaya   ._3DCommandOpcode                    =      1,  \
272910e230b6Smaya   .CommandSubType                      =      3,  \
273010e230b6Smaya   .CommandType                         =      3
273110e230b6Smaya
273296c5ddc4Srjsstruct GFX7_3DSTATE_MULTISAMPLE {
273310e230b6Smaya   uint32_t                             DWordLength;
273410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
273510e230b6Smaya   uint32_t                             _3DCommandOpcode;
273610e230b6Smaya   uint32_t                             CommandSubType;
273710e230b6Smaya   uint32_t                             CommandType;
273810e230b6Smaya   uint32_t                             NumberofMultisamples;
273910e230b6Smaya#define NUMSAMPLES_1                             0
274010e230b6Smaya#define NUMSAMPLES_4                             2
274110e230b6Smaya#define NUMSAMPLES_8                             3
274210e230b6Smaya   uint32_t                             PixelLocation;
274310e230b6Smaya#define CENTER                                   0
274410e230b6Smaya#define UL_CORNER                                1
274510e230b6Smaya   float                                Sample0YOffset;
274610e230b6Smaya   float                                Sample0XOffset;
274710e230b6Smaya   float                                Sample1YOffset;
274810e230b6Smaya   float                                Sample1XOffset;
274910e230b6Smaya   float                                Sample2YOffset;
275010e230b6Smaya   float                                Sample2XOffset;
275110e230b6Smaya   float                                Sample3YOffset;
275210e230b6Smaya   float                                Sample3XOffset;
275310e230b6Smaya   float                                Sample4YOffset;
275410e230b6Smaya   float                                Sample4XOffset;
275510e230b6Smaya   float                                Sample5YOffset;
275610e230b6Smaya   float                                Sample5XOffset;
275710e230b6Smaya   float                                Sample6YOffset;
275810e230b6Smaya   float                                Sample6XOffset;
275910e230b6Smaya   float                                Sample7YOffset;
276010e230b6Smaya   float                                Sample7XOffset;
276110e230b6Smaya};
276210e230b6Smaya
276396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
276496c5ddc4SrjsGFX7_3DSTATE_MULTISAMPLE_pack(__attribute__((unused)) __gen_user_data *data,
276510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
276696c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_3DSTATE_MULTISAMPLE * restrict values)
276710e230b6Smaya{
276810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
276910e230b6Smaya
277010e230b6Smaya   dw[0] =
277110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
277210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
277310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
277410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
277510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
277610e230b6Smaya
277710e230b6Smaya   dw[1] =
277810e230b6Smaya      __gen_uint(values->NumberofMultisamples, 1, 3) |
277910e230b6Smaya      __gen_uint(values->PixelLocation, 4, 4);
278010e230b6Smaya
278110e230b6Smaya   dw[2] =
278210e230b6Smaya      __gen_ufixed(values->Sample0YOffset, 0, 3, 4) |
278310e230b6Smaya      __gen_ufixed(values->Sample0XOffset, 4, 7, 4) |
278410e230b6Smaya      __gen_ufixed(values->Sample1YOffset, 8, 11, 4) |
278510e230b6Smaya      __gen_ufixed(values->Sample1XOffset, 12, 15, 4) |
278610e230b6Smaya      __gen_ufixed(values->Sample2YOffset, 16, 19, 4) |
278710e230b6Smaya      __gen_ufixed(values->Sample2XOffset, 20, 23, 4) |
278810e230b6Smaya      __gen_ufixed(values->Sample3YOffset, 24, 27, 4) |
278910e230b6Smaya      __gen_ufixed(values->Sample3XOffset, 28, 31, 4);
279010e230b6Smaya
279110e230b6Smaya   dw[3] =
279210e230b6Smaya      __gen_ufixed(values->Sample4YOffset, 0, 3, 4) |
279310e230b6Smaya      __gen_ufixed(values->Sample4XOffset, 4, 7, 4) |
279410e230b6Smaya      __gen_ufixed(values->Sample5YOffset, 8, 11, 4) |
279510e230b6Smaya      __gen_ufixed(values->Sample5XOffset, 12, 15, 4) |
279610e230b6Smaya      __gen_ufixed(values->Sample6YOffset, 16, 19, 4) |
279710e230b6Smaya      __gen_ufixed(values->Sample6XOffset, 20, 23, 4) |
279810e230b6Smaya      __gen_ufixed(values->Sample7YOffset, 24, 27, 4) |
279910e230b6Smaya      __gen_ufixed(values->Sample7XOffset, 28, 31, 4);
280010e230b6Smaya}
280110e230b6Smaya
280296c5ddc4Srjs#define GFX7_3DSTATE_POLY_STIPPLE_OFFSET_length      2
280396c5ddc4Srjs#define GFX7_3DSTATE_POLY_STIPPLE_OFFSET_length_bias      2
280496c5ddc4Srjs#define GFX7_3DSTATE_POLY_STIPPLE_OFFSET_header \
280510e230b6Smaya   .DWordLength                         =      0,  \
280610e230b6Smaya   ._3DCommandSubOpcode                 =      6,  \
280710e230b6Smaya   ._3DCommandOpcode                    =      1,  \
280810e230b6Smaya   .CommandSubType                      =      3,  \
280910e230b6Smaya   .CommandType                         =      3
281010e230b6Smaya
281196c5ddc4Srjsstruct GFX7_3DSTATE_POLY_STIPPLE_OFFSET {
281210e230b6Smaya   uint32_t                             DWordLength;
281310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
281410e230b6Smaya   uint32_t                             _3DCommandOpcode;
281510e230b6Smaya   uint32_t                             CommandSubType;
281610e230b6Smaya   uint32_t                             CommandType;
281710e230b6Smaya   uint32_t                             PolygonStippleYOffset;
281810e230b6Smaya   uint32_t                             PolygonStippleXOffset;
281910e230b6Smaya};
282010e230b6Smaya
282196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
282296c5ddc4SrjsGFX7_3DSTATE_POLY_STIPPLE_OFFSET_pack(__attribute__((unused)) __gen_user_data *data,
282310e230b6Smaya                                      __attribute__((unused)) void * restrict dst,
282496c5ddc4Srjs                                      __attribute__((unused)) const struct GFX7_3DSTATE_POLY_STIPPLE_OFFSET * restrict values)
282510e230b6Smaya{
282610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
282710e230b6Smaya
282810e230b6Smaya   dw[0] =
282910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
283010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
283110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
283210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
283310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
283410e230b6Smaya
283510e230b6Smaya   dw[1] =
283610e230b6Smaya      __gen_uint(values->PolygonStippleYOffset, 0, 4) |
283710e230b6Smaya      __gen_uint(values->PolygonStippleXOffset, 8, 12);
283810e230b6Smaya}
283910e230b6Smaya
284096c5ddc4Srjs#define GFX7_3DSTATE_POLY_STIPPLE_PATTERN_length     33
284196c5ddc4Srjs#define GFX7_3DSTATE_POLY_STIPPLE_PATTERN_length_bias      2
284296c5ddc4Srjs#define GFX7_3DSTATE_POLY_STIPPLE_PATTERN_header\
284310e230b6Smaya   .DWordLength                         =     31,  \
284410e230b6Smaya   ._3DCommandSubOpcode                 =      7,  \
284510e230b6Smaya   ._3DCommandOpcode                    =      1,  \
284610e230b6Smaya   .CommandSubType                      =      3,  \
284710e230b6Smaya   .CommandType                         =      3
284810e230b6Smaya
284996c5ddc4Srjsstruct GFX7_3DSTATE_POLY_STIPPLE_PATTERN {
285010e230b6Smaya   uint32_t                             DWordLength;
285110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
285210e230b6Smaya   uint32_t                             _3DCommandOpcode;
285310e230b6Smaya   uint32_t                             CommandSubType;
285410e230b6Smaya   uint32_t                             CommandType;
285510e230b6Smaya   uint32_t                             PatternRow[32];
285610e230b6Smaya};
285710e230b6Smaya
285896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
285996c5ddc4SrjsGFX7_3DSTATE_POLY_STIPPLE_PATTERN_pack(__attribute__((unused)) __gen_user_data *data,
286010e230b6Smaya                                       __attribute__((unused)) void * restrict dst,
286196c5ddc4Srjs                                       __attribute__((unused)) const struct GFX7_3DSTATE_POLY_STIPPLE_PATTERN * restrict values)
286210e230b6Smaya{
286310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
286410e230b6Smaya
286510e230b6Smaya   dw[0] =
286610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
286710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
286810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
286910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
287010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
287110e230b6Smaya
287210e230b6Smaya   dw[1] =
287310e230b6Smaya      __gen_uint(values->PatternRow[0], 0, 31);
287410e230b6Smaya
287510e230b6Smaya   dw[2] =
287610e230b6Smaya      __gen_uint(values->PatternRow[1], 0, 31);
287710e230b6Smaya
287810e230b6Smaya   dw[3] =
287910e230b6Smaya      __gen_uint(values->PatternRow[2], 0, 31);
288010e230b6Smaya
288110e230b6Smaya   dw[4] =
288210e230b6Smaya      __gen_uint(values->PatternRow[3], 0, 31);
288310e230b6Smaya
288410e230b6Smaya   dw[5] =
288510e230b6Smaya      __gen_uint(values->PatternRow[4], 0, 31);
288610e230b6Smaya
288710e230b6Smaya   dw[6] =
288810e230b6Smaya      __gen_uint(values->PatternRow[5], 0, 31);
288910e230b6Smaya
289010e230b6Smaya   dw[7] =
289110e230b6Smaya      __gen_uint(values->PatternRow[6], 0, 31);
289210e230b6Smaya
289310e230b6Smaya   dw[8] =
289410e230b6Smaya      __gen_uint(values->PatternRow[7], 0, 31);
289510e230b6Smaya
289610e230b6Smaya   dw[9] =
289710e230b6Smaya      __gen_uint(values->PatternRow[8], 0, 31);
289810e230b6Smaya
289910e230b6Smaya   dw[10] =
290010e230b6Smaya      __gen_uint(values->PatternRow[9], 0, 31);
290110e230b6Smaya
290210e230b6Smaya   dw[11] =
290310e230b6Smaya      __gen_uint(values->PatternRow[10], 0, 31);
290410e230b6Smaya
290510e230b6Smaya   dw[12] =
290610e230b6Smaya      __gen_uint(values->PatternRow[11], 0, 31);
290710e230b6Smaya
290810e230b6Smaya   dw[13] =
290910e230b6Smaya      __gen_uint(values->PatternRow[12], 0, 31);
291010e230b6Smaya
291110e230b6Smaya   dw[14] =
291210e230b6Smaya      __gen_uint(values->PatternRow[13], 0, 31);
291310e230b6Smaya
291410e230b6Smaya   dw[15] =
291510e230b6Smaya      __gen_uint(values->PatternRow[14], 0, 31);
291610e230b6Smaya
291710e230b6Smaya   dw[16] =
291810e230b6Smaya      __gen_uint(values->PatternRow[15], 0, 31);
291910e230b6Smaya
292010e230b6Smaya   dw[17] =
292110e230b6Smaya      __gen_uint(values->PatternRow[16], 0, 31);
292210e230b6Smaya
292310e230b6Smaya   dw[18] =
292410e230b6Smaya      __gen_uint(values->PatternRow[17], 0, 31);
292510e230b6Smaya
292610e230b6Smaya   dw[19] =
292710e230b6Smaya      __gen_uint(values->PatternRow[18], 0, 31);
292810e230b6Smaya
292910e230b6Smaya   dw[20] =
293010e230b6Smaya      __gen_uint(values->PatternRow[19], 0, 31);
293110e230b6Smaya
293210e230b6Smaya   dw[21] =
293310e230b6Smaya      __gen_uint(values->PatternRow[20], 0, 31);
293410e230b6Smaya
293510e230b6Smaya   dw[22] =
293610e230b6Smaya      __gen_uint(values->PatternRow[21], 0, 31);
293710e230b6Smaya
293810e230b6Smaya   dw[23] =
293910e230b6Smaya      __gen_uint(values->PatternRow[22], 0, 31);
294010e230b6Smaya
294110e230b6Smaya   dw[24] =
294210e230b6Smaya      __gen_uint(values->PatternRow[23], 0, 31);
294310e230b6Smaya
294410e230b6Smaya   dw[25] =
294510e230b6Smaya      __gen_uint(values->PatternRow[24], 0, 31);
294610e230b6Smaya
294710e230b6Smaya   dw[26] =
294810e230b6Smaya      __gen_uint(values->PatternRow[25], 0, 31);
294910e230b6Smaya
295010e230b6Smaya   dw[27] =
295110e230b6Smaya      __gen_uint(values->PatternRow[26], 0, 31);
295210e230b6Smaya
295310e230b6Smaya   dw[28] =
295410e230b6Smaya      __gen_uint(values->PatternRow[27], 0, 31);
295510e230b6Smaya
295610e230b6Smaya   dw[29] =
295710e230b6Smaya      __gen_uint(values->PatternRow[28], 0, 31);
295810e230b6Smaya
295910e230b6Smaya   dw[30] =
296010e230b6Smaya      __gen_uint(values->PatternRow[29], 0, 31);
296110e230b6Smaya
296210e230b6Smaya   dw[31] =
296310e230b6Smaya      __gen_uint(values->PatternRow[30], 0, 31);
296410e230b6Smaya
296510e230b6Smaya   dw[32] =
296610e230b6Smaya      __gen_uint(values->PatternRow[31], 0, 31);
296710e230b6Smaya}
296810e230b6Smaya
296996c5ddc4Srjs#define GFX7_3DSTATE_PS_length                 8
297096c5ddc4Srjs#define GFX7_3DSTATE_PS_length_bias            2
297196c5ddc4Srjs#define GFX7_3DSTATE_PS_header                  \
297210e230b6Smaya   .DWordLength                         =      6,  \
297310e230b6Smaya   ._3DCommandSubOpcode                 =     32,  \
297410e230b6Smaya   ._3DCommandOpcode                    =      0,  \
297510e230b6Smaya   .CommandSubType                      =      3,  \
297610e230b6Smaya   .CommandType                         =      3
297710e230b6Smaya
297896c5ddc4Srjsstruct GFX7_3DSTATE_PS {
297910e230b6Smaya   uint32_t                             DWordLength;
298010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
298110e230b6Smaya   uint32_t                             _3DCommandOpcode;
298210e230b6Smaya   uint32_t                             CommandSubType;
298310e230b6Smaya   uint32_t                             CommandType;
298410e230b6Smaya   uint64_t                             KernelStartPointer0;
298510e230b6Smaya   bool                                 SoftwareExceptionEnable;
298610e230b6Smaya   bool                                 MaskStackExceptionEnable;
298710e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
298810e230b6Smaya   uint32_t                             RoundingMode;
298910e230b6Smaya#define RTNE                                     0
299010e230b6Smaya#define RU                                       1
299110e230b6Smaya#define RD                                       2
299210e230b6Smaya#define RTZ                                      3
299310e230b6Smaya   uint32_t                             FloatingPointMode;
299410e230b6Smaya#define IEEE745                                  0
299510e230b6Smaya#define Alt                                      1
299610e230b6Smaya   uint32_t                             BindingTableEntryCount;
299710e230b6Smaya   uint32_t                             DenormalMode;
299810e230b6Smaya#define FTZ                                      0
299910e230b6Smaya#define RET                                      1
300010e230b6Smaya   uint32_t                             SamplerCount;
300110e230b6Smaya   bool                                 VectorMaskEnable;
300210e230b6Smaya   bool                                 SingleProgramFlow;
300310e230b6Smaya   uint32_t                             PerThreadScratchSpace;
300410e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
300510e230b6Smaya   bool                                 _8PixelDispatchEnable;
300610e230b6Smaya   bool                                 _16PixelDispatchEnable;
300710e230b6Smaya   bool                                 _32PixelDispatchEnable;
300810e230b6Smaya   uint32_t                             PositionXYOffsetSelect;
300910e230b6Smaya#define POSOFFSET_NONE                           0
301010e230b6Smaya#define POSOFFSET_CENTROID                       2
301110e230b6Smaya#define POSOFFSET_SAMPLE                         3
301210e230b6Smaya   bool                                 RenderTargetResolveEnable;
301310e230b6Smaya   bool                                 DualSourceBlendEnable;
301410e230b6Smaya   bool                                 RenderTargetFastClearEnable;
301510e230b6Smaya   bool                                 oMaskPresenttoRenderTarget;
301610e230b6Smaya   bool                                 AttributeEnable;
301710e230b6Smaya   bool                                 PushConstantEnable;
301810e230b6Smaya   uint32_t                             MaximumNumberofThreads;
301910e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForConstantSetupData2;
302010e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForConstantSetupData1;
302110e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForConstantSetupData0;
302210e230b6Smaya   uint64_t                             KernelStartPointer1;
302310e230b6Smaya   uint64_t                             KernelStartPointer2;
302410e230b6Smaya};
302510e230b6Smaya
302696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
302796c5ddc4SrjsGFX7_3DSTATE_PS_pack(__attribute__((unused)) __gen_user_data *data,
302810e230b6Smaya                     __attribute__((unused)) void * restrict dst,
302996c5ddc4Srjs                     __attribute__((unused)) const struct GFX7_3DSTATE_PS * restrict values)
303010e230b6Smaya{
303110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
303210e230b6Smaya
303310e230b6Smaya   dw[0] =
303410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
303510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
303610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
303710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
303810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
303910e230b6Smaya
304010e230b6Smaya   dw[1] =
304110e230b6Smaya      __gen_offset(values->KernelStartPointer0, 6, 31);
304210e230b6Smaya
304310e230b6Smaya   dw[2] =
304410e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
304510e230b6Smaya      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
304610e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
304710e230b6Smaya      __gen_uint(values->RoundingMode, 14, 15) |
304810e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
304910e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
305010e230b6Smaya      __gen_uint(values->DenormalMode, 26, 26) |
305110e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
305210e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
305310e230b6Smaya      __gen_uint(values->SingleProgramFlow, 31, 31);
305410e230b6Smaya
305510e230b6Smaya   const uint32_t v3 =
305610e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
305796c5ddc4Srjs   dw[3] = __gen_address(data, &dw[3], values->ScratchSpaceBasePointer, v3, 10, 31);
305810e230b6Smaya
305910e230b6Smaya   dw[4] =
306010e230b6Smaya      __gen_uint(values->_8PixelDispatchEnable, 0, 0) |
306110e230b6Smaya      __gen_uint(values->_16PixelDispatchEnable, 1, 1) |
306210e230b6Smaya      __gen_uint(values->_32PixelDispatchEnable, 2, 2) |
306310e230b6Smaya      __gen_uint(values->PositionXYOffsetSelect, 3, 4) |
306410e230b6Smaya      __gen_uint(values->RenderTargetResolveEnable, 6, 6) |
306510e230b6Smaya      __gen_uint(values->DualSourceBlendEnable, 7, 7) |
306610e230b6Smaya      __gen_uint(values->RenderTargetFastClearEnable, 8, 8) |
306710e230b6Smaya      __gen_uint(values->oMaskPresenttoRenderTarget, 9, 9) |
306810e230b6Smaya      __gen_uint(values->AttributeEnable, 10, 10) |
306910e230b6Smaya      __gen_uint(values->PushConstantEnable, 11, 11) |
307010e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 24, 31);
307110e230b6Smaya
307210e230b6Smaya   dw[5] =
307310e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData2, 0, 6) |
307410e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData1, 8, 14) |
307510e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData0, 16, 22);
307610e230b6Smaya
307710e230b6Smaya   dw[6] =
307810e230b6Smaya      __gen_offset(values->KernelStartPointer1, 6, 31);
307910e230b6Smaya
308010e230b6Smaya   dw[7] =
308110e230b6Smaya      __gen_offset(values->KernelStartPointer2, 6, 31);
308210e230b6Smaya}
308310e230b6Smaya
308496c5ddc4Srjs#define GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_DS_length      2
308596c5ddc4Srjs#define GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_DS_length_bias      2
308696c5ddc4Srjs#define GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_DS_header\
308710e230b6Smaya   .DWordLength                         =      0,  \
308810e230b6Smaya   ._3DCommandSubOpcode                 =     20,  \
308910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
309010e230b6Smaya   .CommandSubType                      =      3,  \
309110e230b6Smaya   .CommandType                         =      3
309210e230b6Smaya
309396c5ddc4Srjsstruct GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_DS {
309410e230b6Smaya   uint32_t                             DWordLength;
309510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
309610e230b6Smaya   uint32_t                             _3DCommandOpcode;
309710e230b6Smaya   uint32_t                             CommandSubType;
309810e230b6Smaya   uint32_t                             CommandType;
309910e230b6Smaya   uint32_t                             ConstantBufferSize;
310010e230b6Smaya#define _0KB                                     0
310110e230b6Smaya   uint32_t                             ConstantBufferOffset;
310210e230b6Smaya#define _0KB                                     0
310310e230b6Smaya};
310410e230b6Smaya
310596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
310696c5ddc4SrjsGFX7_3DSTATE_PUSH_CONSTANT_ALLOC_DS_pack(__attribute__((unused)) __gen_user_data *data,
310710e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
310896c5ddc4Srjs                                         __attribute__((unused)) const struct GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_DS * restrict values)
310910e230b6Smaya{
311010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
311110e230b6Smaya
311210e230b6Smaya   dw[0] =
311310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
311410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
311510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
311610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
311710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
311810e230b6Smaya
311910e230b6Smaya   dw[1] =
312010e230b6Smaya      __gen_uint(values->ConstantBufferSize, 0, 4) |
312110e230b6Smaya      __gen_uint(values->ConstantBufferOffset, 16, 19);
312210e230b6Smaya}
312310e230b6Smaya
312496c5ddc4Srjs#define GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_GS_length      2
312596c5ddc4Srjs#define GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_GS_length_bias      2
312696c5ddc4Srjs#define GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_GS_header\
312710e230b6Smaya   .DWordLength                         =      0,  \
312810e230b6Smaya   ._3DCommandSubOpcode                 =     21,  \
312910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
313010e230b6Smaya   .CommandSubType                      =      3,  \
313110e230b6Smaya   .CommandType                         =      3
313210e230b6Smaya
313396c5ddc4Srjsstruct GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_GS {
313410e230b6Smaya   uint32_t                             DWordLength;
313510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
313610e230b6Smaya   uint32_t                             _3DCommandOpcode;
313710e230b6Smaya   uint32_t                             CommandSubType;
313810e230b6Smaya   uint32_t                             CommandType;
313910e230b6Smaya   uint32_t                             ConstantBufferSize;
314010e230b6Smaya#define _0KB                                     0
314110e230b6Smaya   uint32_t                             ConstantBufferOffset;
314210e230b6Smaya#define _0KB                                     0
314310e230b6Smaya};
314410e230b6Smaya
314596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
314696c5ddc4SrjsGFX7_3DSTATE_PUSH_CONSTANT_ALLOC_GS_pack(__attribute__((unused)) __gen_user_data *data,
314710e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
314896c5ddc4Srjs                                         __attribute__((unused)) const struct GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_GS * restrict values)
314910e230b6Smaya{
315010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
315110e230b6Smaya
315210e230b6Smaya   dw[0] =
315310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
315410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
315510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
315610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
315710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
315810e230b6Smaya
315910e230b6Smaya   dw[1] =
316010e230b6Smaya      __gen_uint(values->ConstantBufferSize, 0, 4) |
316110e230b6Smaya      __gen_uint(values->ConstantBufferOffset, 16, 19);
316210e230b6Smaya}
316310e230b6Smaya
316496c5ddc4Srjs#define GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_HS_length      2
316596c5ddc4Srjs#define GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_HS_length_bias      2
316696c5ddc4Srjs#define GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_HS_header\
316710e230b6Smaya   .DWordLength                         =      0,  \
316810e230b6Smaya   ._3DCommandSubOpcode                 =     19,  \
316910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
317010e230b6Smaya   .CommandSubType                      =      3,  \
317110e230b6Smaya   .CommandType                         =      3
317210e230b6Smaya
317396c5ddc4Srjsstruct GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_HS {
317410e230b6Smaya   uint32_t                             DWordLength;
317510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
317610e230b6Smaya   uint32_t                             _3DCommandOpcode;
317710e230b6Smaya   uint32_t                             CommandSubType;
317810e230b6Smaya   uint32_t                             CommandType;
317910e230b6Smaya   uint32_t                             ConstantBufferSize;
318010e230b6Smaya#define _0KB                                     0
318110e230b6Smaya   uint32_t                             ConstantBufferOffset;
318210e230b6Smaya#define _0KB                                     0
318310e230b6Smaya};
318410e230b6Smaya
318596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
318696c5ddc4SrjsGFX7_3DSTATE_PUSH_CONSTANT_ALLOC_HS_pack(__attribute__((unused)) __gen_user_data *data,
318710e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
318896c5ddc4Srjs                                         __attribute__((unused)) const struct GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_HS * restrict values)
318910e230b6Smaya{
319010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
319110e230b6Smaya
319210e230b6Smaya   dw[0] =
319310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
319410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
319510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
319610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
319710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
319810e230b6Smaya
319910e230b6Smaya   dw[1] =
320010e230b6Smaya      __gen_uint(values->ConstantBufferSize, 0, 4) |
320110e230b6Smaya      __gen_uint(values->ConstantBufferOffset, 16, 19);
320210e230b6Smaya}
320310e230b6Smaya
320496c5ddc4Srjs#define GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_PS_length      2
320596c5ddc4Srjs#define GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_PS_length_bias      2
320696c5ddc4Srjs#define GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_PS_header\
320710e230b6Smaya   .DWordLength                         =      0,  \
320810e230b6Smaya   ._3DCommandSubOpcode                 =     22,  \
320910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
321010e230b6Smaya   .CommandSubType                      =      3,  \
321110e230b6Smaya   .CommandType                         =      3
321210e230b6Smaya
321396c5ddc4Srjsstruct GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_PS {
321410e230b6Smaya   uint32_t                             DWordLength;
321510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
321610e230b6Smaya   uint32_t                             _3DCommandOpcode;
321710e230b6Smaya   uint32_t                             CommandSubType;
321810e230b6Smaya   uint32_t                             CommandType;
321910e230b6Smaya   uint32_t                             ConstantBufferSize;
322010e230b6Smaya#define _0KB                                     0
322110e230b6Smaya   uint32_t                             ConstantBufferOffset;
322210e230b6Smaya#define _0KB                                     0
322310e230b6Smaya};
322410e230b6Smaya
322596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
322696c5ddc4SrjsGFX7_3DSTATE_PUSH_CONSTANT_ALLOC_PS_pack(__attribute__((unused)) __gen_user_data *data,
322710e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
322896c5ddc4Srjs                                         __attribute__((unused)) const struct GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_PS * restrict values)
322910e230b6Smaya{
323010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
323110e230b6Smaya
323210e230b6Smaya   dw[0] =
323310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
323410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
323510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
323610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
323710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
323810e230b6Smaya
323910e230b6Smaya   dw[1] =
324010e230b6Smaya      __gen_uint(values->ConstantBufferSize, 0, 4) |
324110e230b6Smaya      __gen_uint(values->ConstantBufferOffset, 16, 19);
324210e230b6Smaya}
324310e230b6Smaya
324496c5ddc4Srjs#define GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_VS_length      2
324596c5ddc4Srjs#define GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_VS_length_bias      2
324696c5ddc4Srjs#define GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_VS_header\
324710e230b6Smaya   .DWordLength                         =      0,  \
324810e230b6Smaya   ._3DCommandSubOpcode                 =     18,  \
324910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
325010e230b6Smaya   .CommandSubType                      =      3,  \
325110e230b6Smaya   .CommandType                         =      3
325210e230b6Smaya
325396c5ddc4Srjsstruct GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_VS {
325410e230b6Smaya   uint32_t                             DWordLength;
325510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
325610e230b6Smaya   uint32_t                             _3DCommandOpcode;
325710e230b6Smaya   uint32_t                             CommandSubType;
325810e230b6Smaya   uint32_t                             CommandType;
325910e230b6Smaya   uint32_t                             ConstantBufferSize;
326010e230b6Smaya#define _0KB                                     0
326110e230b6Smaya   uint32_t                             ConstantBufferOffset;
326210e230b6Smaya#define _0KB                                     0
326310e230b6Smaya};
326410e230b6Smaya
326596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
326696c5ddc4SrjsGFX7_3DSTATE_PUSH_CONSTANT_ALLOC_VS_pack(__attribute__((unused)) __gen_user_data *data,
326710e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
326896c5ddc4Srjs                                         __attribute__((unused)) const struct GFX7_3DSTATE_PUSH_CONSTANT_ALLOC_VS * restrict values)
326910e230b6Smaya{
327010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
327110e230b6Smaya
327210e230b6Smaya   dw[0] =
327310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
327410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
327510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
327610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
327710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
327810e230b6Smaya
327910e230b6Smaya   dw[1] =
328010e230b6Smaya      __gen_uint(values->ConstantBufferSize, 0, 4) |
328110e230b6Smaya      __gen_uint(values->ConstantBufferOffset, 16, 19);
328210e230b6Smaya}
328310e230b6Smaya
328496c5ddc4Srjs#define GFX7_3DSTATE_SAMPLER_PALETTE_LOAD0_length_bias      2
328596c5ddc4Srjs#define GFX7_3DSTATE_SAMPLER_PALETTE_LOAD0_header\
328610e230b6Smaya   ._3DCommandSubOpcode                 =      2,  \
328710e230b6Smaya   ._3DCommandOpcode                    =      1,  \
328810e230b6Smaya   .CommandSubType                      =      3,  \
328910e230b6Smaya   .CommandType                         =      3
329010e230b6Smaya
329196c5ddc4Srjsstruct GFX7_3DSTATE_SAMPLER_PALETTE_LOAD0 {
329210e230b6Smaya   uint32_t                             DWordLength;
329310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
329410e230b6Smaya   uint32_t                             _3DCommandOpcode;
329510e230b6Smaya   uint32_t                             CommandSubType;
329610e230b6Smaya   uint32_t                             CommandType;
329710e230b6Smaya   /* variable length fields follow */
329810e230b6Smaya};
329910e230b6Smaya
330096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
330196c5ddc4SrjsGFX7_3DSTATE_SAMPLER_PALETTE_LOAD0_pack(__attribute__((unused)) __gen_user_data *data,
330210e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
330396c5ddc4Srjs                                        __attribute__((unused)) const struct GFX7_3DSTATE_SAMPLER_PALETTE_LOAD0 * restrict values)
330410e230b6Smaya{
330510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
330610e230b6Smaya
330710e230b6Smaya   dw[0] =
330810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
330910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
331010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
331110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
331210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
331310e230b6Smaya}
331410e230b6Smaya
331596c5ddc4Srjs#define GFX7_3DSTATE_SAMPLER_PALETTE_LOAD1_length_bias      2
331696c5ddc4Srjs#define GFX7_3DSTATE_SAMPLER_PALETTE_LOAD1_header\
331710e230b6Smaya   .DWordLength                         =      0,  \
331810e230b6Smaya   ._3DCommandSubOpcode                 =     12,  \
331910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
332010e230b6Smaya   .CommandSubType                      =      3,  \
332110e230b6Smaya   .CommandType                         =      3
332210e230b6Smaya
332396c5ddc4Srjsstruct GFX7_3DSTATE_SAMPLER_PALETTE_LOAD1 {
332410e230b6Smaya   uint32_t                             DWordLength;
332510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
332610e230b6Smaya   uint32_t                             _3DCommandOpcode;
332710e230b6Smaya   uint32_t                             CommandSubType;
332810e230b6Smaya   uint32_t                             CommandType;
332910e230b6Smaya   /* variable length fields follow */
333010e230b6Smaya};
333110e230b6Smaya
333296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
333396c5ddc4SrjsGFX7_3DSTATE_SAMPLER_PALETTE_LOAD1_pack(__attribute__((unused)) __gen_user_data *data,
333410e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
333596c5ddc4Srjs                                        __attribute__((unused)) const struct GFX7_3DSTATE_SAMPLER_PALETTE_LOAD1 * restrict values)
333610e230b6Smaya{
333710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
333810e230b6Smaya
333910e230b6Smaya   dw[0] =
334010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
334110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
334210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
334310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
334410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
334510e230b6Smaya}
334610e230b6Smaya
334796c5ddc4Srjs#define GFX7_3DSTATE_SAMPLER_STATE_POINTERS_DS_length      2
334896c5ddc4Srjs#define GFX7_3DSTATE_SAMPLER_STATE_POINTERS_DS_length_bias      2
334996c5ddc4Srjs#define GFX7_3DSTATE_SAMPLER_STATE_POINTERS_DS_header\
335010e230b6Smaya   .DWordLength                         =      0,  \
335110e230b6Smaya   ._3DCommandSubOpcode                 =     45,  \
335210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
335310e230b6Smaya   .CommandSubType                      =      3,  \
335410e230b6Smaya   .CommandType                         =      3
335510e230b6Smaya
335696c5ddc4Srjsstruct GFX7_3DSTATE_SAMPLER_STATE_POINTERS_DS {
335710e230b6Smaya   uint32_t                             DWordLength;
335810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
335910e230b6Smaya   uint32_t                             _3DCommandOpcode;
336010e230b6Smaya   uint32_t                             CommandSubType;
336110e230b6Smaya   uint32_t                             CommandType;
336210e230b6Smaya   uint64_t                             PointertoDSSamplerState;
336310e230b6Smaya};
336410e230b6Smaya
336596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
336696c5ddc4SrjsGFX7_3DSTATE_SAMPLER_STATE_POINTERS_DS_pack(__attribute__((unused)) __gen_user_data *data,
336710e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
336896c5ddc4Srjs                                            __attribute__((unused)) const struct GFX7_3DSTATE_SAMPLER_STATE_POINTERS_DS * restrict values)
336910e230b6Smaya{
337010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
337110e230b6Smaya
337210e230b6Smaya   dw[0] =
337310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
337410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
337510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
337610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
337710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
337810e230b6Smaya
337910e230b6Smaya   dw[1] =
338010e230b6Smaya      __gen_offset(values->PointertoDSSamplerState, 5, 31);
338110e230b6Smaya}
338210e230b6Smaya
338396c5ddc4Srjs#define GFX7_3DSTATE_SAMPLER_STATE_POINTERS_GS_length      2
338496c5ddc4Srjs#define GFX7_3DSTATE_SAMPLER_STATE_POINTERS_GS_length_bias      2
338596c5ddc4Srjs#define GFX7_3DSTATE_SAMPLER_STATE_POINTERS_GS_header\
338610e230b6Smaya   .DWordLength                         =      0,  \
338710e230b6Smaya   ._3DCommandSubOpcode                 =     46,  \
338810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
338910e230b6Smaya   .CommandSubType                      =      3,  \
339010e230b6Smaya   .CommandType                         =      3
339110e230b6Smaya
339296c5ddc4Srjsstruct GFX7_3DSTATE_SAMPLER_STATE_POINTERS_GS {
339310e230b6Smaya   uint32_t                             DWordLength;
339410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
339510e230b6Smaya   uint32_t                             _3DCommandOpcode;
339610e230b6Smaya   uint32_t                             CommandSubType;
339710e230b6Smaya   uint32_t                             CommandType;
339810e230b6Smaya   uint64_t                             PointertoGSSamplerState;
339910e230b6Smaya};
340010e230b6Smaya
340196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
340296c5ddc4SrjsGFX7_3DSTATE_SAMPLER_STATE_POINTERS_GS_pack(__attribute__((unused)) __gen_user_data *data,
340310e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
340496c5ddc4Srjs                                            __attribute__((unused)) const struct GFX7_3DSTATE_SAMPLER_STATE_POINTERS_GS * restrict values)
340510e230b6Smaya{
340610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
340710e230b6Smaya
340810e230b6Smaya   dw[0] =
340910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
341010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
341110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
341210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
341310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
341410e230b6Smaya
341510e230b6Smaya   dw[1] =
341610e230b6Smaya      __gen_offset(values->PointertoGSSamplerState, 5, 31);
341710e230b6Smaya}
341810e230b6Smaya
341996c5ddc4Srjs#define GFX7_3DSTATE_SAMPLER_STATE_POINTERS_HS_length      2
342096c5ddc4Srjs#define GFX7_3DSTATE_SAMPLER_STATE_POINTERS_HS_length_bias      2
342196c5ddc4Srjs#define GFX7_3DSTATE_SAMPLER_STATE_POINTERS_HS_header\
342210e230b6Smaya   .DWordLength                         =      0,  \
342310e230b6Smaya   ._3DCommandSubOpcode                 =     44,  \
342410e230b6Smaya   ._3DCommandOpcode                    =      0,  \
342510e230b6Smaya   .CommandSubType                      =      3,  \
342610e230b6Smaya   .CommandType                         =      3
342710e230b6Smaya
342896c5ddc4Srjsstruct GFX7_3DSTATE_SAMPLER_STATE_POINTERS_HS {
342910e230b6Smaya   uint32_t                             DWordLength;
343010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
343110e230b6Smaya   uint32_t                             _3DCommandOpcode;
343210e230b6Smaya   uint32_t                             CommandSubType;
343310e230b6Smaya   uint32_t                             CommandType;
343410e230b6Smaya   uint64_t                             PointertoHSSamplerState;
343510e230b6Smaya};
343610e230b6Smaya
343796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
343896c5ddc4SrjsGFX7_3DSTATE_SAMPLER_STATE_POINTERS_HS_pack(__attribute__((unused)) __gen_user_data *data,
343910e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
344096c5ddc4Srjs                                            __attribute__((unused)) const struct GFX7_3DSTATE_SAMPLER_STATE_POINTERS_HS * restrict values)
344110e230b6Smaya{
344210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
344310e230b6Smaya
344410e230b6Smaya   dw[0] =
344510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
344610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
344710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
344810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
344910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
345010e230b6Smaya
345110e230b6Smaya   dw[1] =
345210e230b6Smaya      __gen_offset(values->PointertoHSSamplerState, 5, 31);
345310e230b6Smaya}
345410e230b6Smaya
345596c5ddc4Srjs#define GFX7_3DSTATE_SAMPLER_STATE_POINTERS_PS_length      2
345696c5ddc4Srjs#define GFX7_3DSTATE_SAMPLER_STATE_POINTERS_PS_length_bias      2
345796c5ddc4Srjs#define GFX7_3DSTATE_SAMPLER_STATE_POINTERS_PS_header\
345810e230b6Smaya   .DWordLength                         =      0,  \
345910e230b6Smaya   ._3DCommandSubOpcode                 =     47,  \
346010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
346110e230b6Smaya   .CommandSubType                      =      3,  \
346210e230b6Smaya   .CommandType                         =      3
346310e230b6Smaya
346496c5ddc4Srjsstruct GFX7_3DSTATE_SAMPLER_STATE_POINTERS_PS {
346510e230b6Smaya   uint32_t                             DWordLength;
346610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
346710e230b6Smaya   uint32_t                             _3DCommandOpcode;
346810e230b6Smaya   uint32_t                             CommandSubType;
346910e230b6Smaya   uint32_t                             CommandType;
347010e230b6Smaya   uint64_t                             PointertoPSSamplerState;
347110e230b6Smaya};
347210e230b6Smaya
347396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
347496c5ddc4SrjsGFX7_3DSTATE_SAMPLER_STATE_POINTERS_PS_pack(__attribute__((unused)) __gen_user_data *data,
347510e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
347696c5ddc4Srjs                                            __attribute__((unused)) const struct GFX7_3DSTATE_SAMPLER_STATE_POINTERS_PS * restrict values)
347710e230b6Smaya{
347810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
347910e230b6Smaya
348010e230b6Smaya   dw[0] =
348110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
348210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
348310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
348410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
348510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
348610e230b6Smaya
348710e230b6Smaya   dw[1] =
348810e230b6Smaya      __gen_offset(values->PointertoPSSamplerState, 5, 31);
348910e230b6Smaya}
349010e230b6Smaya
349196c5ddc4Srjs#define GFX7_3DSTATE_SAMPLER_STATE_POINTERS_VS_length      2
349296c5ddc4Srjs#define GFX7_3DSTATE_SAMPLER_STATE_POINTERS_VS_length_bias      2
349396c5ddc4Srjs#define GFX7_3DSTATE_SAMPLER_STATE_POINTERS_VS_header\
349410e230b6Smaya   .DWordLength                         =      0,  \
349510e230b6Smaya   ._3DCommandSubOpcode                 =     43,  \
349610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
349710e230b6Smaya   .CommandSubType                      =      3,  \
349810e230b6Smaya   .CommandType                         =      3
349910e230b6Smaya
350096c5ddc4Srjsstruct GFX7_3DSTATE_SAMPLER_STATE_POINTERS_VS {
350110e230b6Smaya   uint32_t                             DWordLength;
350210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
350310e230b6Smaya   uint32_t                             _3DCommandOpcode;
350410e230b6Smaya   uint32_t                             CommandSubType;
350510e230b6Smaya   uint32_t                             CommandType;
350610e230b6Smaya   uint64_t                             PointertoVSSamplerState;
350710e230b6Smaya};
350810e230b6Smaya
350996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
351096c5ddc4SrjsGFX7_3DSTATE_SAMPLER_STATE_POINTERS_VS_pack(__attribute__((unused)) __gen_user_data *data,
351110e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
351296c5ddc4Srjs                                            __attribute__((unused)) const struct GFX7_3DSTATE_SAMPLER_STATE_POINTERS_VS * restrict values)
351310e230b6Smaya{
351410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
351510e230b6Smaya
351610e230b6Smaya   dw[0] =
351710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
351810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
351910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
352010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
352110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
352210e230b6Smaya
352310e230b6Smaya   dw[1] =
352410e230b6Smaya      __gen_offset(values->PointertoVSSamplerState, 5, 31);
352510e230b6Smaya}
352610e230b6Smaya
352796c5ddc4Srjs#define GFX7_3DSTATE_SAMPLE_MASK_length        2
352896c5ddc4Srjs#define GFX7_3DSTATE_SAMPLE_MASK_length_bias      2
352996c5ddc4Srjs#define GFX7_3DSTATE_SAMPLE_MASK_header         \
353010e230b6Smaya   .DWordLength                         =      0,  \
353110e230b6Smaya   ._3DCommandSubOpcode                 =     24,  \
353210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
353310e230b6Smaya   .CommandSubType                      =      3,  \
353410e230b6Smaya   .CommandType                         =      3
353510e230b6Smaya
353696c5ddc4Srjsstruct GFX7_3DSTATE_SAMPLE_MASK {
353710e230b6Smaya   uint32_t                             DWordLength;
353810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
353910e230b6Smaya   uint32_t                             _3DCommandOpcode;
354010e230b6Smaya   uint32_t                             CommandSubType;
354110e230b6Smaya   uint32_t                             CommandType;
354210e230b6Smaya   uint32_t                             SampleMask;
354310e230b6Smaya};
354410e230b6Smaya
354596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
354696c5ddc4SrjsGFX7_3DSTATE_SAMPLE_MASK_pack(__attribute__((unused)) __gen_user_data *data,
354710e230b6Smaya                              __attribute__((unused)) void * restrict dst,
354896c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_3DSTATE_SAMPLE_MASK * restrict values)
354910e230b6Smaya{
355010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
355110e230b6Smaya
355210e230b6Smaya   dw[0] =
355310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
355410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
355510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
355610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
355710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
355810e230b6Smaya
355910e230b6Smaya   dw[1] =
356010e230b6Smaya      __gen_uint(values->SampleMask, 0, 7);
356110e230b6Smaya}
356210e230b6Smaya
356396c5ddc4Srjs#define GFX7_3DSTATE_SBE_length               14
356496c5ddc4Srjs#define GFX7_3DSTATE_SBE_length_bias           2
356596c5ddc4Srjs#define GFX7_3DSTATE_SBE_header                 \
356610e230b6Smaya   .DWordLength                         =     12,  \
356710e230b6Smaya   ._3DCommandSubOpcode                 =     31,  \
356810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
356910e230b6Smaya   .CommandSubType                      =      3,  \
357010e230b6Smaya   .CommandType                         =      3
357110e230b6Smaya
357296c5ddc4Srjsstruct GFX7_3DSTATE_SBE {
357310e230b6Smaya   uint32_t                             DWordLength;
357410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
357510e230b6Smaya   uint32_t                             _3DCommandOpcode;
357610e230b6Smaya   uint32_t                             CommandSubType;
357710e230b6Smaya   uint32_t                             CommandType;
357810e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
357910e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
358010e230b6Smaya   uint32_t                             PointSpriteTextureCoordinateOrigin;
358110e230b6Smaya#define UPPERLEFT                                0
358210e230b6Smaya#define LOWERLEFT                                1
358310e230b6Smaya   bool                                 AttributeSwizzleEnable;
358410e230b6Smaya   uint32_t                             NumberofSFOutputAttributes;
358510e230b6Smaya   uint32_t                             AttributeSwizzleControlMode;
358610e230b6Smaya#define SWIZ_0_15                                0
358710e230b6Smaya#define SWIZ_16_31                               1
358896c5ddc4Srjs   struct GFX7_SF_OUTPUT_ATTRIBUTE_DETAIL Attribute[16];
358910e230b6Smaya   uint32_t                             PointSpriteTextureCoordinateEnable;
359010e230b6Smaya   uint32_t                             ConstantInterpolationEnable;
359110e230b6Smaya   uint32_t                             Attribute0WrapShortestEnables;
359210e230b6Smaya   uint32_t                             Attribute1WrapShortestEnables;
359310e230b6Smaya   uint32_t                             Attribute2WrapShortestEnables;
359410e230b6Smaya   uint32_t                             Attribute3WrapShortestEnables;
359510e230b6Smaya   uint32_t                             Attribute4WrapShortestEnables;
359610e230b6Smaya   uint32_t                             Attribute5WrapShortestEnables;
359710e230b6Smaya   uint32_t                             Attribute6WrapShortestEnables;
359810e230b6Smaya   uint32_t                             Attribute7WrapShortestEnables;
359910e230b6Smaya   uint32_t                             Attribute8WrapShortestEnables;
360010e230b6Smaya   uint32_t                             Attribute9WrapShortestEnables;
360110e230b6Smaya   uint32_t                             Attribute10WrapShortestEnables;
360210e230b6Smaya   uint32_t                             Attribute11WrapShortestEnables;
360310e230b6Smaya   uint32_t                             Attribute12WrapShortestEnables;
360410e230b6Smaya   uint32_t                             Attribute13WrapShortestEnables;
360510e230b6Smaya   uint32_t                             Attribute14WrapShortestEnables;
360610e230b6Smaya   uint32_t                             Attribute15WrapShortestEnables;
360710e230b6Smaya};
360810e230b6Smaya
360996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
361096c5ddc4SrjsGFX7_3DSTATE_SBE_pack(__attribute__((unused)) __gen_user_data *data,
361110e230b6Smaya                      __attribute__((unused)) void * restrict dst,
361296c5ddc4Srjs                      __attribute__((unused)) const struct GFX7_3DSTATE_SBE * restrict values)
361310e230b6Smaya{
361410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
361510e230b6Smaya
361610e230b6Smaya   dw[0] =
361710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
361810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
361910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
362010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
362110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
362210e230b6Smaya
362310e230b6Smaya   dw[1] =
362410e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
362510e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 15) |
362610e230b6Smaya      __gen_uint(values->PointSpriteTextureCoordinateOrigin, 20, 20) |
362710e230b6Smaya      __gen_uint(values->AttributeSwizzleEnable, 21, 21) |
362810e230b6Smaya      __gen_uint(values->NumberofSFOutputAttributes, 22, 27) |
362910e230b6Smaya      __gen_uint(values->AttributeSwizzleControlMode, 28, 28);
363010e230b6Smaya
363110e230b6Smaya   uint32_t v2_0;
363296c5ddc4Srjs   GFX7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v2_0, &values->Attribute[0]);
363310e230b6Smaya
363410e230b6Smaya   uint32_t v2_1;
363596c5ddc4Srjs   GFX7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v2_1, &values->Attribute[1]);
363610e230b6Smaya
363710e230b6Smaya   dw[2] =
363810e230b6Smaya      __gen_uint(v2_0, 0, 15) |
363910e230b6Smaya      __gen_uint(v2_1, 16, 31);
364010e230b6Smaya
364110e230b6Smaya   uint32_t v3_0;
364296c5ddc4Srjs   GFX7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v3_0, &values->Attribute[2]);
364310e230b6Smaya
364410e230b6Smaya   uint32_t v3_1;
364596c5ddc4Srjs   GFX7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v3_1, &values->Attribute[3]);
364610e230b6Smaya
364710e230b6Smaya   dw[3] =
364810e230b6Smaya      __gen_uint(v3_0, 0, 15) |
364910e230b6Smaya      __gen_uint(v3_1, 16, 31);
365010e230b6Smaya
365110e230b6Smaya   uint32_t v4_0;
365296c5ddc4Srjs   GFX7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v4_0, &values->Attribute[4]);
365310e230b6Smaya
365410e230b6Smaya   uint32_t v4_1;
365596c5ddc4Srjs   GFX7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v4_1, &values->Attribute[5]);
365610e230b6Smaya
365710e230b6Smaya   dw[4] =
365810e230b6Smaya      __gen_uint(v4_0, 0, 15) |
365910e230b6Smaya      __gen_uint(v4_1, 16, 31);
366010e230b6Smaya
366110e230b6Smaya   uint32_t v5_0;
366296c5ddc4Srjs   GFX7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v5_0, &values->Attribute[6]);
366310e230b6Smaya
366410e230b6Smaya   uint32_t v5_1;
366596c5ddc4Srjs   GFX7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v5_1, &values->Attribute[7]);
366610e230b6Smaya
366710e230b6Smaya   dw[5] =
366810e230b6Smaya      __gen_uint(v5_0, 0, 15) |
366910e230b6Smaya      __gen_uint(v5_1, 16, 31);
367010e230b6Smaya
367110e230b6Smaya   uint32_t v6_0;
367296c5ddc4Srjs   GFX7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v6_0, &values->Attribute[8]);
367310e230b6Smaya
367410e230b6Smaya   uint32_t v6_1;
367596c5ddc4Srjs   GFX7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v6_1, &values->Attribute[9]);
367610e230b6Smaya
367710e230b6Smaya   dw[6] =
367810e230b6Smaya      __gen_uint(v6_0, 0, 15) |
367910e230b6Smaya      __gen_uint(v6_1, 16, 31);
368010e230b6Smaya
368110e230b6Smaya   uint32_t v7_0;
368296c5ddc4Srjs   GFX7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v7_0, &values->Attribute[10]);
368310e230b6Smaya
368410e230b6Smaya   uint32_t v7_1;
368596c5ddc4Srjs   GFX7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v7_1, &values->Attribute[11]);
368610e230b6Smaya
368710e230b6Smaya   dw[7] =
368810e230b6Smaya      __gen_uint(v7_0, 0, 15) |
368910e230b6Smaya      __gen_uint(v7_1, 16, 31);
369010e230b6Smaya
369110e230b6Smaya   uint32_t v8_0;
369296c5ddc4Srjs   GFX7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_0, &values->Attribute[12]);
369310e230b6Smaya
369410e230b6Smaya   uint32_t v8_1;
369596c5ddc4Srjs   GFX7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_1, &values->Attribute[13]);
369610e230b6Smaya
369710e230b6Smaya   dw[8] =
369810e230b6Smaya      __gen_uint(v8_0, 0, 15) |
369910e230b6Smaya      __gen_uint(v8_1, 16, 31);
370010e230b6Smaya
370110e230b6Smaya   uint32_t v9_0;
370296c5ddc4Srjs   GFX7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v9_0, &values->Attribute[14]);
370310e230b6Smaya
370410e230b6Smaya   uint32_t v9_1;
370596c5ddc4Srjs   GFX7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v9_1, &values->Attribute[15]);
370610e230b6Smaya
370710e230b6Smaya   dw[9] =
370810e230b6Smaya      __gen_uint(v9_0, 0, 15) |
370910e230b6Smaya      __gen_uint(v9_1, 16, 31);
371010e230b6Smaya
371110e230b6Smaya   dw[10] =
371210e230b6Smaya      __gen_uint(values->PointSpriteTextureCoordinateEnable, 0, 31);
371310e230b6Smaya
371410e230b6Smaya   dw[11] =
371510e230b6Smaya      __gen_uint(values->ConstantInterpolationEnable, 0, 31);
371610e230b6Smaya
371710e230b6Smaya   dw[12] =
371810e230b6Smaya      __gen_uint(values->Attribute0WrapShortestEnables, 0, 3) |
371910e230b6Smaya      __gen_uint(values->Attribute1WrapShortestEnables, 4, 7) |
372010e230b6Smaya      __gen_uint(values->Attribute2WrapShortestEnables, 8, 11) |
372110e230b6Smaya      __gen_uint(values->Attribute3WrapShortestEnables, 12, 15) |
372210e230b6Smaya      __gen_uint(values->Attribute4WrapShortestEnables, 16, 19) |
372310e230b6Smaya      __gen_uint(values->Attribute5WrapShortestEnables, 20, 23) |
372410e230b6Smaya      __gen_uint(values->Attribute6WrapShortestEnables, 24, 27) |
372510e230b6Smaya      __gen_uint(values->Attribute7WrapShortestEnables, 28, 31);
372610e230b6Smaya
372710e230b6Smaya   dw[13] =
372810e230b6Smaya      __gen_uint(values->Attribute8WrapShortestEnables, 0, 3) |
372910e230b6Smaya      __gen_uint(values->Attribute9WrapShortestEnables, 4, 7) |
373010e230b6Smaya      __gen_uint(values->Attribute10WrapShortestEnables, 8, 11) |
373110e230b6Smaya      __gen_uint(values->Attribute11WrapShortestEnables, 12, 15) |
373210e230b6Smaya      __gen_uint(values->Attribute12WrapShortestEnables, 16, 19) |
373310e230b6Smaya      __gen_uint(values->Attribute13WrapShortestEnables, 20, 23) |
373410e230b6Smaya      __gen_uint(values->Attribute14WrapShortestEnables, 24, 27) |
373510e230b6Smaya      __gen_uint(values->Attribute15WrapShortestEnables, 28, 31);
373610e230b6Smaya}
373710e230b6Smaya
373896c5ddc4Srjs#define GFX7_3DSTATE_SCISSOR_STATE_POINTERS_length      2
373996c5ddc4Srjs#define GFX7_3DSTATE_SCISSOR_STATE_POINTERS_length_bias      2
374096c5ddc4Srjs#define GFX7_3DSTATE_SCISSOR_STATE_POINTERS_header\
374110e230b6Smaya   .DWordLength                         =      0,  \
374210e230b6Smaya   ._3DCommandSubOpcode                 =     15,  \
374310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
374410e230b6Smaya   .CommandSubType                      =      3,  \
374510e230b6Smaya   .CommandType                         =      3
374610e230b6Smaya
374796c5ddc4Srjsstruct GFX7_3DSTATE_SCISSOR_STATE_POINTERS {
374810e230b6Smaya   uint32_t                             DWordLength;
374910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
375010e230b6Smaya   uint32_t                             _3DCommandOpcode;
375110e230b6Smaya   uint32_t                             CommandSubType;
375210e230b6Smaya   uint32_t                             CommandType;
375310e230b6Smaya   uint64_t                             ScissorRectPointer;
375410e230b6Smaya};
375510e230b6Smaya
375696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
375796c5ddc4SrjsGFX7_3DSTATE_SCISSOR_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
375810e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
375996c5ddc4Srjs                                         __attribute__((unused)) const struct GFX7_3DSTATE_SCISSOR_STATE_POINTERS * restrict values)
376010e230b6Smaya{
376110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
376210e230b6Smaya
376310e230b6Smaya   dw[0] =
376410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
376510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
376610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
376710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
376810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
376910e230b6Smaya
377010e230b6Smaya   dw[1] =
377110e230b6Smaya      __gen_offset(values->ScissorRectPointer, 5, 31);
377210e230b6Smaya}
377310e230b6Smaya
377496c5ddc4Srjs#define GFX7_3DSTATE_SF_length                 7
377596c5ddc4Srjs#define GFX7_3DSTATE_SF_length_bias            2
377696c5ddc4Srjs#define GFX7_3DSTATE_SF_header                  \
377710e230b6Smaya   .DWordLength                         =      5,  \
377810e230b6Smaya   ._3DCommandSubOpcode                 =     19,  \
377910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
378010e230b6Smaya   .CommandSubType                      =      3,  \
378110e230b6Smaya   .CommandType                         =      3
378210e230b6Smaya
378396c5ddc4Srjsstruct GFX7_3DSTATE_SF {
378410e230b6Smaya   uint32_t                             DWordLength;
378510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
378610e230b6Smaya   uint32_t                             _3DCommandOpcode;
378710e230b6Smaya   uint32_t                             CommandSubType;
378810e230b6Smaya   uint32_t                             CommandType;
378910e230b6Smaya   uint32_t                             FrontWinding;
379010e230b6Smaya   bool                                 ViewportTransformEnable;
379110e230b6Smaya   uint32_t                             BackFaceFillMode;
379210e230b6Smaya#define FILL_MODE_SOLID                          0
379310e230b6Smaya#define FILL_MODE_WIREFRAME                      1
379410e230b6Smaya#define FILL_MODE_POINT                          2
379510e230b6Smaya   uint32_t                             FrontFaceFillMode;
379610e230b6Smaya#define FILL_MODE_SOLID                          0
379710e230b6Smaya#define FILL_MODE_WIREFRAME                      1
379810e230b6Smaya#define FILL_MODE_POINT                          2
379910e230b6Smaya   bool                                 GlobalDepthOffsetEnablePoint;
380010e230b6Smaya   bool                                 GlobalDepthOffsetEnableWireframe;
380110e230b6Smaya   bool                                 GlobalDepthOffsetEnableSolid;
380210e230b6Smaya   bool                                 StatisticsEnable;
380310e230b6Smaya   bool                                 LegacyGlobalDepthBiasEnable;
380410e230b6Smaya   uint32_t                             DepthBufferSurfaceFormat;
380510e230b6Smaya#define D32_FLOAT_S8X24_UINT                     0
380610e230b6Smaya#define D32_FLOAT                                1
380710e230b6Smaya#define D24_UNORM_S8_UINT                        2
380810e230b6Smaya#define D24_UNORM_X8_UINT                        3
380910e230b6Smaya#define D16_UNORM                                5
381010e230b6Smaya   uint32_t                             MultisampleRasterizationMode;
381110e230b6Smaya#define MSRASTMODE_OFF_PIXEL                     0
381210e230b6Smaya#define MSRASTMODE_OFF_PATTERN                   1
381310e230b6Smaya#define MSRASTMODE_ON_PIXEL                      2
381410e230b6Smaya#define MSRASTMODE_ON_PATTERN                    3
381510e230b6Smaya   bool                                 ScissorRectangleEnable;
381610e230b6Smaya   uint32_t                             LineEndCapAntialiasingRegionWidth;
381710e230b6Smaya#define _05pixels                                0
381810e230b6Smaya#define _10pixels                                1
381910e230b6Smaya#define _20pixels                                2
382010e230b6Smaya#define _40pixels                                3
382110e230b6Smaya   float                                LineWidth;
382210e230b6Smaya   uint32_t                             CullMode;
382310e230b6Smaya#define CULLMODE_BOTH                            0
382410e230b6Smaya#define CULLMODE_NONE                            1
382510e230b6Smaya#define CULLMODE_FRONT                           2
382610e230b6Smaya#define CULLMODE_BACK                            3
382796c5ddc4Srjs   bool                                 AntialiasingEnable;
382810e230b6Smaya   float                                PointWidth;
382910e230b6Smaya   uint32_t                             PointWidthSource;
383010e230b6Smaya#define Vertex                                   0
383110e230b6Smaya#define State                                    1
383210e230b6Smaya   uint32_t                             VertexSubPixelPrecisionSelect;
383310e230b6Smaya#define _8Bit                                    0
383410e230b6Smaya#define _4Bit                                    1
383510e230b6Smaya   uint32_t                             AALineDistanceMode;
383610e230b6Smaya#define AALINEDISTANCE_TRUE                      1
383710e230b6Smaya   uint32_t                             TriangleFanProvokingVertexSelect;
383810e230b6Smaya#define Vertex0                                  0
383910e230b6Smaya#define Vertex1                                  1
384010e230b6Smaya#define Vertex2                                  2
384110e230b6Smaya   uint32_t                             LineStripListProvokingVertexSelect;
384210e230b6Smaya   uint32_t                             TriangleStripListProvokingVertexSelect;
384310e230b6Smaya#define Vertex0                                  0
384410e230b6Smaya#define Vertex1                                  1
384510e230b6Smaya#define Vertex2                                  2
384610e230b6Smaya   bool                                 LastPixelEnable;
384710e230b6Smaya   float                                GlobalDepthOffsetConstant;
384810e230b6Smaya   float                                GlobalDepthOffsetScale;
384910e230b6Smaya   float                                GlobalDepthOffsetClamp;
385010e230b6Smaya};
385110e230b6Smaya
385296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
385396c5ddc4SrjsGFX7_3DSTATE_SF_pack(__attribute__((unused)) __gen_user_data *data,
385410e230b6Smaya                     __attribute__((unused)) void * restrict dst,
385596c5ddc4Srjs                     __attribute__((unused)) const struct GFX7_3DSTATE_SF * restrict values)
385610e230b6Smaya{
385710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
385810e230b6Smaya
385910e230b6Smaya   dw[0] =
386010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
386110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
386210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
386310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
386410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
386510e230b6Smaya
386610e230b6Smaya   dw[1] =
386710e230b6Smaya      __gen_uint(values->FrontWinding, 0, 0) |
386810e230b6Smaya      __gen_uint(values->ViewportTransformEnable, 1, 1) |
386910e230b6Smaya      __gen_uint(values->BackFaceFillMode, 3, 4) |
387010e230b6Smaya      __gen_uint(values->FrontFaceFillMode, 5, 6) |
387110e230b6Smaya      __gen_uint(values->GlobalDepthOffsetEnablePoint, 7, 7) |
387210e230b6Smaya      __gen_uint(values->GlobalDepthOffsetEnableWireframe, 8, 8) |
387310e230b6Smaya      __gen_uint(values->GlobalDepthOffsetEnableSolid, 9, 9) |
387410e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
387510e230b6Smaya      __gen_uint(values->LegacyGlobalDepthBiasEnable, 11, 11) |
387610e230b6Smaya      __gen_uint(values->DepthBufferSurfaceFormat, 12, 14);
387710e230b6Smaya
387810e230b6Smaya   dw[2] =
387910e230b6Smaya      __gen_uint(values->MultisampleRasterizationMode, 8, 9) |
388010e230b6Smaya      __gen_uint(values->ScissorRectangleEnable, 11, 11) |
388110e230b6Smaya      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 16, 17) |
388210e230b6Smaya      __gen_ufixed(values->LineWidth, 18, 27, 7) |
388310e230b6Smaya      __gen_uint(values->CullMode, 29, 30) |
388496c5ddc4Srjs      __gen_uint(values->AntialiasingEnable, 31, 31);
388510e230b6Smaya
388610e230b6Smaya   dw[3] =
388710e230b6Smaya      __gen_ufixed(values->PointWidth, 0, 10, 3) |
388810e230b6Smaya      __gen_uint(values->PointWidthSource, 11, 11) |
388910e230b6Smaya      __gen_uint(values->VertexSubPixelPrecisionSelect, 12, 12) |
389010e230b6Smaya      __gen_uint(values->AALineDistanceMode, 14, 14) |
389110e230b6Smaya      __gen_uint(values->TriangleFanProvokingVertexSelect, 25, 26) |
389210e230b6Smaya      __gen_uint(values->LineStripListProvokingVertexSelect, 27, 28) |
389310e230b6Smaya      __gen_uint(values->TriangleStripListProvokingVertexSelect, 29, 30) |
389410e230b6Smaya      __gen_uint(values->LastPixelEnable, 31, 31);
389510e230b6Smaya
389610e230b6Smaya   dw[4] =
389710e230b6Smaya      __gen_float(values->GlobalDepthOffsetConstant);
389810e230b6Smaya
389910e230b6Smaya   dw[5] =
390010e230b6Smaya      __gen_float(values->GlobalDepthOffsetScale);
390110e230b6Smaya
390210e230b6Smaya   dw[6] =
390310e230b6Smaya      __gen_float(values->GlobalDepthOffsetClamp);
390410e230b6Smaya}
390510e230b6Smaya
390696c5ddc4Srjs#define GFX7_3DSTATE_SO_BUFFER_length          4
390796c5ddc4Srjs#define GFX7_3DSTATE_SO_BUFFER_length_bias      2
390896c5ddc4Srjs#define GFX7_3DSTATE_SO_BUFFER_header           \
390910e230b6Smaya   .DWordLength                         =      2,  \
391010e230b6Smaya   ._3DCommandSubOpcode                 =     24,  \
391110e230b6Smaya   ._3DCommandOpcode                    =      1,  \
391210e230b6Smaya   .CommandSubType                      =      3,  \
391310e230b6Smaya   .CommandType                         =      3
391410e230b6Smaya
391596c5ddc4Srjsstruct GFX7_3DSTATE_SO_BUFFER {
391610e230b6Smaya   uint32_t                             DWordLength;
391710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
391810e230b6Smaya   uint32_t                             _3DCommandOpcode;
391910e230b6Smaya   uint32_t                             CommandSubType;
392010e230b6Smaya   uint32_t                             CommandType;
392110e230b6Smaya   uint32_t                             SurfacePitch;
392210e230b6Smaya   uint32_t                             MOCS;
392310e230b6Smaya   uint32_t                             SOBufferIndex;
392410e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
392510e230b6Smaya   __gen_address_type                   SurfaceEndAddress;
392610e230b6Smaya};
392710e230b6Smaya
392896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
392996c5ddc4SrjsGFX7_3DSTATE_SO_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
393010e230b6Smaya                            __attribute__((unused)) void * restrict dst,
393196c5ddc4Srjs                            __attribute__((unused)) const struct GFX7_3DSTATE_SO_BUFFER * restrict values)
393210e230b6Smaya{
393310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
393410e230b6Smaya
393510e230b6Smaya   dw[0] =
393610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
393710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
393810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
393910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
394010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
394110e230b6Smaya
394210e230b6Smaya   dw[1] =
394310e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 11) |
394410e230b6Smaya      __gen_uint(values->MOCS, 25, 28) |
394510e230b6Smaya      __gen_uint(values->SOBufferIndex, 29, 30);
394610e230b6Smaya
394796c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 2, 31);
394810e230b6Smaya
394996c5ddc4Srjs   dw[3] = __gen_address(data, &dw[3], values->SurfaceEndAddress, 0, 2, 31);
395010e230b6Smaya}
395110e230b6Smaya
395296c5ddc4Srjs#define GFX7_3DSTATE_SO_DECL_LIST_length_bias      2
395396c5ddc4Srjs#define GFX7_3DSTATE_SO_DECL_LIST_header        \
395410e230b6Smaya   ._3DCommandSubOpcode                 =     23,  \
395510e230b6Smaya   ._3DCommandOpcode                    =      1,  \
395610e230b6Smaya   .CommandSubType                      =      3,  \
395710e230b6Smaya   .CommandType                         =      3
395810e230b6Smaya
395996c5ddc4Srjsstruct GFX7_3DSTATE_SO_DECL_LIST {
396010e230b6Smaya   uint32_t                             DWordLength;
396110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
396210e230b6Smaya   uint32_t                             _3DCommandOpcode;
396310e230b6Smaya   uint32_t                             CommandSubType;
396410e230b6Smaya   uint32_t                             CommandType;
396510e230b6Smaya   uint32_t                             StreamtoBufferSelects0;
396610e230b6Smaya   uint32_t                             StreamtoBufferSelects1;
396710e230b6Smaya   uint32_t                             StreamtoBufferSelects2;
396810e230b6Smaya   uint32_t                             StreamtoBufferSelects3;
396910e230b6Smaya   uint32_t                             NumEntries0;
397010e230b6Smaya   uint32_t                             NumEntries1;
397110e230b6Smaya   uint32_t                             NumEntries2;
397210e230b6Smaya   uint32_t                             NumEntries3;
397310e230b6Smaya   /* variable length fields follow */
397410e230b6Smaya};
397510e230b6Smaya
397696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
397796c5ddc4SrjsGFX7_3DSTATE_SO_DECL_LIST_pack(__attribute__((unused)) __gen_user_data *data,
397810e230b6Smaya                               __attribute__((unused)) void * restrict dst,
397996c5ddc4Srjs                               __attribute__((unused)) const struct GFX7_3DSTATE_SO_DECL_LIST * restrict values)
398010e230b6Smaya{
398110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
398210e230b6Smaya
398310e230b6Smaya   dw[0] =
398410e230b6Smaya      __gen_uint(values->DWordLength, 0, 8) |
398510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
398610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
398710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
398810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
398910e230b6Smaya
399010e230b6Smaya   dw[1] =
399110e230b6Smaya      __gen_uint(values->StreamtoBufferSelects0, 0, 3) |
399210e230b6Smaya      __gen_uint(values->StreamtoBufferSelects1, 4, 7) |
399310e230b6Smaya      __gen_uint(values->StreamtoBufferSelects2, 8, 11) |
399410e230b6Smaya      __gen_uint(values->StreamtoBufferSelects3, 12, 15);
399510e230b6Smaya
399610e230b6Smaya   dw[2] =
399710e230b6Smaya      __gen_uint(values->NumEntries0, 0, 7) |
399810e230b6Smaya      __gen_uint(values->NumEntries1, 8, 15) |
399910e230b6Smaya      __gen_uint(values->NumEntries2, 16, 23) |
400010e230b6Smaya      __gen_uint(values->NumEntries3, 24, 31);
400110e230b6Smaya}
400210e230b6Smaya
400396c5ddc4Srjs#define GFX7_3DSTATE_STENCIL_BUFFER_length      3
400496c5ddc4Srjs#define GFX7_3DSTATE_STENCIL_BUFFER_length_bias      2
400596c5ddc4Srjs#define GFX7_3DSTATE_STENCIL_BUFFER_header      \
400610e230b6Smaya   .DWordLength                         =      1,  \
400710e230b6Smaya   ._3DCommandSubOpcode                 =      6,  \
400810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
400910e230b6Smaya   .CommandSubType                      =      3,  \
401010e230b6Smaya   .CommandType                         =      3
401110e230b6Smaya
401296c5ddc4Srjsstruct GFX7_3DSTATE_STENCIL_BUFFER {
401310e230b6Smaya   uint32_t                             DWordLength;
401410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
401510e230b6Smaya   uint32_t                             _3DCommandOpcode;
401610e230b6Smaya   uint32_t                             CommandSubType;
401710e230b6Smaya   uint32_t                             CommandType;
401810e230b6Smaya   uint32_t                             SurfacePitch;
401910e230b6Smaya   uint32_t                             MOCS;
402010e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
402110e230b6Smaya};
402210e230b6Smaya
402396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
402496c5ddc4SrjsGFX7_3DSTATE_STENCIL_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
402510e230b6Smaya                                 __attribute__((unused)) void * restrict dst,
402696c5ddc4Srjs                                 __attribute__((unused)) const struct GFX7_3DSTATE_STENCIL_BUFFER * restrict values)
402710e230b6Smaya{
402810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
402910e230b6Smaya
403010e230b6Smaya   dw[0] =
403110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
403210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
403310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
403410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
403510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
403610e230b6Smaya
403710e230b6Smaya   dw[1] =
403810e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 16) |
403910e230b6Smaya      __gen_uint(values->MOCS, 25, 28);
404010e230b6Smaya
404196c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 0, 31);
404210e230b6Smaya}
404310e230b6Smaya
404496c5ddc4Srjs#define GFX7_3DSTATE_STREAMOUT_length          3
404596c5ddc4Srjs#define GFX7_3DSTATE_STREAMOUT_length_bias      2
404696c5ddc4Srjs#define GFX7_3DSTATE_STREAMOUT_header           \
404710e230b6Smaya   .DWordLength                         =      1,  \
404810e230b6Smaya   ._3DCommandSubOpcode                 =     30,  \
404910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
405010e230b6Smaya   .CommandSubType                      =      3,  \
405110e230b6Smaya   .CommandType                         =      3
405210e230b6Smaya
405396c5ddc4Srjsstruct GFX7_3DSTATE_STREAMOUT {
405410e230b6Smaya   uint32_t                             DWordLength;
405510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
405610e230b6Smaya   uint32_t                             _3DCommandOpcode;
405710e230b6Smaya   uint32_t                             CommandSubType;
405810e230b6Smaya   uint32_t                             CommandType;
405910e230b6Smaya   bool                                 SOBufferEnable0;
406010e230b6Smaya   bool                                 SOBufferEnable1;
406110e230b6Smaya   bool                                 SOBufferEnable2;
406210e230b6Smaya   bool                                 SOBufferEnable3;
406310e230b6Smaya   bool                                 SOStatisticsEnable;
406410e230b6Smaya   uint32_t                             ReorderMode;
406510e230b6Smaya#define LEADING                                  0
406610e230b6Smaya#define TRAILING                                 1
406710e230b6Smaya   uint32_t                             RenderStreamSelect;
406810e230b6Smaya   bool                                 RenderingDisable;
406910e230b6Smaya   bool                                 SOFunctionEnable;
407010e230b6Smaya   uint32_t                             Stream0VertexReadLength;
407110e230b6Smaya   uint32_t                             Stream0VertexReadOffset;
407210e230b6Smaya   uint32_t                             Stream1VertexReadLength;
407310e230b6Smaya   uint32_t                             Stream1VertexReadOffset;
407410e230b6Smaya   uint32_t                             Stream2VertexReadLength;
407510e230b6Smaya   uint32_t                             Stream2VertexReadOffset;
407610e230b6Smaya   uint32_t                             Stream3VertexReadLength;
407710e230b6Smaya   uint32_t                             Stream3VertexReadOffset;
407810e230b6Smaya};
407910e230b6Smaya
408096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
408196c5ddc4SrjsGFX7_3DSTATE_STREAMOUT_pack(__attribute__((unused)) __gen_user_data *data,
408210e230b6Smaya                            __attribute__((unused)) void * restrict dst,
408396c5ddc4Srjs                            __attribute__((unused)) const struct GFX7_3DSTATE_STREAMOUT * restrict values)
408410e230b6Smaya{
408510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
408610e230b6Smaya
408710e230b6Smaya   dw[0] =
408810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
408910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
409010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
409110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
409210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
409310e230b6Smaya
409410e230b6Smaya   dw[1] =
409510e230b6Smaya      __gen_uint(values->SOBufferEnable0, 8, 8) |
409610e230b6Smaya      __gen_uint(values->SOBufferEnable1, 9, 9) |
409710e230b6Smaya      __gen_uint(values->SOBufferEnable2, 10, 10) |
409810e230b6Smaya      __gen_uint(values->SOBufferEnable3, 11, 11) |
409910e230b6Smaya      __gen_uint(values->SOStatisticsEnable, 25, 25) |
410010e230b6Smaya      __gen_uint(values->ReorderMode, 26, 26) |
410110e230b6Smaya      __gen_uint(values->RenderStreamSelect, 27, 28) |
410210e230b6Smaya      __gen_uint(values->RenderingDisable, 30, 30) |
410310e230b6Smaya      __gen_uint(values->SOFunctionEnable, 31, 31);
410410e230b6Smaya
410510e230b6Smaya   dw[2] =
410610e230b6Smaya      __gen_uint(values->Stream0VertexReadLength, 0, 4) |
410710e230b6Smaya      __gen_uint(values->Stream0VertexReadOffset, 5, 5) |
410810e230b6Smaya      __gen_uint(values->Stream1VertexReadLength, 8, 12) |
410910e230b6Smaya      __gen_uint(values->Stream1VertexReadOffset, 13, 13) |
411010e230b6Smaya      __gen_uint(values->Stream2VertexReadLength, 16, 20) |
411110e230b6Smaya      __gen_uint(values->Stream2VertexReadOffset, 21, 21) |
411210e230b6Smaya      __gen_uint(values->Stream3VertexReadLength, 24, 28) |
411310e230b6Smaya      __gen_uint(values->Stream3VertexReadOffset, 29, 29);
411410e230b6Smaya}
411510e230b6Smaya
411696c5ddc4Srjs#define GFX7_3DSTATE_TE_length                 4
411796c5ddc4Srjs#define GFX7_3DSTATE_TE_length_bias            2
411896c5ddc4Srjs#define GFX7_3DSTATE_TE_header                  \
411910e230b6Smaya   .DWordLength                         =      2,  \
412010e230b6Smaya   ._3DCommandSubOpcode                 =     28,  \
412110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
412210e230b6Smaya   .CommandSubType                      =      3,  \
412310e230b6Smaya   .CommandType                         =      3
412410e230b6Smaya
412596c5ddc4Srjsstruct GFX7_3DSTATE_TE {
412610e230b6Smaya   uint32_t                             DWordLength;
412710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
412810e230b6Smaya   uint32_t                             _3DCommandOpcode;
412910e230b6Smaya   uint32_t                             CommandSubType;
413010e230b6Smaya   uint32_t                             CommandType;
413110e230b6Smaya   bool                                 TEEnable;
413210e230b6Smaya   uint32_t                             TEMode;
413310e230b6Smaya#define HW_TESS                                  0
413410e230b6Smaya#define SW_TESS                                  1
413510e230b6Smaya   uint32_t                             TEDomain;
413610e230b6Smaya#define QUAD                                     0
413710e230b6Smaya#define TRI                                      1
413810e230b6Smaya#define ISOLINE                                  2
413910e230b6Smaya   uint32_t                             OutputTopology;
414010e230b6Smaya#define OUTPUT_POINT                             0
414110e230b6Smaya#define OUTPUT_LINE                              1
414210e230b6Smaya#define OUTPUT_TRI_CW                            2
414310e230b6Smaya#define OUTPUT_TRI_CCW                           3
414410e230b6Smaya   uint32_t                             Partitioning;
414510e230b6Smaya#define INTEGER                                  0
414610e230b6Smaya#define ODD_FRACTIONAL                           1
414710e230b6Smaya#define EVEN_FRACTIONAL                          2
414810e230b6Smaya   float                                MaximumTessellationFactorOdd;
414910e230b6Smaya   float                                MaximumTessellationFactorNotOdd;
415010e230b6Smaya};
415110e230b6Smaya
415296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
415396c5ddc4SrjsGFX7_3DSTATE_TE_pack(__attribute__((unused)) __gen_user_data *data,
415410e230b6Smaya                     __attribute__((unused)) void * restrict dst,
415596c5ddc4Srjs                     __attribute__((unused)) const struct GFX7_3DSTATE_TE * restrict values)
415610e230b6Smaya{
415710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
415810e230b6Smaya
415910e230b6Smaya   dw[0] =
416010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
416110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
416210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
416310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
416410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
416510e230b6Smaya
416610e230b6Smaya   dw[1] =
416710e230b6Smaya      __gen_uint(values->TEEnable, 0, 0) |
416810e230b6Smaya      __gen_uint(values->TEMode, 1, 2) |
416910e230b6Smaya      __gen_uint(values->TEDomain, 4, 5) |
417010e230b6Smaya      __gen_uint(values->OutputTopology, 8, 9) |
417110e230b6Smaya      __gen_uint(values->Partitioning, 12, 13);
417210e230b6Smaya
417310e230b6Smaya   dw[2] =
417410e230b6Smaya      __gen_float(values->MaximumTessellationFactorOdd);
417510e230b6Smaya
417610e230b6Smaya   dw[3] =
417710e230b6Smaya      __gen_float(values->MaximumTessellationFactorNotOdd);
417810e230b6Smaya}
417910e230b6Smaya
418096c5ddc4Srjs#define GFX7_3DSTATE_URB_DS_length             2
418196c5ddc4Srjs#define GFX7_3DSTATE_URB_DS_length_bias        2
418296c5ddc4Srjs#define GFX7_3DSTATE_URB_DS_header              \
418310e230b6Smaya   .DWordLength                         =      0,  \
418410e230b6Smaya   ._3DCommandSubOpcode                 =     50,  \
418510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
418610e230b6Smaya   .CommandSubType                      =      3,  \
418710e230b6Smaya   .CommandType                         =      3
418810e230b6Smaya
418996c5ddc4Srjsstruct GFX7_3DSTATE_URB_DS {
419010e230b6Smaya   uint32_t                             DWordLength;
419110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
419210e230b6Smaya   uint32_t                             _3DCommandOpcode;
419310e230b6Smaya   uint32_t                             CommandSubType;
419410e230b6Smaya   uint32_t                             CommandType;
419510e230b6Smaya   uint32_t                             DSNumberofURBEntries;
419610e230b6Smaya   uint32_t                             DSURBEntryAllocationSize;
419710e230b6Smaya   uint32_t                             DSURBStartingAddress;
419810e230b6Smaya};
419910e230b6Smaya
420096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
420196c5ddc4SrjsGFX7_3DSTATE_URB_DS_pack(__attribute__((unused)) __gen_user_data *data,
420210e230b6Smaya                         __attribute__((unused)) void * restrict dst,
420396c5ddc4Srjs                         __attribute__((unused)) const struct GFX7_3DSTATE_URB_DS * restrict values)
420410e230b6Smaya{
420510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
420610e230b6Smaya
420710e230b6Smaya   dw[0] =
420810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
420910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
421010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
421110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
421210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
421310e230b6Smaya
421410e230b6Smaya   dw[1] =
421510e230b6Smaya      __gen_uint(values->DSNumberofURBEntries, 0, 15) |
421610e230b6Smaya      __gen_uint(values->DSURBEntryAllocationSize, 16, 24) |
421710e230b6Smaya      __gen_uint(values->DSURBStartingAddress, 25, 29);
421810e230b6Smaya}
421910e230b6Smaya
422096c5ddc4Srjs#define GFX7_3DSTATE_URB_GS_length             2
422196c5ddc4Srjs#define GFX7_3DSTATE_URB_GS_length_bias        2
422296c5ddc4Srjs#define GFX7_3DSTATE_URB_GS_header              \
422310e230b6Smaya   .DWordLength                         =      0,  \
422410e230b6Smaya   ._3DCommandSubOpcode                 =     51,  \
422510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
422610e230b6Smaya   .CommandSubType                      =      3,  \
422710e230b6Smaya   .CommandType                         =      3
422810e230b6Smaya
422996c5ddc4Srjsstruct GFX7_3DSTATE_URB_GS {
423010e230b6Smaya   uint32_t                             DWordLength;
423110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
423210e230b6Smaya   uint32_t                             _3DCommandOpcode;
423310e230b6Smaya   uint32_t                             CommandSubType;
423410e230b6Smaya   uint32_t                             CommandType;
423510e230b6Smaya   uint32_t                             GSNumberofURBEntries;
423610e230b6Smaya   uint32_t                             GSURBEntryAllocationSize;
423710e230b6Smaya   uint32_t                             GSURBStartingAddress;
423810e230b6Smaya};
423910e230b6Smaya
424096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
424196c5ddc4SrjsGFX7_3DSTATE_URB_GS_pack(__attribute__((unused)) __gen_user_data *data,
424210e230b6Smaya                         __attribute__((unused)) void * restrict dst,
424396c5ddc4Srjs                         __attribute__((unused)) const struct GFX7_3DSTATE_URB_GS * restrict values)
424410e230b6Smaya{
424510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
424610e230b6Smaya
424710e230b6Smaya   dw[0] =
424810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
424910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
425010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
425110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
425210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
425310e230b6Smaya
425410e230b6Smaya   dw[1] =
425510e230b6Smaya      __gen_uint(values->GSNumberofURBEntries, 0, 15) |
425610e230b6Smaya      __gen_uint(values->GSURBEntryAllocationSize, 16, 24) |
425710e230b6Smaya      __gen_uint(values->GSURBStartingAddress, 25, 29);
425810e230b6Smaya}
425910e230b6Smaya
426096c5ddc4Srjs#define GFX7_3DSTATE_URB_HS_length             2
426196c5ddc4Srjs#define GFX7_3DSTATE_URB_HS_length_bias        2
426296c5ddc4Srjs#define GFX7_3DSTATE_URB_HS_header              \
426310e230b6Smaya   .DWordLength                         =      0,  \
426410e230b6Smaya   ._3DCommandSubOpcode                 =     49,  \
426510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
426610e230b6Smaya   .CommandSubType                      =      3,  \
426710e230b6Smaya   .CommandType                         =      3
426810e230b6Smaya
426996c5ddc4Srjsstruct GFX7_3DSTATE_URB_HS {
427010e230b6Smaya   uint32_t                             DWordLength;
427110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
427210e230b6Smaya   uint32_t                             _3DCommandOpcode;
427310e230b6Smaya   uint32_t                             CommandSubType;
427410e230b6Smaya   uint32_t                             CommandType;
427510e230b6Smaya   uint32_t                             HSNumberofURBEntries;
427610e230b6Smaya   uint32_t                             HSURBEntryAllocationSize;
427710e230b6Smaya   uint32_t                             HSURBStartingAddress;
427810e230b6Smaya};
427910e230b6Smaya
428096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
428196c5ddc4SrjsGFX7_3DSTATE_URB_HS_pack(__attribute__((unused)) __gen_user_data *data,
428210e230b6Smaya                         __attribute__((unused)) void * restrict dst,
428396c5ddc4Srjs                         __attribute__((unused)) const struct GFX7_3DSTATE_URB_HS * restrict values)
428410e230b6Smaya{
428510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
428610e230b6Smaya
428710e230b6Smaya   dw[0] =
428810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
428910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
429010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
429110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
429210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
429310e230b6Smaya
429410e230b6Smaya   dw[1] =
429510e230b6Smaya      __gen_uint(values->HSNumberofURBEntries, 0, 15) |
429610e230b6Smaya      __gen_uint(values->HSURBEntryAllocationSize, 16, 24) |
429710e230b6Smaya      __gen_uint(values->HSURBStartingAddress, 25, 29);
429810e230b6Smaya}
429910e230b6Smaya
430096c5ddc4Srjs#define GFX7_3DSTATE_URB_VS_length             2
430196c5ddc4Srjs#define GFX7_3DSTATE_URB_VS_length_bias        2
430296c5ddc4Srjs#define GFX7_3DSTATE_URB_VS_header              \
430310e230b6Smaya   .DWordLength                         =      0,  \
430410e230b6Smaya   ._3DCommandSubOpcode                 =     48,  \
430510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
430610e230b6Smaya   .CommandSubType                      =      3,  \
430710e230b6Smaya   .CommandType                         =      3
430810e230b6Smaya
430996c5ddc4Srjsstruct GFX7_3DSTATE_URB_VS {
431010e230b6Smaya   uint32_t                             DWordLength;
431110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
431210e230b6Smaya   uint32_t                             _3DCommandOpcode;
431310e230b6Smaya   uint32_t                             CommandSubType;
431410e230b6Smaya   uint32_t                             CommandType;
431510e230b6Smaya   uint32_t                             VSNumberofURBEntries;
431610e230b6Smaya   uint32_t                             VSURBEntryAllocationSize;
431710e230b6Smaya   uint32_t                             VSURBStartingAddress;
431810e230b6Smaya};
431910e230b6Smaya
432096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
432196c5ddc4SrjsGFX7_3DSTATE_URB_VS_pack(__attribute__((unused)) __gen_user_data *data,
432210e230b6Smaya                         __attribute__((unused)) void * restrict dst,
432396c5ddc4Srjs                         __attribute__((unused)) const struct GFX7_3DSTATE_URB_VS * restrict values)
432410e230b6Smaya{
432510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
432610e230b6Smaya
432710e230b6Smaya   dw[0] =
432810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
432910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
433010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
433110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
433210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
433310e230b6Smaya
433410e230b6Smaya   dw[1] =
433510e230b6Smaya      __gen_uint(values->VSNumberofURBEntries, 0, 15) |
433610e230b6Smaya      __gen_uint(values->VSURBEntryAllocationSize, 16, 24) |
433710e230b6Smaya      __gen_uint(values->VSURBStartingAddress, 25, 29);
433810e230b6Smaya}
433910e230b6Smaya
434096c5ddc4Srjs#define GFX7_3DSTATE_VERTEX_BUFFERS_length_bias      2
434196c5ddc4Srjs#define GFX7_3DSTATE_VERTEX_BUFFERS_header      \
434210e230b6Smaya   .DWordLength                         =      3,  \
434310e230b6Smaya   ._3DCommandSubOpcode                 =      8,  \
434410e230b6Smaya   ._3DCommandOpcode                    =      0,  \
434510e230b6Smaya   .CommandSubType                      =      3,  \
434610e230b6Smaya   .CommandType                         =      3
434710e230b6Smaya
434896c5ddc4Srjsstruct GFX7_3DSTATE_VERTEX_BUFFERS {
434910e230b6Smaya   uint32_t                             DWordLength;
435010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
435110e230b6Smaya   uint32_t                             _3DCommandOpcode;
435210e230b6Smaya   uint32_t                             CommandSubType;
435310e230b6Smaya   uint32_t                             CommandType;
435410e230b6Smaya   /* variable length fields follow */
435510e230b6Smaya};
435610e230b6Smaya
435796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
435896c5ddc4SrjsGFX7_3DSTATE_VERTEX_BUFFERS_pack(__attribute__((unused)) __gen_user_data *data,
435910e230b6Smaya                                 __attribute__((unused)) void * restrict dst,
436096c5ddc4Srjs                                 __attribute__((unused)) const struct GFX7_3DSTATE_VERTEX_BUFFERS * restrict values)
436110e230b6Smaya{
436210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
436310e230b6Smaya
436410e230b6Smaya   dw[0] =
436510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
436610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
436710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
436810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
436910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
437010e230b6Smaya}
437110e230b6Smaya
437296c5ddc4Srjs#define GFX7_3DSTATE_VERTEX_ELEMENTS_length_bias      2
437396c5ddc4Srjs#define GFX7_3DSTATE_VERTEX_ELEMENTS_header     \
437410e230b6Smaya   .DWordLength                         =      1,  \
437510e230b6Smaya   ._3DCommandSubOpcode                 =      9,  \
437610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
437710e230b6Smaya   .CommandSubType                      =      3,  \
437810e230b6Smaya   .CommandType                         =      3
437910e230b6Smaya
438096c5ddc4Srjsstruct GFX7_3DSTATE_VERTEX_ELEMENTS {
438110e230b6Smaya   uint32_t                             DWordLength;
438210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
438310e230b6Smaya   uint32_t                             _3DCommandOpcode;
438410e230b6Smaya   uint32_t                             CommandSubType;
438510e230b6Smaya   uint32_t                             CommandType;
438610e230b6Smaya   /* variable length fields follow */
438710e230b6Smaya};
438810e230b6Smaya
438996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
439096c5ddc4SrjsGFX7_3DSTATE_VERTEX_ELEMENTS_pack(__attribute__((unused)) __gen_user_data *data,
439110e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
439296c5ddc4Srjs                                  __attribute__((unused)) const struct GFX7_3DSTATE_VERTEX_ELEMENTS * restrict values)
439310e230b6Smaya{
439410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
439510e230b6Smaya
439610e230b6Smaya   dw[0] =
439710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
439810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
439910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
440010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
440110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
440210e230b6Smaya}
440310e230b6Smaya
440496c5ddc4Srjs#define GFX7_3DSTATE_VF_STATISTICS_length      1
440596c5ddc4Srjs#define GFX7_3DSTATE_VF_STATISTICS_length_bias      1
440696c5ddc4Srjs#define GFX7_3DSTATE_VF_STATISTICS_header       \
440710e230b6Smaya   ._3DCommandSubOpcode                 =     11,  \
440810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
440910e230b6Smaya   .CommandSubType                      =      1,  \
441010e230b6Smaya   .CommandType                         =      3
441110e230b6Smaya
441296c5ddc4Srjsstruct GFX7_3DSTATE_VF_STATISTICS {
441310e230b6Smaya   bool                                 StatisticsEnable;
441410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
441510e230b6Smaya   uint32_t                             _3DCommandOpcode;
441610e230b6Smaya   uint32_t                             CommandSubType;
441710e230b6Smaya   uint32_t                             CommandType;
441810e230b6Smaya};
441910e230b6Smaya
442096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
442196c5ddc4SrjsGFX7_3DSTATE_VF_STATISTICS_pack(__attribute__((unused)) __gen_user_data *data,
442210e230b6Smaya                                __attribute__((unused)) void * restrict dst,
442396c5ddc4Srjs                                __attribute__((unused)) const struct GFX7_3DSTATE_VF_STATISTICS * restrict values)
442410e230b6Smaya{
442510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
442610e230b6Smaya
442710e230b6Smaya   dw[0] =
442810e230b6Smaya      __gen_uint(values->StatisticsEnable, 0, 0) |
442910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
443010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
443110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
443210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
443310e230b6Smaya}
443410e230b6Smaya
443596c5ddc4Srjs#define GFX7_3DSTATE_VIEWPORT_STATE_POINTERS_CC_length      2
443696c5ddc4Srjs#define GFX7_3DSTATE_VIEWPORT_STATE_POINTERS_CC_length_bias      2
443796c5ddc4Srjs#define GFX7_3DSTATE_VIEWPORT_STATE_POINTERS_CC_header\
443810e230b6Smaya   .DWordLength                         =      0,  \
443910e230b6Smaya   ._3DCommandSubOpcode                 =     35,  \
444010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
444110e230b6Smaya   .CommandSubType                      =      3,  \
444210e230b6Smaya   .CommandType                         =      3
444310e230b6Smaya
444496c5ddc4Srjsstruct GFX7_3DSTATE_VIEWPORT_STATE_POINTERS_CC {
444510e230b6Smaya   uint32_t                             DWordLength;
444610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
444710e230b6Smaya   uint32_t                             _3DCommandOpcode;
444810e230b6Smaya   uint32_t                             CommandSubType;
444910e230b6Smaya   uint32_t                             CommandType;
445010e230b6Smaya   uint64_t                             CCViewportPointer;
445110e230b6Smaya};
445210e230b6Smaya
445396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
445496c5ddc4SrjsGFX7_3DSTATE_VIEWPORT_STATE_POINTERS_CC_pack(__attribute__((unused)) __gen_user_data *data,
445510e230b6Smaya                                             __attribute__((unused)) void * restrict dst,
445696c5ddc4Srjs                                             __attribute__((unused)) const struct GFX7_3DSTATE_VIEWPORT_STATE_POINTERS_CC * restrict values)
445710e230b6Smaya{
445810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
445910e230b6Smaya
446010e230b6Smaya   dw[0] =
446110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
446210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
446310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
446410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
446510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
446610e230b6Smaya
446710e230b6Smaya   dw[1] =
446810e230b6Smaya      __gen_offset(values->CCViewportPointer, 5, 31);
446910e230b6Smaya}
447010e230b6Smaya
447196c5ddc4Srjs#define GFX7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_length      2
447296c5ddc4Srjs#define GFX7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_length_bias      2
447396c5ddc4Srjs#define GFX7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_header\
447410e230b6Smaya   .DWordLength                         =      0,  \
447510e230b6Smaya   ._3DCommandSubOpcode                 =     33,  \
447610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
447710e230b6Smaya   .CommandSubType                      =      3,  \
447810e230b6Smaya   .CommandType                         =      3
447910e230b6Smaya
448096c5ddc4Srjsstruct GFX7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP {
448110e230b6Smaya   uint32_t                             DWordLength;
448210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
448310e230b6Smaya   uint32_t                             _3DCommandOpcode;
448410e230b6Smaya   uint32_t                             CommandSubType;
448510e230b6Smaya   uint32_t                             CommandType;
448610e230b6Smaya   uint64_t                             SFClipViewportPointer;
448710e230b6Smaya};
448810e230b6Smaya
448996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
449096c5ddc4SrjsGFX7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
449110e230b6Smaya                                                  __attribute__((unused)) void * restrict dst,
449296c5ddc4Srjs                                                  __attribute__((unused)) const struct GFX7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP * restrict values)
449310e230b6Smaya{
449410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
449510e230b6Smaya
449610e230b6Smaya   dw[0] =
449710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
449810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
449910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
450010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
450110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
450210e230b6Smaya
450310e230b6Smaya   dw[1] =
450410e230b6Smaya      __gen_offset(values->SFClipViewportPointer, 6, 31);
450510e230b6Smaya}
450610e230b6Smaya
450796c5ddc4Srjs#define GFX7_3DSTATE_VS_length                 6
450896c5ddc4Srjs#define GFX7_3DSTATE_VS_length_bias            2
450996c5ddc4Srjs#define GFX7_3DSTATE_VS_header                  \
451010e230b6Smaya   .DWordLength                         =      4,  \
451110e230b6Smaya   ._3DCommandSubOpcode                 =     16,  \
451210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
451310e230b6Smaya   .CommandSubType                      =      3,  \
451410e230b6Smaya   .CommandType                         =      3
451510e230b6Smaya
451696c5ddc4Srjsstruct GFX7_3DSTATE_VS {
451710e230b6Smaya   uint32_t                             DWordLength;
451810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
451910e230b6Smaya   uint32_t                             _3DCommandOpcode;
452010e230b6Smaya   uint32_t                             CommandSubType;
452110e230b6Smaya   uint32_t                             CommandType;
452210e230b6Smaya   uint64_t                             KernelStartPointer;
452310e230b6Smaya   bool                                 SoftwareExceptionEnable;
452410e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
452510e230b6Smaya   uint32_t                             FloatingPointMode;
452610e230b6Smaya#define IEEE754                                  0
452710e230b6Smaya#define Alternate                                1
452810e230b6Smaya   uint32_t                             BindingTableEntryCount;
452910e230b6Smaya   uint32_t                             SamplerCount;
453010e230b6Smaya#define NoSamplers                               0
453110e230b6Smaya#define _14Samplers                              1
453210e230b6Smaya#define _58Samplers                              2
453310e230b6Smaya#define _912Samplers                             3
453410e230b6Smaya#define _1316Samplers                            4
453510e230b6Smaya   bool                                 VectorMaskEnable;
453610e230b6Smaya   bool                                 SingleVertexDispatch;
453710e230b6Smaya   uint32_t                             PerThreadScratchSpace;
453810e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
453910e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
454010e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
454110e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData;
454210e230b6Smaya   bool                                 Enable;
454310e230b6Smaya   bool                                 VertexCacheDisable;
454410e230b6Smaya   bool                                 StatisticsEnable;
454510e230b6Smaya   uint32_t                             MaximumNumberofThreads;
454610e230b6Smaya};
454710e230b6Smaya
454896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
454996c5ddc4SrjsGFX7_3DSTATE_VS_pack(__attribute__((unused)) __gen_user_data *data,
455010e230b6Smaya                     __attribute__((unused)) void * restrict dst,
455196c5ddc4Srjs                     __attribute__((unused)) const struct GFX7_3DSTATE_VS * restrict values)
455210e230b6Smaya{
455310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
455410e230b6Smaya
455510e230b6Smaya   dw[0] =
455610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
455710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
455810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
455910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
456010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
456110e230b6Smaya
456210e230b6Smaya   dw[1] =
456310e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 31);
456410e230b6Smaya
456510e230b6Smaya   dw[2] =
456610e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
456710e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
456810e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
456910e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
457010e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
457110e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
457210e230b6Smaya      __gen_uint(values->SingleVertexDispatch, 31, 31);
457310e230b6Smaya
457410e230b6Smaya   const uint32_t v3 =
457510e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
457696c5ddc4Srjs   dw[3] = __gen_address(data, &dw[3], values->ScratchSpaceBasePointer, v3, 10, 31);
457710e230b6Smaya
457810e230b6Smaya   dw[4] =
457910e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
458010e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
458110e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
458210e230b6Smaya
458310e230b6Smaya   dw[5] =
458410e230b6Smaya      __gen_uint(values->Enable, 0, 0) |
458510e230b6Smaya      __gen_uint(values->VertexCacheDisable, 1, 1) |
458610e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
458710e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 25, 31);
458810e230b6Smaya}
458910e230b6Smaya
459096c5ddc4Srjs#define GFX7_3DSTATE_WM_length                 3
459196c5ddc4Srjs#define GFX7_3DSTATE_WM_length_bias            2
459296c5ddc4Srjs#define GFX7_3DSTATE_WM_header                  \
459310e230b6Smaya   .DWordLength                         =      1,  \
459410e230b6Smaya   ._3DCommandSubOpcode                 =     20,  \
459510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
459610e230b6Smaya   .CommandSubType                      =      3,  \
459710e230b6Smaya   .CommandType                         =      3
459810e230b6Smaya
459996c5ddc4Srjsstruct GFX7_3DSTATE_WM {
460010e230b6Smaya   uint32_t                             DWordLength;
460110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
460210e230b6Smaya   uint32_t                             _3DCommandOpcode;
460310e230b6Smaya   uint32_t                             CommandSubType;
460410e230b6Smaya   uint32_t                             CommandType;
460510e230b6Smaya   uint32_t                             MultisampleRasterizationMode;
460610e230b6Smaya#define MSRASTMODE_OFF_PIXEL                     0
460710e230b6Smaya#define MSRASTMODE_OFF_PATTERN                   1
460810e230b6Smaya#define MSRASTMODE_ON_PIXEL                      2
460910e230b6Smaya#define MSRASTMODE_ON_PATTERN                    3
461010e230b6Smaya   uint32_t                             PointRasterizationRule;
461110e230b6Smaya#define RASTRULE_UPPER_LEFT                      0
461210e230b6Smaya#define RASTRULE_UPPER_RIGHT                     1
461310e230b6Smaya   bool                                 LineStippleEnable;
461410e230b6Smaya   bool                                 PolygonStippleEnable;
461510e230b6Smaya   uint32_t                             LineAntialiasingRegionWidth;
461610e230b6Smaya#define _05pixels                                0
461710e230b6Smaya#define _10pixels                                1
461810e230b6Smaya#define _20pixels                                2
461910e230b6Smaya#define _40pixels                                3
462010e230b6Smaya   uint32_t                             LineEndCapAntialiasingRegionWidth;
462110e230b6Smaya   bool                                 PixelShaderUsesInputCoverageMask;
462210e230b6Smaya   uint32_t                             BarycentricInterpolationMode;
462310e230b6Smaya#define BIM_PERSPECTIVE_PIXEL                    1
462410e230b6Smaya#define BIM_PERSPECTIVE_CENTROID                 2
462510e230b6Smaya#define BIM_PERSPECTIVE_SAMPLE                   4
462610e230b6Smaya#define BIM_LINEAR_PIXEL                         8
462710e230b6Smaya#define BIM_LINEAR_CENTROID                      16
462810e230b6Smaya#define BIM_LINEAR_SAMPLE                        32
462910e230b6Smaya   uint32_t                             PositionZWInterpolationMode;
463010e230b6Smaya#define INTERP_PIXEL                             0
463110e230b6Smaya#define INTERP_CENTROID                          2
463210e230b6Smaya#define INTERP_SAMPLE                            3
463310e230b6Smaya   bool                                 PixelShaderUsesSourceW;
463410e230b6Smaya   bool                                 PixelShaderUsesSourceDepth;
463510e230b6Smaya   uint32_t                             EarlyDepthStencilControl;
463610e230b6Smaya#define EDSC_NORMAL                              0
463710e230b6Smaya#define EDSC_PSEXEC                              1
463810e230b6Smaya#define EDSC_PREPS                               2
463910e230b6Smaya   uint32_t                             PixelShaderComputedDepthMode;
464010e230b6Smaya#define PSCDEPTH_OFF                             0
464110e230b6Smaya#define PSCDEPTH_ON                              1
464210e230b6Smaya#define PSCDEPTH_ON_GE                           2
464310e230b6Smaya#define PSCDEPTH_ON_LE                           3
464410e230b6Smaya   bool                                 PixelShaderKillsPixel;
464510e230b6Smaya   bool                                 LegacyDiamondLineRasterization;
464610e230b6Smaya   bool                                 HierarchicalDepthBufferResolveEnable;
464710e230b6Smaya   bool                                 DepthBufferResolveEnable;
464810e230b6Smaya   bool                                 ThreadDispatchEnable;
464910e230b6Smaya   bool                                 DepthBufferClear;
465010e230b6Smaya   bool                                 StatisticsEnable;
465110e230b6Smaya   uint32_t                             MultisampleDispatchMode;
465210e230b6Smaya#define MSDISPMODE_PERSAMPLE                     0
465310e230b6Smaya#define MSDISPMODE_PERPIXEL                      1
465410e230b6Smaya};
465510e230b6Smaya
465696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
465796c5ddc4SrjsGFX7_3DSTATE_WM_pack(__attribute__((unused)) __gen_user_data *data,
465810e230b6Smaya                     __attribute__((unused)) void * restrict dst,
465996c5ddc4Srjs                     __attribute__((unused)) const struct GFX7_3DSTATE_WM * restrict values)
466010e230b6Smaya{
466110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
466210e230b6Smaya
466310e230b6Smaya   dw[0] =
466410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
466510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
466610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
466710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
466810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
466910e230b6Smaya
467010e230b6Smaya   dw[1] =
467110e230b6Smaya      __gen_uint(values->MultisampleRasterizationMode, 0, 1) |
467210e230b6Smaya      __gen_uint(values->PointRasterizationRule, 2, 2) |
467310e230b6Smaya      __gen_uint(values->LineStippleEnable, 3, 3) |
467410e230b6Smaya      __gen_uint(values->PolygonStippleEnable, 4, 4) |
467510e230b6Smaya      __gen_uint(values->LineAntialiasingRegionWidth, 6, 7) |
467610e230b6Smaya      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 8, 9) |
467710e230b6Smaya      __gen_uint(values->PixelShaderUsesInputCoverageMask, 10, 10) |
467810e230b6Smaya      __gen_uint(values->BarycentricInterpolationMode, 11, 16) |
467910e230b6Smaya      __gen_uint(values->PositionZWInterpolationMode, 17, 18) |
468010e230b6Smaya      __gen_uint(values->PixelShaderUsesSourceW, 19, 19) |
468110e230b6Smaya      __gen_uint(values->PixelShaderUsesSourceDepth, 20, 20) |
468210e230b6Smaya      __gen_uint(values->EarlyDepthStencilControl, 21, 22) |
468310e230b6Smaya      __gen_uint(values->PixelShaderComputedDepthMode, 23, 24) |
468410e230b6Smaya      __gen_uint(values->PixelShaderKillsPixel, 25, 25) |
468510e230b6Smaya      __gen_uint(values->LegacyDiamondLineRasterization, 26, 26) |
468610e230b6Smaya      __gen_uint(values->HierarchicalDepthBufferResolveEnable, 27, 27) |
468710e230b6Smaya      __gen_uint(values->DepthBufferResolveEnable, 28, 28) |
468810e230b6Smaya      __gen_uint(values->ThreadDispatchEnable, 29, 29) |
468910e230b6Smaya      __gen_uint(values->DepthBufferClear, 30, 30) |
469010e230b6Smaya      __gen_uint(values->StatisticsEnable, 31, 31);
469110e230b6Smaya
469210e230b6Smaya   dw[2] =
469310e230b6Smaya      __gen_uint(values->MultisampleDispatchMode, 31, 31);
469410e230b6Smaya}
469510e230b6Smaya
469696c5ddc4Srjs#define GFX7_GPGPU_OBJECT_length               8
469796c5ddc4Srjs#define GFX7_GPGPU_OBJECT_length_bias          2
469896c5ddc4Srjs#define GFX7_GPGPU_OBJECT_header                \
469910e230b6Smaya   .DWordLength                         =      6,  \
470010e230b6Smaya   .SubOpcode                           =      4,  \
470110e230b6Smaya   .MediaCommandOpcode                  =      1,  \
470210e230b6Smaya   .Pipeline                            =      2,  \
470310e230b6Smaya   .CommandType                         =      3
470410e230b6Smaya
470596c5ddc4Srjsstruct GFX7_GPGPU_OBJECT {
470610e230b6Smaya   uint32_t                             DWordLength;
470710e230b6Smaya   bool                                 PredicateEnable;
470810e230b6Smaya   uint32_t                             SubOpcode;
470910e230b6Smaya   uint32_t                             MediaCommandOpcode;
471010e230b6Smaya   uint32_t                             Pipeline;
471110e230b6Smaya   uint32_t                             CommandType;
471210e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
471310e230b6Smaya   uint32_t                             SharedLocalMemoryFixedOffset;
471410e230b6Smaya   uint32_t                             IndirectDataLength;
471510e230b6Smaya   uint32_t                             HalfSliceDestinationSelect;
471610e230b6Smaya#define HalfSlice1                               2
471710e230b6Smaya#define HalfSlice0                               1
471810e230b6Smaya#define EitherHalfSlice                          0
471910e230b6Smaya   uint32_t                             EndofThreadGroup;
472010e230b6Smaya   uint32_t                             SharedLocalMemoryOffset;
472110e230b6Smaya   uint64_t                             IndirectDataStartAddress;
472210e230b6Smaya   uint32_t                             ThreadGroupIDX;
472310e230b6Smaya   uint32_t                             ThreadGroupIDY;
472410e230b6Smaya   uint32_t                             ThreadGroupIDZ;
472510e230b6Smaya   uint32_t                             ExecutionMask;
472610e230b6Smaya};
472710e230b6Smaya
472896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
472996c5ddc4SrjsGFX7_GPGPU_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
473010e230b6Smaya                       __attribute__((unused)) void * restrict dst,
473196c5ddc4Srjs                       __attribute__((unused)) const struct GFX7_GPGPU_OBJECT * restrict values)
473210e230b6Smaya{
473310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
473410e230b6Smaya
473510e230b6Smaya   dw[0] =
473610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
473710e230b6Smaya      __gen_uint(values->PredicateEnable, 8, 8) |
473810e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
473910e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
474010e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
474110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
474210e230b6Smaya
474310e230b6Smaya   dw[1] =
474410e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 4) |
474510e230b6Smaya      __gen_uint(values->SharedLocalMemoryFixedOffset, 7, 7);
474610e230b6Smaya
474710e230b6Smaya   dw[2] =
474810e230b6Smaya      __gen_uint(values->IndirectDataLength, 0, 16) |
474910e230b6Smaya      __gen_uint(values->HalfSliceDestinationSelect, 17, 18) |
475010e230b6Smaya      __gen_uint(values->EndofThreadGroup, 24, 24) |
475110e230b6Smaya      __gen_uint(values->SharedLocalMemoryOffset, 28, 31);
475210e230b6Smaya
475310e230b6Smaya   dw[3] =
475410e230b6Smaya      __gen_offset(values->IndirectDataStartAddress, 0, 31);
475510e230b6Smaya
475610e230b6Smaya   dw[4] =
475710e230b6Smaya      __gen_uint(values->ThreadGroupIDX, 0, 31);
475810e230b6Smaya
475910e230b6Smaya   dw[5] =
476010e230b6Smaya      __gen_uint(values->ThreadGroupIDY, 0, 31);
476110e230b6Smaya
476210e230b6Smaya   dw[6] =
476310e230b6Smaya      __gen_uint(values->ThreadGroupIDZ, 0, 31);
476410e230b6Smaya
476510e230b6Smaya   dw[7] =
476610e230b6Smaya      __gen_uint(values->ExecutionMask, 0, 31);
476710e230b6Smaya}
476810e230b6Smaya
476996c5ddc4Srjs#define GFX7_GPGPU_WALKER_length              11
477096c5ddc4Srjs#define GFX7_GPGPU_WALKER_length_bias          2
477196c5ddc4Srjs#define GFX7_GPGPU_WALKER_header                \
477210e230b6Smaya   .DWordLength                         =      9,  \
477310e230b6Smaya   .SubOpcodeA                          =      5,  \
477410e230b6Smaya   .MediaCommandOpcode                  =      1,  \
477510e230b6Smaya   .Pipeline                            =      2,  \
477610e230b6Smaya   .CommandType                         =      3
477710e230b6Smaya
477896c5ddc4Srjsstruct GFX7_GPGPU_WALKER {
477910e230b6Smaya   uint32_t                             DWordLength;
478010e230b6Smaya   bool                                 PredicateEnable;
478110e230b6Smaya   bool                                 IndirectParameterEnable;
478210e230b6Smaya   uint32_t                             SubOpcodeA;
478310e230b6Smaya   uint32_t                             MediaCommandOpcode;
478410e230b6Smaya   uint32_t                             Pipeline;
478510e230b6Smaya   uint32_t                             CommandType;
478610e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
478710e230b6Smaya   uint32_t                             ThreadWidthCounterMaximum;
478810e230b6Smaya   uint32_t                             ThreadHeightCounterMaximum;
478910e230b6Smaya   uint32_t                             ThreadDepthCounterMaximum;
479010e230b6Smaya   uint32_t                             SIMDSize;
479110e230b6Smaya#define SIMD8                                    0
479210e230b6Smaya#define SIMD16                                   1
479310e230b6Smaya#define SIMD32                                   2
479410e230b6Smaya   uint32_t                             ThreadGroupIDStartingX;
479510e230b6Smaya   uint32_t                             ThreadGroupIDXDimension;
479610e230b6Smaya   uint32_t                             ThreadGroupIDStartingY;
479710e230b6Smaya   uint32_t                             ThreadGroupIDYDimension;
479810e230b6Smaya   uint32_t                             ThreadGroupIDStartingZ;
479910e230b6Smaya   uint32_t                             ThreadGroupIDZDimension;
480010e230b6Smaya   uint32_t                             RightExecutionMask;
480110e230b6Smaya   uint32_t                             BottomExecutionMask;
480210e230b6Smaya};
480310e230b6Smaya
480496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
480596c5ddc4SrjsGFX7_GPGPU_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
480610e230b6Smaya                       __attribute__((unused)) void * restrict dst,
480796c5ddc4Srjs                       __attribute__((unused)) const struct GFX7_GPGPU_WALKER * restrict values)
480810e230b6Smaya{
480910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
481010e230b6Smaya
481110e230b6Smaya   dw[0] =
481210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
481310e230b6Smaya      __gen_uint(values->PredicateEnable, 8, 8) |
481410e230b6Smaya      __gen_uint(values->IndirectParameterEnable, 10, 10) |
481510e230b6Smaya      __gen_uint(values->SubOpcodeA, 16, 23) |
481610e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
481710e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
481810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
481910e230b6Smaya
482010e230b6Smaya   dw[1] =
482110e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
482210e230b6Smaya
482310e230b6Smaya   dw[2] =
482410e230b6Smaya      __gen_uint(values->ThreadWidthCounterMaximum, 0, 5) |
482510e230b6Smaya      __gen_uint(values->ThreadHeightCounterMaximum, 8, 13) |
482610e230b6Smaya      __gen_uint(values->ThreadDepthCounterMaximum, 16, 21) |
482710e230b6Smaya      __gen_uint(values->SIMDSize, 30, 31);
482810e230b6Smaya
482910e230b6Smaya   dw[3] =
483010e230b6Smaya      __gen_uint(values->ThreadGroupIDStartingX, 0, 31);
483110e230b6Smaya
483210e230b6Smaya   dw[4] =
483310e230b6Smaya      __gen_uint(values->ThreadGroupIDXDimension, 0, 31);
483410e230b6Smaya
483510e230b6Smaya   dw[5] =
483610e230b6Smaya      __gen_uint(values->ThreadGroupIDStartingY, 0, 31);
483710e230b6Smaya
483810e230b6Smaya   dw[6] =
483910e230b6Smaya      __gen_uint(values->ThreadGroupIDYDimension, 0, 31);
484010e230b6Smaya
484110e230b6Smaya   dw[7] =
484210e230b6Smaya      __gen_uint(values->ThreadGroupIDStartingZ, 0, 31);
484310e230b6Smaya
484410e230b6Smaya   dw[8] =
484510e230b6Smaya      __gen_uint(values->ThreadGroupIDZDimension, 0, 31);
484610e230b6Smaya
484710e230b6Smaya   dw[9] =
484810e230b6Smaya      __gen_uint(values->RightExecutionMask, 0, 31);
484910e230b6Smaya
485010e230b6Smaya   dw[10] =
485110e230b6Smaya      __gen_uint(values->BottomExecutionMask, 0, 31);
485210e230b6Smaya}
485310e230b6Smaya
485496c5ddc4Srjs#define GFX7_MEDIA_CURBE_LOAD_length           4
485596c5ddc4Srjs#define GFX7_MEDIA_CURBE_LOAD_length_bias      2
485696c5ddc4Srjs#define GFX7_MEDIA_CURBE_LOAD_header            \
485710e230b6Smaya   .DWordLength                         =      2,  \
485810e230b6Smaya   .SubOpcode                           =      1,  \
485910e230b6Smaya   .MediaCommandOpcode                  =      0,  \
486010e230b6Smaya   .Pipeline                            =      2,  \
486110e230b6Smaya   .CommandType                         =      3
486210e230b6Smaya
486396c5ddc4Srjsstruct GFX7_MEDIA_CURBE_LOAD {
486410e230b6Smaya   uint32_t                             DWordLength;
486510e230b6Smaya   uint32_t                             SubOpcode;
486610e230b6Smaya   uint32_t                             MediaCommandOpcode;
486710e230b6Smaya   uint32_t                             Pipeline;
486810e230b6Smaya   uint32_t                             CommandType;
486910e230b6Smaya   uint32_t                             CURBETotalDataLength;
487010e230b6Smaya   uint32_t                             CURBEDataStartAddress;
487110e230b6Smaya};
487210e230b6Smaya
487396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
487496c5ddc4SrjsGFX7_MEDIA_CURBE_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
487510e230b6Smaya                           __attribute__((unused)) void * restrict dst,
487696c5ddc4Srjs                           __attribute__((unused)) const struct GFX7_MEDIA_CURBE_LOAD * restrict values)
487710e230b6Smaya{
487810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
487910e230b6Smaya
488010e230b6Smaya   dw[0] =
488110e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
488210e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
488310e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
488410e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
488510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
488610e230b6Smaya
488710e230b6Smaya   dw[1] = 0;
488810e230b6Smaya
488910e230b6Smaya   dw[2] =
489010e230b6Smaya      __gen_uint(values->CURBETotalDataLength, 0, 16);
489110e230b6Smaya
489210e230b6Smaya   dw[3] =
489310e230b6Smaya      __gen_uint(values->CURBEDataStartAddress, 0, 31);
489410e230b6Smaya}
489510e230b6Smaya
489696c5ddc4Srjs#define GFX7_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length      4
489796c5ddc4Srjs#define GFX7_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length_bias      2
489896c5ddc4Srjs#define GFX7_MEDIA_INTERFACE_DESCRIPTOR_LOAD_header\
489910e230b6Smaya   .DWordLength                         =      2,  \
490010e230b6Smaya   .SubOpcode                           =      2,  \
490110e230b6Smaya   .MediaCommandOpcode                  =      0,  \
490210e230b6Smaya   .Pipeline                            =      2,  \
490310e230b6Smaya   .CommandType                         =      3
490410e230b6Smaya
490596c5ddc4Srjsstruct GFX7_MEDIA_INTERFACE_DESCRIPTOR_LOAD {
490610e230b6Smaya   uint32_t                             DWordLength;
490710e230b6Smaya   uint32_t                             SubOpcode;
490810e230b6Smaya   uint32_t                             MediaCommandOpcode;
490910e230b6Smaya   uint32_t                             Pipeline;
491010e230b6Smaya   uint32_t                             CommandType;
491110e230b6Smaya   uint32_t                             InterfaceDescriptorTotalLength;
491210e230b6Smaya   uint64_t                             InterfaceDescriptorDataStartAddress;
491310e230b6Smaya};
491410e230b6Smaya
491596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
491696c5ddc4SrjsGFX7_MEDIA_INTERFACE_DESCRIPTOR_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
491710e230b6Smaya                                          __attribute__((unused)) void * restrict dst,
491896c5ddc4Srjs                                          __attribute__((unused)) const struct GFX7_MEDIA_INTERFACE_DESCRIPTOR_LOAD * restrict values)
491910e230b6Smaya{
492010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
492110e230b6Smaya
492210e230b6Smaya   dw[0] =
492310e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
492410e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
492510e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
492610e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
492710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
492810e230b6Smaya
492910e230b6Smaya   dw[1] = 0;
493010e230b6Smaya
493110e230b6Smaya   dw[2] =
493210e230b6Smaya      __gen_uint(values->InterfaceDescriptorTotalLength, 0, 16);
493310e230b6Smaya
493410e230b6Smaya   dw[3] =
493510e230b6Smaya      __gen_offset(values->InterfaceDescriptorDataStartAddress, 0, 31);
493610e230b6Smaya}
493710e230b6Smaya
493896c5ddc4Srjs#define GFX7_MEDIA_OBJECT_length_bias          2
493996c5ddc4Srjs#define GFX7_MEDIA_OBJECT_header                \
494010e230b6Smaya   .DWordLength                         =      4,  \
494110e230b6Smaya   .MediaCommandSubOpcode               =      0,  \
494210e230b6Smaya   .MediaCommandOpcode                  =      1,  \
494310e230b6Smaya   .MediaCommandPipeline                =      2,  \
494410e230b6Smaya   .CommandType                         =      3
494510e230b6Smaya
494696c5ddc4Srjsstruct GFX7_MEDIA_OBJECT {
494710e230b6Smaya   uint32_t                             DWordLength;
494810e230b6Smaya   uint32_t                             MediaCommandSubOpcode;
494910e230b6Smaya   uint32_t                             MediaCommandOpcode;
495010e230b6Smaya   uint32_t                             MediaCommandPipeline;
495110e230b6Smaya   uint32_t                             CommandType;
495210e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
495310e230b6Smaya   uint32_t                             IndirectDataLength;
495410e230b6Smaya   uint32_t                             HalfSliceDestinationSelect;
495510e230b6Smaya#define HalfSlice1                               2
495610e230b6Smaya#define HalfSlice0                               1
495710e230b6Smaya#define Eitherhalfslice                          0
495810e230b6Smaya   uint32_t                             UseScoreboard;
495910e230b6Smaya#define Notusingscoreboard                       0
496010e230b6Smaya#define Usingscoreboard                          1
496110e230b6Smaya   uint32_t                             ThreadSynchronization;
496210e230b6Smaya#define Nothreadsynchronization                  0
496310e230b6Smaya#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
496410e230b6Smaya   bool                                 ChildrenPresent;
496510e230b6Smaya   __gen_address_type                   IndirectDataStartAddress;
496610e230b6Smaya   uint32_t                             ScoreboardX;
496710e230b6Smaya   uint32_t                             ScoredboardY;
496810e230b6Smaya   uint32_t                             ScoreboardMask;
496910e230b6Smaya   uint32_t                             ScoreboardColor;
497010e230b6Smaya   /* variable length fields follow */
497110e230b6Smaya};
497210e230b6Smaya
497396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
497496c5ddc4SrjsGFX7_MEDIA_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
497510e230b6Smaya                       __attribute__((unused)) void * restrict dst,
497696c5ddc4Srjs                       __attribute__((unused)) const struct GFX7_MEDIA_OBJECT * restrict values)
497710e230b6Smaya{
497810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
497910e230b6Smaya
498010e230b6Smaya   dw[0] =
498110e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
498210e230b6Smaya      __gen_uint(values->MediaCommandSubOpcode, 16, 23) |
498310e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
498410e230b6Smaya      __gen_uint(values->MediaCommandPipeline, 27, 28) |
498510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
498610e230b6Smaya
498710e230b6Smaya   dw[1] =
498810e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
498910e230b6Smaya
499010e230b6Smaya   dw[2] =
499110e230b6Smaya      __gen_uint(values->IndirectDataLength, 0, 16) |
499210e230b6Smaya      __gen_uint(values->HalfSliceDestinationSelect, 17, 18) |
499310e230b6Smaya      __gen_uint(values->UseScoreboard, 21, 21) |
499410e230b6Smaya      __gen_uint(values->ThreadSynchronization, 24, 24) |
499510e230b6Smaya      __gen_uint(values->ChildrenPresent, 31, 31);
499610e230b6Smaya
499796c5ddc4Srjs   dw[3] = __gen_address(data, &dw[3], values->IndirectDataStartAddress, 0, 0, 31);
499810e230b6Smaya
499910e230b6Smaya   dw[4] =
500010e230b6Smaya      __gen_uint(values->ScoreboardX, 0, 8) |
500110e230b6Smaya      __gen_uint(values->ScoredboardY, 16, 24);
500210e230b6Smaya
500310e230b6Smaya   dw[5] =
500410e230b6Smaya      __gen_uint(values->ScoreboardMask, 0, 7) |
500510e230b6Smaya      __gen_uint(values->ScoreboardColor, 16, 19);
500610e230b6Smaya}
500710e230b6Smaya
500896c5ddc4Srjs#define GFX7_MEDIA_OBJECT_PRT_length          16
500996c5ddc4Srjs#define GFX7_MEDIA_OBJECT_PRT_length_bias      2
501096c5ddc4Srjs#define GFX7_MEDIA_OBJECT_PRT_header            \
501110e230b6Smaya   .DWordLength                         =     14,  \
501210e230b6Smaya   .SubOpcode                           =      2,  \
501310e230b6Smaya   .MediaCommandOpcode                  =      1,  \
501410e230b6Smaya   .Pipeline                            =      2,  \
501510e230b6Smaya   .CommandType                         =      3
501610e230b6Smaya
501796c5ddc4Srjsstruct GFX7_MEDIA_OBJECT_PRT {
501810e230b6Smaya   uint32_t                             DWordLength;
501910e230b6Smaya   uint32_t                             SubOpcode;
502010e230b6Smaya   uint32_t                             MediaCommandOpcode;
502110e230b6Smaya   uint32_t                             Pipeline;
502210e230b6Smaya   uint32_t                             CommandType;
502310e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
502410e230b6Smaya   uint32_t                             PRT_FenceType;
502510e230b6Smaya#define Rootthreadqueue                          0
502610e230b6Smaya#define VFEstateflush                            1
502710e230b6Smaya   bool                                 PRT_FenceNeeded;
502810e230b6Smaya   bool                                 ChildrenPresent;
502910e230b6Smaya   uint32_t                             InlineData[12];
503010e230b6Smaya};
503110e230b6Smaya
503296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
503396c5ddc4SrjsGFX7_MEDIA_OBJECT_PRT_pack(__attribute__((unused)) __gen_user_data *data,
503410e230b6Smaya                           __attribute__((unused)) void * restrict dst,
503596c5ddc4Srjs                           __attribute__((unused)) const struct GFX7_MEDIA_OBJECT_PRT * restrict values)
503610e230b6Smaya{
503710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
503810e230b6Smaya
503910e230b6Smaya   dw[0] =
504010e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
504110e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
504210e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
504310e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
504410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
504510e230b6Smaya
504610e230b6Smaya   dw[1] =
504710e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
504810e230b6Smaya
504910e230b6Smaya   dw[2] =
505010e230b6Smaya      __gen_uint(values->PRT_FenceType, 22, 22) |
505110e230b6Smaya      __gen_uint(values->PRT_FenceNeeded, 23, 23) |
505210e230b6Smaya      __gen_uint(values->ChildrenPresent, 31, 31);
505310e230b6Smaya
505410e230b6Smaya   dw[3] = 0;
505510e230b6Smaya
505610e230b6Smaya   dw[4] =
505710e230b6Smaya      __gen_uint(values->InlineData[0], 0, 31);
505810e230b6Smaya
505910e230b6Smaya   dw[5] =
506010e230b6Smaya      __gen_uint(values->InlineData[1], 0, 31);
506110e230b6Smaya
506210e230b6Smaya   dw[6] =
506310e230b6Smaya      __gen_uint(values->InlineData[2], 0, 31);
506410e230b6Smaya
506510e230b6Smaya   dw[7] =
506610e230b6Smaya      __gen_uint(values->InlineData[3], 0, 31);
506710e230b6Smaya
506810e230b6Smaya   dw[8] =
506910e230b6Smaya      __gen_uint(values->InlineData[4], 0, 31);
507010e230b6Smaya
507110e230b6Smaya   dw[9] =
507210e230b6Smaya      __gen_uint(values->InlineData[5], 0, 31);
507310e230b6Smaya
507410e230b6Smaya   dw[10] =
507510e230b6Smaya      __gen_uint(values->InlineData[6], 0, 31);
507610e230b6Smaya
507710e230b6Smaya   dw[11] =
507810e230b6Smaya      __gen_uint(values->InlineData[7], 0, 31);
507910e230b6Smaya
508010e230b6Smaya   dw[12] =
508110e230b6Smaya      __gen_uint(values->InlineData[8], 0, 31);
508210e230b6Smaya
508310e230b6Smaya   dw[13] =
508410e230b6Smaya      __gen_uint(values->InlineData[9], 0, 31);
508510e230b6Smaya
508610e230b6Smaya   dw[14] =
508710e230b6Smaya      __gen_uint(values->InlineData[10], 0, 31);
508810e230b6Smaya
508910e230b6Smaya   dw[15] =
509010e230b6Smaya      __gen_uint(values->InlineData[11], 0, 31);
509110e230b6Smaya}
509210e230b6Smaya
509396c5ddc4Srjs#define GFX7_MEDIA_OBJECT_WALKER_length_bias      2
509496c5ddc4Srjs#define GFX7_MEDIA_OBJECT_WALKER_header         \
509510e230b6Smaya   .DWordLength                         =     15,  \
509610e230b6Smaya   .SubOpcode                           =      3,  \
509710e230b6Smaya   .MediaCommandOpcode                  =      1,  \
509810e230b6Smaya   .Pipeline                            =      2,  \
509910e230b6Smaya   .CommandType                         =      3
510010e230b6Smaya
510196c5ddc4Srjsstruct GFX7_MEDIA_OBJECT_WALKER {
510210e230b6Smaya   uint32_t                             DWordLength;
510310e230b6Smaya   uint32_t                             SubOpcode;
510410e230b6Smaya   uint32_t                             MediaCommandOpcode;
510510e230b6Smaya   uint32_t                             Pipeline;
510610e230b6Smaya   uint32_t                             CommandType;
510710e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
510810e230b6Smaya   uint32_t                             IndirectDataLength;
510910e230b6Smaya   uint32_t                             UseScoreboard;
511010e230b6Smaya#define Notusingscoreboard                       0
511110e230b6Smaya#define Usingscoreboard                          1
511210e230b6Smaya   uint32_t                             ThreadSynchronization;
511310e230b6Smaya#define Nothreadsynchronization                  0
511410e230b6Smaya#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
511510e230b6Smaya   uint32_t                             ChildrenPresent;
511610e230b6Smaya   uint64_t                             IndirectDataStartAddress;
511710e230b6Smaya   uint32_t                             ScoreboardMask;
511810e230b6Smaya   int32_t                              MidLoopUnitX;
511910e230b6Smaya   int32_t                              LocalMidLoopUnitY;
512010e230b6Smaya   uint32_t                             MiddleLoopExtraSteps;
512110e230b6Smaya   uint32_t                             ColorCountMinusOne;
512210e230b6Smaya   uint32_t                             Repel;
512310e230b6Smaya   uint32_t                             DualMode;
512410e230b6Smaya   uint32_t                             LocalLoopExecCount;
512510e230b6Smaya   uint32_t                             GlobalLoopExecCount;
512610e230b6Smaya   uint32_t                             BlockResolutionX;
512710e230b6Smaya   uint32_t                             BlockResolutionY;
512810e230b6Smaya   uint32_t                             LocalStartX;
512910e230b6Smaya   uint32_t                             LocalStartY;
513010e230b6Smaya   uint32_t                             LocalEndX;
513110e230b6Smaya   uint32_t                             LocalEndY;
513210e230b6Smaya   int32_t                              LocalOuterLoopStrideX;
513310e230b6Smaya   int32_t                              LocalOuterLoopStrideY;
513410e230b6Smaya   int32_t                              LocalInnerLoopUnitX;
513510e230b6Smaya   int32_t                              LocalInnerLoopUnitY;
513610e230b6Smaya   uint32_t                             GlobalResolutionX;
513710e230b6Smaya   uint32_t                             GlobalResolutionY;
513810e230b6Smaya   int32_t                              GlobalStartX;
513910e230b6Smaya   int32_t                              GlobalStartY;
514010e230b6Smaya   int32_t                              GlobalOuterLoopStrideX;
514110e230b6Smaya   int32_t                              GlobalOuterLoopStrideY;
514210e230b6Smaya   int32_t                              GlobalInnerLoopUnitX;
514310e230b6Smaya   int32_t                              GlobalInnerLoopUnitY;
514410e230b6Smaya   /* variable length fields follow */
514510e230b6Smaya};
514610e230b6Smaya
514796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
514896c5ddc4SrjsGFX7_MEDIA_OBJECT_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
514910e230b6Smaya                              __attribute__((unused)) void * restrict dst,
515096c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_MEDIA_OBJECT_WALKER * restrict values)
515110e230b6Smaya{
515210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
515310e230b6Smaya
515410e230b6Smaya   dw[0] =
515510e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
515610e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
515710e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
515810e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
515910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
516010e230b6Smaya
516110e230b6Smaya   dw[1] =
516210e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
516310e230b6Smaya
516410e230b6Smaya   dw[2] =
516510e230b6Smaya      __gen_uint(values->IndirectDataLength, 0, 16) |
516610e230b6Smaya      __gen_uint(values->UseScoreboard, 21, 21) |
516710e230b6Smaya      __gen_uint(values->ThreadSynchronization, 24, 24) |
516810e230b6Smaya      __gen_uint(values->ChildrenPresent, 31, 31);
516910e230b6Smaya
517010e230b6Smaya   dw[3] =
517110e230b6Smaya      __gen_offset(values->IndirectDataStartAddress, 0, 31);
517210e230b6Smaya
517310e230b6Smaya   dw[4] = 0;
517410e230b6Smaya
517510e230b6Smaya   dw[5] =
517610e230b6Smaya      __gen_uint(values->ScoreboardMask, 0, 7);
517710e230b6Smaya
517810e230b6Smaya   dw[6] =
517910e230b6Smaya      __gen_sint(values->MidLoopUnitX, 8, 9) |
518010e230b6Smaya      __gen_sint(values->LocalMidLoopUnitY, 12, 13) |
518110e230b6Smaya      __gen_uint(values->MiddleLoopExtraSteps, 16, 20) |
518210e230b6Smaya      __gen_uint(values->ColorCountMinusOne, 24, 27) |
518310e230b6Smaya      __gen_uint(values->Repel, 30, 30) |
518410e230b6Smaya      __gen_uint(values->DualMode, 31, 31);
518510e230b6Smaya
518610e230b6Smaya   dw[7] =
518710e230b6Smaya      __gen_uint(values->LocalLoopExecCount, 0, 9) |
518810e230b6Smaya      __gen_uint(values->GlobalLoopExecCount, 16, 25);
518910e230b6Smaya
519010e230b6Smaya   dw[8] =
519110e230b6Smaya      __gen_uint(values->BlockResolutionX, 0, 8) |
519210e230b6Smaya      __gen_uint(values->BlockResolutionY, 16, 24);
519310e230b6Smaya
519410e230b6Smaya   dw[9] =
519510e230b6Smaya      __gen_uint(values->LocalStartX, 0, 8) |
519610e230b6Smaya      __gen_uint(values->LocalStartY, 16, 24);
519710e230b6Smaya
519810e230b6Smaya   dw[10] =
519910e230b6Smaya      __gen_uint(values->LocalEndX, 0, 8) |
520010e230b6Smaya      __gen_uint(values->LocalEndY, 16, 24);
520110e230b6Smaya
520210e230b6Smaya   dw[11] =
520310e230b6Smaya      __gen_sint(values->LocalOuterLoopStrideX, 0, 9) |
520410e230b6Smaya      __gen_sint(values->LocalOuterLoopStrideY, 16, 25);
520510e230b6Smaya
520610e230b6Smaya   dw[12] =
520710e230b6Smaya      __gen_sint(values->LocalInnerLoopUnitX, 0, 9) |
520810e230b6Smaya      __gen_sint(values->LocalInnerLoopUnitY, 16, 25);
520910e230b6Smaya
521010e230b6Smaya   dw[13] =
521110e230b6Smaya      __gen_uint(values->GlobalResolutionX, 0, 8) |
521210e230b6Smaya      __gen_uint(values->GlobalResolutionY, 16, 24);
521310e230b6Smaya
521410e230b6Smaya   dw[14] =
521510e230b6Smaya      __gen_sint(values->GlobalStartX, 0, 9) |
521610e230b6Smaya      __gen_sint(values->GlobalStartY, 16, 25);
521710e230b6Smaya
521810e230b6Smaya   dw[15] =
521910e230b6Smaya      __gen_sint(values->GlobalOuterLoopStrideX, 0, 9) |
522010e230b6Smaya      __gen_sint(values->GlobalOuterLoopStrideY, 16, 25);
522110e230b6Smaya
522210e230b6Smaya   dw[16] =
522310e230b6Smaya      __gen_sint(values->GlobalInnerLoopUnitX, 0, 9) |
522410e230b6Smaya      __gen_sint(values->GlobalInnerLoopUnitY, 16, 25);
522510e230b6Smaya}
522610e230b6Smaya
522796c5ddc4Srjs#define GFX7_MEDIA_STATE_FLUSH_length          2
522896c5ddc4Srjs#define GFX7_MEDIA_STATE_FLUSH_length_bias      2
522996c5ddc4Srjs#define GFX7_MEDIA_STATE_FLUSH_header           \
523010e230b6Smaya   .DWordLength                         =      0,  \
523110e230b6Smaya   .SubOpcode                           =      4,  \
523210e230b6Smaya   .MediaCommandOpcode                  =      0,  \
523310e230b6Smaya   .Pipeline                            =      2,  \
523410e230b6Smaya   .CommandType                         =      3
523510e230b6Smaya
523696c5ddc4Srjsstruct GFX7_MEDIA_STATE_FLUSH {
523710e230b6Smaya   uint32_t                             DWordLength;
523810e230b6Smaya   uint32_t                             SubOpcode;
523910e230b6Smaya   uint32_t                             MediaCommandOpcode;
524010e230b6Smaya   uint32_t                             Pipeline;
524110e230b6Smaya   uint32_t                             CommandType;
524210e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
524310e230b6Smaya   uint32_t                             WatermarkRequired;
524410e230b6Smaya};
524510e230b6Smaya
524696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
524796c5ddc4SrjsGFX7_MEDIA_STATE_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
524810e230b6Smaya                            __attribute__((unused)) void * restrict dst,
524996c5ddc4Srjs                            __attribute__((unused)) const struct GFX7_MEDIA_STATE_FLUSH * restrict values)
525010e230b6Smaya{
525110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
525210e230b6Smaya
525310e230b6Smaya   dw[0] =
525410e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
525510e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
525610e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
525710e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
525810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
525910e230b6Smaya
526010e230b6Smaya   dw[1] =
526110e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 5) |
526210e230b6Smaya      __gen_uint(values->WatermarkRequired, 6, 6);
526310e230b6Smaya}
526410e230b6Smaya
526596c5ddc4Srjs#define GFX7_MEDIA_VFE_STATE_length            8
526696c5ddc4Srjs#define GFX7_MEDIA_VFE_STATE_length_bias       2
526796c5ddc4Srjs#define GFX7_MEDIA_VFE_STATE_header             \
526810e230b6Smaya   .DWordLength                         =      6,  \
526910e230b6Smaya   .SubOpcode                           =      0,  \
527010e230b6Smaya   .MediaCommandOpcode                  =      0,  \
527110e230b6Smaya   .Pipeline                            =      2,  \
527210e230b6Smaya   .CommandType                         =      3
527310e230b6Smaya
527496c5ddc4Srjsstruct GFX7_MEDIA_VFE_STATE {
527510e230b6Smaya   uint32_t                             DWordLength;
527610e230b6Smaya   uint32_t                             SubOpcode;
527710e230b6Smaya   uint32_t                             MediaCommandOpcode;
527810e230b6Smaya   uint32_t                             Pipeline;
527910e230b6Smaya   uint32_t                             CommandType;
528010e230b6Smaya   uint32_t                             PerThreadScratchSpace;
528110e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
528296c5ddc4Srjs   bool                                 GPGPUMode;
528310e230b6Smaya   uint32_t                             GatewayMMIOAccessControl;
528410e230b6Smaya#define NoMMIOreadwriteallowed                   0
528510e230b6Smaya#define MMIOreadwritetoanyaddress                2
528610e230b6Smaya   uint32_t                             BypassGatewayControl;
528710e230b6Smaya#define MaintainingOpenGatewayForwardMsgCloseGatewayprotocollegacymode 0
528810e230b6Smaya#define BypassingOpenGatewayCloseGatewayprotocol 1
528910e230b6Smaya   uint32_t                             ResetGatewayTimer;
529010e230b6Smaya#define Maintainingtheexistingtimestampstate     0
529110e230b6Smaya#define Resettingrelativetimerandlatchingtheglobaltimestamp 1
529210e230b6Smaya   uint32_t                             NumberofURBEntries;
529310e230b6Smaya   uint32_t                             MaximumNumberofThreads;
529410e230b6Smaya   uint32_t                             CURBEAllocationSize;
529510e230b6Smaya   uint32_t                             URBEntryAllocationSize;
529610e230b6Smaya   uint32_t                             ScoreboardMask;
529710e230b6Smaya   uint32_t                             ScoreboardType;
529810e230b6Smaya#define StallingScoreboard                       0
529910e230b6Smaya#define NonStallingScoreboard                    1
530010e230b6Smaya   uint32_t                             ScoreboardEnable;
530110e230b6Smaya#define Scoreboarddisabled                       0
530210e230b6Smaya#define Scoreboardenabled                        1
530310e230b6Smaya   int32_t                              Scoreboard0DeltaX;
530410e230b6Smaya   int32_t                              Scoreboard0DeltaY;
530510e230b6Smaya   int32_t                              Scoreboard1DeltaX;
530610e230b6Smaya   int32_t                              Scoreboard1DeltaY;
530710e230b6Smaya   int32_t                              Scoreboard2DeltaX;
530810e230b6Smaya   int32_t                              Scoreboard2DeltaY;
530910e230b6Smaya   int32_t                              Scoreboard3DeltaX;
531010e230b6Smaya   int32_t                              Scoreboard3DeltaY;
531110e230b6Smaya   int32_t                              Scoreboard4DeltaX;
531210e230b6Smaya   int32_t                              Scoreboard4DeltaY;
531310e230b6Smaya   int32_t                              Scoreboard5DeltaX;
531410e230b6Smaya   int32_t                              Scoreboard5DeltaY;
531510e230b6Smaya   int32_t                              Scoreboard6DeltaX;
531610e230b6Smaya   int32_t                              Scoreboard6DeltaY;
531710e230b6Smaya   int32_t                              Scoreboard7DeltaX;
531810e230b6Smaya   int32_t                              Scoreboard7DeltaY;
531910e230b6Smaya};
532010e230b6Smaya
532196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
532296c5ddc4SrjsGFX7_MEDIA_VFE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
532310e230b6Smaya                          __attribute__((unused)) void * restrict dst,
532496c5ddc4Srjs                          __attribute__((unused)) const struct GFX7_MEDIA_VFE_STATE * restrict values)
532510e230b6Smaya{
532610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
532710e230b6Smaya
532810e230b6Smaya   dw[0] =
532910e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
533010e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
533110e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
533210e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
533310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
533410e230b6Smaya
533510e230b6Smaya   const uint32_t v1 =
533610e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
533796c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->ScratchSpaceBasePointer, v1, 10, 31);
533810e230b6Smaya
533910e230b6Smaya   dw[2] =
534010e230b6Smaya      __gen_uint(values->GPGPUMode, 2, 2) |
534110e230b6Smaya      __gen_uint(values->GatewayMMIOAccessControl, 3, 4) |
534210e230b6Smaya      __gen_uint(values->BypassGatewayControl, 6, 6) |
534310e230b6Smaya      __gen_uint(values->ResetGatewayTimer, 7, 7) |
534410e230b6Smaya      __gen_uint(values->NumberofURBEntries, 8, 15) |
534510e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 16, 31);
534610e230b6Smaya
534710e230b6Smaya   dw[3] = 0;
534810e230b6Smaya
534910e230b6Smaya   dw[4] =
535010e230b6Smaya      __gen_uint(values->CURBEAllocationSize, 0, 15) |
535110e230b6Smaya      __gen_uint(values->URBEntryAllocationSize, 16, 31);
535210e230b6Smaya
535310e230b6Smaya   dw[5] =
535410e230b6Smaya      __gen_uint(values->ScoreboardMask, 0, 7) |
535510e230b6Smaya      __gen_uint(values->ScoreboardType, 30, 30) |
535610e230b6Smaya      __gen_uint(values->ScoreboardEnable, 31, 31);
535710e230b6Smaya
535810e230b6Smaya   dw[6] =
535910e230b6Smaya      __gen_sint(values->Scoreboard0DeltaX, 0, 3) |
536010e230b6Smaya      __gen_sint(values->Scoreboard0DeltaY, 4, 7) |
536110e230b6Smaya      __gen_sint(values->Scoreboard1DeltaX, 8, 11) |
536210e230b6Smaya      __gen_sint(values->Scoreboard1DeltaY, 12, 15) |
536310e230b6Smaya      __gen_sint(values->Scoreboard2DeltaX, 16, 19) |
536410e230b6Smaya      __gen_sint(values->Scoreboard2DeltaY, 20, 23) |
536510e230b6Smaya      __gen_sint(values->Scoreboard3DeltaX, 24, 27) |
536610e230b6Smaya      __gen_sint(values->Scoreboard3DeltaY, 28, 31);
536710e230b6Smaya
536810e230b6Smaya   dw[7] =
536910e230b6Smaya      __gen_sint(values->Scoreboard4DeltaX, 0, 3) |
537010e230b6Smaya      __gen_sint(values->Scoreboard4DeltaY, 4, 7) |
537110e230b6Smaya      __gen_sint(values->Scoreboard5DeltaX, 8, 11) |
537210e230b6Smaya      __gen_sint(values->Scoreboard5DeltaY, 12, 15) |
537310e230b6Smaya      __gen_sint(values->Scoreboard6DeltaX, 16, 19) |
537410e230b6Smaya      __gen_sint(values->Scoreboard6DeltaY, 20, 23) |
537510e230b6Smaya      __gen_sint(values->Scoreboard7DeltaX, 24, 27) |
537610e230b6Smaya      __gen_sint(values->Scoreboard7DeltaY, 28, 31);
537710e230b6Smaya}
537810e230b6Smaya
537996c5ddc4Srjs#define GFX7_MI_ARB_CHECK_length               1
538096c5ddc4Srjs#define GFX7_MI_ARB_CHECK_length_bias          1
538196c5ddc4Srjs#define GFX7_MI_ARB_CHECK_header                \
538210e230b6Smaya   .MICommandOpcode                     =      5,  \
538310e230b6Smaya   .CommandType                         =      0
538410e230b6Smaya
538596c5ddc4Srjsstruct GFX7_MI_ARB_CHECK {
538610e230b6Smaya   uint32_t                             MICommandOpcode;
538710e230b6Smaya   uint32_t                             CommandType;
538810e230b6Smaya};
538910e230b6Smaya
539096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
539196c5ddc4SrjsGFX7_MI_ARB_CHECK_pack(__attribute__((unused)) __gen_user_data *data,
539210e230b6Smaya                       __attribute__((unused)) void * restrict dst,
539396c5ddc4Srjs                       __attribute__((unused)) const struct GFX7_MI_ARB_CHECK * restrict values)
539410e230b6Smaya{
539510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
539610e230b6Smaya
539710e230b6Smaya   dw[0] =
539810e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
539910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
540010e230b6Smaya}
540110e230b6Smaya
540296c5ddc4Srjs#define GFX7_MI_ARB_ON_OFF_length              1
540396c5ddc4Srjs#define GFX7_MI_ARB_ON_OFF_length_bias         1
540496c5ddc4Srjs#define GFX7_MI_ARB_ON_OFF_header               \
540510e230b6Smaya   .MICommandOpcode                     =      8,  \
540610e230b6Smaya   .CommandType                         =      0
540710e230b6Smaya
540896c5ddc4Srjsstruct GFX7_MI_ARB_ON_OFF {
540910e230b6Smaya   bool                                 ArbitrationEnable;
541010e230b6Smaya   uint32_t                             MICommandOpcode;
541110e230b6Smaya   uint32_t                             CommandType;
541210e230b6Smaya};
541310e230b6Smaya
541496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
541596c5ddc4SrjsGFX7_MI_ARB_ON_OFF_pack(__attribute__((unused)) __gen_user_data *data,
541610e230b6Smaya                        __attribute__((unused)) void * restrict dst,
541796c5ddc4Srjs                        __attribute__((unused)) const struct GFX7_MI_ARB_ON_OFF * restrict values)
541810e230b6Smaya{
541910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
542010e230b6Smaya
542110e230b6Smaya   dw[0] =
542210e230b6Smaya      __gen_uint(values->ArbitrationEnable, 0, 0) |
542310e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
542410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
542510e230b6Smaya}
542610e230b6Smaya
542796c5ddc4Srjs#define GFX7_MI_BATCH_BUFFER_END_length        1
542896c5ddc4Srjs#define GFX7_MI_BATCH_BUFFER_END_length_bias      1
542996c5ddc4Srjs#define GFX7_MI_BATCH_BUFFER_END_header         \
543010e230b6Smaya   .MICommandOpcode                     =     10,  \
543110e230b6Smaya   .CommandType                         =      0
543210e230b6Smaya
543396c5ddc4Srjsstruct GFX7_MI_BATCH_BUFFER_END {
543410e230b6Smaya   uint32_t                             MICommandOpcode;
543510e230b6Smaya   uint32_t                             CommandType;
543610e230b6Smaya};
543710e230b6Smaya
543896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
543996c5ddc4SrjsGFX7_MI_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
544010e230b6Smaya                              __attribute__((unused)) void * restrict dst,
544196c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_MI_BATCH_BUFFER_END * restrict values)
544210e230b6Smaya{
544310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
544410e230b6Smaya
544510e230b6Smaya   dw[0] =
544610e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
544710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
544810e230b6Smaya}
544910e230b6Smaya
545096c5ddc4Srjs#define GFX7_MI_BATCH_BUFFER_START_length      2
545196c5ddc4Srjs#define GFX7_MI_BATCH_BUFFER_START_length_bias      2
545296c5ddc4Srjs#define GFX7_MI_BATCH_BUFFER_START_header       \
545310e230b6Smaya   .DWordLength                         =      0,  \
545410e230b6Smaya   .MICommandOpcode                     =     49,  \
545510e230b6Smaya   .CommandType                         =      0
545610e230b6Smaya
545796c5ddc4Srjsstruct GFX7_MI_BATCH_BUFFER_START {
545810e230b6Smaya   uint32_t                             DWordLength;
545910e230b6Smaya   uint32_t                             AddressSpaceIndicator;
546010e230b6Smaya#define ASI_GGTT                                 0
546110e230b6Smaya#define ASI_PPGTT                                1
546210e230b6Smaya   bool                                 ClearCommandBufferEnable;
546310e230b6Smaya   uint32_t                             MICommandOpcode;
546410e230b6Smaya   uint32_t                             CommandType;
546510e230b6Smaya   __gen_address_type                   BatchBufferStartAddress;
546610e230b6Smaya};
546710e230b6Smaya
546896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
546996c5ddc4SrjsGFX7_MI_BATCH_BUFFER_START_pack(__attribute__((unused)) __gen_user_data *data,
547010e230b6Smaya                                __attribute__((unused)) void * restrict dst,
547196c5ddc4Srjs                                __attribute__((unused)) const struct GFX7_MI_BATCH_BUFFER_START * restrict values)
547210e230b6Smaya{
547310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
547410e230b6Smaya
547510e230b6Smaya   dw[0] =
547610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
547710e230b6Smaya      __gen_uint(values->AddressSpaceIndicator, 8, 8) |
547810e230b6Smaya      __gen_uint(values->ClearCommandBufferEnable, 11, 11) |
547910e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
548010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
548110e230b6Smaya
548296c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->BatchBufferStartAddress, 0, 2, 31);
548310e230b6Smaya}
548410e230b6Smaya
548596c5ddc4Srjs#define GFX7_MI_CLFLUSH_length_bias            2
548696c5ddc4Srjs#define GFX7_MI_CLFLUSH_header                  \
548710e230b6Smaya   .DWordLength                         =      1,  \
548810e230b6Smaya   .MICommandOpcode                     =     39,  \
548910e230b6Smaya   .CommandType                         =      0
549010e230b6Smaya
549196c5ddc4Srjsstruct GFX7_MI_CLFLUSH {
549210e230b6Smaya   uint32_t                             DWordLength;
549310e230b6Smaya   bool                                 UseGlobalGTT;
549410e230b6Smaya   uint32_t                             MICommandOpcode;
549510e230b6Smaya   uint32_t                             CommandType;
549610e230b6Smaya   uint32_t                             StartingCachelineOffset;
549710e230b6Smaya   __gen_address_type                   PageBaseAddress;
549810e230b6Smaya   __gen_address_type                   PageBaseAddressHigh;
549910e230b6Smaya   /* variable length fields follow */
550010e230b6Smaya};
550110e230b6Smaya
550296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
550396c5ddc4SrjsGFX7_MI_CLFLUSH_pack(__attribute__((unused)) __gen_user_data *data,
550410e230b6Smaya                     __attribute__((unused)) void * restrict dst,
550596c5ddc4Srjs                     __attribute__((unused)) const struct GFX7_MI_CLFLUSH * restrict values)
550610e230b6Smaya{
550710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
550810e230b6Smaya
550910e230b6Smaya   dw[0] =
551010e230b6Smaya      __gen_uint(values->DWordLength, 0, 9) |
551110e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
551210e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
551310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
551410e230b6Smaya
551510e230b6Smaya   const uint32_t v1 =
551610e230b6Smaya      __gen_uint(values->StartingCachelineOffset, 6, 11);
551796c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->PageBaseAddress, v1, 12, 31);
551810e230b6Smaya
551996c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->PageBaseAddressHigh, 0, 0, 15);
552010e230b6Smaya}
552110e230b6Smaya
552296c5ddc4Srjs#define GFX7_MI_CONDITIONAL_BATCH_BUFFER_END_length      2
552396c5ddc4Srjs#define GFX7_MI_CONDITIONAL_BATCH_BUFFER_END_length_bias      2
552496c5ddc4Srjs#define GFX7_MI_CONDITIONAL_BATCH_BUFFER_END_header\
552510e230b6Smaya   .DWordLength                         =      0,  \
552610e230b6Smaya   .CompareSemaphore                    =      0,  \
552710e230b6Smaya   .MICommandOpcode                     =     54,  \
552810e230b6Smaya   .CommandType                         =      0
552910e230b6Smaya
553096c5ddc4Srjsstruct GFX7_MI_CONDITIONAL_BATCH_BUFFER_END {
553110e230b6Smaya   uint32_t                             DWordLength;
553210e230b6Smaya   uint32_t                             CompareSemaphore;
553310e230b6Smaya   bool                                 UseGlobalGTT;
553410e230b6Smaya   uint32_t                             MICommandOpcode;
553510e230b6Smaya   uint32_t                             CommandType;
553610e230b6Smaya   uint32_t                             CompareDataDword;
553710e230b6Smaya   __gen_address_type                   CompareAddress;
553810e230b6Smaya};
553910e230b6Smaya
554096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
554196c5ddc4SrjsGFX7_MI_CONDITIONAL_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
554210e230b6Smaya                                          __attribute__((unused)) void * restrict dst,
554396c5ddc4Srjs                                          __attribute__((unused)) const struct GFX7_MI_CONDITIONAL_BATCH_BUFFER_END * restrict values)
554410e230b6Smaya{
554510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
554610e230b6Smaya
554710e230b6Smaya   dw[0] =
554810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
554910e230b6Smaya      __gen_uint(values->CompareSemaphore, 21, 21) |
555010e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
555110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
555210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
555310e230b6Smaya
555410e230b6Smaya   dw[1] =
555510e230b6Smaya      __gen_uint(values->CompareDataDword, 0, 31);
555610e230b6Smaya}
555710e230b6Smaya
555896c5ddc4Srjs#define GFX7_MI_FLUSH_length                   1
555996c5ddc4Srjs#define GFX7_MI_FLUSH_length_bias              1
556096c5ddc4Srjs#define GFX7_MI_FLUSH_header                    \
556110e230b6Smaya   .MICommandOpcode                     =      4,  \
556210e230b6Smaya   .CommandType                         =      0
556310e230b6Smaya
556496c5ddc4Srjsstruct GFX7_MI_FLUSH {
556510e230b6Smaya   uint32_t                             StateInstructionCacheInvalidate;
556610e230b6Smaya#define DontInvalidate                           0
556710e230b6Smaya#define Invalidate                               1
556810e230b6Smaya   uint32_t                             RenderCacheFlushInhibit;
556910e230b6Smaya#define Flush                                    0
557010e230b6Smaya#define DontFlush                                1
557110e230b6Smaya   uint32_t                             GlobalSnapshotCountReset;
557210e230b6Smaya#define DontReset                                0
557310e230b6Smaya#define Reset                                    1
557410e230b6Smaya   bool                                 GenericMediaStateClear;
557510e230b6Smaya   bool                                 IndirectStatePointersDisable;
557610e230b6Smaya   uint32_t                             MICommandOpcode;
557710e230b6Smaya   uint32_t                             CommandType;
557810e230b6Smaya};
557910e230b6Smaya
558096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
558196c5ddc4SrjsGFX7_MI_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
558210e230b6Smaya                   __attribute__((unused)) void * restrict dst,
558396c5ddc4Srjs                   __attribute__((unused)) const struct GFX7_MI_FLUSH * restrict values)
558410e230b6Smaya{
558510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
558610e230b6Smaya
558710e230b6Smaya   dw[0] =
558810e230b6Smaya      __gen_uint(values->StateInstructionCacheInvalidate, 1, 1) |
558910e230b6Smaya      __gen_uint(values->RenderCacheFlushInhibit, 2, 2) |
559010e230b6Smaya      __gen_uint(values->GlobalSnapshotCountReset, 3, 3) |
559110e230b6Smaya      __gen_uint(values->GenericMediaStateClear, 4, 4) |
559210e230b6Smaya      __gen_uint(values->IndirectStatePointersDisable, 5, 5) |
559310e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
559410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
559510e230b6Smaya}
559610e230b6Smaya
559796c5ddc4Srjs#define GFX7_MI_LOAD_REGISTER_IMM_length       3
559896c5ddc4Srjs#define GFX7_MI_LOAD_REGISTER_IMM_length_bias      2
559996c5ddc4Srjs#define GFX7_MI_LOAD_REGISTER_IMM_header        \
560010e230b6Smaya   .DWordLength                         =      1,  \
560110e230b6Smaya   .MICommandOpcode                     =     34,  \
560210e230b6Smaya   .CommandType                         =      0
560310e230b6Smaya
560496c5ddc4Srjsstruct GFX7_MI_LOAD_REGISTER_IMM {
560510e230b6Smaya   uint32_t                             DWordLength;
560610e230b6Smaya   uint32_t                             ByteWriteDisables;
560710e230b6Smaya   uint32_t                             MICommandOpcode;
560810e230b6Smaya   uint32_t                             CommandType;
560910e230b6Smaya   uint64_t                             RegisterOffset;
561010e230b6Smaya   uint32_t                             DataDWord;
561110e230b6Smaya   /* variable length fields follow */
561210e230b6Smaya};
561310e230b6Smaya
561496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
561596c5ddc4SrjsGFX7_MI_LOAD_REGISTER_IMM_pack(__attribute__((unused)) __gen_user_data *data,
561610e230b6Smaya                               __attribute__((unused)) void * restrict dst,
561796c5ddc4Srjs                               __attribute__((unused)) const struct GFX7_MI_LOAD_REGISTER_IMM * restrict values)
561810e230b6Smaya{
561910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
562010e230b6Smaya
562110e230b6Smaya   dw[0] =
562210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
562310e230b6Smaya      __gen_uint(values->ByteWriteDisables, 8, 11) |
562410e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
562510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
562610e230b6Smaya
562710e230b6Smaya   dw[1] =
562810e230b6Smaya      __gen_offset(values->RegisterOffset, 2, 22);
562910e230b6Smaya
563010e230b6Smaya   dw[2] =
563110e230b6Smaya      __gen_uint(values->DataDWord, 0, 31);
563210e230b6Smaya}
563310e230b6Smaya
563496c5ddc4Srjs#define GFX7_MI_LOAD_REGISTER_MEM_length       3
563596c5ddc4Srjs#define GFX7_MI_LOAD_REGISTER_MEM_length_bias      2
563696c5ddc4Srjs#define GFX7_MI_LOAD_REGISTER_MEM_header        \
563710e230b6Smaya   .DWordLength                         =      1,  \
563810e230b6Smaya   .MICommandOpcode                     =     41,  \
563910e230b6Smaya   .CommandType                         =      0
564010e230b6Smaya
564196c5ddc4Srjsstruct GFX7_MI_LOAD_REGISTER_MEM {
564210e230b6Smaya   uint32_t                             DWordLength;
564310e230b6Smaya   bool                                 AsyncModeEnable;
564410e230b6Smaya   bool                                 UseGlobalGTT;
564510e230b6Smaya   uint32_t                             MICommandOpcode;
564610e230b6Smaya   uint32_t                             CommandType;
564710e230b6Smaya   uint64_t                             RegisterAddress;
564810e230b6Smaya   __gen_address_type                   MemoryAddress;
564910e230b6Smaya};
565010e230b6Smaya
565196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
565296c5ddc4SrjsGFX7_MI_LOAD_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
565310e230b6Smaya                               __attribute__((unused)) void * restrict dst,
565496c5ddc4Srjs                               __attribute__((unused)) const struct GFX7_MI_LOAD_REGISTER_MEM * restrict values)
565510e230b6Smaya{
565610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
565710e230b6Smaya
565810e230b6Smaya   dw[0] =
565910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
566010e230b6Smaya      __gen_uint(values->AsyncModeEnable, 21, 21) |
566110e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
566210e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
566310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
566410e230b6Smaya
566510e230b6Smaya   dw[1] =
566610e230b6Smaya      __gen_offset(values->RegisterAddress, 2, 22);
566710e230b6Smaya
566896c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->MemoryAddress, 0, 2, 31);
566910e230b6Smaya}
567010e230b6Smaya
567196c5ddc4Srjs#define GFX7_MI_NOOP_length                    1
567296c5ddc4Srjs#define GFX7_MI_NOOP_length_bias               1
567396c5ddc4Srjs#define GFX7_MI_NOOP_header                     \
567410e230b6Smaya   .MICommandOpcode                     =      0,  \
567510e230b6Smaya   .CommandType                         =      0
567610e230b6Smaya
567796c5ddc4Srjsstruct GFX7_MI_NOOP {
567810e230b6Smaya   uint32_t                             IdentificationNumber;
567910e230b6Smaya   bool                                 IdentificationNumberRegisterWriteEnable;
568010e230b6Smaya   uint32_t                             MICommandOpcode;
568110e230b6Smaya   uint32_t                             CommandType;
568210e230b6Smaya};
568310e230b6Smaya
568496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
568596c5ddc4SrjsGFX7_MI_NOOP_pack(__attribute__((unused)) __gen_user_data *data,
568610e230b6Smaya                  __attribute__((unused)) void * restrict dst,
568796c5ddc4Srjs                  __attribute__((unused)) const struct GFX7_MI_NOOP * restrict values)
568810e230b6Smaya{
568910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
569010e230b6Smaya
569110e230b6Smaya   dw[0] =
569210e230b6Smaya      __gen_uint(values->IdentificationNumber, 0, 21) |
569310e230b6Smaya      __gen_uint(values->IdentificationNumberRegisterWriteEnable, 22, 22) |
569410e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
569510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
569610e230b6Smaya}
569710e230b6Smaya
569896c5ddc4Srjs#define GFX7_MI_PREDICATE_length               1
569996c5ddc4Srjs#define GFX7_MI_PREDICATE_length_bias          1
570096c5ddc4Srjs#define GFX7_MI_PREDICATE_header                \
570110e230b6Smaya   .MICommandOpcode                     =     12,  \
570210e230b6Smaya   .CommandType                         =      0
570310e230b6Smaya
570496c5ddc4Srjsstruct GFX7_MI_PREDICATE {
570510e230b6Smaya   uint32_t                             CompareOperation;
570610e230b6Smaya#define COMPARE_TRUE                             0
570710e230b6Smaya#define COMPARE_FALSE                            1
570810e230b6Smaya#define COMPARE_SRCS_EQUAL                       2
570910e230b6Smaya#define COMPARE_DELTAS_EQUAL                     3
571010e230b6Smaya   uint32_t                             CombineOperation;
571110e230b6Smaya#define COMBINE_SET                              0
571210e230b6Smaya#define COMBINE_AND                              1
571310e230b6Smaya#define COMBINE_OR                               2
571410e230b6Smaya#define COMBINE_XOR                              3
571510e230b6Smaya   uint32_t                             LoadOperation;
571610e230b6Smaya#define LOAD_KEEP                                0
571710e230b6Smaya#define LOAD_LOAD                                2
571810e230b6Smaya#define LOAD_LOADINV                             3
571910e230b6Smaya   uint32_t                             MICommandOpcode;
572010e230b6Smaya   uint32_t                             CommandType;
572110e230b6Smaya};
572210e230b6Smaya
572396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
572496c5ddc4SrjsGFX7_MI_PREDICATE_pack(__attribute__((unused)) __gen_user_data *data,
572510e230b6Smaya                       __attribute__((unused)) void * restrict dst,
572696c5ddc4Srjs                       __attribute__((unused)) const struct GFX7_MI_PREDICATE * restrict values)
572710e230b6Smaya{
572810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
572910e230b6Smaya
573010e230b6Smaya   dw[0] =
573110e230b6Smaya      __gen_uint(values->CompareOperation, 0, 1) |
573210e230b6Smaya      __gen_uint(values->CombineOperation, 3, 4) |
573310e230b6Smaya      __gen_uint(values->LoadOperation, 6, 7) |
573410e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
573510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
573610e230b6Smaya}
573710e230b6Smaya
573896c5ddc4Srjs#define GFX7_MI_REPORT_HEAD_length             1
573996c5ddc4Srjs#define GFX7_MI_REPORT_HEAD_length_bias        1
574096c5ddc4Srjs#define GFX7_MI_REPORT_HEAD_header              \
574110e230b6Smaya   .MICommandOpcode                     =      7,  \
574210e230b6Smaya   .CommandType                         =      0
574310e230b6Smaya
574496c5ddc4Srjsstruct GFX7_MI_REPORT_HEAD {
574510e230b6Smaya   uint32_t                             MICommandOpcode;
574610e230b6Smaya   uint32_t                             CommandType;
574710e230b6Smaya};
574810e230b6Smaya
574996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
575096c5ddc4SrjsGFX7_MI_REPORT_HEAD_pack(__attribute__((unused)) __gen_user_data *data,
575110e230b6Smaya                         __attribute__((unused)) void * restrict dst,
575296c5ddc4Srjs                         __attribute__((unused)) const struct GFX7_MI_REPORT_HEAD * restrict values)
575310e230b6Smaya{
575410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
575510e230b6Smaya
575610e230b6Smaya   dw[0] =
575710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
575810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
575910e230b6Smaya}
576010e230b6Smaya
576196c5ddc4Srjs#define GFX7_MI_REPORT_PERF_COUNT_length       3
576296c5ddc4Srjs#define GFX7_MI_REPORT_PERF_COUNT_length_bias      2
576396c5ddc4Srjs#define GFX7_MI_REPORT_PERF_COUNT_header        \
576410e230b6Smaya   .DWordLength                         =      1,  \
576510e230b6Smaya   .MICommandOpcode                     =     40,  \
576610e230b6Smaya   .CommandType                         =      0
576710e230b6Smaya
576896c5ddc4Srjsstruct GFX7_MI_REPORT_PERF_COUNT {
576910e230b6Smaya   uint32_t                             DWordLength;
577010e230b6Smaya   uint32_t                             MICommandOpcode;
577110e230b6Smaya   uint32_t                             CommandType;
577210e230b6Smaya   bool                                 UseGlobalGTT;
577310e230b6Smaya   __gen_address_type                   MemoryAddress;
577410e230b6Smaya   uint32_t                             ReportID;
577510e230b6Smaya};
577610e230b6Smaya
577796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
577896c5ddc4SrjsGFX7_MI_REPORT_PERF_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
577910e230b6Smaya                               __attribute__((unused)) void * restrict dst,
578096c5ddc4Srjs                               __attribute__((unused)) const struct GFX7_MI_REPORT_PERF_COUNT * restrict values)
578110e230b6Smaya{
578210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
578310e230b6Smaya
578410e230b6Smaya   dw[0] =
578510e230b6Smaya      __gen_uint(values->DWordLength, 0, 5) |
578610e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
578710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
578810e230b6Smaya
578910e230b6Smaya   const uint32_t v1 =
579010e230b6Smaya      __gen_uint(values->UseGlobalGTT, 0, 0);
579196c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->MemoryAddress, v1, 6, 31);
579210e230b6Smaya
579310e230b6Smaya   dw[2] =
579410e230b6Smaya      __gen_uint(values->ReportID, 0, 31);
579510e230b6Smaya}
579610e230b6Smaya
579796c5ddc4Srjs#define GFX7_MI_SEMAPHORE_MBOX_length          3
579896c5ddc4Srjs#define GFX7_MI_SEMAPHORE_MBOX_length_bias      2
579996c5ddc4Srjs#define GFX7_MI_SEMAPHORE_MBOX_header           \
580010e230b6Smaya   .DWordLength                         =      1,  \
580110e230b6Smaya   .MICommandOpcode                     =     22,  \
580210e230b6Smaya   .CommandType                         =      0
580310e230b6Smaya
580496c5ddc4Srjsstruct GFX7_MI_SEMAPHORE_MBOX {
580510e230b6Smaya   uint32_t                             DWordLength;
580610e230b6Smaya   uint32_t                             RegisterSelect;
580710e230b6Smaya#define RVSYNC                                   0
580810e230b6Smaya#define RBSYNC                                   2
580910e230b6Smaya#define UseGeneralRegisterSelect                 3
581010e230b6Smaya   uint32_t                             MICommandOpcode;
581110e230b6Smaya   uint32_t                             CommandType;
581210e230b6Smaya   uint32_t                             SemaphoreDataDword;
581310e230b6Smaya};
581410e230b6Smaya
581596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
581696c5ddc4SrjsGFX7_MI_SEMAPHORE_MBOX_pack(__attribute__((unused)) __gen_user_data *data,
581710e230b6Smaya                            __attribute__((unused)) void * restrict dst,
581896c5ddc4Srjs                            __attribute__((unused)) const struct GFX7_MI_SEMAPHORE_MBOX * restrict values)
581910e230b6Smaya{
582010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
582110e230b6Smaya
582210e230b6Smaya   dw[0] =
582310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
582410e230b6Smaya      __gen_uint(values->RegisterSelect, 16, 17) |
582510e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
582610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
582710e230b6Smaya
582810e230b6Smaya   dw[1] =
582910e230b6Smaya      __gen_uint(values->SemaphoreDataDword, 0, 31);
583010e230b6Smaya
583110e230b6Smaya   dw[2] = 0;
583210e230b6Smaya}
583310e230b6Smaya
583496c5ddc4Srjs#define GFX7_MI_SET_CONTEXT_length             2
583596c5ddc4Srjs#define GFX7_MI_SET_CONTEXT_length_bias        2
583696c5ddc4Srjs#define GFX7_MI_SET_CONTEXT_header              \
583710e230b6Smaya   .DWordLength                         =      0,  \
583810e230b6Smaya   .MICommandOpcode                     =     24,  \
583910e230b6Smaya   .CommandType                         =      0
584010e230b6Smaya
584196c5ddc4Srjsstruct GFX7_MI_SET_CONTEXT {
584210e230b6Smaya   uint32_t                             DWordLength;
584310e230b6Smaya   uint32_t                             MICommandOpcode;
584410e230b6Smaya   uint32_t                             CommandType;
584510e230b6Smaya   uint32_t                             RestoreInhibit;
584610e230b6Smaya   uint32_t                             ForceRestore;
584710e230b6Smaya   bool                                 ExtendedStateRestoreEnable;
584810e230b6Smaya   bool                                 ExtendedStateSaveEnable;
584910e230b6Smaya   uint32_t                             ReservedMustbe1;
585010e230b6Smaya   __gen_address_type                   LogicalContextAddress;
585110e230b6Smaya};
585210e230b6Smaya
585396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
585496c5ddc4SrjsGFX7_MI_SET_CONTEXT_pack(__attribute__((unused)) __gen_user_data *data,
585510e230b6Smaya                         __attribute__((unused)) void * restrict dst,
585696c5ddc4Srjs                         __attribute__((unused)) const struct GFX7_MI_SET_CONTEXT * restrict values)
585710e230b6Smaya{
585810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
585910e230b6Smaya
586010e230b6Smaya   dw[0] =
586110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
586210e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
586310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
586410e230b6Smaya
586510e230b6Smaya   const uint32_t v1 =
586610e230b6Smaya      __gen_uint(values->RestoreInhibit, 0, 0) |
586710e230b6Smaya      __gen_uint(values->ForceRestore, 1, 1) |
586810e230b6Smaya      __gen_uint(values->ExtendedStateRestoreEnable, 2, 2) |
586910e230b6Smaya      __gen_uint(values->ExtendedStateSaveEnable, 3, 3) |
587010e230b6Smaya      __gen_uint(values->ReservedMustbe1, 8, 8);
587196c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->LogicalContextAddress, v1, 12, 31);
587210e230b6Smaya}
587310e230b6Smaya
587496c5ddc4Srjs#define GFX7_MI_STORE_DATA_IMM_length          4
587596c5ddc4Srjs#define GFX7_MI_STORE_DATA_IMM_length_bias      2
587696c5ddc4Srjs#define GFX7_MI_STORE_DATA_IMM_header           \
587710e230b6Smaya   .DWordLength                         =      2,  \
587810e230b6Smaya   .MICommandOpcode                     =     32,  \
587910e230b6Smaya   .CommandType                         =      0
588010e230b6Smaya
588196c5ddc4Srjsstruct GFX7_MI_STORE_DATA_IMM {
588210e230b6Smaya   uint32_t                             DWordLength;
588310e230b6Smaya   bool                                 UseGlobalGTT;
588410e230b6Smaya   uint32_t                             MICommandOpcode;
588510e230b6Smaya   uint32_t                             CommandType;
588610e230b6Smaya   uint32_t                             CoreModeEnable;
588710e230b6Smaya   __gen_address_type                   Address;
588810e230b6Smaya   uint64_t                             ImmediateData;
588910e230b6Smaya};
589010e230b6Smaya
589196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
589296c5ddc4SrjsGFX7_MI_STORE_DATA_IMM_pack(__attribute__((unused)) __gen_user_data *data,
589310e230b6Smaya                            __attribute__((unused)) void * restrict dst,
589496c5ddc4Srjs                            __attribute__((unused)) const struct GFX7_MI_STORE_DATA_IMM * restrict values)
589510e230b6Smaya{
589610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
589710e230b6Smaya
589810e230b6Smaya   dw[0] =
589910e230b6Smaya      __gen_uint(values->DWordLength, 0, 5) |
590010e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
590110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
590210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
590310e230b6Smaya
590410e230b6Smaya   dw[1] = 0;
590510e230b6Smaya
590610e230b6Smaya   const uint32_t v2 =
590710e230b6Smaya      __gen_uint(values->CoreModeEnable, 0, 0);
590896c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->Address, v2, 2, 31);
590910e230b6Smaya
591010e230b6Smaya   const uint64_t v3 =
591110e230b6Smaya      __gen_uint(values->ImmediateData, 0, 63);
591210e230b6Smaya   dw[3] = v3;
591310e230b6Smaya   dw[4] = v3 >> 32;
591410e230b6Smaya}
591510e230b6Smaya
591696c5ddc4Srjs#define GFX7_MI_STORE_DATA_INDEX_length        3
591796c5ddc4Srjs#define GFX7_MI_STORE_DATA_INDEX_length_bias      2
591896c5ddc4Srjs#define GFX7_MI_STORE_DATA_INDEX_header         \
591910e230b6Smaya   .DWordLength                         =      1,  \
592010e230b6Smaya   .MICommandOpcode                     =     33,  \
592110e230b6Smaya   .CommandType                         =      0
592210e230b6Smaya
592396c5ddc4Srjsstruct GFX7_MI_STORE_DATA_INDEX {
592410e230b6Smaya   uint32_t                             DWordLength;
592510e230b6Smaya   uint32_t                             MICommandOpcode;
592610e230b6Smaya   uint32_t                             CommandType;
592710e230b6Smaya   uint32_t                             Offset;
592810e230b6Smaya   uint32_t                             DataDWord0;
592910e230b6Smaya   uint32_t                             DataDWord1;
593010e230b6Smaya};
593110e230b6Smaya
593296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
593396c5ddc4SrjsGFX7_MI_STORE_DATA_INDEX_pack(__attribute__((unused)) __gen_user_data *data,
593410e230b6Smaya                              __attribute__((unused)) void * restrict dst,
593596c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_MI_STORE_DATA_INDEX * restrict values)
593610e230b6Smaya{
593710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
593810e230b6Smaya
593910e230b6Smaya   dw[0] =
594010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
594110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
594210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
594310e230b6Smaya
594410e230b6Smaya   dw[1] =
594510e230b6Smaya      __gen_uint(values->Offset, 2, 11);
594610e230b6Smaya
594710e230b6Smaya   dw[2] =
594810e230b6Smaya      __gen_uint(values->DataDWord0, 0, 31);
594910e230b6Smaya}
595010e230b6Smaya
595196c5ddc4Srjs#define GFX7_MI_STORE_REGISTER_MEM_length      3
595296c5ddc4Srjs#define GFX7_MI_STORE_REGISTER_MEM_length_bias      2
595396c5ddc4Srjs#define GFX7_MI_STORE_REGISTER_MEM_header       \
595410e230b6Smaya   .DWordLength                         =      1,  \
595510e230b6Smaya   .MICommandOpcode                     =     36,  \
595610e230b6Smaya   .CommandType                         =      0
595710e230b6Smaya
595896c5ddc4Srjsstruct GFX7_MI_STORE_REGISTER_MEM {
595910e230b6Smaya   uint32_t                             DWordLength;
596010e230b6Smaya   bool                                 UseGlobalGTT;
596110e230b6Smaya   uint32_t                             MICommandOpcode;
596210e230b6Smaya   uint32_t                             CommandType;
596310e230b6Smaya   uint64_t                             RegisterAddress;
596410e230b6Smaya   __gen_address_type                   MemoryAddress;
596510e230b6Smaya};
596610e230b6Smaya
596796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
596896c5ddc4SrjsGFX7_MI_STORE_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
596910e230b6Smaya                                __attribute__((unused)) void * restrict dst,
597096c5ddc4Srjs                                __attribute__((unused)) const struct GFX7_MI_STORE_REGISTER_MEM * restrict values)
597110e230b6Smaya{
597210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
597310e230b6Smaya
597410e230b6Smaya   dw[0] =
597510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
597610e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
597710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
597810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
597910e230b6Smaya
598010e230b6Smaya   dw[1] =
598110e230b6Smaya      __gen_offset(values->RegisterAddress, 2, 22);
598210e230b6Smaya
598396c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->MemoryAddress, 0, 2, 31);
598410e230b6Smaya}
598510e230b6Smaya
598696c5ddc4Srjs#define GFX7_MI_SUSPEND_FLUSH_length           1
598796c5ddc4Srjs#define GFX7_MI_SUSPEND_FLUSH_length_bias      1
598896c5ddc4Srjs#define GFX7_MI_SUSPEND_FLUSH_header            \
598910e230b6Smaya   .MICommandOpcode                     =     11,  \
599010e230b6Smaya   .CommandType                         =      0
599110e230b6Smaya
599296c5ddc4Srjsstruct GFX7_MI_SUSPEND_FLUSH {
599310e230b6Smaya   bool                                 SuspendFlush;
599410e230b6Smaya   uint32_t                             MICommandOpcode;
599510e230b6Smaya   uint32_t                             CommandType;
599610e230b6Smaya};
599710e230b6Smaya
599896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
599996c5ddc4SrjsGFX7_MI_SUSPEND_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
600010e230b6Smaya                           __attribute__((unused)) void * restrict dst,
600196c5ddc4Srjs                           __attribute__((unused)) const struct GFX7_MI_SUSPEND_FLUSH * restrict values)
600210e230b6Smaya{
600310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
600410e230b6Smaya
600510e230b6Smaya   dw[0] =
600610e230b6Smaya      __gen_uint(values->SuspendFlush, 0, 0) |
600710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
600810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
600910e230b6Smaya}
601010e230b6Smaya
601196c5ddc4Srjs#define GFX7_MI_TOPOLOGY_FILTER_length         1
601296c5ddc4Srjs#define GFX7_MI_TOPOLOGY_FILTER_length_bias      1
601396c5ddc4Srjs#define GFX7_MI_TOPOLOGY_FILTER_header          \
601410e230b6Smaya   .MICommandOpcode                     =     13,  \
601510e230b6Smaya   .CommandType                         =      0
601610e230b6Smaya
601796c5ddc4Srjsstruct GFX7_MI_TOPOLOGY_FILTER {
601896c5ddc4Srjs   enum GFX7_3D_Prim_Topo_Type          TopologyFilterValue;
601910e230b6Smaya   uint32_t                             MICommandOpcode;
602010e230b6Smaya   uint32_t                             CommandType;
602110e230b6Smaya};
602210e230b6Smaya
602396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
602496c5ddc4SrjsGFX7_MI_TOPOLOGY_FILTER_pack(__attribute__((unused)) __gen_user_data *data,
602510e230b6Smaya                             __attribute__((unused)) void * restrict dst,
602696c5ddc4Srjs                             __attribute__((unused)) const struct GFX7_MI_TOPOLOGY_FILTER * restrict values)
602710e230b6Smaya{
602810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
602910e230b6Smaya
603010e230b6Smaya   dw[0] =
603110e230b6Smaya      __gen_uint(values->TopologyFilterValue, 0, 5) |
603210e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
603310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
603410e230b6Smaya}
603510e230b6Smaya
603696c5ddc4Srjs#define GFX7_MI_URB_CLEAR_length               2
603796c5ddc4Srjs#define GFX7_MI_URB_CLEAR_length_bias          2
603896c5ddc4Srjs#define GFX7_MI_URB_CLEAR_header                \
603910e230b6Smaya   .DWordLength                         =      0,  \
604010e230b6Smaya   .MICommandOpcode                     =     25,  \
604110e230b6Smaya   .CommandType                         =      0
604210e230b6Smaya
604396c5ddc4Srjsstruct GFX7_MI_URB_CLEAR {
604410e230b6Smaya   uint32_t                             DWordLength;
604510e230b6Smaya   uint32_t                             MICommandOpcode;
604610e230b6Smaya   uint32_t                             CommandType;
604710e230b6Smaya   uint64_t                             URBAddress;
604810e230b6Smaya   uint32_t                             URBClearLength;
604910e230b6Smaya};
605010e230b6Smaya
605196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
605296c5ddc4SrjsGFX7_MI_URB_CLEAR_pack(__attribute__((unused)) __gen_user_data *data,
605310e230b6Smaya                       __attribute__((unused)) void * restrict dst,
605496c5ddc4Srjs                       __attribute__((unused)) const struct GFX7_MI_URB_CLEAR * restrict values)
605510e230b6Smaya{
605610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
605710e230b6Smaya
605810e230b6Smaya   dw[0] =
605910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
606010e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
606110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
606210e230b6Smaya
606310e230b6Smaya   dw[1] =
606410e230b6Smaya      __gen_offset(values->URBAddress, 0, 13) |
606510e230b6Smaya      __gen_uint(values->URBClearLength, 16, 28);
606610e230b6Smaya}
606710e230b6Smaya
606896c5ddc4Srjs#define GFX7_MI_USER_INTERRUPT_length          1
606996c5ddc4Srjs#define GFX7_MI_USER_INTERRUPT_length_bias      1
607096c5ddc4Srjs#define GFX7_MI_USER_INTERRUPT_header           \
607110e230b6Smaya   .MICommandOpcode                     =      2,  \
607210e230b6Smaya   .CommandType                         =      0
607310e230b6Smaya
607496c5ddc4Srjsstruct GFX7_MI_USER_INTERRUPT {
607510e230b6Smaya   uint32_t                             MICommandOpcode;
607610e230b6Smaya   uint32_t                             CommandType;
607710e230b6Smaya};
607810e230b6Smaya
607996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
608096c5ddc4SrjsGFX7_MI_USER_INTERRUPT_pack(__attribute__((unused)) __gen_user_data *data,
608110e230b6Smaya                            __attribute__((unused)) void * restrict dst,
608296c5ddc4Srjs                            __attribute__((unused)) const struct GFX7_MI_USER_INTERRUPT * restrict values)
608310e230b6Smaya{
608410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
608510e230b6Smaya
608610e230b6Smaya   dw[0] =
608710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
608810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
608910e230b6Smaya}
609010e230b6Smaya
609196c5ddc4Srjs#define GFX7_MI_WAIT_FOR_EVENT_length          1
609296c5ddc4Srjs#define GFX7_MI_WAIT_FOR_EVENT_length_bias      1
609396c5ddc4Srjs#define GFX7_MI_WAIT_FOR_EVENT_header           \
609410e230b6Smaya   .MICommandOpcode                     =      3,  \
609510e230b6Smaya   .CommandType                         =      0
609610e230b6Smaya
609796c5ddc4Srjsstruct GFX7_MI_WAIT_FOR_EVENT {
609810e230b6Smaya   bool                                 DisplayPipeAScanLineWaitEnable;
609910e230b6Smaya   bool                                 DisplayPlaneAFlipPendingWaitEnable;
610010e230b6Smaya   bool                                 DisplaySpriteAFlipPendingWaitEnable;
610110e230b6Smaya   bool                                 DisplayPipeAVerticalBlankWaitEnable;
610210e230b6Smaya   bool                                 DisplayPipeAHorizontalBlankWaitEnable;
610310e230b6Smaya   bool                                 DisplayPipeBScanLineWaitEnable;
610410e230b6Smaya   bool                                 DisplayPlaneBFlipPendingWaitEnable;
610510e230b6Smaya   bool                                 DisplaySpriteBFlipPendingWaitEnable;
610610e230b6Smaya   bool                                 DisplayPipeBVerticalBlankWaitEnable;
610710e230b6Smaya   bool                                 DisplayPipeBHorizontalBlankWaitEnable;
610810e230b6Smaya   bool                                 DisplayPipeCScanLineWaitEnable;
610910e230b6Smaya   bool                                 DisplayPlaneCFlipPendingWaitEnable;
611010e230b6Smaya   uint32_t                             ConditionCodeWaitSelect;
611110e230b6Smaya#define Notenabled                               0
611210e230b6Smaya   bool                                 DisplaySpriteCFlipPendingWaitEnable;
611310e230b6Smaya   bool                                 DisplayPipeCVerticalBlankWaitEnable;
611410e230b6Smaya   bool                                 DisplayPipeCHorizontalBlankWaitEnable;
611510e230b6Smaya   uint32_t                             MICommandOpcode;
611610e230b6Smaya   uint32_t                             CommandType;
611710e230b6Smaya};
611810e230b6Smaya
611996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
612096c5ddc4SrjsGFX7_MI_WAIT_FOR_EVENT_pack(__attribute__((unused)) __gen_user_data *data,
612110e230b6Smaya                            __attribute__((unused)) void * restrict dst,
612296c5ddc4Srjs                            __attribute__((unused)) const struct GFX7_MI_WAIT_FOR_EVENT * restrict values)
612310e230b6Smaya{
612410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
612510e230b6Smaya
612610e230b6Smaya   dw[0] =
612710e230b6Smaya      __gen_uint(values->DisplayPipeAScanLineWaitEnable, 0, 0) |
612810e230b6Smaya      __gen_uint(values->DisplayPlaneAFlipPendingWaitEnable, 1, 1) |
612910e230b6Smaya      __gen_uint(values->DisplaySpriteAFlipPendingWaitEnable, 2, 2) |
613010e230b6Smaya      __gen_uint(values->DisplayPipeAVerticalBlankWaitEnable, 3, 3) |
613110e230b6Smaya      __gen_uint(values->DisplayPipeAHorizontalBlankWaitEnable, 5, 5) |
613210e230b6Smaya      __gen_uint(values->DisplayPipeBScanLineWaitEnable, 8, 8) |
613310e230b6Smaya      __gen_uint(values->DisplayPlaneBFlipPendingWaitEnable, 9, 9) |
613410e230b6Smaya      __gen_uint(values->DisplaySpriteBFlipPendingWaitEnable, 10, 10) |
613510e230b6Smaya      __gen_uint(values->DisplayPipeBVerticalBlankWaitEnable, 11, 11) |
613610e230b6Smaya      __gen_uint(values->DisplayPipeBHorizontalBlankWaitEnable, 13, 13) |
613710e230b6Smaya      __gen_uint(values->DisplayPipeCScanLineWaitEnable, 14, 14) |
613810e230b6Smaya      __gen_uint(values->DisplayPlaneCFlipPendingWaitEnable, 15, 15) |
613910e230b6Smaya      __gen_uint(values->ConditionCodeWaitSelect, 16, 19) |
614010e230b6Smaya      __gen_uint(values->DisplaySpriteCFlipPendingWaitEnable, 20, 20) |
614110e230b6Smaya      __gen_uint(values->DisplayPipeCVerticalBlankWaitEnable, 21, 21) |
614210e230b6Smaya      __gen_uint(values->DisplayPipeCHorizontalBlankWaitEnable, 22, 22) |
614310e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
614410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
614510e230b6Smaya}
614610e230b6Smaya
614796c5ddc4Srjs#define GFX7_PIPELINE_SELECT_length            1
614896c5ddc4Srjs#define GFX7_PIPELINE_SELECT_length_bias       1
614996c5ddc4Srjs#define GFX7_PIPELINE_SELECT_header             \
615010e230b6Smaya   ._3DCommandSubOpcode                 =      4,  \
615110e230b6Smaya   ._3DCommandOpcode                    =      1,  \
615210e230b6Smaya   .CommandSubType                      =      1,  \
615310e230b6Smaya   .CommandType                         =      3
615410e230b6Smaya
615596c5ddc4Srjsstruct GFX7_PIPELINE_SELECT {
615610e230b6Smaya   uint32_t                             PipelineSelection;
615710e230b6Smaya#define _3D                                      0
615810e230b6Smaya#define Media                                    1
615910e230b6Smaya#define GPGPU                                    2
616010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
616110e230b6Smaya   uint32_t                             _3DCommandOpcode;
616210e230b6Smaya   uint32_t                             CommandSubType;
616310e230b6Smaya   uint32_t                             CommandType;
616410e230b6Smaya};
616510e230b6Smaya
616696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
616796c5ddc4SrjsGFX7_PIPELINE_SELECT_pack(__attribute__((unused)) __gen_user_data *data,
616810e230b6Smaya                          __attribute__((unused)) void * restrict dst,
616996c5ddc4Srjs                          __attribute__((unused)) const struct GFX7_PIPELINE_SELECT * restrict values)
617010e230b6Smaya{
617110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
617210e230b6Smaya
617310e230b6Smaya   dw[0] =
617410e230b6Smaya      __gen_uint(values->PipelineSelection, 0, 1) |
617510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
617610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
617710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
617810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
617910e230b6Smaya}
618010e230b6Smaya
618196c5ddc4Srjs#define GFX7_PIPE_CONTROL_length               5
618296c5ddc4Srjs#define GFX7_PIPE_CONTROL_length_bias          2
618396c5ddc4Srjs#define GFX7_PIPE_CONTROL_header                \
618410e230b6Smaya   .DWordLength                         =      3,  \
618510e230b6Smaya   ._3DCommandSubOpcode                 =      0,  \
618610e230b6Smaya   ._3DCommandOpcode                    =      2,  \
618710e230b6Smaya   .CommandSubType                      =      3,  \
618810e230b6Smaya   .CommandType                         =      3
618910e230b6Smaya
619096c5ddc4Srjsstruct GFX7_PIPE_CONTROL {
619110e230b6Smaya   uint32_t                             DWordLength;
619210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
619310e230b6Smaya   uint32_t                             _3DCommandOpcode;
619410e230b6Smaya   uint32_t                             CommandSubType;
619510e230b6Smaya   uint32_t                             CommandType;
619610e230b6Smaya   bool                                 DepthCacheFlushEnable;
619710e230b6Smaya   bool                                 StallAtPixelScoreboard;
619810e230b6Smaya   bool                                 StateCacheInvalidationEnable;
619910e230b6Smaya   bool                                 ConstantCacheInvalidationEnable;
620010e230b6Smaya   bool                                 VFCacheInvalidationEnable;
620110e230b6Smaya   bool                                 DCFlushEnable;
620210e230b6Smaya   bool                                 PipeControlFlushEnable;
620310e230b6Smaya   bool                                 NotifyEnable;
620410e230b6Smaya   bool                                 IndirectStatePointersDisable;
620510e230b6Smaya   bool                                 TextureCacheInvalidationEnable;
620610e230b6Smaya   bool                                 InstructionCacheInvalidateEnable;
620710e230b6Smaya   bool                                 RenderTargetCacheFlushEnable;
620810e230b6Smaya   bool                                 DepthStallEnable;
620910e230b6Smaya   uint32_t                             PostSyncOperation;
621010e230b6Smaya#define NoWrite                                  0
621110e230b6Smaya#define WriteImmediateData                       1
621210e230b6Smaya#define WritePSDepthCount                        2
621310e230b6Smaya#define WriteTimestamp                           3
621410e230b6Smaya   bool                                 GenericMediaStateClear;
621510e230b6Smaya   bool                                 TLBInvalidate;
621610e230b6Smaya   bool                                 GlobalSnapshotCountReset;
621710e230b6Smaya   bool                                 CommandStreamerStallEnable;
621810e230b6Smaya   uint32_t                             StoreDataIndex;
621910e230b6Smaya   uint32_t                             LRIPostSyncOperation;
622010e230b6Smaya#define NoLRIOperation                           0
622110e230b6Smaya#define MMIOWriteImmediateData                   1
622210e230b6Smaya   uint32_t                             DestinationAddressType;
622310e230b6Smaya#define DAT_PPGTT                                0
622410e230b6Smaya#define DAT_GGTT                                 1
622510e230b6Smaya   __gen_address_type                   Address;
622610e230b6Smaya   uint64_t                             ImmediateData;
622710e230b6Smaya};
622810e230b6Smaya
622996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
623096c5ddc4SrjsGFX7_PIPE_CONTROL_pack(__attribute__((unused)) __gen_user_data *data,
623110e230b6Smaya                       __attribute__((unused)) void * restrict dst,
623296c5ddc4Srjs                       __attribute__((unused)) const struct GFX7_PIPE_CONTROL * restrict values)
623310e230b6Smaya{
623410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
623510e230b6Smaya
623610e230b6Smaya   dw[0] =
623710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
623810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
623910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
624010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
624110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
624210e230b6Smaya
624310e230b6Smaya   dw[1] =
624410e230b6Smaya      __gen_uint(values->DepthCacheFlushEnable, 0, 0) |
624510e230b6Smaya      __gen_uint(values->StallAtPixelScoreboard, 1, 1) |
624610e230b6Smaya      __gen_uint(values->StateCacheInvalidationEnable, 2, 2) |
624710e230b6Smaya      __gen_uint(values->ConstantCacheInvalidationEnable, 3, 3) |
624810e230b6Smaya      __gen_uint(values->VFCacheInvalidationEnable, 4, 4) |
624910e230b6Smaya      __gen_uint(values->DCFlushEnable, 5, 5) |
625010e230b6Smaya      __gen_uint(values->PipeControlFlushEnable, 7, 7) |
625110e230b6Smaya      __gen_uint(values->NotifyEnable, 8, 8) |
625210e230b6Smaya      __gen_uint(values->IndirectStatePointersDisable, 9, 9) |
625310e230b6Smaya      __gen_uint(values->TextureCacheInvalidationEnable, 10, 10) |
625410e230b6Smaya      __gen_uint(values->InstructionCacheInvalidateEnable, 11, 11) |
625510e230b6Smaya      __gen_uint(values->RenderTargetCacheFlushEnable, 12, 12) |
625610e230b6Smaya      __gen_uint(values->DepthStallEnable, 13, 13) |
625710e230b6Smaya      __gen_uint(values->PostSyncOperation, 14, 15) |
625810e230b6Smaya      __gen_uint(values->GenericMediaStateClear, 16, 16) |
625910e230b6Smaya      __gen_uint(values->TLBInvalidate, 18, 18) |
626010e230b6Smaya      __gen_uint(values->GlobalSnapshotCountReset, 19, 19) |
626110e230b6Smaya      __gen_uint(values->CommandStreamerStallEnable, 20, 20) |
626210e230b6Smaya      __gen_uint(values->StoreDataIndex, 21, 21) |
626310e230b6Smaya      __gen_uint(values->LRIPostSyncOperation, 23, 23) |
626410e230b6Smaya      __gen_uint(values->DestinationAddressType, 24, 24);
626510e230b6Smaya
626696c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->Address, 0, 2, 31);
626710e230b6Smaya
626810e230b6Smaya   const uint64_t v3 =
626910e230b6Smaya      __gen_uint(values->ImmediateData, 0, 63);
627010e230b6Smaya   dw[3] = v3;
627110e230b6Smaya   dw[4] = v3 >> 32;
627210e230b6Smaya}
627310e230b6Smaya
627496c5ddc4Srjs#define GFX7_STATE_BASE_ADDRESS_length        10
627596c5ddc4Srjs#define GFX7_STATE_BASE_ADDRESS_length_bias      2
627696c5ddc4Srjs#define GFX7_STATE_BASE_ADDRESS_header          \
627710e230b6Smaya   .DWordLength                         =      8,  \
627810e230b6Smaya   ._3DCommandSubOpcode                 =      1,  \
627910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
628010e230b6Smaya   .CommandSubType                      =      0,  \
628110e230b6Smaya   .CommandType                         =      3
628210e230b6Smaya
628396c5ddc4Srjsstruct GFX7_STATE_BASE_ADDRESS {
628410e230b6Smaya   uint32_t                             DWordLength;
628510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
628610e230b6Smaya   uint32_t                             _3DCommandOpcode;
628710e230b6Smaya   uint32_t                             CommandSubType;
628810e230b6Smaya   uint32_t                             CommandType;
628910e230b6Smaya   bool                                 GeneralStateBaseAddressModifyEnable;
629010e230b6Smaya   uint32_t                             StatelessDataPortAccessForceWriteThru;
629110e230b6Smaya   uint32_t                             StatelessDataPortAccessMOCS;
629210e230b6Smaya   uint32_t                             GeneralStateMOCS;
629310e230b6Smaya   __gen_address_type                   GeneralStateBaseAddress;
629410e230b6Smaya   bool                                 SurfaceStateBaseAddressModifyEnable;
629510e230b6Smaya   uint32_t                             SurfaceStateMOCS;
629610e230b6Smaya   __gen_address_type                   SurfaceStateBaseAddress;
629710e230b6Smaya   bool                                 DynamicStateBaseAddressModifyEnable;
629810e230b6Smaya   uint32_t                             DynamicStateMOCS;
629910e230b6Smaya   __gen_address_type                   DynamicStateBaseAddress;
630010e230b6Smaya   bool                                 IndirectObjectBaseAddressModifyEnable;
630110e230b6Smaya   uint32_t                             IndirectObjectMOCS;
630210e230b6Smaya   __gen_address_type                   IndirectObjectBaseAddress;
630310e230b6Smaya   bool                                 InstructionBaseAddressModifyEnable;
630410e230b6Smaya   uint32_t                             InstructionMOCS;
630510e230b6Smaya   __gen_address_type                   InstructionBaseAddress;
630610e230b6Smaya   bool                                 GeneralStateAccessUpperBoundModifyEnable;
630710e230b6Smaya   __gen_address_type                   GeneralStateAccessUpperBound;
630810e230b6Smaya   bool                                 DynamicStateAccessUpperBoundModifyEnable;
630910e230b6Smaya   __gen_address_type                   DynamicStateAccessUpperBound;
631010e230b6Smaya   bool                                 IndirectObjectAccessUpperBoundModifyEnable;
631110e230b6Smaya   __gen_address_type                   IndirectObjectAccessUpperBound;
631210e230b6Smaya   bool                                 InstructionAccessUpperBoundModifyEnable;
631310e230b6Smaya   __gen_address_type                   InstructionAccessUpperBound;
631410e230b6Smaya};
631510e230b6Smaya
631696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
631796c5ddc4SrjsGFX7_STATE_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
631810e230b6Smaya                             __attribute__((unused)) void * restrict dst,
631996c5ddc4Srjs                             __attribute__((unused)) const struct GFX7_STATE_BASE_ADDRESS * restrict values)
632010e230b6Smaya{
632110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
632210e230b6Smaya
632310e230b6Smaya   dw[0] =
632410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
632510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
632610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
632710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
632810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
632910e230b6Smaya
633010e230b6Smaya   const uint32_t v1 =
633110e230b6Smaya      __gen_uint(values->GeneralStateBaseAddressModifyEnable, 0, 0) |
633210e230b6Smaya      __gen_uint(values->StatelessDataPortAccessForceWriteThru, 3, 3) |
633310e230b6Smaya      __gen_uint(values->StatelessDataPortAccessMOCS, 4, 7) |
633410e230b6Smaya      __gen_uint(values->GeneralStateMOCS, 8, 11);
633596c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->GeneralStateBaseAddress, v1, 12, 31);
633610e230b6Smaya
633710e230b6Smaya   const uint32_t v2 =
633810e230b6Smaya      __gen_uint(values->SurfaceStateBaseAddressModifyEnable, 0, 0) |
633910e230b6Smaya      __gen_uint(values->SurfaceStateMOCS, 8, 11);
634096c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->SurfaceStateBaseAddress, v2, 12, 31);
634110e230b6Smaya
634210e230b6Smaya   const uint32_t v3 =
634310e230b6Smaya      __gen_uint(values->DynamicStateBaseAddressModifyEnable, 0, 0) |
634410e230b6Smaya      __gen_uint(values->DynamicStateMOCS, 8, 11);
634596c5ddc4Srjs   dw[3] = __gen_address(data, &dw[3], values->DynamicStateBaseAddress, v3, 12, 31);
634610e230b6Smaya
634710e230b6Smaya   const uint32_t v4 =
634810e230b6Smaya      __gen_uint(values->IndirectObjectBaseAddressModifyEnable, 0, 0) |
634910e230b6Smaya      __gen_uint(values->IndirectObjectMOCS, 8, 11);
635096c5ddc4Srjs   dw[4] = __gen_address(data, &dw[4], values->IndirectObjectBaseAddress, v4, 12, 31);
635110e230b6Smaya
635210e230b6Smaya   const uint32_t v5 =
635310e230b6Smaya      __gen_uint(values->InstructionBaseAddressModifyEnable, 0, 0) |
635410e230b6Smaya      __gen_uint(values->InstructionMOCS, 8, 11);
635596c5ddc4Srjs   dw[5] = __gen_address(data, &dw[5], values->InstructionBaseAddress, v5, 12, 31);
635610e230b6Smaya
635710e230b6Smaya   const uint32_t v6 =
635810e230b6Smaya      __gen_uint(values->GeneralStateAccessUpperBoundModifyEnable, 0, 0);
635996c5ddc4Srjs   dw[6] = __gen_address(data, &dw[6], values->GeneralStateAccessUpperBound, v6, 12, 31);
636010e230b6Smaya
636110e230b6Smaya   const uint32_t v7 =
636210e230b6Smaya      __gen_uint(values->DynamicStateAccessUpperBoundModifyEnable, 0, 0);
636396c5ddc4Srjs   dw[7] = __gen_address(data, &dw[7], values->DynamicStateAccessUpperBound, v7, 12, 31);
636410e230b6Smaya
636510e230b6Smaya   const uint32_t v8 =
636610e230b6Smaya      __gen_uint(values->IndirectObjectAccessUpperBoundModifyEnable, 0, 0);
636796c5ddc4Srjs   dw[8] = __gen_address(data, &dw[8], values->IndirectObjectAccessUpperBound, v8, 12, 31);
636810e230b6Smaya
636910e230b6Smaya   const uint32_t v9 =
637010e230b6Smaya      __gen_uint(values->InstructionAccessUpperBoundModifyEnable, 0, 0);
637196c5ddc4Srjs   dw[9] = __gen_address(data, &dw[9], values->InstructionAccessUpperBound, v9, 12, 31);
637210e230b6Smaya}
637310e230b6Smaya
637496c5ddc4Srjs#define GFX7_STATE_PREFETCH_length             2
637596c5ddc4Srjs#define GFX7_STATE_PREFETCH_length_bias        2
637696c5ddc4Srjs#define GFX7_STATE_PREFETCH_header              \
637710e230b6Smaya   .DWordLength                         =      0,  \
637810e230b6Smaya   ._3DCommandSubOpcode                 =      3,  \
637910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
638010e230b6Smaya   .CommandSubType                      =      0,  \
638110e230b6Smaya   .CommandType                         =      3
638210e230b6Smaya
638396c5ddc4Srjsstruct GFX7_STATE_PREFETCH {
638410e230b6Smaya   uint32_t                             DWordLength;
638510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
638610e230b6Smaya   uint32_t                             _3DCommandOpcode;
638710e230b6Smaya   uint32_t                             CommandSubType;
638810e230b6Smaya   uint32_t                             CommandType;
638910e230b6Smaya   uint32_t                             PrefetchCount;
639010e230b6Smaya   __gen_address_type                   PrefetchPointer;
639110e230b6Smaya};
639210e230b6Smaya
639396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
639496c5ddc4SrjsGFX7_STATE_PREFETCH_pack(__attribute__((unused)) __gen_user_data *data,
639510e230b6Smaya                         __attribute__((unused)) void * restrict dst,
639696c5ddc4Srjs                         __attribute__((unused)) const struct GFX7_STATE_PREFETCH * restrict values)
639710e230b6Smaya{
639810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
639910e230b6Smaya
640010e230b6Smaya   dw[0] =
640110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
640210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
640310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
640410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
640510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
640610e230b6Smaya
640710e230b6Smaya   const uint32_t v1 =
640810e230b6Smaya      __gen_uint(values->PrefetchCount, 0, 2);
640996c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->PrefetchPointer, v1, 6, 31);
641010e230b6Smaya}
641110e230b6Smaya
641296c5ddc4Srjs#define GFX7_STATE_SIP_length                  2
641396c5ddc4Srjs#define GFX7_STATE_SIP_length_bias             2
641496c5ddc4Srjs#define GFX7_STATE_SIP_header                   \
641510e230b6Smaya   .DWordLength                         =      0,  \
641610e230b6Smaya   ._3DCommandSubOpcode                 =      2,  \
641710e230b6Smaya   ._3DCommandOpcode                    =      1,  \
641810e230b6Smaya   .CommandSubType                      =      0,  \
641910e230b6Smaya   .CommandType                         =      3
642010e230b6Smaya
642196c5ddc4Srjsstruct GFX7_STATE_SIP {
642210e230b6Smaya   uint32_t                             DWordLength;
642310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
642410e230b6Smaya   uint32_t                             _3DCommandOpcode;
642510e230b6Smaya   uint32_t                             CommandSubType;
642610e230b6Smaya   uint32_t                             CommandType;
642710e230b6Smaya   uint64_t                             SystemInstructionPointer;
642810e230b6Smaya};
642910e230b6Smaya
643096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
643196c5ddc4SrjsGFX7_STATE_SIP_pack(__attribute__((unused)) __gen_user_data *data,
643210e230b6Smaya                    __attribute__((unused)) void * restrict dst,
643396c5ddc4Srjs                    __attribute__((unused)) const struct GFX7_STATE_SIP * restrict values)
643410e230b6Smaya{
643510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
643610e230b6Smaya
643710e230b6Smaya   dw[0] =
643810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
643910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
644010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
644110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
644210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
644310e230b6Smaya
644410e230b6Smaya   dw[1] =
644510e230b6Smaya      __gen_offset(values->SystemInstructionPointer, 4, 31);
644610e230b6Smaya}
644710e230b6Smaya
644896c5ddc4Srjs#define GFX7_SWTESS_BASE_ADDRESS_length        2
644996c5ddc4Srjs#define GFX7_SWTESS_BASE_ADDRESS_length_bias      2
645096c5ddc4Srjs#define GFX7_SWTESS_BASE_ADDRESS_header         \
645110e230b6Smaya   .DWordLength                         =      0,  \
645210e230b6Smaya   ._3DCommandSubOpcode                 =      3,  \
645310e230b6Smaya   ._3DCommandOpcode                    =      1,  \
645410e230b6Smaya   .CommandSubType                      =      0,  \
645510e230b6Smaya   .CommandType                         =      3
645610e230b6Smaya
645796c5ddc4Srjsstruct GFX7_SWTESS_BASE_ADDRESS {
645810e230b6Smaya   uint32_t                             DWordLength;
645910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
646010e230b6Smaya   uint32_t                             _3DCommandOpcode;
646110e230b6Smaya   uint32_t                             CommandSubType;
646210e230b6Smaya   uint32_t                             CommandType;
646310e230b6Smaya   uint32_t                             SWTessellationMOCS;
646410e230b6Smaya   __gen_address_type                   SWTessellationBaseAddress;
646510e230b6Smaya};
646610e230b6Smaya
646796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
646896c5ddc4SrjsGFX7_SWTESS_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
646910e230b6Smaya                              __attribute__((unused)) void * restrict dst,
647096c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_SWTESS_BASE_ADDRESS * restrict values)
647110e230b6Smaya{
647210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
647310e230b6Smaya
647410e230b6Smaya   dw[0] =
647510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
647610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
647710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
647810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
647910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
648010e230b6Smaya
648110e230b6Smaya   const uint32_t v1 =
648210e230b6Smaya      __gen_uint(values->SWTessellationMOCS, 8, 11);
648396c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->SWTessellationBaseAddress, v1, 12, 31);
648410e230b6Smaya}
648510e230b6Smaya
648696c5ddc4Srjs#define GFX7_BCS_FAULT_REG_num            0x4294
648796c5ddc4Srjs#define GFX7_BCS_FAULT_REG_length              1
648896c5ddc4Srjsstruct GFX7_BCS_FAULT_REG {
648910e230b6Smaya   bool                                 ValidBit;
649010e230b6Smaya   uint32_t                             FaultType;
649110e230b6Smaya#define PageFault                                0
649210e230b6Smaya#define InvalidPDFault                           1
649310e230b6Smaya#define UnloadedPDFault                          2
649410e230b6Smaya#define InvalidandUnloadedPDfault                3
649510e230b6Smaya   uint32_t                             SRCIDofFault;
649610e230b6Smaya   uint32_t                             GTTSEL;
649710e230b6Smaya#define PPGTT                                    0
649810e230b6Smaya#define GGTT                                     1
649910e230b6Smaya   __gen_address_type                   VirtualAddressofFault;
650010e230b6Smaya};
650110e230b6Smaya
650296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
650396c5ddc4SrjsGFX7_BCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
650410e230b6Smaya                        __attribute__((unused)) void * restrict dst,
650596c5ddc4Srjs                        __attribute__((unused)) const struct GFX7_BCS_FAULT_REG * restrict values)
650610e230b6Smaya{
650710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
650810e230b6Smaya
650910e230b6Smaya   const uint32_t v0 =
651010e230b6Smaya      __gen_uint(values->ValidBit, 0, 0) |
651110e230b6Smaya      __gen_uint(values->FaultType, 1, 2) |
651210e230b6Smaya      __gen_uint(values->SRCIDofFault, 3, 10) |
651310e230b6Smaya      __gen_uint(values->GTTSEL, 11, 11);
651496c5ddc4Srjs   dw[0] = __gen_address(data, &dw[0], values->VirtualAddressofFault, v0, 12, 31);
651510e230b6Smaya}
651610e230b6Smaya
651796c5ddc4Srjs#define GFX7_BCS_INSTDONE_num             0x2206c
651896c5ddc4Srjs#define GFX7_BCS_INSTDONE_length               1
651996c5ddc4Srjsstruct GFX7_BCS_INSTDONE {
652010e230b6Smaya   bool                                 RingEnable;
652110e230b6Smaya   bool                                 BlitterIDLE;
652210e230b6Smaya   bool                                 GABIDLE;
652310e230b6Smaya   bool                                 BCSDone;
652410e230b6Smaya};
652510e230b6Smaya
652696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
652796c5ddc4SrjsGFX7_BCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
652810e230b6Smaya                       __attribute__((unused)) void * restrict dst,
652996c5ddc4Srjs                       __attribute__((unused)) const struct GFX7_BCS_INSTDONE * restrict values)
653010e230b6Smaya{
653110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
653210e230b6Smaya
653310e230b6Smaya   dw[0] =
653410e230b6Smaya      __gen_uint(values->RingEnable, 0, 0) |
653510e230b6Smaya      __gen_uint(values->BlitterIDLE, 1, 1) |
653610e230b6Smaya      __gen_uint(values->GABIDLE, 2, 2) |
653710e230b6Smaya      __gen_uint(values->BCSDone, 3, 3);
653810e230b6Smaya}
653910e230b6Smaya
654096c5ddc4Srjs#define GFX7_BCS_RING_BUFFER_CTL_num      0x2203c
654196c5ddc4Srjs#define GFX7_BCS_RING_BUFFER_CTL_length        1
654296c5ddc4Srjsstruct GFX7_BCS_RING_BUFFER_CTL {
654310e230b6Smaya   bool                                 RingBufferEnable;
654410e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
654510e230b6Smaya#define MI_AUTOREPORT_OFF                        0
654610e230b6Smaya#define MI_AUTOREPORT_64KB                       1
654710e230b6Smaya#define MI_AUTOREPORT_4KB                        2
654810e230b6Smaya#define MI_AUTOREPORT_128KB                      3
654910e230b6Smaya   bool                                 DisableRegisterAccesses;
655010e230b6Smaya   bool                                 SemaphoreWait;
655110e230b6Smaya   bool                                 RBWait;
655210e230b6Smaya   uint32_t                             BufferLengthinpages1;
655310e230b6Smaya};
655410e230b6Smaya
655596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
655696c5ddc4SrjsGFX7_BCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
655710e230b6Smaya                              __attribute__((unused)) void * restrict dst,
655896c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_BCS_RING_BUFFER_CTL * restrict values)
655910e230b6Smaya{
656010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
656110e230b6Smaya
656210e230b6Smaya   dw[0] =
656310e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
656410e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
656510e230b6Smaya      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
656610e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
656710e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
656810e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
656910e230b6Smaya}
657010e230b6Smaya
657196c5ddc4Srjs#define GFX7_CL_INVOCATION_COUNT_num      0x2338
657296c5ddc4Srjs#define GFX7_CL_INVOCATION_COUNT_length        2
657396c5ddc4Srjsstruct GFX7_CL_INVOCATION_COUNT {
657410e230b6Smaya   uint64_t                             CLInvocationCountReport;
657510e230b6Smaya};
657610e230b6Smaya
657796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
657896c5ddc4SrjsGFX7_CL_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
657910e230b6Smaya                              __attribute__((unused)) void * restrict dst,
658096c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_CL_INVOCATION_COUNT * restrict values)
658110e230b6Smaya{
658210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
658310e230b6Smaya
658410e230b6Smaya   const uint64_t v0 =
658510e230b6Smaya      __gen_uint(values->CLInvocationCountReport, 0, 63);
658610e230b6Smaya   dw[0] = v0;
658710e230b6Smaya   dw[1] = v0 >> 32;
658810e230b6Smaya}
658910e230b6Smaya
659096c5ddc4Srjs#define GFX7_CL_PRIMITIVES_COUNT_num      0x2340
659196c5ddc4Srjs#define GFX7_CL_PRIMITIVES_COUNT_length        2
659296c5ddc4Srjsstruct GFX7_CL_PRIMITIVES_COUNT {
659310e230b6Smaya   uint64_t                             CLPrimitivesCountReport;
659410e230b6Smaya};
659510e230b6Smaya
659696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
659796c5ddc4SrjsGFX7_CL_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
659810e230b6Smaya                              __attribute__((unused)) void * restrict dst,
659996c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_CL_PRIMITIVES_COUNT * restrict values)
660010e230b6Smaya{
660110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
660210e230b6Smaya
660310e230b6Smaya   const uint64_t v0 =
660410e230b6Smaya      __gen_uint(values->CLPrimitivesCountReport, 0, 63);
660510e230b6Smaya   dw[0] = v0;
660610e230b6Smaya   dw[1] = v0 >> 32;
660710e230b6Smaya}
660810e230b6Smaya
660996c5ddc4Srjs#define GFX7_CS_INVOCATION_COUNT_num      0x2290
661096c5ddc4Srjs#define GFX7_CS_INVOCATION_COUNT_length        2
661196c5ddc4Srjsstruct GFX7_CS_INVOCATION_COUNT {
661210e230b6Smaya   uint64_t                             CSInvocationCountReport;
661310e230b6Smaya};
661410e230b6Smaya
661596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
661696c5ddc4SrjsGFX7_CS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
661710e230b6Smaya                              __attribute__((unused)) void * restrict dst,
661896c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_CS_INVOCATION_COUNT * restrict values)
661910e230b6Smaya{
662010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
662110e230b6Smaya
662210e230b6Smaya   const uint64_t v0 =
662310e230b6Smaya      __gen_uint(values->CSInvocationCountReport, 0, 63);
662410e230b6Smaya   dw[0] = v0;
662510e230b6Smaya   dw[1] = v0 >> 32;
662610e230b6Smaya}
662710e230b6Smaya
662896c5ddc4Srjs#define GFX7_DS_INVOCATION_COUNT_num      0x2308
662996c5ddc4Srjs#define GFX7_DS_INVOCATION_COUNT_length        2
663096c5ddc4Srjsstruct GFX7_DS_INVOCATION_COUNT {
663110e230b6Smaya   uint64_t                             DSInvocationCountReport;
663210e230b6Smaya};
663310e230b6Smaya
663496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
663596c5ddc4SrjsGFX7_DS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
663610e230b6Smaya                              __attribute__((unused)) void * restrict dst,
663796c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_DS_INVOCATION_COUNT * restrict values)
663810e230b6Smaya{
663910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
664010e230b6Smaya
664110e230b6Smaya   const uint64_t v0 =
664210e230b6Smaya      __gen_uint(values->DSInvocationCountReport, 0, 63);
664310e230b6Smaya   dw[0] = v0;
664410e230b6Smaya   dw[1] = v0 >> 32;
664510e230b6Smaya}
664610e230b6Smaya
664796c5ddc4Srjs#define GFX7_ERR_INT_num                  0x44040
664896c5ddc4Srjs#define GFX7_ERR_INT_length                    1
664996c5ddc4Srjsstruct GFX7_ERR_INT {
665010e230b6Smaya   bool                                 PrimaryAGTTFaultStatus;
665110e230b6Smaya   bool                                 PrimaryBGTTFaultStatus;
665210e230b6Smaya   bool                                 SpriteAGTTFaultStatus;
665310e230b6Smaya   bool                                 SpriteBGTTFaultStatus;
665410e230b6Smaya   bool                                 CursorAGTTFaultStatus;
665510e230b6Smaya   bool                                 CursorBGTTFaultStatus;
665610e230b6Smaya   bool                                 Invalidpagetableentrydata;
665710e230b6Smaya   bool                                 InvalidGTTpagetableentry;
665810e230b6Smaya};
665910e230b6Smaya
666096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
666196c5ddc4SrjsGFX7_ERR_INT_pack(__attribute__((unused)) __gen_user_data *data,
666210e230b6Smaya                  __attribute__((unused)) void * restrict dst,
666396c5ddc4Srjs                  __attribute__((unused)) const struct GFX7_ERR_INT * restrict values)
666410e230b6Smaya{
666510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
666610e230b6Smaya
666710e230b6Smaya   dw[0] =
666810e230b6Smaya      __gen_uint(values->PrimaryAGTTFaultStatus, 0, 0) |
666910e230b6Smaya      __gen_uint(values->PrimaryBGTTFaultStatus, 1, 1) |
667010e230b6Smaya      __gen_uint(values->SpriteAGTTFaultStatus, 2, 2) |
667110e230b6Smaya      __gen_uint(values->SpriteBGTTFaultStatus, 3, 3) |
667210e230b6Smaya      __gen_uint(values->CursorAGTTFaultStatus, 4, 4) |
667310e230b6Smaya      __gen_uint(values->CursorBGTTFaultStatus, 5, 5) |
667410e230b6Smaya      __gen_uint(values->Invalidpagetableentrydata, 6, 6) |
667510e230b6Smaya      __gen_uint(values->InvalidGTTpagetableentry, 7, 7);
667610e230b6Smaya}
667710e230b6Smaya
667896c5ddc4Srjs#define GFX7_GFX_ARB_ERROR_RPT_num        0x40a0
667996c5ddc4Srjs#define GFX7_GFX_ARB_ERROR_RPT_length          1
668096c5ddc4Srjsstruct GFX7_GFX_ARB_ERROR_RPT {
668110e230b6Smaya   bool                                 TLBPageFaultError;
668210e230b6Smaya   bool                                 ContextPageFaultError;
668310e230b6Smaya   bool                                 InvalidPageDirectoryentryerror;
668410e230b6Smaya   bool                                 HardwareStatusPageFaultError;
668510e230b6Smaya   bool                                 TLBPageVTDTranslationError;
668610e230b6Smaya   bool                                 ContextPageVTDTranslationError;
668710e230b6Smaya   bool                                 PageDirectoryEntryVTDTranslationError;
668810e230b6Smaya   bool                                 HardwareStatusPageVTDTranslationError;
668910e230b6Smaya   bool                                 UnloadedPDError;
669010e230b6Smaya};
669110e230b6Smaya
669296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
669396c5ddc4SrjsGFX7_GFX_ARB_ERROR_RPT_pack(__attribute__((unused)) __gen_user_data *data,
669410e230b6Smaya                            __attribute__((unused)) void * restrict dst,
669596c5ddc4Srjs                            __attribute__((unused)) const struct GFX7_GFX_ARB_ERROR_RPT * restrict values)
669610e230b6Smaya{
669710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
669810e230b6Smaya
669910e230b6Smaya   dw[0] =
670010e230b6Smaya      __gen_uint(values->TLBPageFaultError, 0, 0) |
670110e230b6Smaya      __gen_uint(values->ContextPageFaultError, 1, 1) |
670210e230b6Smaya      __gen_uint(values->InvalidPageDirectoryentryerror, 2, 2) |
670310e230b6Smaya      __gen_uint(values->HardwareStatusPageFaultError, 3, 3) |
670410e230b6Smaya      __gen_uint(values->TLBPageVTDTranslationError, 4, 4) |
670510e230b6Smaya      __gen_uint(values->ContextPageVTDTranslationError, 5, 5) |
670610e230b6Smaya      __gen_uint(values->PageDirectoryEntryVTDTranslationError, 6, 6) |
670710e230b6Smaya      __gen_uint(values->HardwareStatusPageVTDTranslationError, 7, 7) |
670810e230b6Smaya      __gen_uint(values->UnloadedPDError, 8, 8);
670910e230b6Smaya}
671010e230b6Smaya
671196c5ddc4Srjs#define GFX7_GS_INVOCATION_COUNT_num      0x2328
671296c5ddc4Srjs#define GFX7_GS_INVOCATION_COUNT_length        2
671396c5ddc4Srjsstruct GFX7_GS_INVOCATION_COUNT {
671410e230b6Smaya   uint64_t                             GSInvocationCountReport;
671510e230b6Smaya};
671610e230b6Smaya
671796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
671896c5ddc4SrjsGFX7_GS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
671910e230b6Smaya                              __attribute__((unused)) void * restrict dst,
672096c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_GS_INVOCATION_COUNT * restrict values)
672110e230b6Smaya{
672210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
672310e230b6Smaya
672410e230b6Smaya   const uint64_t v0 =
672510e230b6Smaya      __gen_uint(values->GSInvocationCountReport, 0, 63);
672610e230b6Smaya   dw[0] = v0;
672710e230b6Smaya   dw[1] = v0 >> 32;
672810e230b6Smaya}
672910e230b6Smaya
673096c5ddc4Srjs#define GFX7_GS_PRIMITIVES_COUNT_num      0x2330
673196c5ddc4Srjs#define GFX7_GS_PRIMITIVES_COUNT_length        2
673296c5ddc4Srjsstruct GFX7_GS_PRIMITIVES_COUNT {
673310e230b6Smaya   uint64_t                             GSPrimitivesCountReport;
673410e230b6Smaya};
673510e230b6Smaya
673696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
673796c5ddc4SrjsGFX7_GS_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
673810e230b6Smaya                              __attribute__((unused)) void * restrict dst,
673996c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_GS_PRIMITIVES_COUNT * restrict values)
674010e230b6Smaya{
674110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
674210e230b6Smaya
674310e230b6Smaya   const uint64_t v0 =
674410e230b6Smaya      __gen_uint(values->GSPrimitivesCountReport, 0, 63);
674510e230b6Smaya   dw[0] = v0;
674610e230b6Smaya   dw[1] = v0 >> 32;
674710e230b6Smaya}
674810e230b6Smaya
674996c5ddc4Srjs#define GFX7_HS_INVOCATION_COUNT_num      0x2300
675096c5ddc4Srjs#define GFX7_HS_INVOCATION_COUNT_length        2
675196c5ddc4Srjsstruct GFX7_HS_INVOCATION_COUNT {
675210e230b6Smaya   uint64_t                             HSInvocationCountReport;
675310e230b6Smaya};
675410e230b6Smaya
675596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
675696c5ddc4SrjsGFX7_HS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
675710e230b6Smaya                              __attribute__((unused)) void * restrict dst,
675896c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_HS_INVOCATION_COUNT * restrict values)
675910e230b6Smaya{
676010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
676110e230b6Smaya
676210e230b6Smaya   const uint64_t v0 =
676310e230b6Smaya      __gen_uint(values->HSInvocationCountReport, 0, 63);
676410e230b6Smaya   dw[0] = v0;
676510e230b6Smaya   dw[1] = v0 >> 32;
676610e230b6Smaya}
676710e230b6Smaya
676896c5ddc4Srjs#define GFX7_IA_PRIMITIVES_COUNT_num      0x2318
676996c5ddc4Srjs#define GFX7_IA_PRIMITIVES_COUNT_length        2
677096c5ddc4Srjsstruct GFX7_IA_PRIMITIVES_COUNT {
677110e230b6Smaya   uint64_t                             IAPrimitivesCountReport;
677210e230b6Smaya};
677310e230b6Smaya
677496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
677596c5ddc4SrjsGFX7_IA_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
677610e230b6Smaya                              __attribute__((unused)) void * restrict dst,
677796c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_IA_PRIMITIVES_COUNT * restrict values)
677810e230b6Smaya{
677910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
678010e230b6Smaya
678110e230b6Smaya   const uint64_t v0 =
678210e230b6Smaya      __gen_uint(values->IAPrimitivesCountReport, 0, 63);
678310e230b6Smaya   dw[0] = v0;
678410e230b6Smaya   dw[1] = v0 >> 32;
678510e230b6Smaya}
678610e230b6Smaya
678796c5ddc4Srjs#define GFX7_IA_VERTICES_COUNT_num        0x2310
678896c5ddc4Srjs#define GFX7_IA_VERTICES_COUNT_length          2
678996c5ddc4Srjsstruct GFX7_IA_VERTICES_COUNT {
679010e230b6Smaya   uint64_t                             IAVerticesCountReport;
679110e230b6Smaya};
679210e230b6Smaya
679396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
679496c5ddc4SrjsGFX7_IA_VERTICES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
679510e230b6Smaya                            __attribute__((unused)) void * restrict dst,
679696c5ddc4Srjs                            __attribute__((unused)) const struct GFX7_IA_VERTICES_COUNT * restrict values)
679710e230b6Smaya{
679810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
679910e230b6Smaya
680010e230b6Smaya   const uint64_t v0 =
680110e230b6Smaya      __gen_uint(values->IAVerticesCountReport, 0, 63);
680210e230b6Smaya   dw[0] = v0;
680310e230b6Smaya   dw[1] = v0 >> 32;
680410e230b6Smaya}
680510e230b6Smaya
680696c5ddc4Srjs#define GFX7_INSTDONE_1_num               0x206c
680796c5ddc4Srjs#define GFX7_INSTDONE_1_length                 1
680896c5ddc4Srjsstruct GFX7_INSTDONE_1 {
680910e230b6Smaya   bool                                 PRB0RingEnable;
681010e230b6Smaya   bool                                 VFGDone;
681110e230b6Smaya   bool                                 VSDone;
681210e230b6Smaya   bool                                 HSDone;
681310e230b6Smaya   bool                                 TEDone;
681410e230b6Smaya   bool                                 DSDone;
681510e230b6Smaya   bool                                 GSDone;
681610e230b6Smaya   bool                                 SOLDone;
681710e230b6Smaya   bool                                 CLDone;
681810e230b6Smaya   bool                                 SFDone;
681910e230b6Smaya   bool                                 TDGDone;
682010e230b6Smaya   bool                                 URBMDone;
682110e230b6Smaya   bool                                 SVGDone;
682210e230b6Smaya   bool                                 GAFSDone;
682310e230b6Smaya   bool                                 VFEDone;
682410e230b6Smaya   bool                                 TSGDone;
682510e230b6Smaya   bool                                 GAFMDone;
682610e230b6Smaya   bool                                 GAMDone;
682710e230b6Smaya   bool                                 SDEDone;
682810e230b6Smaya   bool                                 RCCFBCCSDone;
682910e230b6Smaya};
683010e230b6Smaya
683196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
683296c5ddc4SrjsGFX7_INSTDONE_1_pack(__attribute__((unused)) __gen_user_data *data,
683310e230b6Smaya                     __attribute__((unused)) void * restrict dst,
683496c5ddc4Srjs                     __attribute__((unused)) const struct GFX7_INSTDONE_1 * restrict values)
683510e230b6Smaya{
683610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
683710e230b6Smaya
683810e230b6Smaya   dw[0] =
683910e230b6Smaya      __gen_uint(values->PRB0RingEnable, 0, 0) |
684010e230b6Smaya      __gen_uint(values->VFGDone, 1, 1) |
684110e230b6Smaya      __gen_uint(values->VSDone, 2, 2) |
684210e230b6Smaya      __gen_uint(values->HSDone, 3, 3) |
684310e230b6Smaya      __gen_uint(values->TEDone, 4, 4) |
684410e230b6Smaya      __gen_uint(values->DSDone, 5, 5) |
684510e230b6Smaya      __gen_uint(values->GSDone, 6, 6) |
684610e230b6Smaya      __gen_uint(values->SOLDone, 7, 7) |
684710e230b6Smaya      __gen_uint(values->CLDone, 8, 8) |
684810e230b6Smaya      __gen_uint(values->SFDone, 9, 9) |
684910e230b6Smaya      __gen_uint(values->TDGDone, 12, 12) |
685010e230b6Smaya      __gen_uint(values->URBMDone, 13, 13) |
685110e230b6Smaya      __gen_uint(values->SVGDone, 14, 14) |
685210e230b6Smaya      __gen_uint(values->GAFSDone, 15, 15) |
685310e230b6Smaya      __gen_uint(values->VFEDone, 16, 16) |
685410e230b6Smaya      __gen_uint(values->TSGDone, 17, 17) |
685510e230b6Smaya      __gen_uint(values->GAFMDone, 18, 18) |
685610e230b6Smaya      __gen_uint(values->GAMDone, 19, 19) |
685710e230b6Smaya      __gen_uint(values->SDEDone, 22, 22) |
685810e230b6Smaya      __gen_uint(values->RCCFBCCSDone, 23, 23);
685910e230b6Smaya}
686010e230b6Smaya
686196c5ddc4Srjs#define GFX7_INSTPM_num                   0x20c0
686296c5ddc4Srjs#define GFX7_INSTPM_length                     1
686396c5ddc4Srjsstruct GFX7_INSTPM {
686410e230b6Smaya   bool                                 _3DStateInstructionDisable;
686510e230b6Smaya   bool                                 _3DRenderingInstructionDisable;
686610e230b6Smaya   bool                                 MediaInstructionDisable;
686710e230b6Smaya   bool                                 CONSTANT_BUFFERAddressOffsetDisable;
686810e230b6Smaya   bool                                 _3DStateInstructionDisableMask;
686910e230b6Smaya   bool                                 _3DRenderingInstructionDisableMask;
687010e230b6Smaya   bool                                 MediaInstructionDisableMask;
687110e230b6Smaya   bool                                 CONSTANT_BUFFERAddressOffsetDisableMask;
687210e230b6Smaya};
687310e230b6Smaya
687496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
687596c5ddc4SrjsGFX7_INSTPM_pack(__attribute__((unused)) __gen_user_data *data,
687610e230b6Smaya                 __attribute__((unused)) void * restrict dst,
687796c5ddc4Srjs                 __attribute__((unused)) const struct GFX7_INSTPM * restrict values)
687810e230b6Smaya{
687910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
688010e230b6Smaya
688110e230b6Smaya   dw[0] =
688210e230b6Smaya      __gen_uint(values->_3DStateInstructionDisable, 1, 1) |
688310e230b6Smaya      __gen_uint(values->_3DRenderingInstructionDisable, 2, 2) |
688410e230b6Smaya      __gen_uint(values->MediaInstructionDisable, 3, 3) |
688510e230b6Smaya      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisable, 6, 6) |
688610e230b6Smaya      __gen_uint(values->_3DStateInstructionDisableMask, 17, 17) |
688710e230b6Smaya      __gen_uint(values->_3DRenderingInstructionDisableMask, 18, 18) |
688810e230b6Smaya      __gen_uint(values->MediaInstructionDisableMask, 19, 19) |
688910e230b6Smaya      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisableMask, 22, 22);
689010e230b6Smaya}
689110e230b6Smaya
689296c5ddc4Srjs#define GFX7_L3CNTLREG2_num               0xb020
689396c5ddc4Srjs#define GFX7_L3CNTLREG2_length                 1
689496c5ddc4Srjsstruct GFX7_L3CNTLREG2 {
689596c5ddc4Srjs   bool                                 SLMEnable;
689610e230b6Smaya   uint32_t                             URBAllocation;
689796c5ddc4Srjs   bool                                 URBLowBandwidth;
689810e230b6Smaya   uint32_t                             ALLAllocation;
689910e230b6Smaya   uint32_t                             ROAllocation;
690096c5ddc4Srjs   bool                                 ROLowBandwidth;
690110e230b6Smaya   uint32_t                             DCAllocation;
690296c5ddc4Srjs   bool                                 DCLowBandwidth;
690310e230b6Smaya};
690410e230b6Smaya
690596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
690696c5ddc4SrjsGFX7_L3CNTLREG2_pack(__attribute__((unused)) __gen_user_data *data,
690710e230b6Smaya                     __attribute__((unused)) void * restrict dst,
690896c5ddc4Srjs                     __attribute__((unused)) const struct GFX7_L3CNTLREG2 * restrict values)
690910e230b6Smaya{
691010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
691110e230b6Smaya
691210e230b6Smaya   dw[0] =
691310e230b6Smaya      __gen_uint(values->SLMEnable, 0, 0) |
691410e230b6Smaya      __gen_uint(values->URBAllocation, 1, 6) |
691510e230b6Smaya      __gen_uint(values->URBLowBandwidth, 7, 7) |
691610e230b6Smaya      __gen_uint(values->ALLAllocation, 8, 13) |
691710e230b6Smaya      __gen_uint(values->ROAllocation, 14, 19) |
691810e230b6Smaya      __gen_uint(values->ROLowBandwidth, 20, 20) |
691910e230b6Smaya      __gen_uint(values->DCAllocation, 21, 26) |
692010e230b6Smaya      __gen_uint(values->DCLowBandwidth, 27, 27);
692110e230b6Smaya}
692210e230b6Smaya
692396c5ddc4Srjs#define GFX7_L3CNTLREG3_num               0xb024
692496c5ddc4Srjs#define GFX7_L3CNTLREG3_length                 1
692596c5ddc4Srjsstruct GFX7_L3CNTLREG3 {
692610e230b6Smaya   uint32_t                             ISAllocation;
692796c5ddc4Srjs   bool                                 ISLowBandwidth;
692810e230b6Smaya   uint32_t                             CAllocation;
692996c5ddc4Srjs   bool                                 CLowBandwidth;
693010e230b6Smaya   uint32_t                             TAllocation;
693196c5ddc4Srjs   bool                                 TLowBandwidth;
693210e230b6Smaya};
693310e230b6Smaya
693496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
693596c5ddc4SrjsGFX7_L3CNTLREG3_pack(__attribute__((unused)) __gen_user_data *data,
693610e230b6Smaya                     __attribute__((unused)) void * restrict dst,
693796c5ddc4Srjs                     __attribute__((unused)) const struct GFX7_L3CNTLREG3 * restrict values)
693810e230b6Smaya{
693910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
694010e230b6Smaya
694110e230b6Smaya   dw[0] =
694210e230b6Smaya      __gen_uint(values->ISAllocation, 1, 6) |
694310e230b6Smaya      __gen_uint(values->ISLowBandwidth, 7, 7) |
694410e230b6Smaya      __gen_uint(values->CAllocation, 8, 13) |
694510e230b6Smaya      __gen_uint(values->CLowBandwidth, 14, 14) |
694610e230b6Smaya      __gen_uint(values->TAllocation, 15, 20) |
694710e230b6Smaya      __gen_uint(values->TLowBandwidth, 21, 21);
694810e230b6Smaya}
694910e230b6Smaya
695096c5ddc4Srjs#define GFX7_L3SQCREG1_num                0xb010
695196c5ddc4Srjs#define GFX7_L3SQCREG1_length                  1
695296c5ddc4Srjsstruct GFX7_L3SQCREG1 {
695396c5ddc4Srjs   uint32_t                             L3SQGeneralPriorityCreditInitialization;
695496c5ddc4Srjs#define SQGPCI_DEFAULT                           7
695596c5ddc4Srjs#define BYT_SQGPCI_DEFAULT                       13
695696c5ddc4Srjs   uint32_t                             L3SQHighPriorityCreditInitialization;
695796c5ddc4Srjs#define SQHPCI_DEFAULT                           3
695896c5ddc4Srjs   bool                                 ConvertDC_UC;
695996c5ddc4Srjs   bool                                 ConvertIS_UC;
696096c5ddc4Srjs   bool                                 ConvertC_UC;
696196c5ddc4Srjs   bool                                 ConvertT_UC;
696210e230b6Smaya};
696310e230b6Smaya
696496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
696596c5ddc4SrjsGFX7_L3SQCREG1_pack(__attribute__((unused)) __gen_user_data *data,
696610e230b6Smaya                    __attribute__((unused)) void * restrict dst,
696796c5ddc4Srjs                    __attribute__((unused)) const struct GFX7_L3SQCREG1 * restrict values)
696810e230b6Smaya{
696910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
697010e230b6Smaya
697110e230b6Smaya   dw[0] =
697296c5ddc4Srjs      __gen_uint(values->L3SQGeneralPriorityCreditInitialization, 20, 23) |
697396c5ddc4Srjs      __gen_uint(values->L3SQHighPriorityCreditInitialization, 16, 19) |
697410e230b6Smaya      __gen_uint(values->ConvertDC_UC, 24, 24) |
697510e230b6Smaya      __gen_uint(values->ConvertIS_UC, 25, 25) |
697610e230b6Smaya      __gen_uint(values->ConvertC_UC, 26, 26) |
697710e230b6Smaya      __gen_uint(values->ConvertT_UC, 27, 27);
697810e230b6Smaya}
697910e230b6Smaya
698096c5ddc4Srjs#define GFX7_PS_INVOCATION_COUNT_num      0x2348
698196c5ddc4Srjs#define GFX7_PS_INVOCATION_COUNT_length        2
698296c5ddc4Srjsstruct GFX7_PS_INVOCATION_COUNT {
698310e230b6Smaya   uint64_t                             PSInvocationCountReport;
698410e230b6Smaya};
698510e230b6Smaya
698696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
698796c5ddc4SrjsGFX7_PS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
698810e230b6Smaya                              __attribute__((unused)) void * restrict dst,
698996c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_PS_INVOCATION_COUNT * restrict values)
699010e230b6Smaya{
699110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
699210e230b6Smaya
699310e230b6Smaya   const uint64_t v0 =
699410e230b6Smaya      __gen_uint(values->PSInvocationCountReport, 0, 63);
699510e230b6Smaya   dw[0] = v0;
699610e230b6Smaya   dw[1] = v0 >> 32;
699710e230b6Smaya}
699810e230b6Smaya
699996c5ddc4Srjs#define GFX7_RCS_FAULT_REG_num            0x4094
700096c5ddc4Srjs#define GFX7_RCS_FAULT_REG_length              1
700196c5ddc4Srjsstruct GFX7_RCS_FAULT_REG {
700210e230b6Smaya   bool                                 ValidBit;
700310e230b6Smaya   uint32_t                             FaultType;
700410e230b6Smaya#define PageFault                                0
700510e230b6Smaya#define InvalidPDFault                           1
700610e230b6Smaya#define UnloadedPDFault                          2
700710e230b6Smaya#define InvalidandUnloadedPDfault                3
700810e230b6Smaya   uint32_t                             SRCIDofFault;
700910e230b6Smaya   uint32_t                             GTTSEL;
701010e230b6Smaya#define PPGTT                                    0
701110e230b6Smaya#define GGTT                                     1
701210e230b6Smaya   __gen_address_type                   VirtualAddressofFault;
701310e230b6Smaya};
701410e230b6Smaya
701596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
701696c5ddc4SrjsGFX7_RCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
701710e230b6Smaya                        __attribute__((unused)) void * restrict dst,
701896c5ddc4Srjs                        __attribute__((unused)) const struct GFX7_RCS_FAULT_REG * restrict values)
701910e230b6Smaya{
702010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
702110e230b6Smaya
702210e230b6Smaya   const uint32_t v0 =
702310e230b6Smaya      __gen_uint(values->ValidBit, 0, 0) |
702410e230b6Smaya      __gen_uint(values->FaultType, 1, 2) |
702510e230b6Smaya      __gen_uint(values->SRCIDofFault, 3, 10) |
702610e230b6Smaya      __gen_uint(values->GTTSEL, 11, 11);
702796c5ddc4Srjs   dw[0] = __gen_address(data, &dw[0], values->VirtualAddressofFault, v0, 12, 31);
702810e230b6Smaya}
702910e230b6Smaya
703096c5ddc4Srjs#define GFX7_RCS_RING_BUFFER_CTL_num      0x203c
703196c5ddc4Srjs#define GFX7_RCS_RING_BUFFER_CTL_length        1
703296c5ddc4Srjsstruct GFX7_RCS_RING_BUFFER_CTL {
703310e230b6Smaya   bool                                 RingBufferEnable;
703410e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
703510e230b6Smaya#define MI_AUTOREPORT_OFF                        0
703610e230b6Smaya#define MI_AUTOREPORT_64KBMI_AUTOREPORT_4KB      1
703710e230b6Smaya#define MI_AUTOREPORT_128KB                      3
703810e230b6Smaya   bool                                 SemaphoreWait;
703910e230b6Smaya   bool                                 RBWait;
704010e230b6Smaya   uint32_t                             BufferLengthinpages1;
704110e230b6Smaya};
704210e230b6Smaya
704396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
704496c5ddc4SrjsGFX7_RCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
704510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
704696c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_RCS_RING_BUFFER_CTL * restrict values)
704710e230b6Smaya{
704810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
704910e230b6Smaya
705010e230b6Smaya   dw[0] =
705110e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
705210e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
705310e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
705410e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
705510e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
705610e230b6Smaya}
705710e230b6Smaya
705896c5ddc4Srjs#define GFX7_ROW_INSTDONE_num             0xe164
705996c5ddc4Srjs#define GFX7_ROW_INSTDONE_length               1
706096c5ddc4Srjsstruct GFX7_ROW_INSTDONE {
706110e230b6Smaya   bool                                 BCDone;
706210e230b6Smaya   bool                                 PSDDone;
706310e230b6Smaya   bool                                 DCDone;
706410e230b6Smaya   bool                                 DAPRDone;
706510e230b6Smaya   bool                                 TDLDone;
706610e230b6Smaya   bool                                 GWDone;
706710e230b6Smaya   bool                                 ICDone;
706810e230b6Smaya   bool                                 EU00DoneSS0;
706910e230b6Smaya   bool                                 EU01DoneSS0;
707010e230b6Smaya   bool                                 EU02DoneSS0;
707110e230b6Smaya   bool                                 EU03DoneSS0;
707210e230b6Smaya   bool                                 MA0DoneSS0;
707310e230b6Smaya   bool                                 EU10DoneSS0;
707410e230b6Smaya   bool                                 EU11DoneSS0;
707510e230b6Smaya   bool                                 EU12DoneSS0;
707610e230b6Smaya   bool                                 EU13DoneSS0;
707710e230b6Smaya   bool                                 MA1Done;
707810e230b6Smaya};
707910e230b6Smaya
708096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
708196c5ddc4SrjsGFX7_ROW_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
708210e230b6Smaya                       __attribute__((unused)) void * restrict dst,
708396c5ddc4Srjs                       __attribute__((unused)) const struct GFX7_ROW_INSTDONE * restrict values)
708410e230b6Smaya{
708510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
708610e230b6Smaya
708710e230b6Smaya   dw[0] =
708810e230b6Smaya      __gen_uint(values->BCDone, 0, 0) |
708910e230b6Smaya      __gen_uint(values->PSDDone, 1, 1) |
709010e230b6Smaya      __gen_uint(values->DCDone, 2, 2) |
709110e230b6Smaya      __gen_uint(values->DAPRDone, 3, 3) |
709210e230b6Smaya      __gen_uint(values->TDLDone, 6, 6) |
709310e230b6Smaya      __gen_uint(values->GWDone, 8, 8) |
709410e230b6Smaya      __gen_uint(values->ICDone, 12, 12) |
709510e230b6Smaya      __gen_uint(values->EU00DoneSS0, 16, 16) |
709610e230b6Smaya      __gen_uint(values->EU01DoneSS0, 17, 17) |
709710e230b6Smaya      __gen_uint(values->EU02DoneSS0, 18, 18) |
709810e230b6Smaya      __gen_uint(values->EU03DoneSS0, 19, 19) |
709910e230b6Smaya      __gen_uint(values->MA0DoneSS0, 20, 20) |
710010e230b6Smaya      __gen_uint(values->EU10DoneSS0, 21, 21) |
710110e230b6Smaya      __gen_uint(values->EU11DoneSS0, 22, 22) |
710210e230b6Smaya      __gen_uint(values->EU12DoneSS0, 23, 23) |
710310e230b6Smaya      __gen_uint(values->EU13DoneSS0, 24, 24) |
710410e230b6Smaya      __gen_uint(values->MA1Done, 25, 25);
710510e230b6Smaya}
710610e230b6Smaya
710796c5ddc4Srjs#define GFX7_RPSTAT1_num                  0xa01c
710896c5ddc4Srjs#define GFX7_RPSTAT1_length                    1
710996c5ddc4Srjsstruct GFX7_RPSTAT1 {
711096c5ddc4Srjs   uint32_t                             PreviousGTFrequency;
711196c5ddc4Srjs   uint32_t                             CurrentGTFrequency;
711296c5ddc4Srjs};
711396c5ddc4Srjs
711496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
711596c5ddc4SrjsGFX7_RPSTAT1_pack(__attribute__((unused)) __gen_user_data *data,
711696c5ddc4Srjs                  __attribute__((unused)) void * restrict dst,
711796c5ddc4Srjs                  __attribute__((unused)) const struct GFX7_RPSTAT1 * restrict values)
711896c5ddc4Srjs{
711996c5ddc4Srjs   uint32_t * restrict dw = (uint32_t * restrict) dst;
712096c5ddc4Srjs
712196c5ddc4Srjs   dw[0] =
712296c5ddc4Srjs      __gen_uint(values->PreviousGTFrequency, 0, 6) |
712396c5ddc4Srjs      __gen_uint(values->CurrentGTFrequency, 7, 14);
712496c5ddc4Srjs}
712596c5ddc4Srjs
712696c5ddc4Srjs#define GFX7_SAMPLER_INSTDONE_num         0xe160
712796c5ddc4Srjs#define GFX7_SAMPLER_INSTDONE_length           1
712896c5ddc4Srjsstruct GFX7_SAMPLER_INSTDONE {
712910e230b6Smaya   bool                                 VMEDone;
713010e230b6Smaya   bool                                 PL0Done;
713110e230b6Smaya   bool                                 SO0Done;
713210e230b6Smaya   bool                                 DG0Done;
713310e230b6Smaya   bool                                 FT0Done;
713410e230b6Smaya   bool                                 DM0Done;
713510e230b6Smaya   bool                                 SCDone;
713610e230b6Smaya   bool                                 FL0Done;
713710e230b6Smaya   bool                                 QCDone;
713810e230b6Smaya   bool                                 SVSMDone;
713910e230b6Smaya   bool                                 SI0Done;
714010e230b6Smaya   bool                                 MT0Done;
714110e230b6Smaya   bool                                 AVSDone;
714210e230b6Smaya   bool                                 IEFDone;
714310e230b6Smaya   bool                                 VDIDone;
714410e230b6Smaya   bool                                 SVSMARB3;
714510e230b6Smaya   bool                                 SVSMARB2;
714610e230b6Smaya   bool                                 SVSMARB1;
714710e230b6Smaya   bool                                 SVSMAdapter;
714810e230b6Smaya};
714910e230b6Smaya
715096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
715196c5ddc4SrjsGFX7_SAMPLER_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
715210e230b6Smaya                           __attribute__((unused)) void * restrict dst,
715396c5ddc4Srjs                           __attribute__((unused)) const struct GFX7_SAMPLER_INSTDONE * restrict values)
715410e230b6Smaya{
715510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
715610e230b6Smaya
715710e230b6Smaya   dw[0] =
715810e230b6Smaya      __gen_uint(values->VMEDone, 0, 0) |
715910e230b6Smaya      __gen_uint(values->PL0Done, 1, 1) |
716010e230b6Smaya      __gen_uint(values->SO0Done, 2, 2) |
716110e230b6Smaya      __gen_uint(values->DG0Done, 3, 3) |
716210e230b6Smaya      __gen_uint(values->FT0Done, 4, 4) |
716310e230b6Smaya      __gen_uint(values->DM0Done, 5, 5) |
716410e230b6Smaya      __gen_uint(values->SCDone, 6, 6) |
716510e230b6Smaya      __gen_uint(values->FL0Done, 7, 7) |
716610e230b6Smaya      __gen_uint(values->QCDone, 8, 8) |
716710e230b6Smaya      __gen_uint(values->SVSMDone, 9, 9) |
716810e230b6Smaya      __gen_uint(values->SI0Done, 10, 10) |
716910e230b6Smaya      __gen_uint(values->MT0Done, 11, 11) |
717010e230b6Smaya      __gen_uint(values->AVSDone, 12, 12) |
717110e230b6Smaya      __gen_uint(values->IEFDone, 13, 13) |
717210e230b6Smaya      __gen_uint(values->VDIDone, 14, 14) |
717310e230b6Smaya      __gen_uint(values->SVSMARB3, 15, 15) |
717410e230b6Smaya      __gen_uint(values->SVSMARB2, 16, 16) |
717510e230b6Smaya      __gen_uint(values->SVSMARB1, 17, 17) |
717610e230b6Smaya      __gen_uint(values->SVSMAdapter, 18, 18);
717710e230b6Smaya}
717810e230b6Smaya
717996c5ddc4Srjs#define GFX7_SC_INSTDONE_num              0x7100
718096c5ddc4Srjs#define GFX7_SC_INSTDONE_length                1
718196c5ddc4Srjsstruct GFX7_SC_INSTDONE {
718210e230b6Smaya   bool                                 SVLDone;
718310e230b6Smaya   bool                                 WMFEDone;
718410e230b6Smaya   bool                                 WMBEDone;
718510e230b6Smaya   bool                                 HIZDone;
718610e230b6Smaya   bool                                 STCDone;
718710e230b6Smaya   bool                                 IZDone;
718810e230b6Smaya   bool                                 SBEDone;
718910e230b6Smaya   bool                                 RCZDone;
719010e230b6Smaya   bool                                 RCCDone;
719110e230b6Smaya   bool                                 RCPBEDone;
719210e230b6Smaya   bool                                 RCPFEDone;
719310e230b6Smaya   bool                                 DAPBDone;
719410e230b6Smaya   bool                                 DAPRBEDone;
719510e230b6Smaya   bool                                 IECPDone;
719610e230b6Smaya   bool                                 SARBDone;
719710e230b6Smaya   bool                                 VSCDone;
719810e230b6Smaya};
719910e230b6Smaya
720096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
720196c5ddc4SrjsGFX7_SC_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
720210e230b6Smaya                      __attribute__((unused)) void * restrict dst,
720396c5ddc4Srjs                      __attribute__((unused)) const struct GFX7_SC_INSTDONE * restrict values)
720410e230b6Smaya{
720510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
720610e230b6Smaya
720710e230b6Smaya   dw[0] =
720810e230b6Smaya      __gen_uint(values->SVLDone, 0, 0) |
720910e230b6Smaya      __gen_uint(values->WMFEDone, 1, 1) |
721010e230b6Smaya      __gen_uint(values->WMBEDone, 2, 2) |
721110e230b6Smaya      __gen_uint(values->HIZDone, 3, 3) |
721210e230b6Smaya      __gen_uint(values->STCDone, 4, 4) |
721310e230b6Smaya      __gen_uint(values->IZDone, 5, 5) |
721410e230b6Smaya      __gen_uint(values->SBEDone, 6, 6) |
721510e230b6Smaya      __gen_uint(values->RCZDone, 8, 8) |
721610e230b6Smaya      __gen_uint(values->RCCDone, 9, 9) |
721710e230b6Smaya      __gen_uint(values->RCPBEDone, 10, 10) |
721810e230b6Smaya      __gen_uint(values->RCPFEDone, 11, 11) |
721910e230b6Smaya      __gen_uint(values->DAPBDone, 12, 12) |
722010e230b6Smaya      __gen_uint(values->DAPRBEDone, 13, 13) |
722110e230b6Smaya      __gen_uint(values->IECPDone, 14, 14) |
722210e230b6Smaya      __gen_uint(values->SARBDone, 15, 15) |
722310e230b6Smaya      __gen_uint(values->VSCDone, 16, 16);
722410e230b6Smaya}
722510e230b6Smaya
722696c5ddc4Srjs#define GFX7_SO_NUM_PRIMS_WRITTEN0_num    0x5200
722796c5ddc4Srjs#define GFX7_SO_NUM_PRIMS_WRITTEN0_length      2
722896c5ddc4Srjsstruct GFX7_SO_NUM_PRIMS_WRITTEN0 {
722910e230b6Smaya   uint64_t                             NumPrimsWrittenCount;
723010e230b6Smaya};
723110e230b6Smaya
723296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
723396c5ddc4SrjsGFX7_SO_NUM_PRIMS_WRITTEN0_pack(__attribute__((unused)) __gen_user_data *data,
723410e230b6Smaya                                __attribute__((unused)) void * restrict dst,
723596c5ddc4Srjs                                __attribute__((unused)) const struct GFX7_SO_NUM_PRIMS_WRITTEN0 * restrict values)
723610e230b6Smaya{
723710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
723810e230b6Smaya
723910e230b6Smaya   const uint64_t v0 =
724010e230b6Smaya      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
724110e230b6Smaya   dw[0] = v0;
724210e230b6Smaya   dw[1] = v0 >> 32;
724310e230b6Smaya}
724410e230b6Smaya
724596c5ddc4Srjs#define GFX7_SO_NUM_PRIMS_WRITTEN1_num    0x5208
724696c5ddc4Srjs#define GFX7_SO_NUM_PRIMS_WRITTEN1_length      2
724796c5ddc4Srjsstruct GFX7_SO_NUM_PRIMS_WRITTEN1 {
724810e230b6Smaya   uint64_t                             NumPrimsWrittenCount;
724910e230b6Smaya};
725010e230b6Smaya
725196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
725296c5ddc4SrjsGFX7_SO_NUM_PRIMS_WRITTEN1_pack(__attribute__((unused)) __gen_user_data *data,
725310e230b6Smaya                                __attribute__((unused)) void * restrict dst,
725496c5ddc4Srjs                                __attribute__((unused)) const struct GFX7_SO_NUM_PRIMS_WRITTEN1 * restrict values)
725510e230b6Smaya{
725610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
725710e230b6Smaya
725810e230b6Smaya   const uint64_t v0 =
725910e230b6Smaya      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
726010e230b6Smaya   dw[0] = v0;
726110e230b6Smaya   dw[1] = v0 >> 32;
726210e230b6Smaya}
726310e230b6Smaya
726496c5ddc4Srjs#define GFX7_SO_NUM_PRIMS_WRITTEN2_num    0x5210
726596c5ddc4Srjs#define GFX7_SO_NUM_PRIMS_WRITTEN2_length      2
726696c5ddc4Srjsstruct GFX7_SO_NUM_PRIMS_WRITTEN2 {
726710e230b6Smaya   uint64_t                             NumPrimsWrittenCount;
726810e230b6Smaya};
726910e230b6Smaya
727096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
727196c5ddc4SrjsGFX7_SO_NUM_PRIMS_WRITTEN2_pack(__attribute__((unused)) __gen_user_data *data,
727210e230b6Smaya                                __attribute__((unused)) void * restrict dst,
727396c5ddc4Srjs                                __attribute__((unused)) const struct GFX7_SO_NUM_PRIMS_WRITTEN2 * restrict values)
727410e230b6Smaya{
727510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
727610e230b6Smaya
727710e230b6Smaya   const uint64_t v0 =
727810e230b6Smaya      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
727910e230b6Smaya   dw[0] = v0;
728010e230b6Smaya   dw[1] = v0 >> 32;
728110e230b6Smaya}
728210e230b6Smaya
728396c5ddc4Srjs#define GFX7_SO_NUM_PRIMS_WRITTEN3_num    0x5218
728496c5ddc4Srjs#define GFX7_SO_NUM_PRIMS_WRITTEN3_length      2
728596c5ddc4Srjsstruct GFX7_SO_NUM_PRIMS_WRITTEN3 {
728610e230b6Smaya   uint64_t                             NumPrimsWrittenCount;
728710e230b6Smaya};
728810e230b6Smaya
728996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
729096c5ddc4SrjsGFX7_SO_NUM_PRIMS_WRITTEN3_pack(__attribute__((unused)) __gen_user_data *data,
729110e230b6Smaya                                __attribute__((unused)) void * restrict dst,
729296c5ddc4Srjs                                __attribute__((unused)) const struct GFX7_SO_NUM_PRIMS_WRITTEN3 * restrict values)
729310e230b6Smaya{
729410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
729510e230b6Smaya
729610e230b6Smaya   const uint64_t v0 =
729710e230b6Smaya      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
729810e230b6Smaya   dw[0] = v0;
729910e230b6Smaya   dw[1] = v0 >> 32;
730010e230b6Smaya}
730110e230b6Smaya
730296c5ddc4Srjs#define GFX7_SO_PRIM_STORAGE_NEEDED0_num  0x5240
730396c5ddc4Srjs#define GFX7_SO_PRIM_STORAGE_NEEDED0_length      2
730496c5ddc4Srjsstruct GFX7_SO_PRIM_STORAGE_NEEDED0 {
730510e230b6Smaya   uint64_t                             PrimStorageNeededCount;
730610e230b6Smaya};
730710e230b6Smaya
730896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
730996c5ddc4SrjsGFX7_SO_PRIM_STORAGE_NEEDED0_pack(__attribute__((unused)) __gen_user_data *data,
731010e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
731196c5ddc4Srjs                                  __attribute__((unused)) const struct GFX7_SO_PRIM_STORAGE_NEEDED0 * restrict values)
731210e230b6Smaya{
731310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
731410e230b6Smaya
731510e230b6Smaya   const uint64_t v0 =
731610e230b6Smaya      __gen_uint(values->PrimStorageNeededCount, 0, 63);
731710e230b6Smaya   dw[0] = v0;
731810e230b6Smaya   dw[1] = v0 >> 32;
731910e230b6Smaya}
732010e230b6Smaya
732196c5ddc4Srjs#define GFX7_SO_PRIM_STORAGE_NEEDED1_num  0x5248
732296c5ddc4Srjs#define GFX7_SO_PRIM_STORAGE_NEEDED1_length      2
732396c5ddc4Srjsstruct GFX7_SO_PRIM_STORAGE_NEEDED1 {
732410e230b6Smaya   uint64_t                             PrimStorageNeededCount;
732510e230b6Smaya};
732610e230b6Smaya
732796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
732896c5ddc4SrjsGFX7_SO_PRIM_STORAGE_NEEDED1_pack(__attribute__((unused)) __gen_user_data *data,
732910e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
733096c5ddc4Srjs                                  __attribute__((unused)) const struct GFX7_SO_PRIM_STORAGE_NEEDED1 * restrict values)
733110e230b6Smaya{
733210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
733310e230b6Smaya
733410e230b6Smaya   const uint64_t v0 =
733510e230b6Smaya      __gen_uint(values->PrimStorageNeededCount, 0, 63);
733610e230b6Smaya   dw[0] = v0;
733710e230b6Smaya   dw[1] = v0 >> 32;
733810e230b6Smaya}
733910e230b6Smaya
734096c5ddc4Srjs#define GFX7_SO_PRIM_STORAGE_NEEDED2_num  0x5250
734196c5ddc4Srjs#define GFX7_SO_PRIM_STORAGE_NEEDED2_length      2
734296c5ddc4Srjsstruct GFX7_SO_PRIM_STORAGE_NEEDED2 {
734310e230b6Smaya   uint64_t                             PrimStorageNeededCount;
734410e230b6Smaya};
734510e230b6Smaya
734696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
734796c5ddc4SrjsGFX7_SO_PRIM_STORAGE_NEEDED2_pack(__attribute__((unused)) __gen_user_data *data,
734810e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
734996c5ddc4Srjs                                  __attribute__((unused)) const struct GFX7_SO_PRIM_STORAGE_NEEDED2 * restrict values)
735010e230b6Smaya{
735110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
735210e230b6Smaya
735310e230b6Smaya   const uint64_t v0 =
735410e230b6Smaya      __gen_uint(values->PrimStorageNeededCount, 0, 63);
735510e230b6Smaya   dw[0] = v0;
735610e230b6Smaya   dw[1] = v0 >> 32;
735710e230b6Smaya}
735810e230b6Smaya
735996c5ddc4Srjs#define GFX7_SO_PRIM_STORAGE_NEEDED3_num  0x5258
736096c5ddc4Srjs#define GFX7_SO_PRIM_STORAGE_NEEDED3_length      2
736196c5ddc4Srjsstruct GFX7_SO_PRIM_STORAGE_NEEDED3 {
736210e230b6Smaya   uint64_t                             PrimStorageNeededCount;
736310e230b6Smaya};
736410e230b6Smaya
736596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
736696c5ddc4SrjsGFX7_SO_PRIM_STORAGE_NEEDED3_pack(__attribute__((unused)) __gen_user_data *data,
736710e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
736896c5ddc4Srjs                                  __attribute__((unused)) const struct GFX7_SO_PRIM_STORAGE_NEEDED3 * restrict values)
736910e230b6Smaya{
737010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
737110e230b6Smaya
737210e230b6Smaya   const uint64_t v0 =
737310e230b6Smaya      __gen_uint(values->PrimStorageNeededCount, 0, 63);
737410e230b6Smaya   dw[0] = v0;
737510e230b6Smaya   dw[1] = v0 >> 32;
737610e230b6Smaya}
737710e230b6Smaya
737896c5ddc4Srjs#define GFX7_SO_WRITE_OFFSET0_num         0x5280
737996c5ddc4Srjs#define GFX7_SO_WRITE_OFFSET0_length           1
738096c5ddc4Srjsstruct GFX7_SO_WRITE_OFFSET0 {
738110e230b6Smaya   uint64_t                             WriteOffset;
738210e230b6Smaya};
738310e230b6Smaya
738496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
738596c5ddc4SrjsGFX7_SO_WRITE_OFFSET0_pack(__attribute__((unused)) __gen_user_data *data,
738610e230b6Smaya                           __attribute__((unused)) void * restrict dst,
738796c5ddc4Srjs                           __attribute__((unused)) const struct GFX7_SO_WRITE_OFFSET0 * restrict values)
738810e230b6Smaya{
738910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
739010e230b6Smaya
739110e230b6Smaya   dw[0] =
739210e230b6Smaya      __gen_offset(values->WriteOffset, 2, 31);
739310e230b6Smaya}
739410e230b6Smaya
739596c5ddc4Srjs#define GFX7_SO_WRITE_OFFSET1_num         0x5284
739696c5ddc4Srjs#define GFX7_SO_WRITE_OFFSET1_length           1
739796c5ddc4Srjsstruct GFX7_SO_WRITE_OFFSET1 {
739810e230b6Smaya   uint64_t                             WriteOffset;
739910e230b6Smaya};
740010e230b6Smaya
740196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
740296c5ddc4SrjsGFX7_SO_WRITE_OFFSET1_pack(__attribute__((unused)) __gen_user_data *data,
740310e230b6Smaya                           __attribute__((unused)) void * restrict dst,
740496c5ddc4Srjs                           __attribute__((unused)) const struct GFX7_SO_WRITE_OFFSET1 * restrict values)
740510e230b6Smaya{
740610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
740710e230b6Smaya
740810e230b6Smaya   dw[0] =
740910e230b6Smaya      __gen_offset(values->WriteOffset, 2, 31);
741010e230b6Smaya}
741110e230b6Smaya
741296c5ddc4Srjs#define GFX7_SO_WRITE_OFFSET2_num         0x5288
741396c5ddc4Srjs#define GFX7_SO_WRITE_OFFSET2_length           1
741496c5ddc4Srjsstruct GFX7_SO_WRITE_OFFSET2 {
741510e230b6Smaya   uint64_t                             WriteOffset;
741610e230b6Smaya};
741710e230b6Smaya
741896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
741996c5ddc4SrjsGFX7_SO_WRITE_OFFSET2_pack(__attribute__((unused)) __gen_user_data *data,
742010e230b6Smaya                           __attribute__((unused)) void * restrict dst,
742196c5ddc4Srjs                           __attribute__((unused)) const struct GFX7_SO_WRITE_OFFSET2 * restrict values)
742210e230b6Smaya{
742310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
742410e230b6Smaya
742510e230b6Smaya   dw[0] =
742610e230b6Smaya      __gen_offset(values->WriteOffset, 2, 31);
742710e230b6Smaya}
742810e230b6Smaya
742996c5ddc4Srjs#define GFX7_SO_WRITE_OFFSET3_num         0x528c
743096c5ddc4Srjs#define GFX7_SO_WRITE_OFFSET3_length           1
743196c5ddc4Srjsstruct GFX7_SO_WRITE_OFFSET3 {
743210e230b6Smaya   uint64_t                             WriteOffset;
743310e230b6Smaya};
743410e230b6Smaya
743596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
743696c5ddc4SrjsGFX7_SO_WRITE_OFFSET3_pack(__attribute__((unused)) __gen_user_data *data,
743710e230b6Smaya                           __attribute__((unused)) void * restrict dst,
743896c5ddc4Srjs                           __attribute__((unused)) const struct GFX7_SO_WRITE_OFFSET3 * restrict values)
743910e230b6Smaya{
744010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
744110e230b6Smaya
744210e230b6Smaya   dw[0] =
744310e230b6Smaya      __gen_offset(values->WriteOffset, 2, 31);
744410e230b6Smaya}
744510e230b6Smaya
744696c5ddc4Srjs#define GFX7_VCS_FAULT_REG_num            0x4194
744796c5ddc4Srjs#define GFX7_VCS_FAULT_REG_length              1
744896c5ddc4Srjsstruct GFX7_VCS_FAULT_REG {
744910e230b6Smaya   bool                                 ValidBit;
745010e230b6Smaya   uint32_t                             FaultType;
745110e230b6Smaya#define PageFault                                0
745210e230b6Smaya#define InvalidPDFault                           1
745310e230b6Smaya#define UnloadedPDFault                          2
745410e230b6Smaya#define InvalidandUnloadedPDfault                3
745510e230b6Smaya   uint32_t                             SRCIDofFault;
745610e230b6Smaya   uint32_t                             GTTSEL;
745710e230b6Smaya#define PPGTT                                    0
745810e230b6Smaya#define GGTT                                     1
745910e230b6Smaya   __gen_address_type                   VirtualAddressofFault;
746010e230b6Smaya};
746110e230b6Smaya
746296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
746396c5ddc4SrjsGFX7_VCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
746410e230b6Smaya                        __attribute__((unused)) void * restrict dst,
746596c5ddc4Srjs                        __attribute__((unused)) const struct GFX7_VCS_FAULT_REG * restrict values)
746610e230b6Smaya{
746710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
746810e230b6Smaya
746910e230b6Smaya   const uint32_t v0 =
747010e230b6Smaya      __gen_uint(values->ValidBit, 0, 0) |
747110e230b6Smaya      __gen_uint(values->FaultType, 1, 2) |
747210e230b6Smaya      __gen_uint(values->SRCIDofFault, 3, 10) |
747310e230b6Smaya      __gen_uint(values->GTTSEL, 11, 11);
747496c5ddc4Srjs   dw[0] = __gen_address(data, &dw[0], values->VirtualAddressofFault, v0, 12, 31);
747510e230b6Smaya}
747610e230b6Smaya
747796c5ddc4Srjs#define GFX7_VCS_INSTDONE_num             0x1206c
747896c5ddc4Srjs#define GFX7_VCS_INSTDONE_length               1
747996c5ddc4Srjsstruct GFX7_VCS_INSTDONE {
748010e230b6Smaya   bool                                 RingEnable;
748110e230b6Smaya   bool                                 USBDone;
748210e230b6Smaya   bool                                 QRCDone;
748310e230b6Smaya   bool                                 SECDone;
748410e230b6Smaya   bool                                 MPCDone;
748510e230b6Smaya   bool                                 VFTDone;
748610e230b6Smaya   bool                                 BSPDone;
748710e230b6Smaya   bool                                 VLFDone;
748810e230b6Smaya   bool                                 VOPDone;
748910e230b6Smaya   bool                                 VMCDone;
749010e230b6Smaya   bool                                 VIPDone;
749110e230b6Smaya   bool                                 VITDone;
749210e230b6Smaya   bool                                 VDSDone;
749310e230b6Smaya   bool                                 VMXDone;
749410e230b6Smaya   bool                                 VCPDone;
749510e230b6Smaya   bool                                 VCDDone;
749610e230b6Smaya   bool                                 VADDone;
749710e230b6Smaya   bool                                 VMDDone;
749810e230b6Smaya   bool                                 VISDone;
749910e230b6Smaya   bool                                 VACDone;
750010e230b6Smaya   bool                                 VAMDone;
750110e230b6Smaya   bool                                 JPGDone;
750210e230b6Smaya   bool                                 VBPDone;
750310e230b6Smaya   bool                                 VHRDone;
750410e230b6Smaya   bool                                 VCIDone;
750510e230b6Smaya   bool                                 VCRDone;
750610e230b6Smaya   bool                                 VINDone;
750710e230b6Smaya   bool                                 VPRDone;
750810e230b6Smaya   bool                                 VTQDone;
750910e230b6Smaya   bool                                 VCSDone;
751010e230b6Smaya   bool                                 GACDone;
751110e230b6Smaya};
751210e230b6Smaya
751396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
751496c5ddc4SrjsGFX7_VCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
751510e230b6Smaya                       __attribute__((unused)) void * restrict dst,
751696c5ddc4Srjs                       __attribute__((unused)) const struct GFX7_VCS_INSTDONE * restrict values)
751710e230b6Smaya{
751810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
751910e230b6Smaya
752010e230b6Smaya   dw[0] =
752110e230b6Smaya      __gen_uint(values->RingEnable, 0, 0) |
752210e230b6Smaya      __gen_uint(values->USBDone, 1, 1) |
752310e230b6Smaya      __gen_uint(values->QRCDone, 2, 2) |
752410e230b6Smaya      __gen_uint(values->SECDone, 3, 3) |
752510e230b6Smaya      __gen_uint(values->MPCDone, 4, 4) |
752610e230b6Smaya      __gen_uint(values->VFTDone, 5, 5) |
752710e230b6Smaya      __gen_uint(values->BSPDone, 6, 6) |
752810e230b6Smaya      __gen_uint(values->VLFDone, 7, 7) |
752910e230b6Smaya      __gen_uint(values->VOPDone, 8, 8) |
753010e230b6Smaya      __gen_uint(values->VMCDone, 9, 9) |
753110e230b6Smaya      __gen_uint(values->VIPDone, 10, 10) |
753210e230b6Smaya      __gen_uint(values->VITDone, 11, 11) |
753310e230b6Smaya      __gen_uint(values->VDSDone, 12, 12) |
753410e230b6Smaya      __gen_uint(values->VMXDone, 13, 13) |
753510e230b6Smaya      __gen_uint(values->VCPDone, 14, 14) |
753610e230b6Smaya      __gen_uint(values->VCDDone, 15, 15) |
753710e230b6Smaya      __gen_uint(values->VADDone, 16, 16) |
753810e230b6Smaya      __gen_uint(values->VMDDone, 17, 17) |
753910e230b6Smaya      __gen_uint(values->VISDone, 18, 18) |
754010e230b6Smaya      __gen_uint(values->VACDone, 19, 19) |
754110e230b6Smaya      __gen_uint(values->VAMDone, 20, 20) |
754210e230b6Smaya      __gen_uint(values->JPGDone, 21, 21) |
754310e230b6Smaya      __gen_uint(values->VBPDone, 22, 22) |
754410e230b6Smaya      __gen_uint(values->VHRDone, 23, 23) |
754510e230b6Smaya      __gen_uint(values->VCIDone, 24, 24) |
754610e230b6Smaya      __gen_uint(values->VCRDone, 25, 25) |
754710e230b6Smaya      __gen_uint(values->VINDone, 26, 26) |
754810e230b6Smaya      __gen_uint(values->VPRDone, 27, 27) |
754910e230b6Smaya      __gen_uint(values->VTQDone, 28, 28) |
755010e230b6Smaya      __gen_uint(values->VCSDone, 30, 30) |
755110e230b6Smaya      __gen_uint(values->GACDone, 31, 31);
755210e230b6Smaya}
755310e230b6Smaya
755496c5ddc4Srjs#define GFX7_VCS_RING_BUFFER_CTL_num      0x1203c
755596c5ddc4Srjs#define GFX7_VCS_RING_BUFFER_CTL_length        1
755696c5ddc4Srjsstruct GFX7_VCS_RING_BUFFER_CTL {
755710e230b6Smaya   bool                                 RingBufferEnable;
755810e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
755910e230b6Smaya#define MI_AUTOREPORT_OFF                        0
756010e230b6Smaya#define MI_AUTOREPORT_64KB                       1
756110e230b6Smaya#define MI_AUTOREPORT_4KB                        2
756210e230b6Smaya#define MI_AUTOREPORT_128KB                      3
756310e230b6Smaya   bool                                 DisableRegisterAccesses;
756410e230b6Smaya   bool                                 SemaphoreWait;
756510e230b6Smaya   bool                                 RBWait;
756610e230b6Smaya   uint32_t                             BufferLengthinpages1;
756710e230b6Smaya};
756810e230b6Smaya
756996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
757096c5ddc4SrjsGFX7_VCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
757110e230b6Smaya                              __attribute__((unused)) void * restrict dst,
757296c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_VCS_RING_BUFFER_CTL * restrict values)
757310e230b6Smaya{
757410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
757510e230b6Smaya
757610e230b6Smaya   dw[0] =
757710e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
757810e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
757910e230b6Smaya      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
758010e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
758110e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
758210e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
758310e230b6Smaya}
758410e230b6Smaya
758596c5ddc4Srjs#define GFX7_VS_INVOCATION_COUNT_num      0x2320
758696c5ddc4Srjs#define GFX7_VS_INVOCATION_COUNT_length        2
758796c5ddc4Srjsstruct GFX7_VS_INVOCATION_COUNT {
758810e230b6Smaya   uint64_t                             VSInvocationCountReport;
758910e230b6Smaya};
759010e230b6Smaya
759196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
759296c5ddc4SrjsGFX7_VS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
759310e230b6Smaya                              __attribute__((unused)) void * restrict dst,
759496c5ddc4Srjs                              __attribute__((unused)) const struct GFX7_VS_INVOCATION_COUNT * restrict values)
759510e230b6Smaya{
759610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
759710e230b6Smaya
759810e230b6Smaya   const uint64_t v0 =
759910e230b6Smaya      __gen_uint(values->VSInvocationCountReport, 0, 63);
760010e230b6Smaya   dw[0] = v0;
760110e230b6Smaya   dw[1] = v0 >> 32;
760210e230b6Smaya}
760310e230b6Smaya
760496c5ddc4Srjs#endif /* GFX7_PACK_H */
7605