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 SKL.
2610e230b6Smaya *
2710e230b6Smaya * This file has been generated, do not hand edit.
2810e230b6Smaya */
2910e230b6Smaya
3096c5ddc4Srjs#ifndef GFX9_PACK_H
3196c5ddc4Srjs#define GFX9_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 GFX9_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 GFX9_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 GFX9_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 GFX9_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 GFX9_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 GFX9_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 GFX9_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_PID                     =      7,
31910e230b6Smaya};
32010e230b6Smaya
32196c5ddc4Srjsenum GFX9_Atomic_OPCODE {
32210e230b6Smaya   MI_ATOMIC_OP_AND                     =      1,
32310e230b6Smaya   MI_ATOMIC_OP_OR                      =      2,
32410e230b6Smaya   MI_ATOMIC_OP_XOR                     =      3,
32510e230b6Smaya   MI_ATOMIC_OP_MOVE                    =      4,
32610e230b6Smaya   MI_ATOMIC_OP_INC                     =      5,
32710e230b6Smaya   MI_ATOMIC_OP_DEC                     =      6,
32810e230b6Smaya   MI_ATOMIC_OP_ADD                     =      7,
32910e230b6Smaya   MI_ATOMIC_OP_SUB                     =      8,
33010e230b6Smaya   MI_ATOMIC_OP_RSUB                    =      9,
33110e230b6Smaya   MI_ATOMIC_OP_IMAX                    =     10,
33210e230b6Smaya   MI_ATOMIC_OP_IMIN                    =     11,
33310e230b6Smaya   MI_ATOMIC_OP_UMAX                    =     12,
33410e230b6Smaya   MI_ATOMIC_OP_UMIN                    =     13,
33510e230b6Smaya   MI_ATOMIC_OP_CMP_WR                  =     14,
33610e230b6Smaya   MI_ATOMIC_OP_PREDEC                  =     15,
33710e230b6Smaya   MI_ATOMIC_OP_AND8B                   =     33,
33810e230b6Smaya   MI_ATOMIC_OP_OR8B                    =     34,
33910e230b6Smaya   MI_ATOMIC_OP_XOR8B                   =     35,
34010e230b6Smaya   MI_ATOMIC_OP_MOVE8B                  =     36,
34110e230b6Smaya   MI_ATOMIC_OP_INC8B                   =     37,
34210e230b6Smaya   MI_ATOMIC_OP_DEC8B                   =     38,
34310e230b6Smaya   MI_ATOMIC_OP_ADD8B                   =     39,
34410e230b6Smaya   MI_ATOMIC_OP_SUB8B                   =     40,
34510e230b6Smaya   MI_ATOMIC_OP_RSUB8B                  =     41,
34610e230b6Smaya   MI_ATOMIC_OP_IMAX8B                  =     42,
34710e230b6Smaya   MI_ATOMIC_OP_IMIN8B                  =     43,
34810e230b6Smaya   MI_ATOMIC_OP_UMAX8B                  =     44,
34910e230b6Smaya   MI_ATOMIC_OP_UMIN8B                  =     45,
35010e230b6Smaya   MI_ATOMIC_OP_CMP_WR8B                =     46,
35110e230b6Smaya   MI_ATOMIC_OP_PREDEC8B                =     47,
35210e230b6Smaya   MI_ATOMIC_OP_CMP_WR16B               =     78,
35310e230b6Smaya};
35410e230b6Smaya
35596c5ddc4Srjsenum GFX9_Attribute_Component_Format {
35610e230b6Smaya   ACF_DISABLED                         =      0,
35710e230b6Smaya   ACF_XY                               =      1,
35810e230b6Smaya   ACF_XYZ                              =      2,
35910e230b6Smaya   ACF_XYZW                             =      3,
36010e230b6Smaya};
36110e230b6Smaya
36296c5ddc4Srjsenum GFX9_COMPONENT_ENABLES {
36310e230b6Smaya   CE_NONE                              =      0,
36410e230b6Smaya   CE_X                                 =      1,
36510e230b6Smaya   CE_Y                                 =      2,
36610e230b6Smaya   CE_XY                                =      3,
36710e230b6Smaya   CE_Z                                 =      4,
36810e230b6Smaya   CE_XZ                                =      5,
36910e230b6Smaya   CE_YZ                                =      6,
37010e230b6Smaya   CE_XYZ                               =      7,
37110e230b6Smaya   CE_W                                 =      8,
37210e230b6Smaya   CE_XW                                =      9,
37310e230b6Smaya   CE_YW                                =     10,
37410e230b6Smaya   CE_XYW                               =     11,
37510e230b6Smaya   CE_ZW                                =     12,
37610e230b6Smaya   CE_XZW                               =     13,
37710e230b6Smaya   CE_YZW                               =     14,
37810e230b6Smaya   CE_XYZW                              =     15,
37910e230b6Smaya};
38010e230b6Smaya
38196c5ddc4Srjsenum GFX9_ShaderChannelSelect {
38210e230b6Smaya   SCS_ZERO                             =      0,
38310e230b6Smaya   SCS_ONE                              =      1,
38410e230b6Smaya   SCS_RED                              =      4,
38510e230b6Smaya   SCS_GREEN                            =      5,
38610e230b6Smaya   SCS_BLUE                             =      6,
38710e230b6Smaya   SCS_ALPHA                            =      7,
38810e230b6Smaya};
38910e230b6Smaya
39096c5ddc4Srjsenum GFX9_TextureCoordinateMode {
39110e230b6Smaya   TCM_WRAP                             =      0,
39210e230b6Smaya   TCM_MIRROR                           =      1,
39310e230b6Smaya   TCM_CLAMP                            =      2,
39410e230b6Smaya   TCM_CUBE                             =      3,
39510e230b6Smaya   TCM_CLAMP_BORDER                     =      4,
39610e230b6Smaya   TCM_MIRROR_ONCE                      =      5,
39710e230b6Smaya   TCM_HALF_BORDER                      =      6,
39810e230b6Smaya};
39910e230b6Smaya
40096c5ddc4Srjsenum GFX9_WRAP_SHORTEST_ENABLE {
40110e230b6Smaya   WSE_X                                =      1,
40210e230b6Smaya   WSE_Y                                =      2,
40310e230b6Smaya   WSE_XY                               =      3,
40410e230b6Smaya   WSE_Z                                =      4,
40510e230b6Smaya   WSE_XZ                               =      5,
40610e230b6Smaya   WSE_YZ                               =      6,
40710e230b6Smaya   WSE_XYZ                              =      7,
40810e230b6Smaya   WSE_W                                =      8,
40910e230b6Smaya   WSE_XW                               =      9,
41010e230b6Smaya   WSE_YW                               =     10,
41110e230b6Smaya   WSE_XYW                              =     11,
41210e230b6Smaya   WSE_ZW                               =     12,
41310e230b6Smaya   WSE_XZW                              =     13,
41410e230b6Smaya   WSE_YZW                              =     14,
41510e230b6Smaya   WSE_XYZW                             =     15,
41610e230b6Smaya};
41710e230b6Smaya
41896c5ddc4Srjs#define GFX9_3DSTATE_CONSTANT_BODY_length     10
41996c5ddc4Srjsstruct GFX9_3DSTATE_CONSTANT_BODY {
42010e230b6Smaya   uint32_t                             ReadLength[4];
42110e230b6Smaya   __gen_address_type                   Buffer[4];
42210e230b6Smaya};
42310e230b6Smaya
42496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
42596c5ddc4SrjsGFX9_3DSTATE_CONSTANT_BODY_pack(__attribute__((unused)) __gen_user_data *data,
42610e230b6Smaya                                __attribute__((unused)) void * restrict dst,
42796c5ddc4Srjs                                __attribute__((unused)) const struct GFX9_3DSTATE_CONSTANT_BODY * restrict values)
42810e230b6Smaya{
42910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
43010e230b6Smaya
43110e230b6Smaya   dw[0] =
43210e230b6Smaya      __gen_uint(values->ReadLength[0], 0, 15) |
43310e230b6Smaya      __gen_uint(values->ReadLength[1], 16, 31);
43410e230b6Smaya
43510e230b6Smaya   dw[1] =
43610e230b6Smaya      __gen_uint(values->ReadLength[2], 0, 15) |
43710e230b6Smaya      __gen_uint(values->ReadLength[3], 16, 31);
43810e230b6Smaya
43910e230b6Smaya   const uint64_t v2_address =
44096c5ddc4Srjs      __gen_address(data, &dw[2], values->Buffer[0], 0, 5, 63);
44110e230b6Smaya   dw[2] = v2_address;
44210e230b6Smaya   dw[3] = v2_address >> 32;
44310e230b6Smaya
44410e230b6Smaya   const uint64_t v4_address =
44596c5ddc4Srjs      __gen_address(data, &dw[4], values->Buffer[1], 0, 5, 63);
44610e230b6Smaya   dw[4] = v4_address;
44710e230b6Smaya   dw[5] = v4_address >> 32;
44810e230b6Smaya
44910e230b6Smaya   const uint64_t v6_address =
45096c5ddc4Srjs      __gen_address(data, &dw[6], values->Buffer[2], 0, 5, 63);
45110e230b6Smaya   dw[6] = v6_address;
45210e230b6Smaya   dw[7] = v6_address >> 32;
45310e230b6Smaya
45410e230b6Smaya   const uint64_t v8_address =
45596c5ddc4Srjs      __gen_address(data, &dw[8], values->Buffer[3], 0, 5, 63);
45610e230b6Smaya   dw[8] = v8_address;
45710e230b6Smaya   dw[9] = v8_address >> 32;
45810e230b6Smaya}
45910e230b6Smaya
46096c5ddc4Srjs#define GFX9_BINDING_TABLE_EDIT_ENTRY_length      1
46196c5ddc4Srjsstruct GFX9_BINDING_TABLE_EDIT_ENTRY {
46210e230b6Smaya   uint64_t                             SurfaceStatePointer;
46310e230b6Smaya   uint32_t                             BindingTableIndex;
46410e230b6Smaya};
46510e230b6Smaya
46696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
46796c5ddc4SrjsGFX9_BINDING_TABLE_EDIT_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
46810e230b6Smaya                                   __attribute__((unused)) void * restrict dst,
46996c5ddc4Srjs                                   __attribute__((unused)) const struct GFX9_BINDING_TABLE_EDIT_ENTRY * restrict values)
47010e230b6Smaya{
47110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
47210e230b6Smaya
47310e230b6Smaya   dw[0] =
47410e230b6Smaya      __gen_offset(values->SurfaceStatePointer, 0, 15) |
47510e230b6Smaya      __gen_uint(values->BindingTableIndex, 16, 23);
47610e230b6Smaya}
47710e230b6Smaya
47896c5ddc4Srjs#define GFX9_BINDING_TABLE_STATE_length        1
47996c5ddc4Srjsstruct GFX9_BINDING_TABLE_STATE {
48010e230b6Smaya   uint64_t                             SurfaceStatePointer;
48110e230b6Smaya};
48210e230b6Smaya
48396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
48496c5ddc4SrjsGFX9_BINDING_TABLE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
48510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
48696c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_BINDING_TABLE_STATE * restrict values)
48710e230b6Smaya{
48810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
48910e230b6Smaya
49010e230b6Smaya   dw[0] =
49110e230b6Smaya      __gen_offset(values->SurfaceStatePointer, 6, 31);
49210e230b6Smaya}
49310e230b6Smaya
49496c5ddc4Srjs#define GFX9_BLEND_STATE_ENTRY_length          2
49596c5ddc4Srjsstruct GFX9_BLEND_STATE_ENTRY {
49610e230b6Smaya   bool                                 WriteDisableBlue;
49710e230b6Smaya   bool                                 WriteDisableGreen;
49810e230b6Smaya   bool                                 WriteDisableRed;
49910e230b6Smaya   bool                                 WriteDisableAlpha;
50096c5ddc4Srjs   enum GFX9_3D_Color_Buffer_Blend_Function AlphaBlendFunction;
50196c5ddc4Srjs   enum GFX9_3D_Color_Buffer_Blend_Factor DestinationAlphaBlendFactor;
50296c5ddc4Srjs   enum GFX9_3D_Color_Buffer_Blend_Factor SourceAlphaBlendFactor;
50396c5ddc4Srjs   enum GFX9_3D_Color_Buffer_Blend_Function ColorBlendFunction;
50496c5ddc4Srjs   enum GFX9_3D_Color_Buffer_Blend_Factor DestinationBlendFactor;
50596c5ddc4Srjs   enum GFX9_3D_Color_Buffer_Blend_Factor SourceBlendFactor;
50610e230b6Smaya   bool                                 ColorBufferBlendEnable;
50710e230b6Smaya   bool                                 PostBlendColorClampEnable;
50810e230b6Smaya   bool                                 PreBlendColorClampEnable;
50910e230b6Smaya   uint32_t                             ColorClampRange;
51010e230b6Smaya#define COLORCLAMP_UNORM                         0
51110e230b6Smaya#define COLORCLAMP_SNORM                         1
51210e230b6Smaya#define COLORCLAMP_RTFORMAT                      2
51310e230b6Smaya   bool                                 PreBlendSourceOnlyClampEnable;
51496c5ddc4Srjs   enum GFX9_3D_Logic_Op_Function       LogicOpFunction;
51510e230b6Smaya   bool                                 LogicOpEnable;
51610e230b6Smaya};
51710e230b6Smaya
51896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
51996c5ddc4SrjsGFX9_BLEND_STATE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
52010e230b6Smaya                            __attribute__((unused)) void * restrict dst,
52196c5ddc4Srjs                            __attribute__((unused)) const struct GFX9_BLEND_STATE_ENTRY * restrict values)
52210e230b6Smaya{
52310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
52410e230b6Smaya
52510e230b6Smaya   dw[0] =
52610e230b6Smaya      __gen_uint(values->WriteDisableBlue, 0, 0) |
52710e230b6Smaya      __gen_uint(values->WriteDisableGreen, 1, 1) |
52810e230b6Smaya      __gen_uint(values->WriteDisableRed, 2, 2) |
52910e230b6Smaya      __gen_uint(values->WriteDisableAlpha, 3, 3) |
53010e230b6Smaya      __gen_uint(values->AlphaBlendFunction, 5, 7) |
53110e230b6Smaya      __gen_uint(values->DestinationAlphaBlendFactor, 8, 12) |
53210e230b6Smaya      __gen_uint(values->SourceAlphaBlendFactor, 13, 17) |
53310e230b6Smaya      __gen_uint(values->ColorBlendFunction, 18, 20) |
53410e230b6Smaya      __gen_uint(values->DestinationBlendFactor, 21, 25) |
53510e230b6Smaya      __gen_uint(values->SourceBlendFactor, 26, 30) |
53610e230b6Smaya      __gen_uint(values->ColorBufferBlendEnable, 31, 31);
53710e230b6Smaya
53810e230b6Smaya   dw[1] =
53910e230b6Smaya      __gen_uint(values->PostBlendColorClampEnable, 0, 0) |
54010e230b6Smaya      __gen_uint(values->PreBlendColorClampEnable, 1, 1) |
54110e230b6Smaya      __gen_uint(values->ColorClampRange, 2, 3) |
54210e230b6Smaya      __gen_uint(values->PreBlendSourceOnlyClampEnable, 4, 4) |
54310e230b6Smaya      __gen_uint(values->LogicOpFunction, 27, 30) |
54410e230b6Smaya      __gen_uint(values->LogicOpEnable, 31, 31);
54510e230b6Smaya}
54610e230b6Smaya
54796c5ddc4Srjs#define GFX9_BLEND_STATE_length                1
54896c5ddc4Srjsstruct GFX9_BLEND_STATE {
54910e230b6Smaya   uint32_t                             YDitherOffset;
55010e230b6Smaya   uint32_t                             XDitherOffset;
55110e230b6Smaya   bool                                 ColorDitherEnable;
55296c5ddc4Srjs   enum GFX9_3D_Compare_Function        AlphaTestFunction;
55310e230b6Smaya   bool                                 AlphaTestEnable;
55410e230b6Smaya   bool                                 AlphaToCoverageDitherEnable;
55510e230b6Smaya   bool                                 AlphaToOneEnable;
55610e230b6Smaya   bool                                 IndependentAlphaBlendEnable;
55710e230b6Smaya   bool                                 AlphaToCoverageEnable;
55810e230b6Smaya   /* variable length fields follow */
55910e230b6Smaya};
56010e230b6Smaya
56196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
56296c5ddc4SrjsGFX9_BLEND_STATE_pack(__attribute__((unused)) __gen_user_data *data,
56310e230b6Smaya                      __attribute__((unused)) void * restrict dst,
56496c5ddc4Srjs                      __attribute__((unused)) const struct GFX9_BLEND_STATE * restrict values)
56510e230b6Smaya{
56610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
56710e230b6Smaya
56810e230b6Smaya   dw[0] =
56910e230b6Smaya      __gen_uint(values->YDitherOffset, 19, 20) |
57010e230b6Smaya      __gen_uint(values->XDitherOffset, 21, 22) |
57110e230b6Smaya      __gen_uint(values->ColorDitherEnable, 23, 23) |
57210e230b6Smaya      __gen_uint(values->AlphaTestFunction, 24, 26) |
57310e230b6Smaya      __gen_uint(values->AlphaTestEnable, 27, 27) |
57410e230b6Smaya      __gen_uint(values->AlphaToCoverageDitherEnable, 28, 28) |
57510e230b6Smaya      __gen_uint(values->AlphaToOneEnable, 29, 29) |
57610e230b6Smaya      __gen_uint(values->IndependentAlphaBlendEnable, 30, 30) |
57710e230b6Smaya      __gen_uint(values->AlphaToCoverageEnable, 31, 31);
57810e230b6Smaya}
57910e230b6Smaya
58096c5ddc4Srjs#define GFX9_CC_VIEWPORT_length                2
58196c5ddc4Srjsstruct GFX9_CC_VIEWPORT {
58210e230b6Smaya   float                                MinimumDepth;
58310e230b6Smaya   float                                MaximumDepth;
58410e230b6Smaya};
58510e230b6Smaya
58696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
58796c5ddc4SrjsGFX9_CC_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
58810e230b6Smaya                      __attribute__((unused)) void * restrict dst,
58996c5ddc4Srjs                      __attribute__((unused)) const struct GFX9_CC_VIEWPORT * restrict values)
59010e230b6Smaya{
59110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
59210e230b6Smaya
59310e230b6Smaya   dw[0] =
59410e230b6Smaya      __gen_float(values->MinimumDepth);
59510e230b6Smaya
59610e230b6Smaya   dw[1] =
59710e230b6Smaya      __gen_float(values->MaximumDepth);
59810e230b6Smaya}
59910e230b6Smaya
60096c5ddc4Srjs#define GFX9_COLOR_CALC_STATE_length           6
60196c5ddc4Srjsstruct GFX9_COLOR_CALC_STATE {
60210e230b6Smaya   uint32_t                             AlphaTestFormat;
60310e230b6Smaya#define ALPHATEST_UNORM8                         0
60410e230b6Smaya#define ALPHATEST_FLOAT32                        1
60510e230b6Smaya   bool                                 RoundDisableFunctionDisable;
60610e230b6Smaya   uint32_t                             AlphaReferenceValueAsUNORM8;
60710e230b6Smaya   float                                AlphaReferenceValueAsFLOAT32;
60810e230b6Smaya   float                                BlendConstantColorRed;
60910e230b6Smaya   float                                BlendConstantColorGreen;
61010e230b6Smaya   float                                BlendConstantColorBlue;
61110e230b6Smaya   float                                BlendConstantColorAlpha;
61210e230b6Smaya};
61310e230b6Smaya
61496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
61596c5ddc4SrjsGFX9_COLOR_CALC_STATE_pack(__attribute__((unused)) __gen_user_data *data,
61610e230b6Smaya                           __attribute__((unused)) void * restrict dst,
61796c5ddc4Srjs                           __attribute__((unused)) const struct GFX9_COLOR_CALC_STATE * restrict values)
61810e230b6Smaya{
61910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
62010e230b6Smaya
62110e230b6Smaya   dw[0] =
62210e230b6Smaya      __gen_uint(values->AlphaTestFormat, 0, 0) |
62310e230b6Smaya      __gen_uint(values->RoundDisableFunctionDisable, 15, 15);
62410e230b6Smaya
62510e230b6Smaya   dw[1] =
62610e230b6Smaya      __gen_uint(values->AlphaReferenceValueAsUNORM8, 0, 31) |
62710e230b6Smaya      __gen_float(values->AlphaReferenceValueAsFLOAT32);
62810e230b6Smaya
62910e230b6Smaya   dw[2] =
63010e230b6Smaya      __gen_float(values->BlendConstantColorRed);
63110e230b6Smaya
63210e230b6Smaya   dw[3] =
63310e230b6Smaya      __gen_float(values->BlendConstantColorGreen);
63410e230b6Smaya
63510e230b6Smaya   dw[4] =
63610e230b6Smaya      __gen_float(values->BlendConstantColorBlue);
63710e230b6Smaya
63810e230b6Smaya   dw[5] =
63910e230b6Smaya      __gen_float(values->BlendConstantColorAlpha);
64010e230b6Smaya}
64110e230b6Smaya
64296c5ddc4Srjs#define GFX9_EXECUTION_UNIT_EXTENDED_MESSAGE_DESCRIPTOR_length      1
64396c5ddc4Srjsstruct GFX9_EXECUTION_UNIT_EXTENDED_MESSAGE_DESCRIPTOR {
64410e230b6Smaya   uint32_t                             TargetFunctionID;
64510e230b6Smaya   uint32_t                             EndOfThread;
64610e230b6Smaya#define NoTermination                            0
64710e230b6Smaya#define EOT                                      1
64810e230b6Smaya   uint32_t                             ExtendedMessageLength;
64910e230b6Smaya};
65010e230b6Smaya
65196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
65296c5ddc4SrjsGFX9_EXECUTION_UNIT_EXTENDED_MESSAGE_DESCRIPTOR_pack(__attribute__((unused)) __gen_user_data *data,
65310e230b6Smaya                                                     __attribute__((unused)) void * restrict dst,
65496c5ddc4Srjs                                                     __attribute__((unused)) const struct GFX9_EXECUTION_UNIT_EXTENDED_MESSAGE_DESCRIPTOR * restrict values)
65510e230b6Smaya{
65610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
65710e230b6Smaya
65810e230b6Smaya   dw[0] =
65910e230b6Smaya      __gen_uint(values->TargetFunctionID, 0, 3) |
66010e230b6Smaya      __gen_uint(values->EndOfThread, 5, 5) |
66110e230b6Smaya      __gen_uint(values->ExtendedMessageLength, 6, 9);
66210e230b6Smaya}
66310e230b6Smaya
66496c5ddc4Srjs#define GFX9_FILTER_COEFFICIENT_length         1
66596c5ddc4Srjsstruct GFX9_FILTER_COEFFICIENT {
66610e230b6Smaya   float                                FilterCoefficient;
66710e230b6Smaya};
66810e230b6Smaya
66996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
67096c5ddc4SrjsGFX9_FILTER_COEFFICIENT_pack(__attribute__((unused)) __gen_user_data *data,
67110e230b6Smaya                             __attribute__((unused)) void * restrict dst,
67296c5ddc4Srjs                             __attribute__((unused)) const struct GFX9_FILTER_COEFFICIENT * restrict values)
67310e230b6Smaya{
67410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
67510e230b6Smaya
67610e230b6Smaya   dw[0] =
67710e230b6Smaya      __gen_sfixed(values->FilterCoefficient, 0, 7, 6);
67810e230b6Smaya}
67910e230b6Smaya
68096c5ddc4Srjs#define GFX9_FRAMEDELTAQP_length               2
68196c5ddc4Srjsstruct GFX9_FRAMEDELTAQP {
68210e230b6Smaya   int32_t                              FrameDeltaQP[8];
68310e230b6Smaya};
68410e230b6Smaya
68596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
68696c5ddc4SrjsGFX9_FRAMEDELTAQP_pack(__attribute__((unused)) __gen_user_data *data,
68710e230b6Smaya                       __attribute__((unused)) void * restrict dst,
68896c5ddc4Srjs                       __attribute__((unused)) const struct GFX9_FRAMEDELTAQP * restrict values)
68910e230b6Smaya{
69010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
69110e230b6Smaya
69210e230b6Smaya   dw[0] =
69310e230b6Smaya      __gen_sint(values->FrameDeltaQP[0], 0, 7) |
69410e230b6Smaya      __gen_sint(values->FrameDeltaQP[1], 8, 15) |
69510e230b6Smaya      __gen_sint(values->FrameDeltaQP[2], 16, 23) |
69610e230b6Smaya      __gen_sint(values->FrameDeltaQP[3], 24, 31);
69710e230b6Smaya
69810e230b6Smaya   dw[1] =
69910e230b6Smaya      __gen_sint(values->FrameDeltaQP[4], 0, 7) |
70010e230b6Smaya      __gen_sint(values->FrameDeltaQP[5], 8, 15) |
70110e230b6Smaya      __gen_sint(values->FrameDeltaQP[6], 16, 23) |
70210e230b6Smaya      __gen_sint(values->FrameDeltaQP[7], 24, 31);
70310e230b6Smaya}
70410e230b6Smaya
70596c5ddc4Srjs#define GFX9_FRAMEDELTAQPRANGE_length          2
70696c5ddc4Srjsstruct GFX9_FRAMEDELTAQPRANGE {
70710e230b6Smaya   uint32_t                             FrameDeltaQPRange[8];
70810e230b6Smaya};
70910e230b6Smaya
71096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
71196c5ddc4SrjsGFX9_FRAMEDELTAQPRANGE_pack(__attribute__((unused)) __gen_user_data *data,
71210e230b6Smaya                            __attribute__((unused)) void * restrict dst,
71396c5ddc4Srjs                            __attribute__((unused)) const struct GFX9_FRAMEDELTAQPRANGE * restrict values)
71410e230b6Smaya{
71510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
71610e230b6Smaya
71710e230b6Smaya   dw[0] =
71810e230b6Smaya      __gen_uint(values->FrameDeltaQPRange[0], 0, 7) |
71910e230b6Smaya      __gen_uint(values->FrameDeltaQPRange[1], 8, 15) |
72010e230b6Smaya      __gen_uint(values->FrameDeltaQPRange[2], 16, 23) |
72110e230b6Smaya      __gen_uint(values->FrameDeltaQPRange[3], 24, 31);
72210e230b6Smaya
72310e230b6Smaya   dw[1] =
72410e230b6Smaya      __gen_uint(values->FrameDeltaQPRange[4], 0, 7) |
72510e230b6Smaya      __gen_uint(values->FrameDeltaQPRange[5], 8, 15) |
72610e230b6Smaya      __gen_uint(values->FrameDeltaQPRange[6], 16, 23) |
72710e230b6Smaya      __gen_uint(values->FrameDeltaQPRange[7], 24, 31);
72810e230b6Smaya}
72910e230b6Smaya
73096c5ddc4Srjs#define GFX9_GATHER_CONSTANT_ENTRY_length      1
73196c5ddc4Srjsstruct GFX9_GATHER_CONSTANT_ENTRY {
73210e230b6Smaya   uint32_t                             BindingTableIndexOffset;
73310e230b6Smaya   uint32_t                             ChannelMask;
73410e230b6Smaya   uint64_t                             ConstantBufferOffset;
73510e230b6Smaya};
73610e230b6Smaya
73796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
73896c5ddc4SrjsGFX9_GATHER_CONSTANT_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
73910e230b6Smaya                                __attribute__((unused)) void * restrict dst,
74096c5ddc4Srjs                                __attribute__((unused)) const struct GFX9_GATHER_CONSTANT_ENTRY * restrict values)
74110e230b6Smaya{
74210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
74310e230b6Smaya
74410e230b6Smaya   dw[0] =
74510e230b6Smaya      __gen_uint(values->BindingTableIndexOffset, 0, 3) |
74610e230b6Smaya      __gen_uint(values->ChannelMask, 4, 7) |
74710e230b6Smaya      __gen_offset(values->ConstantBufferOffset, 8, 15);
74810e230b6Smaya}
74910e230b6Smaya
75096c5ddc4Srjs#define GFX9_MEMORYADDRESSATTRIBUTES_length      1
75196c5ddc4Srjsstruct GFX9_MEMORYADDRESSATTRIBUTES {
75210e230b6Smaya   uint32_t                             MOCS;
75310e230b6Smaya   uint32_t                             ArbitrationPriorityControl;
75410e230b6Smaya#define Highestpriority                          0
75510e230b6Smaya#define Secondhighestpriority                    1
75610e230b6Smaya#define Thirdhighestpriority                     2
75710e230b6Smaya#define Lowestpriority                           3
75810e230b6Smaya   bool                                 MemoryCompressionEnable;
75910e230b6Smaya   uint32_t                             RowStoreScratchBufferCacheSelect;
76010e230b6Smaya#define LLC                                      0
76110e230b6Smaya#define InternalMediaStorage                     1
76210e230b6Smaya   uint32_t                             TiledResourceMode;
76310e230b6Smaya#define TRMODE_NONE                              0
76410e230b6Smaya#define TRMODE_TILEYF                            1
76510e230b6Smaya#define TRMODE_TILEYS                            2
76610e230b6Smaya};
76710e230b6Smaya
76896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
76996c5ddc4SrjsGFX9_MEMORYADDRESSATTRIBUTES_pack(__attribute__((unused)) __gen_user_data *data,
77010e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
77196c5ddc4Srjs                                  __attribute__((unused)) const struct GFX9_MEMORYADDRESSATTRIBUTES * restrict values)
77210e230b6Smaya{
77310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
77410e230b6Smaya
77510e230b6Smaya   dw[0] =
77610e230b6Smaya      __gen_uint(values->MOCS, 1, 6) |
77710e230b6Smaya      __gen_uint(values->ArbitrationPriorityControl, 7, 8) |
77810e230b6Smaya      __gen_uint(values->MemoryCompressionEnable, 9, 9) |
77910e230b6Smaya      __gen_uint(values->RowStoreScratchBufferCacheSelect, 12, 12) |
78010e230b6Smaya      __gen_uint(values->TiledResourceMode, 13, 14);
78110e230b6Smaya}
78210e230b6Smaya
78396c5ddc4Srjs#define GFX9_HCP_PAK_INSERT_OBJECT_INDIRECT_PAYLOAD_length      4
78496c5ddc4Srjsstruct GFX9_HCP_PAK_INSERT_OBJECT_INDIRECT_PAYLOAD {
78510e230b6Smaya   uint32_t                             IndirectPayloadDataSizeinbits;
78610e230b6Smaya   __gen_address_type                   IndirectPayloadBaseAddress;
78796c5ddc4Srjs   struct GFX9_MEMORYADDRESSATTRIBUTES  IndirectPayloadBaseAddress2;
78810e230b6Smaya};
78910e230b6Smaya
79096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
79196c5ddc4SrjsGFX9_HCP_PAK_INSERT_OBJECT_INDIRECT_PAYLOAD_pack(__attribute__((unused)) __gen_user_data *data,
79210e230b6Smaya                                                 __attribute__((unused)) void * restrict dst,
79396c5ddc4Srjs                                                 __attribute__((unused)) const struct GFX9_HCP_PAK_INSERT_OBJECT_INDIRECT_PAYLOAD * restrict values)
79410e230b6Smaya{
79510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
79610e230b6Smaya
79710e230b6Smaya   dw[0] =
79810e230b6Smaya      __gen_uint(values->IndirectPayloadDataSizeinbits, 0, 31);
79910e230b6Smaya
80010e230b6Smaya   const uint64_t v1_address =
80196c5ddc4Srjs      __gen_address(data, &dw[1], values->IndirectPayloadBaseAddress, 0, 0, 63);
80210e230b6Smaya   dw[1] = v1_address;
80310e230b6Smaya   dw[2] = v1_address >> 32;
80410e230b6Smaya
80596c5ddc4Srjs   GFX9_MEMORYADDRESSATTRIBUTES_pack(data, &dw[3], &values->IndirectPayloadBaseAddress2);
80610e230b6Smaya}
80710e230b6Smaya
80896c5ddc4Srjs#define GFX9_HCP_REF_LIST_ENTRY_length         1
80996c5ddc4Srjsstruct GFX9_HCP_REF_LIST_ENTRY {
81010e230b6Smaya   uint32_t                             ReferencePicturetbValue;
81110e230b6Smaya   uint32_t                             ListEntry;
81210e230b6Smaya   uint32_t                             ChromaWeightedPrediction;
81310e230b6Smaya#define Default                                  0
81410e230b6Smaya#define Explicit                                 1
81510e230b6Smaya   uint32_t                             LumaWeightedPrediction;
81610e230b6Smaya#define Default                                  0
81710e230b6Smaya#define Explicit                                 1
81810e230b6Smaya   bool                                 LongTermReference;
81910e230b6Smaya   bool                                 FieldPic;
82010e230b6Smaya   bool                                 TopField;
82110e230b6Smaya};
82210e230b6Smaya
82396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
82496c5ddc4SrjsGFX9_HCP_REF_LIST_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
82510e230b6Smaya                             __attribute__((unused)) void * restrict dst,
82696c5ddc4Srjs                             __attribute__((unused)) const struct GFX9_HCP_REF_LIST_ENTRY * restrict values)
82710e230b6Smaya{
82810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
82910e230b6Smaya
83010e230b6Smaya   dw[0] =
83110e230b6Smaya      __gen_uint(values->ReferencePicturetbValue, 0, 7) |
83210e230b6Smaya      __gen_uint(values->ListEntry, 8, 10) |
83310e230b6Smaya      __gen_uint(values->ChromaWeightedPrediction, 11, 11) |
83410e230b6Smaya      __gen_uint(values->LumaWeightedPrediction, 12, 12) |
83510e230b6Smaya      __gen_uint(values->LongTermReference, 13, 13) |
83610e230b6Smaya      __gen_uint(values->FieldPic, 14, 14) |
83710e230b6Smaya      __gen_uint(values->TopField, 15, 15);
83810e230b6Smaya}
83910e230b6Smaya
84096c5ddc4Srjs#define GFX9_HCP_TILE_POSITION_IN_CTB_length      1
84196c5ddc4Srjsstruct GFX9_HCP_TILE_POSITION_IN_CTB {
84210e230b6Smaya   uint32_t                             CtbPos0i;
84310e230b6Smaya   uint32_t                             CtbPos1i;
84410e230b6Smaya   uint32_t                             CtbPos2i;
84510e230b6Smaya   uint32_t                             CtbPos3i;
84610e230b6Smaya};
84710e230b6Smaya
84896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
84996c5ddc4SrjsGFX9_HCP_TILE_POSITION_IN_CTB_pack(__attribute__((unused)) __gen_user_data *data,
85010e230b6Smaya                                   __attribute__((unused)) void * restrict dst,
85196c5ddc4Srjs                                   __attribute__((unused)) const struct GFX9_HCP_TILE_POSITION_IN_CTB * restrict values)
85210e230b6Smaya{
85310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
85410e230b6Smaya
85510e230b6Smaya   dw[0] =
85610e230b6Smaya      __gen_uint(values->CtbPos0i, 0, 7) |
85710e230b6Smaya      __gen_uint(values->CtbPos1i, 8, 15) |
85810e230b6Smaya      __gen_uint(values->CtbPos2i, 16, 23) |
85910e230b6Smaya      __gen_uint(values->CtbPos3i, 24, 31);
86010e230b6Smaya}
86110e230b6Smaya
86296c5ddc4Srjs#define GFX9_HCP_WEIGHTOFFSET_CHROMA_ENTRY_length      1
86396c5ddc4Srjsstruct GFX9_HCP_WEIGHTOFFSET_CHROMA_ENTRY {
86410e230b6Smaya   int32_t                              DeltaChromaWeightLX0;
86510e230b6Smaya   uint32_t                             ChromaOffsetLX0;
86610e230b6Smaya   int32_t                              DeltaChromaWeightLX1;
86710e230b6Smaya   uint32_t                             ChromaOffsetLX1;
86810e230b6Smaya};
86910e230b6Smaya
87096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
87196c5ddc4SrjsGFX9_HCP_WEIGHTOFFSET_CHROMA_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
87210e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
87396c5ddc4Srjs                                        __attribute__((unused)) const struct GFX9_HCP_WEIGHTOFFSET_CHROMA_ENTRY * restrict values)
87410e230b6Smaya{
87510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
87610e230b6Smaya
87710e230b6Smaya   dw[0] =
87810e230b6Smaya      __gen_sint(values->DeltaChromaWeightLX0, 0, 7) |
87910e230b6Smaya      __gen_uint(values->ChromaOffsetLX0, 8, 15) |
88010e230b6Smaya      __gen_sint(values->DeltaChromaWeightLX1, 16, 23) |
88110e230b6Smaya      __gen_uint(values->ChromaOffsetLX1, 24, 31);
88210e230b6Smaya}
88310e230b6Smaya
88496c5ddc4Srjs#define GFX9_HCP_WEIGHTOFFSET_LUMA_ENTRY_length      1
88596c5ddc4Srjsstruct GFX9_HCP_WEIGHTOFFSET_LUMA_ENTRY {
88610e230b6Smaya   int32_t                              DeltaLumaWeightLX;
88710e230b6Smaya   uint32_t                             LumaOffsetLX;
88810e230b6Smaya};
88910e230b6Smaya
89096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
89196c5ddc4SrjsGFX9_HCP_WEIGHTOFFSET_LUMA_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
89210e230b6Smaya                                      __attribute__((unused)) void * restrict dst,
89396c5ddc4Srjs                                      __attribute__((unused)) const struct GFX9_HCP_WEIGHTOFFSET_LUMA_ENTRY * restrict values)
89410e230b6Smaya{
89510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
89610e230b6Smaya
89710e230b6Smaya   dw[0] =
89810e230b6Smaya      __gen_sint(values->DeltaLumaWeightLX, 0, 7) |
89910e230b6Smaya      __gen_uint(values->LumaOffsetLX, 8, 15);
90010e230b6Smaya}
90110e230b6Smaya
90296c5ddc4Srjs#define GFX9_HEVC_ARBITRATION_PRIORITY_length      1
90396c5ddc4Srjsstruct GFX9_HEVC_ARBITRATION_PRIORITY {
90410e230b6Smaya   uint32_t                             Priority;
90510e230b6Smaya#define Highestpriority                          0
90610e230b6Smaya#define Secondhighestpriority                    1
90710e230b6Smaya#define Thirdhighestpriority                     2
90810e230b6Smaya#define Lowestpriority                           3
90910e230b6Smaya};
91010e230b6Smaya
91196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
91296c5ddc4SrjsGFX9_HEVC_ARBITRATION_PRIORITY_pack(__attribute__((unused)) __gen_user_data *data,
91310e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
91496c5ddc4Srjs                                    __attribute__((unused)) const struct GFX9_HEVC_ARBITRATION_PRIORITY * restrict values)
91510e230b6Smaya{
91610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
91710e230b6Smaya
91810e230b6Smaya   dw[0] =
91910e230b6Smaya      __gen_uint(values->Priority, 0, 1);
92010e230b6Smaya}
92110e230b6Smaya
92296c5ddc4Srjs#define GFX9_HEVC_VP9_RDOQ_LAMBDA_FIELDS_length      1
92396c5ddc4Srjsstruct GFX9_HEVC_VP9_RDOQ_LAMBDA_FIELDS {
92410e230b6Smaya   uint32_t                             LambdaValue0;
92510e230b6Smaya   uint32_t                             LambdaValue1;
92610e230b6Smaya};
92710e230b6Smaya
92896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
92996c5ddc4SrjsGFX9_HEVC_VP9_RDOQ_LAMBDA_FIELDS_pack(__attribute__((unused)) __gen_user_data *data,
93010e230b6Smaya                                      __attribute__((unused)) void * restrict dst,
93196c5ddc4Srjs                                      __attribute__((unused)) const struct GFX9_HEVC_VP9_RDOQ_LAMBDA_FIELDS * restrict values)
93210e230b6Smaya{
93310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
93410e230b6Smaya
93510e230b6Smaya   dw[0] =
93610e230b6Smaya      __gen_uint(values->LambdaValue0, 0, 15) |
93710e230b6Smaya      __gen_uint(values->LambdaValue1, 16, 31);
93810e230b6Smaya}
93910e230b6Smaya
94096c5ddc4Srjs#define GFX9_HUC_VIRTUAL_ADDR_REGION_length      3
94196c5ddc4Srjsstruct GFX9_HUC_VIRTUAL_ADDR_REGION {
94210e230b6Smaya   __gen_address_type                   Address;
94396c5ddc4Srjs   struct GFX9_MEMORYADDRESSATTRIBUTES  MemoryAddressAttributes;
94410e230b6Smaya};
94510e230b6Smaya
94696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
94796c5ddc4SrjsGFX9_HUC_VIRTUAL_ADDR_REGION_pack(__attribute__((unused)) __gen_user_data *data,
94810e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
94996c5ddc4Srjs                                  __attribute__((unused)) const struct GFX9_HUC_VIRTUAL_ADDR_REGION * restrict values)
95010e230b6Smaya{
95110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
95210e230b6Smaya
95310e230b6Smaya   const uint64_t v0_address =
95496c5ddc4Srjs      __gen_address(data, &dw[0], values->Address, 0, 0, 63);
95510e230b6Smaya   dw[0] = v0_address;
95610e230b6Smaya   dw[1] = v0_address >> 32;
95710e230b6Smaya
95896c5ddc4Srjs   GFX9_MEMORYADDRESSATTRIBUTES_pack(data, &dw[2], &values->MemoryAddressAttributes);
95910e230b6Smaya}
96010e230b6Smaya
96196c5ddc4Srjs#define GFX9_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT_length      3
96296c5ddc4Srjsstruct GFX9_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT {
96310e230b6Smaya   bool                                 MBErrorConcealmentPSliceWeightPredictionDisable;
96410e230b6Smaya   bool                                 MBErrorConcealmentPSliceMotionVectorsOverrideDisable;
96510e230b6Smaya   bool                                 MBErrorConcealmentBSpatialWeightPredictionDisable;
96610e230b6Smaya   bool                                 MBErrorConcealmentBSpatialMotionVectorsOverrideDisable;
96710e230b6Smaya   uint32_t                             MBErrorConcealmentBSpatialPredictionMode;
96810e230b6Smaya   bool                                 MBHeaderErrorHandling;
96910e230b6Smaya   bool                                 EntropyErrorHandling;
97010e230b6Smaya   bool                                 MPRErrorHandling;
97110e230b6Smaya   bool                                 BSDPrematureCompleteErrorHandling;
97210e230b6Smaya   uint32_t                             ConcealmentPictureID;
97310e230b6Smaya   bool                                 MBErrorConcealmentBTemporalWeightPredictionDisable;
97410e230b6Smaya   bool                                 MBErrorConcealmentBTemporalMotionVectorsOverrideEnable;
97510e230b6Smaya   uint32_t                             MBErrorConcealmentBTemporalPredictionMode;
97610e230b6Smaya   uint32_t                             IntraPredMode4x48x8LumaErrorControl;
97710e230b6Smaya   bool                                 InitCurrentMBNumber;
97810e230b6Smaya   uint32_t                             ConcealmentMethod;
97910e230b6Smaya   uint32_t                             FirstMBBitOffset;
98010e230b6Smaya   bool                                 LastSlice;
98110e230b6Smaya   bool                                 EmulationPreventionBytePresent;
98210e230b6Smaya   bool                                 FixPrevMBSkipped;
98310e230b6Smaya   uint32_t                             FirstMBByteOffsetofSliceDataorSliceHeader;
98410e230b6Smaya   bool                                 IntraPredictionErrorControl;
98510e230b6Smaya   bool                                 Intra8x84x4PredictionErrorConcealmentControl;
98610e230b6Smaya   uint32_t                             BSliceTemporalInterConcealmentMode;
98710e230b6Smaya   uint32_t                             BSliceSpatialInterConcealmentMode;
98810e230b6Smaya   uint32_t                             BSliceInterDirectTypeConcealmentMode;
98910e230b6Smaya   uint32_t                             BSliceConcealmentMode;
99010e230b6Smaya#define IntraConcealment                         1
99110e230b6Smaya#define InterConcealment                         0
99210e230b6Smaya   uint32_t                             PSliceInterConcealmentMode;
99310e230b6Smaya   uint32_t                             PSliceConcealmentMode;
99410e230b6Smaya#define IntraConcealment                         1
99510e230b6Smaya#define InterConcealment                         0
99610e230b6Smaya   uint32_t                             ConcealmentReferencePictureFieldBit;
99710e230b6Smaya   uint32_t                             ISliceConcealmentMode;
99810e230b6Smaya#define IntraConcealment                         1
99910e230b6Smaya#define InterConcealment                         0
100010e230b6Smaya};
100110e230b6Smaya
100296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
100396c5ddc4SrjsGFX9_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
100410e230b6Smaya                                                         __attribute__((unused)) void * restrict dst,
100596c5ddc4Srjs                                                         __attribute__((unused)) const struct GFX9_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT * restrict values)
100610e230b6Smaya{
100710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
100810e230b6Smaya
100910e230b6Smaya   dw[0] =
101010e230b6Smaya      __gen_uint(values->MBErrorConcealmentPSliceWeightPredictionDisable, 0, 0) |
101110e230b6Smaya      __gen_uint(values->MBErrorConcealmentPSliceMotionVectorsOverrideDisable, 1, 1) |
101210e230b6Smaya      __gen_uint(values->MBErrorConcealmentBSpatialWeightPredictionDisable, 3, 3) |
101310e230b6Smaya      __gen_uint(values->MBErrorConcealmentBSpatialMotionVectorsOverrideDisable, 4, 4) |
101410e230b6Smaya      __gen_uint(values->MBErrorConcealmentBSpatialPredictionMode, 6, 7) |
101510e230b6Smaya      __gen_uint(values->MBHeaderErrorHandling, 8, 8) |
101610e230b6Smaya      __gen_uint(values->EntropyErrorHandling, 10, 10) |
101710e230b6Smaya      __gen_uint(values->MPRErrorHandling, 12, 12) |
101810e230b6Smaya      __gen_uint(values->BSDPrematureCompleteErrorHandling, 14, 14) |
101910e230b6Smaya      __gen_uint(values->ConcealmentPictureID, 16, 21) |
102010e230b6Smaya      __gen_uint(values->MBErrorConcealmentBTemporalWeightPredictionDisable, 24, 24) |
102110e230b6Smaya      __gen_uint(values->MBErrorConcealmentBTemporalMotionVectorsOverrideEnable, 25, 25) |
102210e230b6Smaya      __gen_uint(values->MBErrorConcealmentBTemporalPredictionMode, 27, 28) |
102310e230b6Smaya      __gen_uint(values->IntraPredMode4x48x8LumaErrorControl, 29, 29) |
102410e230b6Smaya      __gen_uint(values->InitCurrentMBNumber, 30, 30) |
102510e230b6Smaya      __gen_uint(values->ConcealmentMethod, 31, 31);
102610e230b6Smaya
102710e230b6Smaya   dw[1] =
102810e230b6Smaya      __gen_uint(values->FirstMBBitOffset, 0, 2) |
102910e230b6Smaya      __gen_uint(values->LastSlice, 3, 3) |
103010e230b6Smaya      __gen_uint(values->EmulationPreventionBytePresent, 4, 4) |
103110e230b6Smaya      __gen_uint(values->FixPrevMBSkipped, 7, 7) |
103210e230b6Smaya      __gen_uint(values->FirstMBByteOffsetofSliceDataorSliceHeader, 16, 31);
103310e230b6Smaya
103410e230b6Smaya   dw[2] =
103510e230b6Smaya      __gen_uint(values->IntraPredictionErrorControl, 0, 0) |
103610e230b6Smaya      __gen_uint(values->Intra8x84x4PredictionErrorConcealmentControl, 1, 1) |
103710e230b6Smaya      __gen_uint(values->BSliceTemporalInterConcealmentMode, 4, 6) |
103810e230b6Smaya      __gen_uint(values->BSliceSpatialInterConcealmentMode, 8, 10) |
103910e230b6Smaya      __gen_uint(values->BSliceInterDirectTypeConcealmentMode, 12, 13) |
104010e230b6Smaya      __gen_uint(values->BSliceConcealmentMode, 15, 15) |
104110e230b6Smaya      __gen_uint(values->PSliceInterConcealmentMode, 16, 18) |
104210e230b6Smaya      __gen_uint(values->PSliceConcealmentMode, 23, 23) |
104310e230b6Smaya      __gen_uint(values->ConcealmentReferencePictureFieldBit, 24, 29) |
104410e230b6Smaya      __gen_uint(values->ISliceConcealmentMode, 31, 31);
104510e230b6Smaya}
104610e230b6Smaya
104796c5ddc4Srjs#define GFX9_INTERFACE_DESCRIPTOR_DATA_length      8
104896c5ddc4Srjsstruct GFX9_INTERFACE_DESCRIPTOR_DATA {
104910e230b6Smaya   uint64_t                             KernelStartPointer;
105010e230b6Smaya   bool                                 SoftwareExceptionEnable;
105110e230b6Smaya   bool                                 MaskStackExceptionEnable;
105210e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
105310e230b6Smaya   uint32_t                             FloatingPointMode;
105410e230b6Smaya#define IEEE754                                  0
105510e230b6Smaya#define Alternate                                1
105610e230b6Smaya   uint32_t                             ThreadPriority;
105710e230b6Smaya#define NormalPriority                           0
105810e230b6Smaya#define HighPriority                             1
105910e230b6Smaya   bool                                 SingleProgramFlow;
106010e230b6Smaya   uint32_t                             DenormMode;
106110e230b6Smaya#define Ftz                                      0
106210e230b6Smaya#define SetByKernel                              1
106310e230b6Smaya   uint32_t                             SamplerCount;
106410e230b6Smaya#define Nosamplersused                           0
106510e230b6Smaya#define Between1and4samplersused                 1
106610e230b6Smaya#define Between5and8samplersused                 2
106710e230b6Smaya#define Between9and12samplersused                3
106810e230b6Smaya#define Between13and16samplersused               4
106910e230b6Smaya   uint64_t                             SamplerStatePointer;
107010e230b6Smaya   uint32_t                             BindingTableEntryCount;
107110e230b6Smaya   uint64_t                             BindingTablePointer;
107210e230b6Smaya   uint32_t                             ConstantURBEntryReadOffset;
107310e230b6Smaya   uint32_t                             ConstantURBEntryReadLength;
107410e230b6Smaya   uint32_t                             NumberofThreadsinGPGPUThreadGroup;
107510e230b6Smaya   bool                                 GlobalBarrierEnable;
107610e230b6Smaya   uint32_t                             SharedLocalMemorySize;
107710e230b6Smaya#define Encodes0K                                0
107810e230b6Smaya#define Encodes1K                                1
107910e230b6Smaya#define Encodes2K                                2
108010e230b6Smaya#define Encodes4K                                3
108110e230b6Smaya#define Encodes8K                                4
108210e230b6Smaya#define Encodes16K                               5
108310e230b6Smaya#define Encodes32K                               6
108410e230b6Smaya#define Encodes64K                               7
108510e230b6Smaya   bool                                 BarrierEnable;
108610e230b6Smaya   uint32_t                             RoundingMode;
108710e230b6Smaya#define RTNE                                     0
108810e230b6Smaya#define RU                                       1
108910e230b6Smaya#define RD                                       2
109010e230b6Smaya#define RTZ                                      3
109110e230b6Smaya   uint32_t                             CrossThreadConstantDataReadLength;
109210e230b6Smaya};
109310e230b6Smaya
109496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
109596c5ddc4SrjsGFX9_INTERFACE_DESCRIPTOR_DATA_pack(__attribute__((unused)) __gen_user_data *data,
109610e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
109796c5ddc4Srjs                                    __attribute__((unused)) const struct GFX9_INTERFACE_DESCRIPTOR_DATA * restrict values)
109810e230b6Smaya{
109910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
110010e230b6Smaya
110110e230b6Smaya   const uint64_t v0 =
110210e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 47);
110310e230b6Smaya   dw[0] = v0;
110410e230b6Smaya   dw[1] = v0 >> 32;
110510e230b6Smaya
110610e230b6Smaya   dw[2] =
110710e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
110810e230b6Smaya      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
110910e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
111010e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
111110e230b6Smaya      __gen_uint(values->ThreadPriority, 17, 17) |
111210e230b6Smaya      __gen_uint(values->SingleProgramFlow, 18, 18) |
111310e230b6Smaya      __gen_uint(values->DenormMode, 19, 19);
111410e230b6Smaya
111510e230b6Smaya   dw[3] =
111610e230b6Smaya      __gen_uint(values->SamplerCount, 2, 4) |
111710e230b6Smaya      __gen_offset(values->SamplerStatePointer, 5, 31);
111810e230b6Smaya
111910e230b6Smaya   dw[4] =
112010e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 0, 4) |
112110e230b6Smaya      __gen_offset(values->BindingTablePointer, 5, 15);
112210e230b6Smaya
112310e230b6Smaya   dw[5] =
112410e230b6Smaya      __gen_uint(values->ConstantURBEntryReadOffset, 0, 15) |
112510e230b6Smaya      __gen_uint(values->ConstantURBEntryReadLength, 16, 31);
112610e230b6Smaya
112710e230b6Smaya   dw[6] =
112810e230b6Smaya      __gen_uint(values->NumberofThreadsinGPGPUThreadGroup, 0, 9) |
112910e230b6Smaya      __gen_uint(values->GlobalBarrierEnable, 15, 15) |
113010e230b6Smaya      __gen_uint(values->SharedLocalMemorySize, 16, 20) |
113110e230b6Smaya      __gen_uint(values->BarrierEnable, 21, 21) |
113210e230b6Smaya      __gen_uint(values->RoundingMode, 22, 23);
113310e230b6Smaya
113410e230b6Smaya   dw[7] =
113510e230b6Smaya      __gen_uint(values->CrossThreadConstantDataReadLength, 0, 7);
113610e230b6Smaya}
113710e230b6Smaya
113896c5ddc4Srjs#define GFX9_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION_length      2
113996c5ddc4Srjsstruct GFX9_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION {
114010e230b6Smaya   uint32_t                             FirstMBBitOffset;
114110e230b6Smaya   bool                                 LastMB;
114210e230b6Smaya   bool                                 LastPicSlice;
114310e230b6Smaya   uint32_t                             SliceConcealmentType;
114410e230b6Smaya   uint32_t                             SliceConcealmentOverride;
114510e230b6Smaya   uint32_t                             MBCount;
114610e230b6Smaya   uint32_t                             SliceVerticalPosition;
114710e230b6Smaya   uint32_t                             SliceHorizontalPosition;
114810e230b6Smaya   uint32_t                             NextSliceHorizontalPosition;
114910e230b6Smaya   uint32_t                             NextSliceVerticalPosition;
115010e230b6Smaya   uint32_t                             QuantizerScaleCode;
115110e230b6Smaya};
115210e230b6Smaya
115396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
115496c5ddc4SrjsGFX9_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION_pack(__attribute__((unused)) __gen_user_data *data,
115510e230b6Smaya                                                       __attribute__((unused)) void * restrict dst,
115696c5ddc4Srjs                                                       __attribute__((unused)) const struct GFX9_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION * restrict values)
115710e230b6Smaya{
115810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
115910e230b6Smaya
116010e230b6Smaya   dw[0] =
116110e230b6Smaya      __gen_uint(values->FirstMBBitOffset, 0, 2) |
116210e230b6Smaya      __gen_uint(values->LastMB, 3, 3) |
116310e230b6Smaya      __gen_uint(values->LastPicSlice, 5, 5) |
116410e230b6Smaya      __gen_uint(values->SliceConcealmentType, 6, 6) |
116510e230b6Smaya      __gen_uint(values->SliceConcealmentOverride, 7, 7) |
116610e230b6Smaya      __gen_uint(values->MBCount, 8, 15) |
116710e230b6Smaya      __gen_uint(values->SliceVerticalPosition, 16, 23) |
116810e230b6Smaya      __gen_uint(values->SliceHorizontalPosition, 24, 31);
116910e230b6Smaya
117010e230b6Smaya   dw[1] =
117110e230b6Smaya      __gen_uint(values->NextSliceHorizontalPosition, 0, 7) |
117210e230b6Smaya      __gen_uint(values->NextSliceVerticalPosition, 8, 16) |
117310e230b6Smaya      __gen_uint(values->QuantizerScaleCode, 24, 28);
117410e230b6Smaya}
117510e230b6Smaya
117696c5ddc4Srjs#define GFX9_MI_MATH_ALU_INSTRUCTION_length      1
117796c5ddc4Srjsstruct GFX9_MI_MATH_ALU_INSTRUCTION {
117810e230b6Smaya   uint32_t                             Operand2;
117910e230b6Smaya#define MI_ALU_REG0                              0
118010e230b6Smaya#define MI_ALU_REG1                              1
118110e230b6Smaya#define MI_ALU_REG2                              2
118210e230b6Smaya#define MI_ALU_REG3                              3
118310e230b6Smaya#define MI_ALU_REG4                              4
118410e230b6Smaya#define MI_ALU_REG5                              5
118510e230b6Smaya#define MI_ALU_REG6                              6
118610e230b6Smaya#define MI_ALU_REG7                              7
118710e230b6Smaya#define MI_ALU_REG8                              8
118810e230b6Smaya#define MI_ALU_REG9                              9
118910e230b6Smaya#define MI_ALU_REG10                             10
119010e230b6Smaya#define MI_ALU_REG11                             11
119110e230b6Smaya#define MI_ALU_REG12                             12
119210e230b6Smaya#define MI_ALU_REG13                             13
119310e230b6Smaya#define MI_ALU_REG14                             14
119410e230b6Smaya#define MI_ALU_REG15                             15
119510e230b6Smaya#define MI_ALU_SRCA                              32
119610e230b6Smaya#define MI_ALU_SRCB                              33
119710e230b6Smaya#define MI_ALU_ACCU                              49
119810e230b6Smaya#define MI_ALU_ZF                                50
119910e230b6Smaya#define MI_ALU_CF                                51
120010e230b6Smaya   uint32_t                             Operand1;
120110e230b6Smaya#define MI_ALU_REG0                              0
120210e230b6Smaya#define MI_ALU_REG1                              1
120310e230b6Smaya#define MI_ALU_REG2                              2
120410e230b6Smaya#define MI_ALU_REG3                              3
120510e230b6Smaya#define MI_ALU_REG4                              4
120610e230b6Smaya#define MI_ALU_REG5                              5
120710e230b6Smaya#define MI_ALU_REG6                              6
120810e230b6Smaya#define MI_ALU_REG7                              7
120910e230b6Smaya#define MI_ALU_REG8                              8
121010e230b6Smaya#define MI_ALU_REG9                              9
121110e230b6Smaya#define MI_ALU_REG10                             10
121210e230b6Smaya#define MI_ALU_REG11                             11
121310e230b6Smaya#define MI_ALU_REG12                             12
121410e230b6Smaya#define MI_ALU_REG13                             13
121510e230b6Smaya#define MI_ALU_REG14                             14
121610e230b6Smaya#define MI_ALU_REG15                             15
121710e230b6Smaya#define MI_ALU_SRCA                              32
121810e230b6Smaya#define MI_ALU_SRCB                              33
121910e230b6Smaya#define MI_ALU_ACCU                              49
122010e230b6Smaya#define MI_ALU_ZF                                50
122110e230b6Smaya#define MI_ALU_CF                                51
122210e230b6Smaya   uint32_t                             ALUOpcode;
122310e230b6Smaya#define MI_ALU_NOOP                              0
122410e230b6Smaya#define MI_ALU_LOAD                              128
122510e230b6Smaya#define MI_ALU_LOADINV                           1152
122610e230b6Smaya#define MI_ALU_LOAD0                             129
122710e230b6Smaya#define MI_ALU_LOAD1                             1153
122810e230b6Smaya#define MI_ALU_ADD                               256
122910e230b6Smaya#define MI_ALU_SUB                               257
123010e230b6Smaya#define MI_ALU_AND                               258
123110e230b6Smaya#define MI_ALU_OR                                259
123210e230b6Smaya#define MI_ALU_XOR                               260
123310e230b6Smaya#define MI_ALU_STORE                             384
123410e230b6Smaya#define MI_ALU_STOREINV                          1408
123510e230b6Smaya};
123610e230b6Smaya
123796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
123896c5ddc4SrjsGFX9_MI_MATH_ALU_INSTRUCTION_pack(__attribute__((unused)) __gen_user_data *data,
123910e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
124096c5ddc4Srjs                                  __attribute__((unused)) const struct GFX9_MI_MATH_ALU_INSTRUCTION * restrict values)
124110e230b6Smaya{
124210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
124310e230b6Smaya
124410e230b6Smaya   dw[0] =
124510e230b6Smaya      __gen_uint(values->Operand2, 0, 9) |
124610e230b6Smaya      __gen_uint(values->Operand1, 10, 19) |
124710e230b6Smaya      __gen_uint(values->ALUOpcode, 20, 31);
124810e230b6Smaya}
124910e230b6Smaya
125096c5ddc4Srjs#define GFX9_PALETTE_ENTRY_length              1
125196c5ddc4Srjsstruct GFX9_PALETTE_ENTRY {
125210e230b6Smaya   uint32_t                             Blue;
125310e230b6Smaya   uint32_t                             Green;
125410e230b6Smaya   uint32_t                             Red;
125510e230b6Smaya   uint32_t                             Alpha;
125610e230b6Smaya};
125710e230b6Smaya
125896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
125996c5ddc4SrjsGFX9_PALETTE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
126010e230b6Smaya                        __attribute__((unused)) void * restrict dst,
126196c5ddc4Srjs                        __attribute__((unused)) const struct GFX9_PALETTE_ENTRY * restrict values)
126210e230b6Smaya{
126310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
126410e230b6Smaya
126510e230b6Smaya   dw[0] =
126610e230b6Smaya      __gen_uint(values->Blue, 0, 7) |
126710e230b6Smaya      __gen_uint(values->Green, 8, 15) |
126810e230b6Smaya      __gen_uint(values->Red, 16, 23) |
126910e230b6Smaya      __gen_uint(values->Alpha, 24, 31);
127010e230b6Smaya}
127110e230b6Smaya
127296c5ddc4Srjs#define GFX9_RENDER_SURFACE_STATE_length      16
127396c5ddc4Srjsstruct GFX9_RENDER_SURFACE_STATE {
127410e230b6Smaya   bool                                 CubeFaceEnablePositiveZ;
127510e230b6Smaya   bool                                 CubeFaceEnableNegativeZ;
127610e230b6Smaya   bool                                 CubeFaceEnablePositiveY;
127710e230b6Smaya   bool                                 CubeFaceEnableNegativeY;
127810e230b6Smaya   bool                                 CubeFaceEnablePositiveX;
127910e230b6Smaya   bool                                 CubeFaceEnableNegativeX;
128010e230b6Smaya   uint32_t                             MediaBoundaryPixelMode;
128110e230b6Smaya#define NORMAL_MODE                              0
128210e230b6Smaya#define PROGRESSIVE_FRAME                        2
128310e230b6Smaya#define INTERLACED_FRAME                         3
128410e230b6Smaya   uint32_t                             RenderCacheReadWriteMode;
128510e230b6Smaya#define WriteOnlyCache                           0
128610e230b6Smaya#define ReadWriteCache                           1
128710e230b6Smaya   bool                                 SamplerL2BypassModeDisable;
128810e230b6Smaya   uint32_t                             VerticalLineStrideOffset;
128910e230b6Smaya   uint32_t                             VerticalLineStride;
129010e230b6Smaya   uint32_t                             TileMode;
129110e230b6Smaya#define LINEAR                                   0
129210e230b6Smaya#define WMAJOR                                   1
129310e230b6Smaya#define XMAJOR                                   2
129410e230b6Smaya#define YMAJOR                                   3
129510e230b6Smaya   uint32_t                             SurfaceHorizontalAlignment;
129696c5ddc4Srjs#define HALIGN_4                                 1
129796c5ddc4Srjs#define HALIGN_8                                 2
129896c5ddc4Srjs#define HALIGN_16                                3
129910e230b6Smaya   uint32_t                             SurfaceVerticalAlignment;
130096c5ddc4Srjs#define VALIGN_4                                 1
130196c5ddc4Srjs#define VALIGN_8                                 2
130296c5ddc4Srjs#define VALIGN_16                                3
130310e230b6Smaya   uint32_t                             SurfaceFormat;
130410e230b6Smaya   bool                                 SurfaceArray;
130510e230b6Smaya   uint32_t                             SurfaceType;
130610e230b6Smaya#define SURFTYPE_1D                              0
130710e230b6Smaya#define SURFTYPE_2D                              1
130810e230b6Smaya#define SURFTYPE_3D                              2
130910e230b6Smaya#define SURFTYPE_CUBE                            3
131010e230b6Smaya#define SURFTYPE_BUFFER                          4
131110e230b6Smaya#define SURFTYPE_STRBUF                          5
131210e230b6Smaya#define SURFTYPE_NULL                            7
131310e230b6Smaya   uint32_t                             SurfaceQPitch;
131410e230b6Smaya   float                                BaseMipLevel;
131510e230b6Smaya   uint32_t                             MOCS;
131610e230b6Smaya   uint32_t                             Width;
131710e230b6Smaya   uint32_t                             Height;
131810e230b6Smaya   uint32_t                             SurfacePitch;
131910e230b6Smaya   uint32_t                             Depth;
132010e230b6Smaya   uint32_t                             MultisamplePositionPaletteIndex;
132110e230b6Smaya   uint32_t                             NumberofMultisamples;
132210e230b6Smaya#define MULTISAMPLECOUNT_1                       0
132310e230b6Smaya#define MULTISAMPLECOUNT_2                       1
132410e230b6Smaya#define MULTISAMPLECOUNT_4                       2
132510e230b6Smaya#define MULTISAMPLECOUNT_8                       3
132610e230b6Smaya#define MULTISAMPLECOUNT_16                      4
132710e230b6Smaya   uint32_t                             MultisampledSurfaceStorageFormat;
132810e230b6Smaya#define MSFMT_MSS                                0
132910e230b6Smaya#define MSFMT_DEPTH_STENCIL                      1
133010e230b6Smaya   uint32_t                             RenderTargetViewExtent;
133110e230b6Smaya   uint32_t                             MinimumArrayElement;
133210e230b6Smaya   uint32_t                             RenderTargetAndSampleUnormRotation;
133310e230b6Smaya#define _0DEG                                    0
133410e230b6Smaya#define _90DEG                                   1
133510e230b6Smaya#define _180DEG                                  2
133610e230b6Smaya#define _270DEG                                  3
133710e230b6Smaya   uint32_t                             MIPCountLOD;
133810e230b6Smaya   uint32_t                             SurfaceMinLOD;
133910e230b6Smaya   uint32_t                             MipTailStartLOD;
134010e230b6Smaya   uint32_t                             CoherencyType;
134110e230b6Smaya#define GPUcoherent                              0
134210e230b6Smaya#define IAcoherent                               1
134310e230b6Smaya   uint32_t                             TiledResourceMode;
134410e230b6Smaya#define NONE                                     0
134510e230b6Smaya#define _4KB                                     1
134610e230b6Smaya#define _64KB                                    2
134710e230b6Smaya#define TILEYF                                   1
134810e230b6Smaya#define TILEYS                                   2
134910e230b6Smaya   bool                                 EWADisableForCube;
135010e230b6Smaya   uint32_t                             YOffset;
135110e230b6Smaya   uint32_t                             XOffset;
135210e230b6Smaya   uint32_t                             AuxiliarySurfaceMode;
135310e230b6Smaya#define AUX_NONE                                 0
135410e230b6Smaya#define AUX_CCS_D                                1
135510e230b6Smaya#define AUX_APPEND                               2
135610e230b6Smaya#define AUX_HIZ                                  3
135710e230b6Smaya#define AUX_CCS_E                                5
135810e230b6Smaya   uint32_t                             YOffsetforUorUVPlane;
135910e230b6Smaya   uint32_t                             AuxiliarySurfacePitch;
136010e230b6Smaya   uint32_t                             AuxiliarySurfaceQPitch;
136110e230b6Smaya   uint32_t                             XOffsetforUorUVPlane;
136210e230b6Smaya   bool                                 SeparateUVPlaneEnable;
136310e230b6Smaya   float                                ResourceMinLOD;
136496c5ddc4Srjs   enum GFX9_ShaderChannelSelect        ShaderChannelSelectAlpha;
136596c5ddc4Srjs   enum GFX9_ShaderChannelSelect        ShaderChannelSelectBlue;
136696c5ddc4Srjs   enum GFX9_ShaderChannelSelect        ShaderChannelSelectGreen;
136796c5ddc4Srjs   enum GFX9_ShaderChannelSelect        ShaderChannelSelectRed;
136810e230b6Smaya   bool                                 MemoryCompressionEnable;
136910e230b6Smaya   uint32_t                             MemoryCompressionMode;
137010e230b6Smaya#define Horizontal                               0
137110e230b6Smaya#define Vertical                                 1
137210e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
137310e230b6Smaya   uint32_t                             QuiltWidth;
137410e230b6Smaya   uint32_t                             QuiltHeight;
137510e230b6Smaya   __gen_address_type                   AuxiliarySurfaceBaseAddress;
137610e230b6Smaya   uint32_t                             AuxiliaryTableIndexforMediaCompressedSurface;
137710e230b6Smaya   uint32_t                             YOffsetforVPlane;
137810e230b6Smaya   uint32_t                             XOffsetforVPlane;
137910e230b6Smaya   float                                HierarchicalDepthClearValue;
138010e230b6Smaya   int32_t                              RedClearColor;
138110e230b6Smaya   int32_t                              GreenClearColor;
138210e230b6Smaya   int32_t                              BlueClearColor;
138310e230b6Smaya   int32_t                              AlphaClearColor;
138410e230b6Smaya};
138510e230b6Smaya
138696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
138796c5ddc4SrjsGFX9_RENDER_SURFACE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
138810e230b6Smaya                               __attribute__((unused)) void * restrict dst,
138996c5ddc4Srjs                               __attribute__((unused)) const struct GFX9_RENDER_SURFACE_STATE * restrict values)
139010e230b6Smaya{
139110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
139210e230b6Smaya
139310e230b6Smaya   dw[0] =
139410e230b6Smaya      __gen_uint(values->CubeFaceEnablePositiveZ, 0, 0) |
139510e230b6Smaya      __gen_uint(values->CubeFaceEnableNegativeZ, 1, 1) |
139610e230b6Smaya      __gen_uint(values->CubeFaceEnablePositiveY, 2, 2) |
139710e230b6Smaya      __gen_uint(values->CubeFaceEnableNegativeY, 3, 3) |
139810e230b6Smaya      __gen_uint(values->CubeFaceEnablePositiveX, 4, 4) |
139910e230b6Smaya      __gen_uint(values->CubeFaceEnableNegativeX, 5, 5) |
140010e230b6Smaya      __gen_uint(values->MediaBoundaryPixelMode, 6, 7) |
140110e230b6Smaya      __gen_uint(values->RenderCacheReadWriteMode, 8, 8) |
140210e230b6Smaya      __gen_uint(values->SamplerL2BypassModeDisable, 9, 9) |
140310e230b6Smaya      __gen_uint(values->VerticalLineStrideOffset, 10, 10) |
140410e230b6Smaya      __gen_uint(values->VerticalLineStride, 11, 11) |
140510e230b6Smaya      __gen_uint(values->TileMode, 12, 13) |
140610e230b6Smaya      __gen_uint(values->SurfaceHorizontalAlignment, 14, 15) |
140710e230b6Smaya      __gen_uint(values->SurfaceVerticalAlignment, 16, 17) |
140810e230b6Smaya      __gen_uint(values->SurfaceFormat, 18, 27) |
140910e230b6Smaya      __gen_uint(values->SurfaceArray, 28, 28) |
141010e230b6Smaya      __gen_uint(values->SurfaceType, 29, 31);
141110e230b6Smaya
141210e230b6Smaya   dw[1] =
141310e230b6Smaya      __gen_uint(values->SurfaceQPitch, 0, 14) |
141410e230b6Smaya      __gen_ufixed(values->BaseMipLevel, 19, 23, 1) |
141510e230b6Smaya      __gen_uint(values->MOCS, 24, 30);
141610e230b6Smaya
141710e230b6Smaya   dw[2] =
141810e230b6Smaya      __gen_uint(values->Width, 0, 13) |
141910e230b6Smaya      __gen_uint(values->Height, 16, 29);
142010e230b6Smaya
142110e230b6Smaya   dw[3] =
142210e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 17) |
142310e230b6Smaya      __gen_uint(values->Depth, 21, 31);
142410e230b6Smaya
142510e230b6Smaya   dw[4] =
142610e230b6Smaya      __gen_uint(values->MultisamplePositionPaletteIndex, 0, 2) |
142710e230b6Smaya      __gen_uint(values->NumberofMultisamples, 3, 5) |
142810e230b6Smaya      __gen_uint(values->MultisampledSurfaceStorageFormat, 6, 6) |
142910e230b6Smaya      __gen_uint(values->RenderTargetViewExtent, 7, 17) |
143010e230b6Smaya      __gen_uint(values->MinimumArrayElement, 18, 28) |
143110e230b6Smaya      __gen_uint(values->RenderTargetAndSampleUnormRotation, 29, 30);
143210e230b6Smaya
143310e230b6Smaya   dw[5] =
143410e230b6Smaya      __gen_uint(values->MIPCountLOD, 0, 3) |
143510e230b6Smaya      __gen_uint(values->SurfaceMinLOD, 4, 7) |
143610e230b6Smaya      __gen_uint(values->MipTailStartLOD, 8, 11) |
143710e230b6Smaya      __gen_uint(values->CoherencyType, 14, 14) |
143810e230b6Smaya      __gen_uint(values->TiledResourceMode, 18, 19) |
143910e230b6Smaya      __gen_uint(values->EWADisableForCube, 20, 20) |
144010e230b6Smaya      __gen_uint(values->YOffset, 21, 23) |
144110e230b6Smaya      __gen_uint(values->XOffset, 25, 31);
144210e230b6Smaya
144310e230b6Smaya   dw[6] =
144410e230b6Smaya      __gen_uint(values->AuxiliarySurfaceMode, 0, 2) |
144510e230b6Smaya      __gen_uint(values->YOffsetforUorUVPlane, 0, 13) |
144610e230b6Smaya      __gen_uint(values->AuxiliarySurfacePitch, 3, 11) |
144710e230b6Smaya      __gen_uint(values->AuxiliarySurfaceQPitch, 16, 30) |
144810e230b6Smaya      __gen_uint(values->XOffsetforUorUVPlane, 16, 29) |
144910e230b6Smaya      __gen_uint(values->SeparateUVPlaneEnable, 31, 31);
145010e230b6Smaya
145110e230b6Smaya   dw[7] =
145210e230b6Smaya      __gen_ufixed(values->ResourceMinLOD, 0, 11, 8) |
145310e230b6Smaya      __gen_uint(values->ShaderChannelSelectAlpha, 16, 18) |
145410e230b6Smaya      __gen_uint(values->ShaderChannelSelectBlue, 19, 21) |
145510e230b6Smaya      __gen_uint(values->ShaderChannelSelectGreen, 22, 24) |
145610e230b6Smaya      __gen_uint(values->ShaderChannelSelectRed, 25, 27) |
145710e230b6Smaya      __gen_uint(values->MemoryCompressionEnable, 30, 30) |
145810e230b6Smaya      __gen_uint(values->MemoryCompressionMode, 31, 31);
145910e230b6Smaya
146010e230b6Smaya   const uint64_t v8_address =
146196c5ddc4Srjs      __gen_address(data, &dw[8], values->SurfaceBaseAddress, 0, 0, 63);
146210e230b6Smaya   dw[8] = v8_address;
146310e230b6Smaya   dw[9] = v8_address >> 32;
146410e230b6Smaya
146510e230b6Smaya   const uint64_t v10 =
146610e230b6Smaya      __gen_uint(values->QuiltWidth, 0, 4) |
146710e230b6Smaya      __gen_uint(values->QuiltHeight, 5, 9) |
146810e230b6Smaya      __gen_uint(values->AuxiliaryTableIndexforMediaCompressedSurface, 21, 31) |
146910e230b6Smaya      __gen_uint(values->YOffsetforVPlane, 32, 45) |
147010e230b6Smaya      __gen_uint(values->XOffsetforVPlane, 48, 61);
147110e230b6Smaya   const uint64_t v10_address =
147296c5ddc4Srjs      __gen_address(data, &dw[10], values->AuxiliarySurfaceBaseAddress, v10, 12, 63);
147310e230b6Smaya   dw[10] = v10_address;
147410e230b6Smaya   dw[11] = (v10_address >> 32) | (v10 >> 32);
147510e230b6Smaya
147610e230b6Smaya   dw[12] =
147710e230b6Smaya      __gen_float(values->HierarchicalDepthClearValue) |
147810e230b6Smaya      __gen_sint(values->RedClearColor, 0, 31);
147910e230b6Smaya
148010e230b6Smaya   dw[13] =
148110e230b6Smaya      __gen_sint(values->GreenClearColor, 0, 31);
148210e230b6Smaya
148310e230b6Smaya   dw[14] =
148410e230b6Smaya      __gen_sint(values->BlueClearColor, 0, 31);
148510e230b6Smaya
148610e230b6Smaya   dw[15] =
148710e230b6Smaya      __gen_sint(values->AlphaClearColor, 0, 31);
148810e230b6Smaya}
148910e230b6Smaya
149096c5ddc4Srjs#define GFX9_ROUNDINGPRECISIONTABLE_3_BITS_length      1
149196c5ddc4Srjsstruct GFX9_ROUNDINGPRECISIONTABLE_3_BITS {
149210e230b6Smaya   uint32_t                             RoundingPrecision;
149310e230b6Smaya#define _116                                     0
149410e230b6Smaya#define _216                                     1
149510e230b6Smaya#define _316                                     2
149610e230b6Smaya#define _416                                     3
149710e230b6Smaya#define _516                                     4
149810e230b6Smaya#define _616                                     5
149910e230b6Smaya#define _716                                     6
150010e230b6Smaya#define _816                                     7
150110e230b6Smaya};
150210e230b6Smaya
150396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
150496c5ddc4SrjsGFX9_ROUNDINGPRECISIONTABLE_3_BITS_pack(__attribute__((unused)) __gen_user_data *data,
150510e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
150696c5ddc4Srjs                                        __attribute__((unused)) const struct GFX9_ROUNDINGPRECISIONTABLE_3_BITS * restrict values)
150710e230b6Smaya{
150810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
150910e230b6Smaya
151010e230b6Smaya   dw[0] =
151110e230b6Smaya      __gen_uint(values->RoundingPrecision, 0, 2);
151210e230b6Smaya}
151310e230b6Smaya
151496c5ddc4Srjs#define GFX9_SAMPLER_BORDER_COLOR_STATE_length      4
151596c5ddc4Srjsstruct GFX9_SAMPLER_BORDER_COLOR_STATE {
151610e230b6Smaya   float                                BorderColorFloatRed;
151710e230b6Smaya   uint32_t                             BorderColor32bitRed;
151810e230b6Smaya   float                                BorderColorFloatGreen;
151910e230b6Smaya   uint32_t                             BorderColor32bitGreen;
152010e230b6Smaya   float                                BorderColorFloatBlue;
152110e230b6Smaya   uint32_t                             BorderColor32bitBlue;
152210e230b6Smaya   float                                BorderColorFloatAlpha;
152310e230b6Smaya   uint32_t                             BorderColor32bitAlpha;
152410e230b6Smaya};
152510e230b6Smaya
152696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
152796c5ddc4SrjsGFX9_SAMPLER_BORDER_COLOR_STATE_pack(__attribute__((unused)) __gen_user_data *data,
152810e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
152996c5ddc4Srjs                                     __attribute__((unused)) const struct GFX9_SAMPLER_BORDER_COLOR_STATE * restrict values)
153010e230b6Smaya{
153110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
153210e230b6Smaya
153310e230b6Smaya   dw[0] =
153410e230b6Smaya      __gen_float(values->BorderColorFloatRed) |
153510e230b6Smaya      __gen_uint(values->BorderColor32bitRed, 0, 31);
153610e230b6Smaya
153710e230b6Smaya   dw[1] =
153810e230b6Smaya      __gen_float(values->BorderColorFloatGreen) |
153910e230b6Smaya      __gen_uint(values->BorderColor32bitGreen, 0, 31);
154010e230b6Smaya
154110e230b6Smaya   dw[2] =
154210e230b6Smaya      __gen_float(values->BorderColorFloatBlue) |
154310e230b6Smaya      __gen_uint(values->BorderColor32bitBlue, 0, 31);
154410e230b6Smaya
154510e230b6Smaya   dw[3] =
154610e230b6Smaya      __gen_float(values->BorderColorFloatAlpha) |
154710e230b6Smaya      __gen_uint(values->BorderColor32bitAlpha, 0, 31);
154810e230b6Smaya}
154910e230b6Smaya
155096c5ddc4Srjs#define GFX9_SAMPLER_STATE_length              4
155196c5ddc4Srjsstruct GFX9_SAMPLER_STATE {
155210e230b6Smaya   uint32_t                             AnisotropicAlgorithm;
155310e230b6Smaya#define LEGACY                                   0
155410e230b6Smaya#define EWAApproximation                         1
155510e230b6Smaya   float                                TextureLODBias;
155610e230b6Smaya   uint32_t                             MinModeFilter;
155710e230b6Smaya#define MAPFILTER_NEAREST                        0
155810e230b6Smaya#define MAPFILTER_LINEAR                         1
155910e230b6Smaya#define MAPFILTER_ANISOTROPIC                    2
156010e230b6Smaya#define MAPFILTER_MONO                           6
156110e230b6Smaya   uint32_t                             MagModeFilter;
156210e230b6Smaya#define MAPFILTER_NEAREST                        0
156310e230b6Smaya#define MAPFILTER_LINEAR                         1
156410e230b6Smaya#define MAPFILTER_ANISOTROPIC                    2
156510e230b6Smaya#define MAPFILTER_MONO                           6
156610e230b6Smaya   uint32_t                             MipModeFilter;
156710e230b6Smaya#define MIPFILTER_NONE                           0
156810e230b6Smaya#define MIPFILTER_NEAREST                        1
156910e230b6Smaya#define MIPFILTER_LINEAR                         3
157010e230b6Smaya   uint32_t                             CoarseLODQualityMode;
157110e230b6Smaya   uint32_t                             LODPreClampMode;
157210e230b6Smaya#define CLAMP_MODE_NONE                          0
157310e230b6Smaya#define CLAMP_MODE_OGL                           2
157410e230b6Smaya   uint32_t                             TextureBorderColorMode;
157510e230b6Smaya#define DX10OGL                                  0
157610e230b6Smaya#define DX9                                      1
157710e230b6Smaya   bool                                 SamplerDisable;
157810e230b6Smaya   uint32_t                             CubeSurfaceControlMode;
157910e230b6Smaya#define PROGRAMMED                               0
158010e230b6Smaya#define OVERRIDE                                 1
158110e230b6Smaya   uint32_t                             ShadowFunction;
158296c5ddc4Srjs#define PREFILTEROP_ALWAYS                       0
158396c5ddc4Srjs#define PREFILTEROP_NEVER                        1
158496c5ddc4Srjs#define PREFILTEROP_LESS                         2
158596c5ddc4Srjs#define PREFILTEROP_EQUAL                        3
158696c5ddc4Srjs#define PREFILTEROP_LEQUAL                       4
158796c5ddc4Srjs#define PREFILTEROP_GREATER                      5
158896c5ddc4Srjs#define PREFILTEROP_NOTEQUAL                     6
158996c5ddc4Srjs#define PREFILTEROP_GEQUAL                       7
159010e230b6Smaya   uint32_t                             ChromaKeyMode;
159110e230b6Smaya#define KEYFILTER_KILL_ON_ANY_MATCH              0
159210e230b6Smaya#define KEYFILTER_REPLACE_BLACK                  1
159310e230b6Smaya   uint32_t                             ChromaKeyIndex;
159410e230b6Smaya   bool                                 ChromaKeyEnable;
159510e230b6Smaya   float                                MaxLOD;
159610e230b6Smaya   float                                MinLOD;
159710e230b6Smaya   uint32_t                             LODClampMagnificationMode;
159810e230b6Smaya#define MIPNONE                                  0
159910e230b6Smaya#define MIPFILTER                                1
160010e230b6Smaya   uint64_t                             BorderColorPointer;
160196c5ddc4Srjs   enum GFX9_TextureCoordinateMode      TCZAddressControlMode;
160296c5ddc4Srjs   enum GFX9_TextureCoordinateMode      TCYAddressControlMode;
160396c5ddc4Srjs   enum GFX9_TextureCoordinateMode      TCXAddressControlMode;
160410e230b6Smaya   bool                                 ReductionTypeEnable;
160510e230b6Smaya   bool                                 NonnormalizedCoordinateEnable;
160610e230b6Smaya   uint32_t                             TrilinearFilterQuality;
160710e230b6Smaya#define FULL                                     0
160810e230b6Smaya#define HIGH                                     1
160910e230b6Smaya#define MED                                      2
161010e230b6Smaya#define LOW                                      3
161110e230b6Smaya   bool                                 RAddressMinFilterRoundingEnable;
161210e230b6Smaya   bool                                 RAddressMagFilterRoundingEnable;
161310e230b6Smaya   bool                                 VAddressMinFilterRoundingEnable;
161410e230b6Smaya   bool                                 VAddressMagFilterRoundingEnable;
161510e230b6Smaya   bool                                 UAddressMinFilterRoundingEnable;
161610e230b6Smaya   bool                                 UAddressMagFilterRoundingEnable;
161710e230b6Smaya   uint32_t                             MaximumAnisotropy;
161810e230b6Smaya#define RATIO21                                  0
161910e230b6Smaya#define RATIO41                                  1
162010e230b6Smaya#define RATIO61                                  2
162110e230b6Smaya#define RATIO81                                  3
162210e230b6Smaya#define RATIO101                                 4
162310e230b6Smaya#define RATIO121                                 5
162410e230b6Smaya#define RATIO141                                 6
162510e230b6Smaya#define RATIO161                                 7
162610e230b6Smaya   uint32_t                             ReductionType;
162710e230b6Smaya#define STD_FILTER                               0
162810e230b6Smaya#define COMPARISON                               1
162910e230b6Smaya#define MINIMUM                                  2
163010e230b6Smaya#define MAXIMUM                                  3
163110e230b6Smaya};
163210e230b6Smaya
163396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
163496c5ddc4SrjsGFX9_SAMPLER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
163510e230b6Smaya                        __attribute__((unused)) void * restrict dst,
163696c5ddc4Srjs                        __attribute__((unused)) const struct GFX9_SAMPLER_STATE * restrict values)
163710e230b6Smaya{
163810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
163910e230b6Smaya
164010e230b6Smaya   dw[0] =
164110e230b6Smaya      __gen_uint(values->AnisotropicAlgorithm, 0, 0) |
164210e230b6Smaya      __gen_sfixed(values->TextureLODBias, 1, 13, 8) |
164310e230b6Smaya      __gen_uint(values->MinModeFilter, 14, 16) |
164410e230b6Smaya      __gen_uint(values->MagModeFilter, 17, 19) |
164510e230b6Smaya      __gen_uint(values->MipModeFilter, 20, 21) |
164610e230b6Smaya      __gen_uint(values->CoarseLODQualityMode, 22, 26) |
164710e230b6Smaya      __gen_uint(values->LODPreClampMode, 27, 28) |
164810e230b6Smaya      __gen_uint(values->TextureBorderColorMode, 29, 29) |
164910e230b6Smaya      __gen_uint(values->SamplerDisable, 31, 31);
165010e230b6Smaya
165110e230b6Smaya   dw[1] =
165210e230b6Smaya      __gen_uint(values->CubeSurfaceControlMode, 0, 0) |
165310e230b6Smaya      __gen_uint(values->ShadowFunction, 1, 3) |
165410e230b6Smaya      __gen_uint(values->ChromaKeyMode, 4, 4) |
165510e230b6Smaya      __gen_uint(values->ChromaKeyIndex, 5, 6) |
165610e230b6Smaya      __gen_uint(values->ChromaKeyEnable, 7, 7) |
165710e230b6Smaya      __gen_ufixed(values->MaxLOD, 8, 19, 8) |
165810e230b6Smaya      __gen_ufixed(values->MinLOD, 20, 31, 8);
165910e230b6Smaya
166010e230b6Smaya   dw[2] =
166110e230b6Smaya      __gen_uint(values->LODClampMagnificationMode, 0, 0) |
166210e230b6Smaya      __gen_offset(values->BorderColorPointer, 6, 23);
166310e230b6Smaya
166410e230b6Smaya   dw[3] =
166510e230b6Smaya      __gen_uint(values->TCZAddressControlMode, 0, 2) |
166610e230b6Smaya      __gen_uint(values->TCYAddressControlMode, 3, 5) |
166710e230b6Smaya      __gen_uint(values->TCXAddressControlMode, 6, 8) |
166810e230b6Smaya      __gen_uint(values->ReductionTypeEnable, 9, 9) |
166910e230b6Smaya      __gen_uint(values->NonnormalizedCoordinateEnable, 10, 10) |
167010e230b6Smaya      __gen_uint(values->TrilinearFilterQuality, 11, 12) |
167110e230b6Smaya      __gen_uint(values->RAddressMinFilterRoundingEnable, 13, 13) |
167210e230b6Smaya      __gen_uint(values->RAddressMagFilterRoundingEnable, 14, 14) |
167310e230b6Smaya      __gen_uint(values->VAddressMinFilterRoundingEnable, 15, 15) |
167410e230b6Smaya      __gen_uint(values->VAddressMagFilterRoundingEnable, 16, 16) |
167510e230b6Smaya      __gen_uint(values->UAddressMinFilterRoundingEnable, 17, 17) |
167610e230b6Smaya      __gen_uint(values->UAddressMagFilterRoundingEnable, 18, 18) |
167710e230b6Smaya      __gen_uint(values->MaximumAnisotropy, 19, 21) |
167810e230b6Smaya      __gen_uint(values->ReductionType, 22, 23);
167910e230b6Smaya}
168010e230b6Smaya
168196c5ddc4Srjs#define GFX9_SAMPLER_STATE_8X8_AVS_COEFFICIENTS_length      8
168296c5ddc4Srjsstruct GFX9_SAMPLER_STATE_8X8_AVS_COEFFICIENTS {
168310e230b6Smaya   float                                Table0FilterCoefficient[4];
168410e230b6Smaya   float                                Table1FilterCoefficient0[4];
168510e230b6Smaya   float                                Table1FilterCoefficient1[4];
168610e230b6Smaya};
168710e230b6Smaya
168896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
168996c5ddc4SrjsGFX9_SAMPLER_STATE_8X8_AVS_COEFFICIENTS_pack(__attribute__((unused)) __gen_user_data *data,
169010e230b6Smaya                                             __attribute__((unused)) void * restrict dst,
169196c5ddc4Srjs                                             __attribute__((unused)) const struct GFX9_SAMPLER_STATE_8X8_AVS_COEFFICIENTS * restrict values)
169210e230b6Smaya{
169310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
169410e230b6Smaya
169510e230b6Smaya   dw[0] =
169610e230b6Smaya      __gen_sfixed(values->Table0FilterCoefficient[0], 0, 7, 6) |
169710e230b6Smaya      __gen_sfixed(values->Table0FilterCoefficient[1], 8, 15, 6) |
169810e230b6Smaya      __gen_sfixed(values->Table0FilterCoefficient[2], 16, 23, 6) |
169910e230b6Smaya      __gen_sfixed(values->Table0FilterCoefficient[3], 24, 31, 6) |
170010e230b6Smaya      __gen_sfixed(values->Table1FilterCoefficient0[0], 0, 7, 6) |
170110e230b6Smaya      __gen_sfixed(values->Table1FilterCoefficient1[0], 8, 15, 6);
170210e230b6Smaya
170310e230b6Smaya   dw[1] =
170410e230b6Smaya      __gen_sfixed(values->Table1FilterCoefficient0[1], 0, 7, 6) |
170510e230b6Smaya      __gen_sfixed(values->Table1FilterCoefficient1[1], 8, 15, 6);
170610e230b6Smaya
170710e230b6Smaya   dw[2] =
170810e230b6Smaya      __gen_sfixed(values->Table1FilterCoefficient0[2], 0, 7, 6) |
170910e230b6Smaya      __gen_sfixed(values->Table1FilterCoefficient1[2], 8, 15, 6);
171010e230b6Smaya
171110e230b6Smaya   dw[3] =
171210e230b6Smaya      __gen_sfixed(values->Table1FilterCoefficient0[3], 0, 7, 6) |
171310e230b6Smaya      __gen_sfixed(values->Table1FilterCoefficient1[3], 8, 15, 6);
171410e230b6Smaya
171510e230b6Smaya   dw[4] = 0;
171610e230b6Smaya
171710e230b6Smaya   dw[5] = 0;
171810e230b6Smaya
171910e230b6Smaya   dw[6] = 0;
172010e230b6Smaya
172110e230b6Smaya   dw[7] = 0;
172210e230b6Smaya}
172310e230b6Smaya
172496c5ddc4Srjs#define GFX9_SCISSOR_RECT_length               2
172596c5ddc4Srjsstruct GFX9_SCISSOR_RECT {
172610e230b6Smaya   uint32_t                             ScissorRectangleXMin;
172710e230b6Smaya   uint32_t                             ScissorRectangleYMin;
172810e230b6Smaya   uint32_t                             ScissorRectangleXMax;
172910e230b6Smaya   uint32_t                             ScissorRectangleYMax;
173010e230b6Smaya};
173110e230b6Smaya
173296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
173396c5ddc4SrjsGFX9_SCISSOR_RECT_pack(__attribute__((unused)) __gen_user_data *data,
173410e230b6Smaya                       __attribute__((unused)) void * restrict dst,
173596c5ddc4Srjs                       __attribute__((unused)) const struct GFX9_SCISSOR_RECT * restrict values)
173610e230b6Smaya{
173710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
173810e230b6Smaya
173910e230b6Smaya   dw[0] =
174010e230b6Smaya      __gen_uint(values->ScissorRectangleXMin, 0, 15) |
174110e230b6Smaya      __gen_uint(values->ScissorRectangleYMin, 16, 31);
174210e230b6Smaya
174310e230b6Smaya   dw[1] =
174410e230b6Smaya      __gen_uint(values->ScissorRectangleXMax, 0, 15) |
174510e230b6Smaya      __gen_uint(values->ScissorRectangleYMax, 16, 31);
174610e230b6Smaya}
174710e230b6Smaya
174896c5ddc4Srjs#define GFX9_SFC_AVS_CHROMA_COEFF_TABLE_BODY_length     64
174996c5ddc4Srjsstruct GFX9_SFC_AVS_CHROMA_COEFF_TABLE_BODY {
175010e230b6Smaya   float                                Table1XFilterCoefficientn2;
175110e230b6Smaya   float                                Table1YFilterCoefficientn2;
175210e230b6Smaya   float                                Table1XFilterCoefficientn3;
175310e230b6Smaya   float                                Table1YFilterCoefficientn3;
175410e230b6Smaya   float                                Table1XFilterCoefficientn4;
175510e230b6Smaya   float                                Table1YFilterCoefficientn4;
175610e230b6Smaya   float                                Table1XFilterCoefficientn5;
175710e230b6Smaya   float                                Table1YFilterCoefficientn5;
175810e230b6Smaya   uint64_t                             FilterCoefficients[31];
175910e230b6Smaya};
176010e230b6Smaya
176196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
176296c5ddc4SrjsGFX9_SFC_AVS_CHROMA_COEFF_TABLE_BODY_pack(__attribute__((unused)) __gen_user_data *data,
176310e230b6Smaya                                          __attribute__((unused)) void * restrict dst,
176496c5ddc4Srjs                                          __attribute__((unused)) const struct GFX9_SFC_AVS_CHROMA_COEFF_TABLE_BODY * restrict values)
176510e230b6Smaya{
176610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
176710e230b6Smaya
176810e230b6Smaya   dw[0] =
176910e230b6Smaya      __gen_sfixed(values->Table1XFilterCoefficientn2, 0, 7, 6) |
177010e230b6Smaya      __gen_sfixed(values->Table1YFilterCoefficientn2, 8, 15, 6) |
177110e230b6Smaya      __gen_sfixed(values->Table1XFilterCoefficientn3, 16, 23, 6) |
177210e230b6Smaya      __gen_sfixed(values->Table1YFilterCoefficientn3, 24, 31, 6);
177310e230b6Smaya
177410e230b6Smaya   dw[1] =
177510e230b6Smaya      __gen_sfixed(values->Table1XFilterCoefficientn4, 0, 7, 6) |
177610e230b6Smaya      __gen_sfixed(values->Table1YFilterCoefficientn4, 8, 15, 6) |
177710e230b6Smaya      __gen_sfixed(values->Table1XFilterCoefficientn5, 16, 23, 6) |
177810e230b6Smaya      __gen_sfixed(values->Table1YFilterCoefficientn5, 24, 31, 6);
177910e230b6Smaya
178010e230b6Smaya   const uint64_t v2 =
178110e230b6Smaya      __gen_uint(values->FilterCoefficients[0], 0, 63);
178210e230b6Smaya   dw[2] = v2;
178310e230b6Smaya   dw[3] = v2 >> 32;
178410e230b6Smaya
178510e230b6Smaya   const uint64_t v4 =
178610e230b6Smaya      __gen_uint(values->FilterCoefficients[1], 0, 63);
178710e230b6Smaya   dw[4] = v4;
178810e230b6Smaya   dw[5] = v4 >> 32;
178910e230b6Smaya
179010e230b6Smaya   const uint64_t v6 =
179110e230b6Smaya      __gen_uint(values->FilterCoefficients[2], 0, 63);
179210e230b6Smaya   dw[6] = v6;
179310e230b6Smaya   dw[7] = v6 >> 32;
179410e230b6Smaya
179510e230b6Smaya   const uint64_t v8 =
179610e230b6Smaya      __gen_uint(values->FilterCoefficients[3], 0, 63);
179710e230b6Smaya   dw[8] = v8;
179810e230b6Smaya   dw[9] = v8 >> 32;
179910e230b6Smaya
180010e230b6Smaya   const uint64_t v10 =
180110e230b6Smaya      __gen_uint(values->FilterCoefficients[4], 0, 63);
180210e230b6Smaya   dw[10] = v10;
180310e230b6Smaya   dw[11] = v10 >> 32;
180410e230b6Smaya
180510e230b6Smaya   const uint64_t v12 =
180610e230b6Smaya      __gen_uint(values->FilterCoefficients[5], 0, 63);
180710e230b6Smaya   dw[12] = v12;
180810e230b6Smaya   dw[13] = v12 >> 32;
180910e230b6Smaya
181010e230b6Smaya   const uint64_t v14 =
181110e230b6Smaya      __gen_uint(values->FilterCoefficients[6], 0, 63);
181210e230b6Smaya   dw[14] = v14;
181310e230b6Smaya   dw[15] = v14 >> 32;
181410e230b6Smaya
181510e230b6Smaya   const uint64_t v16 =
181610e230b6Smaya      __gen_uint(values->FilterCoefficients[7], 0, 63);
181710e230b6Smaya   dw[16] = v16;
181810e230b6Smaya   dw[17] = v16 >> 32;
181910e230b6Smaya
182010e230b6Smaya   const uint64_t v18 =
182110e230b6Smaya      __gen_uint(values->FilterCoefficients[8], 0, 63);
182210e230b6Smaya   dw[18] = v18;
182310e230b6Smaya   dw[19] = v18 >> 32;
182410e230b6Smaya
182510e230b6Smaya   const uint64_t v20 =
182610e230b6Smaya      __gen_uint(values->FilterCoefficients[9], 0, 63);
182710e230b6Smaya   dw[20] = v20;
182810e230b6Smaya   dw[21] = v20 >> 32;
182910e230b6Smaya
183010e230b6Smaya   const uint64_t v22 =
183110e230b6Smaya      __gen_uint(values->FilterCoefficients[10], 0, 63);
183210e230b6Smaya   dw[22] = v22;
183310e230b6Smaya   dw[23] = v22 >> 32;
183410e230b6Smaya
183510e230b6Smaya   const uint64_t v24 =
183610e230b6Smaya      __gen_uint(values->FilterCoefficients[11], 0, 63);
183710e230b6Smaya   dw[24] = v24;
183810e230b6Smaya   dw[25] = v24 >> 32;
183910e230b6Smaya
184010e230b6Smaya   const uint64_t v26 =
184110e230b6Smaya      __gen_uint(values->FilterCoefficients[12], 0, 63);
184210e230b6Smaya   dw[26] = v26;
184310e230b6Smaya   dw[27] = v26 >> 32;
184410e230b6Smaya
184510e230b6Smaya   const uint64_t v28 =
184610e230b6Smaya      __gen_uint(values->FilterCoefficients[13], 0, 63);
184710e230b6Smaya   dw[28] = v28;
184810e230b6Smaya   dw[29] = v28 >> 32;
184910e230b6Smaya
185010e230b6Smaya   const uint64_t v30 =
185110e230b6Smaya      __gen_uint(values->FilterCoefficients[14], 0, 63);
185210e230b6Smaya   dw[30] = v30;
185310e230b6Smaya   dw[31] = v30 >> 32;
185410e230b6Smaya
185510e230b6Smaya   const uint64_t v32 =
185610e230b6Smaya      __gen_uint(values->FilterCoefficients[15], 0, 63);
185710e230b6Smaya   dw[32] = v32;
185810e230b6Smaya   dw[33] = v32 >> 32;
185910e230b6Smaya
186010e230b6Smaya   const uint64_t v34 =
186110e230b6Smaya      __gen_uint(values->FilterCoefficients[16], 0, 63);
186210e230b6Smaya   dw[34] = v34;
186310e230b6Smaya   dw[35] = v34 >> 32;
186410e230b6Smaya
186510e230b6Smaya   const uint64_t v36 =
186610e230b6Smaya      __gen_uint(values->FilterCoefficients[17], 0, 63);
186710e230b6Smaya   dw[36] = v36;
186810e230b6Smaya   dw[37] = v36 >> 32;
186910e230b6Smaya
187010e230b6Smaya   const uint64_t v38 =
187110e230b6Smaya      __gen_uint(values->FilterCoefficients[18], 0, 63);
187210e230b6Smaya   dw[38] = v38;
187310e230b6Smaya   dw[39] = v38 >> 32;
187410e230b6Smaya
187510e230b6Smaya   const uint64_t v40 =
187610e230b6Smaya      __gen_uint(values->FilterCoefficients[19], 0, 63);
187710e230b6Smaya   dw[40] = v40;
187810e230b6Smaya   dw[41] = v40 >> 32;
187910e230b6Smaya
188010e230b6Smaya   const uint64_t v42 =
188110e230b6Smaya      __gen_uint(values->FilterCoefficients[20], 0, 63);
188210e230b6Smaya   dw[42] = v42;
188310e230b6Smaya   dw[43] = v42 >> 32;
188410e230b6Smaya
188510e230b6Smaya   const uint64_t v44 =
188610e230b6Smaya      __gen_uint(values->FilterCoefficients[21], 0, 63);
188710e230b6Smaya   dw[44] = v44;
188810e230b6Smaya   dw[45] = v44 >> 32;
188910e230b6Smaya
189010e230b6Smaya   const uint64_t v46 =
189110e230b6Smaya      __gen_uint(values->FilterCoefficients[22], 0, 63);
189210e230b6Smaya   dw[46] = v46;
189310e230b6Smaya   dw[47] = v46 >> 32;
189410e230b6Smaya
189510e230b6Smaya   const uint64_t v48 =
189610e230b6Smaya      __gen_uint(values->FilterCoefficients[23], 0, 63);
189710e230b6Smaya   dw[48] = v48;
189810e230b6Smaya   dw[49] = v48 >> 32;
189910e230b6Smaya
190010e230b6Smaya   const uint64_t v50 =
190110e230b6Smaya      __gen_uint(values->FilterCoefficients[24], 0, 63);
190210e230b6Smaya   dw[50] = v50;
190310e230b6Smaya   dw[51] = v50 >> 32;
190410e230b6Smaya
190510e230b6Smaya   const uint64_t v52 =
190610e230b6Smaya      __gen_uint(values->FilterCoefficients[25], 0, 63);
190710e230b6Smaya   dw[52] = v52;
190810e230b6Smaya   dw[53] = v52 >> 32;
190910e230b6Smaya
191010e230b6Smaya   const uint64_t v54 =
191110e230b6Smaya      __gen_uint(values->FilterCoefficients[26], 0, 63);
191210e230b6Smaya   dw[54] = v54;
191310e230b6Smaya   dw[55] = v54 >> 32;
191410e230b6Smaya
191510e230b6Smaya   const uint64_t v56 =
191610e230b6Smaya      __gen_uint(values->FilterCoefficients[27], 0, 63);
191710e230b6Smaya   dw[56] = v56;
191810e230b6Smaya   dw[57] = v56 >> 32;
191910e230b6Smaya
192010e230b6Smaya   const uint64_t v58 =
192110e230b6Smaya      __gen_uint(values->FilterCoefficients[28], 0, 63);
192210e230b6Smaya   dw[58] = v58;
192310e230b6Smaya   dw[59] = v58 >> 32;
192410e230b6Smaya
192510e230b6Smaya   const uint64_t v60 =
192610e230b6Smaya      __gen_uint(values->FilterCoefficients[29], 0, 63);
192710e230b6Smaya   dw[60] = v60;
192810e230b6Smaya   dw[61] = v60 >> 32;
192910e230b6Smaya
193010e230b6Smaya   const uint64_t v62 =
193110e230b6Smaya      __gen_uint(values->FilterCoefficients[30], 0, 63);
193210e230b6Smaya   dw[62] = v62;
193310e230b6Smaya   dw[63] = v62 >> 32;
193410e230b6Smaya}
193510e230b6Smaya
193696c5ddc4Srjs#define GFX9_SFC_AVS_LUMA_COEFF_TABLE_BODY_length    128
193796c5ddc4Srjsstruct GFX9_SFC_AVS_LUMA_COEFF_TABLE_BODY {
193810e230b6Smaya   float                                Table0XFilterCoefficientn0;
193910e230b6Smaya   float                                Table0YFilterCoefficientn0;
194010e230b6Smaya   float                                Table0XFilterCoefficientn1;
194110e230b6Smaya   float                                Table0YFilterCoefficientn1;
194210e230b6Smaya   float                                Table0XFilterCoefficientn2;
194310e230b6Smaya   float                                Table0YFilterCoefficientn2;
194410e230b6Smaya   float                                Table0XFilterCoefficientn3;
194510e230b6Smaya   float                                Table0YFilterCoefficientn3;
194610e230b6Smaya   float                                Table0XFilterCoefficientn4;
194710e230b6Smaya   float                                Table0YFilterCoefficientn4;
194810e230b6Smaya   float                                Table0XFilterCoefficientn5;
194910e230b6Smaya   float                                Table0YFilterCoefficientn5;
195010e230b6Smaya   float                                Table0XFilterCoefficientn6;
195110e230b6Smaya   float                                Table0YFilterCoefficientn6;
195210e230b6Smaya   float                                Table0XFilterCoefficientn7;
195310e230b6Smaya   float                                Table0YFilterCoefficientn7;
195410e230b6Smaya   uint64_t                             FilterCoefficients[31];
195510e230b6Smaya};
195610e230b6Smaya
195796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
195896c5ddc4SrjsGFX9_SFC_AVS_LUMA_COEFF_TABLE_BODY_pack(__attribute__((unused)) __gen_user_data *data,
195910e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
196096c5ddc4Srjs                                        __attribute__((unused)) const struct GFX9_SFC_AVS_LUMA_COEFF_TABLE_BODY * restrict values)
196110e230b6Smaya{
196210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
196310e230b6Smaya
196410e230b6Smaya   dw[0] =
196510e230b6Smaya      __gen_sfixed(values->Table0XFilterCoefficientn0, 0, 7, 6) |
196610e230b6Smaya      __gen_sfixed(values->Table0YFilterCoefficientn0, 8, 15, 6) |
196710e230b6Smaya      __gen_sfixed(values->Table0XFilterCoefficientn1, 16, 23, 6) |
196810e230b6Smaya      __gen_sfixed(values->Table0YFilterCoefficientn1, 24, 31, 6);
196910e230b6Smaya
197010e230b6Smaya   dw[1] =
197110e230b6Smaya      __gen_sfixed(values->Table0XFilterCoefficientn2, 0, 7, 6) |
197210e230b6Smaya      __gen_sfixed(values->Table0YFilterCoefficientn2, 8, 15, 6) |
197310e230b6Smaya      __gen_sfixed(values->Table0XFilterCoefficientn3, 16, 23, 6) |
197410e230b6Smaya      __gen_sfixed(values->Table0YFilterCoefficientn3, 24, 31, 6);
197510e230b6Smaya
197610e230b6Smaya   dw[2] =
197710e230b6Smaya      __gen_sfixed(values->Table0XFilterCoefficientn4, 0, 7, 6) |
197810e230b6Smaya      __gen_sfixed(values->Table0YFilterCoefficientn4, 8, 15, 6) |
197910e230b6Smaya      __gen_sfixed(values->Table0XFilterCoefficientn5, 16, 23, 6) |
198010e230b6Smaya      __gen_sfixed(values->Table0YFilterCoefficientn5, 24, 31, 6);
198110e230b6Smaya
198210e230b6Smaya   dw[3] =
198310e230b6Smaya      __gen_sfixed(values->Table0XFilterCoefficientn6, 0, 7, 6) |
198410e230b6Smaya      __gen_sfixed(values->Table0YFilterCoefficientn6, 8, 15, 6) |
198510e230b6Smaya      __gen_sfixed(values->Table0XFilterCoefficientn7, 16, 23, 6) |
198610e230b6Smaya      __gen_sfixed(values->Table0YFilterCoefficientn7, 24, 31, 6);
198710e230b6Smaya
198810e230b6Smaya   const uint64_t v4 =
198910e230b6Smaya      __gen_uint(values->FilterCoefficients[0], 0, 127);
199010e230b6Smaya   dw[4] = v4;
199110e230b6Smaya   dw[5] = v4 >> 32;
199210e230b6Smaya
199310e230b6Smaya   const uint64_t v8 =
199410e230b6Smaya      __gen_uint(values->FilterCoefficients[1], 0, 127);
199510e230b6Smaya   dw[8] = v8;
199610e230b6Smaya   dw[9] = v8 >> 32;
199710e230b6Smaya
199810e230b6Smaya   const uint64_t v12 =
199910e230b6Smaya      __gen_uint(values->FilterCoefficients[2], 0, 127);
200010e230b6Smaya   dw[12] = v12;
200110e230b6Smaya   dw[13] = v12 >> 32;
200210e230b6Smaya
200310e230b6Smaya   const uint64_t v16 =
200410e230b6Smaya      __gen_uint(values->FilterCoefficients[3], 0, 127);
200510e230b6Smaya   dw[16] = v16;
200610e230b6Smaya   dw[17] = v16 >> 32;
200710e230b6Smaya
200810e230b6Smaya   const uint64_t v20 =
200910e230b6Smaya      __gen_uint(values->FilterCoefficients[4], 0, 127);
201010e230b6Smaya   dw[20] = v20;
201110e230b6Smaya   dw[21] = v20 >> 32;
201210e230b6Smaya
201310e230b6Smaya   const uint64_t v24 =
201410e230b6Smaya      __gen_uint(values->FilterCoefficients[5], 0, 127);
201510e230b6Smaya   dw[24] = v24;
201610e230b6Smaya   dw[25] = v24 >> 32;
201710e230b6Smaya
201810e230b6Smaya   const uint64_t v28 =
201910e230b6Smaya      __gen_uint(values->FilterCoefficients[6], 0, 127);
202010e230b6Smaya   dw[28] = v28;
202110e230b6Smaya   dw[29] = v28 >> 32;
202210e230b6Smaya
202310e230b6Smaya   const uint64_t v32 =
202410e230b6Smaya      __gen_uint(values->FilterCoefficients[7], 0, 127);
202510e230b6Smaya   dw[32] = v32;
202610e230b6Smaya   dw[33] = v32 >> 32;
202710e230b6Smaya
202810e230b6Smaya   const uint64_t v36 =
202910e230b6Smaya      __gen_uint(values->FilterCoefficients[8], 0, 127);
203010e230b6Smaya   dw[36] = v36;
203110e230b6Smaya   dw[37] = v36 >> 32;
203210e230b6Smaya
203310e230b6Smaya   const uint64_t v40 =
203410e230b6Smaya      __gen_uint(values->FilterCoefficients[9], 0, 127);
203510e230b6Smaya   dw[40] = v40;
203610e230b6Smaya   dw[41] = v40 >> 32;
203710e230b6Smaya
203810e230b6Smaya   const uint64_t v44 =
203910e230b6Smaya      __gen_uint(values->FilterCoefficients[10], 0, 127);
204010e230b6Smaya   dw[44] = v44;
204110e230b6Smaya   dw[45] = v44 >> 32;
204210e230b6Smaya
204310e230b6Smaya   const uint64_t v48 =
204410e230b6Smaya      __gen_uint(values->FilterCoefficients[11], 0, 127);
204510e230b6Smaya   dw[48] = v48;
204610e230b6Smaya   dw[49] = v48 >> 32;
204710e230b6Smaya
204810e230b6Smaya   const uint64_t v52 =
204910e230b6Smaya      __gen_uint(values->FilterCoefficients[12], 0, 127);
205010e230b6Smaya   dw[52] = v52;
205110e230b6Smaya   dw[53] = v52 >> 32;
205210e230b6Smaya
205310e230b6Smaya   const uint64_t v56 =
205410e230b6Smaya      __gen_uint(values->FilterCoefficients[13], 0, 127);
205510e230b6Smaya   dw[56] = v56;
205610e230b6Smaya   dw[57] = v56 >> 32;
205710e230b6Smaya
205810e230b6Smaya   const uint64_t v60 =
205910e230b6Smaya      __gen_uint(values->FilterCoefficients[14], 0, 127);
206010e230b6Smaya   dw[60] = v60;
206110e230b6Smaya   dw[61] = v60 >> 32;
206210e230b6Smaya
206310e230b6Smaya   const uint64_t v64 =
206410e230b6Smaya      __gen_uint(values->FilterCoefficients[15], 0, 127);
206510e230b6Smaya   dw[64] = v64;
206610e230b6Smaya   dw[65] = v64 >> 32;
206710e230b6Smaya
206810e230b6Smaya   const uint64_t v68 =
206910e230b6Smaya      __gen_uint(values->FilterCoefficients[16], 0, 127);
207010e230b6Smaya   dw[68] = v68;
207110e230b6Smaya   dw[69] = v68 >> 32;
207210e230b6Smaya
207310e230b6Smaya   const uint64_t v72 =
207410e230b6Smaya      __gen_uint(values->FilterCoefficients[17], 0, 127);
207510e230b6Smaya   dw[72] = v72;
207610e230b6Smaya   dw[73] = v72 >> 32;
207710e230b6Smaya
207810e230b6Smaya   const uint64_t v76 =
207910e230b6Smaya      __gen_uint(values->FilterCoefficients[18], 0, 127);
208010e230b6Smaya   dw[76] = v76;
208110e230b6Smaya   dw[77] = v76 >> 32;
208210e230b6Smaya
208310e230b6Smaya   const uint64_t v80 =
208410e230b6Smaya      __gen_uint(values->FilterCoefficients[19], 0, 127);
208510e230b6Smaya   dw[80] = v80;
208610e230b6Smaya   dw[81] = v80 >> 32;
208710e230b6Smaya
208810e230b6Smaya   const uint64_t v84 =
208910e230b6Smaya      __gen_uint(values->FilterCoefficients[20], 0, 127);
209010e230b6Smaya   dw[84] = v84;
209110e230b6Smaya   dw[85] = v84 >> 32;
209210e230b6Smaya
209310e230b6Smaya   const uint64_t v88 =
209410e230b6Smaya      __gen_uint(values->FilterCoefficients[21], 0, 127);
209510e230b6Smaya   dw[88] = v88;
209610e230b6Smaya   dw[89] = v88 >> 32;
209710e230b6Smaya
209810e230b6Smaya   const uint64_t v92 =
209910e230b6Smaya      __gen_uint(values->FilterCoefficients[22], 0, 127);
210010e230b6Smaya   dw[92] = v92;
210110e230b6Smaya   dw[93] = v92 >> 32;
210210e230b6Smaya
210310e230b6Smaya   const uint64_t v96 =
210410e230b6Smaya      __gen_uint(values->FilterCoefficients[23], 0, 127);
210510e230b6Smaya   dw[96] = v96;
210610e230b6Smaya   dw[97] = v96 >> 32;
210710e230b6Smaya
210810e230b6Smaya   const uint64_t v100 =
210910e230b6Smaya      __gen_uint(values->FilterCoefficients[24], 0, 127);
211010e230b6Smaya   dw[100] = v100;
211110e230b6Smaya   dw[101] = v100 >> 32;
211210e230b6Smaya
211310e230b6Smaya   const uint64_t v104 =
211410e230b6Smaya      __gen_uint(values->FilterCoefficients[25], 0, 127);
211510e230b6Smaya   dw[104] = v104;
211610e230b6Smaya   dw[105] = v104 >> 32;
211710e230b6Smaya
211810e230b6Smaya   const uint64_t v108 =
211910e230b6Smaya      __gen_uint(values->FilterCoefficients[26], 0, 127);
212010e230b6Smaya   dw[108] = v108;
212110e230b6Smaya   dw[109] = v108 >> 32;
212210e230b6Smaya
212310e230b6Smaya   const uint64_t v112 =
212410e230b6Smaya      __gen_uint(values->FilterCoefficients[27], 0, 127);
212510e230b6Smaya   dw[112] = v112;
212610e230b6Smaya   dw[113] = v112 >> 32;
212710e230b6Smaya
212810e230b6Smaya   const uint64_t v116 =
212910e230b6Smaya      __gen_uint(values->FilterCoefficients[28], 0, 127);
213010e230b6Smaya   dw[116] = v116;
213110e230b6Smaya   dw[117] = v116 >> 32;
213210e230b6Smaya
213310e230b6Smaya   const uint64_t v120 =
213410e230b6Smaya      __gen_uint(values->FilterCoefficients[29], 0, 127);
213510e230b6Smaya   dw[120] = v120;
213610e230b6Smaya   dw[121] = v120 >> 32;
213710e230b6Smaya
213810e230b6Smaya   const uint64_t v124 =
213910e230b6Smaya      __gen_uint(values->FilterCoefficients[30], 0, 127);
214010e230b6Smaya   dw[124] = v124;
214110e230b6Smaya   dw[125] = v124 >> 32;
214210e230b6Smaya}
214310e230b6Smaya
214496c5ddc4Srjs#define GFX9_SFC_AVS_STATE_BODY_length         2
214596c5ddc4Srjsstruct GFX9_SFC_AVS_STATE_BODY {
214610e230b6Smaya   uint32_t                             TransitionAreawith8Pixels;
214710e230b6Smaya   uint32_t                             TransitionAreawith4Pixels;
214810e230b6Smaya   uint32_t                             SharpnessLevel;
214910e230b6Smaya   uint32_t                             MaxDerivative8Pixels;
215010e230b6Smaya   uint32_t                             MaxDerivative4Pixels;
215110e230b6Smaya};
215210e230b6Smaya
215396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
215496c5ddc4SrjsGFX9_SFC_AVS_STATE_BODY_pack(__attribute__((unused)) __gen_user_data *data,
215510e230b6Smaya                             __attribute__((unused)) void * restrict dst,
215696c5ddc4Srjs                             __attribute__((unused)) const struct GFX9_SFC_AVS_STATE_BODY * restrict values)
215710e230b6Smaya{
215810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
215910e230b6Smaya
216010e230b6Smaya   dw[0] =
216110e230b6Smaya      __gen_uint(values->TransitionAreawith8Pixels, 0, 2) |
216210e230b6Smaya      __gen_uint(values->TransitionAreawith4Pixels, 4, 6) |
216310e230b6Smaya      __gen_uint(values->SharpnessLevel, 24, 31);
216410e230b6Smaya
216510e230b6Smaya   dw[1] =
216610e230b6Smaya      __gen_uint(values->MaxDerivative8Pixels, 0, 7) |
216710e230b6Smaya      __gen_uint(values->MaxDerivative4Pixels, 16, 23);
216810e230b6Smaya}
216910e230b6Smaya
217096c5ddc4Srjs#define GFX9_SFC_IEF_STATE_BODY_length        23
217196c5ddc4Srjsstruct GFX9_SFC_IEF_STATE_BODY {
217210e230b6Smaya   uint32_t                             GainFactor;
217310e230b6Smaya   uint32_t                             WeakEdgeThreshold;
217410e230b6Smaya   uint32_t                             StrongEdgeThreshold;
217510e230b6Smaya   float                                R3xCoefficient;
217610e230b6Smaya   float                                R3cCoefficient;
217710e230b6Smaya   uint32_t                             GlobalNoiseEstimation;
217810e230b6Smaya   uint32_t                             NonEdgeWeight;
217910e230b6Smaya   uint32_t                             RegularWeight;
218010e230b6Smaya   uint32_t                             StrongEdgeWeight;
218110e230b6Smaya   float                                R5xCoefficient;
218210e230b6Smaya   float                                R5cxCoefficient;
218310e230b6Smaya   float                                R5cCoefficient;
218410e230b6Smaya   float                                STDSinalpha;
218510e230b6Smaya   float                                STDCosalpha;
218610e230b6Smaya   uint32_t                             Sat_Max;
218710e230b6Smaya   uint32_t                             Hue_Max;
218810e230b6Smaya   float                                S3U;
218910e230b6Smaya   uint32_t                             DiamondMargin;
219010e230b6Smaya   bool                                 VY_STD_Enable;
219110e230b6Smaya   uint32_t                             U_Mid;
219210e230b6Smaya   uint32_t                             V_Mid;
219310e230b6Smaya   int32_t                              Diamond_dv;
219410e230b6Smaya   uint32_t                             Diamond_Th;
219510e230b6Smaya   float                                Diamond_alpha;
219610e230b6Smaya   uint32_t                             HS_margin;
219710e230b6Smaya   int32_t                              Diamond_du;
219810e230b6Smaya   uint32_t                             SkinDetailFactor;
219910e230b6Smaya#define DetailRevealed                           0
220010e230b6Smaya#define NotDetailRevealed                        1
220110e230b6Smaya   uint32_t                             Y_point_1;
220210e230b6Smaya   uint32_t                             Y_point_2;
220310e230b6Smaya   uint32_t                             Y_point_3;
220410e230b6Smaya   uint32_t                             Y_point_4;
220510e230b6Smaya   float                                INV_Margin_VYL;
220610e230b6Smaya   float                                INV_Margin_VYU;
220710e230b6Smaya   uint32_t                             P0L;
220810e230b6Smaya   uint32_t                             P1L;
220910e230b6Smaya   uint32_t                             P2L;
221010e230b6Smaya   uint32_t                             P3L;
221110e230b6Smaya   uint32_t                             B0L;
221210e230b6Smaya   uint32_t                             B1L;
221310e230b6Smaya   uint32_t                             B2L;
221410e230b6Smaya   uint32_t                             B3L;
221510e230b6Smaya   float                                S0L;
221610e230b6Smaya   float                                Y_Slope_2;
221710e230b6Smaya   float                                S1L;
221810e230b6Smaya   float                                S2L;
221910e230b6Smaya   float                                S3L;
222010e230b6Smaya   uint32_t                             P0U;
222110e230b6Smaya   uint32_t                             P1U;
222210e230b6Smaya   float                                Y_Slope1;
222310e230b6Smaya   uint32_t                             P2U;
222410e230b6Smaya   uint32_t                             P3U;
222510e230b6Smaya   uint32_t                             B0U;
222610e230b6Smaya   uint32_t                             B1U;
222710e230b6Smaya   uint32_t                             B2U;
222810e230b6Smaya   uint32_t                             B3U;
222910e230b6Smaya   float                                S0U;
223010e230b6Smaya   float                                S1U;
223110e230b6Smaya   float                                S2U;
223210e230b6Smaya   bool                                 TransformEnable;
223310e230b6Smaya   bool                                 YUVChannelSwap;
223410e230b6Smaya   float                                C0;
223510e230b6Smaya   float                                C1;
223610e230b6Smaya   float                                C2;
223710e230b6Smaya   float                                C3;
223810e230b6Smaya   float                                C4;
223910e230b6Smaya   float                                C5;
224010e230b6Smaya   float                                C6;
224110e230b6Smaya   float                                C7;
224210e230b6Smaya   float                                C8;
224310e230b6Smaya   float                                OffsetIn1;
224410e230b6Smaya   float                                OffsetOut1;
224510e230b6Smaya   float                                OffsetIn2;
224610e230b6Smaya   float                                OffsetOut2;
224710e230b6Smaya   float                                OffsetIn3;
224810e230b6Smaya   float                                OffsetOut3;
224910e230b6Smaya};
225010e230b6Smaya
225196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
225296c5ddc4SrjsGFX9_SFC_IEF_STATE_BODY_pack(__attribute__((unused)) __gen_user_data *data,
225310e230b6Smaya                             __attribute__((unused)) void * restrict dst,
225496c5ddc4Srjs                             __attribute__((unused)) const struct GFX9_SFC_IEF_STATE_BODY * restrict values)
225510e230b6Smaya{
225610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
225710e230b6Smaya
225810e230b6Smaya   dw[0] =
225910e230b6Smaya      __gen_uint(values->GainFactor, 0, 5) |
226010e230b6Smaya      __gen_uint(values->WeakEdgeThreshold, 6, 11) |
226110e230b6Smaya      __gen_uint(values->StrongEdgeThreshold, 12, 17) |
226210e230b6Smaya      __gen_ufixed(values->R3xCoefficient, 18, 22, 5) |
226310e230b6Smaya      __gen_ufixed(values->R3cCoefficient, 23, 27, 5);
226410e230b6Smaya
226510e230b6Smaya   dw[1] =
226610e230b6Smaya      __gen_uint(values->GlobalNoiseEstimation, 0, 7) |
226710e230b6Smaya      __gen_uint(values->NonEdgeWeight, 8, 10) |
226810e230b6Smaya      __gen_uint(values->RegularWeight, 11, 13) |
226910e230b6Smaya      __gen_uint(values->StrongEdgeWeight, 14, 16) |
227010e230b6Smaya      __gen_ufixed(values->R5xCoefficient, 17, 21, 5) |
227110e230b6Smaya      __gen_ufixed(values->R5cxCoefficient, 22, 26, 5) |
227210e230b6Smaya      __gen_ufixed(values->R5cCoefficient, 27, 31, 5);
227310e230b6Smaya
227410e230b6Smaya   dw[2] =
227510e230b6Smaya      __gen_sfixed(values->STDSinalpha, 0, 7, 7) |
227610e230b6Smaya      __gen_sfixed(values->STDCosalpha, 8, 15, 7) |
227710e230b6Smaya      __gen_uint(values->Sat_Max, 16, 21) |
227810e230b6Smaya      __gen_uint(values->Hue_Max, 22, 27);
227910e230b6Smaya
228010e230b6Smaya   dw[3] =
228110e230b6Smaya      __gen_sfixed(values->S3U, 0, 10, 8) |
228210e230b6Smaya      __gen_uint(values->DiamondMargin, 12, 14) |
228310e230b6Smaya      __gen_uint(values->VY_STD_Enable, 15, 15) |
228410e230b6Smaya      __gen_uint(values->U_Mid, 16, 23) |
228510e230b6Smaya      __gen_uint(values->V_Mid, 24, 31);
228610e230b6Smaya
228710e230b6Smaya   dw[4] =
228810e230b6Smaya      __gen_sint(values->Diamond_dv, 0, 6) |
228910e230b6Smaya      __gen_uint(values->Diamond_Th, 7, 12) |
229010e230b6Smaya      __gen_ufixed(values->Diamond_alpha, 13, 20, 6) |
229110e230b6Smaya      __gen_uint(values->HS_margin, 21, 23) |
229210e230b6Smaya      __gen_sint(values->Diamond_du, 24, 30) |
229310e230b6Smaya      __gen_uint(values->SkinDetailFactor, 31, 31);
229410e230b6Smaya
229510e230b6Smaya   dw[5] =
229610e230b6Smaya      __gen_uint(values->Y_point_1, 0, 7) |
229710e230b6Smaya      __gen_uint(values->Y_point_2, 8, 15) |
229810e230b6Smaya      __gen_uint(values->Y_point_3, 16, 23) |
229910e230b6Smaya      __gen_uint(values->Y_point_4, 24, 31);
230010e230b6Smaya
230110e230b6Smaya   dw[6] =
230210e230b6Smaya      __gen_ufixed(values->INV_Margin_VYL, 0, 15, 16);
230310e230b6Smaya
230410e230b6Smaya   dw[7] =
230510e230b6Smaya      __gen_ufixed(values->INV_Margin_VYU, 0, 15, 16) |
230610e230b6Smaya      __gen_uint(values->P0L, 16, 23) |
230710e230b6Smaya      __gen_uint(values->P1L, 24, 31);
230810e230b6Smaya
230910e230b6Smaya   dw[8] =
231010e230b6Smaya      __gen_uint(values->P2L, 0, 7) |
231110e230b6Smaya      __gen_uint(values->P3L, 8, 15) |
231210e230b6Smaya      __gen_uint(values->B0L, 16, 23) |
231310e230b6Smaya      __gen_uint(values->B1L, 24, 31);
231410e230b6Smaya
231510e230b6Smaya   dw[9] =
231610e230b6Smaya      __gen_uint(values->B2L, 0, 7) |
231710e230b6Smaya      __gen_uint(values->B3L, 8, 15) |
231810e230b6Smaya      __gen_sfixed(values->S0L, 16, 26, 8) |
231910e230b6Smaya      __gen_ufixed(values->Y_Slope_2, 27, 31, 3);
232010e230b6Smaya
232110e230b6Smaya   dw[10] =
232210e230b6Smaya      __gen_sfixed(values->S1L, 0, 10, 8) |
232310e230b6Smaya      __gen_sfixed(values->S2L, 11, 21, 8);
232410e230b6Smaya
232510e230b6Smaya   dw[11] =
232610e230b6Smaya      __gen_sfixed(values->S3L, 0, 10, 8) |
232710e230b6Smaya      __gen_uint(values->P0U, 11, 18) |
232810e230b6Smaya      __gen_uint(values->P1U, 19, 26) |
232910e230b6Smaya      __gen_ufixed(values->Y_Slope1, 27, 31, 3);
233010e230b6Smaya
233110e230b6Smaya   dw[12] =
233210e230b6Smaya      __gen_uint(values->P2U, 0, 7) |
233310e230b6Smaya      __gen_uint(values->P3U, 8, 15) |
233410e230b6Smaya      __gen_uint(values->B0U, 16, 23) |
233510e230b6Smaya      __gen_uint(values->B1U, 24, 31);
233610e230b6Smaya
233710e230b6Smaya   dw[13] =
233810e230b6Smaya      __gen_uint(values->B2U, 0, 7) |
233910e230b6Smaya      __gen_uint(values->B3U, 8, 15) |
234010e230b6Smaya      __gen_sfixed(values->S0U, 16, 26, 8);
234110e230b6Smaya
234210e230b6Smaya   dw[14] =
234310e230b6Smaya      __gen_sfixed(values->S1U, 0, 10, 8) |
234410e230b6Smaya      __gen_sfixed(values->S2U, 11, 21, 8);
234510e230b6Smaya
234610e230b6Smaya   dw[15] =
234710e230b6Smaya      __gen_uint(values->TransformEnable, 0, 0) |
234810e230b6Smaya      __gen_uint(values->YUVChannelSwap, 1, 1) |
234910e230b6Smaya      __gen_sfixed(values->C0, 3, 15, 10) |
235010e230b6Smaya      __gen_sfixed(values->C1, 16, 28, 10);
235110e230b6Smaya
235210e230b6Smaya   dw[16] =
235310e230b6Smaya      __gen_sfixed(values->C2, 0, 12, 10) |
235410e230b6Smaya      __gen_sfixed(values->C3, 13, 25, 10);
235510e230b6Smaya
235610e230b6Smaya   dw[17] =
235710e230b6Smaya      __gen_sfixed(values->C4, 0, 12, 10) |
235810e230b6Smaya      __gen_sfixed(values->C5, 13, 25, 10);
235910e230b6Smaya
236010e230b6Smaya   dw[18] =
236110e230b6Smaya      __gen_sfixed(values->C6, 0, 12, 10) |
236210e230b6Smaya      __gen_sfixed(values->C7, 13, 25, 10);
236310e230b6Smaya
236410e230b6Smaya   dw[19] =
236510e230b6Smaya      __gen_sfixed(values->C8, 0, 12, 10);
236610e230b6Smaya
236710e230b6Smaya   dw[20] =
236810e230b6Smaya      __gen_sfixed(values->OffsetIn1, 0, 10, 8) |
236910e230b6Smaya      __gen_sfixed(values->OffsetOut1, 11, 21, 8);
237010e230b6Smaya
237110e230b6Smaya   dw[21] =
237210e230b6Smaya      __gen_sfixed(values->OffsetIn2, 0, 10, 8) |
237310e230b6Smaya      __gen_sfixed(values->OffsetOut2, 11, 21, 8);
237410e230b6Smaya
237510e230b6Smaya   dw[22] =
237610e230b6Smaya      __gen_sfixed(values->OffsetIn3, 0, 10, 8) |
237710e230b6Smaya      __gen_sfixed(values->OffsetOut3, 11, 21, 8);
237810e230b6Smaya}
237910e230b6Smaya
238096c5ddc4Srjs#define GFX9_SFC_LOCK_BODY_length              1
238196c5ddc4Srjsstruct GFX9_SFC_LOCK_BODY {
238210e230b6Smaya   uint32_t                             VESFCPipeSelect;
238310e230b6Smaya   bool                                 PreScaledOutputSurfaceOutputEnable;
238410e230b6Smaya};
238510e230b6Smaya
238696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
238796c5ddc4SrjsGFX9_SFC_LOCK_BODY_pack(__attribute__((unused)) __gen_user_data *data,
238810e230b6Smaya                        __attribute__((unused)) void * restrict dst,
238996c5ddc4Srjs                        __attribute__((unused)) const struct GFX9_SFC_LOCK_BODY * restrict values)
239010e230b6Smaya{
239110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
239210e230b6Smaya
239310e230b6Smaya   dw[0] =
239410e230b6Smaya      __gen_uint(values->VESFCPipeSelect, 0, 0) |
239510e230b6Smaya      __gen_uint(values->PreScaledOutputSurfaceOutputEnable, 1, 1);
239610e230b6Smaya}
239710e230b6Smaya
239896c5ddc4Srjs#define GFX9_SF_CLIP_VIEWPORT_length          16
239996c5ddc4Srjsstruct GFX9_SF_CLIP_VIEWPORT {
240010e230b6Smaya   float                                ViewportMatrixElementm00;
240110e230b6Smaya   float                                ViewportMatrixElementm11;
240210e230b6Smaya   float                                ViewportMatrixElementm22;
240310e230b6Smaya   float                                ViewportMatrixElementm30;
240410e230b6Smaya   float                                ViewportMatrixElementm31;
240510e230b6Smaya   float                                ViewportMatrixElementm32;
240610e230b6Smaya   float                                XMinClipGuardband;
240710e230b6Smaya   float                                XMaxClipGuardband;
240810e230b6Smaya   float                                YMinClipGuardband;
240910e230b6Smaya   float                                YMaxClipGuardband;
241010e230b6Smaya   float                                XMinViewPort;
241110e230b6Smaya   float                                XMaxViewPort;
241210e230b6Smaya   float                                YMinViewPort;
241310e230b6Smaya   float                                YMaxViewPort;
241410e230b6Smaya};
241510e230b6Smaya
241696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
241796c5ddc4SrjsGFX9_SF_CLIP_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
241810e230b6Smaya                           __attribute__((unused)) void * restrict dst,
241996c5ddc4Srjs                           __attribute__((unused)) const struct GFX9_SF_CLIP_VIEWPORT * restrict values)
242010e230b6Smaya{
242110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
242210e230b6Smaya
242310e230b6Smaya   dw[0] =
242410e230b6Smaya      __gen_float(values->ViewportMatrixElementm00);
242510e230b6Smaya
242610e230b6Smaya   dw[1] =
242710e230b6Smaya      __gen_float(values->ViewportMatrixElementm11);
242810e230b6Smaya
242910e230b6Smaya   dw[2] =
243010e230b6Smaya      __gen_float(values->ViewportMatrixElementm22);
243110e230b6Smaya
243210e230b6Smaya   dw[3] =
243310e230b6Smaya      __gen_float(values->ViewportMatrixElementm30);
243410e230b6Smaya
243510e230b6Smaya   dw[4] =
243610e230b6Smaya      __gen_float(values->ViewportMatrixElementm31);
243710e230b6Smaya
243810e230b6Smaya   dw[5] =
243910e230b6Smaya      __gen_float(values->ViewportMatrixElementm32);
244010e230b6Smaya
244110e230b6Smaya   dw[6] = 0;
244210e230b6Smaya
244310e230b6Smaya   dw[7] = 0;
244410e230b6Smaya
244510e230b6Smaya   dw[8] =
244610e230b6Smaya      __gen_float(values->XMinClipGuardband);
244710e230b6Smaya
244810e230b6Smaya   dw[9] =
244910e230b6Smaya      __gen_float(values->XMaxClipGuardband);
245010e230b6Smaya
245110e230b6Smaya   dw[10] =
245210e230b6Smaya      __gen_float(values->YMinClipGuardband);
245310e230b6Smaya
245410e230b6Smaya   dw[11] =
245510e230b6Smaya      __gen_float(values->YMaxClipGuardband);
245610e230b6Smaya
245710e230b6Smaya   dw[12] =
245810e230b6Smaya      __gen_float(values->XMinViewPort);
245910e230b6Smaya
246010e230b6Smaya   dw[13] =
246110e230b6Smaya      __gen_float(values->XMaxViewPort);
246210e230b6Smaya
246310e230b6Smaya   dw[14] =
246410e230b6Smaya      __gen_float(values->YMinViewPort);
246510e230b6Smaya
246610e230b6Smaya   dw[15] =
246710e230b6Smaya      __gen_float(values->YMaxViewPort);
246810e230b6Smaya}
246910e230b6Smaya
247096c5ddc4Srjs#define GFX9_SF_OUTPUT_ATTRIBUTE_DETAIL_length      1
247196c5ddc4Srjsstruct GFX9_SF_OUTPUT_ATTRIBUTE_DETAIL {
247210e230b6Smaya   uint32_t                             SourceAttribute;
247310e230b6Smaya   uint32_t                             SwizzleSelect;
247410e230b6Smaya#define INPUTATTR                                0
247510e230b6Smaya#define INPUTATTR_FACING                         1
247610e230b6Smaya#define INPUTATTR_W                              2
247710e230b6Smaya#define INPUTATTR_FACING_W                       3
247810e230b6Smaya   uint32_t                             ConstantSource;
247910e230b6Smaya#define CONST_0000                               0
248010e230b6Smaya#define CONST_0001_FLOAT                         1
248110e230b6Smaya#define CONST_1111_FLOAT                         2
248210e230b6Smaya#define PRIM_ID                                  3
248310e230b6Smaya   uint32_t                             SwizzleControlMode;
248410e230b6Smaya   bool                                 ComponentOverrideX;
248510e230b6Smaya   bool                                 ComponentOverrideY;
248610e230b6Smaya   bool                                 ComponentOverrideZ;
248710e230b6Smaya   bool                                 ComponentOverrideW;
248810e230b6Smaya};
248910e230b6Smaya
249096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
249196c5ddc4SrjsGFX9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(__attribute__((unused)) __gen_user_data *data,
249210e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
249396c5ddc4Srjs                                     __attribute__((unused)) const struct GFX9_SF_OUTPUT_ATTRIBUTE_DETAIL * restrict values)
249410e230b6Smaya{
249510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
249610e230b6Smaya
249710e230b6Smaya   dw[0] =
249810e230b6Smaya      __gen_uint(values->SourceAttribute, 0, 4) |
249910e230b6Smaya      __gen_uint(values->SwizzleSelect, 6, 7) |
250010e230b6Smaya      __gen_uint(values->ConstantSource, 9, 10) |
250110e230b6Smaya      __gen_uint(values->SwizzleControlMode, 11, 11) |
250210e230b6Smaya      __gen_uint(values->ComponentOverrideX, 12, 12) |
250310e230b6Smaya      __gen_uint(values->ComponentOverrideY, 13, 13) |
250410e230b6Smaya      __gen_uint(values->ComponentOverrideZ, 14, 14) |
250510e230b6Smaya      __gen_uint(values->ComponentOverrideW, 15, 15);
250610e230b6Smaya}
250710e230b6Smaya
250896c5ddc4Srjs#define GFX9_SO_DECL_length                    1
250996c5ddc4Srjsstruct GFX9_SO_DECL {
251010e230b6Smaya   uint32_t                             ComponentMask;
251110e230b6Smaya   uint32_t                             RegisterIndex;
251296c5ddc4Srjs   bool                                 HoleFlag;
251310e230b6Smaya   uint32_t                             OutputBufferSlot;
251410e230b6Smaya};
251510e230b6Smaya
251696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
251796c5ddc4SrjsGFX9_SO_DECL_pack(__attribute__((unused)) __gen_user_data *data,
251810e230b6Smaya                  __attribute__((unused)) void * restrict dst,
251996c5ddc4Srjs                  __attribute__((unused)) const struct GFX9_SO_DECL * restrict values)
252010e230b6Smaya{
252110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
252210e230b6Smaya
252310e230b6Smaya   dw[0] =
252410e230b6Smaya      __gen_uint(values->ComponentMask, 0, 3) |
252510e230b6Smaya      __gen_uint(values->RegisterIndex, 4, 9) |
252610e230b6Smaya      __gen_uint(values->HoleFlag, 11, 11) |
252710e230b6Smaya      __gen_uint(values->OutputBufferSlot, 12, 13);
252810e230b6Smaya}
252910e230b6Smaya
253096c5ddc4Srjs#define GFX9_SO_DECL_ENTRY_length              2
253196c5ddc4Srjsstruct GFX9_SO_DECL_ENTRY {
253296c5ddc4Srjs   struct GFX9_SO_DECL                  Stream0Decl;
253396c5ddc4Srjs   struct GFX9_SO_DECL                  Stream1Decl;
253496c5ddc4Srjs   struct GFX9_SO_DECL                  Stream2Decl;
253596c5ddc4Srjs   struct GFX9_SO_DECL                  Stream3Decl;
253610e230b6Smaya};
253710e230b6Smaya
253896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
253996c5ddc4SrjsGFX9_SO_DECL_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
254010e230b6Smaya                        __attribute__((unused)) void * restrict dst,
254196c5ddc4Srjs                        __attribute__((unused)) const struct GFX9_SO_DECL_ENTRY * restrict values)
254210e230b6Smaya{
254310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
254410e230b6Smaya
254510e230b6Smaya   uint32_t v0_0;
254696c5ddc4Srjs   GFX9_SO_DECL_pack(data, &v0_0, &values->Stream0Decl);
254710e230b6Smaya
254810e230b6Smaya   uint32_t v0_1;
254996c5ddc4Srjs   GFX9_SO_DECL_pack(data, &v0_1, &values->Stream1Decl);
255010e230b6Smaya
255110e230b6Smaya   dw[0] =
255210e230b6Smaya      __gen_uint(v0_0, 0, 15) |
255310e230b6Smaya      __gen_uint(v0_1, 16, 31);
255410e230b6Smaya
255510e230b6Smaya   uint32_t v1_0;
255696c5ddc4Srjs   GFX9_SO_DECL_pack(data, &v1_0, &values->Stream2Decl);
255710e230b6Smaya
255810e230b6Smaya   uint32_t v1_1;
255996c5ddc4Srjs   GFX9_SO_DECL_pack(data, &v1_1, &values->Stream3Decl);
256010e230b6Smaya
256110e230b6Smaya   dw[1] =
256210e230b6Smaya      __gen_uint(v1_0, 0, 15) |
256310e230b6Smaya      __gen_uint(v1_1, 16, 31);
256410e230b6Smaya}
256510e230b6Smaya
256696c5ddc4Srjs#define GFX9_VDENC_SURFACE_CONTROL_BITS_length      1
256796c5ddc4Srjsstruct GFX9_VDENC_SURFACE_CONTROL_BITS {
256810e230b6Smaya   uint32_t                             MOCS;
256910e230b6Smaya   uint32_t                             ArbitrationPriorityControl;
257010e230b6Smaya#define Highestpriority                          0
257110e230b6Smaya#define Secondhighestpriority                    1
257210e230b6Smaya#define Thirdhighestpriority                     2
257310e230b6Smaya#define Lowestpriority                           3
257410e230b6Smaya   bool                                 MemoryCompressionEnable;
257510e230b6Smaya   uint32_t                             MemoryCompressionMode;
257610e230b6Smaya   uint32_t                             CacheSelect;
257710e230b6Smaya   uint32_t                             TiledResourceMode;
257810e230b6Smaya#define TRMODE_NONE                              0
257910e230b6Smaya#define TRMODE_TILEYF                            1
258010e230b6Smaya#define TRMODE_TILEYS                            2
258110e230b6Smaya};
258210e230b6Smaya
258396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
258496c5ddc4SrjsGFX9_VDENC_SURFACE_CONTROL_BITS_pack(__attribute__((unused)) __gen_user_data *data,
258510e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
258696c5ddc4Srjs                                     __attribute__((unused)) const struct GFX9_VDENC_SURFACE_CONTROL_BITS * restrict values)
258710e230b6Smaya{
258810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
258910e230b6Smaya
259010e230b6Smaya   dw[0] =
259110e230b6Smaya      __gen_uint(values->MOCS, 1, 6) |
259210e230b6Smaya      __gen_uint(values->ArbitrationPriorityControl, 7, 8) |
259310e230b6Smaya      __gen_uint(values->MemoryCompressionEnable, 9, 9) |
259410e230b6Smaya      __gen_uint(values->MemoryCompressionMode, 10, 10) |
259510e230b6Smaya      __gen_uint(values->CacheSelect, 12, 12) |
259610e230b6Smaya      __gen_uint(values->TiledResourceMode, 13, 14);
259710e230b6Smaya}
259810e230b6Smaya
259996c5ddc4Srjs#define GFX9_VDENC_PICTURE_length              3
260096c5ddc4Srjsstruct GFX9_VDENC_PICTURE {
260110e230b6Smaya   __gen_address_type                   Address;
260296c5ddc4Srjs   struct GFX9_VDENC_SURFACE_CONTROL_BITS PictureFields;
260310e230b6Smaya};
260410e230b6Smaya
260596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
260696c5ddc4SrjsGFX9_VDENC_PICTURE_pack(__attribute__((unused)) __gen_user_data *data,
260710e230b6Smaya                        __attribute__((unused)) void * restrict dst,
260896c5ddc4Srjs                        __attribute__((unused)) const struct GFX9_VDENC_PICTURE * restrict values)
260910e230b6Smaya{
261010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
261110e230b6Smaya
261210e230b6Smaya   const uint64_t v0_address =
261396c5ddc4Srjs      __gen_address(data, &dw[0], values->Address, 0, 0, 63);
261410e230b6Smaya   dw[0] = v0_address;
261510e230b6Smaya   dw[1] = v0_address >> 32;
261610e230b6Smaya
261796c5ddc4Srjs   GFX9_VDENC_SURFACE_CONTROL_BITS_pack(data, &dw[2], &values->PictureFields);
261810e230b6Smaya}
261910e230b6Smaya
262096c5ddc4Srjs#define GFX9_VDENC_SURFACE_STATE_FIELDS_length      4
262196c5ddc4Srjsstruct GFX9_VDENC_SURFACE_STATE_FIELDS {
262210e230b6Smaya   float                                CrVCbUPixelOffsetVDirection;
262310e230b6Smaya   bool                                 SurfaceFormatByteSwizzle;
262410e230b6Smaya   uint32_t                             Colorspaceselection;
262510e230b6Smaya   uint32_t                             Width;
262610e230b6Smaya   uint32_t                             Height;
262710e230b6Smaya   uint32_t                             TileWalk;
262810e230b6Smaya#define TW_XMAJOR                                0
262910e230b6Smaya#define TW_YMAJOR                                1
263010e230b6Smaya   uint32_t                             TiledSurface;
263110e230b6Smaya   bool                                 HalfPitchforChroma;
263210e230b6Smaya   uint32_t                             SurfacePitch;
263310e230b6Smaya   uint32_t                             Format;
263410e230b6Smaya   uint32_t                             SurfaceFormat;
263510e230b6Smaya#define VDENC_YUV422                             0
263610e230b6Smaya#define VDENC_RGBA4444                           1
263710e230b6Smaya#define VDENC_YUV444                             2
263810e230b6Smaya#define VDENC_Y8_UNORM                           3
263910e230b6Smaya#define VDENC_PLANAR_420_8                       4
264010e230b6Smaya   uint32_t                             YOffsetforUCb;
264110e230b6Smaya   uint32_t                             XOffsetforUCb;
264210e230b6Smaya   uint32_t                             YOffsetforVCr;
264310e230b6Smaya   uint32_t                             XOffsetforVCr;
264410e230b6Smaya};
264510e230b6Smaya
264696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
264796c5ddc4SrjsGFX9_VDENC_SURFACE_STATE_FIELDS_pack(__attribute__((unused)) __gen_user_data *data,
264810e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
264996c5ddc4Srjs                                     __attribute__((unused)) const struct GFX9_VDENC_SURFACE_STATE_FIELDS * restrict values)
265010e230b6Smaya{
265110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
265210e230b6Smaya
265310e230b6Smaya   dw[0] =
265410e230b6Smaya      __gen_ufixed(values->CrVCbUPixelOffsetVDirection, 0, 1, 2) |
265510e230b6Smaya      __gen_uint(values->SurfaceFormatByteSwizzle, 2, 2) |
265610e230b6Smaya      __gen_uint(values->Colorspaceselection, 3, 3) |
265710e230b6Smaya      __gen_uint(values->Width, 4, 17) |
265810e230b6Smaya      __gen_uint(values->Height, 18, 31);
265910e230b6Smaya
266010e230b6Smaya   dw[1] =
266110e230b6Smaya      __gen_uint(values->TileWalk, 0, 0) |
266210e230b6Smaya      __gen_uint(values->TiledSurface, 1, 1) |
266310e230b6Smaya      __gen_uint(values->HalfPitchforChroma, 2, 2) |
266410e230b6Smaya      __gen_uint(values->SurfacePitch, 3, 19) |
266510e230b6Smaya      __gen_uint(values->Format, 27, 31) |
266610e230b6Smaya      __gen_uint(values->SurfaceFormat, 28, 31);
266710e230b6Smaya
266810e230b6Smaya   dw[2] =
266910e230b6Smaya      __gen_uint(values->YOffsetforUCb, 0, 14) |
267010e230b6Smaya      __gen_uint(values->XOffsetforUCb, 16, 30);
267110e230b6Smaya
267210e230b6Smaya   dw[3] =
267310e230b6Smaya      __gen_uint(values->YOffsetforVCr, 0, 15) |
267410e230b6Smaya      __gen_uint(values->XOffsetforVCr, 16, 28);
267510e230b6Smaya}
267610e230b6Smaya
267796c5ddc4Srjs#define GFX9_VERTEX_BUFFER_STATE_length        4
267896c5ddc4Srjsstruct GFX9_VERTEX_BUFFER_STATE {
267910e230b6Smaya   uint32_t                             BufferPitch;
268010e230b6Smaya   bool                                 NullVertexBuffer;
268110e230b6Smaya   bool                                 AddressModifyEnable;
268210e230b6Smaya   uint32_t                             MOCS;
268310e230b6Smaya   uint32_t                             VertexBufferIndex;
268410e230b6Smaya   __gen_address_type                   BufferStartingAddress;
268510e230b6Smaya   uint32_t                             BufferSize;
268610e230b6Smaya};
268710e230b6Smaya
268896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
268996c5ddc4SrjsGFX9_VERTEX_BUFFER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
269010e230b6Smaya                              __attribute__((unused)) void * restrict dst,
269196c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_VERTEX_BUFFER_STATE * restrict values)
269210e230b6Smaya{
269310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
269410e230b6Smaya
269510e230b6Smaya   dw[0] =
269610e230b6Smaya      __gen_uint(values->BufferPitch, 0, 11) |
269710e230b6Smaya      __gen_uint(values->NullVertexBuffer, 13, 13) |
269810e230b6Smaya      __gen_uint(values->AddressModifyEnable, 14, 14) |
269910e230b6Smaya      __gen_uint(values->MOCS, 16, 22) |
270010e230b6Smaya      __gen_uint(values->VertexBufferIndex, 26, 31);
270110e230b6Smaya
270210e230b6Smaya   const uint64_t v1_address =
270396c5ddc4Srjs      __gen_address(data, &dw[1], values->BufferStartingAddress, 0, 0, 63);
270410e230b6Smaya   dw[1] = v1_address;
270510e230b6Smaya   dw[2] = v1_address >> 32;
270610e230b6Smaya
270710e230b6Smaya   dw[3] =
270810e230b6Smaya      __gen_uint(values->BufferSize, 0, 31);
270910e230b6Smaya}
271010e230b6Smaya
271196c5ddc4Srjs#define GFX9_VERTEX_ELEMENT_STATE_length       2
271296c5ddc4Srjsstruct GFX9_VERTEX_ELEMENT_STATE {
271310e230b6Smaya   uint32_t                             SourceElementOffset;
271410e230b6Smaya   bool                                 EdgeFlagEnable;
271510e230b6Smaya   uint32_t                             SourceElementFormat;
271610e230b6Smaya   bool                                 Valid;
271710e230b6Smaya   uint32_t                             VertexBufferIndex;
271896c5ddc4Srjs   enum GFX9_3D_Vertex_Component_Control Component3Control;
271996c5ddc4Srjs   enum GFX9_3D_Vertex_Component_Control Component2Control;
272096c5ddc4Srjs   enum GFX9_3D_Vertex_Component_Control Component1Control;
272196c5ddc4Srjs   enum GFX9_3D_Vertex_Component_Control Component0Control;
272210e230b6Smaya};
272310e230b6Smaya
272496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
272596c5ddc4SrjsGFX9_VERTEX_ELEMENT_STATE_pack(__attribute__((unused)) __gen_user_data *data,
272610e230b6Smaya                               __attribute__((unused)) void * restrict dst,
272796c5ddc4Srjs                               __attribute__((unused)) const struct GFX9_VERTEX_ELEMENT_STATE * restrict values)
272810e230b6Smaya{
272910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
273010e230b6Smaya
273110e230b6Smaya   dw[0] =
273210e230b6Smaya      __gen_uint(values->SourceElementOffset, 0, 11) |
273310e230b6Smaya      __gen_uint(values->EdgeFlagEnable, 15, 15) |
273410e230b6Smaya      __gen_uint(values->SourceElementFormat, 16, 24) |
273510e230b6Smaya      __gen_uint(values->Valid, 25, 25) |
273610e230b6Smaya      __gen_uint(values->VertexBufferIndex, 26, 31);
273710e230b6Smaya
273810e230b6Smaya   dw[1] =
273910e230b6Smaya      __gen_uint(values->Component3Control, 16, 18) |
274010e230b6Smaya      __gen_uint(values->Component2Control, 20, 22) |
274110e230b6Smaya      __gen_uint(values->Component1Control, 24, 26) |
274210e230b6Smaya      __gen_uint(values->Component0Control, 28, 30);
274310e230b6Smaya}
274410e230b6Smaya
274596c5ddc4Srjs#define GFX9_3DPRIMITIVE_length                7
274696c5ddc4Srjs#define GFX9_3DPRIMITIVE_length_bias           2
274796c5ddc4Srjs#define GFX9_3DPRIMITIVE_header                 \
274810e230b6Smaya   .DWordLength                         =      5,  \
274910e230b6Smaya   ._3DCommandSubOpcode                 =      0,  \
275010e230b6Smaya   ._3DCommandOpcode                    =      3,  \
275110e230b6Smaya   .CommandSubType                      =      3,  \
275210e230b6Smaya   .CommandType                         =      3
275310e230b6Smaya
275496c5ddc4Srjsstruct GFX9_3DPRIMITIVE {
275510e230b6Smaya   uint32_t                             DWordLength;
275610e230b6Smaya   bool                                 PredicateEnable;
275710e230b6Smaya   bool                                 UAVCoherencyRequired;
275810e230b6Smaya   bool                                 IndirectParameterEnable;
275910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
276010e230b6Smaya   uint32_t                             _3DCommandOpcode;
276110e230b6Smaya   uint32_t                             CommandSubType;
276210e230b6Smaya   uint32_t                             CommandType;
276396c5ddc4Srjs   enum GFX9_3D_Prim_Topo_Type          PrimitiveTopologyType;
276410e230b6Smaya   uint32_t                             VertexAccessType;
276510e230b6Smaya#define SEQUENTIAL                               0
276610e230b6Smaya#define RANDOM                                   1
276710e230b6Smaya   bool                                 EndOffsetEnable;
276810e230b6Smaya   uint32_t                             VertexCountPerInstance;
276910e230b6Smaya   uint32_t                             StartVertexLocation;
277010e230b6Smaya   uint32_t                             InstanceCount;
277110e230b6Smaya   uint32_t                             StartInstanceLocation;
277210e230b6Smaya   int32_t                              BaseVertexLocation;
277310e230b6Smaya};
277410e230b6Smaya
277596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
277696c5ddc4SrjsGFX9_3DPRIMITIVE_pack(__attribute__((unused)) __gen_user_data *data,
277710e230b6Smaya                      __attribute__((unused)) void * restrict dst,
277896c5ddc4Srjs                      __attribute__((unused)) const struct GFX9_3DPRIMITIVE * restrict values)
277910e230b6Smaya{
278010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
278110e230b6Smaya
278210e230b6Smaya   dw[0] =
278310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
278410e230b6Smaya      __gen_uint(values->PredicateEnable, 8, 8) |
278510e230b6Smaya      __gen_uint(values->UAVCoherencyRequired, 9, 9) |
278610e230b6Smaya      __gen_uint(values->IndirectParameterEnable, 10, 10) |
278710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
278810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
278910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
279010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
279110e230b6Smaya
279210e230b6Smaya   dw[1] =
279310e230b6Smaya      __gen_uint(values->PrimitiveTopologyType, 0, 5) |
279410e230b6Smaya      __gen_uint(values->VertexAccessType, 8, 8) |
279510e230b6Smaya      __gen_uint(values->EndOffsetEnable, 9, 9);
279610e230b6Smaya
279710e230b6Smaya   dw[2] =
279810e230b6Smaya      __gen_uint(values->VertexCountPerInstance, 0, 31);
279910e230b6Smaya
280010e230b6Smaya   dw[3] =
280110e230b6Smaya      __gen_uint(values->StartVertexLocation, 0, 31);
280210e230b6Smaya
280310e230b6Smaya   dw[4] =
280410e230b6Smaya      __gen_uint(values->InstanceCount, 0, 31);
280510e230b6Smaya
280610e230b6Smaya   dw[5] =
280710e230b6Smaya      __gen_uint(values->StartInstanceLocation, 0, 31);
280810e230b6Smaya
280910e230b6Smaya   dw[6] =
281010e230b6Smaya      __gen_sint(values->BaseVertexLocation, 0, 31);
281110e230b6Smaya}
281210e230b6Smaya
281396c5ddc4Srjs#define GFX9_3DSTATE_AA_LINE_PARAMETERS_length      3
281496c5ddc4Srjs#define GFX9_3DSTATE_AA_LINE_PARAMETERS_length_bias      2
281596c5ddc4Srjs#define GFX9_3DSTATE_AA_LINE_PARAMETERS_header  \
281610e230b6Smaya   .DWordLength                         =      1,  \
281710e230b6Smaya   ._3DCommandSubOpcode                 =     10,  \
281810e230b6Smaya   ._3DCommandOpcode                    =      1,  \
281910e230b6Smaya   .CommandSubType                      =      3,  \
282010e230b6Smaya   .CommandType                         =      3
282110e230b6Smaya
282296c5ddc4Srjsstruct GFX9_3DSTATE_AA_LINE_PARAMETERS {
282310e230b6Smaya   uint32_t                             DWordLength;
282410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
282510e230b6Smaya   uint32_t                             _3DCommandOpcode;
282610e230b6Smaya   uint32_t                             CommandSubType;
282710e230b6Smaya   uint32_t                             CommandType;
282810e230b6Smaya   float                                AACoverageSlope;
282910e230b6Smaya   float                                AAPointCoverageSlope;
283010e230b6Smaya   float                                AACoverageBias;
283110e230b6Smaya   float                                AAPointCoverageBias;
283210e230b6Smaya   float                                AACoverageEndCapSlope;
283310e230b6Smaya   float                                AAPointCoverageEndCapSlope;
283410e230b6Smaya   float                                AACoverageEndCapBias;
283510e230b6Smaya   float                                AAPointCoverageEndCapBias;
283610e230b6Smaya};
283710e230b6Smaya
283896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
283996c5ddc4SrjsGFX9_3DSTATE_AA_LINE_PARAMETERS_pack(__attribute__((unused)) __gen_user_data *data,
284010e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
284196c5ddc4Srjs                                     __attribute__((unused)) const struct GFX9_3DSTATE_AA_LINE_PARAMETERS * restrict values)
284210e230b6Smaya{
284310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
284410e230b6Smaya
284510e230b6Smaya   dw[0] =
284610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
284710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
284810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
284910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
285010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
285110e230b6Smaya
285210e230b6Smaya   dw[1] =
285310e230b6Smaya      __gen_ufixed(values->AACoverageSlope, 0, 7, 8) |
285410e230b6Smaya      __gen_ufixed(values->AAPointCoverageSlope, 8, 15, 8) |
285510e230b6Smaya      __gen_ufixed(values->AACoverageBias, 16, 23, 8) |
285610e230b6Smaya      __gen_ufixed(values->AAPointCoverageBias, 24, 31, 8);
285710e230b6Smaya
285810e230b6Smaya   dw[2] =
285910e230b6Smaya      __gen_ufixed(values->AACoverageEndCapSlope, 0, 7, 8) |
286010e230b6Smaya      __gen_ufixed(values->AAPointCoverageEndCapSlope, 8, 15, 8) |
286110e230b6Smaya      __gen_ufixed(values->AACoverageEndCapBias, 16, 23, 8) |
286210e230b6Smaya      __gen_ufixed(values->AAPointCoverageEndCapBias, 24, 31, 8);
286310e230b6Smaya}
286410e230b6Smaya
286596c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_EDIT_DS_length_bias      2
286696c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_EDIT_DS_header\
286710e230b6Smaya   .DWordLength                         =      0,  \
286810e230b6Smaya   ._3DCommandSubOpcode                 =     70,  \
286910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
287010e230b6Smaya   .CommandSubType                      =      3,  \
287110e230b6Smaya   .CommandType                         =      3
287210e230b6Smaya
287396c5ddc4Srjsstruct GFX9_3DSTATE_BINDING_TABLE_EDIT_DS {
287410e230b6Smaya   uint32_t                             DWordLength;
287510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
287610e230b6Smaya   uint32_t                             _3DCommandOpcode;
287710e230b6Smaya   uint32_t                             CommandSubType;
287810e230b6Smaya   uint32_t                             CommandType;
287910e230b6Smaya   uint32_t                             BindingTableEditTarget;
288010e230b6Smaya#define AllCores                                 3
288110e230b6Smaya#define Core1                                    2
288210e230b6Smaya#define Core0                                    1
288310e230b6Smaya   uint32_t                             BindingTableBlockClear;
288410e230b6Smaya   /* variable length fields follow */
288510e230b6Smaya};
288610e230b6Smaya
288796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
288896c5ddc4SrjsGFX9_3DSTATE_BINDING_TABLE_EDIT_DS_pack(__attribute__((unused)) __gen_user_data *data,
288910e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
289096c5ddc4Srjs                                        __attribute__((unused)) const struct GFX9_3DSTATE_BINDING_TABLE_EDIT_DS * restrict values)
289110e230b6Smaya{
289210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
289310e230b6Smaya
289410e230b6Smaya   dw[0] =
289510e230b6Smaya      __gen_uint(values->DWordLength, 0, 8) |
289610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
289710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
289810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
289910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
290010e230b6Smaya
290110e230b6Smaya   dw[1] =
290210e230b6Smaya      __gen_uint(values->BindingTableEditTarget, 0, 1) |
290310e230b6Smaya      __gen_uint(values->BindingTableBlockClear, 16, 31);
290410e230b6Smaya}
290510e230b6Smaya
290696c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_EDIT_GS_length_bias      2
290796c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_EDIT_GS_header\
290810e230b6Smaya   .DWordLength                         =      0,  \
290910e230b6Smaya   ._3DCommandSubOpcode                 =     68,  \
291010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
291110e230b6Smaya   .CommandSubType                      =      3,  \
291210e230b6Smaya   .CommandType                         =      3
291310e230b6Smaya
291496c5ddc4Srjsstruct GFX9_3DSTATE_BINDING_TABLE_EDIT_GS {
291510e230b6Smaya   uint32_t                             DWordLength;
291610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
291710e230b6Smaya   uint32_t                             _3DCommandOpcode;
291810e230b6Smaya   uint32_t                             CommandSubType;
291910e230b6Smaya   uint32_t                             CommandType;
292010e230b6Smaya   uint32_t                             BindingTableEditTarget;
292110e230b6Smaya#define AllCores                                 3
292210e230b6Smaya#define Core1                                    2
292310e230b6Smaya#define Core0                                    1
292410e230b6Smaya   uint32_t                             BindingTableBlockClear;
292510e230b6Smaya   /* variable length fields follow */
292610e230b6Smaya};
292710e230b6Smaya
292896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
292996c5ddc4SrjsGFX9_3DSTATE_BINDING_TABLE_EDIT_GS_pack(__attribute__((unused)) __gen_user_data *data,
293010e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
293196c5ddc4Srjs                                        __attribute__((unused)) const struct GFX9_3DSTATE_BINDING_TABLE_EDIT_GS * restrict values)
293210e230b6Smaya{
293310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
293410e230b6Smaya
293510e230b6Smaya   dw[0] =
293610e230b6Smaya      __gen_uint(values->DWordLength, 0, 8) |
293710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
293810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
293910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
294010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
294110e230b6Smaya
294210e230b6Smaya   dw[1] =
294310e230b6Smaya      __gen_uint(values->BindingTableEditTarget, 0, 1) |
294410e230b6Smaya      __gen_uint(values->BindingTableBlockClear, 16, 31);
294510e230b6Smaya}
294610e230b6Smaya
294796c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_EDIT_HS_length_bias      2
294896c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_EDIT_HS_header\
294910e230b6Smaya   .DWordLength                         =      0,  \
295010e230b6Smaya   ._3DCommandSubOpcode                 =     69,  \
295110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
295210e230b6Smaya   .CommandSubType                      =      3,  \
295310e230b6Smaya   .CommandType                         =      3
295410e230b6Smaya
295596c5ddc4Srjsstruct GFX9_3DSTATE_BINDING_TABLE_EDIT_HS {
295610e230b6Smaya   uint32_t                             DWordLength;
295710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
295810e230b6Smaya   uint32_t                             _3DCommandOpcode;
295910e230b6Smaya   uint32_t                             CommandSubType;
296010e230b6Smaya   uint32_t                             CommandType;
296110e230b6Smaya   uint32_t                             BindingTableEditTarget;
296210e230b6Smaya#define AllCores                                 3
296310e230b6Smaya#define Core1                                    2
296410e230b6Smaya#define Core0                                    1
296510e230b6Smaya   uint32_t                             BindingTableBlockClear;
296610e230b6Smaya   /* variable length fields follow */
296710e230b6Smaya};
296810e230b6Smaya
296996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
297096c5ddc4SrjsGFX9_3DSTATE_BINDING_TABLE_EDIT_HS_pack(__attribute__((unused)) __gen_user_data *data,
297110e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
297296c5ddc4Srjs                                        __attribute__((unused)) const struct GFX9_3DSTATE_BINDING_TABLE_EDIT_HS * restrict values)
297310e230b6Smaya{
297410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
297510e230b6Smaya
297610e230b6Smaya   dw[0] =
297710e230b6Smaya      __gen_uint(values->DWordLength, 0, 8) |
297810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
297910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
298010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
298110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
298210e230b6Smaya
298310e230b6Smaya   dw[1] =
298410e230b6Smaya      __gen_uint(values->BindingTableEditTarget, 0, 1) |
298510e230b6Smaya      __gen_uint(values->BindingTableBlockClear, 16, 31);
298610e230b6Smaya}
298710e230b6Smaya
298896c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_EDIT_PS_length_bias      2
298996c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_EDIT_PS_header\
299010e230b6Smaya   .DWordLength                         =      0,  \
299110e230b6Smaya   ._3DCommandSubOpcode                 =     71,  \
299210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
299310e230b6Smaya   .CommandSubType                      =      3,  \
299410e230b6Smaya   .CommandType                         =      3
299510e230b6Smaya
299696c5ddc4Srjsstruct GFX9_3DSTATE_BINDING_TABLE_EDIT_PS {
299710e230b6Smaya   uint32_t                             DWordLength;
299810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
299910e230b6Smaya   uint32_t                             _3DCommandOpcode;
300010e230b6Smaya   uint32_t                             CommandSubType;
300110e230b6Smaya   uint32_t                             CommandType;
300210e230b6Smaya   uint32_t                             BindingTableEditTarget;
300310e230b6Smaya#define AllCores                                 3
300410e230b6Smaya#define Core1                                    2
300510e230b6Smaya#define Core0                                    1
300610e230b6Smaya   uint32_t                             BindingTableBlockClear;
300710e230b6Smaya   /* variable length fields follow */
300810e230b6Smaya};
300910e230b6Smaya
301096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
301196c5ddc4SrjsGFX9_3DSTATE_BINDING_TABLE_EDIT_PS_pack(__attribute__((unused)) __gen_user_data *data,
301210e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
301396c5ddc4Srjs                                        __attribute__((unused)) const struct GFX9_3DSTATE_BINDING_TABLE_EDIT_PS * restrict values)
301410e230b6Smaya{
301510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
301610e230b6Smaya
301710e230b6Smaya   dw[0] =
301810e230b6Smaya      __gen_uint(values->DWordLength, 0, 8) |
301910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
302010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
302110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
302210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
302310e230b6Smaya
302410e230b6Smaya   dw[1] =
302510e230b6Smaya      __gen_uint(values->BindingTableEditTarget, 0, 1) |
302610e230b6Smaya      __gen_uint(values->BindingTableBlockClear, 16, 31);
302710e230b6Smaya}
302810e230b6Smaya
302996c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_EDIT_VS_length_bias      2
303096c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_EDIT_VS_header\
303110e230b6Smaya   .DWordLength                         =      0,  \
303210e230b6Smaya   ._3DCommandSubOpcode                 =     67,  \
303310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
303410e230b6Smaya   .CommandSubType                      =      3,  \
303510e230b6Smaya   .CommandType                         =      3
303610e230b6Smaya
303796c5ddc4Srjsstruct GFX9_3DSTATE_BINDING_TABLE_EDIT_VS {
303810e230b6Smaya   uint32_t                             DWordLength;
303910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
304010e230b6Smaya   uint32_t                             _3DCommandOpcode;
304110e230b6Smaya   uint32_t                             CommandSubType;
304210e230b6Smaya   uint32_t                             CommandType;
304310e230b6Smaya   uint32_t                             BindingTableEditTarget;
304410e230b6Smaya#define AllCores                                 3
304510e230b6Smaya#define Core1                                    2
304610e230b6Smaya#define Core0                                    1
304710e230b6Smaya   uint32_t                             BindingTableBlockClear;
304810e230b6Smaya   /* variable length fields follow */
304910e230b6Smaya};
305010e230b6Smaya
305196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
305296c5ddc4SrjsGFX9_3DSTATE_BINDING_TABLE_EDIT_VS_pack(__attribute__((unused)) __gen_user_data *data,
305310e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
305496c5ddc4Srjs                                        __attribute__((unused)) const struct GFX9_3DSTATE_BINDING_TABLE_EDIT_VS * restrict values)
305510e230b6Smaya{
305610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
305710e230b6Smaya
305810e230b6Smaya   dw[0] =
305910e230b6Smaya      __gen_uint(values->DWordLength, 0, 8) |
306010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
306110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
306210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
306310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
306410e230b6Smaya
306510e230b6Smaya   dw[1] =
306610e230b6Smaya      __gen_uint(values->BindingTableEditTarget, 0, 1) |
306710e230b6Smaya      __gen_uint(values->BindingTableBlockClear, 16, 31);
306810e230b6Smaya}
306910e230b6Smaya
307096c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_POINTERS_DS_length      2
307196c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_POINTERS_DS_length_bias      2
307296c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_POINTERS_DS_header\
307310e230b6Smaya   .DWordLength                         =      0,  \
307410e230b6Smaya   ._3DCommandSubOpcode                 =     40,  \
307510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
307610e230b6Smaya   .CommandSubType                      =      3,  \
307710e230b6Smaya   .CommandType                         =      3
307810e230b6Smaya
307996c5ddc4Srjsstruct GFX9_3DSTATE_BINDING_TABLE_POINTERS_DS {
308010e230b6Smaya   uint32_t                             DWordLength;
308110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
308210e230b6Smaya   uint32_t                             _3DCommandOpcode;
308310e230b6Smaya   uint32_t                             CommandSubType;
308410e230b6Smaya   uint32_t                             CommandType;
308510e230b6Smaya   uint64_t                             PointertoDSBindingTable;
308610e230b6Smaya};
308710e230b6Smaya
308896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
308996c5ddc4SrjsGFX9_3DSTATE_BINDING_TABLE_POINTERS_DS_pack(__attribute__((unused)) __gen_user_data *data,
309010e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
309196c5ddc4Srjs                                            __attribute__((unused)) const struct GFX9_3DSTATE_BINDING_TABLE_POINTERS_DS * restrict values)
309210e230b6Smaya{
309310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
309410e230b6Smaya
309510e230b6Smaya   dw[0] =
309610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
309710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
309810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
309910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
310010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
310110e230b6Smaya
310210e230b6Smaya   dw[1] =
310310e230b6Smaya      __gen_offset(values->PointertoDSBindingTable, 5, 15);
310410e230b6Smaya}
310510e230b6Smaya
310696c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_POINTERS_GS_length      2
310796c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_POINTERS_GS_length_bias      2
310896c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_POINTERS_GS_header\
310910e230b6Smaya   .DWordLength                         =      0,  \
311010e230b6Smaya   ._3DCommandSubOpcode                 =     41,  \
311110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
311210e230b6Smaya   .CommandSubType                      =      3,  \
311310e230b6Smaya   .CommandType                         =      3
311410e230b6Smaya
311596c5ddc4Srjsstruct GFX9_3DSTATE_BINDING_TABLE_POINTERS_GS {
311610e230b6Smaya   uint32_t                             DWordLength;
311710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
311810e230b6Smaya   uint32_t                             _3DCommandOpcode;
311910e230b6Smaya   uint32_t                             CommandSubType;
312010e230b6Smaya   uint32_t                             CommandType;
312110e230b6Smaya   uint64_t                             PointertoGSBindingTable;
312210e230b6Smaya};
312310e230b6Smaya
312496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
312596c5ddc4SrjsGFX9_3DSTATE_BINDING_TABLE_POINTERS_GS_pack(__attribute__((unused)) __gen_user_data *data,
312610e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
312796c5ddc4Srjs                                            __attribute__((unused)) const struct GFX9_3DSTATE_BINDING_TABLE_POINTERS_GS * restrict values)
312810e230b6Smaya{
312910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
313010e230b6Smaya
313110e230b6Smaya   dw[0] =
313210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
313310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
313410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
313510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
313610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
313710e230b6Smaya
313810e230b6Smaya   dw[1] =
313910e230b6Smaya      __gen_offset(values->PointertoGSBindingTable, 5, 15);
314010e230b6Smaya}
314110e230b6Smaya
314296c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_POINTERS_HS_length      2
314396c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_POINTERS_HS_length_bias      2
314496c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_POINTERS_HS_header\
314510e230b6Smaya   .DWordLength                         =      0,  \
314610e230b6Smaya   ._3DCommandSubOpcode                 =     39,  \
314710e230b6Smaya   ._3DCommandOpcode                    =      0,  \
314810e230b6Smaya   .CommandSubType                      =      3,  \
314910e230b6Smaya   .CommandType                         =      3
315010e230b6Smaya
315196c5ddc4Srjsstruct GFX9_3DSTATE_BINDING_TABLE_POINTERS_HS {
315210e230b6Smaya   uint32_t                             DWordLength;
315310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
315410e230b6Smaya   uint32_t                             _3DCommandOpcode;
315510e230b6Smaya   uint32_t                             CommandSubType;
315610e230b6Smaya   uint32_t                             CommandType;
315710e230b6Smaya   uint64_t                             PointertoHSBindingTable;
315810e230b6Smaya};
315910e230b6Smaya
316096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
316196c5ddc4SrjsGFX9_3DSTATE_BINDING_TABLE_POINTERS_HS_pack(__attribute__((unused)) __gen_user_data *data,
316210e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
316396c5ddc4Srjs                                            __attribute__((unused)) const struct GFX9_3DSTATE_BINDING_TABLE_POINTERS_HS * restrict values)
316410e230b6Smaya{
316510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
316610e230b6Smaya
316710e230b6Smaya   dw[0] =
316810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
316910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
317010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
317110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
317210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
317310e230b6Smaya
317410e230b6Smaya   dw[1] =
317510e230b6Smaya      __gen_offset(values->PointertoHSBindingTable, 5, 15);
317610e230b6Smaya}
317710e230b6Smaya
317896c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_POINTERS_PS_length      2
317996c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_POINTERS_PS_length_bias      2
318096c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_POINTERS_PS_header\
318110e230b6Smaya   .DWordLength                         =      0,  \
318210e230b6Smaya   ._3DCommandSubOpcode                 =     42,  \
318310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
318410e230b6Smaya   .CommandSubType                      =      3,  \
318510e230b6Smaya   .CommandType                         =      3
318610e230b6Smaya
318796c5ddc4Srjsstruct GFX9_3DSTATE_BINDING_TABLE_POINTERS_PS {
318810e230b6Smaya   uint32_t                             DWordLength;
318910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
319010e230b6Smaya   uint32_t                             _3DCommandOpcode;
319110e230b6Smaya   uint32_t                             CommandSubType;
319210e230b6Smaya   uint32_t                             CommandType;
319310e230b6Smaya   uint64_t                             PointertoPSBindingTable;
319410e230b6Smaya};
319510e230b6Smaya
319696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
319796c5ddc4SrjsGFX9_3DSTATE_BINDING_TABLE_POINTERS_PS_pack(__attribute__((unused)) __gen_user_data *data,
319810e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
319996c5ddc4Srjs                                            __attribute__((unused)) const struct GFX9_3DSTATE_BINDING_TABLE_POINTERS_PS * restrict values)
320010e230b6Smaya{
320110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
320210e230b6Smaya
320310e230b6Smaya   dw[0] =
320410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
320510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
320610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
320710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
320810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
320910e230b6Smaya
321010e230b6Smaya   dw[1] =
321110e230b6Smaya      __gen_offset(values->PointertoPSBindingTable, 5, 15);
321210e230b6Smaya}
321310e230b6Smaya
321496c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_POINTERS_VS_length      2
321596c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_POINTERS_VS_length_bias      2
321696c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_POINTERS_VS_header\
321710e230b6Smaya   .DWordLength                         =      0,  \
321810e230b6Smaya   ._3DCommandSubOpcode                 =     38,  \
321910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
322010e230b6Smaya   .CommandSubType                      =      3,  \
322110e230b6Smaya   .CommandType                         =      3
322210e230b6Smaya
322396c5ddc4Srjsstruct GFX9_3DSTATE_BINDING_TABLE_POINTERS_VS {
322410e230b6Smaya   uint32_t                             DWordLength;
322510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
322610e230b6Smaya   uint32_t                             _3DCommandOpcode;
322710e230b6Smaya   uint32_t                             CommandSubType;
322810e230b6Smaya   uint32_t                             CommandType;
322910e230b6Smaya   uint64_t                             PointertoVSBindingTable;
323010e230b6Smaya};
323110e230b6Smaya
323296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
323396c5ddc4SrjsGFX9_3DSTATE_BINDING_TABLE_POINTERS_VS_pack(__attribute__((unused)) __gen_user_data *data,
323410e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
323596c5ddc4Srjs                                            __attribute__((unused)) const struct GFX9_3DSTATE_BINDING_TABLE_POINTERS_VS * restrict values)
323610e230b6Smaya{
323710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
323810e230b6Smaya
323910e230b6Smaya   dw[0] =
324010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
324110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
324210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
324310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
324410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
324510e230b6Smaya
324610e230b6Smaya   dw[1] =
324710e230b6Smaya      __gen_offset(values->PointertoVSBindingTable, 5, 15);
324810e230b6Smaya}
324910e230b6Smaya
325096c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_POOL_ALLOC_length      4
325196c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_POOL_ALLOC_length_bias      2
325296c5ddc4Srjs#define GFX9_3DSTATE_BINDING_TABLE_POOL_ALLOC_header\
325310e230b6Smaya   .DWordLength                         =      2,  \
325410e230b6Smaya   ._3DCommandSubOpcode                 =     25,  \
325510e230b6Smaya   ._3DCommandOpcode                    =      1,  \
325610e230b6Smaya   .CommandSubType                      =      3,  \
325710e230b6Smaya   .CommandType                         =      3
325810e230b6Smaya
325996c5ddc4Srjsstruct GFX9_3DSTATE_BINDING_TABLE_POOL_ALLOC {
326010e230b6Smaya   uint32_t                             DWordLength;
326110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
326210e230b6Smaya   uint32_t                             _3DCommandOpcode;
326310e230b6Smaya   uint32_t                             CommandSubType;
326410e230b6Smaya   uint32_t                             CommandType;
326510e230b6Smaya   uint32_t                             MOCS;
326696c5ddc4Srjs   bool                                 BindingTablePoolEnable;
326710e230b6Smaya   __gen_address_type                   BindingTablePoolBaseAddress;
326810e230b6Smaya   uint32_t                             BindingTablePoolBufferSize;
326910e230b6Smaya#define NoValidData                              0
327010e230b6Smaya};
327110e230b6Smaya
327296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
327396c5ddc4SrjsGFX9_3DSTATE_BINDING_TABLE_POOL_ALLOC_pack(__attribute__((unused)) __gen_user_data *data,
327410e230b6Smaya                                           __attribute__((unused)) void * restrict dst,
327596c5ddc4Srjs                                           __attribute__((unused)) const struct GFX9_3DSTATE_BINDING_TABLE_POOL_ALLOC * restrict values)
327610e230b6Smaya{
327710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
327810e230b6Smaya
327910e230b6Smaya   dw[0] =
328010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
328110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
328210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
328310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
328410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
328510e230b6Smaya
328610e230b6Smaya   const uint64_t v1 =
328710e230b6Smaya      __gen_uint(values->MOCS, 0, 6) |
328810e230b6Smaya      __gen_uint(values->BindingTablePoolEnable, 11, 11);
328910e230b6Smaya   const uint64_t v1_address =
329096c5ddc4Srjs      __gen_address(data, &dw[1], values->BindingTablePoolBaseAddress, v1, 12, 63);
329110e230b6Smaya   dw[1] = v1_address;
329210e230b6Smaya   dw[2] = (v1_address >> 32) | (v1 >> 32);
329310e230b6Smaya
329410e230b6Smaya   dw[3] =
329510e230b6Smaya      __gen_uint(values->BindingTablePoolBufferSize, 12, 31);
329610e230b6Smaya}
329710e230b6Smaya
329896c5ddc4Srjs#define GFX9_3DSTATE_BLEND_STATE_POINTERS_length      2
329996c5ddc4Srjs#define GFX9_3DSTATE_BLEND_STATE_POINTERS_length_bias      2
330096c5ddc4Srjs#define GFX9_3DSTATE_BLEND_STATE_POINTERS_header\
330110e230b6Smaya   .DWordLength                         =      0,  \
330210e230b6Smaya   ._3DCommandSubOpcode                 =     36,  \
330310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
330410e230b6Smaya   .CommandSubType                      =      3,  \
330510e230b6Smaya   .CommandType                         =      3
330610e230b6Smaya
330796c5ddc4Srjsstruct GFX9_3DSTATE_BLEND_STATE_POINTERS {
330810e230b6Smaya   uint32_t                             DWordLength;
330910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
331010e230b6Smaya   uint32_t                             _3DCommandOpcode;
331110e230b6Smaya   uint32_t                             CommandSubType;
331210e230b6Smaya   uint32_t                             CommandType;
331310e230b6Smaya   bool                                 BlendStatePointerValid;
331410e230b6Smaya   uint64_t                             BlendStatePointer;
331510e230b6Smaya};
331610e230b6Smaya
331796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
331896c5ddc4SrjsGFX9_3DSTATE_BLEND_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
331910e230b6Smaya                                       __attribute__((unused)) void * restrict dst,
332096c5ddc4Srjs                                       __attribute__((unused)) const struct GFX9_3DSTATE_BLEND_STATE_POINTERS * restrict values)
332110e230b6Smaya{
332210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
332310e230b6Smaya
332410e230b6Smaya   dw[0] =
332510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
332610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
332710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
332810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
332910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
333010e230b6Smaya
333110e230b6Smaya   dw[1] =
333210e230b6Smaya      __gen_uint(values->BlendStatePointerValid, 0, 0) |
333310e230b6Smaya      __gen_offset(values->BlendStatePointer, 6, 31);
333410e230b6Smaya}
333510e230b6Smaya
333696c5ddc4Srjs#define GFX9_3DSTATE_CC_STATE_POINTERS_length      2
333796c5ddc4Srjs#define GFX9_3DSTATE_CC_STATE_POINTERS_length_bias      2
333896c5ddc4Srjs#define GFX9_3DSTATE_CC_STATE_POINTERS_header   \
333910e230b6Smaya   .DWordLength                         =      0,  \
334010e230b6Smaya   ._3DCommandSubOpcode                 =     14,  \
334110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
334210e230b6Smaya   .CommandSubType                      =      3,  \
334310e230b6Smaya   .CommandType                         =      3
334410e230b6Smaya
334596c5ddc4Srjsstruct GFX9_3DSTATE_CC_STATE_POINTERS {
334610e230b6Smaya   uint32_t                             DWordLength;
334710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
334810e230b6Smaya   uint32_t                             _3DCommandOpcode;
334910e230b6Smaya   uint32_t                             CommandSubType;
335010e230b6Smaya   uint32_t                             CommandType;
335110e230b6Smaya   bool                                 ColorCalcStatePointerValid;
335210e230b6Smaya   uint64_t                             ColorCalcStatePointer;
335310e230b6Smaya};
335410e230b6Smaya
335596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
335696c5ddc4SrjsGFX9_3DSTATE_CC_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
335710e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
335896c5ddc4Srjs                                    __attribute__((unused)) const struct GFX9_3DSTATE_CC_STATE_POINTERS * restrict values)
335910e230b6Smaya{
336010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
336110e230b6Smaya
336210e230b6Smaya   dw[0] =
336310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
336410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
336510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
336610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
336710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
336810e230b6Smaya
336910e230b6Smaya   dw[1] =
337010e230b6Smaya      __gen_uint(values->ColorCalcStatePointerValid, 0, 0) |
337110e230b6Smaya      __gen_offset(values->ColorCalcStatePointer, 6, 31);
337210e230b6Smaya}
337310e230b6Smaya
337496c5ddc4Srjs#define GFX9_3DSTATE_CHROMA_KEY_length         4
337596c5ddc4Srjs#define GFX9_3DSTATE_CHROMA_KEY_length_bias      2
337696c5ddc4Srjs#define GFX9_3DSTATE_CHROMA_KEY_header          \
337710e230b6Smaya   .DWordLength                         =      2,  \
337810e230b6Smaya   ._3DCommandSubOpcode                 =      4,  \
337910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
338010e230b6Smaya   .CommandSubType                      =      3,  \
338110e230b6Smaya   .CommandType                         =      3
338210e230b6Smaya
338396c5ddc4Srjsstruct GFX9_3DSTATE_CHROMA_KEY {
338410e230b6Smaya   uint32_t                             DWordLength;
338510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
338610e230b6Smaya   uint32_t                             _3DCommandOpcode;
338710e230b6Smaya   uint32_t                             CommandSubType;
338810e230b6Smaya   uint32_t                             CommandType;
338910e230b6Smaya   uint32_t                             ChromaKeyTableIndex;
339010e230b6Smaya   uint32_t                             ChromaKeyLowValue;
339110e230b6Smaya   uint32_t                             ChromaKeyHighValue;
339210e230b6Smaya};
339310e230b6Smaya
339496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
339596c5ddc4SrjsGFX9_3DSTATE_CHROMA_KEY_pack(__attribute__((unused)) __gen_user_data *data,
339610e230b6Smaya                             __attribute__((unused)) void * restrict dst,
339796c5ddc4Srjs                             __attribute__((unused)) const struct GFX9_3DSTATE_CHROMA_KEY * restrict values)
339810e230b6Smaya{
339910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
340010e230b6Smaya
340110e230b6Smaya   dw[0] =
340210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
340310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
340410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
340510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
340610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
340710e230b6Smaya
340810e230b6Smaya   dw[1] =
340910e230b6Smaya      __gen_uint(values->ChromaKeyTableIndex, 30, 31);
341010e230b6Smaya
341110e230b6Smaya   dw[2] =
341210e230b6Smaya      __gen_uint(values->ChromaKeyLowValue, 0, 31);
341310e230b6Smaya
341410e230b6Smaya   dw[3] =
341510e230b6Smaya      __gen_uint(values->ChromaKeyHighValue, 0, 31);
341610e230b6Smaya}
341710e230b6Smaya
341896c5ddc4Srjs#define GFX9_3DSTATE_CLEAR_PARAMS_length       3
341996c5ddc4Srjs#define GFX9_3DSTATE_CLEAR_PARAMS_length_bias      2
342096c5ddc4Srjs#define GFX9_3DSTATE_CLEAR_PARAMS_header        \
342110e230b6Smaya   .DWordLength                         =      1,  \
342210e230b6Smaya   ._3DCommandSubOpcode                 =      4,  \
342310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
342410e230b6Smaya   .CommandSubType                      =      3,  \
342510e230b6Smaya   .CommandType                         =      3
342610e230b6Smaya
342796c5ddc4Srjsstruct GFX9_3DSTATE_CLEAR_PARAMS {
342810e230b6Smaya   uint32_t                             DWordLength;
342910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
343010e230b6Smaya   uint32_t                             _3DCommandOpcode;
343110e230b6Smaya   uint32_t                             CommandSubType;
343210e230b6Smaya   uint32_t                             CommandType;
343310e230b6Smaya   float                                DepthClearValue;
343410e230b6Smaya   bool                                 DepthClearValueValid;
343510e230b6Smaya};
343610e230b6Smaya
343796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
343896c5ddc4SrjsGFX9_3DSTATE_CLEAR_PARAMS_pack(__attribute__((unused)) __gen_user_data *data,
343910e230b6Smaya                               __attribute__((unused)) void * restrict dst,
344096c5ddc4Srjs                               __attribute__((unused)) const struct GFX9_3DSTATE_CLEAR_PARAMS * 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_float(values->DepthClearValue);
345310e230b6Smaya
345410e230b6Smaya   dw[2] =
345510e230b6Smaya      __gen_uint(values->DepthClearValueValid, 0, 0);
345610e230b6Smaya}
345710e230b6Smaya
345896c5ddc4Srjs#define GFX9_3DSTATE_CLIP_length               4
345996c5ddc4Srjs#define GFX9_3DSTATE_CLIP_length_bias          2
346096c5ddc4Srjs#define GFX9_3DSTATE_CLIP_header                \
346110e230b6Smaya   .DWordLength                         =      2,  \
346210e230b6Smaya   ._3DCommandSubOpcode                 =     18,  \
346310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
346410e230b6Smaya   .CommandSubType                      =      3,  \
346510e230b6Smaya   .CommandType                         =      3
346610e230b6Smaya
346796c5ddc4Srjsstruct GFX9_3DSTATE_CLIP {
346810e230b6Smaya   uint32_t                             DWordLength;
346910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
347010e230b6Smaya   uint32_t                             _3DCommandOpcode;
347110e230b6Smaya   uint32_t                             CommandSubType;
347210e230b6Smaya   uint32_t                             CommandType;
347310e230b6Smaya   uint32_t                             UserClipDistanceCullTestEnableBitmask;
347410e230b6Smaya   bool                                 StatisticsEnable;
347510e230b6Smaya   bool                                 ForceClipMode;
347610e230b6Smaya   bool                                 ForceUserClipDistanceClipTestEnableBitmask;
347710e230b6Smaya   bool                                 EarlyCullEnable;
347810e230b6Smaya   uint32_t                             VertexSubPixelPrecisionSelect;
347910e230b6Smaya#define _8Bit                                    0
348010e230b6Smaya#define _4Bit                                    1
348110e230b6Smaya   bool                                 ForceUserClipDistanceCullTestEnableBitmask;
348210e230b6Smaya   uint32_t                             TriangleFanProvokingVertexSelect;
348310e230b6Smaya   uint32_t                             LineStripListProvokingVertexSelect;
348410e230b6Smaya   uint32_t                             TriangleStripListProvokingVertexSelect;
348510e230b6Smaya   bool                                 NonPerspectiveBarycentricEnable;
348610e230b6Smaya   bool                                 PerspectiveDivideDisable;
348710e230b6Smaya   uint32_t                             ClipMode;
348810e230b6Smaya#define CLIPMODE_NORMAL                          0
348910e230b6Smaya#define CLIPMODE_REJECT_ALL                      3
349010e230b6Smaya#define CLIPMODE_ACCEPT_ALL                      4
349110e230b6Smaya   uint32_t                             UserClipDistanceClipTestEnableBitmask;
349210e230b6Smaya   bool                                 GuardbandClipTestEnable;
349310e230b6Smaya   bool                                 ViewportXYClipTestEnable;
349410e230b6Smaya   uint32_t                             APIMode;
349510e230b6Smaya#define APIMODE_OGL                              0
349610e230b6Smaya#define APIMODE_D3D                              1
349710e230b6Smaya   bool                                 ClipEnable;
349810e230b6Smaya   uint32_t                             MaximumVPIndex;
349910e230b6Smaya   bool                                 ForceZeroRTAIndexEnable;
350010e230b6Smaya   float                                MaximumPointWidth;
350110e230b6Smaya   float                                MinimumPointWidth;
350210e230b6Smaya};
350310e230b6Smaya
350496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
350596c5ddc4SrjsGFX9_3DSTATE_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
350610e230b6Smaya                       __attribute__((unused)) void * restrict dst,
350796c5ddc4Srjs                       __attribute__((unused)) const struct GFX9_3DSTATE_CLIP * restrict values)
350810e230b6Smaya{
350910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
351010e230b6Smaya
351110e230b6Smaya   dw[0] =
351210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
351310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
351410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
351510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
351610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
351710e230b6Smaya
351810e230b6Smaya   dw[1] =
351910e230b6Smaya      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
352010e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
352110e230b6Smaya      __gen_uint(values->ForceClipMode, 16, 16) |
352210e230b6Smaya      __gen_uint(values->ForceUserClipDistanceClipTestEnableBitmask, 17, 17) |
352310e230b6Smaya      __gen_uint(values->EarlyCullEnable, 18, 18) |
352410e230b6Smaya      __gen_uint(values->VertexSubPixelPrecisionSelect, 19, 19) |
352510e230b6Smaya      __gen_uint(values->ForceUserClipDistanceCullTestEnableBitmask, 20, 20);
352610e230b6Smaya
352710e230b6Smaya   dw[2] =
352810e230b6Smaya      __gen_uint(values->TriangleFanProvokingVertexSelect, 0, 1) |
352910e230b6Smaya      __gen_uint(values->LineStripListProvokingVertexSelect, 2, 3) |
353010e230b6Smaya      __gen_uint(values->TriangleStripListProvokingVertexSelect, 4, 5) |
353110e230b6Smaya      __gen_uint(values->NonPerspectiveBarycentricEnable, 8, 8) |
353210e230b6Smaya      __gen_uint(values->PerspectiveDivideDisable, 9, 9) |
353310e230b6Smaya      __gen_uint(values->ClipMode, 13, 15) |
353410e230b6Smaya      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 16, 23) |
353510e230b6Smaya      __gen_uint(values->GuardbandClipTestEnable, 26, 26) |
353610e230b6Smaya      __gen_uint(values->ViewportXYClipTestEnable, 28, 28) |
353710e230b6Smaya      __gen_uint(values->APIMode, 30, 30) |
353810e230b6Smaya      __gen_uint(values->ClipEnable, 31, 31);
353910e230b6Smaya
354010e230b6Smaya   dw[3] =
354110e230b6Smaya      __gen_uint(values->MaximumVPIndex, 0, 3) |
354210e230b6Smaya      __gen_uint(values->ForceZeroRTAIndexEnable, 5, 5) |
354310e230b6Smaya      __gen_ufixed(values->MaximumPointWidth, 6, 16, 3) |
354410e230b6Smaya      __gen_ufixed(values->MinimumPointWidth, 17, 27, 3);
354510e230b6Smaya}
354610e230b6Smaya
354796c5ddc4Srjs#define GFX9_3DSTATE_CONSTANT_DS_length       11
354896c5ddc4Srjs#define GFX9_3DSTATE_CONSTANT_DS_length_bias      2
354996c5ddc4Srjs#define GFX9_3DSTATE_CONSTANT_DS_header         \
355010e230b6Smaya   .DWordLength                         =      9,  \
355110e230b6Smaya   ._3DCommandSubOpcode                 =     26,  \
355210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
355310e230b6Smaya   .CommandSubType                      =      3,  \
355410e230b6Smaya   .CommandType                         =      3
355510e230b6Smaya
355696c5ddc4Srjsstruct GFX9_3DSTATE_CONSTANT_DS {
355710e230b6Smaya   uint32_t                             DWordLength;
355810e230b6Smaya   uint32_t                             MOCS;
355910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
356010e230b6Smaya   uint32_t                             _3DCommandOpcode;
356110e230b6Smaya   uint32_t                             CommandSubType;
356210e230b6Smaya   uint32_t                             CommandType;
356396c5ddc4Srjs   struct GFX9_3DSTATE_CONSTANT_BODY    ConstantBody;
356410e230b6Smaya};
356510e230b6Smaya
356696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
356796c5ddc4SrjsGFX9_3DSTATE_CONSTANT_DS_pack(__attribute__((unused)) __gen_user_data *data,
356810e230b6Smaya                              __attribute__((unused)) void * restrict dst,
356996c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_3DSTATE_CONSTANT_DS * restrict values)
357010e230b6Smaya{
357110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
357210e230b6Smaya
357310e230b6Smaya   dw[0] =
357410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
357510e230b6Smaya      __gen_uint(values->MOCS, 8, 14) |
357610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
357710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
357810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
357910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
358010e230b6Smaya
358196c5ddc4Srjs   GFX9_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
358210e230b6Smaya}
358310e230b6Smaya
358496c5ddc4Srjs#define GFX9_3DSTATE_CONSTANT_GS_length       11
358596c5ddc4Srjs#define GFX9_3DSTATE_CONSTANT_GS_length_bias      2
358696c5ddc4Srjs#define GFX9_3DSTATE_CONSTANT_GS_header         \
358710e230b6Smaya   .DWordLength                         =      9,  \
358810e230b6Smaya   ._3DCommandSubOpcode                 =     22,  \
358910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
359010e230b6Smaya   .CommandSubType                      =      3,  \
359110e230b6Smaya   .CommandType                         =      3
359210e230b6Smaya
359396c5ddc4Srjsstruct GFX9_3DSTATE_CONSTANT_GS {
359410e230b6Smaya   uint32_t                             DWordLength;
359510e230b6Smaya   uint32_t                             MOCS;
359610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
359710e230b6Smaya   uint32_t                             _3DCommandOpcode;
359810e230b6Smaya   uint32_t                             CommandSubType;
359910e230b6Smaya   uint32_t                             CommandType;
360096c5ddc4Srjs   struct GFX9_3DSTATE_CONSTANT_BODY    ConstantBody;
360110e230b6Smaya};
360210e230b6Smaya
360396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
360496c5ddc4SrjsGFX9_3DSTATE_CONSTANT_GS_pack(__attribute__((unused)) __gen_user_data *data,
360510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
360696c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_3DSTATE_CONSTANT_GS * restrict values)
360710e230b6Smaya{
360810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
360910e230b6Smaya
361010e230b6Smaya   dw[0] =
361110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
361210e230b6Smaya      __gen_uint(values->MOCS, 8, 14) |
361310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
361410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
361510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
361610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
361710e230b6Smaya
361896c5ddc4Srjs   GFX9_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
361910e230b6Smaya}
362010e230b6Smaya
362196c5ddc4Srjs#define GFX9_3DSTATE_CONSTANT_HS_length       11
362296c5ddc4Srjs#define GFX9_3DSTATE_CONSTANT_HS_length_bias      2
362396c5ddc4Srjs#define GFX9_3DSTATE_CONSTANT_HS_header         \
362410e230b6Smaya   .DWordLength                         =      9,  \
362510e230b6Smaya   ._3DCommandSubOpcode                 =     25,  \
362610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
362710e230b6Smaya   .CommandSubType                      =      3,  \
362810e230b6Smaya   .CommandType                         =      3
362910e230b6Smaya
363096c5ddc4Srjsstruct GFX9_3DSTATE_CONSTANT_HS {
363110e230b6Smaya   uint32_t                             DWordLength;
363210e230b6Smaya   uint32_t                             MOCS;
363310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
363410e230b6Smaya   uint32_t                             _3DCommandOpcode;
363510e230b6Smaya   uint32_t                             CommandSubType;
363610e230b6Smaya   uint32_t                             CommandType;
363796c5ddc4Srjs   struct GFX9_3DSTATE_CONSTANT_BODY    ConstantBody;
363810e230b6Smaya};
363910e230b6Smaya
364096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
364196c5ddc4SrjsGFX9_3DSTATE_CONSTANT_HS_pack(__attribute__((unused)) __gen_user_data *data,
364210e230b6Smaya                              __attribute__((unused)) void * restrict dst,
364396c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_3DSTATE_CONSTANT_HS * restrict values)
364410e230b6Smaya{
364510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
364610e230b6Smaya
364710e230b6Smaya   dw[0] =
364810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
364910e230b6Smaya      __gen_uint(values->MOCS, 8, 14) |
365010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
365110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
365210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
365310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
365410e230b6Smaya
365596c5ddc4Srjs   GFX9_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
365610e230b6Smaya}
365710e230b6Smaya
365896c5ddc4Srjs#define GFX9_3DSTATE_CONSTANT_PS_length       11
365996c5ddc4Srjs#define GFX9_3DSTATE_CONSTANT_PS_length_bias      2
366096c5ddc4Srjs#define GFX9_3DSTATE_CONSTANT_PS_header         \
366110e230b6Smaya   .DWordLength                         =      9,  \
366210e230b6Smaya   ._3DCommandSubOpcode                 =     23,  \
366310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
366410e230b6Smaya   .CommandSubType                      =      3,  \
366510e230b6Smaya   .CommandType                         =      3
366610e230b6Smaya
366796c5ddc4Srjsstruct GFX9_3DSTATE_CONSTANT_PS {
366810e230b6Smaya   uint32_t                             DWordLength;
366910e230b6Smaya   uint32_t                             MOCS;
367010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
367110e230b6Smaya   uint32_t                             _3DCommandOpcode;
367210e230b6Smaya   uint32_t                             CommandSubType;
367310e230b6Smaya   uint32_t                             CommandType;
367496c5ddc4Srjs   struct GFX9_3DSTATE_CONSTANT_BODY    ConstantBody;
367510e230b6Smaya};
367610e230b6Smaya
367796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
367896c5ddc4SrjsGFX9_3DSTATE_CONSTANT_PS_pack(__attribute__((unused)) __gen_user_data *data,
367910e230b6Smaya                              __attribute__((unused)) void * restrict dst,
368096c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_3DSTATE_CONSTANT_PS * restrict values)
368110e230b6Smaya{
368210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
368310e230b6Smaya
368410e230b6Smaya   dw[0] =
368510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
368610e230b6Smaya      __gen_uint(values->MOCS, 8, 14) |
368710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
368810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
368910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
369010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
369110e230b6Smaya
369296c5ddc4Srjs   GFX9_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
369310e230b6Smaya}
369410e230b6Smaya
369596c5ddc4Srjs#define GFX9_3DSTATE_CONSTANT_VS_length       11
369696c5ddc4Srjs#define GFX9_3DSTATE_CONSTANT_VS_length_bias      2
369796c5ddc4Srjs#define GFX9_3DSTATE_CONSTANT_VS_header         \
369810e230b6Smaya   .DWordLength                         =      9,  \
369910e230b6Smaya   ._3DCommandSubOpcode                 =     21,  \
370010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
370110e230b6Smaya   .CommandSubType                      =      3,  \
370210e230b6Smaya   .CommandType                         =      3
370310e230b6Smaya
370496c5ddc4Srjsstruct GFX9_3DSTATE_CONSTANT_VS {
370510e230b6Smaya   uint32_t                             DWordLength;
370610e230b6Smaya   uint32_t                             MOCS;
370710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
370810e230b6Smaya   uint32_t                             _3DCommandOpcode;
370910e230b6Smaya   uint32_t                             CommandSubType;
371010e230b6Smaya   uint32_t                             CommandType;
371196c5ddc4Srjs   struct GFX9_3DSTATE_CONSTANT_BODY    ConstantBody;
371210e230b6Smaya};
371310e230b6Smaya
371496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
371596c5ddc4SrjsGFX9_3DSTATE_CONSTANT_VS_pack(__attribute__((unused)) __gen_user_data *data,
371610e230b6Smaya                              __attribute__((unused)) void * restrict dst,
371796c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_3DSTATE_CONSTANT_VS * restrict values)
371810e230b6Smaya{
371910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
372010e230b6Smaya
372110e230b6Smaya   dw[0] =
372210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
372310e230b6Smaya      __gen_uint(values->MOCS, 8, 14) |
372410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
372510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
372610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
372710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
372810e230b6Smaya
372996c5ddc4Srjs   GFX9_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
373010e230b6Smaya}
373110e230b6Smaya
373296c5ddc4Srjs#define GFX9_3DSTATE_DEPTH_BUFFER_length       8
373396c5ddc4Srjs#define GFX9_3DSTATE_DEPTH_BUFFER_length_bias      2
373496c5ddc4Srjs#define GFX9_3DSTATE_DEPTH_BUFFER_header        \
373510e230b6Smaya   .DWordLength                         =      6,  \
373610e230b6Smaya   ._3DCommandSubOpcode                 =      5,  \
373710e230b6Smaya   ._3DCommandOpcode                    =      0,  \
373810e230b6Smaya   .CommandSubType                      =      3,  \
373910e230b6Smaya   .CommandType                         =      3
374010e230b6Smaya
374196c5ddc4Srjsstruct GFX9_3DSTATE_DEPTH_BUFFER {
374210e230b6Smaya   uint32_t                             DWordLength;
374310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
374410e230b6Smaya   uint32_t                             _3DCommandOpcode;
374510e230b6Smaya   uint32_t                             CommandSubType;
374610e230b6Smaya   uint32_t                             CommandType;
374710e230b6Smaya   uint32_t                             SurfacePitch;
374810e230b6Smaya   uint32_t                             SurfaceFormat;
374910e230b6Smaya#define D32_FLOAT                                1
375010e230b6Smaya#define D24_UNORM_X8_UINT                        3
375110e230b6Smaya#define D16_UNORM                                5
375210e230b6Smaya   bool                                 HierarchicalDepthBufferEnable;
375310e230b6Smaya   bool                                 StencilWriteEnable;
375410e230b6Smaya   bool                                 DepthWriteEnable;
375510e230b6Smaya   uint32_t                             SurfaceType;
375610e230b6Smaya#define SURFTYPE_2D                              1
375710e230b6Smaya#define SURFTYPE_CUBE                            3
375810e230b6Smaya#define SURFTYPE_NULL                            7
375910e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
376010e230b6Smaya   uint32_t                             LOD;
376110e230b6Smaya   uint32_t                             Width;
376210e230b6Smaya   uint32_t                             Height;
376310e230b6Smaya   uint32_t                             MOCS;
376410e230b6Smaya   uint32_t                             MinimumArrayElement;
376510e230b6Smaya   uint32_t                             Depth;
376610e230b6Smaya   uint32_t                             MipTailStartLOD;
376710e230b6Smaya   uint32_t                             TiledResourceMode;
376810e230b6Smaya#define NONE                                     0
376910e230b6Smaya#define TILEYF                                   1
377010e230b6Smaya#define TILEYS                                   2
377110e230b6Smaya   uint32_t                             SurfaceQPitch;
377210e230b6Smaya   uint32_t                             RenderTargetViewExtent;
377310e230b6Smaya};
377410e230b6Smaya
377596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
377696c5ddc4SrjsGFX9_3DSTATE_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
377710e230b6Smaya                               __attribute__((unused)) void * restrict dst,
377896c5ddc4Srjs                               __attribute__((unused)) const struct GFX9_3DSTATE_DEPTH_BUFFER * restrict values)
377910e230b6Smaya{
378010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
378110e230b6Smaya
378210e230b6Smaya   dw[0] =
378310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
378410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
378510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
378610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
378710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
378810e230b6Smaya
378910e230b6Smaya   dw[1] =
379010e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 17) |
379110e230b6Smaya      __gen_uint(values->SurfaceFormat, 18, 20) |
379210e230b6Smaya      __gen_uint(values->HierarchicalDepthBufferEnable, 22, 22) |
379310e230b6Smaya      __gen_uint(values->StencilWriteEnable, 27, 27) |
379410e230b6Smaya      __gen_uint(values->DepthWriteEnable, 28, 28) |
379510e230b6Smaya      __gen_uint(values->SurfaceType, 29, 31);
379610e230b6Smaya
379710e230b6Smaya   const uint64_t v2_address =
379896c5ddc4Srjs      __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 0, 63);
379910e230b6Smaya   dw[2] = v2_address;
380010e230b6Smaya   dw[3] = v2_address >> 32;
380110e230b6Smaya
380210e230b6Smaya   dw[4] =
380310e230b6Smaya      __gen_uint(values->LOD, 0, 3) |
380410e230b6Smaya      __gen_uint(values->Width, 4, 17) |
380510e230b6Smaya      __gen_uint(values->Height, 18, 31);
380610e230b6Smaya
380710e230b6Smaya   dw[5] =
380810e230b6Smaya      __gen_uint(values->MOCS, 0, 6) |
380910e230b6Smaya      __gen_uint(values->MinimumArrayElement, 10, 20) |
381010e230b6Smaya      __gen_uint(values->Depth, 21, 31);
381110e230b6Smaya
381210e230b6Smaya   dw[6] =
381310e230b6Smaya      __gen_uint(values->MipTailStartLOD, 26, 29) |
381410e230b6Smaya      __gen_uint(values->TiledResourceMode, 30, 31);
381510e230b6Smaya
381610e230b6Smaya   dw[7] =
381710e230b6Smaya      __gen_uint(values->SurfaceQPitch, 0, 14) |
381810e230b6Smaya      __gen_uint(values->RenderTargetViewExtent, 21, 31);
381910e230b6Smaya}
382010e230b6Smaya
382196c5ddc4Srjs#define GFX9_3DSTATE_DRAWING_RECTANGLE_length      4
382296c5ddc4Srjs#define GFX9_3DSTATE_DRAWING_RECTANGLE_length_bias      2
382396c5ddc4Srjs#define GFX9_3DSTATE_DRAWING_RECTANGLE_header   \
382410e230b6Smaya   .DWordLength                         =      2,  \
382510e230b6Smaya   ._3DCommandSubOpcode                 =      0,  \
382610e230b6Smaya   ._3DCommandOpcode                    =      1,  \
382710e230b6Smaya   .CommandSubType                      =      3,  \
382810e230b6Smaya   .CommandType                         =      3
382910e230b6Smaya
383096c5ddc4Srjsstruct GFX9_3DSTATE_DRAWING_RECTANGLE {
383110e230b6Smaya   uint32_t                             DWordLength;
383210e230b6Smaya   uint32_t                             CoreModeSelect;
383310e230b6Smaya#define Legacy                                   0
383410e230b6Smaya#define Core0Enabled                             1
383510e230b6Smaya#define Core1Enabled                             2
383610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
383710e230b6Smaya   uint32_t                             _3DCommandOpcode;
383810e230b6Smaya   uint32_t                             CommandSubType;
383910e230b6Smaya   uint32_t                             CommandType;
384010e230b6Smaya   uint32_t                             ClippedDrawingRectangleXMin;
384110e230b6Smaya   uint32_t                             ClippedDrawingRectangleYMin;
384210e230b6Smaya   uint32_t                             ClippedDrawingRectangleXMax;
384310e230b6Smaya   uint32_t                             ClippedDrawingRectangleYMax;
384410e230b6Smaya   int32_t                              DrawingRectangleOriginX;
384510e230b6Smaya   int32_t                              DrawingRectangleOriginY;
384610e230b6Smaya};
384710e230b6Smaya
384896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
384996c5ddc4SrjsGFX9_3DSTATE_DRAWING_RECTANGLE_pack(__attribute__((unused)) __gen_user_data *data,
385010e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
385196c5ddc4Srjs                                    __attribute__((unused)) const struct GFX9_3DSTATE_DRAWING_RECTANGLE * restrict values)
385210e230b6Smaya{
385310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
385410e230b6Smaya
385510e230b6Smaya   dw[0] =
385610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
385710e230b6Smaya      __gen_uint(values->CoreModeSelect, 14, 15) |
385810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
385910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
386010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
386110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
386210e230b6Smaya
386310e230b6Smaya   dw[1] =
386410e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleXMin, 0, 15) |
386510e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleYMin, 16, 31);
386610e230b6Smaya
386710e230b6Smaya   dw[2] =
386810e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleXMax, 0, 15) |
386910e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleYMax, 16, 31);
387010e230b6Smaya
387110e230b6Smaya   dw[3] =
387210e230b6Smaya      __gen_sint(values->DrawingRectangleOriginX, 0, 15) |
387310e230b6Smaya      __gen_sint(values->DrawingRectangleOriginY, 16, 31);
387410e230b6Smaya}
387510e230b6Smaya
387696c5ddc4Srjs#define GFX9_3DSTATE_DS_length                11
387796c5ddc4Srjs#define GFX9_3DSTATE_DS_length_bias            2
387896c5ddc4Srjs#define GFX9_3DSTATE_DS_header                  \
387910e230b6Smaya   .DWordLength                         =      9,  \
388010e230b6Smaya   ._3DCommandSubOpcode                 =     29,  \
388110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
388210e230b6Smaya   .CommandSubType                      =      3,  \
388310e230b6Smaya   .CommandType                         =      3
388410e230b6Smaya
388596c5ddc4Srjsstruct GFX9_3DSTATE_DS {
388610e230b6Smaya   uint32_t                             DWordLength;
388710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
388810e230b6Smaya   uint32_t                             _3DCommandOpcode;
388910e230b6Smaya   uint32_t                             CommandSubType;
389010e230b6Smaya   uint32_t                             CommandType;
389110e230b6Smaya   uint64_t                             KernelStartPointer;
389210e230b6Smaya   bool                                 SoftwareExceptionEnable;
389310e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
389410e230b6Smaya   bool                                 AccessesUAV;
389510e230b6Smaya   uint32_t                             FloatingPointMode;
389610e230b6Smaya#define IEEE754                                  0
389710e230b6Smaya#define Alternate                                1
389810e230b6Smaya   uint32_t                             ThreadDispatchPriority;
389910e230b6Smaya#define High                                     1
390010e230b6Smaya   uint32_t                             BindingTableEntryCount;
390110e230b6Smaya   uint32_t                             SamplerCount;
390210e230b6Smaya#define NoSamplers                               0
390310e230b6Smaya#define _14Samplers                              1
390410e230b6Smaya#define _58Samplers                              2
390510e230b6Smaya#define _912Samplers                             3
390610e230b6Smaya#define _1316Samplers                            4
390710e230b6Smaya   bool                                 VectorMaskEnable;
390810e230b6Smaya   uint32_t                             PerThreadScratchSpace;
390910e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
391010e230b6Smaya   uint32_t                             PatchURBEntryReadOffset;
391110e230b6Smaya   uint32_t                             PatchURBEntryReadLength;
391210e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData;
391310e230b6Smaya   bool                                 Enable;
391410e230b6Smaya   bool                                 CacheDisable;
391510e230b6Smaya   bool                                 ComputeWCoordinateEnable;
391610e230b6Smaya   uint32_t                             DispatchMode;
391710e230b6Smaya#define DISPATCH_MODE_SIMD4X2                    0
391810e230b6Smaya#define DISPATCH_MODE_SIMD8_SINGLE_PATCH         1
391910e230b6Smaya#define DISPATCH_MODE_SIMD8_SINGLE_OR_DUAL_PATCH 2
392010e230b6Smaya   bool                                 StatisticsEnable;
392110e230b6Smaya   uint32_t                             MaximumNumberofThreads;
392210e230b6Smaya   uint32_t                             UserClipDistanceCullTestEnableBitmask;
392310e230b6Smaya   uint32_t                             UserClipDistanceClipTestEnableBitmask;
392410e230b6Smaya   uint32_t                             VertexURBEntryOutputLength;
392510e230b6Smaya   uint32_t                             VertexURBEntryOutputReadOffset;
392610e230b6Smaya   uint64_t                             DUAL_PATCHKernelStartPointer;
392710e230b6Smaya};
392810e230b6Smaya
392996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
393096c5ddc4SrjsGFX9_3DSTATE_DS_pack(__attribute__((unused)) __gen_user_data *data,
393110e230b6Smaya                     __attribute__((unused)) void * restrict dst,
393296c5ddc4Srjs                     __attribute__((unused)) const struct GFX9_3DSTATE_DS * restrict values)
393310e230b6Smaya{
393410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
393510e230b6Smaya
393610e230b6Smaya   dw[0] =
393710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
393810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
393910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
394010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
394110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
394210e230b6Smaya
394310e230b6Smaya   const uint64_t v1 =
394410e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 63);
394510e230b6Smaya   dw[1] = v1;
394610e230b6Smaya   dw[2] = v1 >> 32;
394710e230b6Smaya
394810e230b6Smaya   dw[3] =
394910e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
395010e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
395110e230b6Smaya      __gen_uint(values->AccessesUAV, 14, 14) |
395210e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
395310e230b6Smaya      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
395410e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
395510e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
395610e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30);
395710e230b6Smaya
395810e230b6Smaya   const uint64_t v4 =
395910e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
396010e230b6Smaya   const uint64_t v4_address =
396196c5ddc4Srjs      __gen_address(data, &dw[4], values->ScratchSpaceBasePointer, v4, 10, 63);
396210e230b6Smaya   dw[4] = v4_address;
396310e230b6Smaya   dw[5] = (v4_address >> 32) | (v4 >> 32);
396410e230b6Smaya
396510e230b6Smaya   dw[6] =
396610e230b6Smaya      __gen_uint(values->PatchURBEntryReadOffset, 4, 9) |
396710e230b6Smaya      __gen_uint(values->PatchURBEntryReadLength, 11, 17) |
396810e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
396910e230b6Smaya
397010e230b6Smaya   dw[7] =
397110e230b6Smaya      __gen_uint(values->Enable, 0, 0) |
397210e230b6Smaya      __gen_uint(values->CacheDisable, 1, 1) |
397310e230b6Smaya      __gen_uint(values->ComputeWCoordinateEnable, 2, 2) |
397410e230b6Smaya      __gen_uint(values->DispatchMode, 3, 4) |
397510e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
397610e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 21, 29);
397710e230b6Smaya
397810e230b6Smaya   dw[8] =
397910e230b6Smaya      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
398010e230b6Smaya      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 8, 15) |
398110e230b6Smaya      __gen_uint(values->VertexURBEntryOutputLength, 16, 20) |
398210e230b6Smaya      __gen_uint(values->VertexURBEntryOutputReadOffset, 21, 26);
398310e230b6Smaya
398410e230b6Smaya   const uint64_t v9 =
398510e230b6Smaya      __gen_offset(values->DUAL_PATCHKernelStartPointer, 6, 63);
398610e230b6Smaya   dw[9] = v9;
398710e230b6Smaya   dw[10] = v9 >> 32;
398810e230b6Smaya}
398910e230b6Smaya
399096c5ddc4Srjs#define GFX9_3DSTATE_GATHER_CONSTANT_DS_length_bias      2
399196c5ddc4Srjs#define GFX9_3DSTATE_GATHER_CONSTANT_DS_header  \
399210e230b6Smaya   .DWordLength                         =      1,  \
399310e230b6Smaya   ._3DCommandSubOpcode                 =     55,  \
399410e230b6Smaya   ._3DCommandOpcode                    =      0,  \
399510e230b6Smaya   .CommandSubType                      =      3,  \
399610e230b6Smaya   .CommandType                         =      3
399710e230b6Smaya
399896c5ddc4Srjsstruct GFX9_3DSTATE_GATHER_CONSTANT_DS {
399910e230b6Smaya   uint32_t                             DWordLength;
400010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
400110e230b6Smaya   uint32_t                             _3DCommandOpcode;
400210e230b6Smaya   uint32_t                             CommandSubType;
400310e230b6Smaya   uint32_t                             CommandType;
400410e230b6Smaya   uint32_t                             UpdateGatherTableOnly;
400510e230b6Smaya#define CommitGather                             0
400610e230b6Smaya#define NonCommitGather                          1
400710e230b6Smaya   uint32_t                             ConstantBufferBindingTableBlock;
400810e230b6Smaya   uint32_t                             ConstantBufferValid;
400910e230b6Smaya   uint32_t                             OnDieTable;
401010e230b6Smaya#define Load                                     0
401110e230b6Smaya#define Read                                     1
401210e230b6Smaya   bool                                 ConstantBufferDx9GenerateStall;
401310e230b6Smaya   uint64_t                             GatherBufferOffset;
401410e230b6Smaya   /* variable length fields follow */
401510e230b6Smaya};
401610e230b6Smaya
401796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
401896c5ddc4SrjsGFX9_3DSTATE_GATHER_CONSTANT_DS_pack(__attribute__((unused)) __gen_user_data *data,
401910e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
402096c5ddc4Srjs                                     __attribute__((unused)) const struct GFX9_3DSTATE_GATHER_CONSTANT_DS * restrict values)
402110e230b6Smaya{
402210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
402310e230b6Smaya
402410e230b6Smaya   dw[0] =
402510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
402610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
402710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
402810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
402910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
403010e230b6Smaya
403110e230b6Smaya   dw[1] =
403210e230b6Smaya      __gen_uint(values->UpdateGatherTableOnly, 1, 1) |
403310e230b6Smaya      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
403410e230b6Smaya      __gen_uint(values->ConstantBufferValid, 16, 31);
403510e230b6Smaya
403610e230b6Smaya   dw[2] =
403710e230b6Smaya      __gen_uint(values->OnDieTable, 3, 3) |
403810e230b6Smaya      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
403910e230b6Smaya      __gen_offset(values->GatherBufferOffset, 6, 22);
404010e230b6Smaya}
404110e230b6Smaya
404296c5ddc4Srjs#define GFX9_3DSTATE_GATHER_CONSTANT_GS_length_bias      2
404396c5ddc4Srjs#define GFX9_3DSTATE_GATHER_CONSTANT_GS_header  \
404410e230b6Smaya   .DWordLength                         =      1,  \
404510e230b6Smaya   ._3DCommandSubOpcode                 =     53,  \
404610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
404710e230b6Smaya   .CommandSubType                      =      3,  \
404810e230b6Smaya   .CommandType                         =      3
404910e230b6Smaya
405096c5ddc4Srjsstruct GFX9_3DSTATE_GATHER_CONSTANT_GS {
405110e230b6Smaya   uint32_t                             DWordLength;
405210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
405310e230b6Smaya   uint32_t                             _3DCommandOpcode;
405410e230b6Smaya   uint32_t                             CommandSubType;
405510e230b6Smaya   uint32_t                             CommandType;
405610e230b6Smaya   uint32_t                             UpdateGatherTableOnly;
405710e230b6Smaya#define CommitGather                             0
405810e230b6Smaya#define NonCommitGather                          1
405910e230b6Smaya   uint32_t                             ConstantBufferBindingTableBlock;
406010e230b6Smaya   uint32_t                             ConstantBufferValid;
406110e230b6Smaya   uint32_t                             OnDieTable;
406210e230b6Smaya#define Load                                     0
406310e230b6Smaya#define Read                                     1
406410e230b6Smaya   bool                                 ConstantBufferDx9GenerateStall;
406510e230b6Smaya   uint64_t                             GatherBufferOffset;
406610e230b6Smaya   /* variable length fields follow */
406710e230b6Smaya};
406810e230b6Smaya
406996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
407096c5ddc4SrjsGFX9_3DSTATE_GATHER_CONSTANT_GS_pack(__attribute__((unused)) __gen_user_data *data,
407110e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
407296c5ddc4Srjs                                     __attribute__((unused)) const struct GFX9_3DSTATE_GATHER_CONSTANT_GS * restrict values)
407310e230b6Smaya{
407410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
407510e230b6Smaya
407610e230b6Smaya   dw[0] =
407710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
407810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
407910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
408010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
408110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
408210e230b6Smaya
408310e230b6Smaya   dw[1] =
408410e230b6Smaya      __gen_uint(values->UpdateGatherTableOnly, 1, 1) |
408510e230b6Smaya      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
408610e230b6Smaya      __gen_uint(values->ConstantBufferValid, 16, 31);
408710e230b6Smaya
408810e230b6Smaya   dw[2] =
408910e230b6Smaya      __gen_uint(values->OnDieTable, 3, 3) |
409010e230b6Smaya      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
409110e230b6Smaya      __gen_offset(values->GatherBufferOffset, 6, 22);
409210e230b6Smaya}
409310e230b6Smaya
409496c5ddc4Srjs#define GFX9_3DSTATE_GATHER_CONSTANT_HS_length_bias      2
409596c5ddc4Srjs#define GFX9_3DSTATE_GATHER_CONSTANT_HS_header  \
409610e230b6Smaya   .DWordLength                         =      1,  \
409710e230b6Smaya   ._3DCommandSubOpcode                 =     54,  \
409810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
409910e230b6Smaya   .CommandSubType                      =      3,  \
410010e230b6Smaya   .CommandType                         =      3
410110e230b6Smaya
410296c5ddc4Srjsstruct GFX9_3DSTATE_GATHER_CONSTANT_HS {
410310e230b6Smaya   uint32_t                             DWordLength;
410410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
410510e230b6Smaya   uint32_t                             _3DCommandOpcode;
410610e230b6Smaya   uint32_t                             CommandSubType;
410710e230b6Smaya   uint32_t                             CommandType;
410810e230b6Smaya   uint32_t                             UpdateGatherTableOnly;
410910e230b6Smaya#define CommitGather                             0
411010e230b6Smaya#define NonCommitGather                          1
411110e230b6Smaya   uint32_t                             ConstantBufferBindingTableBlock;
411210e230b6Smaya   uint32_t                             ConstantBufferValid;
411310e230b6Smaya   uint32_t                             OnDieTable;
411410e230b6Smaya#define Load                                     0
411510e230b6Smaya#define Read                                     1
411610e230b6Smaya   bool                                 ConstantBufferDx9GenerateStall;
411710e230b6Smaya   uint64_t                             GatherBufferOffset;
411810e230b6Smaya   /* variable length fields follow */
411910e230b6Smaya};
412010e230b6Smaya
412196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
412296c5ddc4SrjsGFX9_3DSTATE_GATHER_CONSTANT_HS_pack(__attribute__((unused)) __gen_user_data *data,
412310e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
412496c5ddc4Srjs                                     __attribute__((unused)) const struct GFX9_3DSTATE_GATHER_CONSTANT_HS * restrict values)
412510e230b6Smaya{
412610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
412710e230b6Smaya
412810e230b6Smaya   dw[0] =
412910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
413010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
413110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
413210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
413310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
413410e230b6Smaya
413510e230b6Smaya   dw[1] =
413610e230b6Smaya      __gen_uint(values->UpdateGatherTableOnly, 1, 1) |
413710e230b6Smaya      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
413810e230b6Smaya      __gen_uint(values->ConstantBufferValid, 16, 31);
413910e230b6Smaya
414010e230b6Smaya   dw[2] =
414110e230b6Smaya      __gen_uint(values->OnDieTable, 3, 3) |
414210e230b6Smaya      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
414310e230b6Smaya      __gen_offset(values->GatherBufferOffset, 6, 22);
414410e230b6Smaya}
414510e230b6Smaya
414696c5ddc4Srjs#define GFX9_3DSTATE_GATHER_CONSTANT_PS_length_bias      2
414796c5ddc4Srjs#define GFX9_3DSTATE_GATHER_CONSTANT_PS_header  \
414810e230b6Smaya   .DWordLength                         =      1,  \
414910e230b6Smaya   ._3DCommandSubOpcode                 =     56,  \
415010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
415110e230b6Smaya   .CommandSubType                      =      3,  \
415210e230b6Smaya   .CommandType                         =      3
415310e230b6Smaya
415496c5ddc4Srjsstruct GFX9_3DSTATE_GATHER_CONSTANT_PS {
415510e230b6Smaya   uint32_t                             DWordLength;
415610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
415710e230b6Smaya   uint32_t                             _3DCommandOpcode;
415810e230b6Smaya   uint32_t                             CommandSubType;
415910e230b6Smaya   uint32_t                             CommandType;
416010e230b6Smaya   bool                                 DX9OnDieRegisterReadEnable;
416110e230b6Smaya   uint32_t                             UpdateGatherTableOnly;
416210e230b6Smaya#define CommitGather                             0
416310e230b6Smaya#define NonCommitGather                          1
416410e230b6Smaya   uint32_t                             ConstantBufferBindingTableBlock;
416510e230b6Smaya   uint32_t                             ConstantBufferValid;
416610e230b6Smaya   uint32_t                             OnDieTable;
416710e230b6Smaya#define Load                                     0
416810e230b6Smaya#define Read                                     1
416910e230b6Smaya   bool                                 ConstantBufferDx9Enable;
417010e230b6Smaya   bool                                 ConstantBufferDx9GenerateStall;
417110e230b6Smaya   uint64_t                             GatherBufferOffset;
417210e230b6Smaya   /* variable length fields follow */
417310e230b6Smaya};
417410e230b6Smaya
417596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
417696c5ddc4SrjsGFX9_3DSTATE_GATHER_CONSTANT_PS_pack(__attribute__((unused)) __gen_user_data *data,
417710e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
417896c5ddc4Srjs                                     __attribute__((unused)) const struct GFX9_3DSTATE_GATHER_CONSTANT_PS * restrict values)
417910e230b6Smaya{
418010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
418110e230b6Smaya
418210e230b6Smaya   dw[0] =
418310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
418410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
418510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
418610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
418710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
418810e230b6Smaya
418910e230b6Smaya   dw[1] =
419010e230b6Smaya      __gen_uint(values->DX9OnDieRegisterReadEnable, 0, 0) |
419110e230b6Smaya      __gen_uint(values->UpdateGatherTableOnly, 1, 1) |
419210e230b6Smaya      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
419310e230b6Smaya      __gen_uint(values->ConstantBufferValid, 16, 31);
419410e230b6Smaya
419510e230b6Smaya   dw[2] =
419610e230b6Smaya      __gen_uint(values->OnDieTable, 3, 3) |
419710e230b6Smaya      __gen_uint(values->ConstantBufferDx9Enable, 4, 4) |
419810e230b6Smaya      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
419910e230b6Smaya      __gen_offset(values->GatherBufferOffset, 6, 22);
420010e230b6Smaya}
420110e230b6Smaya
420296c5ddc4Srjs#define GFX9_3DSTATE_GATHER_CONSTANT_VS_length_bias      2
420396c5ddc4Srjs#define GFX9_3DSTATE_GATHER_CONSTANT_VS_header  \
420410e230b6Smaya   .DWordLength                         =      0,  \
420510e230b6Smaya   ._3DCommandSubOpcode                 =     52,  \
420610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
420710e230b6Smaya   .CommandSubType                      =      3,  \
420810e230b6Smaya   .CommandType                         =      3
420910e230b6Smaya
421096c5ddc4Srjsstruct GFX9_3DSTATE_GATHER_CONSTANT_VS {
421110e230b6Smaya   uint32_t                             DWordLength;
421210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
421310e230b6Smaya   uint32_t                             _3DCommandOpcode;
421410e230b6Smaya   uint32_t                             CommandSubType;
421510e230b6Smaya   uint32_t                             CommandType;
421610e230b6Smaya   bool                                 DX9OnDieRegisterReadEnable;
421710e230b6Smaya   uint32_t                             UpdateGatherTableOnly;
421810e230b6Smaya#define CommitGather                             0
421910e230b6Smaya#define NonCommitGather                          1
422010e230b6Smaya   uint32_t                             ConstantBufferBindingTableBlock;
422110e230b6Smaya   uint32_t                             ConstantBufferValid;
422210e230b6Smaya   uint32_t                             OnDieTable;
422310e230b6Smaya#define Load                                     0
422410e230b6Smaya#define Read                                     1
422510e230b6Smaya   bool                                 ConstantBufferDx9Enable;
422610e230b6Smaya   bool                                 ConstantBufferDx9GenerateStall;
422710e230b6Smaya   uint64_t                             GatherBufferOffset;
422810e230b6Smaya   /* variable length fields follow */
422910e230b6Smaya};
423010e230b6Smaya
423196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
423296c5ddc4SrjsGFX9_3DSTATE_GATHER_CONSTANT_VS_pack(__attribute__((unused)) __gen_user_data *data,
423310e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
423496c5ddc4Srjs                                     __attribute__((unused)) const struct GFX9_3DSTATE_GATHER_CONSTANT_VS * restrict values)
423510e230b6Smaya{
423610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
423710e230b6Smaya
423810e230b6Smaya   dw[0] =
423910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
424010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
424110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
424210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
424310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
424410e230b6Smaya
424510e230b6Smaya   dw[1] =
424610e230b6Smaya      __gen_uint(values->DX9OnDieRegisterReadEnable, 0, 0) |
424710e230b6Smaya      __gen_uint(values->UpdateGatherTableOnly, 1, 1) |
424810e230b6Smaya      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
424910e230b6Smaya      __gen_uint(values->ConstantBufferValid, 16, 31);
425010e230b6Smaya
425110e230b6Smaya   dw[2] =
425210e230b6Smaya      __gen_uint(values->OnDieTable, 3, 3) |
425310e230b6Smaya      __gen_uint(values->ConstantBufferDx9Enable, 4, 4) |
425410e230b6Smaya      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
425510e230b6Smaya      __gen_offset(values->GatherBufferOffset, 6, 22);
425610e230b6Smaya}
425710e230b6Smaya
425896c5ddc4Srjs#define GFX9_3DSTATE_GATHER_POOL_ALLOC_length      4
425996c5ddc4Srjs#define GFX9_3DSTATE_GATHER_POOL_ALLOC_length_bias      2
426096c5ddc4Srjs#define GFX9_3DSTATE_GATHER_POOL_ALLOC_header   \
426110e230b6Smaya   .DWordLength                         =      2,  \
426210e230b6Smaya   ._3DCommandSubOpcode                 =     26,  \
426310e230b6Smaya   ._3DCommandOpcode                    =      1,  \
426410e230b6Smaya   .CommandSubType                      =      3,  \
426510e230b6Smaya   .CommandType                         =      3
426610e230b6Smaya
426796c5ddc4Srjsstruct GFX9_3DSTATE_GATHER_POOL_ALLOC {
426810e230b6Smaya   uint32_t                             DWordLength;
426910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
427010e230b6Smaya   uint32_t                             _3DCommandOpcode;
427110e230b6Smaya   uint32_t                             CommandSubType;
427210e230b6Smaya   uint32_t                             CommandType;
427310e230b6Smaya   uint32_t                             MOCS;
427410e230b6Smaya   bool                                 GatherPoolEnable;
427510e230b6Smaya   __gen_address_type                   GatherPoolBaseAddress;
427610e230b6Smaya   uint32_t                             GatherPoolBufferSize;
427710e230b6Smaya};
427810e230b6Smaya
427996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
428096c5ddc4SrjsGFX9_3DSTATE_GATHER_POOL_ALLOC_pack(__attribute__((unused)) __gen_user_data *data,
428110e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
428296c5ddc4Srjs                                    __attribute__((unused)) const struct GFX9_3DSTATE_GATHER_POOL_ALLOC * restrict values)
428310e230b6Smaya{
428410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
428510e230b6Smaya
428610e230b6Smaya   dw[0] =
428710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
428810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
428910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
429010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
429110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
429210e230b6Smaya
429310e230b6Smaya   const uint64_t v1 =
429410e230b6Smaya      __gen_uint(values->MOCS, 0, 6) |
429510e230b6Smaya      __gen_uint(values->GatherPoolEnable, 11, 11);
429610e230b6Smaya   const uint64_t v1_address =
429796c5ddc4Srjs      __gen_address(data, &dw[1], values->GatherPoolBaseAddress, v1, 12, 63);
429810e230b6Smaya   dw[1] = v1_address;
429910e230b6Smaya   dw[2] = (v1_address >> 32) | (v1 >> 32);
430010e230b6Smaya
430110e230b6Smaya   dw[3] =
430210e230b6Smaya      __gen_uint(values->GatherPoolBufferSize, 12, 31);
430310e230b6Smaya}
430410e230b6Smaya
430596c5ddc4Srjs#define GFX9_3DSTATE_GS_length                10
430696c5ddc4Srjs#define GFX9_3DSTATE_GS_length_bias            2
430796c5ddc4Srjs#define GFX9_3DSTATE_GS_header                  \
430810e230b6Smaya   .DWordLength                         =      8,  \
430910e230b6Smaya   ._3DCommandSubOpcode                 =     17,  \
431010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
431110e230b6Smaya   .CommandSubType                      =      3,  \
431210e230b6Smaya   .CommandType                         =      3
431310e230b6Smaya
431496c5ddc4Srjsstruct GFX9_3DSTATE_GS {
431510e230b6Smaya   uint32_t                             DWordLength;
431610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
431710e230b6Smaya   uint32_t                             _3DCommandOpcode;
431810e230b6Smaya   uint32_t                             CommandSubType;
431910e230b6Smaya   uint32_t                             CommandType;
432010e230b6Smaya   uint64_t                             KernelStartPointer;
432110e230b6Smaya   uint32_t                             ExpectedVertexCount;
432210e230b6Smaya   bool                                 SoftwareExceptionEnable;
432310e230b6Smaya   bool                                 MaskStackExceptionEnable;
432410e230b6Smaya   bool                                 AccessesUAV;
432510e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
432610e230b6Smaya   uint32_t                             FloatingPointMode;
432710e230b6Smaya#define IEEE754                                  0
432810e230b6Smaya#define Alternate                                1
432910e230b6Smaya   uint32_t                             ThreadDispatchPriority;
433010e230b6Smaya#define High                                     1
433110e230b6Smaya   uint32_t                             BindingTableEntryCount;
433210e230b6Smaya   uint32_t                             SamplerCount;
433310e230b6Smaya#define NoSamplers                               0
433410e230b6Smaya#define _14Samplers                              1
433510e230b6Smaya#define _58Samplers                              2
433610e230b6Smaya#define _912Samplers                             3
433710e230b6Smaya#define _1316Samplers                            4
433810e230b6Smaya   bool                                 VectorMaskEnable;
433910e230b6Smaya   bool                                 SingleProgramFlow;
434010e230b6Smaya   uint32_t                             PerThreadScratchSpace;
434110e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
434210e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData;
434310e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
434410e230b6Smaya   bool                                 IncludeVertexHandles;
434510e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
434696c5ddc4Srjs   enum GFX9_3D_Prim_Topo_Type          OutputTopology;
434710e230b6Smaya   uint32_t                             OutputVertexSize;
434810e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData54;
434910e230b6Smaya   bool                                 Enable;
435010e230b6Smaya   bool                                 DiscardAdjacency;
435110e230b6Smaya   uint32_t                             ReorderMode;
435210e230b6Smaya#define LEADING                                  0
435310e230b6Smaya#define TRAILING                                 1
435410e230b6Smaya   uint32_t                             Hint;
435510e230b6Smaya   bool                                 IncludePrimitiveID;
435610e230b6Smaya   uint32_t                             InvocationsIncrementValue;
435710e230b6Smaya   bool                                 StatisticsEnable;
435810e230b6Smaya   uint32_t                             DispatchMode;
435910e230b6Smaya#define DISPATCH_MODE_DualInstance               1
436010e230b6Smaya#define DISPATCH_MODE_DualObject                 2
436110e230b6Smaya#define DISPATCH_MODE_SIMD8                      3
436210e230b6Smaya   uint32_t                             DefaultStreamId;
436310e230b6Smaya   uint32_t                             InstanceControl;
436410e230b6Smaya   uint32_t                             ControlDataHeaderSize;
436510e230b6Smaya   uint32_t                             MaximumNumberofThreads;
436610e230b6Smaya   uint32_t                             StaticOutputVertexCount;
436710e230b6Smaya   bool                                 StaticOutput;
436810e230b6Smaya   uint32_t                             ControlDataFormat;
436910e230b6Smaya#define CUT                                      0
437010e230b6Smaya#define SID                                      1
437110e230b6Smaya   uint32_t                             UserClipDistanceCullTestEnableBitmask;
437210e230b6Smaya   uint32_t                             UserClipDistanceClipTestEnableBitmask;
437310e230b6Smaya   uint32_t                             VertexURBEntryOutputLength;
437410e230b6Smaya   uint32_t                             VertexURBEntryOutputReadOffset;
437510e230b6Smaya};
437610e230b6Smaya
437796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
437896c5ddc4SrjsGFX9_3DSTATE_GS_pack(__attribute__((unused)) __gen_user_data *data,
437910e230b6Smaya                     __attribute__((unused)) void * restrict dst,
438096c5ddc4Srjs                     __attribute__((unused)) const struct GFX9_3DSTATE_GS * restrict values)
438110e230b6Smaya{
438210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
438310e230b6Smaya
438410e230b6Smaya   dw[0] =
438510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
438610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
438710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
438810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
438910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
439010e230b6Smaya
439110e230b6Smaya   const uint64_t v1 =
439210e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 63);
439310e230b6Smaya   dw[1] = v1;
439410e230b6Smaya   dw[2] = v1 >> 32;
439510e230b6Smaya
439610e230b6Smaya   dw[3] =
439710e230b6Smaya      __gen_uint(values->ExpectedVertexCount, 0, 5) |
439810e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
439910e230b6Smaya      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
440010e230b6Smaya      __gen_uint(values->AccessesUAV, 12, 12) |
440110e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
440210e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
440310e230b6Smaya      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
440410e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
440510e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
440610e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
440710e230b6Smaya      __gen_uint(values->SingleProgramFlow, 31, 31);
440810e230b6Smaya
440910e230b6Smaya   const uint64_t v4 =
441010e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
441110e230b6Smaya   const uint64_t v4_address =
441296c5ddc4Srjs      __gen_address(data, &dw[4], values->ScratchSpaceBasePointer, v4, 10, 63);
441310e230b6Smaya   dw[4] = v4_address;
441410e230b6Smaya   dw[5] = (v4_address >> 32) | (v4 >> 32);
441510e230b6Smaya
441610e230b6Smaya   dw[6] =
441710e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData, 0, 3) |
441810e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
441910e230b6Smaya      __gen_uint(values->IncludeVertexHandles, 10, 10) |
442010e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
442110e230b6Smaya      __gen_uint(values->OutputTopology, 17, 22) |
442210e230b6Smaya      __gen_uint(values->OutputVertexSize, 23, 28) |
442310e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData54, 29, 30);
442410e230b6Smaya
442510e230b6Smaya   dw[7] =
442610e230b6Smaya      __gen_uint(values->Enable, 0, 0) |
442710e230b6Smaya      __gen_uint(values->DiscardAdjacency, 1, 1) |
442810e230b6Smaya      __gen_uint(values->ReorderMode, 2, 2) |
442910e230b6Smaya      __gen_uint(values->Hint, 3, 3) |
443010e230b6Smaya      __gen_uint(values->IncludePrimitiveID, 4, 4) |
443110e230b6Smaya      __gen_uint(values->InvocationsIncrementValue, 5, 9) |
443210e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
443310e230b6Smaya      __gen_uint(values->DispatchMode, 11, 12) |
443410e230b6Smaya      __gen_uint(values->DefaultStreamId, 13, 14) |
443510e230b6Smaya      __gen_uint(values->InstanceControl, 15, 19) |
443610e230b6Smaya      __gen_uint(values->ControlDataHeaderSize, 20, 23);
443710e230b6Smaya
443810e230b6Smaya   dw[8] =
443910e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 0, 8) |
444010e230b6Smaya      __gen_uint(values->StaticOutputVertexCount, 16, 26) |
444110e230b6Smaya      __gen_uint(values->StaticOutput, 30, 30) |
444210e230b6Smaya      __gen_uint(values->ControlDataFormat, 31, 31);
444310e230b6Smaya
444410e230b6Smaya   dw[9] =
444510e230b6Smaya      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
444610e230b6Smaya      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 8, 15) |
444710e230b6Smaya      __gen_uint(values->VertexURBEntryOutputLength, 16, 20) |
444810e230b6Smaya      __gen_uint(values->VertexURBEntryOutputReadOffset, 21, 26);
444910e230b6Smaya}
445010e230b6Smaya
445196c5ddc4Srjs#define GFX9_3DSTATE_HIER_DEPTH_BUFFER_length      5
445296c5ddc4Srjs#define GFX9_3DSTATE_HIER_DEPTH_BUFFER_length_bias      2
445396c5ddc4Srjs#define GFX9_3DSTATE_HIER_DEPTH_BUFFER_header   \
445410e230b6Smaya   .DWordLength                         =      3,  \
445510e230b6Smaya   ._3DCommandSubOpcode                 =      7,  \
445610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
445710e230b6Smaya   .CommandSubType                      =      3,  \
445810e230b6Smaya   .CommandType                         =      3
445910e230b6Smaya
446096c5ddc4Srjsstruct GFX9_3DSTATE_HIER_DEPTH_BUFFER {
446110e230b6Smaya   uint32_t                             DWordLength;
446210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
446310e230b6Smaya   uint32_t                             _3DCommandOpcode;
446410e230b6Smaya   uint32_t                             CommandSubType;
446510e230b6Smaya   uint32_t                             CommandType;
446610e230b6Smaya   uint32_t                             SurfacePitch;
446710e230b6Smaya   uint32_t                             MOCS;
446810e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
446910e230b6Smaya   uint32_t                             SurfaceQPitch;
447010e230b6Smaya};
447110e230b6Smaya
447296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
447396c5ddc4SrjsGFX9_3DSTATE_HIER_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
447410e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
447596c5ddc4Srjs                                    __attribute__((unused)) const struct GFX9_3DSTATE_HIER_DEPTH_BUFFER * restrict values)
447610e230b6Smaya{
447710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
447810e230b6Smaya
447910e230b6Smaya   dw[0] =
448010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
448110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
448210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
448310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
448410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
448510e230b6Smaya
448610e230b6Smaya   dw[1] =
448710e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 16) |
448810e230b6Smaya      __gen_uint(values->MOCS, 25, 31);
448910e230b6Smaya
449010e230b6Smaya   const uint64_t v2_address =
449196c5ddc4Srjs      __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 0, 63);
449210e230b6Smaya   dw[2] = v2_address;
449310e230b6Smaya   dw[3] = v2_address >> 32;
449410e230b6Smaya
449510e230b6Smaya   dw[4] =
449610e230b6Smaya      __gen_uint(values->SurfaceQPitch, 0, 14);
449710e230b6Smaya}
449810e230b6Smaya
449996c5ddc4Srjs#define GFX9_3DSTATE_HS_length                 9
450096c5ddc4Srjs#define GFX9_3DSTATE_HS_length_bias            2
450196c5ddc4Srjs#define GFX9_3DSTATE_HS_header                  \
450210e230b6Smaya   .DWordLength                         =      7,  \
450310e230b6Smaya   ._3DCommandSubOpcode                 =     27,  \
450410e230b6Smaya   ._3DCommandOpcode                    =      0,  \
450510e230b6Smaya   .CommandSubType                      =      3,  \
450610e230b6Smaya   .CommandType                         =      3
450710e230b6Smaya
450896c5ddc4Srjsstruct GFX9_3DSTATE_HS {
450910e230b6Smaya   uint32_t                             DWordLength;
451010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
451110e230b6Smaya   uint32_t                             _3DCommandOpcode;
451210e230b6Smaya   uint32_t                             CommandSubType;
451310e230b6Smaya   uint32_t                             CommandType;
451410e230b6Smaya   bool                                 SoftwareExceptionEnable;
451510e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
451610e230b6Smaya   uint32_t                             FloatingPointMode;
451710e230b6Smaya#define IEEE754                                  0
451810e230b6Smaya#define alternate                                1
451910e230b6Smaya   uint32_t                             ThreadDispatchPriority;
452010e230b6Smaya#define High                                     1
452110e230b6Smaya   uint32_t                             BindingTableEntryCount;
452210e230b6Smaya   uint32_t                             SamplerCount;
452310e230b6Smaya#define NoSamplers                               0
452410e230b6Smaya#define _14Samplers                              1
452510e230b6Smaya#define _58Samplers                              2
452610e230b6Smaya#define _912Samplers                             3
452710e230b6Smaya#define _1316Samplers                            4
452810e230b6Smaya   uint32_t                             InstanceCount;
452910e230b6Smaya   uint32_t                             MaximumNumberofThreads;
453010e230b6Smaya   bool                                 StatisticsEnable;
453110e230b6Smaya   bool                                 Enable;
453210e230b6Smaya   uint64_t                             KernelStartPointer;
453310e230b6Smaya   uint32_t                             PerThreadScratchSpace;
453410e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
453510e230b6Smaya   bool                                 IncludePrimitiveID;
453610e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
453710e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
453810e230b6Smaya   uint32_t                             DispatchMode;
453910e230b6Smaya#define DISPATCH_MODE_SINGLE_PATCH               0
454010e230b6Smaya#define DISPATCH_MODE_DUAL_PATCH                 1
454110e230b6Smaya#define DISPATCH_MODE__8_PATCH                   2
454210e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData;
454310e230b6Smaya   bool                                 IncludeVertexHandles;
454410e230b6Smaya   bool                                 AccessesUAV;
454510e230b6Smaya   bool                                 VectorMaskEnable;
454610e230b6Smaya   bool                                 SingleProgramFlow;
454710e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData5;
454810e230b6Smaya};
454910e230b6Smaya
455096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
455196c5ddc4SrjsGFX9_3DSTATE_HS_pack(__attribute__((unused)) __gen_user_data *data,
455210e230b6Smaya                     __attribute__((unused)) void * restrict dst,
455396c5ddc4Srjs                     __attribute__((unused)) const struct GFX9_3DSTATE_HS * restrict values)
455410e230b6Smaya{
455510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
455610e230b6Smaya
455710e230b6Smaya   dw[0] =
455810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
455910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
456010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
456110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
456210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
456310e230b6Smaya
456410e230b6Smaya   dw[1] =
456510e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 12, 12) |
456610e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
456710e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
456810e230b6Smaya      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
456910e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
457010e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29);
457110e230b6Smaya
457210e230b6Smaya   dw[2] =
457310e230b6Smaya      __gen_uint(values->InstanceCount, 0, 3) |
457410e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 8, 16) |
457510e230b6Smaya      __gen_uint(values->StatisticsEnable, 29, 29) |
457610e230b6Smaya      __gen_uint(values->Enable, 31, 31);
457710e230b6Smaya
457810e230b6Smaya   const uint64_t v3 =
457910e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 63);
458010e230b6Smaya   dw[3] = v3;
458110e230b6Smaya   dw[4] = v3 >> 32;
458210e230b6Smaya
458310e230b6Smaya   const uint64_t v5 =
458410e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
458510e230b6Smaya   const uint64_t v5_address =
458696c5ddc4Srjs      __gen_address(data, &dw[5], values->ScratchSpaceBasePointer, v5, 10, 63);
458710e230b6Smaya   dw[5] = v5_address;
458810e230b6Smaya   dw[6] = (v5_address >> 32) | (v5 >> 32);
458910e230b6Smaya
459010e230b6Smaya   dw[7] =
459110e230b6Smaya      __gen_uint(values->IncludePrimitiveID, 0, 0) |
459210e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
459310e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
459410e230b6Smaya      __gen_uint(values->DispatchMode, 17, 18) |
459510e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData, 19, 23) |
459610e230b6Smaya      __gen_uint(values->IncludeVertexHandles, 24, 24) |
459710e230b6Smaya      __gen_uint(values->AccessesUAV, 25, 25) |
459810e230b6Smaya      __gen_uint(values->VectorMaskEnable, 26, 26) |
459910e230b6Smaya      __gen_uint(values->SingleProgramFlow, 27, 27) |
460010e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData5, 28, 28);
460110e230b6Smaya
460210e230b6Smaya   dw[8] = 0;
460310e230b6Smaya}
460410e230b6Smaya
460596c5ddc4Srjs#define GFX9_3DSTATE_INDEX_BUFFER_length       5
460696c5ddc4Srjs#define GFX9_3DSTATE_INDEX_BUFFER_length_bias      2
460796c5ddc4Srjs#define GFX9_3DSTATE_INDEX_BUFFER_header        \
460810e230b6Smaya   .DWordLength                         =      3,  \
460910e230b6Smaya   ._3DCommandSubOpcode                 =     10,  \
461010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
461110e230b6Smaya   .CommandSubType                      =      3,  \
461210e230b6Smaya   .CommandType                         =      3
461310e230b6Smaya
461496c5ddc4Srjsstruct GFX9_3DSTATE_INDEX_BUFFER {
461510e230b6Smaya   uint32_t                             DWordLength;
461610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
461710e230b6Smaya   uint32_t                             _3DCommandOpcode;
461810e230b6Smaya   uint32_t                             CommandSubType;
461910e230b6Smaya   uint32_t                             CommandType;
462010e230b6Smaya   uint32_t                             MOCS;
462110e230b6Smaya   uint32_t                             IndexFormat;
462210e230b6Smaya#define INDEX_BYTE                               0
462310e230b6Smaya#define INDEX_WORD                               1
462410e230b6Smaya#define INDEX_DWORD                              2
462510e230b6Smaya   __gen_address_type                   BufferStartingAddress;
462610e230b6Smaya   uint32_t                             BufferSize;
462710e230b6Smaya};
462810e230b6Smaya
462996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
463096c5ddc4SrjsGFX9_3DSTATE_INDEX_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
463110e230b6Smaya                               __attribute__((unused)) void * restrict dst,
463296c5ddc4Srjs                               __attribute__((unused)) const struct GFX9_3DSTATE_INDEX_BUFFER * restrict values)
463310e230b6Smaya{
463410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
463510e230b6Smaya
463610e230b6Smaya   dw[0] =
463710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
463810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
463910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
464010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
464110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
464210e230b6Smaya
464310e230b6Smaya   dw[1] =
464410e230b6Smaya      __gen_uint(values->MOCS, 0, 6) |
464510e230b6Smaya      __gen_uint(values->IndexFormat, 8, 9);
464610e230b6Smaya
464710e230b6Smaya   const uint64_t v2_address =
464896c5ddc4Srjs      __gen_address(data, &dw[2], values->BufferStartingAddress, 0, 0, 63);
464910e230b6Smaya   dw[2] = v2_address;
465010e230b6Smaya   dw[3] = v2_address >> 32;
465110e230b6Smaya
465210e230b6Smaya   dw[4] =
465310e230b6Smaya      __gen_uint(values->BufferSize, 0, 31);
465410e230b6Smaya}
465510e230b6Smaya
465696c5ddc4Srjs#define GFX9_3DSTATE_LINE_STIPPLE_length       3
465796c5ddc4Srjs#define GFX9_3DSTATE_LINE_STIPPLE_length_bias      2
465896c5ddc4Srjs#define GFX9_3DSTATE_LINE_STIPPLE_header        \
465910e230b6Smaya   .DWordLength                         =      1,  \
466010e230b6Smaya   ._3DCommandSubOpcode                 =      8,  \
466110e230b6Smaya   ._3DCommandOpcode                    =      1,  \
466210e230b6Smaya   .CommandSubType                      =      3,  \
466310e230b6Smaya   .CommandType                         =      3
466410e230b6Smaya
466596c5ddc4Srjsstruct GFX9_3DSTATE_LINE_STIPPLE {
466610e230b6Smaya   uint32_t                             DWordLength;
466710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
466810e230b6Smaya   uint32_t                             _3DCommandOpcode;
466910e230b6Smaya   uint32_t                             CommandSubType;
467010e230b6Smaya   uint32_t                             CommandType;
467110e230b6Smaya   uint32_t                             LineStipplePattern;
467210e230b6Smaya   uint32_t                             CurrentStippleIndex;
467310e230b6Smaya   uint32_t                             CurrentRepeatCounter;
467410e230b6Smaya   bool                                 ModifyEnableCurrentRepeatCounterCurrentStippleIndex;
467510e230b6Smaya   uint32_t                             LineStippleRepeatCount;
467610e230b6Smaya   float                                LineStippleInverseRepeatCount;
467710e230b6Smaya};
467810e230b6Smaya
467996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
468096c5ddc4SrjsGFX9_3DSTATE_LINE_STIPPLE_pack(__attribute__((unused)) __gen_user_data *data,
468110e230b6Smaya                               __attribute__((unused)) void * restrict dst,
468296c5ddc4Srjs                               __attribute__((unused)) const struct GFX9_3DSTATE_LINE_STIPPLE * restrict values)
468310e230b6Smaya{
468410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
468510e230b6Smaya
468610e230b6Smaya   dw[0] =
468710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
468810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
468910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
469010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
469110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
469210e230b6Smaya
469310e230b6Smaya   dw[1] =
469410e230b6Smaya      __gen_uint(values->LineStipplePattern, 0, 15) |
469510e230b6Smaya      __gen_uint(values->CurrentStippleIndex, 16, 19) |
469610e230b6Smaya      __gen_uint(values->CurrentRepeatCounter, 21, 29) |
469710e230b6Smaya      __gen_uint(values->ModifyEnableCurrentRepeatCounterCurrentStippleIndex, 31, 31);
469810e230b6Smaya
469910e230b6Smaya   dw[2] =
470010e230b6Smaya      __gen_uint(values->LineStippleRepeatCount, 0, 8) |
470110e230b6Smaya      __gen_ufixed(values->LineStippleInverseRepeatCount, 15, 31, 16);
470210e230b6Smaya}
470310e230b6Smaya
470496c5ddc4Srjs#define GFX9_3DSTATE_MONOFILTER_SIZE_length      2
470596c5ddc4Srjs#define GFX9_3DSTATE_MONOFILTER_SIZE_length_bias      2
470696c5ddc4Srjs#define GFX9_3DSTATE_MONOFILTER_SIZE_header     \
470710e230b6Smaya   .DWordLength                         =      0,  \
470810e230b6Smaya   ._3DCommandSubOpcode                 =     17,  \
470910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
471010e230b6Smaya   .CommandSubType                      =      3,  \
471110e230b6Smaya   .CommandType                         =      3
471210e230b6Smaya
471396c5ddc4Srjsstruct GFX9_3DSTATE_MONOFILTER_SIZE {
471410e230b6Smaya   uint32_t                             DWordLength;
471510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
471610e230b6Smaya   uint32_t                             _3DCommandOpcode;
471710e230b6Smaya   uint32_t                             CommandSubType;
471810e230b6Smaya   uint32_t                             CommandType;
471910e230b6Smaya   uint32_t                             MonochromeFilterHeight;
472010e230b6Smaya   uint32_t                             MonochromeFilterWidth;
472110e230b6Smaya};
472210e230b6Smaya
472396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
472496c5ddc4SrjsGFX9_3DSTATE_MONOFILTER_SIZE_pack(__attribute__((unused)) __gen_user_data *data,
472510e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
472696c5ddc4Srjs                                  __attribute__((unused)) const struct GFX9_3DSTATE_MONOFILTER_SIZE * restrict values)
472710e230b6Smaya{
472810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
472910e230b6Smaya
473010e230b6Smaya   dw[0] =
473110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
473210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
473310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
473410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
473510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
473610e230b6Smaya
473710e230b6Smaya   dw[1] =
473810e230b6Smaya      __gen_uint(values->MonochromeFilterHeight, 0, 2) |
473910e230b6Smaya      __gen_uint(values->MonochromeFilterWidth, 3, 5);
474010e230b6Smaya}
474110e230b6Smaya
474296c5ddc4Srjs#define GFX9_3DSTATE_MULTISAMPLE_length        2
474396c5ddc4Srjs#define GFX9_3DSTATE_MULTISAMPLE_length_bias      2
474496c5ddc4Srjs#define GFX9_3DSTATE_MULTISAMPLE_header         \
474510e230b6Smaya   .DWordLength                         =      0,  \
474610e230b6Smaya   ._3DCommandSubOpcode                 =     13,  \
474710e230b6Smaya   ._3DCommandOpcode                    =      0,  \
474810e230b6Smaya   .CommandSubType                      =      3,  \
474910e230b6Smaya   .CommandType                         =      3
475010e230b6Smaya
475196c5ddc4Srjsstruct GFX9_3DSTATE_MULTISAMPLE {
475210e230b6Smaya   uint32_t                             DWordLength;
475310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
475410e230b6Smaya   uint32_t                             _3DCommandOpcode;
475510e230b6Smaya   uint32_t                             CommandSubType;
475610e230b6Smaya   uint32_t                             CommandType;
475710e230b6Smaya   uint32_t                             NumberofMultisamples;
475810e230b6Smaya   uint32_t                             PixelLocation;
475910e230b6Smaya#define CENTER                                   0
476010e230b6Smaya#define UL_CORNER                                1
476110e230b6Smaya   bool                                 PixelPositionOffsetEnable;
476210e230b6Smaya};
476310e230b6Smaya
476496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
476596c5ddc4SrjsGFX9_3DSTATE_MULTISAMPLE_pack(__attribute__((unused)) __gen_user_data *data,
476610e230b6Smaya                              __attribute__((unused)) void * restrict dst,
476796c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_3DSTATE_MULTISAMPLE * restrict values)
476810e230b6Smaya{
476910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
477010e230b6Smaya
477110e230b6Smaya   dw[0] =
477210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
477310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
477410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
477510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
477610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
477710e230b6Smaya
477810e230b6Smaya   dw[1] =
477910e230b6Smaya      __gen_uint(values->NumberofMultisamples, 1, 3) |
478010e230b6Smaya      __gen_uint(values->PixelLocation, 4, 4) |
478110e230b6Smaya      __gen_uint(values->PixelPositionOffsetEnable, 5, 5);
478210e230b6Smaya}
478310e230b6Smaya
478496c5ddc4Srjs#define GFX9_3DSTATE_POLY_STIPPLE_OFFSET_length      2
478596c5ddc4Srjs#define GFX9_3DSTATE_POLY_STIPPLE_OFFSET_length_bias      2
478696c5ddc4Srjs#define GFX9_3DSTATE_POLY_STIPPLE_OFFSET_header \
478710e230b6Smaya   .DWordLength                         =      0,  \
478810e230b6Smaya   ._3DCommandSubOpcode                 =      6,  \
478910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
479010e230b6Smaya   .CommandSubType                      =      3,  \
479110e230b6Smaya   .CommandType                         =      3
479210e230b6Smaya
479396c5ddc4Srjsstruct GFX9_3DSTATE_POLY_STIPPLE_OFFSET {
479410e230b6Smaya   uint32_t                             DWordLength;
479510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
479610e230b6Smaya   uint32_t                             _3DCommandOpcode;
479710e230b6Smaya   uint32_t                             CommandSubType;
479810e230b6Smaya   uint32_t                             CommandType;
479910e230b6Smaya   uint32_t                             PolygonStippleYOffset;
480010e230b6Smaya   uint32_t                             PolygonStippleXOffset;
480110e230b6Smaya};
480210e230b6Smaya
480396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
480496c5ddc4SrjsGFX9_3DSTATE_POLY_STIPPLE_OFFSET_pack(__attribute__((unused)) __gen_user_data *data,
480510e230b6Smaya                                      __attribute__((unused)) void * restrict dst,
480696c5ddc4Srjs                                      __attribute__((unused)) const struct GFX9_3DSTATE_POLY_STIPPLE_OFFSET * restrict values)
480710e230b6Smaya{
480810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
480910e230b6Smaya
481010e230b6Smaya   dw[0] =
481110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
481210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
481310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
481410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
481510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
481610e230b6Smaya
481710e230b6Smaya   dw[1] =
481810e230b6Smaya      __gen_uint(values->PolygonStippleYOffset, 0, 4) |
481910e230b6Smaya      __gen_uint(values->PolygonStippleXOffset, 8, 12);
482010e230b6Smaya}
482110e230b6Smaya
482296c5ddc4Srjs#define GFX9_3DSTATE_POLY_STIPPLE_PATTERN_length     33
482396c5ddc4Srjs#define GFX9_3DSTATE_POLY_STIPPLE_PATTERN_length_bias      2
482496c5ddc4Srjs#define GFX9_3DSTATE_POLY_STIPPLE_PATTERN_header\
482510e230b6Smaya   .DWordLength                         =     31,  \
482610e230b6Smaya   ._3DCommandSubOpcode                 =      7,  \
482710e230b6Smaya   ._3DCommandOpcode                    =      1,  \
482810e230b6Smaya   .CommandSubType                      =      3,  \
482910e230b6Smaya   .CommandType                         =      3
483010e230b6Smaya
483196c5ddc4Srjsstruct GFX9_3DSTATE_POLY_STIPPLE_PATTERN {
483210e230b6Smaya   uint32_t                             DWordLength;
483310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
483410e230b6Smaya   uint32_t                             _3DCommandOpcode;
483510e230b6Smaya   uint32_t                             CommandSubType;
483610e230b6Smaya   uint32_t                             CommandType;
483710e230b6Smaya   uint32_t                             PatternRow[32];
483810e230b6Smaya};
483910e230b6Smaya
484096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
484196c5ddc4SrjsGFX9_3DSTATE_POLY_STIPPLE_PATTERN_pack(__attribute__((unused)) __gen_user_data *data,
484210e230b6Smaya                                       __attribute__((unused)) void * restrict dst,
484396c5ddc4Srjs                                       __attribute__((unused)) const struct GFX9_3DSTATE_POLY_STIPPLE_PATTERN * restrict values)
484410e230b6Smaya{
484510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
484610e230b6Smaya
484710e230b6Smaya   dw[0] =
484810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
484910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
485010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
485110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
485210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
485310e230b6Smaya
485410e230b6Smaya   dw[1] =
485510e230b6Smaya      __gen_uint(values->PatternRow[0], 0, 31);
485610e230b6Smaya
485710e230b6Smaya   dw[2] =
485810e230b6Smaya      __gen_uint(values->PatternRow[1], 0, 31);
485910e230b6Smaya
486010e230b6Smaya   dw[3] =
486110e230b6Smaya      __gen_uint(values->PatternRow[2], 0, 31);
486210e230b6Smaya
486310e230b6Smaya   dw[4] =
486410e230b6Smaya      __gen_uint(values->PatternRow[3], 0, 31);
486510e230b6Smaya
486610e230b6Smaya   dw[5] =
486710e230b6Smaya      __gen_uint(values->PatternRow[4], 0, 31);
486810e230b6Smaya
486910e230b6Smaya   dw[6] =
487010e230b6Smaya      __gen_uint(values->PatternRow[5], 0, 31);
487110e230b6Smaya
487210e230b6Smaya   dw[7] =
487310e230b6Smaya      __gen_uint(values->PatternRow[6], 0, 31);
487410e230b6Smaya
487510e230b6Smaya   dw[8] =
487610e230b6Smaya      __gen_uint(values->PatternRow[7], 0, 31);
487710e230b6Smaya
487810e230b6Smaya   dw[9] =
487910e230b6Smaya      __gen_uint(values->PatternRow[8], 0, 31);
488010e230b6Smaya
488110e230b6Smaya   dw[10] =
488210e230b6Smaya      __gen_uint(values->PatternRow[9], 0, 31);
488310e230b6Smaya
488410e230b6Smaya   dw[11] =
488510e230b6Smaya      __gen_uint(values->PatternRow[10], 0, 31);
488610e230b6Smaya
488710e230b6Smaya   dw[12] =
488810e230b6Smaya      __gen_uint(values->PatternRow[11], 0, 31);
488910e230b6Smaya
489010e230b6Smaya   dw[13] =
489110e230b6Smaya      __gen_uint(values->PatternRow[12], 0, 31);
489210e230b6Smaya
489310e230b6Smaya   dw[14] =
489410e230b6Smaya      __gen_uint(values->PatternRow[13], 0, 31);
489510e230b6Smaya
489610e230b6Smaya   dw[15] =
489710e230b6Smaya      __gen_uint(values->PatternRow[14], 0, 31);
489810e230b6Smaya
489910e230b6Smaya   dw[16] =
490010e230b6Smaya      __gen_uint(values->PatternRow[15], 0, 31);
490110e230b6Smaya
490210e230b6Smaya   dw[17] =
490310e230b6Smaya      __gen_uint(values->PatternRow[16], 0, 31);
490410e230b6Smaya
490510e230b6Smaya   dw[18] =
490610e230b6Smaya      __gen_uint(values->PatternRow[17], 0, 31);
490710e230b6Smaya
490810e230b6Smaya   dw[19] =
490910e230b6Smaya      __gen_uint(values->PatternRow[18], 0, 31);
491010e230b6Smaya
491110e230b6Smaya   dw[20] =
491210e230b6Smaya      __gen_uint(values->PatternRow[19], 0, 31);
491310e230b6Smaya
491410e230b6Smaya   dw[21] =
491510e230b6Smaya      __gen_uint(values->PatternRow[20], 0, 31);
491610e230b6Smaya
491710e230b6Smaya   dw[22] =
491810e230b6Smaya      __gen_uint(values->PatternRow[21], 0, 31);
491910e230b6Smaya
492010e230b6Smaya   dw[23] =
492110e230b6Smaya      __gen_uint(values->PatternRow[22], 0, 31);
492210e230b6Smaya
492310e230b6Smaya   dw[24] =
492410e230b6Smaya      __gen_uint(values->PatternRow[23], 0, 31);
492510e230b6Smaya
492610e230b6Smaya   dw[25] =
492710e230b6Smaya      __gen_uint(values->PatternRow[24], 0, 31);
492810e230b6Smaya
492910e230b6Smaya   dw[26] =
493010e230b6Smaya      __gen_uint(values->PatternRow[25], 0, 31);
493110e230b6Smaya
493210e230b6Smaya   dw[27] =
493310e230b6Smaya      __gen_uint(values->PatternRow[26], 0, 31);
493410e230b6Smaya
493510e230b6Smaya   dw[28] =
493610e230b6Smaya      __gen_uint(values->PatternRow[27], 0, 31);
493710e230b6Smaya
493810e230b6Smaya   dw[29] =
493910e230b6Smaya      __gen_uint(values->PatternRow[28], 0, 31);
494010e230b6Smaya
494110e230b6Smaya   dw[30] =
494210e230b6Smaya      __gen_uint(values->PatternRow[29], 0, 31);
494310e230b6Smaya
494410e230b6Smaya   dw[31] =
494510e230b6Smaya      __gen_uint(values->PatternRow[30], 0, 31);
494610e230b6Smaya
494710e230b6Smaya   dw[32] =
494810e230b6Smaya      __gen_uint(values->PatternRow[31], 0, 31);
494910e230b6Smaya}
495010e230b6Smaya
495196c5ddc4Srjs#define GFX9_3DSTATE_PS_length                12
495296c5ddc4Srjs#define GFX9_3DSTATE_PS_length_bias            2
495396c5ddc4Srjs#define GFX9_3DSTATE_PS_header                  \
495410e230b6Smaya   .DWordLength                         =     10,  \
495510e230b6Smaya   ._3DCommandSubOpcode                 =     32,  \
495610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
495710e230b6Smaya   .CommandSubType                      =      3,  \
495810e230b6Smaya   .CommandType                         =      3
495910e230b6Smaya
496096c5ddc4Srjsstruct GFX9_3DSTATE_PS {
496110e230b6Smaya   uint32_t                             DWordLength;
496210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
496310e230b6Smaya   uint32_t                             _3DCommandOpcode;
496410e230b6Smaya   uint32_t                             CommandSubType;
496510e230b6Smaya   uint32_t                             CommandType;
496610e230b6Smaya   uint64_t                             KernelStartPointer0;
496710e230b6Smaya   bool                                 SoftwareExceptionEnable;
496810e230b6Smaya   bool                                 MaskStackExceptionEnable;
496910e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
497010e230b6Smaya   uint32_t                             RoundingMode;
497110e230b6Smaya#define RTNE                                     0
497210e230b6Smaya#define RU                                       1
497310e230b6Smaya#define RD                                       2
497410e230b6Smaya#define RTZ                                      3
497510e230b6Smaya   uint32_t                             FloatingPointMode;
497610e230b6Smaya#define IEEE754                                  0
497710e230b6Smaya#define Alternate                                1
497810e230b6Smaya   uint32_t                             ThreadDispatchPriority;
497910e230b6Smaya#define High                                     1
498010e230b6Smaya   uint32_t                             BindingTableEntryCount;
498110e230b6Smaya   uint32_t                             SinglePrecisionDenormalMode;
498210e230b6Smaya#define FlushedtoZero                            0
498310e230b6Smaya#define Retained                                 1
498410e230b6Smaya   uint32_t                             SamplerCount;
498510e230b6Smaya#define NoSamplers                               0
498610e230b6Smaya#define _14Samplers                              1
498710e230b6Smaya#define _58Samplers                              2
498810e230b6Smaya#define _912Samplers                             3
498910e230b6Smaya#define _1316Samplers                            4
499010e230b6Smaya   bool                                 VectorMaskEnable;
499110e230b6Smaya   bool                                 SingleProgramFlow;
499210e230b6Smaya   uint32_t                             PerThreadScratchSpace;
499310e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
499410e230b6Smaya   bool                                 _8PixelDispatchEnable;
499510e230b6Smaya   bool                                 _16PixelDispatchEnable;
499610e230b6Smaya   bool                                 _32PixelDispatchEnable;
499710e230b6Smaya   uint32_t                             PositionXYOffsetSelect;
499810e230b6Smaya#define POSOFFSET_NONE                           0
499910e230b6Smaya#define POSOFFSET_CENTROID                       2
500010e230b6Smaya#define POSOFFSET_SAMPLE                         3
500110e230b6Smaya   uint32_t                             RenderTargetResolveType;
500210e230b6Smaya#define RESOLVE_DISABLED                         0
500310e230b6Smaya#define RESOLVE_PARTIAL                          1
500410e230b6Smaya#define RESOLVE_FULL                             3
500510e230b6Smaya   bool                                 RenderTargetFastClearEnable;
500610e230b6Smaya   bool                                 PushConstantEnable;
500710e230b6Smaya   uint32_t                             MaximumNumberofThreadsPerPSD;
500810e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForConstantSetupData2;
500910e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForConstantSetupData1;
501010e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForConstantSetupData0;
501110e230b6Smaya   uint64_t                             KernelStartPointer1;
501210e230b6Smaya   uint64_t                             KernelStartPointer2;
501310e230b6Smaya};
501410e230b6Smaya
501596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
501696c5ddc4SrjsGFX9_3DSTATE_PS_pack(__attribute__((unused)) __gen_user_data *data,
501710e230b6Smaya                     __attribute__((unused)) void * restrict dst,
501896c5ddc4Srjs                     __attribute__((unused)) const struct GFX9_3DSTATE_PS * restrict values)
501910e230b6Smaya{
502010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
502110e230b6Smaya
502210e230b6Smaya   dw[0] =
502310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
502410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
502510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
502610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
502710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
502810e230b6Smaya
502910e230b6Smaya   const uint64_t v1 =
503010e230b6Smaya      __gen_offset(values->KernelStartPointer0, 6, 63);
503110e230b6Smaya   dw[1] = v1;
503210e230b6Smaya   dw[2] = v1 >> 32;
503310e230b6Smaya
503410e230b6Smaya   dw[3] =
503510e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
503610e230b6Smaya      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
503710e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
503810e230b6Smaya      __gen_uint(values->RoundingMode, 14, 15) |
503910e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
504010e230b6Smaya      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
504110e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
504210e230b6Smaya      __gen_uint(values->SinglePrecisionDenormalMode, 26, 26) |
504310e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
504410e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
504510e230b6Smaya      __gen_uint(values->SingleProgramFlow, 31, 31);
504610e230b6Smaya
504710e230b6Smaya   const uint64_t v4 =
504810e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
504910e230b6Smaya   const uint64_t v4_address =
505096c5ddc4Srjs      __gen_address(data, &dw[4], values->ScratchSpaceBasePointer, v4, 10, 63);
505110e230b6Smaya   dw[4] = v4_address;
505210e230b6Smaya   dw[5] = (v4_address >> 32) | (v4 >> 32);
505310e230b6Smaya
505410e230b6Smaya   dw[6] =
505510e230b6Smaya      __gen_uint(values->_8PixelDispatchEnable, 0, 0) |
505610e230b6Smaya      __gen_uint(values->_16PixelDispatchEnable, 1, 1) |
505710e230b6Smaya      __gen_uint(values->_32PixelDispatchEnable, 2, 2) |
505810e230b6Smaya      __gen_uint(values->PositionXYOffsetSelect, 3, 4) |
505910e230b6Smaya      __gen_uint(values->RenderTargetResolveType, 6, 7) |
506010e230b6Smaya      __gen_uint(values->RenderTargetFastClearEnable, 8, 8) |
506110e230b6Smaya      __gen_uint(values->PushConstantEnable, 11, 11) |
506210e230b6Smaya      __gen_uint(values->MaximumNumberofThreadsPerPSD, 23, 31);
506310e230b6Smaya
506410e230b6Smaya   dw[7] =
506510e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData2, 0, 6) |
506610e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData1, 8, 14) |
506710e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData0, 16, 22);
506810e230b6Smaya
506910e230b6Smaya   const uint64_t v8 =
507010e230b6Smaya      __gen_offset(values->KernelStartPointer1, 6, 63);
507110e230b6Smaya   dw[8] = v8;
507210e230b6Smaya   dw[9] = v8 >> 32;
507310e230b6Smaya
507410e230b6Smaya   const uint64_t v10 =
507510e230b6Smaya      __gen_offset(values->KernelStartPointer2, 6, 63);
507610e230b6Smaya   dw[10] = v10;
507710e230b6Smaya   dw[11] = v10 >> 32;
507810e230b6Smaya}
507910e230b6Smaya
508096c5ddc4Srjs#define GFX9_3DSTATE_PS_BLEND_length           2
508196c5ddc4Srjs#define GFX9_3DSTATE_PS_BLEND_length_bias      2
508296c5ddc4Srjs#define GFX9_3DSTATE_PS_BLEND_header            \
508310e230b6Smaya   .DWordLength                         =      0,  \
508410e230b6Smaya   ._3DCommandSubOpcode                 =     77,  \
508510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
508610e230b6Smaya   .CommandSubType                      =      3,  \
508710e230b6Smaya   .CommandType                         =      3
508810e230b6Smaya
508996c5ddc4Srjsstruct GFX9_3DSTATE_PS_BLEND {
509010e230b6Smaya   uint32_t                             DWordLength;
509110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
509210e230b6Smaya   uint32_t                             _3DCommandOpcode;
509310e230b6Smaya   uint32_t                             CommandSubType;
509410e230b6Smaya   uint32_t                             CommandType;
509510e230b6Smaya   bool                                 IndependentAlphaBlendEnable;
509610e230b6Smaya   bool                                 AlphaTestEnable;
509796c5ddc4Srjs   enum GFX9_3D_Color_Buffer_Blend_Factor DestinationBlendFactor;
509896c5ddc4Srjs   enum GFX9_3D_Color_Buffer_Blend_Factor SourceBlendFactor;
509996c5ddc4Srjs   enum GFX9_3D_Color_Buffer_Blend_Factor DestinationAlphaBlendFactor;
510096c5ddc4Srjs   enum GFX9_3D_Color_Buffer_Blend_Factor SourceAlphaBlendFactor;
510110e230b6Smaya   bool                                 ColorBufferBlendEnable;
510210e230b6Smaya   bool                                 HasWriteableRT;
510310e230b6Smaya   bool                                 AlphaToCoverageEnable;
510410e230b6Smaya};
510510e230b6Smaya
510696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
510796c5ddc4SrjsGFX9_3DSTATE_PS_BLEND_pack(__attribute__((unused)) __gen_user_data *data,
510810e230b6Smaya                           __attribute__((unused)) void * restrict dst,
510996c5ddc4Srjs                           __attribute__((unused)) const struct GFX9_3DSTATE_PS_BLEND * restrict values)
511010e230b6Smaya{
511110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
511210e230b6Smaya
511310e230b6Smaya   dw[0] =
511410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
511510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
511610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
511710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
511810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
511910e230b6Smaya
512010e230b6Smaya   dw[1] =
512110e230b6Smaya      __gen_uint(values->IndependentAlphaBlendEnable, 7, 7) |
512210e230b6Smaya      __gen_uint(values->AlphaTestEnable, 8, 8) |
512310e230b6Smaya      __gen_uint(values->DestinationBlendFactor, 9, 13) |
512410e230b6Smaya      __gen_uint(values->SourceBlendFactor, 14, 18) |
512510e230b6Smaya      __gen_uint(values->DestinationAlphaBlendFactor, 19, 23) |
512610e230b6Smaya      __gen_uint(values->SourceAlphaBlendFactor, 24, 28) |
512710e230b6Smaya      __gen_uint(values->ColorBufferBlendEnable, 29, 29) |
512810e230b6Smaya      __gen_uint(values->HasWriteableRT, 30, 30) |
512910e230b6Smaya      __gen_uint(values->AlphaToCoverageEnable, 31, 31);
513010e230b6Smaya}
513110e230b6Smaya
513296c5ddc4Srjs#define GFX9_3DSTATE_PS_EXTRA_length           2
513396c5ddc4Srjs#define GFX9_3DSTATE_PS_EXTRA_length_bias      2
513496c5ddc4Srjs#define GFX9_3DSTATE_PS_EXTRA_header            \
513510e230b6Smaya   .DWordLength                         =      0,  \
513610e230b6Smaya   ._3DCommandSubOpcode                 =     79,  \
513710e230b6Smaya   ._3DCommandOpcode                    =      0,  \
513810e230b6Smaya   .CommandSubType                      =      3,  \
513910e230b6Smaya   .CommandType                         =      3
514010e230b6Smaya
514196c5ddc4Srjsstruct GFX9_3DSTATE_PS_EXTRA {
514210e230b6Smaya   uint32_t                             DWordLength;
514310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
514410e230b6Smaya   uint32_t                             _3DCommandOpcode;
514510e230b6Smaya   uint32_t                             CommandSubType;
514610e230b6Smaya   uint32_t                             CommandType;
514710e230b6Smaya   uint32_t                             InputCoverageMaskState;
514810e230b6Smaya#define ICMS_NONE                                0
514910e230b6Smaya#define ICMS_NORMAL                              1
515010e230b6Smaya#define ICMS_INNER_CONSERVATIVE                  2
515110e230b6Smaya#define ICMS_DEPTH_COVERAGE                      3
515210e230b6Smaya   bool                                 PixelShaderHasUAV;
515310e230b6Smaya   bool                                 PixelShaderPullsBary;
515410e230b6Smaya   bool                                 PixelShaderComputesStencil;
515510e230b6Smaya   bool                                 PixelShaderIsPerSample;
515610e230b6Smaya   bool                                 PixelShaderDisablesAlphaToCoverage;
515710e230b6Smaya   bool                                 AttributeEnable;
515810e230b6Smaya   bool                                 PixelShaderUsesSourceW;
515910e230b6Smaya   bool                                 PixelShaderUsesSourceDepth;
516010e230b6Smaya   bool                                 ForceComputedDepth;
516110e230b6Smaya   uint32_t                             PixelShaderComputedDepthMode;
516210e230b6Smaya#define PSCDEPTH_OFF                             0
516310e230b6Smaya#define PSCDEPTH_ON                              1
516410e230b6Smaya#define PSCDEPTH_ON_GE                           2
516510e230b6Smaya#define PSCDEPTH_ON_LE                           3
516610e230b6Smaya   bool                                 PixelShaderKillsPixel;
516710e230b6Smaya   bool                                 oMaskPresenttoRenderTarget;
516810e230b6Smaya   bool                                 PixelShaderDoesnotwritetoRT;
516910e230b6Smaya   bool                                 PixelShaderValid;
517010e230b6Smaya};
517110e230b6Smaya
517296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
517396c5ddc4SrjsGFX9_3DSTATE_PS_EXTRA_pack(__attribute__((unused)) __gen_user_data *data,
517410e230b6Smaya                           __attribute__((unused)) void * restrict dst,
517596c5ddc4Srjs                           __attribute__((unused)) const struct GFX9_3DSTATE_PS_EXTRA * restrict values)
517610e230b6Smaya{
517710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
517810e230b6Smaya
517910e230b6Smaya   dw[0] =
518010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
518110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
518210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
518310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
518410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
518510e230b6Smaya
518610e230b6Smaya   dw[1] =
518710e230b6Smaya      __gen_uint(values->InputCoverageMaskState, 0, 1) |
518810e230b6Smaya      __gen_uint(values->PixelShaderHasUAV, 2, 2) |
518910e230b6Smaya      __gen_uint(values->PixelShaderPullsBary, 3, 3) |
519010e230b6Smaya      __gen_uint(values->PixelShaderComputesStencil, 5, 5) |
519110e230b6Smaya      __gen_uint(values->PixelShaderIsPerSample, 6, 6) |
519210e230b6Smaya      __gen_uint(values->PixelShaderDisablesAlphaToCoverage, 7, 7) |
519310e230b6Smaya      __gen_uint(values->AttributeEnable, 8, 8) |
519410e230b6Smaya      __gen_uint(values->PixelShaderUsesSourceW, 23, 23) |
519510e230b6Smaya      __gen_uint(values->PixelShaderUsesSourceDepth, 24, 24) |
519610e230b6Smaya      __gen_uint(values->ForceComputedDepth, 25, 25) |
519710e230b6Smaya      __gen_uint(values->PixelShaderComputedDepthMode, 26, 27) |
519810e230b6Smaya      __gen_uint(values->PixelShaderKillsPixel, 28, 28) |
519910e230b6Smaya      __gen_uint(values->oMaskPresenttoRenderTarget, 29, 29) |
520010e230b6Smaya      __gen_uint(values->PixelShaderDoesnotwritetoRT, 30, 30) |
520110e230b6Smaya      __gen_uint(values->PixelShaderValid, 31, 31);
520210e230b6Smaya}
520310e230b6Smaya
520496c5ddc4Srjs#define GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_DS_length      2
520596c5ddc4Srjs#define GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_DS_length_bias      2
520696c5ddc4Srjs#define GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_DS_header\
520710e230b6Smaya   .DWordLength                         =      0,  \
520810e230b6Smaya   ._3DCommandSubOpcode                 =     20,  \
520910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
521010e230b6Smaya   .CommandSubType                      =      3,  \
521110e230b6Smaya   .CommandType                         =      3
521210e230b6Smaya
521396c5ddc4Srjsstruct GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_DS {
521410e230b6Smaya   uint32_t                             DWordLength;
521510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
521610e230b6Smaya   uint32_t                             _3DCommandOpcode;
521710e230b6Smaya   uint32_t                             CommandSubType;
521810e230b6Smaya   uint32_t                             CommandType;
521910e230b6Smaya   uint32_t                             ConstantBufferSize;
522010e230b6Smaya   uint32_t                             ConstantBufferOffset;
522110e230b6Smaya};
522210e230b6Smaya
522396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
522496c5ddc4SrjsGFX9_3DSTATE_PUSH_CONSTANT_ALLOC_DS_pack(__attribute__((unused)) __gen_user_data *data,
522510e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
522696c5ddc4Srjs                                         __attribute__((unused)) const struct GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_DS * restrict values)
522710e230b6Smaya{
522810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
522910e230b6Smaya
523010e230b6Smaya   dw[0] =
523110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
523210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
523310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
523410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
523510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
523610e230b6Smaya
523710e230b6Smaya   dw[1] =
523810e230b6Smaya      __gen_uint(values->ConstantBufferSize, 0, 5) |
523910e230b6Smaya      __gen_uint(values->ConstantBufferOffset, 16, 20);
524010e230b6Smaya}
524110e230b6Smaya
524296c5ddc4Srjs#define GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_GS_length      2
524396c5ddc4Srjs#define GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_GS_length_bias      2
524496c5ddc4Srjs#define GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_GS_header\
524510e230b6Smaya   .DWordLength                         =      0,  \
524610e230b6Smaya   ._3DCommandSubOpcode                 =     21,  \
524710e230b6Smaya   ._3DCommandOpcode                    =      1,  \
524810e230b6Smaya   .CommandSubType                      =      3,  \
524910e230b6Smaya   .CommandType                         =      3
525010e230b6Smaya
525196c5ddc4Srjsstruct GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_GS {
525210e230b6Smaya   uint32_t                             DWordLength;
525310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
525410e230b6Smaya   uint32_t                             _3DCommandOpcode;
525510e230b6Smaya   uint32_t                             CommandSubType;
525610e230b6Smaya   uint32_t                             CommandType;
525710e230b6Smaya   uint32_t                             ConstantBufferSize;
525810e230b6Smaya   uint32_t                             ConstantBufferOffset;
525910e230b6Smaya};
526010e230b6Smaya
526196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
526296c5ddc4SrjsGFX9_3DSTATE_PUSH_CONSTANT_ALLOC_GS_pack(__attribute__((unused)) __gen_user_data *data,
526310e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
526496c5ddc4Srjs                                         __attribute__((unused)) const struct GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_GS * restrict values)
526510e230b6Smaya{
526610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
526710e230b6Smaya
526810e230b6Smaya   dw[0] =
526910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
527010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
527110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
527210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
527310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
527410e230b6Smaya
527510e230b6Smaya   dw[1] =
527610e230b6Smaya      __gen_uint(values->ConstantBufferSize, 0, 5) |
527710e230b6Smaya      __gen_uint(values->ConstantBufferOffset, 16, 20);
527810e230b6Smaya}
527910e230b6Smaya
528096c5ddc4Srjs#define GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_HS_length      2
528196c5ddc4Srjs#define GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_HS_length_bias      2
528296c5ddc4Srjs#define GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_HS_header\
528310e230b6Smaya   .DWordLength                         =      0,  \
528410e230b6Smaya   ._3DCommandSubOpcode                 =     19,  \
528510e230b6Smaya   ._3DCommandOpcode                    =      1,  \
528610e230b6Smaya   .CommandSubType                      =      3,  \
528710e230b6Smaya   .CommandType                         =      3
528810e230b6Smaya
528996c5ddc4Srjsstruct GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_HS {
529010e230b6Smaya   uint32_t                             DWordLength;
529110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
529210e230b6Smaya   uint32_t                             _3DCommandOpcode;
529310e230b6Smaya   uint32_t                             CommandSubType;
529410e230b6Smaya   uint32_t                             CommandType;
529510e230b6Smaya   uint32_t                             ConstantBufferSize;
529610e230b6Smaya   uint32_t                             ConstantBufferOffset;
529710e230b6Smaya};
529810e230b6Smaya
529996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
530096c5ddc4SrjsGFX9_3DSTATE_PUSH_CONSTANT_ALLOC_HS_pack(__attribute__((unused)) __gen_user_data *data,
530110e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
530296c5ddc4Srjs                                         __attribute__((unused)) const struct GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_HS * restrict values)
530310e230b6Smaya{
530410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
530510e230b6Smaya
530610e230b6Smaya   dw[0] =
530710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
530810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
530910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
531010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
531110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
531210e230b6Smaya
531310e230b6Smaya   dw[1] =
531410e230b6Smaya      __gen_uint(values->ConstantBufferSize, 0, 5) |
531510e230b6Smaya      __gen_uint(values->ConstantBufferOffset, 16, 20);
531610e230b6Smaya}
531710e230b6Smaya
531896c5ddc4Srjs#define GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_PS_length      2
531996c5ddc4Srjs#define GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_PS_length_bias      2
532096c5ddc4Srjs#define GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_PS_header\
532110e230b6Smaya   .DWordLength                         =      0,  \
532210e230b6Smaya   ._3DCommandSubOpcode                 =     22,  \
532310e230b6Smaya   ._3DCommandOpcode                    =      1,  \
532410e230b6Smaya   .CommandSubType                      =      3,  \
532510e230b6Smaya   .CommandType                         =      3
532610e230b6Smaya
532796c5ddc4Srjsstruct GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_PS {
532810e230b6Smaya   uint32_t                             DWordLength;
532910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
533010e230b6Smaya   uint32_t                             _3DCommandOpcode;
533110e230b6Smaya   uint32_t                             CommandSubType;
533210e230b6Smaya   uint32_t                             CommandType;
533310e230b6Smaya   uint32_t                             ConstantBufferSize;
533410e230b6Smaya   uint32_t                             ConstantBufferOffset;
533510e230b6Smaya};
533610e230b6Smaya
533796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
533896c5ddc4SrjsGFX9_3DSTATE_PUSH_CONSTANT_ALLOC_PS_pack(__attribute__((unused)) __gen_user_data *data,
533910e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
534096c5ddc4Srjs                                         __attribute__((unused)) const struct GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_PS * restrict values)
534110e230b6Smaya{
534210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
534310e230b6Smaya
534410e230b6Smaya   dw[0] =
534510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
534610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
534710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
534810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
534910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
535010e230b6Smaya
535110e230b6Smaya   dw[1] =
535210e230b6Smaya      __gen_uint(values->ConstantBufferSize, 0, 5) |
535310e230b6Smaya      __gen_uint(values->ConstantBufferOffset, 16, 20);
535410e230b6Smaya}
535510e230b6Smaya
535696c5ddc4Srjs#define GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_VS_length      2
535796c5ddc4Srjs#define GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_VS_length_bias      2
535896c5ddc4Srjs#define GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_VS_header\
535910e230b6Smaya   .DWordLength                         =      0,  \
536010e230b6Smaya   ._3DCommandSubOpcode                 =     18,  \
536110e230b6Smaya   ._3DCommandOpcode                    =      1,  \
536210e230b6Smaya   .CommandSubType                      =      3,  \
536310e230b6Smaya   .CommandType                         =      3
536410e230b6Smaya
536596c5ddc4Srjsstruct GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_VS {
536610e230b6Smaya   uint32_t                             DWordLength;
536710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
536810e230b6Smaya   uint32_t                             _3DCommandOpcode;
536910e230b6Smaya   uint32_t                             CommandSubType;
537010e230b6Smaya   uint32_t                             CommandType;
537110e230b6Smaya   uint32_t                             ConstantBufferSize;
537210e230b6Smaya   uint32_t                             ConstantBufferOffset;
537310e230b6Smaya};
537410e230b6Smaya
537596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
537696c5ddc4SrjsGFX9_3DSTATE_PUSH_CONSTANT_ALLOC_VS_pack(__attribute__((unused)) __gen_user_data *data,
537710e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
537896c5ddc4Srjs                                         __attribute__((unused)) const struct GFX9_3DSTATE_PUSH_CONSTANT_ALLOC_VS * restrict values)
537910e230b6Smaya{
538010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
538110e230b6Smaya
538210e230b6Smaya   dw[0] =
538310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
538410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
538510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
538610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
538710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
538810e230b6Smaya
538910e230b6Smaya   dw[1] =
539010e230b6Smaya      __gen_uint(values->ConstantBufferSize, 0, 5) |
539110e230b6Smaya      __gen_uint(values->ConstantBufferOffset, 16, 20);
539210e230b6Smaya}
539310e230b6Smaya
539496c5ddc4Srjs#define GFX9_3DSTATE_RASTER_length             5
539596c5ddc4Srjs#define GFX9_3DSTATE_RASTER_length_bias        2
539696c5ddc4Srjs#define GFX9_3DSTATE_RASTER_header              \
539710e230b6Smaya   .DWordLength                         =      3,  \
539810e230b6Smaya   ._3DCommandSubOpcode                 =     80,  \
539910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
540010e230b6Smaya   .CommandSubType                      =      3,  \
540110e230b6Smaya   .CommandType                         =      3
540210e230b6Smaya
540396c5ddc4Srjsstruct GFX9_3DSTATE_RASTER {
540410e230b6Smaya   uint32_t                             DWordLength;
540510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
540610e230b6Smaya   uint32_t                             _3DCommandOpcode;
540710e230b6Smaya   uint32_t                             CommandSubType;
540810e230b6Smaya   uint32_t                             CommandType;
540910e230b6Smaya   bool                                 ViewportZNearClipTestEnable;
541010e230b6Smaya   bool                                 ScissorRectangleEnable;
541110e230b6Smaya   bool                                 AntialiasingEnable;
541210e230b6Smaya   uint32_t                             BackFaceFillMode;
541310e230b6Smaya#define FILL_MODE_SOLID                          0
541410e230b6Smaya#define FILL_MODE_WIREFRAME                      1
541510e230b6Smaya#define FILL_MODE_POINT                          2
541610e230b6Smaya   uint32_t                             FrontFaceFillMode;
541710e230b6Smaya#define FILL_MODE_SOLID                          0
541810e230b6Smaya#define FILL_MODE_WIREFRAME                      1
541910e230b6Smaya#define FILL_MODE_POINT                          2
542010e230b6Smaya   bool                                 GlobalDepthOffsetEnablePoint;
542110e230b6Smaya   bool                                 GlobalDepthOffsetEnableWireframe;
542210e230b6Smaya   bool                                 GlobalDepthOffsetEnableSolid;
542310e230b6Smaya   uint32_t                             DXMultisampleRasterizationMode;
542410e230b6Smaya#define MSRASTMODE_OFF_PIXEL                     0
542510e230b6Smaya#define MSRASTMODE_OFF_PATTERN                   1
542610e230b6Smaya#define MSRASTMODE_ON_PIXEL                      2
542710e230b6Smaya#define MSRASTMODE_ON_PATTERN                    3
542810e230b6Smaya   bool                                 DXMultisampleRasterizationEnable;
542910e230b6Smaya   bool                                 SmoothPointEnable;
543010e230b6Smaya   uint32_t                             ForceMultisampling;
543110e230b6Smaya   uint32_t                             CullMode;
543210e230b6Smaya#define CULLMODE_BOTH                            0
543310e230b6Smaya#define CULLMODE_NONE                            1
543410e230b6Smaya#define CULLMODE_FRONT                           2
543510e230b6Smaya#define CULLMODE_BACK                            3
543610e230b6Smaya   uint32_t                             ForcedSampleCount;
543710e230b6Smaya#define FSC_NUMRASTSAMPLES_0                     0
543810e230b6Smaya#define FSC_NUMRASTSAMPLES_1                     1
543910e230b6Smaya#define FSC_NUMRASTSAMPLES_2                     2
544010e230b6Smaya#define FSC_NUMRASTSAMPLES_4                     3
544110e230b6Smaya#define FSC_NUMRASTSAMPLES_8                     4
544210e230b6Smaya#define FSC_NUMRASTSAMPLES_16                    5
544310e230b6Smaya   uint32_t                             FrontWinding;
544410e230b6Smaya#define Clockwise                                0
544510e230b6Smaya#define CounterClockwise                         1
544610e230b6Smaya   uint32_t                             APIMode;
544710e230b6Smaya#define DX9OGL                                   0
544810e230b6Smaya#define DX100                                    1
544910e230b6Smaya#define DX101                                    2
545010e230b6Smaya   bool                                 ConservativeRasterizationEnable;
545110e230b6Smaya   bool                                 ViewportZFarClipTestEnable;
545210e230b6Smaya   float                                GlobalDepthOffsetConstant;
545310e230b6Smaya   float                                GlobalDepthOffsetScale;
545410e230b6Smaya   float                                GlobalDepthOffsetClamp;
545510e230b6Smaya};
545610e230b6Smaya
545796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
545896c5ddc4SrjsGFX9_3DSTATE_RASTER_pack(__attribute__((unused)) __gen_user_data *data,
545910e230b6Smaya                         __attribute__((unused)) void * restrict dst,
546096c5ddc4Srjs                         __attribute__((unused)) const struct GFX9_3DSTATE_RASTER * restrict values)
546110e230b6Smaya{
546210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
546310e230b6Smaya
546410e230b6Smaya   dw[0] =
546510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
546610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
546710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
546810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
546910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
547010e230b6Smaya
547110e230b6Smaya   dw[1] =
547210e230b6Smaya      __gen_uint(values->ViewportZNearClipTestEnable, 0, 0) |
547310e230b6Smaya      __gen_uint(values->ScissorRectangleEnable, 1, 1) |
547410e230b6Smaya      __gen_uint(values->AntialiasingEnable, 2, 2) |
547510e230b6Smaya      __gen_uint(values->BackFaceFillMode, 3, 4) |
547610e230b6Smaya      __gen_uint(values->FrontFaceFillMode, 5, 6) |
547710e230b6Smaya      __gen_uint(values->GlobalDepthOffsetEnablePoint, 7, 7) |
547810e230b6Smaya      __gen_uint(values->GlobalDepthOffsetEnableWireframe, 8, 8) |
547910e230b6Smaya      __gen_uint(values->GlobalDepthOffsetEnableSolid, 9, 9) |
548010e230b6Smaya      __gen_uint(values->DXMultisampleRasterizationMode, 10, 11) |
548110e230b6Smaya      __gen_uint(values->DXMultisampleRasterizationEnable, 12, 12) |
548210e230b6Smaya      __gen_uint(values->SmoothPointEnable, 13, 13) |
548310e230b6Smaya      __gen_uint(values->ForceMultisampling, 14, 14) |
548410e230b6Smaya      __gen_uint(values->CullMode, 16, 17) |
548510e230b6Smaya      __gen_uint(values->ForcedSampleCount, 18, 20) |
548610e230b6Smaya      __gen_uint(values->FrontWinding, 21, 21) |
548710e230b6Smaya      __gen_uint(values->APIMode, 22, 23) |
548810e230b6Smaya      __gen_uint(values->ConservativeRasterizationEnable, 24, 24) |
548910e230b6Smaya      __gen_uint(values->ViewportZFarClipTestEnable, 26, 26);
549010e230b6Smaya
549110e230b6Smaya   dw[2] =
549210e230b6Smaya      __gen_float(values->GlobalDepthOffsetConstant);
549310e230b6Smaya
549410e230b6Smaya   dw[3] =
549510e230b6Smaya      __gen_float(values->GlobalDepthOffsetScale);
549610e230b6Smaya
549710e230b6Smaya   dw[4] =
549810e230b6Smaya      __gen_float(values->GlobalDepthOffsetClamp);
549910e230b6Smaya}
550010e230b6Smaya
550196c5ddc4Srjs#define GFX9_3DSTATE_RS_CONSTANT_POINTER_length      4
550296c5ddc4Srjs#define GFX9_3DSTATE_RS_CONSTANT_POINTER_length_bias      2
550396c5ddc4Srjs#define GFX9_3DSTATE_RS_CONSTANT_POINTER_header \
550410e230b6Smaya   .DWordLength                         =      2,  \
550510e230b6Smaya   ._3DCommandSubOpcode                 =     84,  \
550610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
550710e230b6Smaya   .CommandSubType                      =      3,  \
550810e230b6Smaya   .CommandType                         =      3
550910e230b6Smaya
551096c5ddc4Srjsstruct GFX9_3DSTATE_RS_CONSTANT_POINTER {
551110e230b6Smaya   uint32_t                             DWordLength;
551210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
551310e230b6Smaya   uint32_t                             _3DCommandOpcode;
551410e230b6Smaya   uint32_t                             CommandSubType;
551510e230b6Smaya   uint32_t                             CommandType;
551610e230b6Smaya   uint32_t                             OperationLoadorStore;
551710e230b6Smaya#define RS_Store                                 0
551810e230b6Smaya#define RS_Load                                  1
551910e230b6Smaya   uint32_t                             ShaderSelect;
552010e230b6Smaya#define VS                                       0
552110e230b6Smaya#define PS                                       4
552210e230b6Smaya   __gen_address_type                   GlobalConstantBufferAddress;
552310e230b6Smaya   __gen_address_type                   GlobalConstantBufferAddressHigh;
552410e230b6Smaya};
552510e230b6Smaya
552696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
552796c5ddc4SrjsGFX9_3DSTATE_RS_CONSTANT_POINTER_pack(__attribute__((unused)) __gen_user_data *data,
552810e230b6Smaya                                      __attribute__((unused)) void * restrict dst,
552996c5ddc4Srjs                                      __attribute__((unused)) const struct GFX9_3DSTATE_RS_CONSTANT_POINTER * restrict values)
553010e230b6Smaya{
553110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
553210e230b6Smaya
553310e230b6Smaya   dw[0] =
553410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
553510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
553610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
553710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
553810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
553910e230b6Smaya
554010e230b6Smaya   dw[1] =
554110e230b6Smaya      __gen_uint(values->OperationLoadorStore, 12, 12) |
554210e230b6Smaya      __gen_uint(values->ShaderSelect, 28, 30);
554310e230b6Smaya
554496c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->GlobalConstantBufferAddress, 0, 6, 31);
554510e230b6Smaya
554696c5ddc4Srjs   dw[3] = __gen_address(data, &dw[3], values->GlobalConstantBufferAddressHigh, 0, 0, 31);
554710e230b6Smaya}
554810e230b6Smaya
554996c5ddc4Srjs#define GFX9_3DSTATE_SAMPLER_PALETTE_LOAD0_length_bias      2
555096c5ddc4Srjs#define GFX9_3DSTATE_SAMPLER_PALETTE_LOAD0_header\
555110e230b6Smaya   ._3DCommandSubOpcode                 =      2,  \
555210e230b6Smaya   ._3DCommandOpcode                    =      1,  \
555310e230b6Smaya   .CommandSubType                      =      3,  \
555410e230b6Smaya   .CommandType                         =      3
555510e230b6Smaya
555696c5ddc4Srjsstruct GFX9_3DSTATE_SAMPLER_PALETTE_LOAD0 {
555710e230b6Smaya   uint32_t                             DWordLength;
555810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
555910e230b6Smaya   uint32_t                             _3DCommandOpcode;
556010e230b6Smaya   uint32_t                             CommandSubType;
556110e230b6Smaya   uint32_t                             CommandType;
556210e230b6Smaya   /* variable length fields follow */
556310e230b6Smaya};
556410e230b6Smaya
556596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
556696c5ddc4SrjsGFX9_3DSTATE_SAMPLER_PALETTE_LOAD0_pack(__attribute__((unused)) __gen_user_data *data,
556710e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
556896c5ddc4Srjs                                        __attribute__((unused)) const struct GFX9_3DSTATE_SAMPLER_PALETTE_LOAD0 * restrict values)
556910e230b6Smaya{
557010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
557110e230b6Smaya
557210e230b6Smaya   dw[0] =
557310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
557410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
557510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
557610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
557710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
557810e230b6Smaya}
557910e230b6Smaya
558096c5ddc4Srjs#define GFX9_3DSTATE_SAMPLER_PALETTE_LOAD1_length_bias      2
558196c5ddc4Srjs#define GFX9_3DSTATE_SAMPLER_PALETTE_LOAD1_header\
558210e230b6Smaya   .DWordLength                         =      0,  \
558310e230b6Smaya   ._3DCommandSubOpcode                 =     12,  \
558410e230b6Smaya   ._3DCommandOpcode                    =      1,  \
558510e230b6Smaya   .CommandSubType                      =      3,  \
558610e230b6Smaya   .CommandType                         =      3
558710e230b6Smaya
558896c5ddc4Srjsstruct GFX9_3DSTATE_SAMPLER_PALETTE_LOAD1 {
558910e230b6Smaya   uint32_t                             DWordLength;
559010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
559110e230b6Smaya   uint32_t                             _3DCommandOpcode;
559210e230b6Smaya   uint32_t                             CommandSubType;
559310e230b6Smaya   uint32_t                             CommandType;
559410e230b6Smaya   /* variable length fields follow */
559510e230b6Smaya};
559610e230b6Smaya
559796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
559896c5ddc4SrjsGFX9_3DSTATE_SAMPLER_PALETTE_LOAD1_pack(__attribute__((unused)) __gen_user_data *data,
559910e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
560096c5ddc4Srjs                                        __attribute__((unused)) const struct GFX9_3DSTATE_SAMPLER_PALETTE_LOAD1 * restrict values)
560110e230b6Smaya{
560210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
560310e230b6Smaya
560410e230b6Smaya   dw[0] =
560510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
560610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
560710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
560810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
560910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
561010e230b6Smaya}
561110e230b6Smaya
561296c5ddc4Srjs#define GFX9_3DSTATE_SAMPLER_STATE_POINTERS_DS_length      2
561396c5ddc4Srjs#define GFX9_3DSTATE_SAMPLER_STATE_POINTERS_DS_length_bias      2
561496c5ddc4Srjs#define GFX9_3DSTATE_SAMPLER_STATE_POINTERS_DS_header\
561510e230b6Smaya   .DWordLength                         =      0,  \
561610e230b6Smaya   ._3DCommandSubOpcode                 =     45,  \
561710e230b6Smaya   ._3DCommandOpcode                    =      0,  \
561810e230b6Smaya   .CommandSubType                      =      3,  \
561910e230b6Smaya   .CommandType                         =      3
562010e230b6Smaya
562196c5ddc4Srjsstruct GFX9_3DSTATE_SAMPLER_STATE_POINTERS_DS {
562210e230b6Smaya   uint32_t                             DWordLength;
562310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
562410e230b6Smaya   uint32_t                             _3DCommandOpcode;
562510e230b6Smaya   uint32_t                             CommandSubType;
562610e230b6Smaya   uint32_t                             CommandType;
562710e230b6Smaya   uint64_t                             PointertoDSSamplerState;
562810e230b6Smaya};
562910e230b6Smaya
563096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
563196c5ddc4SrjsGFX9_3DSTATE_SAMPLER_STATE_POINTERS_DS_pack(__attribute__((unused)) __gen_user_data *data,
563210e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
563396c5ddc4Srjs                                            __attribute__((unused)) const struct GFX9_3DSTATE_SAMPLER_STATE_POINTERS_DS * restrict values)
563410e230b6Smaya{
563510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
563610e230b6Smaya
563710e230b6Smaya   dw[0] =
563810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
563910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
564010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
564110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
564210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
564310e230b6Smaya
564410e230b6Smaya   dw[1] =
564510e230b6Smaya      __gen_offset(values->PointertoDSSamplerState, 5, 31);
564610e230b6Smaya}
564710e230b6Smaya
564896c5ddc4Srjs#define GFX9_3DSTATE_SAMPLER_STATE_POINTERS_GS_length      2
564996c5ddc4Srjs#define GFX9_3DSTATE_SAMPLER_STATE_POINTERS_GS_length_bias      2
565096c5ddc4Srjs#define GFX9_3DSTATE_SAMPLER_STATE_POINTERS_GS_header\
565110e230b6Smaya   .DWordLength                         =      0,  \
565210e230b6Smaya   ._3DCommandSubOpcode                 =     46,  \
565310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
565410e230b6Smaya   .CommandSubType                      =      3,  \
565510e230b6Smaya   .CommandType                         =      3
565610e230b6Smaya
565796c5ddc4Srjsstruct GFX9_3DSTATE_SAMPLER_STATE_POINTERS_GS {
565810e230b6Smaya   uint32_t                             DWordLength;
565910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
566010e230b6Smaya   uint32_t                             _3DCommandOpcode;
566110e230b6Smaya   uint32_t                             CommandSubType;
566210e230b6Smaya   uint32_t                             CommandType;
566310e230b6Smaya   uint64_t                             PointertoGSSamplerState;
566410e230b6Smaya};
566510e230b6Smaya
566696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
566796c5ddc4SrjsGFX9_3DSTATE_SAMPLER_STATE_POINTERS_GS_pack(__attribute__((unused)) __gen_user_data *data,
566810e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
566996c5ddc4Srjs                                            __attribute__((unused)) const struct GFX9_3DSTATE_SAMPLER_STATE_POINTERS_GS * restrict values)
567010e230b6Smaya{
567110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
567210e230b6Smaya
567310e230b6Smaya   dw[0] =
567410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
567510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
567610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
567710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
567810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
567910e230b6Smaya
568010e230b6Smaya   dw[1] =
568110e230b6Smaya      __gen_offset(values->PointertoGSSamplerState, 5, 31);
568210e230b6Smaya}
568310e230b6Smaya
568496c5ddc4Srjs#define GFX9_3DSTATE_SAMPLER_STATE_POINTERS_HS_length      2
568596c5ddc4Srjs#define GFX9_3DSTATE_SAMPLER_STATE_POINTERS_HS_length_bias      2
568696c5ddc4Srjs#define GFX9_3DSTATE_SAMPLER_STATE_POINTERS_HS_header\
568710e230b6Smaya   .DWordLength                         =      0,  \
568810e230b6Smaya   ._3DCommandSubOpcode                 =     44,  \
568910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
569010e230b6Smaya   .CommandSubType                      =      3,  \
569110e230b6Smaya   .CommandType                         =      3
569210e230b6Smaya
569396c5ddc4Srjsstruct GFX9_3DSTATE_SAMPLER_STATE_POINTERS_HS {
569410e230b6Smaya   uint32_t                             DWordLength;
569510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
569610e230b6Smaya   uint32_t                             _3DCommandOpcode;
569710e230b6Smaya   uint32_t                             CommandSubType;
569810e230b6Smaya   uint32_t                             CommandType;
569910e230b6Smaya   uint64_t                             PointertoHSSamplerState;
570010e230b6Smaya};
570110e230b6Smaya
570296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
570396c5ddc4SrjsGFX9_3DSTATE_SAMPLER_STATE_POINTERS_HS_pack(__attribute__((unused)) __gen_user_data *data,
570410e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
570596c5ddc4Srjs                                            __attribute__((unused)) const struct GFX9_3DSTATE_SAMPLER_STATE_POINTERS_HS * restrict values)
570610e230b6Smaya{
570710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
570810e230b6Smaya
570910e230b6Smaya   dw[0] =
571010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
571110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
571210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
571310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
571410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
571510e230b6Smaya
571610e230b6Smaya   dw[1] =
571710e230b6Smaya      __gen_offset(values->PointertoHSSamplerState, 5, 31);
571810e230b6Smaya}
571910e230b6Smaya
572096c5ddc4Srjs#define GFX9_3DSTATE_SAMPLER_STATE_POINTERS_PS_length      2
572196c5ddc4Srjs#define GFX9_3DSTATE_SAMPLER_STATE_POINTERS_PS_length_bias      2
572296c5ddc4Srjs#define GFX9_3DSTATE_SAMPLER_STATE_POINTERS_PS_header\
572310e230b6Smaya   .DWordLength                         =      0,  \
572410e230b6Smaya   ._3DCommandSubOpcode                 =     47,  \
572510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
572610e230b6Smaya   .CommandSubType                      =      3,  \
572710e230b6Smaya   .CommandType                         =      3
572810e230b6Smaya
572996c5ddc4Srjsstruct GFX9_3DSTATE_SAMPLER_STATE_POINTERS_PS {
573010e230b6Smaya   uint32_t                             DWordLength;
573110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
573210e230b6Smaya   uint32_t                             _3DCommandOpcode;
573310e230b6Smaya   uint32_t                             CommandSubType;
573410e230b6Smaya   uint32_t                             CommandType;
573510e230b6Smaya   uint64_t                             PointertoPSSamplerState;
573610e230b6Smaya};
573710e230b6Smaya
573896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
573996c5ddc4SrjsGFX9_3DSTATE_SAMPLER_STATE_POINTERS_PS_pack(__attribute__((unused)) __gen_user_data *data,
574010e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
574196c5ddc4Srjs                                            __attribute__((unused)) const struct GFX9_3DSTATE_SAMPLER_STATE_POINTERS_PS * restrict values)
574210e230b6Smaya{
574310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
574410e230b6Smaya
574510e230b6Smaya   dw[0] =
574610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
574710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
574810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
574910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
575010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
575110e230b6Smaya
575210e230b6Smaya   dw[1] =
575310e230b6Smaya      __gen_offset(values->PointertoPSSamplerState, 5, 31);
575410e230b6Smaya}
575510e230b6Smaya
575696c5ddc4Srjs#define GFX9_3DSTATE_SAMPLER_STATE_POINTERS_VS_length      2
575796c5ddc4Srjs#define GFX9_3DSTATE_SAMPLER_STATE_POINTERS_VS_length_bias      2
575896c5ddc4Srjs#define GFX9_3DSTATE_SAMPLER_STATE_POINTERS_VS_header\
575910e230b6Smaya   .DWordLength                         =      0,  \
576010e230b6Smaya   ._3DCommandSubOpcode                 =     43,  \
576110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
576210e230b6Smaya   .CommandSubType                      =      3,  \
576310e230b6Smaya   .CommandType                         =      3
576410e230b6Smaya
576596c5ddc4Srjsstruct GFX9_3DSTATE_SAMPLER_STATE_POINTERS_VS {
576610e230b6Smaya   uint32_t                             DWordLength;
576710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
576810e230b6Smaya   uint32_t                             _3DCommandOpcode;
576910e230b6Smaya   uint32_t                             CommandSubType;
577010e230b6Smaya   uint32_t                             CommandType;
577110e230b6Smaya   uint64_t                             PointertoVSSamplerState;
577210e230b6Smaya};
577310e230b6Smaya
577496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
577596c5ddc4SrjsGFX9_3DSTATE_SAMPLER_STATE_POINTERS_VS_pack(__attribute__((unused)) __gen_user_data *data,
577610e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
577796c5ddc4Srjs                                            __attribute__((unused)) const struct GFX9_3DSTATE_SAMPLER_STATE_POINTERS_VS * restrict values)
577810e230b6Smaya{
577910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
578010e230b6Smaya
578110e230b6Smaya   dw[0] =
578210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
578310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
578410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
578510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
578610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
578710e230b6Smaya
578810e230b6Smaya   dw[1] =
578910e230b6Smaya      __gen_offset(values->PointertoVSSamplerState, 5, 31);
579010e230b6Smaya}
579110e230b6Smaya
579296c5ddc4Srjs#define GFX9_3DSTATE_SAMPLE_MASK_length        2
579396c5ddc4Srjs#define GFX9_3DSTATE_SAMPLE_MASK_length_bias      2
579496c5ddc4Srjs#define GFX9_3DSTATE_SAMPLE_MASK_header         \
579510e230b6Smaya   .DWordLength                         =      0,  \
579610e230b6Smaya   ._3DCommandSubOpcode                 =     24,  \
579710e230b6Smaya   ._3DCommandOpcode                    =      0,  \
579810e230b6Smaya   .CommandSubType                      =      3,  \
579910e230b6Smaya   .CommandType                         =      3
580010e230b6Smaya
580196c5ddc4Srjsstruct GFX9_3DSTATE_SAMPLE_MASK {
580210e230b6Smaya   uint32_t                             DWordLength;
580310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
580410e230b6Smaya   uint32_t                             _3DCommandOpcode;
580510e230b6Smaya   uint32_t                             CommandSubType;
580610e230b6Smaya   uint32_t                             CommandType;
580710e230b6Smaya   uint32_t                             SampleMask;
580810e230b6Smaya};
580910e230b6Smaya
581096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
581196c5ddc4SrjsGFX9_3DSTATE_SAMPLE_MASK_pack(__attribute__((unused)) __gen_user_data *data,
581210e230b6Smaya                              __attribute__((unused)) void * restrict dst,
581396c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_3DSTATE_SAMPLE_MASK * restrict values)
581410e230b6Smaya{
581510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
581610e230b6Smaya
581710e230b6Smaya   dw[0] =
581810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
581910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
582010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
582110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
582210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
582310e230b6Smaya
582410e230b6Smaya   dw[1] =
582510e230b6Smaya      __gen_uint(values->SampleMask, 0, 15);
582610e230b6Smaya}
582710e230b6Smaya
582896c5ddc4Srjs#define GFX9_3DSTATE_SAMPLE_PATTERN_length      9
582996c5ddc4Srjs#define GFX9_3DSTATE_SAMPLE_PATTERN_length_bias      2
583096c5ddc4Srjs#define GFX9_3DSTATE_SAMPLE_PATTERN_header      \
583110e230b6Smaya   .DWordLength                         =      7,  \
583210e230b6Smaya   ._3DCommandSubOpcode                 =     28,  \
583310e230b6Smaya   ._3DCommandOpcode                    =      1,  \
583410e230b6Smaya   .CommandSubType                      =      3,  \
583510e230b6Smaya   .CommandType                         =      3
583610e230b6Smaya
583796c5ddc4Srjsstruct GFX9_3DSTATE_SAMPLE_PATTERN {
583810e230b6Smaya   uint32_t                             DWordLength;
583910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
584010e230b6Smaya   uint32_t                             _3DCommandOpcode;
584110e230b6Smaya   uint32_t                             CommandSubType;
584210e230b6Smaya   uint32_t                             CommandType;
584310e230b6Smaya   float                                _16xSample0YOffset;
584410e230b6Smaya   float                                _16xSample0XOffset;
584510e230b6Smaya   float                                _16xSample1YOffset;
584610e230b6Smaya   float                                _16xSample1XOffset;
584710e230b6Smaya   float                                _16xSample2YOffset;
584810e230b6Smaya   float                                _16xSample2XOffset;
584910e230b6Smaya   float                                _16xSample3YOffset;
585010e230b6Smaya   float                                _16xSample3XOffset;
585110e230b6Smaya   float                                _16xSample4YOffset;
585210e230b6Smaya   float                                _16xSample4XOffset;
585310e230b6Smaya   float                                _16xSample5YOffset;
585410e230b6Smaya   float                                _16xSample5XOffset;
585510e230b6Smaya   float                                _16xSample6YOffset;
585610e230b6Smaya   float                                _16xSample6XOffset;
585710e230b6Smaya   float                                _16xSample7YOffset;
585810e230b6Smaya   float                                _16xSample7XOffset;
585910e230b6Smaya   float                                _16xSample8YOffset;
586010e230b6Smaya   float                                _16xSample8XOffset;
586110e230b6Smaya   float                                _16xSample9YOffset;
586210e230b6Smaya   float                                _16xSample9XOffset;
586310e230b6Smaya   float                                _16xSample10YOffset;
586410e230b6Smaya   float                                _16xSample10XOffset;
586510e230b6Smaya   float                                _16xSample11YOffset;
586610e230b6Smaya   float                                _16xSample11XOffset;
586710e230b6Smaya   float                                _16xSample12YOffset;
586810e230b6Smaya   float                                _16xSample12XOffset;
586910e230b6Smaya   float                                _16xSample13YOffset;
587010e230b6Smaya   float                                _16xSample13XOffset;
587110e230b6Smaya   float                                _16xSample14YOffset;
587210e230b6Smaya   float                                _16xSample14XOffset;
587310e230b6Smaya   float                                _16xSample15YOffset;
587410e230b6Smaya   float                                _16xSample15XOffset;
587510e230b6Smaya   float                                _8xSample4YOffset;
587610e230b6Smaya   float                                _8xSample4XOffset;
587710e230b6Smaya   float                                _8xSample5YOffset;
587810e230b6Smaya   float                                _8xSample5XOffset;
587910e230b6Smaya   float                                _8xSample6YOffset;
588010e230b6Smaya   float                                _8xSample6XOffset;
588110e230b6Smaya   float                                _8xSample7YOffset;
588210e230b6Smaya   float                                _8xSample7XOffset;
588310e230b6Smaya   float                                _8xSample0YOffset;
588410e230b6Smaya   float                                _8xSample0XOffset;
588510e230b6Smaya   float                                _8xSample1YOffset;
588610e230b6Smaya   float                                _8xSample1XOffset;
588710e230b6Smaya   float                                _8xSample2YOffset;
588810e230b6Smaya   float                                _8xSample2XOffset;
588910e230b6Smaya   float                                _8xSample3YOffset;
589010e230b6Smaya   float                                _8xSample3XOffset;
589110e230b6Smaya   float                                _4xSample0YOffset;
589210e230b6Smaya   float                                _4xSample0XOffset;
589310e230b6Smaya   float                                _4xSample1YOffset;
589410e230b6Smaya   float                                _4xSample1XOffset;
589510e230b6Smaya   float                                _4xSample2YOffset;
589610e230b6Smaya   float                                _4xSample2XOffset;
589710e230b6Smaya   float                                _4xSample3YOffset;
589810e230b6Smaya   float                                _4xSample3XOffset;
589910e230b6Smaya   float                                _2xSample0YOffset;
590010e230b6Smaya   float                                _2xSample0XOffset;
590110e230b6Smaya   float                                _2xSample1YOffset;
590210e230b6Smaya   float                                _2xSample1XOffset;
590310e230b6Smaya   float                                _1xSample0YOffset;
590410e230b6Smaya   float                                _1xSample0XOffset;
590510e230b6Smaya};
590610e230b6Smaya
590796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
590896c5ddc4SrjsGFX9_3DSTATE_SAMPLE_PATTERN_pack(__attribute__((unused)) __gen_user_data *data,
590910e230b6Smaya                                 __attribute__((unused)) void * restrict dst,
591096c5ddc4Srjs                                 __attribute__((unused)) const struct GFX9_3DSTATE_SAMPLE_PATTERN * restrict values)
591110e230b6Smaya{
591210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
591310e230b6Smaya
591410e230b6Smaya   dw[0] =
591510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
591610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
591710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
591810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
591910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
592010e230b6Smaya
592110e230b6Smaya   dw[1] =
592210e230b6Smaya      __gen_ufixed(values->_16xSample0YOffset, 0, 3, 4) |
592310e230b6Smaya      __gen_ufixed(values->_16xSample0XOffset, 4, 7, 4) |
592410e230b6Smaya      __gen_ufixed(values->_16xSample1YOffset, 8, 11, 4) |
592510e230b6Smaya      __gen_ufixed(values->_16xSample1XOffset, 12, 15, 4) |
592610e230b6Smaya      __gen_ufixed(values->_16xSample2YOffset, 16, 19, 4) |
592710e230b6Smaya      __gen_ufixed(values->_16xSample2XOffset, 20, 23, 4) |
592810e230b6Smaya      __gen_ufixed(values->_16xSample3YOffset, 24, 27, 4) |
592910e230b6Smaya      __gen_ufixed(values->_16xSample3XOffset, 28, 31, 4);
593010e230b6Smaya
593110e230b6Smaya   dw[2] =
593210e230b6Smaya      __gen_ufixed(values->_16xSample4YOffset, 0, 3, 4) |
593310e230b6Smaya      __gen_ufixed(values->_16xSample4XOffset, 4, 7, 4) |
593410e230b6Smaya      __gen_ufixed(values->_16xSample5YOffset, 8, 11, 4) |
593510e230b6Smaya      __gen_ufixed(values->_16xSample5XOffset, 12, 15, 4) |
593610e230b6Smaya      __gen_ufixed(values->_16xSample6YOffset, 16, 19, 4) |
593710e230b6Smaya      __gen_ufixed(values->_16xSample6XOffset, 20, 23, 4) |
593810e230b6Smaya      __gen_ufixed(values->_16xSample7YOffset, 24, 27, 4) |
593910e230b6Smaya      __gen_ufixed(values->_16xSample7XOffset, 28, 31, 4);
594010e230b6Smaya
594110e230b6Smaya   dw[3] =
594210e230b6Smaya      __gen_ufixed(values->_16xSample8YOffset, 0, 3, 4) |
594310e230b6Smaya      __gen_ufixed(values->_16xSample8XOffset, 4, 7, 4) |
594410e230b6Smaya      __gen_ufixed(values->_16xSample9YOffset, 8, 11, 4) |
594510e230b6Smaya      __gen_ufixed(values->_16xSample9XOffset, 12, 15, 4) |
594610e230b6Smaya      __gen_ufixed(values->_16xSample10YOffset, 16, 19, 4) |
594710e230b6Smaya      __gen_ufixed(values->_16xSample10XOffset, 20, 23, 4) |
594810e230b6Smaya      __gen_ufixed(values->_16xSample11YOffset, 24, 27, 4) |
594910e230b6Smaya      __gen_ufixed(values->_16xSample11XOffset, 28, 31, 4);
595010e230b6Smaya
595110e230b6Smaya   dw[4] =
595210e230b6Smaya      __gen_ufixed(values->_16xSample12YOffset, 0, 3, 4) |
595310e230b6Smaya      __gen_ufixed(values->_16xSample12XOffset, 4, 7, 4) |
595410e230b6Smaya      __gen_ufixed(values->_16xSample13YOffset, 8, 11, 4) |
595510e230b6Smaya      __gen_ufixed(values->_16xSample13XOffset, 12, 15, 4) |
595610e230b6Smaya      __gen_ufixed(values->_16xSample14YOffset, 16, 19, 4) |
595710e230b6Smaya      __gen_ufixed(values->_16xSample14XOffset, 20, 23, 4) |
595810e230b6Smaya      __gen_ufixed(values->_16xSample15YOffset, 24, 27, 4) |
595910e230b6Smaya      __gen_ufixed(values->_16xSample15XOffset, 28, 31, 4);
596010e230b6Smaya
596110e230b6Smaya   dw[5] =
596210e230b6Smaya      __gen_ufixed(values->_8xSample4YOffset, 0, 3, 4) |
596310e230b6Smaya      __gen_ufixed(values->_8xSample4XOffset, 4, 7, 4) |
596410e230b6Smaya      __gen_ufixed(values->_8xSample5YOffset, 8, 11, 4) |
596510e230b6Smaya      __gen_ufixed(values->_8xSample5XOffset, 12, 15, 4) |
596610e230b6Smaya      __gen_ufixed(values->_8xSample6YOffset, 16, 19, 4) |
596710e230b6Smaya      __gen_ufixed(values->_8xSample6XOffset, 20, 23, 4) |
596810e230b6Smaya      __gen_ufixed(values->_8xSample7YOffset, 24, 27, 4) |
596910e230b6Smaya      __gen_ufixed(values->_8xSample7XOffset, 28, 31, 4);
597010e230b6Smaya
597110e230b6Smaya   dw[6] =
597210e230b6Smaya      __gen_ufixed(values->_8xSample0YOffset, 0, 3, 4) |
597310e230b6Smaya      __gen_ufixed(values->_8xSample0XOffset, 4, 7, 4) |
597410e230b6Smaya      __gen_ufixed(values->_8xSample1YOffset, 8, 11, 4) |
597510e230b6Smaya      __gen_ufixed(values->_8xSample1XOffset, 12, 15, 4) |
597610e230b6Smaya      __gen_ufixed(values->_8xSample2YOffset, 16, 19, 4) |
597710e230b6Smaya      __gen_ufixed(values->_8xSample2XOffset, 20, 23, 4) |
597810e230b6Smaya      __gen_ufixed(values->_8xSample3YOffset, 24, 27, 4) |
597910e230b6Smaya      __gen_ufixed(values->_8xSample3XOffset, 28, 31, 4);
598010e230b6Smaya
598110e230b6Smaya   dw[7] =
598210e230b6Smaya      __gen_ufixed(values->_4xSample0YOffset, 0, 3, 4) |
598310e230b6Smaya      __gen_ufixed(values->_4xSample0XOffset, 4, 7, 4) |
598410e230b6Smaya      __gen_ufixed(values->_4xSample1YOffset, 8, 11, 4) |
598510e230b6Smaya      __gen_ufixed(values->_4xSample1XOffset, 12, 15, 4) |
598610e230b6Smaya      __gen_ufixed(values->_4xSample2YOffset, 16, 19, 4) |
598710e230b6Smaya      __gen_ufixed(values->_4xSample2XOffset, 20, 23, 4) |
598810e230b6Smaya      __gen_ufixed(values->_4xSample3YOffset, 24, 27, 4) |
598910e230b6Smaya      __gen_ufixed(values->_4xSample3XOffset, 28, 31, 4);
599010e230b6Smaya
599110e230b6Smaya   dw[8] =
599210e230b6Smaya      __gen_ufixed(values->_2xSample0YOffset, 0, 3, 4) |
599310e230b6Smaya      __gen_ufixed(values->_2xSample0XOffset, 4, 7, 4) |
599410e230b6Smaya      __gen_ufixed(values->_2xSample1YOffset, 8, 11, 4) |
599510e230b6Smaya      __gen_ufixed(values->_2xSample1XOffset, 12, 15, 4) |
599610e230b6Smaya      __gen_ufixed(values->_1xSample0YOffset, 16, 19, 4) |
599710e230b6Smaya      __gen_ufixed(values->_1xSample0XOffset, 20, 23, 4);
599810e230b6Smaya}
599910e230b6Smaya
600096c5ddc4Srjs#define GFX9_3DSTATE_SBE_length                6
600196c5ddc4Srjs#define GFX9_3DSTATE_SBE_length_bias           2
600296c5ddc4Srjs#define GFX9_3DSTATE_SBE_header                 \
600310e230b6Smaya   .DWordLength                         =      4,  \
600410e230b6Smaya   ._3DCommandSubOpcode                 =     31,  \
600510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
600610e230b6Smaya   .CommandSubType                      =      3,  \
600710e230b6Smaya   .CommandType                         =      3
600810e230b6Smaya
600996c5ddc4Srjsstruct GFX9_3DSTATE_SBE {
601010e230b6Smaya   uint32_t                             DWordLength;
601110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
601210e230b6Smaya   uint32_t                             _3DCommandOpcode;
601310e230b6Smaya   uint32_t                             CommandSubType;
601410e230b6Smaya   uint32_t                             CommandType;
601510e230b6Smaya   uint32_t                             PrimitiveIDOverrideAttributeSelect;
601610e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
601710e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
601810e230b6Smaya   bool                                 PrimitiveIDOverrideComponentX;
601910e230b6Smaya   bool                                 PrimitiveIDOverrideComponentY;
602010e230b6Smaya   bool                                 PrimitiveIDOverrideComponentZ;
602110e230b6Smaya   bool                                 PrimitiveIDOverrideComponentW;
602210e230b6Smaya   uint32_t                             PointSpriteTextureCoordinateOrigin;
602310e230b6Smaya#define UPPERLEFT                                0
602410e230b6Smaya#define LOWERLEFT                                1
602510e230b6Smaya   bool                                 AttributeSwizzleEnable;
602610e230b6Smaya   uint32_t                             NumberofSFOutputAttributes;
602710e230b6Smaya   bool                                 ForceVertexURBEntryReadOffset;
602810e230b6Smaya   bool                                 ForceVertexURBEntryReadLength;
602910e230b6Smaya   uint32_t                             PointSpriteTextureCoordinateEnable;
603010e230b6Smaya   uint32_t                             ConstantInterpolationEnable;
603110e230b6Smaya   uint32_t                             AttributeActiveComponentFormat[32];
603210e230b6Smaya#define ACTIVE_COMPONENT_DISABLED                0
603310e230b6Smaya#define ACTIVE_COMPONENT_XY                      1
603410e230b6Smaya#define ACTIVE_COMPONENT_XYZ                     2
603510e230b6Smaya#define ACTIVE_COMPONENT_XYZW                    3
603610e230b6Smaya};
603710e230b6Smaya
603896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
603996c5ddc4SrjsGFX9_3DSTATE_SBE_pack(__attribute__((unused)) __gen_user_data *data,
604010e230b6Smaya                      __attribute__((unused)) void * restrict dst,
604196c5ddc4Srjs                      __attribute__((unused)) const struct GFX9_3DSTATE_SBE * restrict values)
604210e230b6Smaya{
604310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
604410e230b6Smaya
604510e230b6Smaya   dw[0] =
604610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
604710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
604810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
604910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
605010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
605110e230b6Smaya
605210e230b6Smaya   dw[1] =
605310e230b6Smaya      __gen_uint(values->PrimitiveIDOverrideAttributeSelect, 0, 4) |
605410e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 5, 10) |
605510e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 15) |
605610e230b6Smaya      __gen_uint(values->PrimitiveIDOverrideComponentX, 16, 16) |
605710e230b6Smaya      __gen_uint(values->PrimitiveIDOverrideComponentY, 17, 17) |
605810e230b6Smaya      __gen_uint(values->PrimitiveIDOverrideComponentZ, 18, 18) |
605910e230b6Smaya      __gen_uint(values->PrimitiveIDOverrideComponentW, 19, 19) |
606010e230b6Smaya      __gen_uint(values->PointSpriteTextureCoordinateOrigin, 20, 20) |
606110e230b6Smaya      __gen_uint(values->AttributeSwizzleEnable, 21, 21) |
606210e230b6Smaya      __gen_uint(values->NumberofSFOutputAttributes, 22, 27) |
606310e230b6Smaya      __gen_uint(values->ForceVertexURBEntryReadOffset, 28, 28) |
606410e230b6Smaya      __gen_uint(values->ForceVertexURBEntryReadLength, 29, 29);
606510e230b6Smaya
606610e230b6Smaya   dw[2] =
606710e230b6Smaya      __gen_uint(values->PointSpriteTextureCoordinateEnable, 0, 31);
606810e230b6Smaya
606910e230b6Smaya   dw[3] =
607010e230b6Smaya      __gen_uint(values->ConstantInterpolationEnable, 0, 31);
607110e230b6Smaya
607210e230b6Smaya   dw[4] =
607310e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[0], 0, 1) |
607410e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[1], 2, 3) |
607510e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[2], 4, 5) |
607610e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[3], 6, 7) |
607710e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[4], 8, 9) |
607810e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[5], 10, 11) |
607910e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[6], 12, 13) |
608010e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[7], 14, 15) |
608110e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[8], 16, 17) |
608210e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[9], 18, 19) |
608310e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[10], 20, 21) |
608410e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[11], 22, 23) |
608510e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[12], 24, 25) |
608610e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[13], 26, 27) |
608710e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[14], 28, 29) |
608810e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[15], 30, 31);
608910e230b6Smaya
609010e230b6Smaya   dw[5] =
609110e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[16], 0, 1) |
609210e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[17], 2, 3) |
609310e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[18], 4, 5) |
609410e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[19], 6, 7) |
609510e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[20], 8, 9) |
609610e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[21], 10, 11) |
609710e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[22], 12, 13) |
609810e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[23], 14, 15) |
609910e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[24], 16, 17) |
610010e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[25], 18, 19) |
610110e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[26], 20, 21) |
610210e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[27], 22, 23) |
610310e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[28], 24, 25) |
610410e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[29], 26, 27) |
610510e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[30], 28, 29) |
610610e230b6Smaya      __gen_uint(values->AttributeActiveComponentFormat[31], 30, 31);
610710e230b6Smaya}
610810e230b6Smaya
610996c5ddc4Srjs#define GFX9_3DSTATE_SBE_SWIZ_length          11
611096c5ddc4Srjs#define GFX9_3DSTATE_SBE_SWIZ_length_bias      2
611196c5ddc4Srjs#define GFX9_3DSTATE_SBE_SWIZ_header            \
611210e230b6Smaya   .DWordLength                         =      9,  \
611310e230b6Smaya   ._3DCommandSubOpcode                 =     81,  \
611410e230b6Smaya   ._3DCommandOpcode                    =      0,  \
611510e230b6Smaya   .CommandSubType                      =      3,  \
611610e230b6Smaya   .CommandType                         =      3
611710e230b6Smaya
611896c5ddc4Srjsstruct GFX9_3DSTATE_SBE_SWIZ {
611910e230b6Smaya   uint32_t                             DWordLength;
612010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
612110e230b6Smaya   uint32_t                             _3DCommandOpcode;
612210e230b6Smaya   uint32_t                             CommandSubType;
612310e230b6Smaya   uint32_t                             CommandType;
612496c5ddc4Srjs   struct GFX9_SF_OUTPUT_ATTRIBUTE_DETAIL Attribute[16];
612510e230b6Smaya   uint32_t                             AttributeWrapShortestEnables[16];
612610e230b6Smaya};
612710e230b6Smaya
612896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
612996c5ddc4SrjsGFX9_3DSTATE_SBE_SWIZ_pack(__attribute__((unused)) __gen_user_data *data,
613010e230b6Smaya                           __attribute__((unused)) void * restrict dst,
613196c5ddc4Srjs                           __attribute__((unused)) const struct GFX9_3DSTATE_SBE_SWIZ * restrict values)
613210e230b6Smaya{
613310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
613410e230b6Smaya
613510e230b6Smaya   dw[0] =
613610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
613710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
613810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
613910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
614010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
614110e230b6Smaya
614210e230b6Smaya   uint32_t v1_0;
614396c5ddc4Srjs   GFX9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v1_0, &values->Attribute[0]);
614410e230b6Smaya
614510e230b6Smaya   uint32_t v1_1;
614696c5ddc4Srjs   GFX9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v1_1, &values->Attribute[1]);
614710e230b6Smaya
614810e230b6Smaya   dw[1] =
614910e230b6Smaya      __gen_uint(v1_0, 0, 15) |
615010e230b6Smaya      __gen_uint(v1_1, 16, 31);
615110e230b6Smaya
615210e230b6Smaya   uint32_t v2_0;
615396c5ddc4Srjs   GFX9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v2_0, &values->Attribute[2]);
615410e230b6Smaya
615510e230b6Smaya   uint32_t v2_1;
615696c5ddc4Srjs   GFX9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v2_1, &values->Attribute[3]);
615710e230b6Smaya
615810e230b6Smaya   dw[2] =
615910e230b6Smaya      __gen_uint(v2_0, 0, 15) |
616010e230b6Smaya      __gen_uint(v2_1, 16, 31);
616110e230b6Smaya
616210e230b6Smaya   uint32_t v3_0;
616396c5ddc4Srjs   GFX9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v3_0, &values->Attribute[4]);
616410e230b6Smaya
616510e230b6Smaya   uint32_t v3_1;
616696c5ddc4Srjs   GFX9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v3_1, &values->Attribute[5]);
616710e230b6Smaya
616810e230b6Smaya   dw[3] =
616910e230b6Smaya      __gen_uint(v3_0, 0, 15) |
617010e230b6Smaya      __gen_uint(v3_1, 16, 31);
617110e230b6Smaya
617210e230b6Smaya   uint32_t v4_0;
617396c5ddc4Srjs   GFX9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v4_0, &values->Attribute[6]);
617410e230b6Smaya
617510e230b6Smaya   uint32_t v4_1;
617696c5ddc4Srjs   GFX9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v4_1, &values->Attribute[7]);
617710e230b6Smaya
617810e230b6Smaya   dw[4] =
617910e230b6Smaya      __gen_uint(v4_0, 0, 15) |
618010e230b6Smaya      __gen_uint(v4_1, 16, 31);
618110e230b6Smaya
618210e230b6Smaya   uint32_t v5_0;
618396c5ddc4Srjs   GFX9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v5_0, &values->Attribute[8]);
618410e230b6Smaya
618510e230b6Smaya   uint32_t v5_1;
618696c5ddc4Srjs   GFX9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v5_1, &values->Attribute[9]);
618710e230b6Smaya
618810e230b6Smaya   dw[5] =
618910e230b6Smaya      __gen_uint(v5_0, 0, 15) |
619010e230b6Smaya      __gen_uint(v5_1, 16, 31);
619110e230b6Smaya
619210e230b6Smaya   uint32_t v6_0;
619396c5ddc4Srjs   GFX9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v6_0, &values->Attribute[10]);
619410e230b6Smaya
619510e230b6Smaya   uint32_t v6_1;
619696c5ddc4Srjs   GFX9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v6_1, &values->Attribute[11]);
619710e230b6Smaya
619810e230b6Smaya   dw[6] =
619910e230b6Smaya      __gen_uint(v6_0, 0, 15) |
620010e230b6Smaya      __gen_uint(v6_1, 16, 31);
620110e230b6Smaya
620210e230b6Smaya   uint32_t v7_0;
620396c5ddc4Srjs   GFX9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v7_0, &values->Attribute[12]);
620410e230b6Smaya
620510e230b6Smaya   uint32_t v7_1;
620696c5ddc4Srjs   GFX9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v7_1, &values->Attribute[13]);
620710e230b6Smaya
620810e230b6Smaya   dw[7] =
620910e230b6Smaya      __gen_uint(v7_0, 0, 15) |
621010e230b6Smaya      __gen_uint(v7_1, 16, 31);
621110e230b6Smaya
621210e230b6Smaya   uint32_t v8_0;
621396c5ddc4Srjs   GFX9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_0, &values->Attribute[14]);
621410e230b6Smaya
621510e230b6Smaya   uint32_t v8_1;
621696c5ddc4Srjs   GFX9_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_1, &values->Attribute[15]);
621710e230b6Smaya
621810e230b6Smaya   dw[8] =
621910e230b6Smaya      __gen_uint(v8_0, 0, 15) |
622010e230b6Smaya      __gen_uint(v8_1, 16, 31);
622110e230b6Smaya
622210e230b6Smaya   dw[9] =
622310e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[0], 0, 3) |
622410e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[1], 4, 7) |
622510e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[2], 8, 11) |
622610e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[3], 12, 15) |
622710e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[4], 16, 19) |
622810e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[5], 20, 23) |
622910e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[6], 24, 27) |
623010e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[7], 28, 31);
623110e230b6Smaya
623210e230b6Smaya   dw[10] =
623310e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[8], 0, 3) |
623410e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[9], 4, 7) |
623510e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[10], 8, 11) |
623610e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[11], 12, 15) |
623710e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[12], 16, 19) |
623810e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[13], 20, 23) |
623910e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[14], 24, 27) |
624010e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[15], 28, 31);
624110e230b6Smaya}
624210e230b6Smaya
624396c5ddc4Srjs#define GFX9_3DSTATE_SCISSOR_STATE_POINTERS_length      2
624496c5ddc4Srjs#define GFX9_3DSTATE_SCISSOR_STATE_POINTERS_length_bias      2
624596c5ddc4Srjs#define GFX9_3DSTATE_SCISSOR_STATE_POINTERS_header\
624610e230b6Smaya   .DWordLength                         =      0,  \
624710e230b6Smaya   ._3DCommandSubOpcode                 =     15,  \
624810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
624910e230b6Smaya   .CommandSubType                      =      3,  \
625010e230b6Smaya   .CommandType                         =      3
625110e230b6Smaya
625296c5ddc4Srjsstruct GFX9_3DSTATE_SCISSOR_STATE_POINTERS {
625310e230b6Smaya   uint32_t                             DWordLength;
625410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
625510e230b6Smaya   uint32_t                             _3DCommandOpcode;
625610e230b6Smaya   uint32_t                             CommandSubType;
625710e230b6Smaya   uint32_t                             CommandType;
625810e230b6Smaya   uint64_t                             ScissorRectPointer;
625910e230b6Smaya};
626010e230b6Smaya
626196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
626296c5ddc4SrjsGFX9_3DSTATE_SCISSOR_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
626310e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
626496c5ddc4Srjs                                         __attribute__((unused)) const struct GFX9_3DSTATE_SCISSOR_STATE_POINTERS * restrict values)
626510e230b6Smaya{
626610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
626710e230b6Smaya
626810e230b6Smaya   dw[0] =
626910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
627010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
627110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
627210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
627310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
627410e230b6Smaya
627510e230b6Smaya   dw[1] =
627610e230b6Smaya      __gen_offset(values->ScissorRectPointer, 5, 31);
627710e230b6Smaya}
627810e230b6Smaya
627996c5ddc4Srjs#define GFX9_3DSTATE_SF_length                 4
628096c5ddc4Srjs#define GFX9_3DSTATE_SF_length_bias            2
628196c5ddc4Srjs#define GFX9_3DSTATE_SF_header                  \
628210e230b6Smaya   .DWordLength                         =      2,  \
628310e230b6Smaya   ._3DCommandSubOpcode                 =     19,  \
628410e230b6Smaya   ._3DCommandOpcode                    =      0,  \
628510e230b6Smaya   .CommandSubType                      =      3,  \
628610e230b6Smaya   .CommandType                         =      3
628710e230b6Smaya
628896c5ddc4Srjsstruct GFX9_3DSTATE_SF {
628910e230b6Smaya   uint32_t                             DWordLength;
629010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
629110e230b6Smaya   uint32_t                             _3DCommandOpcode;
629210e230b6Smaya   uint32_t                             CommandSubType;
629310e230b6Smaya   uint32_t                             CommandType;
629410e230b6Smaya   bool                                 ViewportTransformEnable;
629510e230b6Smaya   bool                                 StatisticsEnable;
629610e230b6Smaya   bool                                 LegacyGlobalDepthBiasEnable;
629710e230b6Smaya   float                                LineWidth;
629810e230b6Smaya   uint32_t                             LineEndCapAntialiasingRegionWidth;
629910e230b6Smaya#define _05pixels                                0
630010e230b6Smaya#define _10pixels                                1
630110e230b6Smaya#define _20pixels                                2
630210e230b6Smaya#define _40pixels                                3
630310e230b6Smaya   float                                PointWidth;
630410e230b6Smaya   uint32_t                             PointWidthSource;
630510e230b6Smaya#define Vertex                                   0
630610e230b6Smaya#define State                                    1
630710e230b6Smaya   uint32_t                             VertexSubPixelPrecisionSelect;
630810e230b6Smaya#define _8Bit                                    0
630910e230b6Smaya#define _4Bit                                    1
631010e230b6Smaya   bool                                 SmoothPointEnable;
631110e230b6Smaya   uint32_t                             AALineDistanceMode;
631210e230b6Smaya#define AALINEDISTANCE_TRUE                      1
631310e230b6Smaya   uint32_t                             TriangleFanProvokingVertexSelect;
631410e230b6Smaya   uint32_t                             LineStripListProvokingVertexSelect;
631510e230b6Smaya   uint32_t                             TriangleStripListProvokingVertexSelect;
631610e230b6Smaya   bool                                 LastPixelEnable;
631710e230b6Smaya};
631810e230b6Smaya
631996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
632096c5ddc4SrjsGFX9_3DSTATE_SF_pack(__attribute__((unused)) __gen_user_data *data,
632110e230b6Smaya                     __attribute__((unused)) void * restrict dst,
632296c5ddc4Srjs                     __attribute__((unused)) const struct GFX9_3DSTATE_SF * restrict values)
632310e230b6Smaya{
632410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
632510e230b6Smaya
632610e230b6Smaya   dw[0] =
632710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
632810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
632910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
633010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
633110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
633210e230b6Smaya
633310e230b6Smaya   dw[1] =
633410e230b6Smaya      __gen_uint(values->ViewportTransformEnable, 1, 1) |
633510e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
633610e230b6Smaya      __gen_uint(values->LegacyGlobalDepthBiasEnable, 11, 11) |
633710e230b6Smaya      __gen_ufixed(values->LineWidth, 12, 29, 7);
633810e230b6Smaya
633910e230b6Smaya   dw[2] =
634010e230b6Smaya      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 16, 17);
634110e230b6Smaya
634210e230b6Smaya   dw[3] =
634310e230b6Smaya      __gen_ufixed(values->PointWidth, 0, 10, 3) |
634410e230b6Smaya      __gen_uint(values->PointWidthSource, 11, 11) |
634510e230b6Smaya      __gen_uint(values->VertexSubPixelPrecisionSelect, 12, 12) |
634610e230b6Smaya      __gen_uint(values->SmoothPointEnable, 13, 13) |
634710e230b6Smaya      __gen_uint(values->AALineDistanceMode, 14, 14) |
634810e230b6Smaya      __gen_uint(values->TriangleFanProvokingVertexSelect, 25, 26) |
634910e230b6Smaya      __gen_uint(values->LineStripListProvokingVertexSelect, 27, 28) |
635010e230b6Smaya      __gen_uint(values->TriangleStripListProvokingVertexSelect, 29, 30) |
635110e230b6Smaya      __gen_uint(values->LastPixelEnable, 31, 31);
635210e230b6Smaya}
635310e230b6Smaya
635496c5ddc4Srjs#define GFX9_3DSTATE_SO_BUFFER_length          8
635596c5ddc4Srjs#define GFX9_3DSTATE_SO_BUFFER_length_bias      2
635696c5ddc4Srjs#define GFX9_3DSTATE_SO_BUFFER_header           \
635710e230b6Smaya   .DWordLength                         =      6,  \
635810e230b6Smaya   ._3DCommandSubOpcode                 =     24,  \
635910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
636010e230b6Smaya   .CommandSubType                      =      3,  \
636110e230b6Smaya   .CommandType                         =      3
636210e230b6Smaya
636396c5ddc4Srjsstruct GFX9_3DSTATE_SO_BUFFER {
636410e230b6Smaya   uint32_t                             DWordLength;
636510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
636610e230b6Smaya   uint32_t                             _3DCommandOpcode;
636710e230b6Smaya   uint32_t                             CommandSubType;
636810e230b6Smaya   uint32_t                             CommandType;
636910e230b6Smaya   bool                                 StreamOutputBufferOffsetAddressEnable;
637010e230b6Smaya   bool                                 StreamOffsetWriteEnable;
637110e230b6Smaya   uint32_t                             MOCS;
637210e230b6Smaya   uint32_t                             SOBufferIndex;
637310e230b6Smaya   bool                                 SOBufferEnable;
637410e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
637510e230b6Smaya   uint32_t                             SurfaceSize;
637610e230b6Smaya   __gen_address_type                   StreamOutputBufferOffsetAddress;
637710e230b6Smaya   uint32_t                             StreamOffset;
637810e230b6Smaya};
637910e230b6Smaya
638096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
638196c5ddc4SrjsGFX9_3DSTATE_SO_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
638210e230b6Smaya                            __attribute__((unused)) void * restrict dst,
638396c5ddc4Srjs                            __attribute__((unused)) const struct GFX9_3DSTATE_SO_BUFFER * restrict values)
638410e230b6Smaya{
638510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
638610e230b6Smaya
638710e230b6Smaya   dw[0] =
638810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
638910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
639010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
639110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
639210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
639310e230b6Smaya
639410e230b6Smaya   dw[1] =
639510e230b6Smaya      __gen_uint(values->StreamOutputBufferOffsetAddressEnable, 20, 20) |
639610e230b6Smaya      __gen_uint(values->StreamOffsetWriteEnable, 21, 21) |
639710e230b6Smaya      __gen_uint(values->MOCS, 22, 28) |
639810e230b6Smaya      __gen_uint(values->SOBufferIndex, 29, 30) |
639910e230b6Smaya      __gen_uint(values->SOBufferEnable, 31, 31);
640010e230b6Smaya
640110e230b6Smaya   const uint64_t v2_address =
640296c5ddc4Srjs      __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 2, 47);
640310e230b6Smaya   dw[2] = v2_address;
640410e230b6Smaya   dw[3] = v2_address >> 32;
640510e230b6Smaya
640610e230b6Smaya   dw[4] =
640710e230b6Smaya      __gen_uint(values->SurfaceSize, 0, 29);
640810e230b6Smaya
640910e230b6Smaya   const uint64_t v5_address =
641096c5ddc4Srjs      __gen_address(data, &dw[5], values->StreamOutputBufferOffsetAddress, 0, 2, 47);
641110e230b6Smaya   dw[5] = v5_address;
641210e230b6Smaya   dw[6] = v5_address >> 32;
641310e230b6Smaya
641410e230b6Smaya   dw[7] =
641510e230b6Smaya      __gen_uint(values->StreamOffset, 0, 31);
641610e230b6Smaya}
641710e230b6Smaya
641896c5ddc4Srjs#define GFX9_3DSTATE_SO_DECL_LIST_length_bias      2
641996c5ddc4Srjs#define GFX9_3DSTATE_SO_DECL_LIST_header        \
642010e230b6Smaya   ._3DCommandSubOpcode                 =     23,  \
642110e230b6Smaya   ._3DCommandOpcode                    =      1,  \
642210e230b6Smaya   .CommandSubType                      =      3,  \
642310e230b6Smaya   .CommandType                         =      3
642410e230b6Smaya
642596c5ddc4Srjsstruct GFX9_3DSTATE_SO_DECL_LIST {
642610e230b6Smaya   uint32_t                             DWordLength;
642710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
642810e230b6Smaya   uint32_t                             _3DCommandOpcode;
642910e230b6Smaya   uint32_t                             CommandSubType;
643010e230b6Smaya   uint32_t                             CommandType;
643110e230b6Smaya   uint32_t                             StreamtoBufferSelects0;
643210e230b6Smaya   uint32_t                             StreamtoBufferSelects1;
643310e230b6Smaya   uint32_t                             StreamtoBufferSelects2;
643410e230b6Smaya   uint32_t                             StreamtoBufferSelects3;
643510e230b6Smaya   uint32_t                             NumEntries0;
643610e230b6Smaya   uint32_t                             NumEntries1;
643710e230b6Smaya   uint32_t                             NumEntries2;
643810e230b6Smaya   uint32_t                             NumEntries3;
643910e230b6Smaya   /* variable length fields follow */
644010e230b6Smaya};
644110e230b6Smaya
644296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
644396c5ddc4SrjsGFX9_3DSTATE_SO_DECL_LIST_pack(__attribute__((unused)) __gen_user_data *data,
644410e230b6Smaya                               __attribute__((unused)) void * restrict dst,
644596c5ddc4Srjs                               __attribute__((unused)) const struct GFX9_3DSTATE_SO_DECL_LIST * restrict values)
644610e230b6Smaya{
644710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
644810e230b6Smaya
644910e230b6Smaya   dw[0] =
645010e230b6Smaya      __gen_uint(values->DWordLength, 0, 8) |
645110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
645210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
645310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
645410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
645510e230b6Smaya
645610e230b6Smaya   dw[1] =
645710e230b6Smaya      __gen_uint(values->StreamtoBufferSelects0, 0, 3) |
645810e230b6Smaya      __gen_uint(values->StreamtoBufferSelects1, 4, 7) |
645910e230b6Smaya      __gen_uint(values->StreamtoBufferSelects2, 8, 11) |
646010e230b6Smaya      __gen_uint(values->StreamtoBufferSelects3, 12, 15);
646110e230b6Smaya
646210e230b6Smaya   dw[2] =
646310e230b6Smaya      __gen_uint(values->NumEntries0, 0, 7) |
646410e230b6Smaya      __gen_uint(values->NumEntries1, 8, 15) |
646510e230b6Smaya      __gen_uint(values->NumEntries2, 16, 23) |
646610e230b6Smaya      __gen_uint(values->NumEntries3, 24, 31);
646710e230b6Smaya}
646810e230b6Smaya
646996c5ddc4Srjs#define GFX9_3DSTATE_STENCIL_BUFFER_length      5
647096c5ddc4Srjs#define GFX9_3DSTATE_STENCIL_BUFFER_length_bias      2
647196c5ddc4Srjs#define GFX9_3DSTATE_STENCIL_BUFFER_header      \
647210e230b6Smaya   .DWordLength                         =      3,  \
647310e230b6Smaya   ._3DCommandSubOpcode                 =      6,  \
647410e230b6Smaya   ._3DCommandOpcode                    =      0,  \
647510e230b6Smaya   .CommandSubType                      =      3,  \
647610e230b6Smaya   .CommandType                         =      3
647710e230b6Smaya
647896c5ddc4Srjsstruct GFX9_3DSTATE_STENCIL_BUFFER {
647910e230b6Smaya   uint32_t                             DWordLength;
648010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
648110e230b6Smaya   uint32_t                             _3DCommandOpcode;
648210e230b6Smaya   uint32_t                             CommandSubType;
648310e230b6Smaya   uint32_t                             CommandType;
648410e230b6Smaya   uint32_t                             SurfacePitch;
648510e230b6Smaya   uint32_t                             MOCS;
648610e230b6Smaya   bool                                 StencilBufferEnable;
648710e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
648810e230b6Smaya   uint32_t                             SurfaceQPitch;
648910e230b6Smaya};
649010e230b6Smaya
649196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
649296c5ddc4SrjsGFX9_3DSTATE_STENCIL_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
649310e230b6Smaya                                 __attribute__((unused)) void * restrict dst,
649496c5ddc4Srjs                                 __attribute__((unused)) const struct GFX9_3DSTATE_STENCIL_BUFFER * restrict values)
649510e230b6Smaya{
649610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
649710e230b6Smaya
649810e230b6Smaya   dw[0] =
649910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
650010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
650110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
650210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
650310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
650410e230b6Smaya
650510e230b6Smaya   dw[1] =
650610e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 16) |
650710e230b6Smaya      __gen_uint(values->MOCS, 22, 28) |
650810e230b6Smaya      __gen_uint(values->StencilBufferEnable, 31, 31);
650910e230b6Smaya
651010e230b6Smaya   const uint64_t v2_address =
651196c5ddc4Srjs      __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 0, 63);
651210e230b6Smaya   dw[2] = v2_address;
651310e230b6Smaya   dw[3] = v2_address >> 32;
651410e230b6Smaya
651510e230b6Smaya   dw[4] =
651610e230b6Smaya      __gen_uint(values->SurfaceQPitch, 0, 14);
651710e230b6Smaya}
651810e230b6Smaya
651996c5ddc4Srjs#define GFX9_3DSTATE_STREAMOUT_length          5
652096c5ddc4Srjs#define GFX9_3DSTATE_STREAMOUT_length_bias      2
652196c5ddc4Srjs#define GFX9_3DSTATE_STREAMOUT_header           \
652210e230b6Smaya   .DWordLength                         =      3,  \
652310e230b6Smaya   ._3DCommandSubOpcode                 =     30,  \
652410e230b6Smaya   ._3DCommandOpcode                    =      0,  \
652510e230b6Smaya   .CommandSubType                      =      3,  \
652610e230b6Smaya   .CommandType                         =      3
652710e230b6Smaya
652896c5ddc4Srjsstruct GFX9_3DSTATE_STREAMOUT {
652910e230b6Smaya   uint32_t                             DWordLength;
653010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
653110e230b6Smaya   uint32_t                             _3DCommandOpcode;
653210e230b6Smaya   uint32_t                             CommandSubType;
653310e230b6Smaya   uint32_t                             CommandType;
653410e230b6Smaya   uint32_t                             ForceRendering;
653510e230b6Smaya#define Resreved                                 1
653610e230b6Smaya#define Force_Off                                2
653710e230b6Smaya#define Force_on                                 3
653810e230b6Smaya   bool                                 SOStatisticsEnable;
653910e230b6Smaya   uint32_t                             ReorderMode;
654010e230b6Smaya#define LEADING                                  0
654110e230b6Smaya#define TRAILING                                 1
654210e230b6Smaya   uint32_t                             RenderStreamSelect;
654310e230b6Smaya   bool                                 RenderingDisable;
654410e230b6Smaya   bool                                 SOFunctionEnable;
654510e230b6Smaya   uint32_t                             Stream0VertexReadLength;
654610e230b6Smaya   uint32_t                             Stream0VertexReadOffset;
654710e230b6Smaya   uint32_t                             Stream1VertexReadLength;
654810e230b6Smaya   uint32_t                             Stream1VertexReadOffset;
654910e230b6Smaya   uint32_t                             Stream2VertexReadLength;
655010e230b6Smaya   uint32_t                             Stream2VertexReadOffset;
655110e230b6Smaya   uint32_t                             Stream3VertexReadLength;
655210e230b6Smaya   uint32_t                             Stream3VertexReadOffset;
655310e230b6Smaya   uint32_t                             Buffer0SurfacePitch;
655410e230b6Smaya   uint32_t                             Buffer1SurfacePitch;
655510e230b6Smaya   uint32_t                             Buffer2SurfacePitch;
655610e230b6Smaya   uint32_t                             Buffer3SurfacePitch;
655710e230b6Smaya};
655810e230b6Smaya
655996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
656096c5ddc4SrjsGFX9_3DSTATE_STREAMOUT_pack(__attribute__((unused)) __gen_user_data *data,
656110e230b6Smaya                            __attribute__((unused)) void * restrict dst,
656296c5ddc4Srjs                            __attribute__((unused)) const struct GFX9_3DSTATE_STREAMOUT * restrict values)
656310e230b6Smaya{
656410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
656510e230b6Smaya
656610e230b6Smaya   dw[0] =
656710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
656810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
656910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
657010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
657110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
657210e230b6Smaya
657310e230b6Smaya   dw[1] =
657410e230b6Smaya      __gen_uint(values->ForceRendering, 23, 24) |
657510e230b6Smaya      __gen_uint(values->SOStatisticsEnable, 25, 25) |
657610e230b6Smaya      __gen_uint(values->ReorderMode, 26, 26) |
657710e230b6Smaya      __gen_uint(values->RenderStreamSelect, 27, 28) |
657810e230b6Smaya      __gen_uint(values->RenderingDisable, 30, 30) |
657910e230b6Smaya      __gen_uint(values->SOFunctionEnable, 31, 31);
658010e230b6Smaya
658110e230b6Smaya   dw[2] =
658210e230b6Smaya      __gen_uint(values->Stream0VertexReadLength, 0, 4) |
658310e230b6Smaya      __gen_uint(values->Stream0VertexReadOffset, 5, 5) |
658410e230b6Smaya      __gen_uint(values->Stream1VertexReadLength, 8, 12) |
658510e230b6Smaya      __gen_uint(values->Stream1VertexReadOffset, 13, 13) |
658610e230b6Smaya      __gen_uint(values->Stream2VertexReadLength, 16, 20) |
658710e230b6Smaya      __gen_uint(values->Stream2VertexReadOffset, 21, 21) |
658810e230b6Smaya      __gen_uint(values->Stream3VertexReadLength, 24, 28) |
658910e230b6Smaya      __gen_uint(values->Stream3VertexReadOffset, 29, 29);
659010e230b6Smaya
659110e230b6Smaya   dw[3] =
659210e230b6Smaya      __gen_uint(values->Buffer0SurfacePitch, 0, 11) |
659310e230b6Smaya      __gen_uint(values->Buffer1SurfacePitch, 16, 27);
659410e230b6Smaya
659510e230b6Smaya   dw[4] =
659610e230b6Smaya      __gen_uint(values->Buffer2SurfacePitch, 0, 11) |
659710e230b6Smaya      __gen_uint(values->Buffer3SurfacePitch, 16, 27);
659810e230b6Smaya}
659910e230b6Smaya
660096c5ddc4Srjs#define GFX9_3DSTATE_TE_length                 4
660196c5ddc4Srjs#define GFX9_3DSTATE_TE_length_bias            2
660296c5ddc4Srjs#define GFX9_3DSTATE_TE_header                  \
660310e230b6Smaya   .DWordLength                         =      2,  \
660410e230b6Smaya   ._3DCommandSubOpcode                 =     28,  \
660510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
660610e230b6Smaya   .CommandSubType                      =      3,  \
660710e230b6Smaya   .CommandType                         =      3
660810e230b6Smaya
660996c5ddc4Srjsstruct GFX9_3DSTATE_TE {
661010e230b6Smaya   uint32_t                             DWordLength;
661110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
661210e230b6Smaya   uint32_t                             _3DCommandOpcode;
661310e230b6Smaya   uint32_t                             CommandSubType;
661410e230b6Smaya   uint32_t                             CommandType;
661510e230b6Smaya   bool                                 TEEnable;
661610e230b6Smaya   uint32_t                             TEMode;
661710e230b6Smaya#define HW_TESS                                  0
661810e230b6Smaya   uint32_t                             TEDomain;
661910e230b6Smaya#define QUAD                                     0
662010e230b6Smaya#define TRI                                      1
662110e230b6Smaya#define ISOLINE                                  2
662210e230b6Smaya   uint32_t                             OutputTopology;
662310e230b6Smaya#define OUTPUT_POINT                             0
662410e230b6Smaya#define OUTPUT_LINE                              1
662510e230b6Smaya#define OUTPUT_TRI_CW                            2
662610e230b6Smaya#define OUTPUT_TRI_CCW                           3
662710e230b6Smaya   uint32_t                             Partitioning;
662810e230b6Smaya#define INTEGER                                  0
662910e230b6Smaya#define ODD_FRACTIONAL                           1
663010e230b6Smaya#define EVEN_FRACTIONAL                          2
663110e230b6Smaya   float                                MaximumTessellationFactorOdd;
663210e230b6Smaya   float                                MaximumTessellationFactorNotOdd;
663310e230b6Smaya};
663410e230b6Smaya
663596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
663696c5ddc4SrjsGFX9_3DSTATE_TE_pack(__attribute__((unused)) __gen_user_data *data,
663710e230b6Smaya                     __attribute__((unused)) void * restrict dst,
663896c5ddc4Srjs                     __attribute__((unused)) const struct GFX9_3DSTATE_TE * restrict values)
663910e230b6Smaya{
664010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
664110e230b6Smaya
664210e230b6Smaya   dw[0] =
664310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
664410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
664510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
664610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
664710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
664810e230b6Smaya
664910e230b6Smaya   dw[1] =
665010e230b6Smaya      __gen_uint(values->TEEnable, 0, 0) |
665110e230b6Smaya      __gen_uint(values->TEMode, 1, 2) |
665210e230b6Smaya      __gen_uint(values->TEDomain, 4, 5) |
665310e230b6Smaya      __gen_uint(values->OutputTopology, 8, 9) |
665410e230b6Smaya      __gen_uint(values->Partitioning, 12, 13);
665510e230b6Smaya
665610e230b6Smaya   dw[2] =
665710e230b6Smaya      __gen_float(values->MaximumTessellationFactorOdd);
665810e230b6Smaya
665910e230b6Smaya   dw[3] =
666010e230b6Smaya      __gen_float(values->MaximumTessellationFactorNotOdd);
666110e230b6Smaya}
666210e230b6Smaya
666396c5ddc4Srjs#define GFX9_3DSTATE_URB_CLEAR_length          2
666496c5ddc4Srjs#define GFX9_3DSTATE_URB_CLEAR_length_bias      2
666596c5ddc4Srjs#define GFX9_3DSTATE_URB_CLEAR_header           \
666610e230b6Smaya   .DWordLength                         =      0,  \
666710e230b6Smaya   ._3DCommandSubOpcode                 =     29,  \
666810e230b6Smaya   ._3DCommandOpcode                    =      1,  \
666910e230b6Smaya   .CommandSubType                      =      3,  \
667010e230b6Smaya   .CommandType                         =      3
667110e230b6Smaya
667296c5ddc4Srjsstruct GFX9_3DSTATE_URB_CLEAR {
667310e230b6Smaya   uint32_t                             DWordLength;
667410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
667510e230b6Smaya   uint32_t                             _3DCommandOpcode;
667610e230b6Smaya   uint32_t                             CommandSubType;
667710e230b6Smaya   uint32_t                             CommandType;
667810e230b6Smaya   uint64_t                             URBAddress;
667910e230b6Smaya   uint32_t                             URBClearLength;
668010e230b6Smaya};
668110e230b6Smaya
668296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
668396c5ddc4SrjsGFX9_3DSTATE_URB_CLEAR_pack(__attribute__((unused)) __gen_user_data *data,
668410e230b6Smaya                            __attribute__((unused)) void * restrict dst,
668596c5ddc4Srjs                            __attribute__((unused)) const struct GFX9_3DSTATE_URB_CLEAR * restrict values)
668610e230b6Smaya{
668710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
668810e230b6Smaya
668910e230b6Smaya   dw[0] =
669010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
669110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
669210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
669310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
669410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
669510e230b6Smaya
669610e230b6Smaya   dw[1] =
669710e230b6Smaya      __gen_offset(values->URBAddress, 0, 14) |
669810e230b6Smaya      __gen_uint(values->URBClearLength, 16, 29);
669910e230b6Smaya}
670010e230b6Smaya
670196c5ddc4Srjs#define GFX9_3DSTATE_URB_DS_length             2
670296c5ddc4Srjs#define GFX9_3DSTATE_URB_DS_length_bias        2
670396c5ddc4Srjs#define GFX9_3DSTATE_URB_DS_header              \
670410e230b6Smaya   .DWordLength                         =      0,  \
670510e230b6Smaya   ._3DCommandSubOpcode                 =     50,  \
670610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
670710e230b6Smaya   .CommandSubType                      =      3,  \
670810e230b6Smaya   .CommandType                         =      3
670910e230b6Smaya
671096c5ddc4Srjsstruct GFX9_3DSTATE_URB_DS {
671110e230b6Smaya   uint32_t                             DWordLength;
671210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
671310e230b6Smaya   uint32_t                             _3DCommandOpcode;
671410e230b6Smaya   uint32_t                             CommandSubType;
671510e230b6Smaya   uint32_t                             CommandType;
671610e230b6Smaya   uint32_t                             DSNumberofURBEntries;
671710e230b6Smaya   uint32_t                             DSURBEntryAllocationSize;
671810e230b6Smaya   uint32_t                             DSURBStartingAddress;
671910e230b6Smaya};
672010e230b6Smaya
672196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
672296c5ddc4SrjsGFX9_3DSTATE_URB_DS_pack(__attribute__((unused)) __gen_user_data *data,
672310e230b6Smaya                         __attribute__((unused)) void * restrict dst,
672496c5ddc4Srjs                         __attribute__((unused)) const struct GFX9_3DSTATE_URB_DS * restrict values)
672510e230b6Smaya{
672610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
672710e230b6Smaya
672810e230b6Smaya   dw[0] =
672910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
673010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
673110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
673210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
673310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
673410e230b6Smaya
673510e230b6Smaya   dw[1] =
673610e230b6Smaya      __gen_uint(values->DSNumberofURBEntries, 0, 15) |
673710e230b6Smaya      __gen_uint(values->DSURBEntryAllocationSize, 16, 24) |
673810e230b6Smaya      __gen_uint(values->DSURBStartingAddress, 25, 31);
673910e230b6Smaya}
674010e230b6Smaya
674196c5ddc4Srjs#define GFX9_3DSTATE_URB_GS_length             2
674296c5ddc4Srjs#define GFX9_3DSTATE_URB_GS_length_bias        2
674396c5ddc4Srjs#define GFX9_3DSTATE_URB_GS_header              \
674410e230b6Smaya   .DWordLength                         =      0,  \
674510e230b6Smaya   ._3DCommandSubOpcode                 =     51,  \
674610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
674710e230b6Smaya   .CommandSubType                      =      3,  \
674810e230b6Smaya   .CommandType                         =      3
674910e230b6Smaya
675096c5ddc4Srjsstruct GFX9_3DSTATE_URB_GS {
675110e230b6Smaya   uint32_t                             DWordLength;
675210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
675310e230b6Smaya   uint32_t                             _3DCommandOpcode;
675410e230b6Smaya   uint32_t                             CommandSubType;
675510e230b6Smaya   uint32_t                             CommandType;
675610e230b6Smaya   uint32_t                             GSNumberofURBEntries;
675710e230b6Smaya   uint32_t                             GSURBEntryAllocationSize;
675810e230b6Smaya   uint32_t                             GSURBStartingAddress;
675910e230b6Smaya};
676010e230b6Smaya
676196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
676296c5ddc4SrjsGFX9_3DSTATE_URB_GS_pack(__attribute__((unused)) __gen_user_data *data,
676310e230b6Smaya                         __attribute__((unused)) void * restrict dst,
676496c5ddc4Srjs                         __attribute__((unused)) const struct GFX9_3DSTATE_URB_GS * restrict values)
676510e230b6Smaya{
676610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
676710e230b6Smaya
676810e230b6Smaya   dw[0] =
676910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
677010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
677110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
677210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
677310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
677410e230b6Smaya
677510e230b6Smaya   dw[1] =
677610e230b6Smaya      __gen_uint(values->GSNumberofURBEntries, 0, 15) |
677710e230b6Smaya      __gen_uint(values->GSURBEntryAllocationSize, 16, 24) |
677810e230b6Smaya      __gen_uint(values->GSURBStartingAddress, 25, 31);
677910e230b6Smaya}
678010e230b6Smaya
678196c5ddc4Srjs#define GFX9_3DSTATE_URB_HS_length             2
678296c5ddc4Srjs#define GFX9_3DSTATE_URB_HS_length_bias        2
678396c5ddc4Srjs#define GFX9_3DSTATE_URB_HS_header              \
678410e230b6Smaya   .DWordLength                         =      0,  \
678510e230b6Smaya   ._3DCommandSubOpcode                 =     49,  \
678610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
678710e230b6Smaya   .CommandSubType                      =      3,  \
678810e230b6Smaya   .CommandType                         =      3
678910e230b6Smaya
679096c5ddc4Srjsstruct GFX9_3DSTATE_URB_HS {
679110e230b6Smaya   uint32_t                             DWordLength;
679210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
679310e230b6Smaya   uint32_t                             _3DCommandOpcode;
679410e230b6Smaya   uint32_t                             CommandSubType;
679510e230b6Smaya   uint32_t                             CommandType;
679610e230b6Smaya   uint32_t                             HSNumberofURBEntries;
679710e230b6Smaya   uint32_t                             HSURBEntryAllocationSize;
679810e230b6Smaya   uint32_t                             HSURBStartingAddress;
679910e230b6Smaya};
680010e230b6Smaya
680196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
680296c5ddc4SrjsGFX9_3DSTATE_URB_HS_pack(__attribute__((unused)) __gen_user_data *data,
680310e230b6Smaya                         __attribute__((unused)) void * restrict dst,
680496c5ddc4Srjs                         __attribute__((unused)) const struct GFX9_3DSTATE_URB_HS * restrict values)
680510e230b6Smaya{
680610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
680710e230b6Smaya
680810e230b6Smaya   dw[0] =
680910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
681010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
681110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
681210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
681310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
681410e230b6Smaya
681510e230b6Smaya   dw[1] =
681610e230b6Smaya      __gen_uint(values->HSNumberofURBEntries, 0, 15) |
681710e230b6Smaya      __gen_uint(values->HSURBEntryAllocationSize, 16, 24) |
681810e230b6Smaya      __gen_uint(values->HSURBStartingAddress, 25, 31);
681910e230b6Smaya}
682010e230b6Smaya
682196c5ddc4Srjs#define GFX9_3DSTATE_URB_VS_length             2
682296c5ddc4Srjs#define GFX9_3DSTATE_URB_VS_length_bias        2
682396c5ddc4Srjs#define GFX9_3DSTATE_URB_VS_header              \
682410e230b6Smaya   .DWordLength                         =      0,  \
682510e230b6Smaya   ._3DCommandSubOpcode                 =     48,  \
682610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
682710e230b6Smaya   .CommandSubType                      =      3,  \
682810e230b6Smaya   .CommandType                         =      3
682910e230b6Smaya
683096c5ddc4Srjsstruct GFX9_3DSTATE_URB_VS {
683110e230b6Smaya   uint32_t                             DWordLength;
683210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
683310e230b6Smaya   uint32_t                             _3DCommandOpcode;
683410e230b6Smaya   uint32_t                             CommandSubType;
683510e230b6Smaya   uint32_t                             CommandType;
683610e230b6Smaya   uint32_t                             VSNumberofURBEntries;
683710e230b6Smaya   uint32_t                             VSURBEntryAllocationSize;
683810e230b6Smaya   uint32_t                             VSURBStartingAddress;
683910e230b6Smaya};
684010e230b6Smaya
684196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
684296c5ddc4SrjsGFX9_3DSTATE_URB_VS_pack(__attribute__((unused)) __gen_user_data *data,
684310e230b6Smaya                         __attribute__((unused)) void * restrict dst,
684496c5ddc4Srjs                         __attribute__((unused)) const struct GFX9_3DSTATE_URB_VS * restrict values)
684510e230b6Smaya{
684610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
684710e230b6Smaya
684810e230b6Smaya   dw[0] =
684910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
685010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
685110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
685210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
685310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
685410e230b6Smaya
685510e230b6Smaya   dw[1] =
685610e230b6Smaya      __gen_uint(values->VSNumberofURBEntries, 0, 15) |
685710e230b6Smaya      __gen_uint(values->VSURBEntryAllocationSize, 16, 24) |
685810e230b6Smaya      __gen_uint(values->VSURBStartingAddress, 25, 31);
685910e230b6Smaya}
686010e230b6Smaya
686196c5ddc4Srjs#define GFX9_3DSTATE_VERTEX_BUFFERS_length_bias      2
686296c5ddc4Srjs#define GFX9_3DSTATE_VERTEX_BUFFERS_header      \
686310e230b6Smaya   .DWordLength                         =      3,  \
686410e230b6Smaya   ._3DCommandSubOpcode                 =      8,  \
686510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
686610e230b6Smaya   .CommandSubType                      =      3,  \
686710e230b6Smaya   .CommandType                         =      3
686810e230b6Smaya
686996c5ddc4Srjsstruct GFX9_3DSTATE_VERTEX_BUFFERS {
687010e230b6Smaya   uint32_t                             DWordLength;
687110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
687210e230b6Smaya   uint32_t                             _3DCommandOpcode;
687310e230b6Smaya   uint32_t                             CommandSubType;
687410e230b6Smaya   uint32_t                             CommandType;
687510e230b6Smaya   /* variable length fields follow */
687610e230b6Smaya};
687710e230b6Smaya
687896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
687996c5ddc4SrjsGFX9_3DSTATE_VERTEX_BUFFERS_pack(__attribute__((unused)) __gen_user_data *data,
688010e230b6Smaya                                 __attribute__((unused)) void * restrict dst,
688196c5ddc4Srjs                                 __attribute__((unused)) const struct GFX9_3DSTATE_VERTEX_BUFFERS * restrict values)
688210e230b6Smaya{
688310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
688410e230b6Smaya
688510e230b6Smaya   dw[0] =
688610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
688710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
688810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
688910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
689010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
689110e230b6Smaya}
689210e230b6Smaya
689396c5ddc4Srjs#define GFX9_3DSTATE_VERTEX_ELEMENTS_length_bias      2
689496c5ddc4Srjs#define GFX9_3DSTATE_VERTEX_ELEMENTS_header     \
689510e230b6Smaya   .DWordLength                         =      1,  \
689610e230b6Smaya   ._3DCommandSubOpcode                 =      9,  \
689710e230b6Smaya   ._3DCommandOpcode                    =      0,  \
689810e230b6Smaya   .CommandSubType                      =      3,  \
689910e230b6Smaya   .CommandType                         =      3
690010e230b6Smaya
690196c5ddc4Srjsstruct GFX9_3DSTATE_VERTEX_ELEMENTS {
690210e230b6Smaya   uint32_t                             DWordLength;
690310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
690410e230b6Smaya   uint32_t                             _3DCommandOpcode;
690510e230b6Smaya   uint32_t                             CommandSubType;
690610e230b6Smaya   uint32_t                             CommandType;
690710e230b6Smaya   /* variable length fields follow */
690810e230b6Smaya};
690910e230b6Smaya
691096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
691196c5ddc4SrjsGFX9_3DSTATE_VERTEX_ELEMENTS_pack(__attribute__((unused)) __gen_user_data *data,
691210e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
691396c5ddc4Srjs                                  __attribute__((unused)) const struct GFX9_3DSTATE_VERTEX_ELEMENTS * restrict values)
691410e230b6Smaya{
691510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
691610e230b6Smaya
691710e230b6Smaya   dw[0] =
691810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
691910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
692010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
692110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
692210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
692310e230b6Smaya}
692410e230b6Smaya
692596c5ddc4Srjs#define GFX9_3DSTATE_VF_length                 2
692696c5ddc4Srjs#define GFX9_3DSTATE_VF_length_bias            2
692796c5ddc4Srjs#define GFX9_3DSTATE_VF_header                  \
692810e230b6Smaya   .DWordLength                         =      0,  \
692910e230b6Smaya   ._3DCommandSubOpcode                 =     12,  \
693010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
693110e230b6Smaya   .CommandSubType                      =      3,  \
693210e230b6Smaya   .CommandType                         =      3
693310e230b6Smaya
693496c5ddc4Srjsstruct GFX9_3DSTATE_VF {
693510e230b6Smaya   uint32_t                             DWordLength;
693610e230b6Smaya   bool                                 IndexedDrawCutIndexEnable;
693710e230b6Smaya   bool                                 ComponentPackingEnable;
693810e230b6Smaya   bool                                 SequentialDrawCutIndexEnable;
693910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
694010e230b6Smaya   uint32_t                             _3DCommandOpcode;
694110e230b6Smaya   uint32_t                             CommandSubType;
694210e230b6Smaya   uint32_t                             CommandType;
694310e230b6Smaya   uint32_t                             CutIndex;
694410e230b6Smaya};
694510e230b6Smaya
694696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
694796c5ddc4SrjsGFX9_3DSTATE_VF_pack(__attribute__((unused)) __gen_user_data *data,
694810e230b6Smaya                     __attribute__((unused)) void * restrict dst,
694996c5ddc4Srjs                     __attribute__((unused)) const struct GFX9_3DSTATE_VF * restrict values)
695010e230b6Smaya{
695110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
695210e230b6Smaya
695310e230b6Smaya   dw[0] =
695410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
695510e230b6Smaya      __gen_uint(values->IndexedDrawCutIndexEnable, 8, 8) |
695610e230b6Smaya      __gen_uint(values->ComponentPackingEnable, 9, 9) |
695710e230b6Smaya      __gen_uint(values->SequentialDrawCutIndexEnable, 10, 10) |
695810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
695910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
696010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
696110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
696210e230b6Smaya
696310e230b6Smaya   dw[1] =
696410e230b6Smaya      __gen_uint(values->CutIndex, 0, 31);
696510e230b6Smaya}
696610e230b6Smaya
696796c5ddc4Srjs#define GFX9_3DSTATE_VF_COMPONENT_PACKING_length      5
696896c5ddc4Srjs#define GFX9_3DSTATE_VF_COMPONENT_PACKING_length_bias      2
696996c5ddc4Srjs#define GFX9_3DSTATE_VF_COMPONENT_PACKING_header\
697010e230b6Smaya   .DWordLength                         =      3,  \
697110e230b6Smaya   ._3DCommandSubOpcode                 =     85,  \
697210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
697310e230b6Smaya   .CommandSubType                      =      3,  \
697410e230b6Smaya   .CommandType                         =      3
697510e230b6Smaya
697696c5ddc4Srjsstruct GFX9_3DSTATE_VF_COMPONENT_PACKING {
697710e230b6Smaya   uint32_t                             DWordLength;
697810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
697910e230b6Smaya   uint32_t                             _3DCommandOpcode;
698010e230b6Smaya   uint32_t                             CommandSubType;
698110e230b6Smaya   uint32_t                             CommandType;
698210e230b6Smaya   uint32_t                             VertexElement00Enables;
698310e230b6Smaya   uint32_t                             VertexElement01Enables;
698410e230b6Smaya   uint32_t                             VertexElement02Enables;
698510e230b6Smaya   uint32_t                             VertexElement03Enables;
698610e230b6Smaya   uint32_t                             VertexElement04Enables;
698710e230b6Smaya   uint32_t                             VertexElement05Enables;
698810e230b6Smaya   uint32_t                             VertexElement06Enables;
698910e230b6Smaya   uint32_t                             VertexElement07Enables;
699010e230b6Smaya   uint32_t                             VertexElement08Enables;
699110e230b6Smaya   uint32_t                             VertexElement09Enables;
699210e230b6Smaya   uint32_t                             VertexElement10Enables;
699310e230b6Smaya   uint32_t                             VertexElement11Enables;
699410e230b6Smaya   uint32_t                             VertexElement12Enables;
699510e230b6Smaya   uint32_t                             VertexElement13Enables;
699610e230b6Smaya   uint32_t                             VertexElement14Enables;
699710e230b6Smaya   uint32_t                             VertexElement15Enables;
699810e230b6Smaya   uint32_t                             VertexElement16Enables;
699910e230b6Smaya   uint32_t                             VertexElement17Enables;
700010e230b6Smaya   uint32_t                             VertexElement18Enables;
700110e230b6Smaya   uint32_t                             VertexElement19Enables;
700210e230b6Smaya   uint32_t                             VertexElement20Enables;
700310e230b6Smaya   uint32_t                             VertexElement21Enables;
700410e230b6Smaya   uint32_t                             VertexElement22Enables;
700510e230b6Smaya   uint32_t                             VertexElement23Enables;
700610e230b6Smaya   uint32_t                             VertexElement24Enables;
700710e230b6Smaya   uint32_t                             VertexElement25Enables;
700810e230b6Smaya   uint32_t                             VertexElement26Enables;
700910e230b6Smaya   uint32_t                             VertexElement27Enables;
701010e230b6Smaya   uint32_t                             VertexElement28Enables;
701110e230b6Smaya   uint32_t                             VertexElement29Enables;
701210e230b6Smaya   uint32_t                             VertexElement30Enables;
701310e230b6Smaya   uint32_t                             VertexElement31Enables;
701410e230b6Smaya};
701510e230b6Smaya
701696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
701796c5ddc4SrjsGFX9_3DSTATE_VF_COMPONENT_PACKING_pack(__attribute__((unused)) __gen_user_data *data,
701810e230b6Smaya                                       __attribute__((unused)) void * restrict dst,
701996c5ddc4Srjs                                       __attribute__((unused)) const struct GFX9_3DSTATE_VF_COMPONENT_PACKING * restrict values)
702010e230b6Smaya{
702110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
702210e230b6Smaya
702310e230b6Smaya   dw[0] =
702410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
702510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
702610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
702710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
702810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
702910e230b6Smaya
703010e230b6Smaya   dw[1] =
703110e230b6Smaya      __gen_uint(values->VertexElement00Enables, 0, 3) |
703210e230b6Smaya      __gen_uint(values->VertexElement01Enables, 4, 7) |
703310e230b6Smaya      __gen_uint(values->VertexElement02Enables, 8, 11) |
703410e230b6Smaya      __gen_uint(values->VertexElement03Enables, 12, 15) |
703510e230b6Smaya      __gen_uint(values->VertexElement04Enables, 16, 19) |
703610e230b6Smaya      __gen_uint(values->VertexElement05Enables, 20, 23) |
703710e230b6Smaya      __gen_uint(values->VertexElement06Enables, 24, 27) |
703810e230b6Smaya      __gen_uint(values->VertexElement07Enables, 28, 31);
703910e230b6Smaya
704010e230b6Smaya   dw[2] =
704110e230b6Smaya      __gen_uint(values->VertexElement08Enables, 0, 3) |
704210e230b6Smaya      __gen_uint(values->VertexElement09Enables, 4, 7) |
704310e230b6Smaya      __gen_uint(values->VertexElement10Enables, 8, 11) |
704410e230b6Smaya      __gen_uint(values->VertexElement11Enables, 12, 15) |
704510e230b6Smaya      __gen_uint(values->VertexElement12Enables, 16, 19) |
704610e230b6Smaya      __gen_uint(values->VertexElement13Enables, 20, 23) |
704710e230b6Smaya      __gen_uint(values->VertexElement14Enables, 24, 27) |
704810e230b6Smaya      __gen_uint(values->VertexElement15Enables, 28, 31);
704910e230b6Smaya
705010e230b6Smaya   dw[3] =
705110e230b6Smaya      __gen_uint(values->VertexElement16Enables, 0, 3) |
705210e230b6Smaya      __gen_uint(values->VertexElement17Enables, 4, 7) |
705310e230b6Smaya      __gen_uint(values->VertexElement18Enables, 8, 11) |
705410e230b6Smaya      __gen_uint(values->VertexElement19Enables, 12, 15) |
705510e230b6Smaya      __gen_uint(values->VertexElement20Enables, 16, 19) |
705610e230b6Smaya      __gen_uint(values->VertexElement21Enables, 20, 23) |
705710e230b6Smaya      __gen_uint(values->VertexElement22Enables, 24, 27) |
705810e230b6Smaya      __gen_uint(values->VertexElement23Enables, 28, 31);
705910e230b6Smaya
706010e230b6Smaya   dw[4] =
706110e230b6Smaya      __gen_uint(values->VertexElement24Enables, 0, 3) |
706210e230b6Smaya      __gen_uint(values->VertexElement25Enables, 4, 7) |
706310e230b6Smaya      __gen_uint(values->VertexElement26Enables, 8, 11) |
706410e230b6Smaya      __gen_uint(values->VertexElement27Enables, 12, 15) |
706510e230b6Smaya      __gen_uint(values->VertexElement28Enables, 16, 19) |
706610e230b6Smaya      __gen_uint(values->VertexElement29Enables, 20, 23) |
706710e230b6Smaya      __gen_uint(values->VertexElement30Enables, 24, 27) |
706810e230b6Smaya      __gen_uint(values->VertexElement31Enables, 28, 31);
706910e230b6Smaya}
707010e230b6Smaya
707196c5ddc4Srjs#define GFX9_3DSTATE_VF_INSTANCING_length      3
707296c5ddc4Srjs#define GFX9_3DSTATE_VF_INSTANCING_length_bias      2
707396c5ddc4Srjs#define GFX9_3DSTATE_VF_INSTANCING_header       \
707410e230b6Smaya   .DWordLength                         =      1,  \
707510e230b6Smaya   ._3DCommandSubOpcode                 =     73,  \
707610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
707710e230b6Smaya   .CommandSubType                      =      3,  \
707810e230b6Smaya   .CommandType                         =      3
707910e230b6Smaya
708096c5ddc4Srjsstruct GFX9_3DSTATE_VF_INSTANCING {
708110e230b6Smaya   uint32_t                             DWordLength;
708210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
708310e230b6Smaya   uint32_t                             _3DCommandOpcode;
708410e230b6Smaya   uint32_t                             CommandSubType;
708510e230b6Smaya   uint32_t                             CommandType;
708610e230b6Smaya   uint32_t                             VertexElementIndex;
708710e230b6Smaya   bool                                 InstancingEnable;
708810e230b6Smaya   uint32_t                             InstanceDataStepRate;
708910e230b6Smaya};
709010e230b6Smaya
709196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
709296c5ddc4SrjsGFX9_3DSTATE_VF_INSTANCING_pack(__attribute__((unused)) __gen_user_data *data,
709310e230b6Smaya                                __attribute__((unused)) void * restrict dst,
709496c5ddc4Srjs                                __attribute__((unused)) const struct GFX9_3DSTATE_VF_INSTANCING * restrict values)
709510e230b6Smaya{
709610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
709710e230b6Smaya
709810e230b6Smaya   dw[0] =
709910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
710010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
710110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
710210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
710310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
710410e230b6Smaya
710510e230b6Smaya   dw[1] =
710610e230b6Smaya      __gen_uint(values->VertexElementIndex, 0, 5) |
710710e230b6Smaya      __gen_uint(values->InstancingEnable, 8, 8);
710810e230b6Smaya
710910e230b6Smaya   dw[2] =
711010e230b6Smaya      __gen_uint(values->InstanceDataStepRate, 0, 31);
711110e230b6Smaya}
711210e230b6Smaya
711396c5ddc4Srjs#define GFX9_3DSTATE_VF_SGVS_length            2
711496c5ddc4Srjs#define GFX9_3DSTATE_VF_SGVS_length_bias       2
711596c5ddc4Srjs#define GFX9_3DSTATE_VF_SGVS_header             \
711610e230b6Smaya   .DWordLength                         =      0,  \
711710e230b6Smaya   ._3DCommandSubOpcode                 =     74,  \
711810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
711910e230b6Smaya   .CommandSubType                      =      3,  \
712010e230b6Smaya   .CommandType                         =      3
712110e230b6Smaya
712296c5ddc4Srjsstruct GFX9_3DSTATE_VF_SGVS {
712310e230b6Smaya   uint32_t                             DWordLength;
712410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
712510e230b6Smaya   uint32_t                             _3DCommandOpcode;
712610e230b6Smaya   uint32_t                             CommandSubType;
712710e230b6Smaya   uint32_t                             CommandType;
712810e230b6Smaya   uint32_t                             VertexIDElementOffset;
712910e230b6Smaya   uint32_t                             VertexIDComponentNumber;
713010e230b6Smaya#define COMP_0                                   0
713110e230b6Smaya#define COMP_1                                   1
713210e230b6Smaya#define COMP_2                                   2
713310e230b6Smaya#define COMP_3                                   3
713410e230b6Smaya   bool                                 VertexIDEnable;
713510e230b6Smaya   uint32_t                             InstanceIDElementOffset;
713610e230b6Smaya   uint32_t                             InstanceIDComponentNumber;
713710e230b6Smaya#define COMP_0                                   0
713810e230b6Smaya#define COMP_1                                   1
713910e230b6Smaya#define COMP_2                                   2
714010e230b6Smaya#define COMP_3                                   3
714110e230b6Smaya   bool                                 InstanceIDEnable;
714210e230b6Smaya};
714310e230b6Smaya
714496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
714596c5ddc4SrjsGFX9_3DSTATE_VF_SGVS_pack(__attribute__((unused)) __gen_user_data *data,
714610e230b6Smaya                          __attribute__((unused)) void * restrict dst,
714796c5ddc4Srjs                          __attribute__((unused)) const struct GFX9_3DSTATE_VF_SGVS * restrict values)
714810e230b6Smaya{
714910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
715010e230b6Smaya
715110e230b6Smaya   dw[0] =
715210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
715310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
715410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
715510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
715610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
715710e230b6Smaya
715810e230b6Smaya   dw[1] =
715910e230b6Smaya      __gen_uint(values->VertexIDElementOffset, 0, 5) |
716010e230b6Smaya      __gen_uint(values->VertexIDComponentNumber, 13, 14) |
716110e230b6Smaya      __gen_uint(values->VertexIDEnable, 15, 15) |
716210e230b6Smaya      __gen_uint(values->InstanceIDElementOffset, 16, 21) |
716310e230b6Smaya      __gen_uint(values->InstanceIDComponentNumber, 29, 30) |
716410e230b6Smaya      __gen_uint(values->InstanceIDEnable, 31, 31);
716510e230b6Smaya}
716610e230b6Smaya
716796c5ddc4Srjs#define GFX9_3DSTATE_VF_STATISTICS_length      1
716896c5ddc4Srjs#define GFX9_3DSTATE_VF_STATISTICS_length_bias      1
716996c5ddc4Srjs#define GFX9_3DSTATE_VF_STATISTICS_header       \
717010e230b6Smaya   ._3DCommandSubOpcode                 =     11,  \
717110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
717210e230b6Smaya   .CommandSubType                      =      1,  \
717310e230b6Smaya   .CommandType                         =      3
717410e230b6Smaya
717596c5ddc4Srjsstruct GFX9_3DSTATE_VF_STATISTICS {
717610e230b6Smaya   bool                                 StatisticsEnable;
717710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
717810e230b6Smaya   uint32_t                             _3DCommandOpcode;
717910e230b6Smaya   uint32_t                             CommandSubType;
718010e230b6Smaya   uint32_t                             CommandType;
718110e230b6Smaya};
718210e230b6Smaya
718396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
718496c5ddc4SrjsGFX9_3DSTATE_VF_STATISTICS_pack(__attribute__((unused)) __gen_user_data *data,
718510e230b6Smaya                                __attribute__((unused)) void * restrict dst,
718696c5ddc4Srjs                                __attribute__((unused)) const struct GFX9_3DSTATE_VF_STATISTICS * restrict values)
718710e230b6Smaya{
718810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
718910e230b6Smaya
719010e230b6Smaya   dw[0] =
719110e230b6Smaya      __gen_uint(values->StatisticsEnable, 0, 0) |
719210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
719310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
719410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
719510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
719610e230b6Smaya}
719710e230b6Smaya
719896c5ddc4Srjs#define GFX9_3DSTATE_VF_TOPOLOGY_length        2
719996c5ddc4Srjs#define GFX9_3DSTATE_VF_TOPOLOGY_length_bias      2
720096c5ddc4Srjs#define GFX9_3DSTATE_VF_TOPOLOGY_header         \
720110e230b6Smaya   .DWordLength                         =      0,  \
720210e230b6Smaya   ._3DCommandSubOpcode                 =     75,  \
720310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
720410e230b6Smaya   .CommandSubType                      =      3,  \
720510e230b6Smaya   .CommandType                         =      3
720610e230b6Smaya
720796c5ddc4Srjsstruct GFX9_3DSTATE_VF_TOPOLOGY {
720810e230b6Smaya   uint32_t                             DWordLength;
720910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
721010e230b6Smaya   uint32_t                             _3DCommandOpcode;
721110e230b6Smaya   uint32_t                             CommandSubType;
721210e230b6Smaya   uint32_t                             CommandType;
721396c5ddc4Srjs   enum GFX9_3D_Prim_Topo_Type          PrimitiveTopologyType;
721410e230b6Smaya};
721510e230b6Smaya
721696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
721796c5ddc4SrjsGFX9_3DSTATE_VF_TOPOLOGY_pack(__attribute__((unused)) __gen_user_data *data,
721810e230b6Smaya                              __attribute__((unused)) void * restrict dst,
721996c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_3DSTATE_VF_TOPOLOGY * restrict values)
722010e230b6Smaya{
722110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
722210e230b6Smaya
722310e230b6Smaya   dw[0] =
722410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
722510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
722610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
722710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
722810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
722910e230b6Smaya
723010e230b6Smaya   dw[1] =
723110e230b6Smaya      __gen_uint(values->PrimitiveTopologyType, 0, 5);
723210e230b6Smaya}
723310e230b6Smaya
723496c5ddc4Srjs#define GFX9_3DSTATE_VIEWPORT_STATE_POINTERS_CC_length      2
723596c5ddc4Srjs#define GFX9_3DSTATE_VIEWPORT_STATE_POINTERS_CC_length_bias      2
723696c5ddc4Srjs#define GFX9_3DSTATE_VIEWPORT_STATE_POINTERS_CC_header\
723710e230b6Smaya   .DWordLength                         =      0,  \
723810e230b6Smaya   ._3DCommandSubOpcode                 =     35,  \
723910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
724010e230b6Smaya   .CommandSubType                      =      3,  \
724110e230b6Smaya   .CommandType                         =      3
724210e230b6Smaya
724396c5ddc4Srjsstruct GFX9_3DSTATE_VIEWPORT_STATE_POINTERS_CC {
724410e230b6Smaya   uint32_t                             DWordLength;
724510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
724610e230b6Smaya   uint32_t                             _3DCommandOpcode;
724710e230b6Smaya   uint32_t                             CommandSubType;
724810e230b6Smaya   uint32_t                             CommandType;
724910e230b6Smaya   uint64_t                             CCViewportPointer;
725010e230b6Smaya};
725110e230b6Smaya
725296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
725396c5ddc4SrjsGFX9_3DSTATE_VIEWPORT_STATE_POINTERS_CC_pack(__attribute__((unused)) __gen_user_data *data,
725410e230b6Smaya                                             __attribute__((unused)) void * restrict dst,
725596c5ddc4Srjs                                             __attribute__((unused)) const struct GFX9_3DSTATE_VIEWPORT_STATE_POINTERS_CC * restrict values)
725610e230b6Smaya{
725710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
725810e230b6Smaya
725910e230b6Smaya   dw[0] =
726010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
726110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
726210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
726310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
726410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
726510e230b6Smaya
726610e230b6Smaya   dw[1] =
726710e230b6Smaya      __gen_offset(values->CCViewportPointer, 5, 31);
726810e230b6Smaya}
726910e230b6Smaya
727096c5ddc4Srjs#define GFX9_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_length      2
727196c5ddc4Srjs#define GFX9_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_length_bias      2
727296c5ddc4Srjs#define GFX9_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_header\
727310e230b6Smaya   .DWordLength                         =      0,  \
727410e230b6Smaya   ._3DCommandSubOpcode                 =     33,  \
727510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
727610e230b6Smaya   .CommandSubType                      =      3,  \
727710e230b6Smaya   .CommandType                         =      3
727810e230b6Smaya
727996c5ddc4Srjsstruct GFX9_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP {
728010e230b6Smaya   uint32_t                             DWordLength;
728110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
728210e230b6Smaya   uint32_t                             _3DCommandOpcode;
728310e230b6Smaya   uint32_t                             CommandSubType;
728410e230b6Smaya   uint32_t                             CommandType;
728510e230b6Smaya   uint64_t                             SFClipViewportPointer;
728610e230b6Smaya};
728710e230b6Smaya
728896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
728996c5ddc4SrjsGFX9_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
729010e230b6Smaya                                                  __attribute__((unused)) void * restrict dst,
729196c5ddc4Srjs                                                  __attribute__((unused)) const struct GFX9_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP * restrict values)
729210e230b6Smaya{
729310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
729410e230b6Smaya
729510e230b6Smaya   dw[0] =
729610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
729710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
729810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
729910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
730010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
730110e230b6Smaya
730210e230b6Smaya   dw[1] =
730310e230b6Smaya      __gen_offset(values->SFClipViewportPointer, 6, 31);
730410e230b6Smaya}
730510e230b6Smaya
730696c5ddc4Srjs#define GFX9_3DSTATE_VS_length                 9
730796c5ddc4Srjs#define GFX9_3DSTATE_VS_length_bias            2
730896c5ddc4Srjs#define GFX9_3DSTATE_VS_header                  \
730910e230b6Smaya   .DWordLength                         =      7,  \
731010e230b6Smaya   ._3DCommandSubOpcode                 =     16,  \
731110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
731210e230b6Smaya   .CommandSubType                      =      3,  \
731310e230b6Smaya   .CommandType                         =      3
731410e230b6Smaya
731596c5ddc4Srjsstruct GFX9_3DSTATE_VS {
731610e230b6Smaya   uint32_t                             DWordLength;
731710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
731810e230b6Smaya   uint32_t                             _3DCommandOpcode;
731910e230b6Smaya   uint32_t                             CommandSubType;
732010e230b6Smaya   uint32_t                             CommandType;
732110e230b6Smaya   uint64_t                             KernelStartPointer;
732210e230b6Smaya   bool                                 SoftwareExceptionEnable;
732310e230b6Smaya   bool                                 AccessesUAV;
732410e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
732510e230b6Smaya   uint32_t                             FloatingPointMode;
732610e230b6Smaya#define IEEE754                                  0
732710e230b6Smaya#define Alternate                                1
732810e230b6Smaya   uint32_t                             ThreadDispatchPriority;
732910e230b6Smaya#define High                                     1
733010e230b6Smaya   uint32_t                             BindingTableEntryCount;
733110e230b6Smaya   uint32_t                             SamplerCount;
733210e230b6Smaya#define NoSamplers                               0
733310e230b6Smaya#define _14Samplers                              1
733410e230b6Smaya#define _58Samplers                              2
733510e230b6Smaya#define _912Samplers                             3
733610e230b6Smaya#define _1316Samplers                            4
733710e230b6Smaya   bool                                 VectorMaskEnable;
733810e230b6Smaya   bool                                 SingleVertexDispatch;
733910e230b6Smaya   uint32_t                             PerThreadScratchSpace;
734010e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
734110e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
734210e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
734310e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData;
734410e230b6Smaya   bool                                 Enable;
734510e230b6Smaya   bool                                 VertexCacheDisable;
734610e230b6Smaya   bool                                 SIMD8DispatchEnable;
734710e230b6Smaya   bool                                 StatisticsEnable;
734810e230b6Smaya   uint32_t                             MaximumNumberofThreads;
734910e230b6Smaya   uint32_t                             UserClipDistanceCullTestEnableBitmask;
735010e230b6Smaya   uint32_t                             UserClipDistanceClipTestEnableBitmask;
735110e230b6Smaya   uint32_t                             VertexURBEntryOutputLength;
735210e230b6Smaya   uint32_t                             VertexURBEntryOutputReadOffset;
735310e230b6Smaya};
735410e230b6Smaya
735596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
735696c5ddc4SrjsGFX9_3DSTATE_VS_pack(__attribute__((unused)) __gen_user_data *data,
735710e230b6Smaya                     __attribute__((unused)) void * restrict dst,
735896c5ddc4Srjs                     __attribute__((unused)) const struct GFX9_3DSTATE_VS * restrict values)
735910e230b6Smaya{
736010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
736110e230b6Smaya
736210e230b6Smaya   dw[0] =
736310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
736410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
736510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
736610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
736710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
736810e230b6Smaya
736910e230b6Smaya   const uint64_t v1 =
737010e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 63);
737110e230b6Smaya   dw[1] = v1;
737210e230b6Smaya   dw[2] = v1 >> 32;
737310e230b6Smaya
737410e230b6Smaya   dw[3] =
737510e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
737610e230b6Smaya      __gen_uint(values->AccessesUAV, 12, 12) |
737710e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
737810e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
737910e230b6Smaya      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
738010e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
738110e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
738210e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
738310e230b6Smaya      __gen_uint(values->SingleVertexDispatch, 31, 31);
738410e230b6Smaya
738510e230b6Smaya   const uint64_t v4 =
738610e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
738710e230b6Smaya   const uint64_t v4_address =
738896c5ddc4Srjs      __gen_address(data, &dw[4], values->ScratchSpaceBasePointer, v4, 10, 63);
738910e230b6Smaya   dw[4] = v4_address;
739010e230b6Smaya   dw[5] = (v4_address >> 32) | (v4 >> 32);
739110e230b6Smaya
739210e230b6Smaya   dw[6] =
739310e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
739410e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
739510e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
739610e230b6Smaya
739710e230b6Smaya   dw[7] =
739810e230b6Smaya      __gen_uint(values->Enable, 0, 0) |
739910e230b6Smaya      __gen_uint(values->VertexCacheDisable, 1, 1) |
740010e230b6Smaya      __gen_uint(values->SIMD8DispatchEnable, 2, 2) |
740110e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
740210e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 23, 31);
740310e230b6Smaya
740410e230b6Smaya   dw[8] =
740510e230b6Smaya      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
740610e230b6Smaya      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 8, 15) |
740710e230b6Smaya      __gen_uint(values->VertexURBEntryOutputLength, 16, 20) |
740810e230b6Smaya      __gen_uint(values->VertexURBEntryOutputReadOffset, 21, 26);
740910e230b6Smaya}
741010e230b6Smaya
741196c5ddc4Srjs#define GFX9_3DSTATE_WM_length                 2
741296c5ddc4Srjs#define GFX9_3DSTATE_WM_length_bias            2
741396c5ddc4Srjs#define GFX9_3DSTATE_WM_header                  \
741410e230b6Smaya   .DWordLength                         =      0,  \
741510e230b6Smaya   ._3DCommandSubOpcode                 =     20,  \
741610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
741710e230b6Smaya   .CommandSubType                      =      3,  \
741810e230b6Smaya   .CommandType                         =      3
741910e230b6Smaya
742096c5ddc4Srjsstruct GFX9_3DSTATE_WM {
742110e230b6Smaya   uint32_t                             DWordLength;
742210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
742310e230b6Smaya   uint32_t                             _3DCommandOpcode;
742410e230b6Smaya   uint32_t                             CommandSubType;
742510e230b6Smaya   uint32_t                             CommandType;
742610e230b6Smaya   uint32_t                             ForceKillPixelEnable;
742710e230b6Smaya#define ForceOff                                 1
742810e230b6Smaya#define ForceON                                  2
742910e230b6Smaya   uint32_t                             PointRasterizationRule;
743010e230b6Smaya#define RASTRULE_UPPER_LEFT                      0
743110e230b6Smaya#define RASTRULE_UPPER_RIGHT                     1
743210e230b6Smaya   bool                                 LineStippleEnable;
743310e230b6Smaya   bool                                 PolygonStippleEnable;
743410e230b6Smaya   uint32_t                             LineAntialiasingRegionWidth;
743510e230b6Smaya#define _05pixels                                0
743610e230b6Smaya#define _10pixels                                1
743710e230b6Smaya#define _20pixels                                2
743810e230b6Smaya#define _40pixels                                3
743910e230b6Smaya   uint32_t                             LineEndCapAntialiasingRegionWidth;
744010e230b6Smaya#define _05pixels                                0
744110e230b6Smaya#define _10pixels                                1
744210e230b6Smaya#define _20pixels                                2
744310e230b6Smaya#define _40pixels                                3
744410e230b6Smaya   uint32_t                             BarycentricInterpolationMode;
744510e230b6Smaya#define BIM_PERSPECTIVE_PIXEL                    1
744610e230b6Smaya#define BIM_PERSPECTIVE_CENTROID                 2
744710e230b6Smaya#define BIM_PERSPECTIVE_SAMPLE                   4
744810e230b6Smaya#define BIM_LINEAR_PIXEL                         8
744910e230b6Smaya#define BIM_LINEAR_CENTROID                      16
745010e230b6Smaya#define BIM_LINEAR_SAMPLE                        32
745110e230b6Smaya   uint32_t                             PositionZWInterpolationMode;
745210e230b6Smaya#define INTERP_PIXEL                             0
745310e230b6Smaya#define INTERP_CENTROID                          2
745410e230b6Smaya#define INTERP_SAMPLE                            3
745510e230b6Smaya   uint32_t                             ForceThreadDispatchEnable;
745610e230b6Smaya#define ForceOff                                 1
745710e230b6Smaya#define ForceON                                  2
745810e230b6Smaya   uint32_t                             EarlyDepthStencilControl;
745910e230b6Smaya#define EDSC_NORMAL                              0
746010e230b6Smaya#define EDSC_PSEXEC                              1
746110e230b6Smaya#define EDSC_PREPS                               2
746210e230b6Smaya   bool                                 LegacyDiamondLineRasterization;
746310e230b6Smaya   bool                                 LegacyHierarchicalDepthBufferResolveEnable;
746410e230b6Smaya   bool                                 LegacyDepthBufferResolveEnable;
746510e230b6Smaya   bool                                 LegacyDepthBufferClearEnable;
746610e230b6Smaya   bool                                 StatisticsEnable;
746710e230b6Smaya};
746810e230b6Smaya
746996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
747096c5ddc4SrjsGFX9_3DSTATE_WM_pack(__attribute__((unused)) __gen_user_data *data,
747110e230b6Smaya                     __attribute__((unused)) void * restrict dst,
747296c5ddc4Srjs                     __attribute__((unused)) const struct GFX9_3DSTATE_WM * restrict values)
747310e230b6Smaya{
747410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
747510e230b6Smaya
747610e230b6Smaya   dw[0] =
747710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
747810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
747910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
748010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
748110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
748210e230b6Smaya
748310e230b6Smaya   dw[1] =
748410e230b6Smaya      __gen_uint(values->ForceKillPixelEnable, 0, 1) |
748510e230b6Smaya      __gen_uint(values->PointRasterizationRule, 2, 2) |
748610e230b6Smaya      __gen_uint(values->LineStippleEnable, 3, 3) |
748710e230b6Smaya      __gen_uint(values->PolygonStippleEnable, 4, 4) |
748810e230b6Smaya      __gen_uint(values->LineAntialiasingRegionWidth, 6, 7) |
748910e230b6Smaya      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 8, 9) |
749010e230b6Smaya      __gen_uint(values->BarycentricInterpolationMode, 11, 16) |
749110e230b6Smaya      __gen_uint(values->PositionZWInterpolationMode, 17, 18) |
749210e230b6Smaya      __gen_uint(values->ForceThreadDispatchEnable, 19, 20) |
749310e230b6Smaya      __gen_uint(values->EarlyDepthStencilControl, 21, 22) |
749410e230b6Smaya      __gen_uint(values->LegacyDiamondLineRasterization, 26, 26) |
749510e230b6Smaya      __gen_uint(values->LegacyHierarchicalDepthBufferResolveEnable, 27, 27) |
749610e230b6Smaya      __gen_uint(values->LegacyDepthBufferResolveEnable, 28, 28) |
749710e230b6Smaya      __gen_uint(values->LegacyDepthBufferClearEnable, 30, 30) |
749810e230b6Smaya      __gen_uint(values->StatisticsEnable, 31, 31);
749910e230b6Smaya}
750010e230b6Smaya
750196c5ddc4Srjs#define GFX9_3DSTATE_WM_CHROMAKEY_length       2
750296c5ddc4Srjs#define GFX9_3DSTATE_WM_CHROMAKEY_length_bias      2
750396c5ddc4Srjs#define GFX9_3DSTATE_WM_CHROMAKEY_header        \
750410e230b6Smaya   .DWordLength                         =      0,  \
750510e230b6Smaya   ._3DCommandSubOpcode                 =     76,  \
750610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
750710e230b6Smaya   .CommandSubType                      =      3,  \
750810e230b6Smaya   .CommandType                         =      3
750910e230b6Smaya
751096c5ddc4Srjsstruct GFX9_3DSTATE_WM_CHROMAKEY {
751110e230b6Smaya   uint32_t                             DWordLength;
751210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
751310e230b6Smaya   uint32_t                             _3DCommandOpcode;
751410e230b6Smaya   uint32_t                             CommandSubType;
751510e230b6Smaya   uint32_t                             CommandType;
751610e230b6Smaya   bool                                 ChromaKeyKillEnable;
751710e230b6Smaya};
751810e230b6Smaya
751996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
752096c5ddc4SrjsGFX9_3DSTATE_WM_CHROMAKEY_pack(__attribute__((unused)) __gen_user_data *data,
752110e230b6Smaya                               __attribute__((unused)) void * restrict dst,
752296c5ddc4Srjs                               __attribute__((unused)) const struct GFX9_3DSTATE_WM_CHROMAKEY * restrict values)
752310e230b6Smaya{
752410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
752510e230b6Smaya
752610e230b6Smaya   dw[0] =
752710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
752810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
752910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
753010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
753110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
753210e230b6Smaya
753310e230b6Smaya   dw[1] =
753410e230b6Smaya      __gen_uint(values->ChromaKeyKillEnable, 31, 31);
753510e230b6Smaya}
753610e230b6Smaya
753796c5ddc4Srjs#define GFX9_3DSTATE_WM_DEPTH_STENCIL_length      4
753896c5ddc4Srjs#define GFX9_3DSTATE_WM_DEPTH_STENCIL_length_bias      2
753996c5ddc4Srjs#define GFX9_3DSTATE_WM_DEPTH_STENCIL_header    \
754010e230b6Smaya   .DWordLength                         =      2,  \
754110e230b6Smaya   ._3DCommandSubOpcode                 =     78,  \
754210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
754310e230b6Smaya   .CommandSubType                      =      3,  \
754410e230b6Smaya   .CommandType                         =      3
754510e230b6Smaya
754696c5ddc4Srjsstruct GFX9_3DSTATE_WM_DEPTH_STENCIL {
754710e230b6Smaya   uint32_t                             DWordLength;
754810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
754910e230b6Smaya   uint32_t                             _3DCommandOpcode;
755010e230b6Smaya   uint32_t                             CommandSubType;
755110e230b6Smaya   uint32_t                             CommandType;
755210e230b6Smaya   bool                                 DepthBufferWriteEnable;
755310e230b6Smaya   bool                                 DepthTestEnable;
755410e230b6Smaya   bool                                 StencilBufferWriteEnable;
755510e230b6Smaya   bool                                 StencilTestEnable;
755610e230b6Smaya   bool                                 DoubleSidedStencilEnable;
755796c5ddc4Srjs   enum GFX9_3D_Compare_Function        DepthTestFunction;
755896c5ddc4Srjs   enum GFX9_3D_Compare_Function        StencilTestFunction;
755996c5ddc4Srjs   enum GFX9_3D_Stencil_Operation       BackfaceStencilPassDepthPassOp;
756096c5ddc4Srjs   enum GFX9_3D_Stencil_Operation       BackfaceStencilPassDepthFailOp;
756196c5ddc4Srjs   enum GFX9_3D_Stencil_Operation       BackfaceStencilFailOp;
756296c5ddc4Srjs   enum GFX9_3D_Compare_Function        BackfaceStencilTestFunction;
756396c5ddc4Srjs   enum GFX9_3D_Stencil_Operation       StencilPassDepthPassOp;
756496c5ddc4Srjs   enum GFX9_3D_Stencil_Operation       StencilPassDepthFailOp;
756596c5ddc4Srjs   enum GFX9_3D_Stencil_Operation       StencilFailOp;
756610e230b6Smaya   uint32_t                             BackfaceStencilWriteMask;
756710e230b6Smaya   uint32_t                             BackfaceStencilTestMask;
756810e230b6Smaya   uint32_t                             StencilWriteMask;
756910e230b6Smaya   uint32_t                             StencilTestMask;
757010e230b6Smaya   uint32_t                             BackfaceStencilReferenceValue;
757110e230b6Smaya   uint32_t                             StencilReferenceValue;
757210e230b6Smaya};
757310e230b6Smaya
757496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
757596c5ddc4SrjsGFX9_3DSTATE_WM_DEPTH_STENCIL_pack(__attribute__((unused)) __gen_user_data *data,
757610e230b6Smaya                                   __attribute__((unused)) void * restrict dst,
757796c5ddc4Srjs                                   __attribute__((unused)) const struct GFX9_3DSTATE_WM_DEPTH_STENCIL * restrict values)
757810e230b6Smaya{
757910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
758010e230b6Smaya
758110e230b6Smaya   dw[0] =
758210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
758310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
758410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
758510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
758610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
758710e230b6Smaya
758810e230b6Smaya   dw[1] =
758910e230b6Smaya      __gen_uint(values->DepthBufferWriteEnable, 0, 0) |
759010e230b6Smaya      __gen_uint(values->DepthTestEnable, 1, 1) |
759110e230b6Smaya      __gen_uint(values->StencilBufferWriteEnable, 2, 2) |
759210e230b6Smaya      __gen_uint(values->StencilTestEnable, 3, 3) |
759310e230b6Smaya      __gen_uint(values->DoubleSidedStencilEnable, 4, 4) |
759410e230b6Smaya      __gen_uint(values->DepthTestFunction, 5, 7) |
759510e230b6Smaya      __gen_uint(values->StencilTestFunction, 8, 10) |
759610e230b6Smaya      __gen_uint(values->BackfaceStencilPassDepthPassOp, 11, 13) |
759710e230b6Smaya      __gen_uint(values->BackfaceStencilPassDepthFailOp, 14, 16) |
759810e230b6Smaya      __gen_uint(values->BackfaceStencilFailOp, 17, 19) |
759910e230b6Smaya      __gen_uint(values->BackfaceStencilTestFunction, 20, 22) |
760010e230b6Smaya      __gen_uint(values->StencilPassDepthPassOp, 23, 25) |
760110e230b6Smaya      __gen_uint(values->StencilPassDepthFailOp, 26, 28) |
760210e230b6Smaya      __gen_uint(values->StencilFailOp, 29, 31);
760310e230b6Smaya
760410e230b6Smaya   dw[2] =
760510e230b6Smaya      __gen_uint(values->BackfaceStencilWriteMask, 0, 7) |
760610e230b6Smaya      __gen_uint(values->BackfaceStencilTestMask, 8, 15) |
760710e230b6Smaya      __gen_uint(values->StencilWriteMask, 16, 23) |
760810e230b6Smaya      __gen_uint(values->StencilTestMask, 24, 31);
760910e230b6Smaya
761010e230b6Smaya   dw[3] =
761110e230b6Smaya      __gen_uint(values->BackfaceStencilReferenceValue, 0, 7) |
761210e230b6Smaya      __gen_uint(values->StencilReferenceValue, 8, 15);
761310e230b6Smaya}
761410e230b6Smaya
761596c5ddc4Srjs#define GFX9_3DSTATE_WM_HZ_OP_length           5
761696c5ddc4Srjs#define GFX9_3DSTATE_WM_HZ_OP_length_bias      2
761796c5ddc4Srjs#define GFX9_3DSTATE_WM_HZ_OP_header            \
761810e230b6Smaya   .DWordLength                         =      3,  \
761910e230b6Smaya   ._3DCommandSubOpcode                 =     82,  \
762010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
762110e230b6Smaya   .CommandSubType                      =      3,  \
762210e230b6Smaya   .CommandType                         =      3
762310e230b6Smaya
762496c5ddc4Srjsstruct GFX9_3DSTATE_WM_HZ_OP {
762510e230b6Smaya   uint32_t                             DWordLength;
762610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
762710e230b6Smaya   uint32_t                             _3DCommandOpcode;
762810e230b6Smaya   uint32_t                             CommandSubType;
762910e230b6Smaya   uint32_t                             CommandType;
763010e230b6Smaya   uint32_t                             NumberofMultisamples;
763110e230b6Smaya   uint32_t                             StencilClearValue;
763210e230b6Smaya   bool                                 FullSurfaceDepthandStencilClear;
763310e230b6Smaya   bool                                 PixelPositionOffsetEnable;
763410e230b6Smaya   bool                                 HierarchicalDepthBufferResolveEnable;
763510e230b6Smaya   bool                                 DepthBufferResolveEnable;
763610e230b6Smaya   bool                                 ScissorRectangleEnable;
763710e230b6Smaya   bool                                 DepthBufferClearEnable;
763810e230b6Smaya   bool                                 StencilBufferClearEnable;
763910e230b6Smaya   uint32_t                             ClearRectangleXMin;
764010e230b6Smaya   uint32_t                             ClearRectangleYMin;
764110e230b6Smaya   uint32_t                             ClearRectangleXMax;
764210e230b6Smaya   uint32_t                             ClearRectangleYMax;
764310e230b6Smaya   uint32_t                             SampleMask;
764410e230b6Smaya};
764510e230b6Smaya
764696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
764796c5ddc4SrjsGFX9_3DSTATE_WM_HZ_OP_pack(__attribute__((unused)) __gen_user_data *data,
764810e230b6Smaya                           __attribute__((unused)) void * restrict dst,
764996c5ddc4Srjs                           __attribute__((unused)) const struct GFX9_3DSTATE_WM_HZ_OP * restrict values)
765010e230b6Smaya{
765110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
765210e230b6Smaya
765310e230b6Smaya   dw[0] =
765410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
765510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
765610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
765710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
765810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
765910e230b6Smaya
766010e230b6Smaya   dw[1] =
766110e230b6Smaya      __gen_uint(values->NumberofMultisamples, 13, 15) |
766210e230b6Smaya      __gen_uint(values->StencilClearValue, 16, 23) |
766310e230b6Smaya      __gen_uint(values->FullSurfaceDepthandStencilClear, 25, 25) |
766410e230b6Smaya      __gen_uint(values->PixelPositionOffsetEnable, 26, 26) |
766510e230b6Smaya      __gen_uint(values->HierarchicalDepthBufferResolveEnable, 27, 27) |
766610e230b6Smaya      __gen_uint(values->DepthBufferResolveEnable, 28, 28) |
766710e230b6Smaya      __gen_uint(values->ScissorRectangleEnable, 29, 29) |
766810e230b6Smaya      __gen_uint(values->DepthBufferClearEnable, 30, 30) |
766910e230b6Smaya      __gen_uint(values->StencilBufferClearEnable, 31, 31);
767010e230b6Smaya
767110e230b6Smaya   dw[2] =
767210e230b6Smaya      __gen_uint(values->ClearRectangleXMin, 0, 15) |
767310e230b6Smaya      __gen_uint(values->ClearRectangleYMin, 16, 31);
767410e230b6Smaya
767510e230b6Smaya   dw[3] =
767610e230b6Smaya      __gen_uint(values->ClearRectangleXMax, 0, 15) |
767710e230b6Smaya      __gen_uint(values->ClearRectangleYMax, 16, 31);
767810e230b6Smaya
767910e230b6Smaya   dw[4] =
768010e230b6Smaya      __gen_uint(values->SampleMask, 0, 15);
768110e230b6Smaya}
768210e230b6Smaya
768396c5ddc4Srjs#define GFX9_GPGPU_CSR_BASE_ADDRESS_length      3
768496c5ddc4Srjs#define GFX9_GPGPU_CSR_BASE_ADDRESS_length_bias      2
768596c5ddc4Srjs#define GFX9_GPGPU_CSR_BASE_ADDRESS_header      \
768610e230b6Smaya   .DWordLength                         =      1,  \
768710e230b6Smaya   ._3DCommandSubOpcode                 =      4,  \
768810e230b6Smaya   ._3DCommandOpcode                    =      1,  \
768910e230b6Smaya   .CommandSubType                      =      0,  \
769010e230b6Smaya   .CommandType                         =      3
769110e230b6Smaya
769296c5ddc4Srjsstruct GFX9_GPGPU_CSR_BASE_ADDRESS {
769310e230b6Smaya   uint32_t                             DWordLength;
769410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
769510e230b6Smaya   uint32_t                             _3DCommandOpcode;
769610e230b6Smaya   uint32_t                             CommandSubType;
769710e230b6Smaya   uint32_t                             CommandType;
769810e230b6Smaya   __gen_address_type                   GPGPUCSRBaseAddress;
769910e230b6Smaya};
770010e230b6Smaya
770196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
770296c5ddc4SrjsGFX9_GPGPU_CSR_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
770310e230b6Smaya                                 __attribute__((unused)) void * restrict dst,
770496c5ddc4Srjs                                 __attribute__((unused)) const struct GFX9_GPGPU_CSR_BASE_ADDRESS * restrict values)
770510e230b6Smaya{
770610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
770710e230b6Smaya
770810e230b6Smaya   dw[0] =
770910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
771010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
771110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
771210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
771310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
771410e230b6Smaya
771510e230b6Smaya   const uint64_t v1_address =
771696c5ddc4Srjs      __gen_address(data, &dw[1], values->GPGPUCSRBaseAddress, 0, 12, 63);
771710e230b6Smaya   dw[1] = v1_address;
771810e230b6Smaya   dw[2] = v1_address >> 32;
771910e230b6Smaya}
772010e230b6Smaya
772196c5ddc4Srjs#define GFX9_GPGPU_WALKER_length              15
772296c5ddc4Srjs#define GFX9_GPGPU_WALKER_length_bias          2
772396c5ddc4Srjs#define GFX9_GPGPU_WALKER_header                \
772410e230b6Smaya   .DWordLength                         =     13,  \
772510e230b6Smaya   .SubOpcode                           =      5,  \
772610e230b6Smaya   .MediaCommandOpcode                  =      1,  \
772710e230b6Smaya   .Pipeline                            =      2,  \
772810e230b6Smaya   .CommandType                         =      3
772910e230b6Smaya
773096c5ddc4Srjsstruct GFX9_GPGPU_WALKER {
773110e230b6Smaya   uint32_t                             DWordLength;
773210e230b6Smaya   bool                                 PredicateEnable;
773310e230b6Smaya   bool                                 IndirectParameterEnable;
773410e230b6Smaya   uint32_t                             SubOpcode;
773510e230b6Smaya   uint32_t                             MediaCommandOpcode;
773610e230b6Smaya   uint32_t                             Pipeline;
773710e230b6Smaya   uint32_t                             CommandType;
773810e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
773910e230b6Smaya   uint32_t                             IndirectDataLength;
774010e230b6Smaya   uint64_t                             IndirectDataStartAddress;
774110e230b6Smaya   uint32_t                             ThreadWidthCounterMaximum;
774210e230b6Smaya   uint32_t                             ThreadHeightCounterMaximum;
774310e230b6Smaya   uint32_t                             ThreadDepthCounterMaximum;
774410e230b6Smaya   uint32_t                             SIMDSize;
774510e230b6Smaya#define SIMD8                                    0
774610e230b6Smaya#define SIMD16                                   1
774710e230b6Smaya#define SIMD32                                   2
774810e230b6Smaya   uint32_t                             ThreadGroupIDStartingX;
774910e230b6Smaya   uint32_t                             ThreadGroupIDXDimension;
775010e230b6Smaya   uint32_t                             ThreadGroupIDStartingY;
775110e230b6Smaya   uint32_t                             ThreadGroupIDYDimension;
775210e230b6Smaya   uint32_t                             ThreadGroupIDStartingResumeZ;
775310e230b6Smaya   uint32_t                             ThreadGroupIDZDimension;
775410e230b6Smaya   uint32_t                             RightExecutionMask;
775510e230b6Smaya   uint32_t                             BottomExecutionMask;
775610e230b6Smaya};
775710e230b6Smaya
775896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
775996c5ddc4SrjsGFX9_GPGPU_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
776010e230b6Smaya                       __attribute__((unused)) void * restrict dst,
776196c5ddc4Srjs                       __attribute__((unused)) const struct GFX9_GPGPU_WALKER * restrict values)
776210e230b6Smaya{
776310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
776410e230b6Smaya
776510e230b6Smaya   dw[0] =
776610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
776710e230b6Smaya      __gen_uint(values->PredicateEnable, 8, 8) |
776810e230b6Smaya      __gen_uint(values->IndirectParameterEnable, 10, 10) |
776910e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
777010e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
777110e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
777210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
777310e230b6Smaya
777410e230b6Smaya   dw[1] =
777510e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
777610e230b6Smaya
777710e230b6Smaya   dw[2] =
777810e230b6Smaya      __gen_uint(values->IndirectDataLength, 0, 16);
777910e230b6Smaya
778010e230b6Smaya   dw[3] =
778110e230b6Smaya      __gen_offset(values->IndirectDataStartAddress, 6, 31);
778210e230b6Smaya
778310e230b6Smaya   dw[4] =
778410e230b6Smaya      __gen_uint(values->ThreadWidthCounterMaximum, 0, 5) |
778510e230b6Smaya      __gen_uint(values->ThreadHeightCounterMaximum, 8, 13) |
778610e230b6Smaya      __gen_uint(values->ThreadDepthCounterMaximum, 16, 21) |
778710e230b6Smaya      __gen_uint(values->SIMDSize, 30, 31);
778810e230b6Smaya
778910e230b6Smaya   dw[5] =
779010e230b6Smaya      __gen_uint(values->ThreadGroupIDStartingX, 0, 31);
779110e230b6Smaya
779210e230b6Smaya   dw[6] = 0;
779310e230b6Smaya
779410e230b6Smaya   dw[7] =
779510e230b6Smaya      __gen_uint(values->ThreadGroupIDXDimension, 0, 31);
779610e230b6Smaya
779710e230b6Smaya   dw[8] =
779810e230b6Smaya      __gen_uint(values->ThreadGroupIDStartingY, 0, 31);
779910e230b6Smaya
780010e230b6Smaya   dw[9] = 0;
780110e230b6Smaya
780210e230b6Smaya   dw[10] =
780310e230b6Smaya      __gen_uint(values->ThreadGroupIDYDimension, 0, 31);
780410e230b6Smaya
780510e230b6Smaya   dw[11] =
780610e230b6Smaya      __gen_uint(values->ThreadGroupIDStartingResumeZ, 0, 31);
780710e230b6Smaya
780810e230b6Smaya   dw[12] =
780910e230b6Smaya      __gen_uint(values->ThreadGroupIDZDimension, 0, 31);
781010e230b6Smaya
781110e230b6Smaya   dw[13] =
781210e230b6Smaya      __gen_uint(values->RightExecutionMask, 0, 31);
781310e230b6Smaya
781410e230b6Smaya   dw[14] =
781510e230b6Smaya      __gen_uint(values->BottomExecutionMask, 0, 31);
781610e230b6Smaya}
781710e230b6Smaya
781896c5ddc4Srjs#define GFX9_MEDIA_CURBE_LOAD_length           4
781996c5ddc4Srjs#define GFX9_MEDIA_CURBE_LOAD_length_bias      2
782096c5ddc4Srjs#define GFX9_MEDIA_CURBE_LOAD_header            \
782110e230b6Smaya   .DWordLength                         =      2,  \
782210e230b6Smaya   .SubOpcode                           =      1,  \
782310e230b6Smaya   .MediaCommandOpcode                  =      0,  \
782410e230b6Smaya   .Pipeline                            =      2,  \
782510e230b6Smaya   .CommandType                         =      3
782610e230b6Smaya
782796c5ddc4Srjsstruct GFX9_MEDIA_CURBE_LOAD {
782810e230b6Smaya   uint32_t                             DWordLength;
782910e230b6Smaya   uint32_t                             SubOpcode;
783010e230b6Smaya   uint32_t                             MediaCommandOpcode;
783110e230b6Smaya   uint32_t                             Pipeline;
783210e230b6Smaya   uint32_t                             CommandType;
783310e230b6Smaya   uint32_t                             CURBETotalDataLength;
783410e230b6Smaya   uint32_t                             CURBEDataStartAddress;
783510e230b6Smaya};
783610e230b6Smaya
783796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
783896c5ddc4SrjsGFX9_MEDIA_CURBE_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
783910e230b6Smaya                           __attribute__((unused)) void * restrict dst,
784096c5ddc4Srjs                           __attribute__((unused)) const struct GFX9_MEDIA_CURBE_LOAD * restrict values)
784110e230b6Smaya{
784210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
784310e230b6Smaya
784410e230b6Smaya   dw[0] =
784510e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
784610e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
784710e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
784810e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
784910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
785010e230b6Smaya
785110e230b6Smaya   dw[1] = 0;
785210e230b6Smaya
785310e230b6Smaya   dw[2] =
785410e230b6Smaya      __gen_uint(values->CURBETotalDataLength, 0, 16);
785510e230b6Smaya
785610e230b6Smaya   dw[3] =
785710e230b6Smaya      __gen_uint(values->CURBEDataStartAddress, 0, 31);
785810e230b6Smaya}
785910e230b6Smaya
786096c5ddc4Srjs#define GFX9_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length      4
786196c5ddc4Srjs#define GFX9_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length_bias      2
786296c5ddc4Srjs#define GFX9_MEDIA_INTERFACE_DESCRIPTOR_LOAD_header\
786310e230b6Smaya   .DWordLength                         =      2,  \
786410e230b6Smaya   .SubOpcode                           =      2,  \
786510e230b6Smaya   .MediaCommandOpcode                  =      0,  \
786610e230b6Smaya   .Pipeline                            =      2,  \
786710e230b6Smaya   .CommandType                         =      3
786810e230b6Smaya
786996c5ddc4Srjsstruct GFX9_MEDIA_INTERFACE_DESCRIPTOR_LOAD {
787010e230b6Smaya   uint32_t                             DWordLength;
787110e230b6Smaya   uint32_t                             SubOpcode;
787210e230b6Smaya   uint32_t                             MediaCommandOpcode;
787310e230b6Smaya   uint32_t                             Pipeline;
787410e230b6Smaya   uint32_t                             CommandType;
787510e230b6Smaya   uint32_t                             InterfaceDescriptorTotalLength;
787610e230b6Smaya   uint64_t                             InterfaceDescriptorDataStartAddress;
787710e230b6Smaya};
787810e230b6Smaya
787996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
788096c5ddc4SrjsGFX9_MEDIA_INTERFACE_DESCRIPTOR_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
788110e230b6Smaya                                          __attribute__((unused)) void * restrict dst,
788296c5ddc4Srjs                                          __attribute__((unused)) const struct GFX9_MEDIA_INTERFACE_DESCRIPTOR_LOAD * restrict values)
788310e230b6Smaya{
788410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
788510e230b6Smaya
788610e230b6Smaya   dw[0] =
788710e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
788810e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
788910e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
789010e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
789110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
789210e230b6Smaya
789310e230b6Smaya   dw[1] = 0;
789410e230b6Smaya
789510e230b6Smaya   dw[2] =
789610e230b6Smaya      __gen_uint(values->InterfaceDescriptorTotalLength, 0, 16);
789710e230b6Smaya
789810e230b6Smaya   dw[3] =
789910e230b6Smaya      __gen_offset(values->InterfaceDescriptorDataStartAddress, 0, 31);
790010e230b6Smaya}
790110e230b6Smaya
790296c5ddc4Srjs#define GFX9_MEDIA_OBJECT_length_bias          2
790396c5ddc4Srjs#define GFX9_MEDIA_OBJECT_header                \
790410e230b6Smaya   .DWordLength                         =      4,  \
790510e230b6Smaya   .MediaCommandSubOpcode               =      0,  \
790610e230b6Smaya   .MediaCommandOpcode                  =      1,  \
790710e230b6Smaya   .MediaCommandPipeline                =      2,  \
790810e230b6Smaya   .CommandType                         =      3
790910e230b6Smaya
791096c5ddc4Srjsstruct GFX9_MEDIA_OBJECT {
791110e230b6Smaya   uint32_t                             DWordLength;
791210e230b6Smaya   uint32_t                             MediaCommandSubOpcode;
791310e230b6Smaya   uint32_t                             MediaCommandOpcode;
791410e230b6Smaya   uint32_t                             MediaCommandPipeline;
791510e230b6Smaya   uint32_t                             CommandType;
791610e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
791710e230b6Smaya   uint32_t                             IndirectDataLength;
791810e230b6Smaya   uint32_t                             SubSliceDestinationSelect;
791910e230b6Smaya#define Subslice3                                3
792010e230b6Smaya#define SubSlice2                                2
792110e230b6Smaya#define SubSlice1                                1
792210e230b6Smaya#define SubSlice0                                0
792310e230b6Smaya   uint32_t                             SliceDestinationSelect;
792410e230b6Smaya#define Slice0                                   0
792510e230b6Smaya#define Slice1                                   1
792610e230b6Smaya#define Slice2                                   2
792710e230b6Smaya   uint32_t                             UseScoreboard;
792810e230b6Smaya#define Notusingscoreboard                       0
792910e230b6Smaya#define Usingscoreboard                          1
793010e230b6Smaya   uint32_t                             ForceDestination;
793110e230b6Smaya   uint32_t                             ThreadSynchronization;
793210e230b6Smaya#define Nothreadsynchronization                  0
793310e230b6Smaya#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
793410e230b6Smaya   uint32_t                             SliceDestinationSelectMSBs;
793510e230b6Smaya   bool                                 ChildrenPresent;
793610e230b6Smaya   __gen_address_type                   IndirectDataStartAddress;
793710e230b6Smaya   uint32_t                             ScoreboardX;
793810e230b6Smaya   uint32_t                             ScoredboardY;
793910e230b6Smaya   uint32_t                             ScoreboardMask;
794010e230b6Smaya   uint32_t                             ScoreboardColor;
794110e230b6Smaya   /* variable length fields follow */
794210e230b6Smaya};
794310e230b6Smaya
794496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
794596c5ddc4SrjsGFX9_MEDIA_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
794610e230b6Smaya                       __attribute__((unused)) void * restrict dst,
794796c5ddc4Srjs                       __attribute__((unused)) const struct GFX9_MEDIA_OBJECT * restrict values)
794810e230b6Smaya{
794910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
795010e230b6Smaya
795110e230b6Smaya   dw[0] =
795210e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
795310e230b6Smaya      __gen_uint(values->MediaCommandSubOpcode, 16, 23) |
795410e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
795510e230b6Smaya      __gen_uint(values->MediaCommandPipeline, 27, 28) |
795610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
795710e230b6Smaya
795810e230b6Smaya   dw[1] =
795910e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
796010e230b6Smaya
796110e230b6Smaya   dw[2] =
796210e230b6Smaya      __gen_uint(values->IndirectDataLength, 0, 16) |
796310e230b6Smaya      __gen_uint(values->SubSliceDestinationSelect, 17, 18) |
796410e230b6Smaya      __gen_uint(values->SliceDestinationSelect, 19, 20) |
796510e230b6Smaya      __gen_uint(values->UseScoreboard, 21, 21) |
796610e230b6Smaya      __gen_uint(values->ForceDestination, 22, 22) |
796710e230b6Smaya      __gen_uint(values->ThreadSynchronization, 24, 24) |
796810e230b6Smaya      __gen_uint(values->SliceDestinationSelectMSBs, 25, 26) |
796910e230b6Smaya      __gen_uint(values->ChildrenPresent, 31, 31);
797010e230b6Smaya
797196c5ddc4Srjs   dw[3] = __gen_address(data, &dw[3], values->IndirectDataStartAddress, 0, 0, 31);
797210e230b6Smaya
797310e230b6Smaya   dw[4] =
797410e230b6Smaya      __gen_uint(values->ScoreboardX, 0, 8) |
797510e230b6Smaya      __gen_uint(values->ScoredboardY, 16, 24);
797610e230b6Smaya
797710e230b6Smaya   dw[5] =
797810e230b6Smaya      __gen_uint(values->ScoreboardMask, 0, 7) |
797910e230b6Smaya      __gen_uint(values->ScoreboardColor, 16, 19);
798010e230b6Smaya}
798110e230b6Smaya
798296c5ddc4Srjs#define GFX9_MEDIA_OBJECT_GRPID_length_bias      2
798396c5ddc4Srjs#define GFX9_MEDIA_OBJECT_GRPID_header          \
798410e230b6Smaya   .DWordLength                         =      5,  \
798510e230b6Smaya   .MediaCommandSubOpcode               =      6,  \
798610e230b6Smaya   .MediaCommandOpcode                  =      1,  \
798710e230b6Smaya   .MediaCommandPipeline                =      2,  \
798810e230b6Smaya   .CommandType                         =      3
798910e230b6Smaya
799096c5ddc4Srjsstruct GFX9_MEDIA_OBJECT_GRPID {
799110e230b6Smaya   uint32_t                             DWordLength;
799210e230b6Smaya   uint32_t                             MediaCommandSubOpcode;
799310e230b6Smaya   uint32_t                             MediaCommandOpcode;
799410e230b6Smaya   uint32_t                             MediaCommandPipeline;
799510e230b6Smaya   uint32_t                             CommandType;
799610e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
799710e230b6Smaya   uint32_t                             IndirectDataLength;
799810e230b6Smaya   uint32_t                             SubSliceDestinationSelect;
799910e230b6Smaya#define Subslice3                                3
800010e230b6Smaya#define SubSlice2                                2
800110e230b6Smaya#define SubSlice1                                1
800210e230b6Smaya#define SubSlice0                                0
800310e230b6Smaya   uint32_t                             SliceDestinationSelect;
800410e230b6Smaya#define Slice0                                   0
800510e230b6Smaya#define Slice1                                   1
800610e230b6Smaya#define Slice2                                   2
800710e230b6Smaya   uint32_t                             UseScoreboard;
800810e230b6Smaya#define Notusingscoreboard                       0
800910e230b6Smaya#define Usingscoreboard                          1
801010e230b6Smaya   uint32_t                             ForceDestination;
801110e230b6Smaya   uint32_t                             EndofThreadGroup;
801210e230b6Smaya   uint32_t                             SliceDestinationSelectMSB;
801310e230b6Smaya   __gen_address_type                   IndirectDataStartAddress;
801410e230b6Smaya   uint32_t                             ScoreboardX;
801510e230b6Smaya   uint32_t                             ScoreboardY;
801610e230b6Smaya   uint32_t                             ScoreboardMask;
801710e230b6Smaya   uint32_t                             ScoreboardColor;
801810e230b6Smaya   uint32_t                             GroupID;
801910e230b6Smaya   /* variable length fields follow */
802010e230b6Smaya};
802110e230b6Smaya
802296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
802396c5ddc4SrjsGFX9_MEDIA_OBJECT_GRPID_pack(__attribute__((unused)) __gen_user_data *data,
802410e230b6Smaya                             __attribute__((unused)) void * restrict dst,
802596c5ddc4Srjs                             __attribute__((unused)) const struct GFX9_MEDIA_OBJECT_GRPID * restrict values)
802610e230b6Smaya{
802710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
802810e230b6Smaya
802910e230b6Smaya   dw[0] =
803010e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
803110e230b6Smaya      __gen_uint(values->MediaCommandSubOpcode, 16, 23) |
803210e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
803310e230b6Smaya      __gen_uint(values->MediaCommandPipeline, 27, 28) |
803410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
803510e230b6Smaya
803610e230b6Smaya   dw[1] =
803710e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
803810e230b6Smaya
803910e230b6Smaya   dw[2] =
804010e230b6Smaya      __gen_uint(values->IndirectDataLength, 0, 16) |
804110e230b6Smaya      __gen_uint(values->SubSliceDestinationSelect, 17, 18) |
804210e230b6Smaya      __gen_uint(values->SliceDestinationSelect, 19, 20) |
804310e230b6Smaya      __gen_uint(values->UseScoreboard, 21, 21) |
804410e230b6Smaya      __gen_uint(values->ForceDestination, 22, 22) |
804510e230b6Smaya      __gen_uint(values->EndofThreadGroup, 23, 23) |
804610e230b6Smaya      __gen_uint(values->SliceDestinationSelectMSB, 24, 24);
804710e230b6Smaya
804896c5ddc4Srjs   dw[3] = __gen_address(data, &dw[3], values->IndirectDataStartAddress, 0, 0, 31);
804910e230b6Smaya
805010e230b6Smaya   dw[4] =
805110e230b6Smaya      __gen_uint(values->ScoreboardX, 0, 8) |
805210e230b6Smaya      __gen_uint(values->ScoreboardY, 16, 24);
805310e230b6Smaya
805410e230b6Smaya   dw[5] =
805510e230b6Smaya      __gen_uint(values->ScoreboardMask, 0, 7) |
805610e230b6Smaya      __gen_uint(values->ScoreboardColor, 16, 19);
805710e230b6Smaya
805810e230b6Smaya   dw[6] =
805910e230b6Smaya      __gen_uint(values->GroupID, 0, 31);
806010e230b6Smaya}
806110e230b6Smaya
806296c5ddc4Srjs#define GFX9_MEDIA_OBJECT_PRT_length          16
806396c5ddc4Srjs#define GFX9_MEDIA_OBJECT_PRT_length_bias      2
806496c5ddc4Srjs#define GFX9_MEDIA_OBJECT_PRT_header            \
806510e230b6Smaya   .DWordLength                         =     14,  \
806610e230b6Smaya   .SubOpcode                           =      2,  \
806710e230b6Smaya   .MediaCommandOpcode                  =      1,  \
806810e230b6Smaya   .Pipeline                            =      2,  \
806910e230b6Smaya   .CommandType                         =      3
807010e230b6Smaya
807196c5ddc4Srjsstruct GFX9_MEDIA_OBJECT_PRT {
807210e230b6Smaya   uint32_t                             DWordLength;
807310e230b6Smaya   uint32_t                             SubOpcode;
807410e230b6Smaya   uint32_t                             MediaCommandOpcode;
807510e230b6Smaya   uint32_t                             Pipeline;
807610e230b6Smaya   uint32_t                             CommandType;
807710e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
807810e230b6Smaya   uint32_t                             PRT_FenceType;
807910e230b6Smaya#define Rootthreadqueue                          0
808010e230b6Smaya#define VFEstateflush                            1
808110e230b6Smaya   bool                                 PRT_FenceNeeded;
808210e230b6Smaya   bool                                 ChildrenPresent;
808310e230b6Smaya   uint32_t                             InlineData[12];
808410e230b6Smaya};
808510e230b6Smaya
808696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
808796c5ddc4SrjsGFX9_MEDIA_OBJECT_PRT_pack(__attribute__((unused)) __gen_user_data *data,
808810e230b6Smaya                           __attribute__((unused)) void * restrict dst,
808996c5ddc4Srjs                           __attribute__((unused)) const struct GFX9_MEDIA_OBJECT_PRT * restrict values)
809010e230b6Smaya{
809110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
809210e230b6Smaya
809310e230b6Smaya   dw[0] =
809410e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
809510e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
809610e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
809710e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
809810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
809910e230b6Smaya
810010e230b6Smaya   dw[1] =
810110e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
810210e230b6Smaya
810310e230b6Smaya   dw[2] =
810410e230b6Smaya      __gen_uint(values->PRT_FenceType, 22, 22) |
810510e230b6Smaya      __gen_uint(values->PRT_FenceNeeded, 23, 23) |
810610e230b6Smaya      __gen_uint(values->ChildrenPresent, 31, 31);
810710e230b6Smaya
810810e230b6Smaya   dw[3] = 0;
810910e230b6Smaya
811010e230b6Smaya   dw[4] =
811110e230b6Smaya      __gen_uint(values->InlineData[0], 0, 31);
811210e230b6Smaya
811310e230b6Smaya   dw[5] =
811410e230b6Smaya      __gen_uint(values->InlineData[1], 0, 31);
811510e230b6Smaya
811610e230b6Smaya   dw[6] =
811710e230b6Smaya      __gen_uint(values->InlineData[2], 0, 31);
811810e230b6Smaya
811910e230b6Smaya   dw[7] =
812010e230b6Smaya      __gen_uint(values->InlineData[3], 0, 31);
812110e230b6Smaya
812210e230b6Smaya   dw[8] =
812310e230b6Smaya      __gen_uint(values->InlineData[4], 0, 31);
812410e230b6Smaya
812510e230b6Smaya   dw[9] =
812610e230b6Smaya      __gen_uint(values->InlineData[5], 0, 31);
812710e230b6Smaya
812810e230b6Smaya   dw[10] =
812910e230b6Smaya      __gen_uint(values->InlineData[6], 0, 31);
813010e230b6Smaya
813110e230b6Smaya   dw[11] =
813210e230b6Smaya      __gen_uint(values->InlineData[7], 0, 31);
813310e230b6Smaya
813410e230b6Smaya   dw[12] =
813510e230b6Smaya      __gen_uint(values->InlineData[8], 0, 31);
813610e230b6Smaya
813710e230b6Smaya   dw[13] =
813810e230b6Smaya      __gen_uint(values->InlineData[9], 0, 31);
813910e230b6Smaya
814010e230b6Smaya   dw[14] =
814110e230b6Smaya      __gen_uint(values->InlineData[10], 0, 31);
814210e230b6Smaya
814310e230b6Smaya   dw[15] =
814410e230b6Smaya      __gen_uint(values->InlineData[11], 0, 31);
814510e230b6Smaya}
814610e230b6Smaya
814796c5ddc4Srjs#define GFX9_MEDIA_OBJECT_WALKER_length_bias      2
814896c5ddc4Srjs#define GFX9_MEDIA_OBJECT_WALKER_header         \
814910e230b6Smaya   .DWordLength                         =     15,  \
815010e230b6Smaya   .SubOpcode                           =      3,  \
815110e230b6Smaya   .MediaCommandOpcode                  =      1,  \
815210e230b6Smaya   .Pipeline                            =      2,  \
815310e230b6Smaya   .CommandType                         =      3
815410e230b6Smaya
815596c5ddc4Srjsstruct GFX9_MEDIA_OBJECT_WALKER {
815610e230b6Smaya   uint32_t                             DWordLength;
815710e230b6Smaya   uint32_t                             SubOpcode;
815810e230b6Smaya   uint32_t                             MediaCommandOpcode;
815910e230b6Smaya   uint32_t                             Pipeline;
816010e230b6Smaya   uint32_t                             CommandType;
816110e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
816210e230b6Smaya   uint32_t                             IndirectDataLength;
816310e230b6Smaya   uint32_t                             UseScoreboard;
816410e230b6Smaya#define Notusingscoreboard                       0
816510e230b6Smaya#define Usingscoreboard                          1
816610e230b6Smaya   uint32_t                             MaskedDispatch;
816710e230b6Smaya   uint32_t                             ThreadSynchronization;
816810e230b6Smaya#define Nothreadsynchronization                  0
816910e230b6Smaya#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
817010e230b6Smaya   uint32_t                             IndirectDataStartAddress;
817110e230b6Smaya   uint32_t                             ScoreboardMask;
817210e230b6Smaya   uint32_t                             GroupIDLoopSelect;
817310e230b6Smaya#define No_Groups                                0
817410e230b6Smaya#define Color_Groups                             1
817510e230b6Smaya#define InnerLocal_Groups                        2
817610e230b6Smaya#define MidLocal_Groups                          3
817710e230b6Smaya#define OuterLocal_Groups                        4
817810e230b6Smaya#define InnerGlobal_Groups                       5
817910e230b6Smaya   int32_t                              MidLoopUnitX;
818010e230b6Smaya   int32_t                              LocalMidLoopUnitY;
818110e230b6Smaya   uint32_t                             MiddleLoopExtraSteps;
818210e230b6Smaya   uint32_t                             ColorCountMinusOne;
818310e230b6Smaya   uint32_t                             LocalLoopExecCount;
818410e230b6Smaya   uint32_t                             GlobalLoopExecCount;
818510e230b6Smaya   uint32_t                             BlockResolutionX;
818610e230b6Smaya   uint32_t                             BlockResolutionY;
818710e230b6Smaya   uint32_t                             LocalStartX;
818810e230b6Smaya   uint32_t                             LocalStartY;
818910e230b6Smaya   int32_t                              LocalOuterLoopStrideX;
819010e230b6Smaya   int32_t                              LocalOuterLoopStrideY;
819110e230b6Smaya   int32_t                              LocalInnerLoopUnitX;
819210e230b6Smaya   int32_t                              LocalInnerLoopUnitY;
819310e230b6Smaya   uint32_t                             GlobalResolutionX;
819410e230b6Smaya   uint32_t                             GlobalResolutionY;
819510e230b6Smaya   int32_t                              GlobalStartX;
819610e230b6Smaya   int32_t                              GlobalStartY;
819710e230b6Smaya   int32_t                              GlobalOuterLoopStrideX;
819810e230b6Smaya   int32_t                              GlobalOuterLoopStrideY;
819910e230b6Smaya   int32_t                              GlobalInnerLoopUnitX;
820010e230b6Smaya   int32_t                              GlobalInnerLoopUnitY;
820110e230b6Smaya   /* variable length fields follow */
820210e230b6Smaya};
820310e230b6Smaya
820496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
820596c5ddc4SrjsGFX9_MEDIA_OBJECT_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
820610e230b6Smaya                              __attribute__((unused)) void * restrict dst,
820796c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_MEDIA_OBJECT_WALKER * restrict values)
820810e230b6Smaya{
820910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
821010e230b6Smaya
821110e230b6Smaya   dw[0] =
821210e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
821310e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
821410e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
821510e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
821610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
821710e230b6Smaya
821810e230b6Smaya   dw[1] =
821910e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
822010e230b6Smaya
822110e230b6Smaya   dw[2] =
822210e230b6Smaya      __gen_uint(values->IndirectDataLength, 0, 16) |
822310e230b6Smaya      __gen_uint(values->UseScoreboard, 21, 21) |
822410e230b6Smaya      __gen_uint(values->MaskedDispatch, 22, 23) |
822510e230b6Smaya      __gen_uint(values->ThreadSynchronization, 24, 24);
822610e230b6Smaya
822710e230b6Smaya   dw[3] =
822810e230b6Smaya      __gen_uint(values->IndirectDataStartAddress, 0, 31);
822910e230b6Smaya
823010e230b6Smaya   dw[4] = 0;
823110e230b6Smaya
823210e230b6Smaya   dw[5] =
823310e230b6Smaya      __gen_uint(values->ScoreboardMask, 0, 7) |
823410e230b6Smaya      __gen_uint(values->GroupIDLoopSelect, 8, 31);
823510e230b6Smaya
823610e230b6Smaya   dw[6] =
823710e230b6Smaya      __gen_sint(values->MidLoopUnitX, 8, 9) |
823810e230b6Smaya      __gen_sint(values->LocalMidLoopUnitY, 12, 13) |
823910e230b6Smaya      __gen_uint(values->MiddleLoopExtraSteps, 16, 20) |
824010e230b6Smaya      __gen_uint(values->ColorCountMinusOne, 24, 27);
824110e230b6Smaya
824210e230b6Smaya   dw[7] =
824310e230b6Smaya      __gen_uint(values->LocalLoopExecCount, 0, 11) |
824410e230b6Smaya      __gen_uint(values->GlobalLoopExecCount, 16, 27);
824510e230b6Smaya
824610e230b6Smaya   dw[8] =
824710e230b6Smaya      __gen_uint(values->BlockResolutionX, 0, 10) |
824810e230b6Smaya      __gen_uint(values->BlockResolutionY, 16, 26);
824910e230b6Smaya
825010e230b6Smaya   dw[9] =
825110e230b6Smaya      __gen_uint(values->LocalStartX, 0, 10) |
825210e230b6Smaya      __gen_uint(values->LocalStartY, 16, 26);
825310e230b6Smaya
825410e230b6Smaya   dw[10] = 0;
825510e230b6Smaya
825610e230b6Smaya   dw[11] =
825710e230b6Smaya      __gen_sint(values->LocalOuterLoopStrideX, 0, 11) |
825810e230b6Smaya      __gen_sint(values->LocalOuterLoopStrideY, 16, 27);
825910e230b6Smaya
826010e230b6Smaya   dw[12] =
826110e230b6Smaya      __gen_sint(values->LocalInnerLoopUnitX, 0, 11) |
826210e230b6Smaya      __gen_sint(values->LocalInnerLoopUnitY, 16, 27);
826310e230b6Smaya
826410e230b6Smaya   dw[13] =
826510e230b6Smaya      __gen_uint(values->GlobalResolutionX, 0, 10) |
826610e230b6Smaya      __gen_uint(values->GlobalResolutionY, 16, 26);
826710e230b6Smaya
826810e230b6Smaya   dw[14] =
826910e230b6Smaya      __gen_sint(values->GlobalStartX, 0, 11) |
827010e230b6Smaya      __gen_sint(values->GlobalStartY, 16, 27);
827110e230b6Smaya
827210e230b6Smaya   dw[15] =
827310e230b6Smaya      __gen_sint(values->GlobalOuterLoopStrideX, 0, 11) |
827410e230b6Smaya      __gen_sint(values->GlobalOuterLoopStrideY, 16, 27);
827510e230b6Smaya
827610e230b6Smaya   dw[16] =
827710e230b6Smaya      __gen_sint(values->GlobalInnerLoopUnitX, 0, 11) |
827810e230b6Smaya      __gen_sint(values->GlobalInnerLoopUnitY, 16, 27);
827910e230b6Smaya}
828010e230b6Smaya
828196c5ddc4Srjs#define GFX9_MEDIA_STATE_FLUSH_length          2
828296c5ddc4Srjs#define GFX9_MEDIA_STATE_FLUSH_length_bias      2
828396c5ddc4Srjs#define GFX9_MEDIA_STATE_FLUSH_header           \
828410e230b6Smaya   .DWordLength                         =      0,  \
828510e230b6Smaya   .SubOpcode                           =      4,  \
828610e230b6Smaya   .MediaCommandOpcode                  =      0,  \
828710e230b6Smaya   .Pipeline                            =      2,  \
828810e230b6Smaya   .CommandType                         =      3
828910e230b6Smaya
829096c5ddc4Srjsstruct GFX9_MEDIA_STATE_FLUSH {
829110e230b6Smaya   uint32_t                             DWordLength;
829210e230b6Smaya   uint32_t                             SubOpcode;
829310e230b6Smaya   uint32_t                             MediaCommandOpcode;
829410e230b6Smaya   uint32_t                             Pipeline;
829510e230b6Smaya   uint32_t                             CommandType;
829610e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
829710e230b6Smaya   uint32_t                             WatermarkRequired;
829810e230b6Smaya   bool                                 FlushtoGO;
829910e230b6Smaya};
830010e230b6Smaya
830196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
830296c5ddc4SrjsGFX9_MEDIA_STATE_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
830310e230b6Smaya                            __attribute__((unused)) void * restrict dst,
830496c5ddc4Srjs                            __attribute__((unused)) const struct GFX9_MEDIA_STATE_FLUSH * restrict values)
830510e230b6Smaya{
830610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
830710e230b6Smaya
830810e230b6Smaya   dw[0] =
830910e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
831010e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
831110e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
831210e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
831310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
831410e230b6Smaya
831510e230b6Smaya   dw[1] =
831610e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 5) |
831710e230b6Smaya      __gen_uint(values->WatermarkRequired, 6, 6) |
831810e230b6Smaya      __gen_uint(values->FlushtoGO, 7, 7);
831910e230b6Smaya}
832010e230b6Smaya
832196c5ddc4Srjs#define GFX9_MEDIA_VFE_STATE_length            9
832296c5ddc4Srjs#define GFX9_MEDIA_VFE_STATE_length_bias       2
832396c5ddc4Srjs#define GFX9_MEDIA_VFE_STATE_header             \
832410e230b6Smaya   .DWordLength                         =      7,  \
832510e230b6Smaya   .SubOpcode                           =      0,  \
832610e230b6Smaya   .MediaCommandOpcode                  =      0,  \
832710e230b6Smaya   .Pipeline                            =      2,  \
832810e230b6Smaya   .CommandType                         =      3
832910e230b6Smaya
833096c5ddc4Srjsstruct GFX9_MEDIA_VFE_STATE {
833110e230b6Smaya   uint32_t                             DWordLength;
833210e230b6Smaya   uint32_t                             SubOpcode;
833310e230b6Smaya   uint32_t                             MediaCommandOpcode;
833410e230b6Smaya   uint32_t                             Pipeline;
833510e230b6Smaya   uint32_t                             CommandType;
833610e230b6Smaya   uint32_t                             PerThreadScratchSpace;
833710e230b6Smaya   uint32_t                             StackSize;
833810e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
833910e230b6Smaya   uint32_t                             ResetGatewayTimer;
834010e230b6Smaya#define Maintainingtheexistingtimestampstate     0
834110e230b6Smaya#define Resettingrelativetimerandlatchingtheglobaltimestamp 1
834210e230b6Smaya   uint32_t                             NumberofURBEntries;
834310e230b6Smaya   uint32_t                             MaximumNumberofThreads;
834410e230b6Smaya   uint32_t                             SliceDisable;
834510e230b6Smaya#define AllSubslicesEnabled                      0
834610e230b6Smaya#define OnlySlice0Enabled                        1
834710e230b6Smaya#define OnlySlice0Subslice0Enabled               3
834810e230b6Smaya   uint32_t                             CURBEAllocationSize;
834910e230b6Smaya   uint32_t                             URBEntryAllocationSize;
835010e230b6Smaya   uint32_t                             ScoreboardMask;
835110e230b6Smaya   uint32_t                             ScoreboardType;
835210e230b6Smaya#define StallingScoreboard                       0
835310e230b6Smaya#define NonStallingScoreboard                    1
835410e230b6Smaya   bool                                 ScoreboardEnable;
835510e230b6Smaya   int32_t                              Scoreboard0DeltaX;
835610e230b6Smaya   int32_t                              Scoreboard0DeltaY;
835710e230b6Smaya   int32_t                              Scoreboard1DeltaX;
835810e230b6Smaya   int32_t                              Scoreboard1DeltaY;
835910e230b6Smaya   int32_t                              Scoreboard2DeltaX;
836010e230b6Smaya   int32_t                              Scoreboard2DeltaY;
836110e230b6Smaya   int32_t                              Scoreboard3DeltaX;
836210e230b6Smaya   int32_t                              Scoreboard3DeltaY;
836310e230b6Smaya   int32_t                              Scoreboard4DeltaX;
836410e230b6Smaya   int32_t                              Scoreboard4DeltaY;
836510e230b6Smaya   int32_t                              Scoreboard5DeltaX;
836610e230b6Smaya   int32_t                              Scoreboard5DeltaY;
836710e230b6Smaya   int32_t                              Scoreboard6DeltaX;
836810e230b6Smaya   int32_t                              Scoreboard6DeltaY;
836910e230b6Smaya   int32_t                              Scoreboard7DeltaX;
837010e230b6Smaya   int32_t                              Scoreboard7DeltaY;
837110e230b6Smaya};
837210e230b6Smaya
837396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
837496c5ddc4SrjsGFX9_MEDIA_VFE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
837510e230b6Smaya                          __attribute__((unused)) void * restrict dst,
837696c5ddc4Srjs                          __attribute__((unused)) const struct GFX9_MEDIA_VFE_STATE * restrict values)
837710e230b6Smaya{
837810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
837910e230b6Smaya
838010e230b6Smaya   dw[0] =
838110e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
838210e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
838310e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
838410e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
838510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
838610e230b6Smaya
838710e230b6Smaya   const uint64_t v1 =
838810e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3) |
838910e230b6Smaya      __gen_uint(values->StackSize, 4, 7);
839010e230b6Smaya   const uint64_t v1_address =
839196c5ddc4Srjs      __gen_address(data, &dw[1], values->ScratchSpaceBasePointer, v1, 10, 47);
839210e230b6Smaya   dw[1] = v1_address;
839310e230b6Smaya   dw[2] = (v1_address >> 32) | (v1 >> 32);
839410e230b6Smaya
839510e230b6Smaya   dw[3] =
839610e230b6Smaya      __gen_uint(values->ResetGatewayTimer, 7, 7) |
839710e230b6Smaya      __gen_uint(values->NumberofURBEntries, 8, 15) |
839810e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 16, 31);
839910e230b6Smaya
840010e230b6Smaya   dw[4] =
840110e230b6Smaya      __gen_uint(values->SliceDisable, 0, 1);
840210e230b6Smaya
840310e230b6Smaya   dw[5] =
840410e230b6Smaya      __gen_uint(values->CURBEAllocationSize, 0, 15) |
840510e230b6Smaya      __gen_uint(values->URBEntryAllocationSize, 16, 31);
840610e230b6Smaya
840710e230b6Smaya   dw[6] =
840810e230b6Smaya      __gen_uint(values->ScoreboardMask, 0, 7) |
840910e230b6Smaya      __gen_uint(values->ScoreboardType, 30, 30) |
841010e230b6Smaya      __gen_uint(values->ScoreboardEnable, 31, 31);
841110e230b6Smaya
841210e230b6Smaya   dw[7] =
841310e230b6Smaya      __gen_sint(values->Scoreboard0DeltaX, 0, 3) |
841410e230b6Smaya      __gen_sint(values->Scoreboard0DeltaY, 4, 7) |
841510e230b6Smaya      __gen_sint(values->Scoreboard1DeltaX, 8, 11) |
841610e230b6Smaya      __gen_sint(values->Scoreboard1DeltaY, 12, 15) |
841710e230b6Smaya      __gen_sint(values->Scoreboard2DeltaX, 16, 19) |
841810e230b6Smaya      __gen_sint(values->Scoreboard2DeltaY, 20, 23) |
841910e230b6Smaya      __gen_sint(values->Scoreboard3DeltaX, 24, 27) |
842010e230b6Smaya      __gen_sint(values->Scoreboard3DeltaY, 28, 31);
842110e230b6Smaya
842210e230b6Smaya   dw[8] =
842310e230b6Smaya      __gen_sint(values->Scoreboard4DeltaX, 0, 3) |
842410e230b6Smaya      __gen_sint(values->Scoreboard4DeltaY, 4, 7) |
842510e230b6Smaya      __gen_sint(values->Scoreboard5DeltaX, 8, 11) |
842610e230b6Smaya      __gen_sint(values->Scoreboard5DeltaY, 12, 15) |
842710e230b6Smaya      __gen_sint(values->Scoreboard6DeltaX, 16, 19) |
842810e230b6Smaya      __gen_sint(values->Scoreboard6DeltaY, 20, 23) |
842910e230b6Smaya      __gen_sint(values->Scoreboard7DeltaX, 24, 27) |
843010e230b6Smaya      __gen_sint(values->Scoreboard7DeltaY, 28, 31);
843110e230b6Smaya}
843210e230b6Smaya
843396c5ddc4Srjs#define GFX9_MI_ARB_CHECK_length               1
843496c5ddc4Srjs#define GFX9_MI_ARB_CHECK_length_bias          1
843596c5ddc4Srjs#define GFX9_MI_ARB_CHECK_header                \
843610e230b6Smaya   .MICommandOpcode                     =      5,  \
843710e230b6Smaya   .CommandType                         =      0
843810e230b6Smaya
843996c5ddc4Srjsstruct GFX9_MI_ARB_CHECK {
844010e230b6Smaya   uint32_t                             MICommandOpcode;
844110e230b6Smaya   uint32_t                             CommandType;
844210e230b6Smaya};
844310e230b6Smaya
844496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
844596c5ddc4SrjsGFX9_MI_ARB_CHECK_pack(__attribute__((unused)) __gen_user_data *data,
844610e230b6Smaya                       __attribute__((unused)) void * restrict dst,
844796c5ddc4Srjs                       __attribute__((unused)) const struct GFX9_MI_ARB_CHECK * restrict values)
844810e230b6Smaya{
844910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
845010e230b6Smaya
845110e230b6Smaya   dw[0] =
845210e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
845310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
845410e230b6Smaya}
845510e230b6Smaya
845696c5ddc4Srjs#define GFX9_MI_ARB_ON_OFF_length              1
845796c5ddc4Srjs#define GFX9_MI_ARB_ON_OFF_length_bias         1
845896c5ddc4Srjs#define GFX9_MI_ARB_ON_OFF_header               \
845910e230b6Smaya   .ArbitrationEnable                   =      1,  \
846010e230b6Smaya   .MICommandOpcode                     =      8,  \
846110e230b6Smaya   .CommandType                         =      0
846210e230b6Smaya
846396c5ddc4Srjsstruct GFX9_MI_ARB_ON_OFF {
846410e230b6Smaya   bool                                 ArbitrationEnable;
846510e230b6Smaya   uint32_t                             MICommandOpcode;
846610e230b6Smaya   uint32_t                             CommandType;
846710e230b6Smaya};
846810e230b6Smaya
846996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
847096c5ddc4SrjsGFX9_MI_ARB_ON_OFF_pack(__attribute__((unused)) __gen_user_data *data,
847110e230b6Smaya                        __attribute__((unused)) void * restrict dst,
847296c5ddc4Srjs                        __attribute__((unused)) const struct GFX9_MI_ARB_ON_OFF * restrict values)
847310e230b6Smaya{
847410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
847510e230b6Smaya
847610e230b6Smaya   dw[0] =
847710e230b6Smaya      __gen_uint(values->ArbitrationEnable, 0, 0) |
847810e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
847910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
848010e230b6Smaya}
848110e230b6Smaya
848296c5ddc4Srjs#define GFX9_MI_ATOMIC_length                  3
848396c5ddc4Srjs#define GFX9_MI_ATOMIC_length_bias             2
848496c5ddc4Srjs#define GFX9_MI_ATOMIC_header                   \
848510e230b6Smaya   .DWordLength                         =      1,  \
848610e230b6Smaya   .MICommandOpcode                     =     47,  \
848710e230b6Smaya   .CommandType                         =      0
848810e230b6Smaya
848996c5ddc4Srjsstruct GFX9_MI_ATOMIC {
849010e230b6Smaya   uint32_t                             DWordLength;
849196c5ddc4Srjs   enum GFX9_Atomic_OPCODE              ATOMICOPCODE;
849210e230b6Smaya   bool                                 ReturnDataControl;
849310e230b6Smaya   bool                                 CSSTALL;
849410e230b6Smaya   bool                                 InlineData;
849510e230b6Smaya   uint32_t                             DataSize;
849610e230b6Smaya#define MI_ATOMIC_DWORD                          0
849710e230b6Smaya#define MI_ATOMIC_QWORD                          1
849810e230b6Smaya#define MI_ATOMIC_OCTWORD                        2
849910e230b6Smaya#define MI_ATOMIC_RESERVED                       3
850010e230b6Smaya   bool                                 PostSyncOperation;
850110e230b6Smaya   uint32_t                             MemoryType;
850210e230b6Smaya#define PerProcessGraphicsAddress                0
850310e230b6Smaya#define GlobalGraphicsAddress                    1
850410e230b6Smaya   uint32_t                             MICommandOpcode;
850510e230b6Smaya   uint32_t                             CommandType;
850610e230b6Smaya   __gen_address_type                   MemoryAddress;
850710e230b6Smaya   uint32_t                             Operand1DataDword0;
850810e230b6Smaya   uint32_t                             Operand2DataDword0;
850910e230b6Smaya   uint32_t                             Operand1DataDword1;
851010e230b6Smaya   uint32_t                             Operand2DataDword1;
851110e230b6Smaya   uint32_t                             Operand1DataDword2;
851210e230b6Smaya   uint32_t                             Operand2DataDword2;
851310e230b6Smaya   uint32_t                             Operand1DataDword3;
851410e230b6Smaya   uint32_t                             Operand2DataDword3;
851510e230b6Smaya};
851610e230b6Smaya
851796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
851896c5ddc4SrjsGFX9_MI_ATOMIC_pack(__attribute__((unused)) __gen_user_data *data,
851910e230b6Smaya                    __attribute__((unused)) void * restrict dst,
852096c5ddc4Srjs                    __attribute__((unused)) const struct GFX9_MI_ATOMIC * restrict values)
852110e230b6Smaya{
852210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
852310e230b6Smaya
852410e230b6Smaya   dw[0] =
852510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
852610e230b6Smaya      __gen_uint(values->ATOMICOPCODE, 8, 15) |
852710e230b6Smaya      __gen_uint(values->ReturnDataControl, 16, 16) |
852810e230b6Smaya      __gen_uint(values->CSSTALL, 17, 17) |
852910e230b6Smaya      __gen_uint(values->InlineData, 18, 18) |
853010e230b6Smaya      __gen_uint(values->DataSize, 19, 20) |
853110e230b6Smaya      __gen_uint(values->PostSyncOperation, 21, 21) |
853210e230b6Smaya      __gen_uint(values->MemoryType, 22, 22) |
853310e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
853410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
853510e230b6Smaya
853610e230b6Smaya   const uint64_t v1_address =
853796c5ddc4Srjs      __gen_address(data, &dw[1], values->MemoryAddress, 0, 2, 47);
853810e230b6Smaya   dw[1] = v1_address;
853910e230b6Smaya   dw[2] = v1_address >> 32;
854010e230b6Smaya}
854110e230b6Smaya
854296c5ddc4Srjs#define GFX9_MI_BATCH_BUFFER_END_length        1
854396c5ddc4Srjs#define GFX9_MI_BATCH_BUFFER_END_length_bias      1
854496c5ddc4Srjs#define GFX9_MI_BATCH_BUFFER_END_header         \
854510e230b6Smaya   .MICommandOpcode                     =     10,  \
854610e230b6Smaya   .CommandType                         =      0
854710e230b6Smaya
854896c5ddc4Srjsstruct GFX9_MI_BATCH_BUFFER_END {
854910e230b6Smaya   uint32_t                             MICommandOpcode;
855010e230b6Smaya   uint32_t                             CommandType;
855110e230b6Smaya};
855210e230b6Smaya
855396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
855496c5ddc4SrjsGFX9_MI_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
855510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
855696c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_MI_BATCH_BUFFER_END * restrict values)
855710e230b6Smaya{
855810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
855910e230b6Smaya
856010e230b6Smaya   dw[0] =
856110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
856210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
856310e230b6Smaya}
856410e230b6Smaya
856596c5ddc4Srjs#define GFX9_MI_BATCH_BUFFER_START_length      3
856696c5ddc4Srjs#define GFX9_MI_BATCH_BUFFER_START_length_bias      2
856796c5ddc4Srjs#define GFX9_MI_BATCH_BUFFER_START_header       \
856810e230b6Smaya   .DWordLength                         =      1,  \
856910e230b6Smaya   .MICommandOpcode                     =     49,  \
857010e230b6Smaya   .CommandType                         =      0
857110e230b6Smaya
857296c5ddc4Srjsstruct GFX9_MI_BATCH_BUFFER_START {
857310e230b6Smaya   uint32_t                             DWordLength;
857410e230b6Smaya   uint32_t                             AddressSpaceIndicator;
857510e230b6Smaya#define ASI_GGTT                                 0
857610e230b6Smaya#define ASI_PPGTT                                1
857710e230b6Smaya   bool                                 ResourceStreamerEnable;
857810e230b6Smaya   bool                                 PredicationEnable;
857910e230b6Smaya   bool                                 AddOffsetEnable;
858010e230b6Smaya   uint32_t                             SecondLevelBatchBuffer;
858110e230b6Smaya#define Firstlevelbatch                          0
858210e230b6Smaya#define Secondlevelbatch                         1
858310e230b6Smaya   uint32_t                             MICommandOpcode;
858410e230b6Smaya   uint32_t                             CommandType;
858510e230b6Smaya   __gen_address_type                   BatchBufferStartAddress;
858610e230b6Smaya};
858710e230b6Smaya
858896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
858996c5ddc4SrjsGFX9_MI_BATCH_BUFFER_START_pack(__attribute__((unused)) __gen_user_data *data,
859010e230b6Smaya                                __attribute__((unused)) void * restrict dst,
859196c5ddc4Srjs                                __attribute__((unused)) const struct GFX9_MI_BATCH_BUFFER_START * restrict values)
859210e230b6Smaya{
859310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
859410e230b6Smaya
859510e230b6Smaya   dw[0] =
859610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
859710e230b6Smaya      __gen_uint(values->AddressSpaceIndicator, 8, 8) |
859810e230b6Smaya      __gen_uint(values->ResourceStreamerEnable, 10, 10) |
859910e230b6Smaya      __gen_uint(values->PredicationEnable, 15, 15) |
860010e230b6Smaya      __gen_uint(values->AddOffsetEnable, 16, 16) |
860110e230b6Smaya      __gen_uint(values->SecondLevelBatchBuffer, 22, 22) |
860210e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
860310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
860410e230b6Smaya
860510e230b6Smaya   const uint64_t v1_address =
860696c5ddc4Srjs      __gen_address(data, &dw[1], values->BatchBufferStartAddress, 0, 2, 63);
860710e230b6Smaya   dw[1] = v1_address;
860810e230b6Smaya   dw[2] = v1_address >> 32;
860910e230b6Smaya}
861010e230b6Smaya
861196c5ddc4Srjs#define GFX9_MI_CLFLUSH_length_bias            2
861296c5ddc4Srjs#define GFX9_MI_CLFLUSH_header                  \
861310e230b6Smaya   .DWordLength                         =      1,  \
861410e230b6Smaya   .MICommandOpcode                     =     39,  \
861510e230b6Smaya   .CommandType                         =      0
861610e230b6Smaya
861796c5ddc4Srjsstruct GFX9_MI_CLFLUSH {
861810e230b6Smaya   uint32_t                             DWordLength;
861910e230b6Smaya   bool                                 UseGlobalGTT;
862010e230b6Smaya   uint32_t                             MICommandOpcode;
862110e230b6Smaya   uint32_t                             CommandType;
862210e230b6Smaya   uint32_t                             StartingCachelineOffset;
862310e230b6Smaya   __gen_address_type                   PageBaseAddress;
862410e230b6Smaya   /* variable length fields follow */
862510e230b6Smaya};
862610e230b6Smaya
862796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
862896c5ddc4SrjsGFX9_MI_CLFLUSH_pack(__attribute__((unused)) __gen_user_data *data,
862910e230b6Smaya                     __attribute__((unused)) void * restrict dst,
863096c5ddc4Srjs                     __attribute__((unused)) const struct GFX9_MI_CLFLUSH * restrict values)
863110e230b6Smaya{
863210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
863310e230b6Smaya
863410e230b6Smaya   dw[0] =
863510e230b6Smaya      __gen_uint(values->DWordLength, 0, 9) |
863610e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
863710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
863810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
863910e230b6Smaya
864010e230b6Smaya   const uint64_t v1 =
864110e230b6Smaya      __gen_uint(values->StartingCachelineOffset, 6, 11);
864210e230b6Smaya   const uint64_t v1_address =
864396c5ddc4Srjs      __gen_address(data, &dw[1], values->PageBaseAddress, v1, 12, 47);
864410e230b6Smaya   dw[1] = v1_address;
864510e230b6Smaya   dw[2] = (v1_address >> 32) | (v1 >> 32);
864610e230b6Smaya}
864710e230b6Smaya
864896c5ddc4Srjs#define GFX9_MI_CONDITIONAL_BATCH_BUFFER_END_length      4
864996c5ddc4Srjs#define GFX9_MI_CONDITIONAL_BATCH_BUFFER_END_length_bias      2
865096c5ddc4Srjs#define GFX9_MI_CONDITIONAL_BATCH_BUFFER_END_header\
865110e230b6Smaya   .DWordLength                         =      2,  \
865210e230b6Smaya   .CompareSemaphore                    =      0,  \
865310e230b6Smaya   .MICommandOpcode                     =     54,  \
865410e230b6Smaya   .CommandType                         =      0
865510e230b6Smaya
865696c5ddc4Srjsstruct GFX9_MI_CONDITIONAL_BATCH_BUFFER_END {
865710e230b6Smaya   uint32_t                             DWordLength;
865810e230b6Smaya   uint32_t                             CompareMaskMode;
865910e230b6Smaya#define CompareMaskModeDisabled                  0
866010e230b6Smaya#define CompareMaskModeEnabled                   1
866110e230b6Smaya   uint32_t                             CompareSemaphore;
866210e230b6Smaya   bool                                 UseGlobalGTT;
866310e230b6Smaya   uint32_t                             MICommandOpcode;
866410e230b6Smaya   uint32_t                             CommandType;
866510e230b6Smaya   uint32_t                             CompareDataDword;
866610e230b6Smaya   __gen_address_type                   CompareAddress;
866710e230b6Smaya};
866810e230b6Smaya
866996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
867096c5ddc4SrjsGFX9_MI_CONDITIONAL_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
867110e230b6Smaya                                          __attribute__((unused)) void * restrict dst,
867296c5ddc4Srjs                                          __attribute__((unused)) const struct GFX9_MI_CONDITIONAL_BATCH_BUFFER_END * restrict values)
867310e230b6Smaya{
867410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
867510e230b6Smaya
867610e230b6Smaya   dw[0] =
867710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
867810e230b6Smaya      __gen_uint(values->CompareMaskMode, 19, 19) |
867910e230b6Smaya      __gen_uint(values->CompareSemaphore, 21, 21) |
868010e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
868110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
868210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
868310e230b6Smaya
868410e230b6Smaya   dw[1] =
868510e230b6Smaya      __gen_uint(values->CompareDataDword, 0, 31);
868610e230b6Smaya
868710e230b6Smaya   const uint64_t v2_address =
868896c5ddc4Srjs      __gen_address(data, &dw[2], values->CompareAddress, 0, 3, 63);
868910e230b6Smaya   dw[2] = v2_address;
869010e230b6Smaya   dw[3] = v2_address >> 32;
869110e230b6Smaya}
869210e230b6Smaya
869396c5ddc4Srjs#define GFX9_MI_COPY_MEM_MEM_length            5
869496c5ddc4Srjs#define GFX9_MI_COPY_MEM_MEM_length_bias       2
869596c5ddc4Srjs#define GFX9_MI_COPY_MEM_MEM_header             \
869610e230b6Smaya   .DWordLength                         =      3,  \
869710e230b6Smaya   .MICommandOpcode                     =     46,  \
869810e230b6Smaya   .CommandType                         =      0
869910e230b6Smaya
870096c5ddc4Srjsstruct GFX9_MI_COPY_MEM_MEM {
870110e230b6Smaya   uint32_t                             DWordLength;
870210e230b6Smaya   bool                                 UseGlobalGTTDestination;
870310e230b6Smaya   bool                                 UseGlobalGTTSource;
870410e230b6Smaya   uint32_t                             MICommandOpcode;
870510e230b6Smaya   uint32_t                             CommandType;
870610e230b6Smaya   __gen_address_type                   DestinationMemoryAddress;
870710e230b6Smaya   __gen_address_type                   SourceMemoryAddress;
870810e230b6Smaya};
870910e230b6Smaya
871096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
871196c5ddc4SrjsGFX9_MI_COPY_MEM_MEM_pack(__attribute__((unused)) __gen_user_data *data,
871210e230b6Smaya                          __attribute__((unused)) void * restrict dst,
871396c5ddc4Srjs                          __attribute__((unused)) const struct GFX9_MI_COPY_MEM_MEM * restrict values)
871410e230b6Smaya{
871510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
871610e230b6Smaya
871710e230b6Smaya   dw[0] =
871810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
871910e230b6Smaya      __gen_uint(values->UseGlobalGTTDestination, 21, 21) |
872010e230b6Smaya      __gen_uint(values->UseGlobalGTTSource, 22, 22) |
872110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
872210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
872310e230b6Smaya
872410e230b6Smaya   const uint64_t v1_address =
872596c5ddc4Srjs      __gen_address(data, &dw[1], values->DestinationMemoryAddress, 0, 2, 63);
872610e230b6Smaya   dw[1] = v1_address;
872710e230b6Smaya   dw[2] = v1_address >> 32;
872810e230b6Smaya
872910e230b6Smaya   const uint64_t v3_address =
873096c5ddc4Srjs      __gen_address(data, &dw[3], values->SourceMemoryAddress, 0, 2, 63);
873110e230b6Smaya   dw[3] = v3_address;
873210e230b6Smaya   dw[4] = v3_address >> 32;
873310e230b6Smaya}
873410e230b6Smaya
873596c5ddc4Srjs#define GFX9_MI_DISPLAY_FLIP_length            3
873696c5ddc4Srjs#define GFX9_MI_DISPLAY_FLIP_length_bias       2
873796c5ddc4Srjs#define GFX9_MI_DISPLAY_FLIP_header             \
873810e230b6Smaya   .DWordLength                         =      1,  \
873910e230b6Smaya   .MICommandOpcode                     =     20,  \
874010e230b6Smaya   .CommandType                         =      0
874110e230b6Smaya
874296c5ddc4Srjsstruct GFX9_MI_DISPLAY_FLIP {
874310e230b6Smaya   uint32_t                             DWordLength;
874410e230b6Smaya   uint32_t                             DisplayPlaneSelect;
874510e230b6Smaya#define DisplayPlane1                            0
874610e230b6Smaya#define DisplayPlane2                            1
874710e230b6Smaya#define DisplayPlane3                            2
874810e230b6Smaya#define DisplayPlane4                            4
874910e230b6Smaya#define DisplayPlane5                            5
875010e230b6Smaya#define DisplayPlane6                            6
875110e230b6Smaya#define DisplayPlane7                            7
875210e230b6Smaya#define DisplayPlane8                            8
875310e230b6Smaya#define DisplayPlane9                            9
875410e230b6Smaya#define DisplayPlane10                           10
875510e230b6Smaya#define DisplayPlane11                           11
875610e230b6Smaya#define DisplayPlane12                           12
875710e230b6Smaya   bool                                 AsyncFlipIndicator;
875810e230b6Smaya   uint32_t                             MICommandOpcode;
875910e230b6Smaya   uint32_t                             CommandType;
876010e230b6Smaya   uint32_t                             TileParameter;
876110e230b6Smaya   uint32_t                             DisplayBufferPitch;
876210e230b6Smaya   bool                                 Stereoscopic3DMode;
876310e230b6Smaya   uint32_t                             FlipType;
876410e230b6Smaya#define SyncFlip                                 0
876510e230b6Smaya#define AsyncFlip                                1
876610e230b6Smaya#define Stereo3DFlip                             2
876710e230b6Smaya   __gen_address_type                   DisplayBufferBaseAddress;
876810e230b6Smaya   __gen_address_type                   LeftEyeDisplayBufferBaseAddress;
876910e230b6Smaya};
877010e230b6Smaya
877196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
877296c5ddc4SrjsGFX9_MI_DISPLAY_FLIP_pack(__attribute__((unused)) __gen_user_data *data,
877310e230b6Smaya                          __attribute__((unused)) void * restrict dst,
877496c5ddc4Srjs                          __attribute__((unused)) const struct GFX9_MI_DISPLAY_FLIP * restrict values)
877510e230b6Smaya{
877610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
877710e230b6Smaya
877810e230b6Smaya   dw[0] =
877910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
878010e230b6Smaya      __gen_uint(values->DisplayPlaneSelect, 8, 12) |
878110e230b6Smaya      __gen_uint(values->AsyncFlipIndicator, 22, 22) |
878210e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
878310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
878410e230b6Smaya
878510e230b6Smaya   dw[1] =
878610e230b6Smaya      __gen_uint(values->TileParameter, 0, 2) |
878710e230b6Smaya      __gen_uint(values->DisplayBufferPitch, 6, 15) |
878810e230b6Smaya      __gen_uint(values->Stereoscopic3DMode, 31, 31);
878910e230b6Smaya
879010e230b6Smaya   const uint32_t v2 =
879110e230b6Smaya      __gen_uint(values->FlipType, 0, 1);
879296c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->DisplayBufferBaseAddress, v2, 12, 31);
879310e230b6Smaya}
879410e230b6Smaya
879596c5ddc4Srjs#define GFX9_MI_FORCE_WAKEUP_length            2
879696c5ddc4Srjs#define GFX9_MI_FORCE_WAKEUP_length_bias       2
879796c5ddc4Srjs#define GFX9_MI_FORCE_WAKEUP_header             \
879810e230b6Smaya   .DWordLength                         =      0,  \
879910e230b6Smaya   .MICommandOpcode                     =     29,  \
880010e230b6Smaya   .CommandType                         =      0
880110e230b6Smaya
880296c5ddc4Srjsstruct GFX9_MI_FORCE_WAKEUP {
880310e230b6Smaya   uint32_t                             DWordLength;
880410e230b6Smaya   uint32_t                             MICommandOpcode;
880510e230b6Smaya   uint32_t                             CommandType;
880610e230b6Smaya   uint32_t                             ForceMediaAwake;
880710e230b6Smaya   uint32_t                             ForceRenderAwake;
880810e230b6Smaya   uint32_t                             MaskBits;
880910e230b6Smaya};
881010e230b6Smaya
881196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
881296c5ddc4SrjsGFX9_MI_FORCE_WAKEUP_pack(__attribute__((unused)) __gen_user_data *data,
881310e230b6Smaya                          __attribute__((unused)) void * restrict dst,
881496c5ddc4Srjs                          __attribute__((unused)) const struct GFX9_MI_FORCE_WAKEUP * restrict values)
881510e230b6Smaya{
881610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
881710e230b6Smaya
881810e230b6Smaya   dw[0] =
881910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
882010e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
882110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
882210e230b6Smaya
882310e230b6Smaya   dw[1] =
882410e230b6Smaya      __gen_uint(values->ForceMediaAwake, 0, 0) |
882510e230b6Smaya      __gen_uint(values->ForceRenderAwake, 1, 1) |
882610e230b6Smaya      __gen_uint(values->MaskBits, 16, 31);
882710e230b6Smaya}
882810e230b6Smaya
882996c5ddc4Srjs#define GFX9_MI_LOAD_REGISTER_IMM_length       3
883096c5ddc4Srjs#define GFX9_MI_LOAD_REGISTER_IMM_length_bias      2
883196c5ddc4Srjs#define GFX9_MI_LOAD_REGISTER_IMM_header        \
883210e230b6Smaya   .DWordLength                         =      1,  \
883310e230b6Smaya   .MICommandOpcode                     =     34,  \
883410e230b6Smaya   .CommandType                         =      0
883510e230b6Smaya
883696c5ddc4Srjsstruct GFX9_MI_LOAD_REGISTER_IMM {
883710e230b6Smaya   uint32_t                             DWordLength;
883810e230b6Smaya   uint32_t                             ByteWriteDisables;
883910e230b6Smaya   uint32_t                             MICommandOpcode;
884010e230b6Smaya   uint32_t                             CommandType;
884110e230b6Smaya   uint64_t                             RegisterOffset;
884210e230b6Smaya   uint32_t                             DataDWord;
884310e230b6Smaya   /* variable length fields follow */
884410e230b6Smaya};
884510e230b6Smaya
884696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
884796c5ddc4SrjsGFX9_MI_LOAD_REGISTER_IMM_pack(__attribute__((unused)) __gen_user_data *data,
884810e230b6Smaya                               __attribute__((unused)) void * restrict dst,
884996c5ddc4Srjs                               __attribute__((unused)) const struct GFX9_MI_LOAD_REGISTER_IMM * restrict values)
885010e230b6Smaya{
885110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
885210e230b6Smaya
885310e230b6Smaya   dw[0] =
885410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
885510e230b6Smaya      __gen_uint(values->ByteWriteDisables, 8, 11) |
885610e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
885710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
885810e230b6Smaya
885910e230b6Smaya   dw[1] =
886010e230b6Smaya      __gen_offset(values->RegisterOffset, 2, 22);
886110e230b6Smaya
886210e230b6Smaya   dw[2] =
886310e230b6Smaya      __gen_uint(values->DataDWord, 0, 31);
886410e230b6Smaya}
886510e230b6Smaya
886696c5ddc4Srjs#define GFX9_MI_LOAD_REGISTER_MEM_length       4
886796c5ddc4Srjs#define GFX9_MI_LOAD_REGISTER_MEM_length_bias      2
886896c5ddc4Srjs#define GFX9_MI_LOAD_REGISTER_MEM_header        \
886910e230b6Smaya   .DWordLength                         =      2,  \
887010e230b6Smaya   .MICommandOpcode                     =     41,  \
887110e230b6Smaya   .CommandType                         =      0
887210e230b6Smaya
887396c5ddc4Srjsstruct GFX9_MI_LOAD_REGISTER_MEM {
887410e230b6Smaya   uint32_t                             DWordLength;
887510e230b6Smaya   bool                                 AsyncModeEnable;
887610e230b6Smaya   bool                                 UseGlobalGTT;
887710e230b6Smaya   uint32_t                             MICommandOpcode;
887810e230b6Smaya   uint32_t                             CommandType;
887910e230b6Smaya   uint64_t                             RegisterAddress;
888010e230b6Smaya   __gen_address_type                   MemoryAddress;
888110e230b6Smaya};
888210e230b6Smaya
888396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
888496c5ddc4SrjsGFX9_MI_LOAD_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
888510e230b6Smaya                               __attribute__((unused)) void * restrict dst,
888696c5ddc4Srjs                               __attribute__((unused)) const struct GFX9_MI_LOAD_REGISTER_MEM * restrict values)
888710e230b6Smaya{
888810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
888910e230b6Smaya
889010e230b6Smaya   dw[0] =
889110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
889210e230b6Smaya      __gen_uint(values->AsyncModeEnable, 21, 21) |
889310e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
889410e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
889510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
889610e230b6Smaya
889710e230b6Smaya   dw[1] =
889810e230b6Smaya      __gen_offset(values->RegisterAddress, 2, 22);
889910e230b6Smaya
890010e230b6Smaya   const uint64_t v2_address =
890196c5ddc4Srjs      __gen_address(data, &dw[2], values->MemoryAddress, 0, 2, 63);
890210e230b6Smaya   dw[2] = v2_address;
890310e230b6Smaya   dw[3] = v2_address >> 32;
890410e230b6Smaya}
890510e230b6Smaya
890696c5ddc4Srjs#define GFX9_MI_LOAD_REGISTER_REG_length       3
890796c5ddc4Srjs#define GFX9_MI_LOAD_REGISTER_REG_length_bias      2
890896c5ddc4Srjs#define GFX9_MI_LOAD_REGISTER_REG_header        \
890910e230b6Smaya   .DWordLength                         =      1,  \
891010e230b6Smaya   .MICommandOpcode                     =     42,  \
891110e230b6Smaya   .CommandType                         =      0
891210e230b6Smaya
891396c5ddc4Srjsstruct GFX9_MI_LOAD_REGISTER_REG {
891410e230b6Smaya   uint32_t                             DWordLength;
891510e230b6Smaya   uint32_t                             MICommandOpcode;
891610e230b6Smaya   uint32_t                             CommandType;
891710e230b6Smaya   uint64_t                             SourceRegisterAddress;
891810e230b6Smaya   uint64_t                             DestinationRegisterAddress;
891910e230b6Smaya};
892010e230b6Smaya
892196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
892296c5ddc4SrjsGFX9_MI_LOAD_REGISTER_REG_pack(__attribute__((unused)) __gen_user_data *data,
892310e230b6Smaya                               __attribute__((unused)) void * restrict dst,
892496c5ddc4Srjs                               __attribute__((unused)) const struct GFX9_MI_LOAD_REGISTER_REG * restrict values)
892510e230b6Smaya{
892610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
892710e230b6Smaya
892810e230b6Smaya   dw[0] =
892910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
893010e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
893110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
893210e230b6Smaya
893310e230b6Smaya   dw[1] =
893410e230b6Smaya      __gen_offset(values->SourceRegisterAddress, 2, 22);
893510e230b6Smaya
893610e230b6Smaya   dw[2] =
893710e230b6Smaya      __gen_offset(values->DestinationRegisterAddress, 2, 22);
893810e230b6Smaya}
893910e230b6Smaya
894096c5ddc4Srjs#define GFX9_MI_LOAD_SCAN_LINES_EXCL_length      2
894196c5ddc4Srjs#define GFX9_MI_LOAD_SCAN_LINES_EXCL_length_bias      2
894296c5ddc4Srjs#define GFX9_MI_LOAD_SCAN_LINES_EXCL_header     \
894310e230b6Smaya   .DWordLength                         =      0,  \
894410e230b6Smaya   .MICommandOpcode                     =     19,  \
894510e230b6Smaya   .CommandType                         =      0
894610e230b6Smaya
894796c5ddc4Srjsstruct GFX9_MI_LOAD_SCAN_LINES_EXCL {
894810e230b6Smaya   uint32_t                             DWordLength;
894910e230b6Smaya   uint32_t                             DisplayPlaneSelect;
895010e230b6Smaya#define DisplayPlaneA                            0
895110e230b6Smaya#define DisplayPlaneB                            1
895210e230b6Smaya#define DisplayPlaneC                            4
895310e230b6Smaya   uint32_t                             MICommandOpcode;
895410e230b6Smaya   uint32_t                             CommandType;
895510e230b6Smaya   uint32_t                             EndScanLineNumber;
895610e230b6Smaya   uint32_t                             StartScanLineNumber;
895710e230b6Smaya};
895810e230b6Smaya
895996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
896096c5ddc4SrjsGFX9_MI_LOAD_SCAN_LINES_EXCL_pack(__attribute__((unused)) __gen_user_data *data,
896110e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
896296c5ddc4Srjs                                  __attribute__((unused)) const struct GFX9_MI_LOAD_SCAN_LINES_EXCL * restrict values)
896310e230b6Smaya{
896410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
896510e230b6Smaya
896610e230b6Smaya   dw[0] =
896710e230b6Smaya      __gen_uint(values->DWordLength, 0, 5) |
896810e230b6Smaya      __gen_uint(values->DisplayPlaneSelect, 19, 21) |
896910e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
897010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
897110e230b6Smaya
897210e230b6Smaya   dw[1] =
897310e230b6Smaya      __gen_uint(values->EndScanLineNumber, 0, 12) |
897410e230b6Smaya      __gen_uint(values->StartScanLineNumber, 16, 28);
897510e230b6Smaya}
897610e230b6Smaya
897796c5ddc4Srjs#define GFX9_MI_LOAD_SCAN_LINES_INCL_length      2
897896c5ddc4Srjs#define GFX9_MI_LOAD_SCAN_LINES_INCL_length_bias      2
897996c5ddc4Srjs#define GFX9_MI_LOAD_SCAN_LINES_INCL_header     \
898010e230b6Smaya   .DWordLength                         =      0,  \
898110e230b6Smaya   .MICommandOpcode                     =     18,  \
898210e230b6Smaya   .CommandType                         =      0
898310e230b6Smaya
898496c5ddc4Srjsstruct GFX9_MI_LOAD_SCAN_LINES_INCL {
898510e230b6Smaya   uint32_t                             DWordLength;
898610e230b6Smaya   uint32_t                             ScanLineEventDoneForward;
898710e230b6Smaya   uint32_t                             DisplayPlaneSelect;
898810e230b6Smaya#define DisplayPlane1A                           0
898910e230b6Smaya#define DisplayPlane1B                           1
899010e230b6Smaya#define DisplayPlane1C                           4
899110e230b6Smaya   uint32_t                             MICommandOpcode;
899210e230b6Smaya   uint32_t                             CommandType;
899310e230b6Smaya   uint32_t                             EndScanLineNumber;
899410e230b6Smaya   uint32_t                             StartScanLineNumber;
899510e230b6Smaya};
899610e230b6Smaya
899796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
899896c5ddc4SrjsGFX9_MI_LOAD_SCAN_LINES_INCL_pack(__attribute__((unused)) __gen_user_data *data,
899910e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
900096c5ddc4Srjs                                  __attribute__((unused)) const struct GFX9_MI_LOAD_SCAN_LINES_INCL * restrict values)
900110e230b6Smaya{
900210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
900310e230b6Smaya
900410e230b6Smaya   dw[0] =
900510e230b6Smaya      __gen_uint(values->DWordLength, 0, 5) |
900610e230b6Smaya      __gen_uint(values->ScanLineEventDoneForward, 17, 18) |
900710e230b6Smaya      __gen_uint(values->DisplayPlaneSelect, 19, 21) |
900810e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
900910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
901010e230b6Smaya
901110e230b6Smaya   dw[1] =
901210e230b6Smaya      __gen_uint(values->EndScanLineNumber, 0, 12) |
901310e230b6Smaya      __gen_uint(values->StartScanLineNumber, 16, 28);
901410e230b6Smaya}
901510e230b6Smaya
901696c5ddc4Srjs#define GFX9_MI_LOAD_URB_MEM_length            4
901796c5ddc4Srjs#define GFX9_MI_LOAD_URB_MEM_length_bias       2
901896c5ddc4Srjs#define GFX9_MI_LOAD_URB_MEM_header             \
901910e230b6Smaya   .DWordLength                         =      2,  \
902010e230b6Smaya   .MICommandOpcode                     =     44,  \
902110e230b6Smaya   .CommandType                         =      0
902210e230b6Smaya
902396c5ddc4Srjsstruct GFX9_MI_LOAD_URB_MEM {
902410e230b6Smaya   uint32_t                             DWordLength;
902510e230b6Smaya   uint32_t                             MICommandOpcode;
902610e230b6Smaya   uint32_t                             CommandType;
902710e230b6Smaya   uint32_t                             URBAddress;
902810e230b6Smaya   __gen_address_type                   MemoryAddress;
902910e230b6Smaya};
903010e230b6Smaya
903196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
903296c5ddc4SrjsGFX9_MI_LOAD_URB_MEM_pack(__attribute__((unused)) __gen_user_data *data,
903310e230b6Smaya                          __attribute__((unused)) void * restrict dst,
903496c5ddc4Srjs                          __attribute__((unused)) const struct GFX9_MI_LOAD_URB_MEM * restrict values)
903510e230b6Smaya{
903610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
903710e230b6Smaya
903810e230b6Smaya   dw[0] =
903910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
904010e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
904110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
904210e230b6Smaya
904310e230b6Smaya   dw[1] =
904410e230b6Smaya      __gen_uint(values->URBAddress, 2, 14);
904510e230b6Smaya
904610e230b6Smaya   const uint64_t v2_address =
904796c5ddc4Srjs      __gen_address(data, &dw[2], values->MemoryAddress, 0, 6, 63);
904810e230b6Smaya   dw[2] = v2_address;
904910e230b6Smaya   dw[3] = v2_address >> 32;
905010e230b6Smaya}
905110e230b6Smaya
905296c5ddc4Srjs#define GFX9_MI_MATH_length_bias               2
905396c5ddc4Srjs#define GFX9_MI_MATH_header                     \
905410e230b6Smaya   .DWordLength                         =      0,  \
905510e230b6Smaya   .MICommandOpcode                     =     26,  \
905610e230b6Smaya   .CommandType                         =      0
905710e230b6Smaya
905896c5ddc4Srjsstruct GFX9_MI_MATH {
905910e230b6Smaya   uint32_t                             DWordLength;
906010e230b6Smaya   uint32_t                             MICommandOpcode;
906110e230b6Smaya   uint32_t                             CommandType;
906210e230b6Smaya   /* variable length fields follow */
906310e230b6Smaya};
906410e230b6Smaya
906596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
906696c5ddc4SrjsGFX9_MI_MATH_pack(__attribute__((unused)) __gen_user_data *data,
906710e230b6Smaya                  __attribute__((unused)) void * restrict dst,
906896c5ddc4Srjs                  __attribute__((unused)) const struct GFX9_MI_MATH * restrict values)
906910e230b6Smaya{
907010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
907110e230b6Smaya
907210e230b6Smaya   dw[0] =
907310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
907410e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
907510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
907610e230b6Smaya}
907710e230b6Smaya
907896c5ddc4Srjs#define GFX9_MI_NOOP_length                    1
907996c5ddc4Srjs#define GFX9_MI_NOOP_length_bias               1
908096c5ddc4Srjs#define GFX9_MI_NOOP_header                     \
908110e230b6Smaya   .MICommandOpcode                     =      0,  \
908210e230b6Smaya   .CommandType                         =      0
908310e230b6Smaya
908496c5ddc4Srjsstruct GFX9_MI_NOOP {
908510e230b6Smaya   uint32_t                             IdentificationNumber;
908610e230b6Smaya   bool                                 IdentificationNumberRegisterWriteEnable;
908710e230b6Smaya   uint32_t                             MICommandOpcode;
908810e230b6Smaya   uint32_t                             CommandType;
908910e230b6Smaya};
909010e230b6Smaya
909196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
909296c5ddc4SrjsGFX9_MI_NOOP_pack(__attribute__((unused)) __gen_user_data *data,
909310e230b6Smaya                  __attribute__((unused)) void * restrict dst,
909496c5ddc4Srjs                  __attribute__((unused)) const struct GFX9_MI_NOOP * restrict values)
909510e230b6Smaya{
909610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
909710e230b6Smaya
909810e230b6Smaya   dw[0] =
909910e230b6Smaya      __gen_uint(values->IdentificationNumber, 0, 21) |
910010e230b6Smaya      __gen_uint(values->IdentificationNumberRegisterWriteEnable, 22, 22) |
910110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
910210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
910310e230b6Smaya}
910410e230b6Smaya
910596c5ddc4Srjs#define GFX9_MI_PREDICATE_length               1
910696c5ddc4Srjs#define GFX9_MI_PREDICATE_length_bias          1
910796c5ddc4Srjs#define GFX9_MI_PREDICATE_header                \
910810e230b6Smaya   .MICommandOpcode                     =     12,  \
910910e230b6Smaya   .CommandType                         =      0
911010e230b6Smaya
911196c5ddc4Srjsstruct GFX9_MI_PREDICATE {
911210e230b6Smaya   uint32_t                             CompareOperation;
911310e230b6Smaya#define COMPARE_TRUE                             0
911410e230b6Smaya#define COMPARE_FALSE                            1
911510e230b6Smaya#define COMPARE_SRCS_EQUAL                       2
911610e230b6Smaya#define COMPARE_DELTAS_EQUAL                     3
911710e230b6Smaya   uint32_t                             CombineOperation;
911810e230b6Smaya#define COMBINE_SET                              0
911910e230b6Smaya#define COMBINE_AND                              1
912010e230b6Smaya#define COMBINE_OR                               2
912110e230b6Smaya#define COMBINE_XOR                              3
912210e230b6Smaya   uint32_t                             LoadOperation;
912310e230b6Smaya#define LOAD_KEEP                                0
912410e230b6Smaya#define LOAD_LOAD                                2
912510e230b6Smaya#define LOAD_LOADINV                             3
912610e230b6Smaya   uint32_t                             MICommandOpcode;
912710e230b6Smaya   uint32_t                             CommandType;
912810e230b6Smaya};
912910e230b6Smaya
913096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
913196c5ddc4SrjsGFX9_MI_PREDICATE_pack(__attribute__((unused)) __gen_user_data *data,
913210e230b6Smaya                       __attribute__((unused)) void * restrict dst,
913396c5ddc4Srjs                       __attribute__((unused)) const struct GFX9_MI_PREDICATE * restrict values)
913410e230b6Smaya{
913510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
913610e230b6Smaya
913710e230b6Smaya   dw[0] =
913810e230b6Smaya      __gen_uint(values->CompareOperation, 0, 1) |
913910e230b6Smaya      __gen_uint(values->CombineOperation, 3, 4) |
914010e230b6Smaya      __gen_uint(values->LoadOperation, 6, 7) |
914110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
914210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
914310e230b6Smaya}
914410e230b6Smaya
914596c5ddc4Srjs#define GFX9_MI_REPORT_HEAD_length             1
914696c5ddc4Srjs#define GFX9_MI_REPORT_HEAD_length_bias        1
914796c5ddc4Srjs#define GFX9_MI_REPORT_HEAD_header              \
914810e230b6Smaya   .MICommandOpcode                     =      7,  \
914910e230b6Smaya   .CommandType                         =      0
915010e230b6Smaya
915196c5ddc4Srjsstruct GFX9_MI_REPORT_HEAD {
915210e230b6Smaya   uint32_t                             MICommandOpcode;
915310e230b6Smaya   uint32_t                             CommandType;
915410e230b6Smaya};
915510e230b6Smaya
915696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
915796c5ddc4SrjsGFX9_MI_REPORT_HEAD_pack(__attribute__((unused)) __gen_user_data *data,
915810e230b6Smaya                         __attribute__((unused)) void * restrict dst,
915996c5ddc4Srjs                         __attribute__((unused)) const struct GFX9_MI_REPORT_HEAD * restrict values)
916010e230b6Smaya{
916110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
916210e230b6Smaya
916310e230b6Smaya   dw[0] =
916410e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
916510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
916610e230b6Smaya}
916710e230b6Smaya
916896c5ddc4Srjs#define GFX9_MI_REPORT_PERF_COUNT_length       4
916996c5ddc4Srjs#define GFX9_MI_REPORT_PERF_COUNT_length_bias      2
917096c5ddc4Srjs#define GFX9_MI_REPORT_PERF_COUNT_header        \
917110e230b6Smaya   .DWordLength                         =      2,  \
917210e230b6Smaya   .MICommandOpcode                     =     40,  \
917310e230b6Smaya   .CommandType                         =      0
917410e230b6Smaya
917596c5ddc4Srjsstruct GFX9_MI_REPORT_PERF_COUNT {
917610e230b6Smaya   uint32_t                             DWordLength;
917710e230b6Smaya   uint32_t                             MICommandOpcode;
917810e230b6Smaya   uint32_t                             CommandType;
917910e230b6Smaya   bool                                 UseGlobalGTT;
918010e230b6Smaya   uint32_t                             CoreModeEnable;
918110e230b6Smaya   __gen_address_type                   MemoryAddress;
918210e230b6Smaya   uint32_t                             ReportID;
918310e230b6Smaya};
918410e230b6Smaya
918596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
918696c5ddc4SrjsGFX9_MI_REPORT_PERF_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
918710e230b6Smaya                               __attribute__((unused)) void * restrict dst,
918896c5ddc4Srjs                               __attribute__((unused)) const struct GFX9_MI_REPORT_PERF_COUNT * restrict values)
918910e230b6Smaya{
919010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
919110e230b6Smaya
919210e230b6Smaya   dw[0] =
919310e230b6Smaya      __gen_uint(values->DWordLength, 0, 5) |
919410e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
919510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
919610e230b6Smaya
919710e230b6Smaya   const uint64_t v1 =
919810e230b6Smaya      __gen_uint(values->UseGlobalGTT, 0, 0) |
919910e230b6Smaya      __gen_uint(values->CoreModeEnable, 4, 4);
920010e230b6Smaya   const uint64_t v1_address =
920196c5ddc4Srjs      __gen_address(data, &dw[1], values->MemoryAddress, v1, 6, 63);
920210e230b6Smaya   dw[1] = v1_address;
920310e230b6Smaya   dw[2] = (v1_address >> 32) | (v1 >> 32);
920410e230b6Smaya
920510e230b6Smaya   dw[3] =
920610e230b6Smaya      __gen_uint(values->ReportID, 0, 31);
920710e230b6Smaya}
920810e230b6Smaya
920996c5ddc4Srjs#define GFX9_MI_RS_CONTEXT_length              1
921096c5ddc4Srjs#define GFX9_MI_RS_CONTEXT_length_bias         1
921196c5ddc4Srjs#define GFX9_MI_RS_CONTEXT_header               \
921210e230b6Smaya   .MICommandOpcode                     =     15,  \
921310e230b6Smaya   .CommandType                         =      0
921410e230b6Smaya
921596c5ddc4Srjsstruct GFX9_MI_RS_CONTEXT {
921610e230b6Smaya   uint32_t                             ResourceStreamerSave;
921710e230b6Smaya#define RS_Restore                               0
921810e230b6Smaya#define RS_Save                                  1
921910e230b6Smaya   uint32_t                             MICommandOpcode;
922010e230b6Smaya   uint32_t                             CommandType;
922110e230b6Smaya};
922210e230b6Smaya
922396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
922496c5ddc4SrjsGFX9_MI_RS_CONTEXT_pack(__attribute__((unused)) __gen_user_data *data,
922510e230b6Smaya                        __attribute__((unused)) void * restrict dst,
922696c5ddc4Srjs                        __attribute__((unused)) const struct GFX9_MI_RS_CONTEXT * restrict values)
922710e230b6Smaya{
922810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
922910e230b6Smaya
923010e230b6Smaya   dw[0] =
923110e230b6Smaya      __gen_uint(values->ResourceStreamerSave, 0, 0) |
923210e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
923310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
923410e230b6Smaya}
923510e230b6Smaya
923696c5ddc4Srjs#define GFX9_MI_RS_CONTROL_length              1
923796c5ddc4Srjs#define GFX9_MI_RS_CONTROL_length_bias         1
923896c5ddc4Srjs#define GFX9_MI_RS_CONTROL_header               \
923910e230b6Smaya   .MICommandOpcode                     =      6,  \
924010e230b6Smaya   .CommandType                         =      0
924110e230b6Smaya
924296c5ddc4Srjsstruct GFX9_MI_RS_CONTROL {
924310e230b6Smaya   uint32_t                             ResourceStreamerControl;
924410e230b6Smaya#define RS_Stop                                  0
924510e230b6Smaya#define RS_Start                                 1
924610e230b6Smaya   uint32_t                             MICommandOpcode;
924710e230b6Smaya   uint32_t                             CommandType;
924810e230b6Smaya};
924910e230b6Smaya
925096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
925196c5ddc4SrjsGFX9_MI_RS_CONTROL_pack(__attribute__((unused)) __gen_user_data *data,
925210e230b6Smaya                        __attribute__((unused)) void * restrict dst,
925396c5ddc4Srjs                        __attribute__((unused)) const struct GFX9_MI_RS_CONTROL * restrict values)
925410e230b6Smaya{
925510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
925610e230b6Smaya
925710e230b6Smaya   dw[0] =
925810e230b6Smaya      __gen_uint(values->ResourceStreamerControl, 0, 0) |
925910e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
926010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
926110e230b6Smaya}
926210e230b6Smaya
926396c5ddc4Srjs#define GFX9_MI_RS_STORE_DATA_IMM_length       4
926496c5ddc4Srjs#define GFX9_MI_RS_STORE_DATA_IMM_length_bias      2
926596c5ddc4Srjs#define GFX9_MI_RS_STORE_DATA_IMM_header        \
926610e230b6Smaya   .DWordLength                         =      2,  \
926710e230b6Smaya   .MICommandOpcode                     =     43,  \
926810e230b6Smaya   .CommandType                         =      0
926910e230b6Smaya
927096c5ddc4Srjsstruct GFX9_MI_RS_STORE_DATA_IMM {
927110e230b6Smaya   uint32_t                             DWordLength;
927210e230b6Smaya   uint32_t                             MICommandOpcode;
927310e230b6Smaya   uint32_t                             CommandType;
927410e230b6Smaya   uint32_t                             CoreModeEnable;
927510e230b6Smaya   __gen_address_type                   DestinationAddress;
927610e230b6Smaya   uint32_t                             DataDWord0;
927710e230b6Smaya};
927810e230b6Smaya
927996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
928096c5ddc4SrjsGFX9_MI_RS_STORE_DATA_IMM_pack(__attribute__((unused)) __gen_user_data *data,
928110e230b6Smaya                               __attribute__((unused)) void * restrict dst,
928296c5ddc4Srjs                               __attribute__((unused)) const struct GFX9_MI_RS_STORE_DATA_IMM * restrict values)
928310e230b6Smaya{
928410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
928510e230b6Smaya
928610e230b6Smaya   dw[0] =
928710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
928810e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
928910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
929010e230b6Smaya
929110e230b6Smaya   const uint64_t v1 =
929210e230b6Smaya      __gen_uint(values->CoreModeEnable, 0, 0);
929310e230b6Smaya   const uint64_t v1_address =
929496c5ddc4Srjs      __gen_address(data, &dw[1], values->DestinationAddress, v1, 2, 63);
929510e230b6Smaya   dw[1] = v1_address;
929610e230b6Smaya   dw[2] = (v1_address >> 32) | (v1 >> 32);
929710e230b6Smaya
929810e230b6Smaya   dw[3] =
929910e230b6Smaya      __gen_uint(values->DataDWord0, 0, 31);
930010e230b6Smaya}
930110e230b6Smaya
930296c5ddc4Srjs#define GFX9_MI_SEMAPHORE_SIGNAL_length        2
930396c5ddc4Srjs#define GFX9_MI_SEMAPHORE_SIGNAL_length_bias      2
930496c5ddc4Srjs#define GFX9_MI_SEMAPHORE_SIGNAL_header         \
930510e230b6Smaya   .DWordLength                         =      0,  \
930610e230b6Smaya   .MICommandOpcode                     =     27,  \
930710e230b6Smaya   .CommandType                         =      0
930810e230b6Smaya
930996c5ddc4Srjsstruct GFX9_MI_SEMAPHORE_SIGNAL {
931010e230b6Smaya   uint32_t                             DWordLength;
931110e230b6Smaya   uint32_t                             TargetEngineSelect;
931210e230b6Smaya#define RCS                                      0
931310e230b6Smaya#define VCS0                                     1
931410e230b6Smaya#define BCS                                      2
931510e230b6Smaya#define VECS                                     3
931610e230b6Smaya#define VCS1                                     4
931710e230b6Smaya   bool                                 PostSyncOperation;
931810e230b6Smaya   uint32_t                             MICommandOpcode;
931910e230b6Smaya   uint32_t                             CommandType;
932010e230b6Smaya   uint32_t                             TargetContextID;
932110e230b6Smaya};
932210e230b6Smaya
932396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
932496c5ddc4SrjsGFX9_MI_SEMAPHORE_SIGNAL_pack(__attribute__((unused)) __gen_user_data *data,
932510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
932696c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_MI_SEMAPHORE_SIGNAL * restrict values)
932710e230b6Smaya{
932810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
932910e230b6Smaya
933010e230b6Smaya   dw[0] =
933110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
933210e230b6Smaya      __gen_uint(values->TargetEngineSelect, 15, 17) |
933310e230b6Smaya      __gen_uint(values->PostSyncOperation, 21, 21) |
933410e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
933510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
933610e230b6Smaya
933710e230b6Smaya   dw[1] =
933810e230b6Smaya      __gen_uint(values->TargetContextID, 0, 31);
933910e230b6Smaya}
934010e230b6Smaya
934196c5ddc4Srjs#define GFX9_MI_SEMAPHORE_WAIT_length          4
934296c5ddc4Srjs#define GFX9_MI_SEMAPHORE_WAIT_length_bias      2
934396c5ddc4Srjs#define GFX9_MI_SEMAPHORE_WAIT_header           \
934410e230b6Smaya   .DWordLength                         =      2,  \
934510e230b6Smaya   .MICommandOpcode                     =     28,  \
934610e230b6Smaya   .CommandType                         =      0
934710e230b6Smaya
934896c5ddc4Srjsstruct GFX9_MI_SEMAPHORE_WAIT {
934910e230b6Smaya   uint32_t                             DWordLength;
935010e230b6Smaya   uint32_t                             CompareOperation;
935110e230b6Smaya#define COMPARE_SAD_GREATER_THAN_SDD             0
935210e230b6Smaya#define COMPARE_SAD_GREATER_THAN_OR_EQUAL_SDD    1
935310e230b6Smaya#define COMPARE_SAD_LESS_THAN_SDD                2
935410e230b6Smaya#define COMPARE_SAD_LESS_THAN_OR_EQUAL_SDD       3
935510e230b6Smaya#define COMPARE_SAD_EQUAL_SDD                    4
935610e230b6Smaya#define COMPARE_SAD_NOT_EQUAL_SDD                5
935710e230b6Smaya   uint32_t                             WaitMode;
935810e230b6Smaya#define PollingMode                              1
935910e230b6Smaya#define SignalMode                               0
936010e230b6Smaya   bool                                 RegisterPollMode;
936110e230b6Smaya   uint32_t                             MemoryType;
936210e230b6Smaya#define PerProcessGraphicsAddress                0
936310e230b6Smaya#define GlobalGraphicsAddress                    1
936410e230b6Smaya   uint32_t                             MICommandOpcode;
936510e230b6Smaya   uint32_t                             CommandType;
936610e230b6Smaya   uint32_t                             SemaphoreDataDword;
936710e230b6Smaya   __gen_address_type                   SemaphoreAddress;
936810e230b6Smaya};
936910e230b6Smaya
937096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
937196c5ddc4SrjsGFX9_MI_SEMAPHORE_WAIT_pack(__attribute__((unused)) __gen_user_data *data,
937210e230b6Smaya                            __attribute__((unused)) void * restrict dst,
937396c5ddc4Srjs                            __attribute__((unused)) const struct GFX9_MI_SEMAPHORE_WAIT * restrict values)
937410e230b6Smaya{
937510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
937610e230b6Smaya
937710e230b6Smaya   dw[0] =
937810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
937910e230b6Smaya      __gen_uint(values->CompareOperation, 12, 14) |
938010e230b6Smaya      __gen_uint(values->WaitMode, 15, 15) |
938110e230b6Smaya      __gen_uint(values->RegisterPollMode, 16, 16) |
938210e230b6Smaya      __gen_uint(values->MemoryType, 22, 22) |
938310e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
938410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
938510e230b6Smaya
938610e230b6Smaya   dw[1] =
938710e230b6Smaya      __gen_uint(values->SemaphoreDataDword, 0, 31);
938810e230b6Smaya
938910e230b6Smaya   const uint64_t v2_address =
939096c5ddc4Srjs      __gen_address(data, &dw[2], values->SemaphoreAddress, 0, 2, 63);
939110e230b6Smaya   dw[2] = v2_address;
939210e230b6Smaya   dw[3] = v2_address >> 32;
939310e230b6Smaya}
939410e230b6Smaya
939596c5ddc4Srjs#define GFX9_MI_SET_CONTEXT_length             2
939696c5ddc4Srjs#define GFX9_MI_SET_CONTEXT_length_bias        2
939796c5ddc4Srjs#define GFX9_MI_SET_CONTEXT_header              \
939810e230b6Smaya   .DWordLength                         =      0,  \
939910e230b6Smaya   .MICommandOpcode                     =     24,  \
940010e230b6Smaya   .CommandType                         =      0
940110e230b6Smaya
940296c5ddc4Srjsstruct GFX9_MI_SET_CONTEXT {
940310e230b6Smaya   uint32_t                             DWordLength;
940410e230b6Smaya   uint32_t                             MICommandOpcode;
940510e230b6Smaya   uint32_t                             CommandType;
940610e230b6Smaya   uint32_t                             RestoreInhibit;
940710e230b6Smaya   uint32_t                             ForceRestore;
940810e230b6Smaya   bool                                 ResourceStreamerStateRestoreEnable;
940910e230b6Smaya   bool                                 ResourceStreamerStateSaveEnable;
941010e230b6Smaya   bool                                 CoreModeEnable;
941110e230b6Smaya   uint32_t                             ReservedMustbe1;
941210e230b6Smaya   __gen_address_type                   LogicalContextAddress;
941310e230b6Smaya};
941410e230b6Smaya
941596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
941696c5ddc4SrjsGFX9_MI_SET_CONTEXT_pack(__attribute__((unused)) __gen_user_data *data,
941710e230b6Smaya                         __attribute__((unused)) void * restrict dst,
941896c5ddc4Srjs                         __attribute__((unused)) const struct GFX9_MI_SET_CONTEXT * restrict values)
941910e230b6Smaya{
942010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
942110e230b6Smaya
942210e230b6Smaya   dw[0] =
942310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
942410e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
942510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
942610e230b6Smaya
942710e230b6Smaya   const uint32_t v1 =
942810e230b6Smaya      __gen_uint(values->RestoreInhibit, 0, 0) |
942910e230b6Smaya      __gen_uint(values->ForceRestore, 1, 1) |
943010e230b6Smaya      __gen_uint(values->ResourceStreamerStateRestoreEnable, 2, 2) |
943110e230b6Smaya      __gen_uint(values->ResourceStreamerStateSaveEnable, 3, 3) |
943210e230b6Smaya      __gen_uint(values->CoreModeEnable, 4, 4) |
943310e230b6Smaya      __gen_uint(values->ReservedMustbe1, 8, 8);
943496c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->LogicalContextAddress, v1, 12, 31);
943510e230b6Smaya}
943610e230b6Smaya
943796c5ddc4Srjs#define GFX9_MI_SET_PREDICATE_length           1
943896c5ddc4Srjs#define GFX9_MI_SET_PREDICATE_length_bias      1
943996c5ddc4Srjs#define GFX9_MI_SET_PREDICATE_header            \
944010e230b6Smaya   .MICommandOpcode                     =      1,  \
944110e230b6Smaya   .CommandType                         =      0
944210e230b6Smaya
944396c5ddc4Srjsstruct GFX9_MI_SET_PREDICATE {
944410e230b6Smaya   uint32_t                             PREDICATEENABLE;
944510e230b6Smaya#define NOOPNever                                0
944610e230b6Smaya#define NOOPonResult2clear                       1
944710e230b6Smaya#define NOOPonResult2set                         2
944810e230b6Smaya#define NOOPonResultclear                        3
944910e230b6Smaya#define NOOPonResultset                          4
945010e230b6Smaya#define Executewhenonesliceenabled               5
945110e230b6Smaya#define Executewhentwoslicesareenabled           6
945210e230b6Smaya#define Executewhenthreeslicesareenabled         7
945310e230b6Smaya#define NOOPAlways                               15
945410e230b6Smaya   uint32_t                             MICommandOpcode;
945510e230b6Smaya   uint32_t                             CommandType;
945610e230b6Smaya};
945710e230b6Smaya
945896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
945996c5ddc4SrjsGFX9_MI_SET_PREDICATE_pack(__attribute__((unused)) __gen_user_data *data,
946010e230b6Smaya                           __attribute__((unused)) void * restrict dst,
946196c5ddc4Srjs                           __attribute__((unused)) const struct GFX9_MI_SET_PREDICATE * restrict values)
946210e230b6Smaya{
946310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
946410e230b6Smaya
946510e230b6Smaya   dw[0] =
946610e230b6Smaya      __gen_uint(values->PREDICATEENABLE, 0, 3) |
946710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
946810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
946910e230b6Smaya}
947010e230b6Smaya
947196c5ddc4Srjs#define GFX9_MI_STORE_DATA_IMM_length          4
947296c5ddc4Srjs#define GFX9_MI_STORE_DATA_IMM_length_bias      2
947396c5ddc4Srjs#define GFX9_MI_STORE_DATA_IMM_header           \
947410e230b6Smaya   .DWordLength                         =      2,  \
947510e230b6Smaya   .MICommandOpcode                     =     32,  \
947610e230b6Smaya   .CommandType                         =      0
947710e230b6Smaya
947896c5ddc4Srjsstruct GFX9_MI_STORE_DATA_IMM {
947910e230b6Smaya   uint32_t                             DWordLength;
948010e230b6Smaya   uint32_t                             StoreQword;
948110e230b6Smaya   bool                                 UseGlobalGTT;
948210e230b6Smaya   uint32_t                             MICommandOpcode;
948310e230b6Smaya   uint32_t                             CommandType;
948410e230b6Smaya   uint32_t                             CoreModeEnable;
948510e230b6Smaya   __gen_address_type                   Address;
948610e230b6Smaya   uint64_t                             ImmediateData;
948710e230b6Smaya};
948810e230b6Smaya
948996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
949096c5ddc4SrjsGFX9_MI_STORE_DATA_IMM_pack(__attribute__((unused)) __gen_user_data *data,
949110e230b6Smaya                            __attribute__((unused)) void * restrict dst,
949296c5ddc4Srjs                            __attribute__((unused)) const struct GFX9_MI_STORE_DATA_IMM * restrict values)
949310e230b6Smaya{
949410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
949510e230b6Smaya
949610e230b6Smaya   dw[0] =
949710e230b6Smaya      __gen_uint(values->DWordLength, 0, 9) |
949810e230b6Smaya      __gen_uint(values->StoreQword, 21, 21) |
949910e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
950010e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
950110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
950210e230b6Smaya
950310e230b6Smaya   const uint64_t v1 =
950410e230b6Smaya      __gen_uint(values->CoreModeEnable, 0, 0);
950510e230b6Smaya   const uint64_t v1_address =
950696c5ddc4Srjs      __gen_address(data, &dw[1], values->Address, v1, 2, 47);
950710e230b6Smaya   dw[1] = v1_address;
950810e230b6Smaya   dw[2] = (v1_address >> 32) | (v1 >> 32);
950910e230b6Smaya
951010e230b6Smaya   const uint64_t v3 =
951110e230b6Smaya      __gen_uint(values->ImmediateData, 0, 63);
951210e230b6Smaya   dw[3] = v3;
951310e230b6Smaya   dw[4] = v3 >> 32;
951410e230b6Smaya}
951510e230b6Smaya
951696c5ddc4Srjs#define GFX9_MI_STORE_DATA_INDEX_length        3
951796c5ddc4Srjs#define GFX9_MI_STORE_DATA_INDEX_length_bias      2
951896c5ddc4Srjs#define GFX9_MI_STORE_DATA_INDEX_header         \
951910e230b6Smaya   .DWordLength                         =      1,  \
952010e230b6Smaya   .MICommandOpcode                     =     33,  \
952110e230b6Smaya   .CommandType                         =      0
952210e230b6Smaya
952396c5ddc4Srjsstruct GFX9_MI_STORE_DATA_INDEX {
952410e230b6Smaya   uint32_t                             DWordLength;
952510e230b6Smaya   uint32_t                             UsePerProcessHardwareStatusPage;
952610e230b6Smaya   uint32_t                             MICommandOpcode;
952710e230b6Smaya   uint32_t                             CommandType;
952810e230b6Smaya   uint32_t                             Offset;
952910e230b6Smaya   uint32_t                             DataDWord0;
953010e230b6Smaya   uint32_t                             DataDWord1;
953110e230b6Smaya};
953210e230b6Smaya
953396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
953496c5ddc4SrjsGFX9_MI_STORE_DATA_INDEX_pack(__attribute__((unused)) __gen_user_data *data,
953510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
953696c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_MI_STORE_DATA_INDEX * restrict values)
953710e230b6Smaya{
953810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
953910e230b6Smaya
954010e230b6Smaya   dw[0] =
954110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
954210e230b6Smaya      __gen_uint(values->UsePerProcessHardwareStatusPage, 21, 21) |
954310e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
954410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
954510e230b6Smaya
954610e230b6Smaya   dw[1] =
954710e230b6Smaya      __gen_uint(values->Offset, 2, 11);
954810e230b6Smaya
954910e230b6Smaya   dw[2] =
955010e230b6Smaya      __gen_uint(values->DataDWord0, 0, 31);
955110e230b6Smaya}
955210e230b6Smaya
955396c5ddc4Srjs#define GFX9_MI_STORE_REGISTER_MEM_length      4
955496c5ddc4Srjs#define GFX9_MI_STORE_REGISTER_MEM_length_bias      2
955596c5ddc4Srjs#define GFX9_MI_STORE_REGISTER_MEM_header       \
955610e230b6Smaya   .DWordLength                         =      2,  \
955710e230b6Smaya   .MICommandOpcode                     =     36,  \
955810e230b6Smaya   .CommandType                         =      0
955910e230b6Smaya
956096c5ddc4Srjsstruct GFX9_MI_STORE_REGISTER_MEM {
956110e230b6Smaya   uint32_t                             DWordLength;
956210e230b6Smaya   bool                                 PredicateEnable;
956310e230b6Smaya   bool                                 UseGlobalGTT;
956410e230b6Smaya   uint32_t                             MICommandOpcode;
956510e230b6Smaya   uint32_t                             CommandType;
956610e230b6Smaya   uint64_t                             RegisterAddress;
956710e230b6Smaya   __gen_address_type                   MemoryAddress;
956810e230b6Smaya};
956910e230b6Smaya
957096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
957196c5ddc4SrjsGFX9_MI_STORE_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
957210e230b6Smaya                                __attribute__((unused)) void * restrict dst,
957396c5ddc4Srjs                                __attribute__((unused)) const struct GFX9_MI_STORE_REGISTER_MEM * restrict values)
957410e230b6Smaya{
957510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
957610e230b6Smaya
957710e230b6Smaya   dw[0] =
957810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
957910e230b6Smaya      __gen_uint(values->PredicateEnable, 21, 21) |
958010e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
958110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
958210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
958310e230b6Smaya
958410e230b6Smaya   dw[1] =
958510e230b6Smaya      __gen_offset(values->RegisterAddress, 2, 22);
958610e230b6Smaya
958710e230b6Smaya   const uint64_t v2_address =
958896c5ddc4Srjs      __gen_address(data, &dw[2], values->MemoryAddress, 0, 2, 63);
958910e230b6Smaya   dw[2] = v2_address;
959010e230b6Smaya   dw[3] = v2_address >> 32;
959110e230b6Smaya}
959210e230b6Smaya
959396c5ddc4Srjs#define GFX9_MI_STORE_URB_MEM_length           4
959496c5ddc4Srjs#define GFX9_MI_STORE_URB_MEM_length_bias      2
959596c5ddc4Srjs#define GFX9_MI_STORE_URB_MEM_header            \
959610e230b6Smaya   .DWordLength                         =      2,  \
959710e230b6Smaya   .MICommandOpcode                     =     45,  \
959810e230b6Smaya   .CommandType                         =      0
959910e230b6Smaya
960096c5ddc4Srjsstruct GFX9_MI_STORE_URB_MEM {
960110e230b6Smaya   uint32_t                             DWordLength;
960210e230b6Smaya   uint32_t                             MICommandOpcode;
960310e230b6Smaya   uint32_t                             CommandType;
960410e230b6Smaya   uint32_t                             URBAddress;
960510e230b6Smaya   __gen_address_type                   MemoryAddress;
960610e230b6Smaya};
960710e230b6Smaya
960896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
960996c5ddc4SrjsGFX9_MI_STORE_URB_MEM_pack(__attribute__((unused)) __gen_user_data *data,
961010e230b6Smaya                           __attribute__((unused)) void * restrict dst,
961196c5ddc4Srjs                           __attribute__((unused)) const struct GFX9_MI_STORE_URB_MEM * restrict values)
961210e230b6Smaya{
961310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
961410e230b6Smaya
961510e230b6Smaya   dw[0] =
961610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
961710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
961810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
961910e230b6Smaya
962010e230b6Smaya   dw[1] =
962110e230b6Smaya      __gen_uint(values->URBAddress, 2, 14);
962210e230b6Smaya
962310e230b6Smaya   const uint64_t v2_address =
962496c5ddc4Srjs      __gen_address(data, &dw[2], values->MemoryAddress, 0, 6, 63);
962510e230b6Smaya   dw[2] = v2_address;
962610e230b6Smaya   dw[3] = v2_address >> 32;
962710e230b6Smaya}
962810e230b6Smaya
962996c5ddc4Srjs#define GFX9_MI_SUSPEND_FLUSH_length           1
963096c5ddc4Srjs#define GFX9_MI_SUSPEND_FLUSH_length_bias      1
963196c5ddc4Srjs#define GFX9_MI_SUSPEND_FLUSH_header            \
963210e230b6Smaya   .MICommandOpcode                     =     11,  \
963310e230b6Smaya   .CommandType                         =      0
963410e230b6Smaya
963596c5ddc4Srjsstruct GFX9_MI_SUSPEND_FLUSH {
963610e230b6Smaya   bool                                 SuspendFlush;
963710e230b6Smaya   uint32_t                             MICommandOpcode;
963810e230b6Smaya   uint32_t                             CommandType;
963910e230b6Smaya};
964010e230b6Smaya
964196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
964296c5ddc4SrjsGFX9_MI_SUSPEND_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
964310e230b6Smaya                           __attribute__((unused)) void * restrict dst,
964496c5ddc4Srjs                           __attribute__((unused)) const struct GFX9_MI_SUSPEND_FLUSH * restrict values)
964510e230b6Smaya{
964610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
964710e230b6Smaya
964810e230b6Smaya   dw[0] =
964910e230b6Smaya      __gen_uint(values->SuspendFlush, 0, 0) |
965010e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
965110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
965210e230b6Smaya}
965310e230b6Smaya
965496c5ddc4Srjs#define GFX9_MI_TOPOLOGY_FILTER_length         1
965596c5ddc4Srjs#define GFX9_MI_TOPOLOGY_FILTER_length_bias      1
965696c5ddc4Srjs#define GFX9_MI_TOPOLOGY_FILTER_header          \
965710e230b6Smaya   .MICommandOpcode                     =     13,  \
965810e230b6Smaya   .CommandType                         =      0
965910e230b6Smaya
966096c5ddc4Srjsstruct GFX9_MI_TOPOLOGY_FILTER {
966196c5ddc4Srjs   enum GFX9_3D_Prim_Topo_Type          TopologyFilterValue;
966210e230b6Smaya   uint32_t                             MICommandOpcode;
966310e230b6Smaya   uint32_t                             CommandType;
966410e230b6Smaya};
966510e230b6Smaya
966696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
966796c5ddc4SrjsGFX9_MI_TOPOLOGY_FILTER_pack(__attribute__((unused)) __gen_user_data *data,
966810e230b6Smaya                             __attribute__((unused)) void * restrict dst,
966996c5ddc4Srjs                             __attribute__((unused)) const struct GFX9_MI_TOPOLOGY_FILTER * restrict values)
967010e230b6Smaya{
967110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
967210e230b6Smaya
967310e230b6Smaya   dw[0] =
967410e230b6Smaya      __gen_uint(values->TopologyFilterValue, 0, 5) |
967510e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
967610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
967710e230b6Smaya}
967810e230b6Smaya
967996c5ddc4Srjs#define GFX9_MI_URB_ATOMIC_ALLOC_length        1
968096c5ddc4Srjs#define GFX9_MI_URB_ATOMIC_ALLOC_length_bias      1
968196c5ddc4Srjs#define GFX9_MI_URB_ATOMIC_ALLOC_header         \
968210e230b6Smaya   .MICommandOpcode                     =      9,  \
968310e230b6Smaya   .CommandType                         =      0
968410e230b6Smaya
968596c5ddc4Srjsstruct GFX9_MI_URB_ATOMIC_ALLOC {
968610e230b6Smaya   uint32_t                             URBAtomicStorageSize;
968710e230b6Smaya   uint32_t                             URBAtomicStorageOffset;
968810e230b6Smaya   uint32_t                             MICommandOpcode;
968910e230b6Smaya   uint32_t                             CommandType;
969010e230b6Smaya};
969110e230b6Smaya
969296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
969396c5ddc4SrjsGFX9_MI_URB_ATOMIC_ALLOC_pack(__attribute__((unused)) __gen_user_data *data,
969410e230b6Smaya                              __attribute__((unused)) void * restrict dst,
969596c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_MI_URB_ATOMIC_ALLOC * restrict values)
969610e230b6Smaya{
969710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
969810e230b6Smaya
969910e230b6Smaya   dw[0] =
970010e230b6Smaya      __gen_uint(values->URBAtomicStorageSize, 0, 8) |
970110e230b6Smaya      __gen_uint(values->URBAtomicStorageOffset, 12, 19) |
970210e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
970310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
970410e230b6Smaya}
970510e230b6Smaya
970696c5ddc4Srjs#define GFX9_MI_USER_INTERRUPT_length          1
970796c5ddc4Srjs#define GFX9_MI_USER_INTERRUPT_length_bias      1
970896c5ddc4Srjs#define GFX9_MI_USER_INTERRUPT_header           \
970910e230b6Smaya   .MICommandOpcode                     =      2,  \
971010e230b6Smaya   .CommandType                         =      0
971110e230b6Smaya
971296c5ddc4Srjsstruct GFX9_MI_USER_INTERRUPT {
971310e230b6Smaya   uint32_t                             MICommandOpcode;
971410e230b6Smaya   uint32_t                             CommandType;
971510e230b6Smaya};
971610e230b6Smaya
971796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
971896c5ddc4SrjsGFX9_MI_USER_INTERRUPT_pack(__attribute__((unused)) __gen_user_data *data,
971910e230b6Smaya                            __attribute__((unused)) void * restrict dst,
972096c5ddc4Srjs                            __attribute__((unused)) const struct GFX9_MI_USER_INTERRUPT * restrict values)
972110e230b6Smaya{
972210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
972310e230b6Smaya
972410e230b6Smaya   dw[0] =
972510e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
972610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
972710e230b6Smaya}
972810e230b6Smaya
972996c5ddc4Srjs#define GFX9_MI_WAIT_FOR_EVENT_length          1
973096c5ddc4Srjs#define GFX9_MI_WAIT_FOR_EVENT_length_bias      1
973196c5ddc4Srjs#define GFX9_MI_WAIT_FOR_EVENT_header           \
973210e230b6Smaya   .MICommandOpcode                     =      3,  \
973310e230b6Smaya   .CommandType                         =      0
973410e230b6Smaya
973596c5ddc4Srjsstruct GFX9_MI_WAIT_FOR_EVENT {
973610e230b6Smaya   bool                                 DisplayPlnae1AScanLineWaitEnable;
973710e230b6Smaya   bool                                 DisplayPlane1FlipPendingWaitEnable;
973810e230b6Smaya   bool                                 DisplayPlane4FlipPendingWaitEnable;
973910e230b6Smaya   bool                                 DisplayPlane1AVerticalBlankWaitEnable;
974010e230b6Smaya   bool                                 DisplayPlane7FlipPendingWaitEnable;
974110e230b6Smaya   bool                                 DisplayPlane8FlipPendingWaitEnable;
974210e230b6Smaya   bool                                 DisplayPlane1BScanLineWaitEnable;
974310e230b6Smaya   bool                                 DisplayPlane2FlipPendingWaitEnable;
974410e230b6Smaya   bool                                 DisplayPlane5FlipPendingWaitEnable;
974510e230b6Smaya   bool                                 DisplayPlane1BVerticalBlankWaitEnable;
974610e230b6Smaya   bool                                 DisplayPlane1CScanLineWaitEnable;
974710e230b6Smaya   bool                                 DisplayPlane3FlipPendingWaitEnable;
974810e230b6Smaya   bool                                 DisplayPlane9FlipPendingWaitEnable;
974910e230b6Smaya   bool                                 DisplayPlane10FlipPendingWaitEnable;
975010e230b6Smaya   bool                                 DisplayPlane11FlipPendingWaitEnable;
975110e230b6Smaya   bool                                 DisplayPlane12FlipPendingWaitEnable;
975210e230b6Smaya   bool                                 DisplayPlane6FlipPendingWaitEnable;
975310e230b6Smaya   bool                                 DisplayPlane1CVerticalBlankWaitEnable;
975410e230b6Smaya   uint32_t                             MICommandOpcode;
975510e230b6Smaya   uint32_t                             CommandType;
975610e230b6Smaya};
975710e230b6Smaya
975896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
975996c5ddc4SrjsGFX9_MI_WAIT_FOR_EVENT_pack(__attribute__((unused)) __gen_user_data *data,
976010e230b6Smaya                            __attribute__((unused)) void * restrict dst,
976196c5ddc4Srjs                            __attribute__((unused)) const struct GFX9_MI_WAIT_FOR_EVENT * restrict values)
976210e230b6Smaya{
976310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
976410e230b6Smaya
976510e230b6Smaya   dw[0] =
976610e230b6Smaya      __gen_uint(values->DisplayPlnae1AScanLineWaitEnable, 0, 0) |
976710e230b6Smaya      __gen_uint(values->DisplayPlane1FlipPendingWaitEnable, 1, 1) |
976810e230b6Smaya      __gen_uint(values->DisplayPlane4FlipPendingWaitEnable, 2, 2) |
976910e230b6Smaya      __gen_uint(values->DisplayPlane1AVerticalBlankWaitEnable, 3, 3) |
977010e230b6Smaya      __gen_uint(values->DisplayPlane7FlipPendingWaitEnable, 6, 6) |
977110e230b6Smaya      __gen_uint(values->DisplayPlane8FlipPendingWaitEnable, 7, 7) |
977210e230b6Smaya      __gen_uint(values->DisplayPlane1BScanLineWaitEnable, 8, 8) |
977310e230b6Smaya      __gen_uint(values->DisplayPlane2FlipPendingWaitEnable, 9, 9) |
977410e230b6Smaya      __gen_uint(values->DisplayPlane5FlipPendingWaitEnable, 10, 10) |
977510e230b6Smaya      __gen_uint(values->DisplayPlane1BVerticalBlankWaitEnable, 11, 11) |
977610e230b6Smaya      __gen_uint(values->DisplayPlane1CScanLineWaitEnable, 14, 14) |
977710e230b6Smaya      __gen_uint(values->DisplayPlane3FlipPendingWaitEnable, 15, 15) |
977810e230b6Smaya      __gen_uint(values->DisplayPlane9FlipPendingWaitEnable, 16, 16) |
977910e230b6Smaya      __gen_uint(values->DisplayPlane10FlipPendingWaitEnable, 17, 17) |
978010e230b6Smaya      __gen_uint(values->DisplayPlane11FlipPendingWaitEnable, 18, 18) |
978110e230b6Smaya      __gen_uint(values->DisplayPlane12FlipPendingWaitEnable, 19, 19) |
978210e230b6Smaya      __gen_uint(values->DisplayPlane6FlipPendingWaitEnable, 20, 20) |
978310e230b6Smaya      __gen_uint(values->DisplayPlane1CVerticalBlankWaitEnable, 21, 21) |
978410e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
978510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
978610e230b6Smaya}
978710e230b6Smaya
978896c5ddc4Srjs#define GFX9_PIPELINE_SELECT_length            1
978996c5ddc4Srjs#define GFX9_PIPELINE_SELECT_length_bias       1
979096c5ddc4Srjs#define GFX9_PIPELINE_SELECT_header             \
979110e230b6Smaya   ._3DCommandSubOpcode                 =      4,  \
979210e230b6Smaya   ._3DCommandOpcode                    =      1,  \
979310e230b6Smaya   .CommandSubType                      =      1,  \
979410e230b6Smaya   .CommandType                         =      3
979510e230b6Smaya
979696c5ddc4Srjsstruct GFX9_PIPELINE_SELECT {
979710e230b6Smaya   uint32_t                             PipelineSelection;
979810e230b6Smaya#define _3D                                      0
979910e230b6Smaya#define Media                                    1
980010e230b6Smaya#define GPGPU                                    2
980110e230b6Smaya   bool                                 MediaSamplerDOPClockGateEnable;
980210e230b6Smaya   bool                                 ForceMediaAwake;
980310e230b6Smaya   uint32_t                             MaskBits;
980410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
980510e230b6Smaya   uint32_t                             _3DCommandOpcode;
980610e230b6Smaya   uint32_t                             CommandSubType;
980710e230b6Smaya   uint32_t                             CommandType;
980810e230b6Smaya};
980910e230b6Smaya
981096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
981196c5ddc4SrjsGFX9_PIPELINE_SELECT_pack(__attribute__((unused)) __gen_user_data *data,
981210e230b6Smaya                          __attribute__((unused)) void * restrict dst,
981396c5ddc4Srjs                          __attribute__((unused)) const struct GFX9_PIPELINE_SELECT * restrict values)
981410e230b6Smaya{
981510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
981610e230b6Smaya
981710e230b6Smaya   dw[0] =
981810e230b6Smaya      __gen_uint(values->PipelineSelection, 0, 1) |
981910e230b6Smaya      __gen_uint(values->MediaSamplerDOPClockGateEnable, 4, 4) |
982010e230b6Smaya      __gen_uint(values->ForceMediaAwake, 5, 5) |
982110e230b6Smaya      __gen_uint(values->MaskBits, 8, 15) |
982210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
982310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
982410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
982510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
982610e230b6Smaya}
982710e230b6Smaya
982896c5ddc4Srjs#define GFX9_PIPE_CONTROL_length               6
982996c5ddc4Srjs#define GFX9_PIPE_CONTROL_length_bias          2
983096c5ddc4Srjs#define GFX9_PIPE_CONTROL_header                \
983110e230b6Smaya   .DWordLength                         =      4,  \
983210e230b6Smaya   ._3DCommandSubOpcode                 =      0,  \
983310e230b6Smaya   ._3DCommandOpcode                    =      2,  \
983410e230b6Smaya   .CommandSubType                      =      3,  \
983510e230b6Smaya   .CommandType                         =      3
983610e230b6Smaya
983796c5ddc4Srjsstruct GFX9_PIPE_CONTROL {
983810e230b6Smaya   uint32_t                             DWordLength;
983910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
984010e230b6Smaya   uint32_t                             _3DCommandOpcode;
984110e230b6Smaya   uint32_t                             CommandSubType;
984210e230b6Smaya   uint32_t                             CommandType;
984310e230b6Smaya   bool                                 DepthCacheFlushEnable;
984410e230b6Smaya   bool                                 StallAtPixelScoreboard;
984510e230b6Smaya   bool                                 StateCacheInvalidationEnable;
984610e230b6Smaya   bool                                 ConstantCacheInvalidationEnable;
984710e230b6Smaya   bool                                 VFCacheInvalidationEnable;
984810e230b6Smaya   bool                                 DCFlushEnable;
984910e230b6Smaya   bool                                 PipeControlFlushEnable;
985010e230b6Smaya   bool                                 NotifyEnable;
985110e230b6Smaya   bool                                 IndirectStatePointersDisable;
985210e230b6Smaya   bool                                 TextureCacheInvalidationEnable;
985310e230b6Smaya   bool                                 InstructionCacheInvalidateEnable;
985410e230b6Smaya   bool                                 RenderTargetCacheFlushEnable;
985510e230b6Smaya   bool                                 DepthStallEnable;
985610e230b6Smaya   uint32_t                             PostSyncOperation;
985710e230b6Smaya#define NoWrite                                  0
985810e230b6Smaya#define WriteImmediateData                       1
985910e230b6Smaya#define WritePSDepthCount                        2
986010e230b6Smaya#define WriteTimestamp                           3
986110e230b6Smaya   bool                                 GenericMediaStateClear;
986210e230b6Smaya   bool                                 TLBInvalidate;
986310e230b6Smaya   bool                                 GlobalSnapshotCountReset;
986410e230b6Smaya   bool                                 CommandStreamerStallEnable;
986510e230b6Smaya   uint32_t                             StoreDataIndex;
986610e230b6Smaya   uint32_t                             LRIPostSyncOperation;
986710e230b6Smaya#define NoLRIOperation                           0
986810e230b6Smaya#define MMIOWriteImmediateData                   1
986910e230b6Smaya   uint32_t                             DestinationAddressType;
987010e230b6Smaya#define DAT_PPGTT                                0
987110e230b6Smaya#define DAT_GGTT                                 1
987210e230b6Smaya   bool                                 FlushLLC;
987310e230b6Smaya   __gen_address_type                   Address;
987410e230b6Smaya   uint64_t                             ImmediateData;
987510e230b6Smaya};
987610e230b6Smaya
987796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
987896c5ddc4SrjsGFX9_PIPE_CONTROL_pack(__attribute__((unused)) __gen_user_data *data,
987910e230b6Smaya                       __attribute__((unused)) void * restrict dst,
988096c5ddc4Srjs                       __attribute__((unused)) const struct GFX9_PIPE_CONTROL * restrict values)
988110e230b6Smaya{
988210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
988310e230b6Smaya
988410e230b6Smaya   dw[0] =
988510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
988610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
988710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
988810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
988910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
989010e230b6Smaya
989110e230b6Smaya   dw[1] =
989210e230b6Smaya      __gen_uint(values->DepthCacheFlushEnable, 0, 0) |
989310e230b6Smaya      __gen_uint(values->StallAtPixelScoreboard, 1, 1) |
989410e230b6Smaya      __gen_uint(values->StateCacheInvalidationEnable, 2, 2) |
989510e230b6Smaya      __gen_uint(values->ConstantCacheInvalidationEnable, 3, 3) |
989610e230b6Smaya      __gen_uint(values->VFCacheInvalidationEnable, 4, 4) |
989710e230b6Smaya      __gen_uint(values->DCFlushEnable, 5, 5) |
989810e230b6Smaya      __gen_uint(values->PipeControlFlushEnable, 7, 7) |
989910e230b6Smaya      __gen_uint(values->NotifyEnable, 8, 8) |
990010e230b6Smaya      __gen_uint(values->IndirectStatePointersDisable, 9, 9) |
990110e230b6Smaya      __gen_uint(values->TextureCacheInvalidationEnable, 10, 10) |
990210e230b6Smaya      __gen_uint(values->InstructionCacheInvalidateEnable, 11, 11) |
990310e230b6Smaya      __gen_uint(values->RenderTargetCacheFlushEnable, 12, 12) |
990410e230b6Smaya      __gen_uint(values->DepthStallEnable, 13, 13) |
990510e230b6Smaya      __gen_uint(values->PostSyncOperation, 14, 15) |
990610e230b6Smaya      __gen_uint(values->GenericMediaStateClear, 16, 16) |
990710e230b6Smaya      __gen_uint(values->TLBInvalidate, 18, 18) |
990810e230b6Smaya      __gen_uint(values->GlobalSnapshotCountReset, 19, 19) |
990910e230b6Smaya      __gen_uint(values->CommandStreamerStallEnable, 20, 20) |
991010e230b6Smaya      __gen_uint(values->StoreDataIndex, 21, 21) |
991110e230b6Smaya      __gen_uint(values->LRIPostSyncOperation, 23, 23) |
991210e230b6Smaya      __gen_uint(values->DestinationAddressType, 24, 24) |
991310e230b6Smaya      __gen_uint(values->FlushLLC, 26, 26);
991410e230b6Smaya
991510e230b6Smaya   const uint64_t v2_address =
991696c5ddc4Srjs      __gen_address(data, &dw[2], values->Address, 0, 2, 47);
991710e230b6Smaya   dw[2] = v2_address;
991810e230b6Smaya   dw[3] = v2_address >> 32;
991910e230b6Smaya
992010e230b6Smaya   const uint64_t v4 =
992110e230b6Smaya      __gen_uint(values->ImmediateData, 0, 63);
992210e230b6Smaya   dw[4] = v4;
992310e230b6Smaya   dw[5] = v4 >> 32;
992410e230b6Smaya}
992510e230b6Smaya
992696c5ddc4Srjs#define GFX9_STATE_BASE_ADDRESS_length        19
992796c5ddc4Srjs#define GFX9_STATE_BASE_ADDRESS_length_bias      2
992896c5ddc4Srjs#define GFX9_STATE_BASE_ADDRESS_header          \
992910e230b6Smaya   .DWordLength                         =     17,  \
993010e230b6Smaya   ._3DCommandSubOpcode                 =      1,  \
993110e230b6Smaya   ._3DCommandOpcode                    =      1,  \
993210e230b6Smaya   .CommandSubType                      =      0,  \
993310e230b6Smaya   .CommandType                         =      3
993410e230b6Smaya
993596c5ddc4Srjsstruct GFX9_STATE_BASE_ADDRESS {
993610e230b6Smaya   uint32_t                             DWordLength;
993710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
993810e230b6Smaya   uint32_t                             _3DCommandOpcode;
993910e230b6Smaya   uint32_t                             CommandSubType;
994010e230b6Smaya   uint32_t                             CommandType;
994110e230b6Smaya   bool                                 GeneralStateBaseAddressModifyEnable;
994210e230b6Smaya   uint32_t                             GeneralStateMOCS;
994310e230b6Smaya   __gen_address_type                   GeneralStateBaseAddress;
994410e230b6Smaya   uint32_t                             StatelessDataPortAccessMOCS;
994510e230b6Smaya   bool                                 SurfaceStateBaseAddressModifyEnable;
994610e230b6Smaya   uint32_t                             SurfaceStateMOCS;
994710e230b6Smaya   __gen_address_type                   SurfaceStateBaseAddress;
994810e230b6Smaya   bool                                 DynamicStateBaseAddressModifyEnable;
994910e230b6Smaya   uint32_t                             DynamicStateMOCS;
995010e230b6Smaya   __gen_address_type                   DynamicStateBaseAddress;
995110e230b6Smaya   bool                                 IndirectObjectBaseAddressModifyEnable;
995210e230b6Smaya   uint32_t                             IndirectObjectMOCS;
995310e230b6Smaya   __gen_address_type                   IndirectObjectBaseAddress;
995410e230b6Smaya   bool                                 InstructionBaseAddressModifyEnable;
995510e230b6Smaya   uint32_t                             InstructionMOCS;
995610e230b6Smaya   __gen_address_type                   InstructionBaseAddress;
995710e230b6Smaya   bool                                 GeneralStateBufferSizeModifyEnable;
995810e230b6Smaya   uint32_t                             GeneralStateBufferSize;
995910e230b6Smaya   bool                                 DynamicStateBufferSizeModifyEnable;
996010e230b6Smaya   uint32_t                             DynamicStateBufferSize;
996110e230b6Smaya   bool                                 IndirectObjectBufferSizeModifyEnable;
996210e230b6Smaya   uint32_t                             IndirectObjectBufferSize;
996310e230b6Smaya   bool                                 InstructionBuffersizeModifyEnable;
996410e230b6Smaya   uint32_t                             InstructionBufferSize;
996510e230b6Smaya   bool                                 BindlessSurfaceStateBaseAddressModifyEnable;
996610e230b6Smaya   uint32_t                             BindlessSurfaceStateMOCS;
996710e230b6Smaya   __gen_address_type                   BindlessSurfaceStateBaseAddress;
996810e230b6Smaya   uint32_t                             BindlessSurfaceStateSize;
996910e230b6Smaya};
997010e230b6Smaya
997196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
997296c5ddc4SrjsGFX9_STATE_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
997310e230b6Smaya                             __attribute__((unused)) void * restrict dst,
997496c5ddc4Srjs                             __attribute__((unused)) const struct GFX9_STATE_BASE_ADDRESS * restrict values)
997510e230b6Smaya{
997610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
997710e230b6Smaya
997810e230b6Smaya   dw[0] =
997910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
998010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
998110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
998210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
998310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
998410e230b6Smaya
998510e230b6Smaya   const uint64_t v1 =
998610e230b6Smaya      __gen_uint(values->GeneralStateBaseAddressModifyEnable, 0, 0) |
998710e230b6Smaya      __gen_uint(values->GeneralStateMOCS, 4, 10);
998810e230b6Smaya   const uint64_t v1_address =
998996c5ddc4Srjs      __gen_address(data, &dw[1], values->GeneralStateBaseAddress, v1, 12, 63);
999010e230b6Smaya   dw[1] = v1_address;
999110e230b6Smaya   dw[2] = (v1_address >> 32) | (v1 >> 32);
999210e230b6Smaya
999310e230b6Smaya   dw[3] =
999410e230b6Smaya      __gen_uint(values->StatelessDataPortAccessMOCS, 16, 22);
999510e230b6Smaya
999610e230b6Smaya   const uint64_t v4 =
999710e230b6Smaya      __gen_uint(values->SurfaceStateBaseAddressModifyEnable, 0, 0) |
999810e230b6Smaya      __gen_uint(values->SurfaceStateMOCS, 4, 10);
999910e230b6Smaya   const uint64_t v4_address =
1000096c5ddc4Srjs      __gen_address(data, &dw[4], values->SurfaceStateBaseAddress, v4, 12, 63);
1000110e230b6Smaya   dw[4] = v4_address;
1000210e230b6Smaya   dw[5] = (v4_address >> 32) | (v4 >> 32);
1000310e230b6Smaya
1000410e230b6Smaya   const uint64_t v6 =
1000510e230b6Smaya      __gen_uint(values->DynamicStateBaseAddressModifyEnable, 0, 0) |
1000610e230b6Smaya      __gen_uint(values->DynamicStateMOCS, 4, 10);
1000710e230b6Smaya   const uint64_t v6_address =
1000896c5ddc4Srjs      __gen_address(data, &dw[6], values->DynamicStateBaseAddress, v6, 12, 63);
1000910e230b6Smaya   dw[6] = v6_address;
1001010e230b6Smaya   dw[7] = (v6_address >> 32) | (v6 >> 32);
1001110e230b6Smaya
1001210e230b6Smaya   const uint64_t v8 =
1001310e230b6Smaya      __gen_uint(values->IndirectObjectBaseAddressModifyEnable, 0, 0) |
1001410e230b6Smaya      __gen_uint(values->IndirectObjectMOCS, 4, 10);
1001510e230b6Smaya   const uint64_t v8_address =
1001696c5ddc4Srjs      __gen_address(data, &dw[8], values->IndirectObjectBaseAddress, v8, 12, 63);
1001710e230b6Smaya   dw[8] = v8_address;
1001810e230b6Smaya   dw[9] = (v8_address >> 32) | (v8 >> 32);
1001910e230b6Smaya
1002010e230b6Smaya   const uint64_t v10 =
1002110e230b6Smaya      __gen_uint(values->InstructionBaseAddressModifyEnable, 0, 0) |
1002210e230b6Smaya      __gen_uint(values->InstructionMOCS, 4, 10);
1002310e230b6Smaya   const uint64_t v10_address =
1002496c5ddc4Srjs      __gen_address(data, &dw[10], values->InstructionBaseAddress, v10, 12, 63);
1002510e230b6Smaya   dw[10] = v10_address;
1002610e230b6Smaya   dw[11] = (v10_address >> 32) | (v10 >> 32);
1002710e230b6Smaya
1002810e230b6Smaya   dw[12] =
1002910e230b6Smaya      __gen_uint(values->GeneralStateBufferSizeModifyEnable, 0, 0) |
1003010e230b6Smaya      __gen_uint(values->GeneralStateBufferSize, 12, 31);
1003110e230b6Smaya
1003210e230b6Smaya   dw[13] =
1003310e230b6Smaya      __gen_uint(values->DynamicStateBufferSizeModifyEnable, 0, 0) |
1003410e230b6Smaya      __gen_uint(values->DynamicStateBufferSize, 12, 31);
1003510e230b6Smaya
1003610e230b6Smaya   dw[14] =
1003710e230b6Smaya      __gen_uint(values->IndirectObjectBufferSizeModifyEnable, 0, 0) |
1003810e230b6Smaya      __gen_uint(values->IndirectObjectBufferSize, 12, 31);
1003910e230b6Smaya
1004010e230b6Smaya   dw[15] =
1004110e230b6Smaya      __gen_uint(values->InstructionBuffersizeModifyEnable, 0, 0) |
1004210e230b6Smaya      __gen_uint(values->InstructionBufferSize, 12, 31);
1004310e230b6Smaya
1004410e230b6Smaya   const uint64_t v16 =
1004510e230b6Smaya      __gen_uint(values->BindlessSurfaceStateBaseAddressModifyEnable, 0, 0) |
1004610e230b6Smaya      __gen_uint(values->BindlessSurfaceStateMOCS, 4, 10);
1004710e230b6Smaya   const uint64_t v16_address =
1004896c5ddc4Srjs      __gen_address(data, &dw[16], values->BindlessSurfaceStateBaseAddress, v16, 12, 63);
1004910e230b6Smaya   dw[16] = v16_address;
1005010e230b6Smaya   dw[17] = (v16_address >> 32) | (v16 >> 32);
1005110e230b6Smaya
1005210e230b6Smaya   dw[18] =
1005310e230b6Smaya      __gen_uint(values->BindlessSurfaceStateSize, 12, 31);
1005410e230b6Smaya}
1005510e230b6Smaya
1005696c5ddc4Srjs#define GFX9_STATE_PREFETCH_length             2
1005796c5ddc4Srjs#define GFX9_STATE_PREFETCH_length_bias        2
1005896c5ddc4Srjs#define GFX9_STATE_PREFETCH_header              \
1005910e230b6Smaya   .DWordLength                         =      0,  \
1006010e230b6Smaya   ._3DCommandSubOpcode                 =      3,  \
1006110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
1006210e230b6Smaya   .CommandSubType                      =      0,  \
1006310e230b6Smaya   .CommandType                         =      3
1006410e230b6Smaya
1006596c5ddc4Srjsstruct GFX9_STATE_PREFETCH {
1006610e230b6Smaya   uint32_t                             DWordLength;
1006710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
1006810e230b6Smaya   uint32_t                             _3DCommandOpcode;
1006910e230b6Smaya   uint32_t                             CommandSubType;
1007010e230b6Smaya   uint32_t                             CommandType;
1007110e230b6Smaya   uint32_t                             PrefetchCount;
1007210e230b6Smaya   __gen_address_type                   PrefetchPointer;
1007310e230b6Smaya};
1007410e230b6Smaya
1007596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1007696c5ddc4SrjsGFX9_STATE_PREFETCH_pack(__attribute__((unused)) __gen_user_data *data,
1007710e230b6Smaya                         __attribute__((unused)) void * restrict dst,
1007896c5ddc4Srjs                         __attribute__((unused)) const struct GFX9_STATE_PREFETCH * restrict values)
1007910e230b6Smaya{
1008010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1008110e230b6Smaya
1008210e230b6Smaya   dw[0] =
1008310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
1008410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1008510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1008610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
1008710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
1008810e230b6Smaya
1008910e230b6Smaya   const uint32_t v1 =
1009010e230b6Smaya      __gen_uint(values->PrefetchCount, 0, 2);
1009196c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->PrefetchPointer, v1, 6, 31);
1009210e230b6Smaya}
1009310e230b6Smaya
1009496c5ddc4Srjs#define GFX9_STATE_SIP_length                  3
1009596c5ddc4Srjs#define GFX9_STATE_SIP_length_bias             2
1009696c5ddc4Srjs#define GFX9_STATE_SIP_header                   \
1009710e230b6Smaya   .DWordLength                         =      1,  \
1009810e230b6Smaya   ._3DCommandSubOpcode                 =      2,  \
1009910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
1010010e230b6Smaya   .CommandSubType                      =      0,  \
1010110e230b6Smaya   .CommandType                         =      3
1010210e230b6Smaya
1010396c5ddc4Srjsstruct GFX9_STATE_SIP {
1010410e230b6Smaya   uint32_t                             DWordLength;
1010510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
1010610e230b6Smaya   uint32_t                             _3DCommandOpcode;
1010710e230b6Smaya   uint32_t                             CommandSubType;
1010810e230b6Smaya   uint32_t                             CommandType;
1010910e230b6Smaya   uint64_t                             SystemInstructionPointer;
1011010e230b6Smaya};
1011110e230b6Smaya
1011296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1011396c5ddc4SrjsGFX9_STATE_SIP_pack(__attribute__((unused)) __gen_user_data *data,
1011410e230b6Smaya                    __attribute__((unused)) void * restrict dst,
1011596c5ddc4Srjs                    __attribute__((unused)) const struct GFX9_STATE_SIP * restrict values)
1011610e230b6Smaya{
1011710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1011810e230b6Smaya
1011910e230b6Smaya   dw[0] =
1012010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
1012110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1012210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1012310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
1012410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
1012510e230b6Smaya
1012610e230b6Smaya   const uint64_t v1 =
1012710e230b6Smaya      __gen_offset(values->SystemInstructionPointer, 4, 63);
1012810e230b6Smaya   dw[1] = v1;
1012910e230b6Smaya   dw[2] = v1 >> 32;
1013010e230b6Smaya}
1013110e230b6Smaya
1013296c5ddc4Srjs#define GFX9_ACTHD_UDW_num                0x205c
1013396c5ddc4Srjs#define GFX9_ACTHD_UDW_length                  1
1013496c5ddc4Srjsstruct GFX9_ACTHD_UDW {
1013510e230b6Smaya   uint32_t                             HeadPointerUpperDWORD;
1013610e230b6Smaya};
1013710e230b6Smaya
1013896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1013996c5ddc4SrjsGFX9_ACTHD_UDW_pack(__attribute__((unused)) __gen_user_data *data,
1014010e230b6Smaya                    __attribute__((unused)) void * restrict dst,
1014196c5ddc4Srjs                    __attribute__((unused)) const struct GFX9_ACTHD_UDW * restrict values)
1014210e230b6Smaya{
1014310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1014410e230b6Smaya
1014510e230b6Smaya   dw[0] =
1014610e230b6Smaya      __gen_uint(values->HeadPointerUpperDWORD, 0, 15);
1014710e230b6Smaya}
1014810e230b6Smaya
1014996c5ddc4Srjs#define GFX9_BCS_ACTHD_UDW_num            0x2205c
1015096c5ddc4Srjs#define GFX9_BCS_ACTHD_UDW_length              1
1015196c5ddc4Srjsstruct GFX9_BCS_ACTHD_UDW {
1015210e230b6Smaya   uint32_t                             HeadPointerUpperDWORD;
1015310e230b6Smaya};
1015410e230b6Smaya
1015596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1015696c5ddc4SrjsGFX9_BCS_ACTHD_UDW_pack(__attribute__((unused)) __gen_user_data *data,
1015710e230b6Smaya                        __attribute__((unused)) void * restrict dst,
1015896c5ddc4Srjs                        __attribute__((unused)) const struct GFX9_BCS_ACTHD_UDW * restrict values)
1015910e230b6Smaya{
1016010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1016110e230b6Smaya
1016210e230b6Smaya   dw[0] =
1016310e230b6Smaya      __gen_uint(values->HeadPointerUpperDWORD, 0, 15);
1016410e230b6Smaya}
1016510e230b6Smaya
1016696c5ddc4Srjs#define GFX9_BCS_INSTDONE_num             0x2206c
1016796c5ddc4Srjs#define GFX9_BCS_INSTDONE_length               1
1016896c5ddc4Srjsstruct GFX9_BCS_INSTDONE {
1016910e230b6Smaya   bool                                 RingEnable;
1017010e230b6Smaya   bool                                 BlitterIDLE;
1017110e230b6Smaya   bool                                 GABIDLE;
1017210e230b6Smaya   bool                                 BCSDone;
1017310e230b6Smaya};
1017410e230b6Smaya
1017596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1017696c5ddc4SrjsGFX9_BCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
1017710e230b6Smaya                       __attribute__((unused)) void * restrict dst,
1017896c5ddc4Srjs                       __attribute__((unused)) const struct GFX9_BCS_INSTDONE * restrict values)
1017910e230b6Smaya{
1018010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1018110e230b6Smaya
1018210e230b6Smaya   dw[0] =
1018310e230b6Smaya      __gen_uint(values->RingEnable, 0, 0) |
1018410e230b6Smaya      __gen_uint(values->BlitterIDLE, 1, 1) |
1018510e230b6Smaya      __gen_uint(values->GABIDLE, 2, 2) |
1018610e230b6Smaya      __gen_uint(values->BCSDone, 3, 3);
1018710e230b6Smaya}
1018810e230b6Smaya
1018996c5ddc4Srjs#define GFX9_BCS_RING_BUFFER_CTL_num      0x2203c
1019096c5ddc4Srjs#define GFX9_BCS_RING_BUFFER_CTL_length        1
1019196c5ddc4Srjsstruct GFX9_BCS_RING_BUFFER_CTL {
1019210e230b6Smaya   bool                                 RingBufferEnable;
1019310e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
1019410e230b6Smaya#define MI_AUTOREPORT_OFF                        0
1019510e230b6Smaya#define MI_AUTOREPORT_64KB                       1
1019610e230b6Smaya#define MI_AUTOREPORT_4KB                        2
1019710e230b6Smaya#define MI_AUTOREPORT_128KB                      3
1019810e230b6Smaya   bool                                 DisableRegisterAccesses;
1019910e230b6Smaya   bool                                 SemaphoreWait;
1020010e230b6Smaya   bool                                 RBWait;
1020110e230b6Smaya   uint32_t                             BufferLengthinpages1;
1020210e230b6Smaya};
1020310e230b6Smaya
1020496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1020596c5ddc4SrjsGFX9_BCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
1020610e230b6Smaya                              __attribute__((unused)) void * restrict dst,
1020796c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_BCS_RING_BUFFER_CTL * restrict values)
1020810e230b6Smaya{
1020910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1021010e230b6Smaya
1021110e230b6Smaya   dw[0] =
1021210e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
1021310e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
1021410e230b6Smaya      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
1021510e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
1021610e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
1021710e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
1021810e230b6Smaya}
1021910e230b6Smaya
1022096c5ddc4Srjs#define GFX9_CACHE_MODE_0_num             0x7000
1022196c5ddc4Srjs#define GFX9_CACHE_MODE_0_length               1
1022296c5ddc4Srjsstruct GFX9_CACHE_MODE_0 {
1022310e230b6Smaya   bool                                 Nulltilefixdisable;
1022410e230b6Smaya   bool                                 Disableclockgatinginthepixelbackend;
1022510e230b6Smaya   bool                                 HierarchicalZRAWStallOptimizationDisable;
1022610e230b6Smaya   bool                                 RCCEvictionPolicy;
1022710e230b6Smaya   bool                                 STCPMAOptimizationEnable;
1022810e230b6Smaya   uint32_t                             SamplerL2RequestArbitration;
1022910e230b6Smaya#define RoundRobin                               0
1023010e230b6Smaya#define FetchareHighestPriority                  1
1023110e230b6Smaya#define ConstantsareHighestPriority              2
1023210e230b6Smaya   bool                                 SamplerL2TLBPrefetchEnable;
1023310e230b6Smaya   bool                                 SamplerSetRemappingfor3DDisable;
1023410e230b6Smaya   uint32_t                             MSAACompressionPlaneNumberThresholdforeLLC;
1023510e230b6Smaya   bool                                 SamplerL2Disable;
1023610e230b6Smaya   bool                                 NulltilefixdisableMask;
1023710e230b6Smaya   bool                                 DisableclockgatinginthepixelbackendMask;
1023810e230b6Smaya   bool                                 HierarchicalZRAWStallOptimizationDisableMask;
1023910e230b6Smaya   bool                                 RCCEvictionPolicyMask;
1024010e230b6Smaya   bool                                 STCPMAOptimizationEnableMask;
1024110e230b6Smaya   uint32_t                             SamplerL2RequestArbitrationMask;
1024210e230b6Smaya   bool                                 SamplerL2TLBPrefetchEnableMask;
1024310e230b6Smaya   bool                                 SamplerSetRemappingfor3DDisableMask;
1024410e230b6Smaya   uint32_t                             MSAACompressionPlaneNumberThresholdforeLLCMask;
1024510e230b6Smaya   bool                                 SamplerL2DisableMask;
1024610e230b6Smaya};
1024710e230b6Smaya
1024896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1024996c5ddc4SrjsGFX9_CACHE_MODE_0_pack(__attribute__((unused)) __gen_user_data *data,
1025010e230b6Smaya                       __attribute__((unused)) void * restrict dst,
1025196c5ddc4Srjs                       __attribute__((unused)) const struct GFX9_CACHE_MODE_0 * restrict values)
1025210e230b6Smaya{
1025310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1025410e230b6Smaya
1025510e230b6Smaya   dw[0] =
1025610e230b6Smaya      __gen_uint(values->Nulltilefixdisable, 0, 0) |
1025710e230b6Smaya      __gen_uint(values->Disableclockgatinginthepixelbackend, 1, 1) |
1025810e230b6Smaya      __gen_uint(values->HierarchicalZRAWStallOptimizationDisable, 2, 2) |
1025910e230b6Smaya      __gen_uint(values->RCCEvictionPolicy, 4, 4) |
1026010e230b6Smaya      __gen_uint(values->STCPMAOptimizationEnable, 5, 5) |
1026110e230b6Smaya      __gen_uint(values->SamplerL2RequestArbitration, 6, 7) |
1026210e230b6Smaya      __gen_uint(values->SamplerL2TLBPrefetchEnable, 9, 9) |
1026310e230b6Smaya      __gen_uint(values->SamplerSetRemappingfor3DDisable, 11, 11) |
1026410e230b6Smaya      __gen_uint(values->MSAACompressionPlaneNumberThresholdforeLLC, 12, 14) |
1026510e230b6Smaya      __gen_uint(values->SamplerL2Disable, 15, 15) |
1026610e230b6Smaya      __gen_uint(values->NulltilefixdisableMask, 16, 16) |
1026710e230b6Smaya      __gen_uint(values->DisableclockgatinginthepixelbackendMask, 17, 17) |
1026810e230b6Smaya      __gen_uint(values->HierarchicalZRAWStallOptimizationDisableMask, 18, 18) |
1026910e230b6Smaya      __gen_uint(values->RCCEvictionPolicyMask, 20, 20) |
1027010e230b6Smaya      __gen_uint(values->STCPMAOptimizationEnableMask, 21, 21) |
1027110e230b6Smaya      __gen_uint(values->SamplerL2RequestArbitrationMask, 22, 23) |
1027210e230b6Smaya      __gen_uint(values->SamplerL2TLBPrefetchEnableMask, 25, 25) |
1027310e230b6Smaya      __gen_uint(values->SamplerSetRemappingfor3DDisableMask, 27, 27) |
1027410e230b6Smaya      __gen_uint(values->MSAACompressionPlaneNumberThresholdforeLLCMask, 28, 30) |
1027510e230b6Smaya      __gen_uint(values->SamplerL2DisableMask, 31, 31);
1027610e230b6Smaya}
1027710e230b6Smaya
1027896c5ddc4Srjs#define GFX9_CACHE_MODE_1_num             0x7004
1027996c5ddc4Srjs#define GFX9_CACHE_MODE_1_length               1
1028096c5ddc4Srjsstruct GFX9_CACHE_MODE_1 {
1028110e230b6Smaya   bool                                 PartialResolveDisableInVC;
1028210e230b6Smaya   bool                                 RCZReadafterexpansioncontrolfix2;
1028310e230b6Smaya   bool                                 DepthReadHitWriteOnlyOptimizationDisable;
1028410e230b6Smaya   bool                                 FloatBlendOptimizationEnable;
1028510e230b6Smaya   bool                                 MCSCacheDisable;
1028610e230b6Smaya   bool                                 _4X4RCPFESTCOptimizationDisable;
1028710e230b6Smaya   uint32_t                             SamplerCacheSetXORselection;
1028810e230b6Smaya   bool                                 MSCRAWHazardAvoidanceBit;
1028910e230b6Smaya   uint32_t                             NPPMAFixEnable;
1029010e230b6Smaya   uint32_t                             HIZEvictionPolicy;
1029110e230b6Smaya   uint32_t                             NPEarlyZFailsDisable;
1029210e230b6Smaya   bool                                 BlendOptimizationFixDisable;
1029310e230b6Smaya   bool                                 ColorCompressionDisable;
1029410e230b6Smaya   bool                                 PartialResolveDisableInVCMask;
1029510e230b6Smaya   bool                                 RCZReadafterexpansioncontrolfix2Mask;
1029610e230b6Smaya   bool                                 DepthReadHitWriteOnlyOptimizationDisableMask;
1029710e230b6Smaya   bool                                 FloatBlendOptimizationEnableMask;
1029810e230b6Smaya   bool                                 MCSCacheDisableMask;
1029910e230b6Smaya   bool                                 _4X4RCPFESTCOptimizationDisableMask;
1030010e230b6Smaya   uint32_t                             SamplerCacheSetXORselectionMask;
1030110e230b6Smaya   bool                                 MSCRAWHazardAvoidanceBitMask;
1030210e230b6Smaya   bool                                 NPPMAFixEnableMask;
1030310e230b6Smaya   bool                                 HIZEvictionPolicyMask;
1030410e230b6Smaya   bool                                 NPEarlyZFailsDisableMask;
1030510e230b6Smaya   bool                                 BlendOptimizationFixDisableMask;
1030610e230b6Smaya   bool                                 ColorCompressionDisableMask;
1030710e230b6Smaya};
1030810e230b6Smaya
1030996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1031096c5ddc4SrjsGFX9_CACHE_MODE_1_pack(__attribute__((unused)) __gen_user_data *data,
1031110e230b6Smaya                       __attribute__((unused)) void * restrict dst,
1031296c5ddc4Srjs                       __attribute__((unused)) const struct GFX9_CACHE_MODE_1 * restrict values)
1031310e230b6Smaya{
1031410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1031510e230b6Smaya
1031610e230b6Smaya   dw[0] =
1031710e230b6Smaya      __gen_uint(values->PartialResolveDisableInVC, 1, 1) |
1031810e230b6Smaya      __gen_uint(values->RCZReadafterexpansioncontrolfix2, 2, 2) |
1031910e230b6Smaya      __gen_uint(values->DepthReadHitWriteOnlyOptimizationDisable, 3, 3) |
1032010e230b6Smaya      __gen_uint(values->FloatBlendOptimizationEnable, 4, 4) |
1032110e230b6Smaya      __gen_uint(values->MCSCacheDisable, 5, 5) |
1032210e230b6Smaya      __gen_uint(values->_4X4RCPFESTCOptimizationDisable, 6, 6) |
1032310e230b6Smaya      __gen_uint(values->SamplerCacheSetXORselection, 7, 8) |
1032410e230b6Smaya      __gen_uint(values->MSCRAWHazardAvoidanceBit, 9, 9) |
1032510e230b6Smaya      __gen_uint(values->NPPMAFixEnable, 11, 11) |
1032610e230b6Smaya      __gen_uint(values->HIZEvictionPolicy, 12, 12) |
1032710e230b6Smaya      __gen_uint(values->NPEarlyZFailsDisable, 13, 13) |
1032810e230b6Smaya      __gen_uint(values->BlendOptimizationFixDisable, 14, 14) |
1032910e230b6Smaya      __gen_uint(values->ColorCompressionDisable, 15, 15) |
1033010e230b6Smaya      __gen_uint(values->PartialResolveDisableInVCMask, 17, 17) |
1033110e230b6Smaya      __gen_uint(values->RCZReadafterexpansioncontrolfix2Mask, 18, 18) |
1033210e230b6Smaya      __gen_uint(values->DepthReadHitWriteOnlyOptimizationDisableMask, 19, 19) |
1033310e230b6Smaya      __gen_uint(values->FloatBlendOptimizationEnableMask, 20, 20) |
1033410e230b6Smaya      __gen_uint(values->MCSCacheDisableMask, 21, 21) |
1033510e230b6Smaya      __gen_uint(values->_4X4RCPFESTCOptimizationDisableMask, 22, 22) |
1033610e230b6Smaya      __gen_uint(values->SamplerCacheSetXORselectionMask, 23, 24) |
1033710e230b6Smaya      __gen_uint(values->MSCRAWHazardAvoidanceBitMask, 25, 25) |
1033810e230b6Smaya      __gen_uint(values->NPPMAFixEnableMask, 27, 27) |
1033910e230b6Smaya      __gen_uint(values->HIZEvictionPolicyMask, 28, 28) |
1034010e230b6Smaya      __gen_uint(values->NPEarlyZFailsDisableMask, 29, 29) |
1034110e230b6Smaya      __gen_uint(values->BlendOptimizationFixDisableMask, 30, 30) |
1034210e230b6Smaya      __gen_uint(values->ColorCompressionDisableMask, 31, 31);
1034310e230b6Smaya}
1034410e230b6Smaya
1034596c5ddc4Srjs#define GFX9_CL_INVOCATION_COUNT_num      0x2338
1034696c5ddc4Srjs#define GFX9_CL_INVOCATION_COUNT_length        2
1034796c5ddc4Srjsstruct GFX9_CL_INVOCATION_COUNT {
1034810e230b6Smaya   uint64_t                             CLInvocationCountReport;
1034910e230b6Smaya};
1035010e230b6Smaya
1035196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1035296c5ddc4SrjsGFX9_CL_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
1035310e230b6Smaya                              __attribute__((unused)) void * restrict dst,
1035496c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_CL_INVOCATION_COUNT * restrict values)
1035510e230b6Smaya{
1035610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1035710e230b6Smaya
1035810e230b6Smaya   const uint64_t v0 =
1035910e230b6Smaya      __gen_uint(values->CLInvocationCountReport, 0, 63);
1036010e230b6Smaya   dw[0] = v0;
1036110e230b6Smaya   dw[1] = v0 >> 32;
1036210e230b6Smaya}
1036310e230b6Smaya
1036496c5ddc4Srjs#define GFX9_CL_PRIMITIVES_COUNT_num      0x2340
1036596c5ddc4Srjs#define GFX9_CL_PRIMITIVES_COUNT_length        2
1036696c5ddc4Srjsstruct GFX9_CL_PRIMITIVES_COUNT {
1036710e230b6Smaya   uint64_t                             CLPrimitivesCountReport;
1036810e230b6Smaya};
1036910e230b6Smaya
1037096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1037196c5ddc4SrjsGFX9_CL_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
1037210e230b6Smaya                              __attribute__((unused)) void * restrict dst,
1037396c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_CL_PRIMITIVES_COUNT * restrict values)
1037410e230b6Smaya{
1037510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1037610e230b6Smaya
1037710e230b6Smaya   const uint64_t v0 =
1037810e230b6Smaya      __gen_uint(values->CLPrimitivesCountReport, 0, 63);
1037910e230b6Smaya   dw[0] = v0;
1038010e230b6Smaya   dw[1] = v0 >> 32;
1038110e230b6Smaya}
1038210e230b6Smaya
1038396c5ddc4Srjs#define GFX9_CS_CHICKEN1_num              0x2580
1038496c5ddc4Srjs#define GFX9_CS_CHICKEN1_length                1
1038596c5ddc4Srjsstruct GFX9_CS_CHICKEN1 {
1038610e230b6Smaya   uint32_t                             ReplayMode;
1038710e230b6Smaya#define MidcmdbufferPreemption                   0
1038810e230b6Smaya#define ObjectLevelPreemption                    1
1038910e230b6Smaya   bool                                 ReplayModeMask;
1039010e230b6Smaya};
1039110e230b6Smaya
1039296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1039396c5ddc4SrjsGFX9_CS_CHICKEN1_pack(__attribute__((unused)) __gen_user_data *data,
1039410e230b6Smaya                      __attribute__((unused)) void * restrict dst,
1039596c5ddc4Srjs                      __attribute__((unused)) const struct GFX9_CS_CHICKEN1 * restrict values)
1039610e230b6Smaya{
1039710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1039810e230b6Smaya
1039910e230b6Smaya   dw[0] =
1040010e230b6Smaya      __gen_uint(values->ReplayMode, 0, 0) |
1040110e230b6Smaya      __gen_uint(values->ReplayModeMask, 16, 16);
1040210e230b6Smaya}
1040310e230b6Smaya
1040496c5ddc4Srjs#define GFX9_CS_DEBUG_MODE2_num           0x20d8
1040596c5ddc4Srjs#define GFX9_CS_DEBUG_MODE2_length             1
1040696c5ddc4Srjsstruct GFX9_CS_DEBUG_MODE2 {
1040710e230b6Smaya   bool                                 _3DRenderingInstructionDisable;
1040810e230b6Smaya   bool                                 MediaInstructionDisable;
1040910e230b6Smaya   bool                                 CONSTANT_BUFFERAddressOffsetDisable;
1041010e230b6Smaya   bool                                 _3DRenderingInstructionDisableMask;
1041110e230b6Smaya   bool                                 MediaInstructionDisableMask;
1041210e230b6Smaya   bool                                 CONSTANT_BUFFERAddressOffsetDisableMask;
1041310e230b6Smaya};
1041410e230b6Smaya
1041596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1041696c5ddc4SrjsGFX9_CS_DEBUG_MODE2_pack(__attribute__((unused)) __gen_user_data *data,
1041710e230b6Smaya                         __attribute__((unused)) void * restrict dst,
1041896c5ddc4Srjs                         __attribute__((unused)) const struct GFX9_CS_DEBUG_MODE2 * restrict values)
1041910e230b6Smaya{
1042010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1042110e230b6Smaya
1042210e230b6Smaya   dw[0] =
1042310e230b6Smaya      __gen_uint(values->_3DRenderingInstructionDisable, 0, 0) |
1042410e230b6Smaya      __gen_uint(values->MediaInstructionDisable, 1, 1) |
1042510e230b6Smaya      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisable, 4, 4) |
1042610e230b6Smaya      __gen_uint(values->_3DRenderingInstructionDisableMask, 16, 16) |
1042710e230b6Smaya      __gen_uint(values->MediaInstructionDisableMask, 17, 17) |
1042810e230b6Smaya      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisableMask, 20, 20);
1042910e230b6Smaya}
1043010e230b6Smaya
1043196c5ddc4Srjs#define GFX9_CS_INVOCATION_COUNT_num      0x2290
1043296c5ddc4Srjs#define GFX9_CS_INVOCATION_COUNT_length        2
1043396c5ddc4Srjsstruct GFX9_CS_INVOCATION_COUNT {
1043410e230b6Smaya   uint64_t                             CSInvocationCountReport;
1043510e230b6Smaya};
1043610e230b6Smaya
1043796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1043896c5ddc4SrjsGFX9_CS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
1043910e230b6Smaya                              __attribute__((unused)) void * restrict dst,
1044096c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_CS_INVOCATION_COUNT * restrict values)
1044110e230b6Smaya{
1044210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1044310e230b6Smaya
1044410e230b6Smaya   const uint64_t v0 =
1044510e230b6Smaya      __gen_uint(values->CSInvocationCountReport, 0, 63);
1044610e230b6Smaya   dw[0] = v0;
1044710e230b6Smaya   dw[1] = v0 >> 32;
1044810e230b6Smaya}
1044910e230b6Smaya
1045096c5ddc4Srjs#define GFX9_DS_INVOCATION_COUNT_num      0x2308
1045196c5ddc4Srjs#define GFX9_DS_INVOCATION_COUNT_length        2
1045296c5ddc4Srjsstruct GFX9_DS_INVOCATION_COUNT {
1045310e230b6Smaya   uint64_t                             DSInvocationCountReport;
1045410e230b6Smaya};
1045510e230b6Smaya
1045696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1045796c5ddc4SrjsGFX9_DS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
1045810e230b6Smaya                              __attribute__((unused)) void * restrict dst,
1045996c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_DS_INVOCATION_COUNT * restrict values)
1046010e230b6Smaya{
1046110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1046210e230b6Smaya
1046310e230b6Smaya   const uint64_t v0 =
1046410e230b6Smaya      __gen_uint(values->DSInvocationCountReport, 0, 63);
1046510e230b6Smaya   dw[0] = v0;
1046610e230b6Smaya   dw[1] = v0 >> 32;
1046710e230b6Smaya}
1046810e230b6Smaya
1046996c5ddc4Srjs#define GFX9_FAULT_REG_num                0x4094
1047096c5ddc4Srjs#define GFX9_FAULT_REG_length                  1
1047196c5ddc4Srjsstruct GFX9_FAULT_REG {
1047210e230b6Smaya   bool                                 ValidBit;
1047310e230b6Smaya   uint32_t                             FaultType;
1047410e230b6Smaya#define InvalidPTEFault                          0
1047510e230b6Smaya#define InvalidPDEFault                          1
1047610e230b6Smaya#define InvalidPDPEFault                         2
1047710e230b6Smaya#define InvalidPML4EFault                        3
1047810e230b6Smaya   uint32_t                             SRCIDofFault;
1047910e230b6Smaya   uint32_t                             GTTSEL;
1048010e230b6Smaya#define PPGTT                                    0
1048110e230b6Smaya#define GGTT                                     1
1048210e230b6Smaya   uint32_t                             EngineID;
1048310e230b6Smaya#define GFX                                      0
1048410e230b6Smaya#define MFX0                                     1
1048510e230b6Smaya#define MFX1                                     2
1048610e230b6Smaya#define VEBX                                     3
1048710e230b6Smaya#define BLT                                      4
1048810e230b6Smaya#define GUC                                      5
1048910e230b6Smaya};
1049010e230b6Smaya
1049196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1049296c5ddc4SrjsGFX9_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
1049310e230b6Smaya                    __attribute__((unused)) void * restrict dst,
1049496c5ddc4Srjs                    __attribute__((unused)) const struct GFX9_FAULT_REG * restrict values)
1049510e230b6Smaya{
1049610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1049710e230b6Smaya
1049810e230b6Smaya   dw[0] =
1049910e230b6Smaya      __gen_uint(values->ValidBit, 0, 0) |
1050010e230b6Smaya      __gen_uint(values->FaultType, 1, 2) |
1050110e230b6Smaya      __gen_uint(values->SRCIDofFault, 3, 10) |
1050210e230b6Smaya      __gen_uint(values->GTTSEL, 11, 11) |
1050310e230b6Smaya      __gen_uint(values->EngineID, 12, 14);
1050410e230b6Smaya}
1050510e230b6Smaya
1050696c5ddc4Srjs#define GFX9_GFX_ARB_ERROR_RPT_num        0x40a0
1050796c5ddc4Srjs#define GFX9_GFX_ARB_ERROR_RPT_length          1
1050896c5ddc4Srjsstruct GFX9_GFX_ARB_ERROR_RPT {
1050910e230b6Smaya   bool                                 TLBPageFaultError;
1051010e230b6Smaya   bool                                 RSTRMPAVPReadInvalid;
1051110e230b6Smaya   bool                                 InvalidPageDirectoryEntryError;
1051210e230b6Smaya   bool                                 ROSTRMPAVPInvalidPhysicalAddress;
1051310e230b6Smaya   bool                                 TLBPageVTDTranslationError;
1051410e230b6Smaya   bool                                 WRDPPAVPInvalid;
1051510e230b6Smaya   bool                                 PageDirectoryEntryVTDTranslationError;
1051610e230b6Smaya   bool                                 UnloadedPDError;
1051710e230b6Smaya   bool                                 GuCVTdtranslationPageFault2ndlevelUndefineddoorbell;
1051810e230b6Smaya   bool                                 NonWBmemorytypeforAdvancedContext;
1051910e230b6Smaya   bool                                 PASIDNotEnabled;
1052010e230b6Smaya   bool                                 PASIDBoundaryViolation;
1052110e230b6Smaya   bool                                 PASIDNotValid;
1052210e230b6Smaya   bool                                 PASIDWasZeroForUntranslatedRequest;
1052310e230b6Smaya   bool                                 ContextWasNotMarkedAsPresentWhenDoingDMA;
1052410e230b6Smaya};
1052510e230b6Smaya
1052696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1052796c5ddc4SrjsGFX9_GFX_ARB_ERROR_RPT_pack(__attribute__((unused)) __gen_user_data *data,
1052810e230b6Smaya                            __attribute__((unused)) void * restrict dst,
1052996c5ddc4Srjs                            __attribute__((unused)) const struct GFX9_GFX_ARB_ERROR_RPT * restrict values)
1053010e230b6Smaya{
1053110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1053210e230b6Smaya
1053310e230b6Smaya   dw[0] =
1053410e230b6Smaya      __gen_uint(values->TLBPageFaultError, 0, 0) |
1053510e230b6Smaya      __gen_uint(values->RSTRMPAVPReadInvalid, 1, 1) |
1053610e230b6Smaya      __gen_uint(values->InvalidPageDirectoryEntryError, 2, 2) |
1053710e230b6Smaya      __gen_uint(values->ROSTRMPAVPInvalidPhysicalAddress, 3, 3) |
1053810e230b6Smaya      __gen_uint(values->TLBPageVTDTranslationError, 4, 4) |
1053910e230b6Smaya      __gen_uint(values->WRDPPAVPInvalid, 5, 5) |
1054010e230b6Smaya      __gen_uint(values->PageDirectoryEntryVTDTranslationError, 6, 6) |
1054110e230b6Smaya      __gen_uint(values->UnloadedPDError, 8, 8) |
1054210e230b6Smaya      __gen_uint(values->GuCVTdtranslationPageFault2ndlevelUndefineddoorbell, 9, 9) |
1054310e230b6Smaya      __gen_uint(values->NonWBmemorytypeforAdvancedContext, 10, 10) |
1054410e230b6Smaya      __gen_uint(values->PASIDNotEnabled, 11, 11) |
1054510e230b6Smaya      __gen_uint(values->PASIDBoundaryViolation, 12, 12) |
1054610e230b6Smaya      __gen_uint(values->PASIDNotValid, 13, 13) |
1054710e230b6Smaya      __gen_uint(values->PASIDWasZeroForUntranslatedRequest, 14, 14) |
1054810e230b6Smaya      __gen_uint(values->ContextWasNotMarkedAsPresentWhenDoingDMA, 15, 15);
1054910e230b6Smaya}
1055010e230b6Smaya
1055196c5ddc4Srjs#define GFX9_GS_INVOCATION_COUNT_num      0x2328
1055296c5ddc4Srjs#define GFX9_GS_INVOCATION_COUNT_length        2
1055396c5ddc4Srjsstruct GFX9_GS_INVOCATION_COUNT {
1055410e230b6Smaya   uint64_t                             GSInvocationCountReport;
1055510e230b6Smaya};
1055610e230b6Smaya
1055796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1055896c5ddc4SrjsGFX9_GS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
1055910e230b6Smaya                              __attribute__((unused)) void * restrict dst,
1056096c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_GS_INVOCATION_COUNT * restrict values)
1056110e230b6Smaya{
1056210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1056310e230b6Smaya
1056410e230b6Smaya   const uint64_t v0 =
1056510e230b6Smaya      __gen_uint(values->GSInvocationCountReport, 0, 63);
1056610e230b6Smaya   dw[0] = v0;
1056710e230b6Smaya   dw[1] = v0 >> 32;
1056810e230b6Smaya}
1056910e230b6Smaya
1057096c5ddc4Srjs#define GFX9_GS_PRIMITIVES_COUNT_num      0x2330
1057196c5ddc4Srjs#define GFX9_GS_PRIMITIVES_COUNT_length        2
1057296c5ddc4Srjsstruct GFX9_GS_PRIMITIVES_COUNT {
1057310e230b6Smaya   uint64_t                             GSPrimitivesCountReport;
1057410e230b6Smaya};
1057510e230b6Smaya
1057696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1057796c5ddc4SrjsGFX9_GS_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
1057810e230b6Smaya                              __attribute__((unused)) void * restrict dst,
1057996c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_GS_PRIMITIVES_COUNT * restrict values)
1058010e230b6Smaya{
1058110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1058210e230b6Smaya
1058310e230b6Smaya   const uint64_t v0 =
1058410e230b6Smaya      __gen_uint(values->GSPrimitivesCountReport, 0, 63);
1058510e230b6Smaya   dw[0] = v0;
1058610e230b6Smaya   dw[1] = v0 >> 32;
1058710e230b6Smaya}
1058810e230b6Smaya
1058996c5ddc4Srjs#define GFX9_GT_MODE_num                  0x7008
1059096c5ddc4Srjs#define GFX9_GT_MODE_length                    1
1059196c5ddc4Srjsstruct GFX9_GT_MODE {
1059296c5ddc4Srjs   uint32_t                             SubsliceHashing;
1059396c5ddc4Srjs#define _8x8                                     0
1059496c5ddc4Srjs#define _16x4                                    1
1059596c5ddc4Srjs#define _8x4                                     2
1059696c5ddc4Srjs#define _16x16                                   3
1059796c5ddc4Srjs   uint32_t                             SliceHashing;
1059896c5ddc4Srjs#define NORMAL                                   0
1059996c5ddc4Srjs#define DISABLED                                 1
1060096c5ddc4Srjs#define _32x16                                   2
1060196c5ddc4Srjs#define _32x32                                   3
1060296c5ddc4Srjs   int32_t                              SubsliceHashingMask;
1060396c5ddc4Srjs   int32_t                              SliceHashingMask;
1060496c5ddc4Srjs};
1060596c5ddc4Srjs
1060696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1060796c5ddc4SrjsGFX9_GT_MODE_pack(__attribute__((unused)) __gen_user_data *data,
1060896c5ddc4Srjs                  __attribute__((unused)) void * restrict dst,
1060996c5ddc4Srjs                  __attribute__((unused)) const struct GFX9_GT_MODE * restrict values)
1061096c5ddc4Srjs{
1061196c5ddc4Srjs   uint32_t * restrict dw = (uint32_t * restrict) dst;
1061296c5ddc4Srjs
1061396c5ddc4Srjs   dw[0] =
1061496c5ddc4Srjs      __gen_uint(values->SubsliceHashing, 8, 9) |
1061596c5ddc4Srjs      __gen_uint(values->SliceHashing, 11, 12) |
1061696c5ddc4Srjs      __gen_sint(values->SubsliceHashingMask, 24, 25) |
1061796c5ddc4Srjs      __gen_sint(values->SliceHashingMask, 27, 28);
1061896c5ddc4Srjs}
1061996c5ddc4Srjs
1062096c5ddc4Srjs#define GFX9_HS_INVOCATION_COUNT_num      0x2300
1062196c5ddc4Srjs#define GFX9_HS_INVOCATION_COUNT_length        2
1062296c5ddc4Srjsstruct GFX9_HS_INVOCATION_COUNT {
1062310e230b6Smaya   uint64_t                             HSInvocationCountReport;
1062410e230b6Smaya};
1062510e230b6Smaya
1062696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1062796c5ddc4SrjsGFX9_HS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
1062810e230b6Smaya                              __attribute__((unused)) void * restrict dst,
1062996c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_HS_INVOCATION_COUNT * restrict values)
1063010e230b6Smaya{
1063110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1063210e230b6Smaya
1063310e230b6Smaya   const uint64_t v0 =
1063410e230b6Smaya      __gen_uint(values->HSInvocationCountReport, 0, 63);
1063510e230b6Smaya   dw[0] = v0;
1063610e230b6Smaya   dw[1] = v0 >> 32;
1063710e230b6Smaya}
1063810e230b6Smaya
1063996c5ddc4Srjs#define GFX9_IA_PRIMITIVES_COUNT_num      0x2318
1064096c5ddc4Srjs#define GFX9_IA_PRIMITIVES_COUNT_length        2
1064196c5ddc4Srjsstruct GFX9_IA_PRIMITIVES_COUNT {
1064210e230b6Smaya   uint64_t                             IAPrimitivesCountReport;
1064310e230b6Smaya};
1064410e230b6Smaya
1064596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1064696c5ddc4SrjsGFX9_IA_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
1064710e230b6Smaya                              __attribute__((unused)) void * restrict dst,
1064896c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_IA_PRIMITIVES_COUNT * restrict values)
1064910e230b6Smaya{
1065010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1065110e230b6Smaya
1065210e230b6Smaya   const uint64_t v0 =
1065310e230b6Smaya      __gen_uint(values->IAPrimitivesCountReport, 0, 63);
1065410e230b6Smaya   dw[0] = v0;
1065510e230b6Smaya   dw[1] = v0 >> 32;
1065610e230b6Smaya}
1065710e230b6Smaya
1065896c5ddc4Srjs#define GFX9_IA_VERTICES_COUNT_num        0x2310
1065996c5ddc4Srjs#define GFX9_IA_VERTICES_COUNT_length          2
1066096c5ddc4Srjsstruct GFX9_IA_VERTICES_COUNT {
1066110e230b6Smaya   uint64_t                             IAVerticesCountReport;
1066210e230b6Smaya};
1066310e230b6Smaya
1066496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1066596c5ddc4SrjsGFX9_IA_VERTICES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
1066610e230b6Smaya                            __attribute__((unused)) void * restrict dst,
1066796c5ddc4Srjs                            __attribute__((unused)) const struct GFX9_IA_VERTICES_COUNT * restrict values)
1066810e230b6Smaya{
1066910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1067010e230b6Smaya
1067110e230b6Smaya   const uint64_t v0 =
1067210e230b6Smaya      __gen_uint(values->IAVerticesCountReport, 0, 63);
1067310e230b6Smaya   dw[0] = v0;
1067410e230b6Smaya   dw[1] = v0 >> 32;
1067510e230b6Smaya}
1067610e230b6Smaya
1067796c5ddc4Srjs#define GFX9_INSTDONE_1_num               0x206c
1067896c5ddc4Srjs#define GFX9_INSTDONE_1_length                 1
1067996c5ddc4Srjsstruct GFX9_INSTDONE_1 {
1068010e230b6Smaya   bool                                 PRB0RingEnable;
1068110e230b6Smaya   bool                                 VFGDone;
1068210e230b6Smaya   bool                                 VSDone;
1068310e230b6Smaya   bool                                 HSDone;
1068410e230b6Smaya   bool                                 TEDone;
1068510e230b6Smaya   bool                                 DSDone;
1068610e230b6Smaya   bool                                 GSDone;
1068710e230b6Smaya   bool                                 SOLDone;
1068810e230b6Smaya   bool                                 CLDone;
1068910e230b6Smaya   bool                                 SFDone;
1069010e230b6Smaya   bool                                 TDGDone;
1069110e230b6Smaya   bool                                 URBMDone;
1069210e230b6Smaya   bool                                 SVGDone;
1069310e230b6Smaya   bool                                 GAFSDone;
1069410e230b6Smaya   bool                                 VFEDone;
1069510e230b6Smaya   bool                                 TSGDone;
1069610e230b6Smaya   bool                                 GAFMDone;
1069710e230b6Smaya   bool                                 GAMDone;
1069810e230b6Smaya   bool                                 RSDone;
1069910e230b6Smaya   bool                                 CSDone;
1070010e230b6Smaya   bool                                 SDEDone;
1070110e230b6Smaya   bool                                 RCCFBCCSDone;
1070210e230b6Smaya};
1070310e230b6Smaya
1070496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1070596c5ddc4SrjsGFX9_INSTDONE_1_pack(__attribute__((unused)) __gen_user_data *data,
1070610e230b6Smaya                     __attribute__((unused)) void * restrict dst,
1070796c5ddc4Srjs                     __attribute__((unused)) const struct GFX9_INSTDONE_1 * restrict values)
1070810e230b6Smaya{
1070910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1071010e230b6Smaya
1071110e230b6Smaya   dw[0] =
1071210e230b6Smaya      __gen_uint(values->PRB0RingEnable, 0, 0) |
1071310e230b6Smaya      __gen_uint(values->VFGDone, 1, 1) |
1071410e230b6Smaya      __gen_uint(values->VSDone, 2, 2) |
1071510e230b6Smaya      __gen_uint(values->HSDone, 3, 3) |
1071610e230b6Smaya      __gen_uint(values->TEDone, 4, 4) |
1071710e230b6Smaya      __gen_uint(values->DSDone, 5, 5) |
1071810e230b6Smaya      __gen_uint(values->GSDone, 6, 6) |
1071910e230b6Smaya      __gen_uint(values->SOLDone, 7, 7) |
1072010e230b6Smaya      __gen_uint(values->CLDone, 8, 8) |
1072110e230b6Smaya      __gen_uint(values->SFDone, 9, 9) |
1072210e230b6Smaya      __gen_uint(values->TDGDone, 12, 12) |
1072310e230b6Smaya      __gen_uint(values->URBMDone, 13, 13) |
1072410e230b6Smaya      __gen_uint(values->SVGDone, 14, 14) |
1072510e230b6Smaya      __gen_uint(values->GAFSDone, 15, 15) |
1072610e230b6Smaya      __gen_uint(values->VFEDone, 16, 16) |
1072710e230b6Smaya      __gen_uint(values->TSGDone, 17, 17) |
1072810e230b6Smaya      __gen_uint(values->GAFMDone, 18, 18) |
1072910e230b6Smaya      __gen_uint(values->GAMDone, 19, 19) |
1073010e230b6Smaya      __gen_uint(values->RSDone, 20, 20) |
1073110e230b6Smaya      __gen_uint(values->CSDone, 21, 21) |
1073210e230b6Smaya      __gen_uint(values->SDEDone, 22, 22) |
1073310e230b6Smaya      __gen_uint(values->RCCFBCCSDone, 23, 23);
1073410e230b6Smaya}
1073510e230b6Smaya
1073696c5ddc4Srjs#define GFX9_L3CNTLREG_num                0x7034
1073796c5ddc4Srjs#define GFX9_L3CNTLREG_length                  1
1073896c5ddc4Srjsstruct GFX9_L3CNTLREG {
1073910e230b6Smaya   bool                                 SLMEnable;
1074010e230b6Smaya   uint32_t                             URBAllocation;
1074110e230b6Smaya   uint32_t                             ROAllocation;
1074210e230b6Smaya   uint32_t                             DCAllocation;
1074310e230b6Smaya   uint32_t                             AllAllocation;
1074410e230b6Smaya};
1074510e230b6Smaya
1074696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1074796c5ddc4SrjsGFX9_L3CNTLREG_pack(__attribute__((unused)) __gen_user_data *data,
1074810e230b6Smaya                    __attribute__((unused)) void * restrict dst,
1074996c5ddc4Srjs                    __attribute__((unused)) const struct GFX9_L3CNTLREG * restrict values)
1075010e230b6Smaya{
1075110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1075210e230b6Smaya
1075310e230b6Smaya   dw[0] =
1075410e230b6Smaya      __gen_uint(values->SLMEnable, 0, 0) |
1075510e230b6Smaya      __gen_uint(values->URBAllocation, 1, 7) |
1075610e230b6Smaya      __gen_uint(values->ROAllocation, 11, 17) |
1075710e230b6Smaya      __gen_uint(values->DCAllocation, 18, 24) |
1075810e230b6Smaya      __gen_uint(values->AllAllocation, 25, 31);
1075910e230b6Smaya}
1076010e230b6Smaya
1076196c5ddc4Srjs#define GFX9_PERFCNT1_num                 0x91b8
1076296c5ddc4Srjs#define GFX9_PERFCNT1_length                   2
1076396c5ddc4Srjsstruct GFX9_PERFCNT1 {
1076496c5ddc4Srjs   uint64_t                             Value;
1076596c5ddc4Srjs   uint32_t                             EventSelection;
1076696c5ddc4Srjs   bool                                 CounterClear;
1076796c5ddc4Srjs   bool                                 EdgeDetect;
1076896c5ddc4Srjs   bool                                 OverflowEnable;
1076996c5ddc4Srjs   bool                                 CounterEnable;
1077096c5ddc4Srjs};
1077196c5ddc4Srjs
1077296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1077396c5ddc4SrjsGFX9_PERFCNT1_pack(__attribute__((unused)) __gen_user_data *data,
1077496c5ddc4Srjs                   __attribute__((unused)) void * restrict dst,
1077596c5ddc4Srjs                   __attribute__((unused)) const struct GFX9_PERFCNT1 * restrict values)
1077696c5ddc4Srjs{
1077796c5ddc4Srjs   uint32_t * restrict dw = (uint32_t * restrict) dst;
1077896c5ddc4Srjs
1077996c5ddc4Srjs   const uint64_t v0 =
1078096c5ddc4Srjs      __gen_uint(values->Value, 0, 43) |
1078196c5ddc4Srjs      __gen_uint(values->EventSelection, 52, 59) |
1078296c5ddc4Srjs      __gen_uint(values->CounterClear, 60, 60) |
1078396c5ddc4Srjs      __gen_uint(values->EdgeDetect, 61, 61) |
1078496c5ddc4Srjs      __gen_uint(values->OverflowEnable, 62, 62) |
1078596c5ddc4Srjs      __gen_uint(values->CounterEnable, 63, 63);
1078696c5ddc4Srjs   dw[0] = v0;
1078796c5ddc4Srjs   dw[1] = v0 >> 32;
1078896c5ddc4Srjs}
1078996c5ddc4Srjs
1079096c5ddc4Srjs#define GFX9_PERFCNT2_num                 0x91c0
1079196c5ddc4Srjs#define GFX9_PERFCNT2_length                   2
1079296c5ddc4Srjsstruct GFX9_PERFCNT2 {
1079396c5ddc4Srjs   uint64_t                             Value;
1079496c5ddc4Srjs   uint32_t                             EventSelection;
1079596c5ddc4Srjs   bool                                 CounterClear;
1079696c5ddc4Srjs   bool                                 EdgeDetect;
1079796c5ddc4Srjs   bool                                 OverflowEnable;
1079896c5ddc4Srjs   bool                                 CounterEnable;
1079996c5ddc4Srjs};
1080096c5ddc4Srjs
1080196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1080296c5ddc4SrjsGFX9_PERFCNT2_pack(__attribute__((unused)) __gen_user_data *data,
1080396c5ddc4Srjs                   __attribute__((unused)) void * restrict dst,
1080496c5ddc4Srjs                   __attribute__((unused)) const struct GFX9_PERFCNT2 * restrict values)
1080596c5ddc4Srjs{
1080696c5ddc4Srjs   uint32_t * restrict dw = (uint32_t * restrict) dst;
1080796c5ddc4Srjs
1080896c5ddc4Srjs   const uint64_t v0 =
1080996c5ddc4Srjs      __gen_uint(values->Value, 0, 43) |
1081096c5ddc4Srjs      __gen_uint(values->EventSelection, 52, 59) |
1081196c5ddc4Srjs      __gen_uint(values->CounterClear, 60, 60) |
1081296c5ddc4Srjs      __gen_uint(values->EdgeDetect, 61, 61) |
1081396c5ddc4Srjs      __gen_uint(values->OverflowEnable, 62, 62) |
1081496c5ddc4Srjs      __gen_uint(values->CounterEnable, 63, 63);
1081596c5ddc4Srjs   dw[0] = v0;
1081696c5ddc4Srjs   dw[1] = v0 >> 32;
1081796c5ddc4Srjs}
1081896c5ddc4Srjs
1081996c5ddc4Srjs#define GFX9_PS_INVOCATION_COUNT_num      0x2348
1082096c5ddc4Srjs#define GFX9_PS_INVOCATION_COUNT_length        2
1082196c5ddc4Srjsstruct GFX9_PS_INVOCATION_COUNT {
1082210e230b6Smaya   uint64_t                             PSInvocationCountReport;
1082310e230b6Smaya};
1082410e230b6Smaya
1082596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1082696c5ddc4SrjsGFX9_PS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
1082710e230b6Smaya                              __attribute__((unused)) void * restrict dst,
1082896c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_PS_INVOCATION_COUNT * restrict values)
1082910e230b6Smaya{
1083010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1083110e230b6Smaya
1083210e230b6Smaya   const uint64_t v0 =
1083310e230b6Smaya      __gen_uint(values->PSInvocationCountReport, 0, 63);
1083410e230b6Smaya   dw[0] = v0;
1083510e230b6Smaya   dw[1] = v0 >> 32;
1083610e230b6Smaya}
1083710e230b6Smaya
1083896c5ddc4Srjs#define GFX9_RCS_RING_BUFFER_CTL_num      0x203c
1083996c5ddc4Srjs#define GFX9_RCS_RING_BUFFER_CTL_length        1
1084096c5ddc4Srjsstruct GFX9_RCS_RING_BUFFER_CTL {
1084110e230b6Smaya   bool                                 RingBufferEnable;
1084210e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
1084310e230b6Smaya#define MI_AUTOREPORT_OFF                        0
1084410e230b6Smaya#define MI_AUTOREPORT_64KB                       1
1084510e230b6Smaya#define MI_AUTOREPORT_4KB                        2
1084610e230b6Smaya#define MI_AUTOREPORT_128KB                      3
1084710e230b6Smaya   bool                                 SemaphoreWait;
1084810e230b6Smaya   bool                                 RBWait;
1084910e230b6Smaya   uint32_t                             BufferLengthinpages1;
1085010e230b6Smaya};
1085110e230b6Smaya
1085296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1085396c5ddc4SrjsGFX9_RCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
1085410e230b6Smaya                              __attribute__((unused)) void * restrict dst,
1085596c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_RCS_RING_BUFFER_CTL * restrict values)
1085610e230b6Smaya{
1085710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1085810e230b6Smaya
1085910e230b6Smaya   dw[0] =
1086010e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
1086110e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
1086210e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
1086310e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
1086410e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
1086510e230b6Smaya}
1086610e230b6Smaya
1086796c5ddc4Srjs#define GFX9_ROW_INSTDONE_num             0xe164
1086896c5ddc4Srjs#define GFX9_ROW_INSTDONE_length               1
1086996c5ddc4Srjsstruct GFX9_ROW_INSTDONE {
1087010e230b6Smaya   bool                                 BCDone;
1087110e230b6Smaya   bool                                 PSDDone;
1087210e230b6Smaya   bool                                 DAPRDone;
1087310e230b6Smaya   bool                                 TDLDone;
1087410e230b6Smaya   bool                                 ICDone;
1087510e230b6Smaya   bool                                 MA0Done;
1087610e230b6Smaya   bool                                 EU00DoneSS0;
1087710e230b6Smaya   bool                                 EU01DoneSS0;
1087810e230b6Smaya   bool                                 EU02DoneSS0;
1087910e230b6Smaya   bool                                 EU03DoneSS0;
1088010e230b6Smaya   bool                                 EU10DoneSS0;
1088110e230b6Smaya   bool                                 EU11DoneSS0;
1088210e230b6Smaya   bool                                 EU12DoneSS0;
1088310e230b6Smaya   bool                                 EU13DoneSS0;
1088410e230b6Smaya   bool                                 MA1DoneSS0;
1088510e230b6Smaya};
1088610e230b6Smaya
1088796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1088896c5ddc4SrjsGFX9_ROW_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
1088910e230b6Smaya                       __attribute__((unused)) void * restrict dst,
1089096c5ddc4Srjs                       __attribute__((unused)) const struct GFX9_ROW_INSTDONE * restrict values)
1089110e230b6Smaya{
1089210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1089310e230b6Smaya
1089410e230b6Smaya   dw[0] =
1089510e230b6Smaya      __gen_uint(values->BCDone, 0, 0) |
1089610e230b6Smaya      __gen_uint(values->PSDDone, 1, 1) |
1089710e230b6Smaya      __gen_uint(values->DAPRDone, 3, 3) |
1089810e230b6Smaya      __gen_uint(values->TDLDone, 6, 6) |
1089910e230b6Smaya      __gen_uint(values->ICDone, 12, 12) |
1090010e230b6Smaya      __gen_uint(values->MA0Done, 15, 15) |
1090110e230b6Smaya      __gen_uint(values->EU00DoneSS0, 16, 16) |
1090210e230b6Smaya      __gen_uint(values->EU01DoneSS0, 17, 17) |
1090310e230b6Smaya      __gen_uint(values->EU02DoneSS0, 18, 18) |
1090410e230b6Smaya      __gen_uint(values->EU03DoneSS0, 19, 19) |
1090510e230b6Smaya      __gen_uint(values->EU10DoneSS0, 21, 21) |
1090610e230b6Smaya      __gen_uint(values->EU11DoneSS0, 22, 22) |
1090710e230b6Smaya      __gen_uint(values->EU12DoneSS0, 23, 23) |
1090810e230b6Smaya      __gen_uint(values->EU13DoneSS0, 24, 24) |
1090910e230b6Smaya      __gen_uint(values->MA1DoneSS0, 26, 26);
1091010e230b6Smaya}
1091110e230b6Smaya
1091296c5ddc4Srjs#define GFX9_RPSTAT0_num                  0xa01c
1091396c5ddc4Srjs#define GFX9_RPSTAT0_length                    1
1091496c5ddc4Srjsstruct GFX9_RPSTAT0 {
1091596c5ddc4Srjs   uint32_t                             PreviousGTFrequency;
1091696c5ddc4Srjs   uint32_t                             CurrentGTFrequency;
1091796c5ddc4Srjs};
1091896c5ddc4Srjs
1091996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1092096c5ddc4SrjsGFX9_RPSTAT0_pack(__attribute__((unused)) __gen_user_data *data,
1092196c5ddc4Srjs                  __attribute__((unused)) void * restrict dst,
1092296c5ddc4Srjs                  __attribute__((unused)) const struct GFX9_RPSTAT0 * restrict values)
1092396c5ddc4Srjs{
1092496c5ddc4Srjs   uint32_t * restrict dw = (uint32_t * restrict) dst;
1092596c5ddc4Srjs
1092696c5ddc4Srjs   dw[0] =
1092796c5ddc4Srjs      __gen_uint(values->PreviousGTFrequency, 0, 8) |
1092896c5ddc4Srjs      __gen_uint(values->CurrentGTFrequency, 23, 31);
1092996c5ddc4Srjs}
1093096c5ddc4Srjs
1093196c5ddc4Srjs#define GFX9_SAMPLER_INSTDONE_num         0xe160
1093296c5ddc4Srjs#define GFX9_SAMPLER_INSTDONE_length           1
1093396c5ddc4Srjsstruct GFX9_SAMPLER_INSTDONE {
1093410e230b6Smaya   bool                                 IMEDone;
1093510e230b6Smaya   bool                                 PL0Done;
1093610e230b6Smaya   bool                                 SO0Done;
1093710e230b6Smaya   bool                                 DG0Done;
1093810e230b6Smaya   bool                                 FT0Done;
1093910e230b6Smaya   bool                                 DM0Done;
1094010e230b6Smaya   bool                                 SCDone;
1094110e230b6Smaya   bool                                 FL0Done;
1094210e230b6Smaya   bool                                 QCDone;
1094310e230b6Smaya   bool                                 SVSMDone;
1094410e230b6Smaya   bool                                 SI0Done;
1094510e230b6Smaya   bool                                 MT0Done;
1094610e230b6Smaya   bool                                 AVSDone;
1094710e230b6Smaya   bool                                 IEFDone;
1094810e230b6Smaya   bool                                 CREDone;
1094910e230b6Smaya   bool                                 SVSMARB3;
1095010e230b6Smaya   bool                                 SVSMARB2;
1095110e230b6Smaya   bool                                 SVSMARB1;
1095210e230b6Smaya   bool                                 SVSMAdapter;
1095310e230b6Smaya   bool                                 BDMDone;
1095410e230b6Smaya};
1095510e230b6Smaya
1095696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1095796c5ddc4SrjsGFX9_SAMPLER_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
1095810e230b6Smaya                           __attribute__((unused)) void * restrict dst,
1095996c5ddc4Srjs                           __attribute__((unused)) const struct GFX9_SAMPLER_INSTDONE * restrict values)
1096010e230b6Smaya{
1096110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1096210e230b6Smaya
1096310e230b6Smaya   dw[0] =
1096410e230b6Smaya      __gen_uint(values->IMEDone, 0, 0) |
1096510e230b6Smaya      __gen_uint(values->PL0Done, 1, 1) |
1096610e230b6Smaya      __gen_uint(values->SO0Done, 2, 2) |
1096710e230b6Smaya      __gen_uint(values->DG0Done, 3, 3) |
1096810e230b6Smaya      __gen_uint(values->FT0Done, 4, 4) |
1096910e230b6Smaya      __gen_uint(values->DM0Done, 5, 5) |
1097010e230b6Smaya      __gen_uint(values->SCDone, 6, 6) |
1097110e230b6Smaya      __gen_uint(values->FL0Done, 7, 7) |
1097210e230b6Smaya      __gen_uint(values->QCDone, 8, 8) |
1097310e230b6Smaya      __gen_uint(values->SVSMDone, 9, 9) |
1097410e230b6Smaya      __gen_uint(values->SI0Done, 10, 10) |
1097510e230b6Smaya      __gen_uint(values->MT0Done, 11, 11) |
1097610e230b6Smaya      __gen_uint(values->AVSDone, 12, 12) |
1097710e230b6Smaya      __gen_uint(values->IEFDone, 13, 13) |
1097810e230b6Smaya      __gen_uint(values->CREDone, 14, 14) |
1097910e230b6Smaya      __gen_uint(values->SVSMARB3, 15, 15) |
1098010e230b6Smaya      __gen_uint(values->SVSMARB2, 16, 16) |
1098110e230b6Smaya      __gen_uint(values->SVSMARB1, 17, 17) |
1098210e230b6Smaya      __gen_uint(values->SVSMAdapter, 18, 18) |
1098310e230b6Smaya      __gen_uint(values->BDMDone, 19, 19);
1098410e230b6Smaya}
1098510e230b6Smaya
1098696c5ddc4Srjs#define GFX9_SC_INSTDONE_num              0x7100
1098796c5ddc4Srjs#define GFX9_SC_INSTDONE_length                1
1098896c5ddc4Srjsstruct GFX9_SC_INSTDONE {
1098910e230b6Smaya   bool                                 SVLDone;
1099010e230b6Smaya   bool                                 WMFEDone;
1099110e230b6Smaya   bool                                 WMBEDone;
1099210e230b6Smaya   bool                                 HIZDone;
1099310e230b6Smaya   bool                                 STCDone;
1099410e230b6Smaya   bool                                 IZDone;
1099510e230b6Smaya   bool                                 SBEDone;
1099610e230b6Smaya   bool                                 RCZDone;
1099710e230b6Smaya   bool                                 RCCDone;
1099810e230b6Smaya   bool                                 RCPBEDone;
1099910e230b6Smaya   bool                                 RCPFEDone;
1100010e230b6Smaya   bool                                 DAPBDone;
1100110e230b6Smaya   bool                                 DAPRBEDone;
1100210e230b6Smaya   bool                                 SARBDone;
1100310e230b6Smaya   bool                                 DC0Done;
1100410e230b6Smaya   bool                                 DC1Done;
1100510e230b6Smaya   bool                                 DC2Done;
1100610e230b6Smaya   bool                                 DC3Done;
1100710e230b6Smaya   bool                                 GW0Done;
1100810e230b6Smaya   bool                                 GW1Done;
1100910e230b6Smaya   bool                                 GW2Done;
1101010e230b6Smaya   bool                                 GW3Done;
1101110e230b6Smaya   bool                                 TDCDone;
1101210e230b6Smaya};
1101310e230b6Smaya
1101496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1101596c5ddc4SrjsGFX9_SC_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
1101610e230b6Smaya                      __attribute__((unused)) void * restrict dst,
1101796c5ddc4Srjs                      __attribute__((unused)) const struct GFX9_SC_INSTDONE * restrict values)
1101810e230b6Smaya{
1101910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1102010e230b6Smaya
1102110e230b6Smaya   dw[0] =
1102210e230b6Smaya      __gen_uint(values->SVLDone, 0, 0) |
1102310e230b6Smaya      __gen_uint(values->WMFEDone, 1, 1) |
1102410e230b6Smaya      __gen_uint(values->WMBEDone, 2, 2) |
1102510e230b6Smaya      __gen_uint(values->HIZDone, 3, 3) |
1102610e230b6Smaya      __gen_uint(values->STCDone, 4, 4) |
1102710e230b6Smaya      __gen_uint(values->IZDone, 5, 5) |
1102810e230b6Smaya      __gen_uint(values->SBEDone, 6, 6) |
1102910e230b6Smaya      __gen_uint(values->RCZDone, 8, 8) |
1103010e230b6Smaya      __gen_uint(values->RCCDone, 9, 9) |
1103110e230b6Smaya      __gen_uint(values->RCPBEDone, 10, 10) |
1103210e230b6Smaya      __gen_uint(values->RCPFEDone, 11, 11) |
1103310e230b6Smaya      __gen_uint(values->DAPBDone, 12, 12) |
1103410e230b6Smaya      __gen_uint(values->DAPRBEDone, 13, 13) |
1103510e230b6Smaya      __gen_uint(values->SARBDone, 15, 15) |
1103610e230b6Smaya      __gen_uint(values->DC0Done, 16, 16) |
1103710e230b6Smaya      __gen_uint(values->DC1Done, 17, 17) |
1103810e230b6Smaya      __gen_uint(values->DC2Done, 18, 18) |
1103910e230b6Smaya      __gen_uint(values->DC3Done, 19, 19) |
1104010e230b6Smaya      __gen_uint(values->GW0Done, 20, 20) |
1104110e230b6Smaya      __gen_uint(values->GW1Done, 21, 21) |
1104210e230b6Smaya      __gen_uint(values->GW2Done, 22, 22) |
1104310e230b6Smaya      __gen_uint(values->GW3Done, 23, 23) |
1104410e230b6Smaya      __gen_uint(values->TDCDone, 24, 24);
1104510e230b6Smaya}
1104610e230b6Smaya
1104796c5ddc4Srjs#define GFX9_SLICE_COMMON_ECO_CHICKEN1_num 0x731c
1104896c5ddc4Srjs#define GFX9_SLICE_COMMON_ECO_CHICKEN1_length      1
1104996c5ddc4Srjsstruct GFX9_SLICE_COMMON_ECO_CHICKEN1 {
1105010e230b6Smaya   uint32_t                             GLKBarrierMode;
1105110e230b6Smaya#define GLK_BARRIER_MODE_GPGPU                   0
1105210e230b6Smaya#define GLK_BARRIER_MODE_3D_HULL                 1
1105310e230b6Smaya   bool                                 GLKBarrierModeMask;
1105410e230b6Smaya};
1105510e230b6Smaya
1105696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1105796c5ddc4SrjsGFX9_SLICE_COMMON_ECO_CHICKEN1_pack(__attribute__((unused)) __gen_user_data *data,
1105810e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
1105996c5ddc4Srjs                                    __attribute__((unused)) const struct GFX9_SLICE_COMMON_ECO_CHICKEN1 * restrict values)
1106010e230b6Smaya{
1106110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1106210e230b6Smaya
1106310e230b6Smaya   dw[0] =
1106410e230b6Smaya      __gen_uint(values->GLKBarrierMode, 7, 7) |
1106510e230b6Smaya      __gen_uint(values->GLKBarrierModeMask, 23, 23);
1106610e230b6Smaya}
1106710e230b6Smaya
1106896c5ddc4Srjs#define GFX9_SO_NUM_PRIMS_WRITTEN0_num    0x5200
1106996c5ddc4Srjs#define GFX9_SO_NUM_PRIMS_WRITTEN0_length      2
1107096c5ddc4Srjsstruct GFX9_SO_NUM_PRIMS_WRITTEN0 {
1107110e230b6Smaya   uint64_t                             NumPrimsWrittenCount;
1107210e230b6Smaya};
1107310e230b6Smaya
1107496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1107596c5ddc4SrjsGFX9_SO_NUM_PRIMS_WRITTEN0_pack(__attribute__((unused)) __gen_user_data *data,
1107610e230b6Smaya                                __attribute__((unused)) void * restrict dst,
1107796c5ddc4Srjs                                __attribute__((unused)) const struct GFX9_SO_NUM_PRIMS_WRITTEN0 * restrict values)
1107810e230b6Smaya{
1107910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1108010e230b6Smaya
1108110e230b6Smaya   const uint64_t v0 =
1108210e230b6Smaya      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
1108310e230b6Smaya   dw[0] = v0;
1108410e230b6Smaya   dw[1] = v0 >> 32;
1108510e230b6Smaya}
1108610e230b6Smaya
1108796c5ddc4Srjs#define GFX9_SO_NUM_PRIMS_WRITTEN1_num    0x5208
1108896c5ddc4Srjs#define GFX9_SO_NUM_PRIMS_WRITTEN1_length      2
1108996c5ddc4Srjsstruct GFX9_SO_NUM_PRIMS_WRITTEN1 {
1109010e230b6Smaya   uint64_t                             NumPrimsWrittenCount;
1109110e230b6Smaya};
1109210e230b6Smaya
1109396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1109496c5ddc4SrjsGFX9_SO_NUM_PRIMS_WRITTEN1_pack(__attribute__((unused)) __gen_user_data *data,
1109510e230b6Smaya                                __attribute__((unused)) void * restrict dst,
1109696c5ddc4Srjs                                __attribute__((unused)) const struct GFX9_SO_NUM_PRIMS_WRITTEN1 * restrict values)
1109710e230b6Smaya{
1109810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1109910e230b6Smaya
1110010e230b6Smaya   const uint64_t v0 =
1110110e230b6Smaya      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
1110210e230b6Smaya   dw[0] = v0;
1110310e230b6Smaya   dw[1] = v0 >> 32;
1110410e230b6Smaya}
1110510e230b6Smaya
1110696c5ddc4Srjs#define GFX9_SO_NUM_PRIMS_WRITTEN2_num    0x5210
1110796c5ddc4Srjs#define GFX9_SO_NUM_PRIMS_WRITTEN2_length      2
1110896c5ddc4Srjsstruct GFX9_SO_NUM_PRIMS_WRITTEN2 {
1110910e230b6Smaya   uint64_t                             NumPrimsWrittenCount;
1111010e230b6Smaya};
1111110e230b6Smaya
1111296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1111396c5ddc4SrjsGFX9_SO_NUM_PRIMS_WRITTEN2_pack(__attribute__((unused)) __gen_user_data *data,
1111410e230b6Smaya                                __attribute__((unused)) void * restrict dst,
1111596c5ddc4Srjs                                __attribute__((unused)) const struct GFX9_SO_NUM_PRIMS_WRITTEN2 * restrict values)
1111610e230b6Smaya{
1111710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1111810e230b6Smaya
1111910e230b6Smaya   const uint64_t v0 =
1112010e230b6Smaya      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
1112110e230b6Smaya   dw[0] = v0;
1112210e230b6Smaya   dw[1] = v0 >> 32;
1112310e230b6Smaya}
1112410e230b6Smaya
1112596c5ddc4Srjs#define GFX9_SO_NUM_PRIMS_WRITTEN3_num    0x5218
1112696c5ddc4Srjs#define GFX9_SO_NUM_PRIMS_WRITTEN3_length      2
1112796c5ddc4Srjsstruct GFX9_SO_NUM_PRIMS_WRITTEN3 {
1112810e230b6Smaya   uint64_t                             NumPrimsWrittenCount;
1112910e230b6Smaya};
1113010e230b6Smaya
1113196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1113296c5ddc4SrjsGFX9_SO_NUM_PRIMS_WRITTEN3_pack(__attribute__((unused)) __gen_user_data *data,
1113310e230b6Smaya                                __attribute__((unused)) void * restrict dst,
1113496c5ddc4Srjs                                __attribute__((unused)) const struct GFX9_SO_NUM_PRIMS_WRITTEN3 * restrict values)
1113510e230b6Smaya{
1113610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1113710e230b6Smaya
1113810e230b6Smaya   const uint64_t v0 =
1113910e230b6Smaya      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
1114010e230b6Smaya   dw[0] = v0;
1114110e230b6Smaya   dw[1] = v0 >> 32;
1114210e230b6Smaya}
1114310e230b6Smaya
1114496c5ddc4Srjs#define GFX9_SO_PRIM_STORAGE_NEEDED0_num  0x5240
1114596c5ddc4Srjs#define GFX9_SO_PRIM_STORAGE_NEEDED0_length      2
1114696c5ddc4Srjsstruct GFX9_SO_PRIM_STORAGE_NEEDED0 {
1114710e230b6Smaya   uint64_t                             PrimStorageNeededCount;
1114810e230b6Smaya};
1114910e230b6Smaya
1115096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1115196c5ddc4SrjsGFX9_SO_PRIM_STORAGE_NEEDED0_pack(__attribute__((unused)) __gen_user_data *data,
1115210e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
1115396c5ddc4Srjs                                  __attribute__((unused)) const struct GFX9_SO_PRIM_STORAGE_NEEDED0 * restrict values)
1115410e230b6Smaya{
1115510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1115610e230b6Smaya
1115710e230b6Smaya   const uint64_t v0 =
1115810e230b6Smaya      __gen_uint(values->PrimStorageNeededCount, 0, 63);
1115910e230b6Smaya   dw[0] = v0;
1116010e230b6Smaya   dw[1] = v0 >> 32;
1116110e230b6Smaya}
1116210e230b6Smaya
1116396c5ddc4Srjs#define GFX9_SO_PRIM_STORAGE_NEEDED1_num  0x5248
1116496c5ddc4Srjs#define GFX9_SO_PRIM_STORAGE_NEEDED1_length      2
1116596c5ddc4Srjsstruct GFX9_SO_PRIM_STORAGE_NEEDED1 {
1116610e230b6Smaya   uint64_t                             PrimStorageNeededCount;
1116710e230b6Smaya};
1116810e230b6Smaya
1116996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1117096c5ddc4SrjsGFX9_SO_PRIM_STORAGE_NEEDED1_pack(__attribute__((unused)) __gen_user_data *data,
1117110e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
1117296c5ddc4Srjs                                  __attribute__((unused)) const struct GFX9_SO_PRIM_STORAGE_NEEDED1 * restrict values)
1117310e230b6Smaya{
1117410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1117510e230b6Smaya
1117610e230b6Smaya   const uint64_t v0 =
1117710e230b6Smaya      __gen_uint(values->PrimStorageNeededCount, 0, 63);
1117810e230b6Smaya   dw[0] = v0;
1117910e230b6Smaya   dw[1] = v0 >> 32;
1118010e230b6Smaya}
1118110e230b6Smaya
1118296c5ddc4Srjs#define GFX9_SO_PRIM_STORAGE_NEEDED2_num  0x5250
1118396c5ddc4Srjs#define GFX9_SO_PRIM_STORAGE_NEEDED2_length      2
1118496c5ddc4Srjsstruct GFX9_SO_PRIM_STORAGE_NEEDED2 {
1118510e230b6Smaya   uint64_t                             PrimStorageNeededCount;
1118610e230b6Smaya};
1118710e230b6Smaya
1118896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1118996c5ddc4SrjsGFX9_SO_PRIM_STORAGE_NEEDED2_pack(__attribute__((unused)) __gen_user_data *data,
1119010e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
1119196c5ddc4Srjs                                  __attribute__((unused)) const struct GFX9_SO_PRIM_STORAGE_NEEDED2 * restrict values)
1119210e230b6Smaya{
1119310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1119410e230b6Smaya
1119510e230b6Smaya   const uint64_t v0 =
1119610e230b6Smaya      __gen_uint(values->PrimStorageNeededCount, 0, 63);
1119710e230b6Smaya   dw[0] = v0;
1119810e230b6Smaya   dw[1] = v0 >> 32;
1119910e230b6Smaya}
1120010e230b6Smaya
1120196c5ddc4Srjs#define GFX9_SO_PRIM_STORAGE_NEEDED3_num  0x5258
1120296c5ddc4Srjs#define GFX9_SO_PRIM_STORAGE_NEEDED3_length      2
1120396c5ddc4Srjsstruct GFX9_SO_PRIM_STORAGE_NEEDED3 {
1120410e230b6Smaya   uint64_t                             PrimStorageNeededCount;
1120510e230b6Smaya};
1120610e230b6Smaya
1120796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1120896c5ddc4SrjsGFX9_SO_PRIM_STORAGE_NEEDED3_pack(__attribute__((unused)) __gen_user_data *data,
1120910e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
1121096c5ddc4Srjs                                  __attribute__((unused)) const struct GFX9_SO_PRIM_STORAGE_NEEDED3 * restrict values)
1121110e230b6Smaya{
1121210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1121310e230b6Smaya
1121410e230b6Smaya   const uint64_t v0 =
1121510e230b6Smaya      __gen_uint(values->PrimStorageNeededCount, 0, 63);
1121610e230b6Smaya   dw[0] = v0;
1121710e230b6Smaya   dw[1] = v0 >> 32;
1121810e230b6Smaya}
1121910e230b6Smaya
1122096c5ddc4Srjs#define GFX9_SO_WRITE_OFFSET0_num         0x5280
1122196c5ddc4Srjs#define GFX9_SO_WRITE_OFFSET0_length           1
1122296c5ddc4Srjsstruct GFX9_SO_WRITE_OFFSET0 {
1122310e230b6Smaya   uint64_t                             WriteOffset;
1122410e230b6Smaya};
1122510e230b6Smaya
1122696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1122796c5ddc4SrjsGFX9_SO_WRITE_OFFSET0_pack(__attribute__((unused)) __gen_user_data *data,
1122810e230b6Smaya                           __attribute__((unused)) void * restrict dst,
1122996c5ddc4Srjs                           __attribute__((unused)) const struct GFX9_SO_WRITE_OFFSET0 * restrict values)
1123010e230b6Smaya{
1123110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1123210e230b6Smaya
1123310e230b6Smaya   dw[0] =
1123410e230b6Smaya      __gen_offset(values->WriteOffset, 2, 31);
1123510e230b6Smaya}
1123610e230b6Smaya
1123796c5ddc4Srjs#define GFX9_SO_WRITE_OFFSET1_num         0x5284
1123896c5ddc4Srjs#define GFX9_SO_WRITE_OFFSET1_length           1
1123996c5ddc4Srjsstruct GFX9_SO_WRITE_OFFSET1 {
1124010e230b6Smaya   uint64_t                             WriteOffset;
1124110e230b6Smaya};
1124210e230b6Smaya
1124396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1124496c5ddc4SrjsGFX9_SO_WRITE_OFFSET1_pack(__attribute__((unused)) __gen_user_data *data,
1124510e230b6Smaya                           __attribute__((unused)) void * restrict dst,
1124696c5ddc4Srjs                           __attribute__((unused)) const struct GFX9_SO_WRITE_OFFSET1 * restrict values)
1124710e230b6Smaya{
1124810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1124910e230b6Smaya
1125010e230b6Smaya   dw[0] =
1125110e230b6Smaya      __gen_offset(values->WriteOffset, 2, 31);
1125210e230b6Smaya}
1125310e230b6Smaya
1125496c5ddc4Srjs#define GFX9_SO_WRITE_OFFSET2_num         0x5288
1125596c5ddc4Srjs#define GFX9_SO_WRITE_OFFSET2_length           1
1125696c5ddc4Srjsstruct GFX9_SO_WRITE_OFFSET2 {
1125710e230b6Smaya   uint64_t                             WriteOffset;
1125810e230b6Smaya};
1125910e230b6Smaya
1126096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1126196c5ddc4SrjsGFX9_SO_WRITE_OFFSET2_pack(__attribute__((unused)) __gen_user_data *data,
1126210e230b6Smaya                           __attribute__((unused)) void * restrict dst,
1126396c5ddc4Srjs                           __attribute__((unused)) const struct GFX9_SO_WRITE_OFFSET2 * restrict values)
1126410e230b6Smaya{
1126510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1126610e230b6Smaya
1126710e230b6Smaya   dw[0] =
1126810e230b6Smaya      __gen_offset(values->WriteOffset, 2, 31);
1126910e230b6Smaya}
1127010e230b6Smaya
1127196c5ddc4Srjs#define GFX9_SO_WRITE_OFFSET3_num         0x528c
1127296c5ddc4Srjs#define GFX9_SO_WRITE_OFFSET3_length           1
1127396c5ddc4Srjsstruct GFX9_SO_WRITE_OFFSET3 {
1127410e230b6Smaya   uint64_t                             WriteOffset;
1127510e230b6Smaya};
1127610e230b6Smaya
1127796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1127896c5ddc4SrjsGFX9_SO_WRITE_OFFSET3_pack(__attribute__((unused)) __gen_user_data *data,
1127910e230b6Smaya                           __attribute__((unused)) void * restrict dst,
1128096c5ddc4Srjs                           __attribute__((unused)) const struct GFX9_SO_WRITE_OFFSET3 * restrict values)
1128110e230b6Smaya{
1128210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1128310e230b6Smaya
1128410e230b6Smaya   dw[0] =
1128510e230b6Smaya      __gen_offset(values->WriteOffset, 2, 31);
1128610e230b6Smaya}
1128710e230b6Smaya
1128896c5ddc4Srjs#define GFX9_VCS2_RING_BUFFER_CTL_num     0x1203c
1128996c5ddc4Srjs#define GFX9_VCS2_RING_BUFFER_CTL_length       1
1129096c5ddc4Srjsstruct GFX9_VCS2_RING_BUFFER_CTL {
1129110e230b6Smaya   bool                                 RingBufferEnable;
1129210e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
1129310e230b6Smaya#define MI_AUTOREPORT_OFF                        0
1129410e230b6Smaya#define MI_AUTOREPORT_64KB                       1
1129510e230b6Smaya#define MI_AUTOREPORT_4KB                        2
1129610e230b6Smaya#define MI_AUTOREPORT_128KB                      3
1129710e230b6Smaya   bool                                 DisableRegisterAccesses;
1129810e230b6Smaya   bool                                 SemaphoreWait;
1129910e230b6Smaya   bool                                 RBWait;
1130010e230b6Smaya   uint32_t                             BufferLengthinpages1;
1130110e230b6Smaya};
1130210e230b6Smaya
1130396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1130496c5ddc4SrjsGFX9_VCS2_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
1130510e230b6Smaya                               __attribute__((unused)) void * restrict dst,
1130696c5ddc4Srjs                               __attribute__((unused)) const struct GFX9_VCS2_RING_BUFFER_CTL * restrict values)
1130710e230b6Smaya{
1130810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1130910e230b6Smaya
1131010e230b6Smaya   dw[0] =
1131110e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
1131210e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
1131310e230b6Smaya      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
1131410e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
1131510e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
1131610e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
1131710e230b6Smaya}
1131810e230b6Smaya
1131996c5ddc4Srjs#define GFX9_VCS_ACTHD_UDW_num            0x1205c
1132096c5ddc4Srjs#define GFX9_VCS_ACTHD_UDW_length              1
1132196c5ddc4Srjsstruct GFX9_VCS_ACTHD_UDW {
1132210e230b6Smaya   uint32_t                             HeadPointerUpperDWORD;
1132310e230b6Smaya};
1132410e230b6Smaya
1132596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1132696c5ddc4SrjsGFX9_VCS_ACTHD_UDW_pack(__attribute__((unused)) __gen_user_data *data,
1132710e230b6Smaya                        __attribute__((unused)) void * restrict dst,
1132896c5ddc4Srjs                        __attribute__((unused)) const struct GFX9_VCS_ACTHD_UDW * restrict values)
1132910e230b6Smaya{
1133010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1133110e230b6Smaya
1133210e230b6Smaya   dw[0] =
1133310e230b6Smaya      __gen_uint(values->HeadPointerUpperDWORD, 0, 15);
1133410e230b6Smaya}
1133510e230b6Smaya
1133696c5ddc4Srjs#define GFX9_VCS_INSTDONE_num             0x1206c
1133796c5ddc4Srjs#define GFX9_VCS_INSTDONE_length               1
1133896c5ddc4Srjsstruct GFX9_VCS_INSTDONE {
1133910e230b6Smaya   bool                                 RingEnable;
1134010e230b6Smaya   bool                                 USBDone;
1134110e230b6Smaya   bool                                 QRCDone;
1134210e230b6Smaya   bool                                 SECDone;
1134310e230b6Smaya   bool                                 MPCDone;
1134410e230b6Smaya   bool                                 VFTDone;
1134510e230b6Smaya   bool                                 BSPDone;
1134610e230b6Smaya   bool                                 VLFDone;
1134710e230b6Smaya   bool                                 VOPDone;
1134810e230b6Smaya   bool                                 VMCDone;
1134910e230b6Smaya   bool                                 VIPDone;
1135010e230b6Smaya   bool                                 VITDone;
1135110e230b6Smaya   bool                                 VDSDone;
1135210e230b6Smaya   bool                                 VMXDone;
1135310e230b6Smaya   bool                                 VCPDone;
1135410e230b6Smaya   bool                                 VCDDone;
1135510e230b6Smaya   bool                                 VADDone;
1135610e230b6Smaya   bool                                 VMDDone;
1135710e230b6Smaya   bool                                 VISDone;
1135810e230b6Smaya   bool                                 VACDone;
1135910e230b6Smaya   bool                                 VAMDone;
1136010e230b6Smaya   bool                                 JPGDone;
1136110e230b6Smaya   bool                                 VBPDone;
1136210e230b6Smaya   bool                                 VHRDone;
1136310e230b6Smaya   bool                                 VCIDone;
1136410e230b6Smaya   bool                                 VCRDone;
1136510e230b6Smaya   bool                                 VINDone;
1136610e230b6Smaya   bool                                 VPRDone;
1136710e230b6Smaya   bool                                 VTQDone;
1136810e230b6Smaya   bool                                 Reserved;
1136910e230b6Smaya   bool                                 VCSDone;
1137010e230b6Smaya   bool                                 GACDone;
1137110e230b6Smaya};
1137210e230b6Smaya
1137396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1137496c5ddc4SrjsGFX9_VCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
1137510e230b6Smaya                       __attribute__((unused)) void * restrict dst,
1137696c5ddc4Srjs                       __attribute__((unused)) const struct GFX9_VCS_INSTDONE * restrict values)
1137710e230b6Smaya{
1137810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1137910e230b6Smaya
1138010e230b6Smaya   dw[0] =
1138110e230b6Smaya      __gen_uint(values->RingEnable, 0, 0) |
1138210e230b6Smaya      __gen_uint(values->USBDone, 1, 1) |
1138310e230b6Smaya      __gen_uint(values->QRCDone, 2, 2) |
1138410e230b6Smaya      __gen_uint(values->SECDone, 3, 3) |
1138510e230b6Smaya      __gen_uint(values->MPCDone, 4, 4) |
1138610e230b6Smaya      __gen_uint(values->VFTDone, 5, 5) |
1138710e230b6Smaya      __gen_uint(values->BSPDone, 6, 6) |
1138810e230b6Smaya      __gen_uint(values->VLFDone, 7, 7) |
1138910e230b6Smaya      __gen_uint(values->VOPDone, 8, 8) |
1139010e230b6Smaya      __gen_uint(values->VMCDone, 9, 9) |
1139110e230b6Smaya      __gen_uint(values->VIPDone, 10, 10) |
1139210e230b6Smaya      __gen_uint(values->VITDone, 11, 11) |
1139310e230b6Smaya      __gen_uint(values->VDSDone, 12, 12) |
1139410e230b6Smaya      __gen_uint(values->VMXDone, 13, 13) |
1139510e230b6Smaya      __gen_uint(values->VCPDone, 14, 14) |
1139610e230b6Smaya      __gen_uint(values->VCDDone, 15, 15) |
1139710e230b6Smaya      __gen_uint(values->VADDone, 16, 16) |
1139810e230b6Smaya      __gen_uint(values->VMDDone, 17, 17) |
1139910e230b6Smaya      __gen_uint(values->VISDone, 18, 18) |
1140010e230b6Smaya      __gen_uint(values->VACDone, 19, 19) |
1140110e230b6Smaya      __gen_uint(values->VAMDone, 20, 20) |
1140210e230b6Smaya      __gen_uint(values->JPGDone, 21, 21) |
1140310e230b6Smaya      __gen_uint(values->VBPDone, 22, 22) |
1140410e230b6Smaya      __gen_uint(values->VHRDone, 23, 23) |
1140510e230b6Smaya      __gen_uint(values->VCIDone, 24, 24) |
1140610e230b6Smaya      __gen_uint(values->VCRDone, 25, 25) |
1140710e230b6Smaya      __gen_uint(values->VINDone, 26, 26) |
1140810e230b6Smaya      __gen_uint(values->VPRDone, 27, 27) |
1140910e230b6Smaya      __gen_uint(values->VTQDone, 28, 28) |
1141010e230b6Smaya      __gen_uint(values->Reserved, 29, 29) |
1141110e230b6Smaya      __gen_uint(values->VCSDone, 30, 30) |
1141210e230b6Smaya      __gen_uint(values->GACDone, 31, 31);
1141310e230b6Smaya}
1141410e230b6Smaya
1141596c5ddc4Srjs#define GFX9_VCS_RING_BUFFER_CTL_num      0x1203c
1141696c5ddc4Srjs#define GFX9_VCS_RING_BUFFER_CTL_length        1
1141796c5ddc4Srjsstruct GFX9_VCS_RING_BUFFER_CTL {
1141810e230b6Smaya   bool                                 RingBufferEnable;
1141910e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
1142010e230b6Smaya#define MI_AUTOREPORT_OFF                        0
1142110e230b6Smaya#define MI_AUTOREPORT_64KB                       1
1142210e230b6Smaya#define MI_AUTOREPORT_4KB                        2
1142310e230b6Smaya#define MI_AUTOREPORT_128KB                      3
1142410e230b6Smaya   bool                                 DisableRegisterAccesses;
1142510e230b6Smaya   bool                                 SemaphoreWait;
1142610e230b6Smaya   bool                                 RBWait;
1142710e230b6Smaya   uint32_t                             BufferLengthinpages1;
1142810e230b6Smaya};
1142910e230b6Smaya
1143096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1143196c5ddc4SrjsGFX9_VCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
1143210e230b6Smaya                              __attribute__((unused)) void * restrict dst,
1143396c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_VCS_RING_BUFFER_CTL * restrict values)
1143410e230b6Smaya{
1143510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1143610e230b6Smaya
1143710e230b6Smaya   dw[0] =
1143810e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
1143910e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
1144010e230b6Smaya      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
1144110e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
1144210e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
1144310e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
1144410e230b6Smaya}
1144510e230b6Smaya
1144696c5ddc4Srjs#define GFX9_VECS_ACTHD_UDW_num           0x1a05c
1144796c5ddc4Srjs#define GFX9_VECS_ACTHD_UDW_length             1
1144896c5ddc4Srjsstruct GFX9_VECS_ACTHD_UDW {
1144910e230b6Smaya   uint32_t                             HeadPointerUpperDWORD;
1145010e230b6Smaya};
1145110e230b6Smaya
1145296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1145396c5ddc4SrjsGFX9_VECS_ACTHD_UDW_pack(__attribute__((unused)) __gen_user_data *data,
1145410e230b6Smaya                         __attribute__((unused)) void * restrict dst,
1145596c5ddc4Srjs                         __attribute__((unused)) const struct GFX9_VECS_ACTHD_UDW * restrict values)
1145610e230b6Smaya{
1145710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1145810e230b6Smaya
1145910e230b6Smaya   dw[0] =
1146010e230b6Smaya      __gen_uint(values->HeadPointerUpperDWORD, 0, 15);
1146110e230b6Smaya}
1146210e230b6Smaya
1146396c5ddc4Srjs#define GFX9_VECS_INSTDONE_num            0x1a06c
1146496c5ddc4Srjs#define GFX9_VECS_INSTDONE_length              1
1146596c5ddc4Srjsstruct GFX9_VECS_INSTDONE {
1146610e230b6Smaya   bool                                 RingEnable;
1146710e230b6Smaya   bool                                 VECSDone;
1146810e230b6Smaya   bool                                 GAMDone;
1146910e230b6Smaya};
1147010e230b6Smaya
1147196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1147296c5ddc4SrjsGFX9_VECS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
1147310e230b6Smaya                        __attribute__((unused)) void * restrict dst,
1147496c5ddc4Srjs                        __attribute__((unused)) const struct GFX9_VECS_INSTDONE * restrict values)
1147510e230b6Smaya{
1147610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1147710e230b6Smaya
1147810e230b6Smaya   dw[0] =
1147910e230b6Smaya      __gen_uint(values->RingEnable, 0, 0) |
1148010e230b6Smaya      __gen_uint(values->VECSDone, 30, 30) |
1148110e230b6Smaya      __gen_uint(values->GAMDone, 31, 31);
1148210e230b6Smaya}
1148310e230b6Smaya
1148496c5ddc4Srjs#define GFX9_VECS_RING_BUFFER_CTL_num     0x1a03c
1148596c5ddc4Srjs#define GFX9_VECS_RING_BUFFER_CTL_length       1
1148696c5ddc4Srjsstruct GFX9_VECS_RING_BUFFER_CTL {
1148710e230b6Smaya   bool                                 RingBufferEnable;
1148810e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
1148910e230b6Smaya#define MI_AUTOREPORT_OFF                        0
1149010e230b6Smaya#define MI_AUTOREPORT_64KB                       1
1149110e230b6Smaya#define MI_AUTOREPORT_4KB                        2
1149210e230b6Smaya#define MI_AUTOREPORT_128KB                      3
1149310e230b6Smaya   bool                                 DisableRegisterAccesses;
1149410e230b6Smaya   bool                                 SemaphoreWait;
1149510e230b6Smaya   bool                                 RBWait;
1149610e230b6Smaya   uint32_t                             BufferLengthinpages1;
1149710e230b6Smaya};
1149810e230b6Smaya
1149996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1150096c5ddc4SrjsGFX9_VECS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
1150110e230b6Smaya                               __attribute__((unused)) void * restrict dst,
1150296c5ddc4Srjs                               __attribute__((unused)) const struct GFX9_VECS_RING_BUFFER_CTL * restrict values)
1150310e230b6Smaya{
1150410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1150510e230b6Smaya
1150610e230b6Smaya   dw[0] =
1150710e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
1150810e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
1150910e230b6Smaya      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
1151010e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
1151110e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
1151210e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
1151310e230b6Smaya}
1151410e230b6Smaya
1151596c5ddc4Srjs#define GFX9_VS_INVOCATION_COUNT_num      0x2320
1151696c5ddc4Srjs#define GFX9_VS_INVOCATION_COUNT_length        2
1151796c5ddc4Srjsstruct GFX9_VS_INVOCATION_COUNT {
1151810e230b6Smaya   uint64_t                             VSInvocationCountReport;
1151910e230b6Smaya};
1152010e230b6Smaya
1152196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
1152296c5ddc4SrjsGFX9_VS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
1152310e230b6Smaya                              __attribute__((unused)) void * restrict dst,
1152496c5ddc4Srjs                              __attribute__((unused)) const struct GFX9_VS_INVOCATION_COUNT * restrict values)
1152510e230b6Smaya{
1152610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
1152710e230b6Smaya
1152810e230b6Smaya   const uint64_t v0 =
1152910e230b6Smaya      __gen_uint(values->VSInvocationCountReport, 0, 63);
1153010e230b6Smaya   dw[0] = v0;
1153110e230b6Smaya   dw[1] = v0 >> 32;
1153210e230b6Smaya}
1153310e230b6Smaya
1153496c5ddc4Srjs#endif /* GFX9_PACK_H */
11535