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 BDW.
2610e230b6Smaya *
2710e230b6Smaya * This file has been generated, do not hand edit.
2810e230b6Smaya */
2910e230b6Smaya
3096c5ddc4Srjs#ifndef GFX8_PACK_H
3196c5ddc4Srjs#define GFX8_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 GFX8_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 GFX8_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 GFX8_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 GFX8_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 GFX8_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 GFX8_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 GFX8_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 GFX8_ClearColor {
32210e230b6Smaya   CC_ZERO                              =      0,
32310e230b6Smaya   CC_ONE                               =      1,
32410e230b6Smaya};
32510e230b6Smaya
32696c5ddc4Srjsenum GFX8_ShaderChannelSelect {
32710e230b6Smaya   SCS_ZERO                             =      0,
32810e230b6Smaya   SCS_ONE                              =      1,
32910e230b6Smaya   SCS_RED                              =      4,
33010e230b6Smaya   SCS_GREEN                            =      5,
33110e230b6Smaya   SCS_BLUE                             =      6,
33210e230b6Smaya   SCS_ALPHA                            =      7,
33310e230b6Smaya};
33410e230b6Smaya
33596c5ddc4Srjsenum GFX8_TextureCoordinateMode {
33610e230b6Smaya   TCM_WRAP                             =      0,
33710e230b6Smaya   TCM_MIRROR                           =      1,
33810e230b6Smaya   TCM_CLAMP                            =      2,
33910e230b6Smaya   TCM_CUBE                             =      3,
34010e230b6Smaya   TCM_CLAMP_BORDER                     =      4,
34110e230b6Smaya   TCM_MIRROR_ONCE                      =      5,
34210e230b6Smaya   TCM_HALF_BORDER                      =      6,
34310e230b6Smaya};
34410e230b6Smaya
34596c5ddc4Srjsenum GFX8_WRAP_SHORTEST_ENABLE {
34610e230b6Smaya   WSE_X                                =      1,
34710e230b6Smaya   WSE_Y                                =      2,
34810e230b6Smaya   WSE_XY                               =      3,
34910e230b6Smaya   WSE_Z                                =      4,
35010e230b6Smaya   WSE_XZ                               =      5,
35110e230b6Smaya   WSE_YZ                               =      6,
35210e230b6Smaya   WSE_XYZ                              =      7,
35310e230b6Smaya   WSE_W                                =      8,
35410e230b6Smaya   WSE_XW                               =      9,
35510e230b6Smaya   WSE_YW                               =     10,
35610e230b6Smaya   WSE_XYW                              =     11,
35710e230b6Smaya   WSE_ZW                               =     12,
35810e230b6Smaya   WSE_XZW                              =     13,
35910e230b6Smaya   WSE_YZW                              =     14,
36010e230b6Smaya   WSE_XYZW                             =     15,
36110e230b6Smaya};
36210e230b6Smaya
36396c5ddc4Srjs#define GFX8_3DSTATE_CONSTANT_BODY_length     10
36496c5ddc4Srjsstruct GFX8_3DSTATE_CONSTANT_BODY {
36510e230b6Smaya   uint32_t                             ReadLength[4];
36610e230b6Smaya   __gen_address_type                   Buffer[4];
36710e230b6Smaya};
36810e230b6Smaya
36996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
37096c5ddc4SrjsGFX8_3DSTATE_CONSTANT_BODY_pack(__attribute__((unused)) __gen_user_data *data,
37110e230b6Smaya                                __attribute__((unused)) void * restrict dst,
37296c5ddc4Srjs                                __attribute__((unused)) const struct GFX8_3DSTATE_CONSTANT_BODY * restrict values)
37310e230b6Smaya{
37410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
37510e230b6Smaya
37610e230b6Smaya   dw[0] =
37710e230b6Smaya      __gen_uint(values->ReadLength[0], 0, 15) |
37810e230b6Smaya      __gen_uint(values->ReadLength[1], 16, 31);
37910e230b6Smaya
38010e230b6Smaya   dw[1] =
38110e230b6Smaya      __gen_uint(values->ReadLength[2], 0, 15) |
38210e230b6Smaya      __gen_uint(values->ReadLength[3], 16, 31);
38310e230b6Smaya
38410e230b6Smaya   const uint64_t v2_address =
38596c5ddc4Srjs      __gen_address(data, &dw[2], values->Buffer[0], 0, 5, 63);
38610e230b6Smaya   dw[2] = v2_address;
38710e230b6Smaya   dw[3] = v2_address >> 32;
38810e230b6Smaya
38910e230b6Smaya   const uint64_t v4_address =
39096c5ddc4Srjs      __gen_address(data, &dw[4], values->Buffer[1], 0, 5, 63);
39110e230b6Smaya   dw[4] = v4_address;
39210e230b6Smaya   dw[5] = v4_address >> 32;
39310e230b6Smaya
39410e230b6Smaya   const uint64_t v6_address =
39596c5ddc4Srjs      __gen_address(data, &dw[6], values->Buffer[2], 0, 5, 63);
39610e230b6Smaya   dw[6] = v6_address;
39710e230b6Smaya   dw[7] = v6_address >> 32;
39810e230b6Smaya
39910e230b6Smaya   const uint64_t v8_address =
40096c5ddc4Srjs      __gen_address(data, &dw[8], values->Buffer[3], 0, 5, 63);
40110e230b6Smaya   dw[8] = v8_address;
40210e230b6Smaya   dw[9] = v8_address >> 32;
40310e230b6Smaya}
40410e230b6Smaya
40596c5ddc4Srjs#define GFX8_BINDING_TABLE_EDIT_ENTRY_length      1
40696c5ddc4Srjsstruct GFX8_BINDING_TABLE_EDIT_ENTRY {
40710e230b6Smaya   uint64_t                             SurfaceStatePointer;
40810e230b6Smaya   uint32_t                             BindingTableIndex;
40910e230b6Smaya};
41010e230b6Smaya
41196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
41296c5ddc4SrjsGFX8_BINDING_TABLE_EDIT_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
41310e230b6Smaya                                   __attribute__((unused)) void * restrict dst,
41496c5ddc4Srjs                                   __attribute__((unused)) const struct GFX8_BINDING_TABLE_EDIT_ENTRY * restrict values)
41510e230b6Smaya{
41610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
41710e230b6Smaya
41810e230b6Smaya   dw[0] =
41910e230b6Smaya      __gen_offset(values->SurfaceStatePointer, 0, 15) |
42010e230b6Smaya      __gen_uint(values->BindingTableIndex, 16, 23);
42110e230b6Smaya}
42210e230b6Smaya
42396c5ddc4Srjs#define GFX8_BINDING_TABLE_STATE_length        1
42496c5ddc4Srjsstruct GFX8_BINDING_TABLE_STATE {
42510e230b6Smaya   uint64_t                             SurfaceStatePointer;
42610e230b6Smaya};
42710e230b6Smaya
42896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
42996c5ddc4SrjsGFX8_BINDING_TABLE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
43010e230b6Smaya                              __attribute__((unused)) void * restrict dst,
43196c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_BINDING_TABLE_STATE * restrict values)
43210e230b6Smaya{
43310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
43410e230b6Smaya
43510e230b6Smaya   dw[0] =
43610e230b6Smaya      __gen_offset(values->SurfaceStatePointer, 6, 31);
43710e230b6Smaya}
43810e230b6Smaya
43996c5ddc4Srjs#define GFX8_BLEND_STATE_ENTRY_length          2
44096c5ddc4Srjsstruct GFX8_BLEND_STATE_ENTRY {
44110e230b6Smaya   bool                                 WriteDisableBlue;
44210e230b6Smaya   bool                                 WriteDisableGreen;
44310e230b6Smaya   bool                                 WriteDisableRed;
44410e230b6Smaya   bool                                 WriteDisableAlpha;
44596c5ddc4Srjs   enum GFX8_3D_Color_Buffer_Blend_Function AlphaBlendFunction;
44696c5ddc4Srjs   enum GFX8_3D_Color_Buffer_Blend_Factor DestinationAlphaBlendFactor;
44796c5ddc4Srjs   enum GFX8_3D_Color_Buffer_Blend_Factor SourceAlphaBlendFactor;
44896c5ddc4Srjs   enum GFX8_3D_Color_Buffer_Blend_Function ColorBlendFunction;
44996c5ddc4Srjs   enum GFX8_3D_Color_Buffer_Blend_Factor DestinationBlendFactor;
45096c5ddc4Srjs   enum GFX8_3D_Color_Buffer_Blend_Factor SourceBlendFactor;
45110e230b6Smaya   bool                                 ColorBufferBlendEnable;
45210e230b6Smaya   bool                                 PostBlendColorClampEnable;
45310e230b6Smaya   bool                                 PreBlendColorClampEnable;
45410e230b6Smaya   uint32_t                             ColorClampRange;
45510e230b6Smaya#define COLORCLAMP_UNORM                         0
45610e230b6Smaya#define COLORCLAMP_SNORM                         1
45710e230b6Smaya#define COLORCLAMP_RTFORMAT                      2
45810e230b6Smaya   bool                                 PreBlendSourceOnlyClampEnable;
45996c5ddc4Srjs   enum GFX8_3D_Logic_Op_Function       LogicOpFunction;
46010e230b6Smaya   bool                                 LogicOpEnable;
46110e230b6Smaya};
46210e230b6Smaya
46396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
46496c5ddc4SrjsGFX8_BLEND_STATE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
46510e230b6Smaya                            __attribute__((unused)) void * restrict dst,
46696c5ddc4Srjs                            __attribute__((unused)) const struct GFX8_BLEND_STATE_ENTRY * restrict values)
46710e230b6Smaya{
46810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
46910e230b6Smaya
47010e230b6Smaya   dw[0] =
47110e230b6Smaya      __gen_uint(values->WriteDisableBlue, 0, 0) |
47210e230b6Smaya      __gen_uint(values->WriteDisableGreen, 1, 1) |
47310e230b6Smaya      __gen_uint(values->WriteDisableRed, 2, 2) |
47410e230b6Smaya      __gen_uint(values->WriteDisableAlpha, 3, 3) |
47510e230b6Smaya      __gen_uint(values->AlphaBlendFunction, 5, 7) |
47610e230b6Smaya      __gen_uint(values->DestinationAlphaBlendFactor, 8, 12) |
47710e230b6Smaya      __gen_uint(values->SourceAlphaBlendFactor, 13, 17) |
47810e230b6Smaya      __gen_uint(values->ColorBlendFunction, 18, 20) |
47910e230b6Smaya      __gen_uint(values->DestinationBlendFactor, 21, 25) |
48010e230b6Smaya      __gen_uint(values->SourceBlendFactor, 26, 30) |
48110e230b6Smaya      __gen_uint(values->ColorBufferBlendEnable, 31, 31);
48210e230b6Smaya
48310e230b6Smaya   dw[1] =
48410e230b6Smaya      __gen_uint(values->PostBlendColorClampEnable, 0, 0) |
48510e230b6Smaya      __gen_uint(values->PreBlendColorClampEnable, 1, 1) |
48610e230b6Smaya      __gen_uint(values->ColorClampRange, 2, 3) |
48710e230b6Smaya      __gen_uint(values->PreBlendSourceOnlyClampEnable, 4, 4) |
48810e230b6Smaya      __gen_uint(values->LogicOpFunction, 27, 30) |
48910e230b6Smaya      __gen_uint(values->LogicOpEnable, 31, 31);
49010e230b6Smaya}
49110e230b6Smaya
49296c5ddc4Srjs#define GFX8_BLEND_STATE_length                1
49396c5ddc4Srjsstruct GFX8_BLEND_STATE {
49410e230b6Smaya   uint32_t                             YDitherOffset;
49510e230b6Smaya   uint32_t                             XDitherOffset;
49610e230b6Smaya   bool                                 ColorDitherEnable;
49796c5ddc4Srjs   enum GFX8_3D_Compare_Function        AlphaTestFunction;
49810e230b6Smaya   bool                                 AlphaTestEnable;
49910e230b6Smaya   bool                                 AlphaToCoverageDitherEnable;
50010e230b6Smaya   bool                                 AlphaToOneEnable;
50110e230b6Smaya   bool                                 IndependentAlphaBlendEnable;
50210e230b6Smaya   bool                                 AlphaToCoverageEnable;
50310e230b6Smaya   /* variable length fields follow */
50410e230b6Smaya};
50510e230b6Smaya
50696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
50796c5ddc4SrjsGFX8_BLEND_STATE_pack(__attribute__((unused)) __gen_user_data *data,
50810e230b6Smaya                      __attribute__((unused)) void * restrict dst,
50996c5ddc4Srjs                      __attribute__((unused)) const struct GFX8_BLEND_STATE * restrict values)
51010e230b6Smaya{
51110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
51210e230b6Smaya
51310e230b6Smaya   dw[0] =
51410e230b6Smaya      __gen_uint(values->YDitherOffset, 19, 20) |
51510e230b6Smaya      __gen_uint(values->XDitherOffset, 21, 22) |
51610e230b6Smaya      __gen_uint(values->ColorDitherEnable, 23, 23) |
51710e230b6Smaya      __gen_uint(values->AlphaTestFunction, 24, 26) |
51810e230b6Smaya      __gen_uint(values->AlphaTestEnable, 27, 27) |
51910e230b6Smaya      __gen_uint(values->AlphaToCoverageDitherEnable, 28, 28) |
52010e230b6Smaya      __gen_uint(values->AlphaToOneEnable, 29, 29) |
52110e230b6Smaya      __gen_uint(values->IndependentAlphaBlendEnable, 30, 30) |
52210e230b6Smaya      __gen_uint(values->AlphaToCoverageEnable, 31, 31);
52310e230b6Smaya}
52410e230b6Smaya
52596c5ddc4Srjs#define GFX8_CC_VIEWPORT_length                2
52696c5ddc4Srjsstruct GFX8_CC_VIEWPORT {
52710e230b6Smaya   float                                MinimumDepth;
52810e230b6Smaya   float                                MaximumDepth;
52910e230b6Smaya};
53010e230b6Smaya
53196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
53296c5ddc4SrjsGFX8_CC_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
53310e230b6Smaya                      __attribute__((unused)) void * restrict dst,
53496c5ddc4Srjs                      __attribute__((unused)) const struct GFX8_CC_VIEWPORT * restrict values)
53510e230b6Smaya{
53610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
53710e230b6Smaya
53810e230b6Smaya   dw[0] =
53910e230b6Smaya      __gen_float(values->MinimumDepth);
54010e230b6Smaya
54110e230b6Smaya   dw[1] =
54210e230b6Smaya      __gen_float(values->MaximumDepth);
54310e230b6Smaya}
54410e230b6Smaya
54596c5ddc4Srjs#define GFX8_COLOR_CALC_STATE_length           6
54696c5ddc4Srjsstruct GFX8_COLOR_CALC_STATE {
54710e230b6Smaya   uint32_t                             AlphaTestFormat;
54810e230b6Smaya#define ALPHATEST_UNORM8                         0
54910e230b6Smaya#define ALPHATEST_FLOAT32                        1
55010e230b6Smaya   bool                                 RoundDisableFunctionDisable;
55110e230b6Smaya   uint32_t                             BackfaceStencilReferenceValue;
55210e230b6Smaya   uint32_t                             StencilReferenceValue;
55310e230b6Smaya   uint32_t                             AlphaReferenceValueAsUNORM8;
55410e230b6Smaya   float                                AlphaReferenceValueAsFLOAT32;
55510e230b6Smaya   float                                BlendConstantColorRed;
55610e230b6Smaya   float                                BlendConstantColorGreen;
55710e230b6Smaya   float                                BlendConstantColorBlue;
55810e230b6Smaya   float                                BlendConstantColorAlpha;
55910e230b6Smaya};
56010e230b6Smaya
56196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
56296c5ddc4SrjsGFX8_COLOR_CALC_STATE_pack(__attribute__((unused)) __gen_user_data *data,
56310e230b6Smaya                           __attribute__((unused)) void * restrict dst,
56496c5ddc4Srjs                           __attribute__((unused)) const struct GFX8_COLOR_CALC_STATE * restrict values)
56510e230b6Smaya{
56610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
56710e230b6Smaya
56810e230b6Smaya   dw[0] =
56910e230b6Smaya      __gen_uint(values->AlphaTestFormat, 0, 0) |
57010e230b6Smaya      __gen_uint(values->RoundDisableFunctionDisable, 15, 15) |
57110e230b6Smaya      __gen_uint(values->BackfaceStencilReferenceValue, 16, 23) |
57210e230b6Smaya      __gen_uint(values->StencilReferenceValue, 24, 31);
57310e230b6Smaya
57410e230b6Smaya   dw[1] =
57510e230b6Smaya      __gen_uint(values->AlphaReferenceValueAsUNORM8, 0, 31) |
57610e230b6Smaya      __gen_float(values->AlphaReferenceValueAsFLOAT32);
57710e230b6Smaya
57810e230b6Smaya   dw[2] =
57910e230b6Smaya      __gen_float(values->BlendConstantColorRed);
58010e230b6Smaya
58110e230b6Smaya   dw[3] =
58210e230b6Smaya      __gen_float(values->BlendConstantColorGreen);
58310e230b6Smaya
58410e230b6Smaya   dw[4] =
58510e230b6Smaya      __gen_float(values->BlendConstantColorBlue);
58610e230b6Smaya
58710e230b6Smaya   dw[5] =
58810e230b6Smaya      __gen_float(values->BlendConstantColorAlpha);
58910e230b6Smaya}
59010e230b6Smaya
59196c5ddc4Srjs#define GFX8_FILTER_COEFFICIENT_length         1
59296c5ddc4Srjsstruct GFX8_FILTER_COEFFICIENT {
59310e230b6Smaya   float                                FilterCoefficient;
59410e230b6Smaya};
59510e230b6Smaya
59696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
59796c5ddc4SrjsGFX8_FILTER_COEFFICIENT_pack(__attribute__((unused)) __gen_user_data *data,
59810e230b6Smaya                             __attribute__((unused)) void * restrict dst,
59996c5ddc4Srjs                             __attribute__((unused)) const struct GFX8_FILTER_COEFFICIENT * restrict values)
60010e230b6Smaya{
60110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
60210e230b6Smaya
60310e230b6Smaya   dw[0] =
60410e230b6Smaya      __gen_sfixed(values->FilterCoefficient, 0, 7, 6);
60510e230b6Smaya}
60610e230b6Smaya
60796c5ddc4Srjs#define GFX8_GATHER_CONSTANT_ENTRY_length      1
60896c5ddc4Srjsstruct GFX8_GATHER_CONSTANT_ENTRY {
60910e230b6Smaya   uint32_t                             BindingTableIndexOffset;
61010e230b6Smaya   uint32_t                             ChannelMask;
61110e230b6Smaya   uint64_t                             ConstantBufferOffset;
61210e230b6Smaya};
61310e230b6Smaya
61496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
61596c5ddc4SrjsGFX8_GATHER_CONSTANT_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
61610e230b6Smaya                                __attribute__((unused)) void * restrict dst,
61796c5ddc4Srjs                                __attribute__((unused)) const struct GFX8_GATHER_CONSTANT_ENTRY * restrict values)
61810e230b6Smaya{
61910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
62010e230b6Smaya
62110e230b6Smaya   dw[0] =
62210e230b6Smaya      __gen_uint(values->BindingTableIndexOffset, 0, 3) |
62310e230b6Smaya      __gen_uint(values->ChannelMask, 4, 7) |
62410e230b6Smaya      __gen_offset(values->ConstantBufferOffset, 8, 15);
62510e230b6Smaya}
62610e230b6Smaya
62796c5ddc4Srjs#define GFX8_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT_length      3
62896c5ddc4Srjsstruct GFX8_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT {
62910e230b6Smaya   bool                                 MBErrorConcealmentPSliceWeightPredictionDisable;
63010e230b6Smaya   bool                                 MBErrorConcealmentPSliceMotionVectorsOverrideDisable;
63110e230b6Smaya   bool                                 MBErrorConcealmentBSpatialWeightPredictionDisable;
63210e230b6Smaya   bool                                 MBErrorConcealmentBSpatialMotionVectorsOverrideDisable;
63310e230b6Smaya   uint32_t                             MBErrorConcealmentBSpatialPredictionMode;
63410e230b6Smaya   bool                                 MBHeaderErrorHandling;
63510e230b6Smaya   bool                                 EntropyErrorHandling;
63610e230b6Smaya   bool                                 MPRErrorHandling;
63710e230b6Smaya   bool                                 BSDPrematureCompleteErrorHandling;
63810e230b6Smaya   uint32_t                             ConcealmentPictureID;
63910e230b6Smaya   bool                                 MBErrorConcealmentBTemporalWeightPredictionDisable;
64010e230b6Smaya   bool                                 MBErrorConcealmentBTemporalMotionVectorsOverrideEnable;
64110e230b6Smaya   uint32_t                             MBErrorConcealmentBTemporalPredictionMode;
64210e230b6Smaya   bool                                 IntraPredMode4x48x8LumaErrorControl;
64310e230b6Smaya   bool                                 InitCurrentMBNumber;
64410e230b6Smaya   uint32_t                             ConcealmentMethod;
64510e230b6Smaya   uint32_t                             FirstMBBitOffset;
64610e230b6Smaya   bool                                 LastSlice;
64710e230b6Smaya   bool                                 EmulationPreventionBytePresent;
64810e230b6Smaya   bool                                 FixPrevMBSkipped;
64910e230b6Smaya   uint32_t                             FirstMBByteOffsetofSliceDataorSliceHeader;
65010e230b6Smaya   bool                                 IntraPredictionErrorControl;
65110e230b6Smaya   bool                                 Intra8x84x4PredictionErrorConcealmentControl;
65210e230b6Smaya   uint32_t                             BSliceTemporalInterConcealmentMode;
65310e230b6Smaya   uint32_t                             BSliceSpatialInterConcealmentMode;
65410e230b6Smaya   uint32_t                             BSliceInterDirectTypeConcealmentMode;
65510e230b6Smaya   uint32_t                             BSliceConcealmentMode;
65610e230b6Smaya#define IntraConcealment                         1
65710e230b6Smaya#define InterConcealment                         0
65810e230b6Smaya   uint32_t                             PSliceInterConcealmentMode;
65910e230b6Smaya   uint32_t                             PSliceConcealmentMode;
66010e230b6Smaya#define IntraConcealment                         1
66110e230b6Smaya#define InterConcealment                         0
66210e230b6Smaya   uint32_t                             ConcealmentReferencePictureFieldBit;
66310e230b6Smaya   uint32_t                             ISliceConcealmentMode;
66410e230b6Smaya#define IntraConcealment                         1
66510e230b6Smaya#define InterConcealment                         0
66610e230b6Smaya};
66710e230b6Smaya
66896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
66996c5ddc4SrjsGFX8_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
67010e230b6Smaya                                                         __attribute__((unused)) void * restrict dst,
67196c5ddc4Srjs                                                         __attribute__((unused)) const struct GFX8_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT * restrict values)
67210e230b6Smaya{
67310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
67410e230b6Smaya
67510e230b6Smaya   dw[0] =
67610e230b6Smaya      __gen_uint(values->MBErrorConcealmentPSliceWeightPredictionDisable, 0, 0) |
67710e230b6Smaya      __gen_uint(values->MBErrorConcealmentPSliceMotionVectorsOverrideDisable, 1, 1) |
67810e230b6Smaya      __gen_uint(values->MBErrorConcealmentBSpatialWeightPredictionDisable, 3, 3) |
67910e230b6Smaya      __gen_uint(values->MBErrorConcealmentBSpatialMotionVectorsOverrideDisable, 4, 4) |
68010e230b6Smaya      __gen_uint(values->MBErrorConcealmentBSpatialPredictionMode, 6, 7) |
68110e230b6Smaya      __gen_uint(values->MBHeaderErrorHandling, 8, 8) |
68210e230b6Smaya      __gen_uint(values->EntropyErrorHandling, 10, 10) |
68310e230b6Smaya      __gen_uint(values->MPRErrorHandling, 12, 12) |
68410e230b6Smaya      __gen_uint(values->BSDPrematureCompleteErrorHandling, 14, 14) |
68510e230b6Smaya      __gen_uint(values->ConcealmentPictureID, 16, 21) |
68610e230b6Smaya      __gen_uint(values->MBErrorConcealmentBTemporalWeightPredictionDisable, 24, 24) |
68710e230b6Smaya      __gen_uint(values->MBErrorConcealmentBTemporalMotionVectorsOverrideEnable, 25, 25) |
68810e230b6Smaya      __gen_uint(values->MBErrorConcealmentBTemporalPredictionMode, 27, 28) |
68910e230b6Smaya      __gen_uint(values->IntraPredMode4x48x8LumaErrorControl, 29, 29) |
69010e230b6Smaya      __gen_uint(values->InitCurrentMBNumber, 30, 30) |
69110e230b6Smaya      __gen_uint(values->ConcealmentMethod, 31, 31);
69210e230b6Smaya
69310e230b6Smaya   dw[1] =
69410e230b6Smaya      __gen_uint(values->FirstMBBitOffset, 0, 2) |
69510e230b6Smaya      __gen_uint(values->LastSlice, 3, 3) |
69610e230b6Smaya      __gen_uint(values->EmulationPreventionBytePresent, 4, 4) |
69710e230b6Smaya      __gen_uint(values->FixPrevMBSkipped, 7, 7) |
69810e230b6Smaya      __gen_uint(values->FirstMBByteOffsetofSliceDataorSliceHeader, 16, 31);
69910e230b6Smaya
70010e230b6Smaya   dw[2] =
70110e230b6Smaya      __gen_uint(values->IntraPredictionErrorControl, 0, 0) |
70210e230b6Smaya      __gen_uint(values->Intra8x84x4PredictionErrorConcealmentControl, 1, 1) |
70310e230b6Smaya      __gen_uint(values->BSliceTemporalInterConcealmentMode, 4, 6) |
70410e230b6Smaya      __gen_uint(values->BSliceSpatialInterConcealmentMode, 8, 10) |
70510e230b6Smaya      __gen_uint(values->BSliceInterDirectTypeConcealmentMode, 12, 13) |
70610e230b6Smaya      __gen_uint(values->BSliceConcealmentMode, 15, 15) |
70710e230b6Smaya      __gen_uint(values->PSliceInterConcealmentMode, 16, 18) |
70810e230b6Smaya      __gen_uint(values->PSliceConcealmentMode, 23, 23) |
70910e230b6Smaya      __gen_uint(values->ConcealmentReferencePictureFieldBit, 24, 29) |
71010e230b6Smaya      __gen_uint(values->ISliceConcealmentMode, 31, 31);
71110e230b6Smaya}
71210e230b6Smaya
71396c5ddc4Srjs#define GFX8_INTERFACE_DESCRIPTOR_DATA_length      8
71496c5ddc4Srjsstruct GFX8_INTERFACE_DESCRIPTOR_DATA {
71510e230b6Smaya   uint64_t                             KernelStartPointer;
71610e230b6Smaya   bool                                 SoftwareExceptionEnable;
71710e230b6Smaya   bool                                 MaskStackExceptionEnable;
71810e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
71910e230b6Smaya   uint32_t                             FloatingPointMode;
72010e230b6Smaya#define IEEE754                                  0
72110e230b6Smaya#define Alternate                                1
72210e230b6Smaya   uint32_t                             ThreadPriority;
72310e230b6Smaya#define NormalPriority                           0
72410e230b6Smaya#define HighPriority                             1
72510e230b6Smaya   bool                                 SingleProgramFlow;
72610e230b6Smaya   uint32_t                             DenormMode;
72710e230b6Smaya#define Ftz                                      0
72810e230b6Smaya#define SetByKernel                              1
72910e230b6Smaya   uint32_t                             SamplerCount;
73010e230b6Smaya#define Nosamplersused                           0
73110e230b6Smaya#define Between1and4samplersused                 1
73210e230b6Smaya#define Between5and8samplersused                 2
73310e230b6Smaya#define Between9and12samplersused                3
73410e230b6Smaya#define Between13and16samplersused               4
73510e230b6Smaya   uint64_t                             SamplerStatePointer;
73610e230b6Smaya   uint32_t                             BindingTableEntryCount;
73710e230b6Smaya   uint64_t                             BindingTablePointer;
73810e230b6Smaya   uint32_t                             ConstantURBEntryReadOffset;
73910e230b6Smaya   uint32_t                             ConstantURBEntryReadLength;
74010e230b6Smaya   uint32_t                             NumberofThreadsinGPGPUThreadGroup;
74110e230b6Smaya   uint32_t                             SharedLocalMemorySize;
74210e230b6Smaya#define Encodes0k                                0
74310e230b6Smaya#define Encodes4k                                1
74410e230b6Smaya#define Encodes8k                                2
74510e230b6Smaya#define Encodes16k                               4
74610e230b6Smaya#define Encodes32k                               8
74710e230b6Smaya#define Encodes64k                               16
74810e230b6Smaya   bool                                 BarrierEnable;
74910e230b6Smaya   uint32_t                             RoundingMode;
75010e230b6Smaya#define RTNE                                     0
75110e230b6Smaya#define RU                                       1
75210e230b6Smaya#define RD                                       2
75310e230b6Smaya#define RTZ                                      3
75410e230b6Smaya   uint32_t                             CrossThreadConstantDataReadLength;
75510e230b6Smaya};
75610e230b6Smaya
75796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
75896c5ddc4SrjsGFX8_INTERFACE_DESCRIPTOR_DATA_pack(__attribute__((unused)) __gen_user_data *data,
75910e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
76096c5ddc4Srjs                                    __attribute__((unused)) const struct GFX8_INTERFACE_DESCRIPTOR_DATA * restrict values)
76110e230b6Smaya{
76210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
76310e230b6Smaya
76410e230b6Smaya   const uint64_t v0 =
76510e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 47);
76610e230b6Smaya   dw[0] = v0;
76710e230b6Smaya   dw[1] = v0 >> 32;
76810e230b6Smaya
76910e230b6Smaya   dw[2] =
77010e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
77110e230b6Smaya      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
77210e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
77310e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
77410e230b6Smaya      __gen_uint(values->ThreadPriority, 17, 17) |
77510e230b6Smaya      __gen_uint(values->SingleProgramFlow, 18, 18) |
77610e230b6Smaya      __gen_uint(values->DenormMode, 19, 19);
77710e230b6Smaya
77810e230b6Smaya   dw[3] =
77910e230b6Smaya      __gen_uint(values->SamplerCount, 2, 4) |
78010e230b6Smaya      __gen_offset(values->SamplerStatePointer, 5, 31);
78110e230b6Smaya
78210e230b6Smaya   dw[4] =
78310e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 0, 4) |
78410e230b6Smaya      __gen_offset(values->BindingTablePointer, 5, 15);
78510e230b6Smaya
78610e230b6Smaya   dw[5] =
78710e230b6Smaya      __gen_uint(values->ConstantURBEntryReadOffset, 0, 15) |
78810e230b6Smaya      __gen_uint(values->ConstantURBEntryReadLength, 16, 31);
78910e230b6Smaya
79010e230b6Smaya   dw[6] =
79110e230b6Smaya      __gen_uint(values->NumberofThreadsinGPGPUThreadGroup, 0, 9) |
79210e230b6Smaya      __gen_uint(values->SharedLocalMemorySize, 16, 20) |
79310e230b6Smaya      __gen_uint(values->BarrierEnable, 21, 21) |
79410e230b6Smaya      __gen_uint(values->RoundingMode, 22, 23);
79510e230b6Smaya
79610e230b6Smaya   dw[7] =
79710e230b6Smaya      __gen_uint(values->CrossThreadConstantDataReadLength, 0, 7);
79810e230b6Smaya}
79910e230b6Smaya
80096c5ddc4Srjs#define GFX8_MEMORYADDRESSATTRIBUTES_length      1
80196c5ddc4Srjsstruct GFX8_MEMORYADDRESSATTRIBUTES {
80210e230b6Smaya   uint32_t                             AgeforQUADLRU;
80310e230b6Smaya   uint32_t                             TargetCache;
80410e230b6Smaya#define eLLCOnly                                 0
80510e230b6Smaya#define LLCOnly                                  1
80610e230b6Smaya#define LLCeLLC                                  2
80710e230b6Smaya#define L3LLCeLLC                                3
80810e230b6Smaya   uint32_t                             ArbitrationPriorityControl;
80910e230b6Smaya};
81010e230b6Smaya
81196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
81296c5ddc4SrjsGFX8_MEMORYADDRESSATTRIBUTES_pack(__attribute__((unused)) __gen_user_data *data,
81310e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
81496c5ddc4Srjs                                  __attribute__((unused)) const struct GFX8_MEMORYADDRESSATTRIBUTES * restrict values)
81510e230b6Smaya{
81610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
81710e230b6Smaya
81810e230b6Smaya   dw[0] =
81910e230b6Smaya      __gen_uint(values->AgeforQUADLRU, 0, 1) |
82010e230b6Smaya      __gen_uint(values->TargetCache, 3, 4) |
82110e230b6Smaya      __gen_uint(values->ArbitrationPriorityControl, 7, 8);
82210e230b6Smaya}
82310e230b6Smaya
82496c5ddc4Srjs#define GFX8_MEMORY_OBJECT_CONTROL_STATE_length      1
82596c5ddc4Srjsstruct GFX8_MEMORY_OBJECT_CONTROL_STATE {
82610e230b6Smaya   uint32_t                             AgeforQUADLRU;
82710e230b6Smaya   uint32_t                             TargetCache;
82810e230b6Smaya#define eLLCOnlywheneDRAMispresentelsegetsallocatedinLLC 0
82910e230b6Smaya#define LLCOnly                                  1
83010e230b6Smaya#define LLCeLLCAllowed                           2
83110e230b6Smaya#define L3DefertoPATforLLCeLLCselection          3
83210e230b6Smaya   uint32_t                             MemoryTypeLLCeLLCCacheabilityControl;
83310e230b6Smaya#define UCwithFenceifcoherentcycle               0
83410e230b6Smaya#define UCUncacheable                            1
83510e230b6Smaya#define WT                                       2
83610e230b6Smaya#define WB                                       3
83710e230b6Smaya};
83810e230b6Smaya
83996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
84096c5ddc4SrjsGFX8_MEMORY_OBJECT_CONTROL_STATE_pack(__attribute__((unused)) __gen_user_data *data,
84110e230b6Smaya                                      __attribute__((unused)) void * restrict dst,
84296c5ddc4Srjs                                      __attribute__((unused)) const struct GFX8_MEMORY_OBJECT_CONTROL_STATE * restrict values)
84310e230b6Smaya{
84410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
84510e230b6Smaya
84610e230b6Smaya   dw[0] =
84710e230b6Smaya      __gen_uint(values->AgeforQUADLRU, 0, 1) |
84810e230b6Smaya      __gen_uint(values->TargetCache, 3, 4) |
84910e230b6Smaya      __gen_uint(values->MemoryTypeLLCeLLCCacheabilityControl, 5, 6);
85010e230b6Smaya}
85110e230b6Smaya
85296c5ddc4Srjs#define GFX8_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION_length      2
85396c5ddc4Srjsstruct GFX8_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION {
85410e230b6Smaya   uint32_t                             FirstMBBitOffset;
85510e230b6Smaya   bool                                 LastMB;
85610e230b6Smaya   bool                                 LastPicSlice;
85710e230b6Smaya   uint32_t                             SliceConcealmentType;
85810e230b6Smaya   uint32_t                             SliceConcealmentOverride;
85910e230b6Smaya   uint32_t                             MBCount;
86010e230b6Smaya   uint32_t                             SliceVerticalPosition;
86110e230b6Smaya   uint32_t                             SliceHorizontalPosition;
86210e230b6Smaya   uint32_t                             NextSliceHorizontalPosition;
86310e230b6Smaya   uint32_t                             NextSliceVerticalPosition;
86410e230b6Smaya   uint32_t                             QuantizerScaleCode;
86510e230b6Smaya};
86610e230b6Smaya
86796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
86896c5ddc4SrjsGFX8_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION_pack(__attribute__((unused)) __gen_user_data *data,
86910e230b6Smaya                                                       __attribute__((unused)) void * restrict dst,
87096c5ddc4Srjs                                                       __attribute__((unused)) const struct GFX8_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION * restrict values)
87110e230b6Smaya{
87210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
87310e230b6Smaya
87410e230b6Smaya   dw[0] =
87510e230b6Smaya      __gen_uint(values->FirstMBBitOffset, 0, 2) |
87610e230b6Smaya      __gen_uint(values->LastMB, 3, 3) |
87710e230b6Smaya      __gen_uint(values->LastPicSlice, 5, 5) |
87810e230b6Smaya      __gen_uint(values->SliceConcealmentType, 6, 6) |
87910e230b6Smaya      __gen_uint(values->SliceConcealmentOverride, 7, 7) |
88010e230b6Smaya      __gen_uint(values->MBCount, 8, 15) |
88110e230b6Smaya      __gen_uint(values->SliceVerticalPosition, 16, 23) |
88210e230b6Smaya      __gen_uint(values->SliceHorizontalPosition, 24, 31);
88310e230b6Smaya
88410e230b6Smaya   dw[1] =
88510e230b6Smaya      __gen_uint(values->NextSliceHorizontalPosition, 0, 7) |
88610e230b6Smaya      __gen_uint(values->NextSliceVerticalPosition, 8, 16) |
88710e230b6Smaya      __gen_uint(values->QuantizerScaleCode, 24, 28);
88810e230b6Smaya}
88910e230b6Smaya
89096c5ddc4Srjs#define GFX8_MI_MATH_ALU_INSTRUCTION_length      1
89196c5ddc4Srjsstruct GFX8_MI_MATH_ALU_INSTRUCTION {
89210e230b6Smaya   uint32_t                             Operand2;
89310e230b6Smaya#define MI_ALU_REG0                              0
89410e230b6Smaya#define MI_ALU_REG1                              1
89510e230b6Smaya#define MI_ALU_REG2                              2
89610e230b6Smaya#define MI_ALU_REG3                              3
89710e230b6Smaya#define MI_ALU_REG4                              4
89810e230b6Smaya#define MI_ALU_REG5                              5
89910e230b6Smaya#define MI_ALU_REG6                              6
90010e230b6Smaya#define MI_ALU_REG7                              7
90110e230b6Smaya#define MI_ALU_REG8                              8
90210e230b6Smaya#define MI_ALU_REG9                              9
90310e230b6Smaya#define MI_ALU_REG10                             10
90410e230b6Smaya#define MI_ALU_REG11                             11
90510e230b6Smaya#define MI_ALU_REG12                             12
90610e230b6Smaya#define MI_ALU_REG13                             13
90710e230b6Smaya#define MI_ALU_REG14                             14
90810e230b6Smaya#define MI_ALU_REG15                             15
90910e230b6Smaya#define MI_ALU_SRCA                              32
91010e230b6Smaya#define MI_ALU_SRCB                              33
91110e230b6Smaya#define MI_ALU_ACCU                              49
91210e230b6Smaya#define MI_ALU_ZF                                50
91310e230b6Smaya#define MI_ALU_CF                                51
91410e230b6Smaya   uint32_t                             Operand1;
91510e230b6Smaya#define MI_ALU_REG0                              0
91610e230b6Smaya#define MI_ALU_REG1                              1
91710e230b6Smaya#define MI_ALU_REG2                              2
91810e230b6Smaya#define MI_ALU_REG3                              3
91910e230b6Smaya#define MI_ALU_REG4                              4
92010e230b6Smaya#define MI_ALU_REG5                              5
92110e230b6Smaya#define MI_ALU_REG6                              6
92210e230b6Smaya#define MI_ALU_REG7                              7
92310e230b6Smaya#define MI_ALU_REG8                              8
92410e230b6Smaya#define MI_ALU_REG9                              9
92510e230b6Smaya#define MI_ALU_REG10                             10
92610e230b6Smaya#define MI_ALU_REG11                             11
92710e230b6Smaya#define MI_ALU_REG12                             12
92810e230b6Smaya#define MI_ALU_REG13                             13
92910e230b6Smaya#define MI_ALU_REG14                             14
93010e230b6Smaya#define MI_ALU_REG15                             15
93110e230b6Smaya#define MI_ALU_SRCA                              32
93210e230b6Smaya#define MI_ALU_SRCB                              33
93310e230b6Smaya#define MI_ALU_ACCU                              49
93410e230b6Smaya#define MI_ALU_ZF                                50
93510e230b6Smaya#define MI_ALU_CF                                51
93610e230b6Smaya   uint32_t                             ALUOpcode;
93710e230b6Smaya#define MI_ALU_NOOP                              0
93810e230b6Smaya#define MI_ALU_LOAD                              128
93910e230b6Smaya#define MI_ALU_LOADINV                           1152
94010e230b6Smaya#define MI_ALU_LOAD0                             129
94110e230b6Smaya#define MI_ALU_LOAD1                             1153
94210e230b6Smaya#define MI_ALU_ADD                               256
94310e230b6Smaya#define MI_ALU_SUB                               257
94410e230b6Smaya#define MI_ALU_AND                               258
94510e230b6Smaya#define MI_ALU_OR                                259
94610e230b6Smaya#define MI_ALU_XOR                               260
94710e230b6Smaya#define MI_ALU_STORE                             384
94810e230b6Smaya#define MI_ALU_STOREINV                          1408
94910e230b6Smaya};
95010e230b6Smaya
95196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
95296c5ddc4SrjsGFX8_MI_MATH_ALU_INSTRUCTION_pack(__attribute__((unused)) __gen_user_data *data,
95310e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
95496c5ddc4Srjs                                  __attribute__((unused)) const struct GFX8_MI_MATH_ALU_INSTRUCTION * restrict values)
95510e230b6Smaya{
95610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
95710e230b6Smaya
95810e230b6Smaya   dw[0] =
95910e230b6Smaya      __gen_uint(values->Operand2, 0, 9) |
96010e230b6Smaya      __gen_uint(values->Operand1, 10, 19) |
96110e230b6Smaya      __gen_uint(values->ALUOpcode, 20, 31);
96210e230b6Smaya}
96310e230b6Smaya
96496c5ddc4Srjs#define GFX8_PALETTE_ENTRY_length              1
96596c5ddc4Srjsstruct GFX8_PALETTE_ENTRY {
96610e230b6Smaya   uint32_t                             Blue;
96710e230b6Smaya   uint32_t                             Green;
96810e230b6Smaya   uint32_t                             Red;
96910e230b6Smaya   uint32_t                             Alpha;
97010e230b6Smaya};
97110e230b6Smaya
97296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
97396c5ddc4SrjsGFX8_PALETTE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
97410e230b6Smaya                        __attribute__((unused)) void * restrict dst,
97596c5ddc4Srjs                        __attribute__((unused)) const struct GFX8_PALETTE_ENTRY * restrict values)
97610e230b6Smaya{
97710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
97810e230b6Smaya
97910e230b6Smaya   dw[0] =
98010e230b6Smaya      __gen_uint(values->Blue, 0, 7) |
98110e230b6Smaya      __gen_uint(values->Green, 8, 15) |
98210e230b6Smaya      __gen_uint(values->Red, 16, 23) |
98310e230b6Smaya      __gen_uint(values->Alpha, 24, 31);
98410e230b6Smaya}
98510e230b6Smaya
98696c5ddc4Srjs#define GFX8_RENDER_SURFACE_STATE_length      16
98796c5ddc4Srjsstruct GFX8_RENDER_SURFACE_STATE {
98810e230b6Smaya   bool                                 CubeFaceEnablePositiveZ;
98910e230b6Smaya   bool                                 CubeFaceEnableNegativeZ;
99010e230b6Smaya   bool                                 CubeFaceEnablePositiveY;
99110e230b6Smaya   bool                                 CubeFaceEnableNegativeY;
99210e230b6Smaya   bool                                 CubeFaceEnablePositiveX;
99310e230b6Smaya   bool                                 CubeFaceEnableNegativeX;
99410e230b6Smaya   uint32_t                             MediaBoundaryPixelMode;
99510e230b6Smaya#define NORMAL_MODE                              0
99610e230b6Smaya#define PROGRESSIVE_FRAME                        2
99710e230b6Smaya#define INTERLACED_FRAME                         3
99810e230b6Smaya   uint32_t                             RenderCacheReadWriteMode;
99910e230b6Smaya#define WriteOnlyCache                           0
100010e230b6Smaya#define ReadWriteCache                           1
100110e230b6Smaya   bool                                 SamplerL2BypassModeDisable;
100210e230b6Smaya   uint32_t                             VerticalLineStrideOffset;
100310e230b6Smaya   uint32_t                             VerticalLineStride;
100410e230b6Smaya   uint32_t                             TileMode;
100510e230b6Smaya#define LINEAR                                   0
100610e230b6Smaya#define WMAJOR                                   1
100710e230b6Smaya#define XMAJOR                                   2
100810e230b6Smaya#define YMAJOR                                   3
100910e230b6Smaya   uint32_t                             SurfaceHorizontalAlignment;
101096c5ddc4Srjs#define HALIGN_4                                 1
101196c5ddc4Srjs#define HALIGN_8                                 2
101296c5ddc4Srjs#define HALIGN_16                                3
101310e230b6Smaya   uint32_t                             SurfaceVerticalAlignment;
101496c5ddc4Srjs#define VALIGN_4                                 1
101596c5ddc4Srjs#define VALIGN_8                                 2
101696c5ddc4Srjs#define VALIGN_16                                3
101710e230b6Smaya   uint32_t                             SurfaceFormat;
101810e230b6Smaya   bool                                 SurfaceArray;
101910e230b6Smaya   uint32_t                             SurfaceType;
102010e230b6Smaya#define SURFTYPE_1D                              0
102110e230b6Smaya#define SURFTYPE_2D                              1
102210e230b6Smaya#define SURFTYPE_3D                              2
102310e230b6Smaya#define SURFTYPE_CUBE                            3
102410e230b6Smaya#define SURFTYPE_BUFFER                          4
102510e230b6Smaya#define SURFTYPE_STRBUF                          5
102610e230b6Smaya#define SURFTYPE_NULL                            7
102710e230b6Smaya   uint32_t                             SurfaceQPitch;
102810e230b6Smaya   float                                BaseMipLevel;
102910e230b6Smaya   uint32_t                             MOCS;
103010e230b6Smaya   uint32_t                             Width;
103110e230b6Smaya   uint32_t                             Height;
103210e230b6Smaya   uint32_t                             SurfacePitch;
103310e230b6Smaya   uint32_t                             Depth;
103410e230b6Smaya   uint32_t                             MultisamplePositionPaletteIndex;
103510e230b6Smaya   uint32_t                             NumberofMultisamples;
103610e230b6Smaya#define MULTISAMPLECOUNT_1                       0
103710e230b6Smaya#define MULTISAMPLECOUNT_2                       1
103810e230b6Smaya#define MULTISAMPLECOUNT_4                       2
103910e230b6Smaya#define MULTISAMPLECOUNT_8                       3
104010e230b6Smaya   uint32_t                             MultisampledSurfaceStorageFormat;
104110e230b6Smaya#define MSFMT_MSS                                0
104210e230b6Smaya#define MSFMT_DEPTH_STENCIL                      1
104310e230b6Smaya   uint32_t                             RenderTargetViewExtent;
104410e230b6Smaya   uint32_t                             MinimumArrayElement;
104510e230b6Smaya   uint32_t                             RenderTargetAndSampleUnormRotation;
104610e230b6Smaya#define _0DEG                                    0
104710e230b6Smaya#define _90DEG                                   1
104810e230b6Smaya#define _270DEG                                  3
104910e230b6Smaya   uint32_t                             MIPCountLOD;
105010e230b6Smaya   uint32_t                             SurfaceMinLOD;
105110e230b6Smaya   uint32_t                             CoherencyType;
105210e230b6Smaya#define GPUcoherent                              0
105310e230b6Smaya#define IAcoherent                               1
105410e230b6Smaya   bool                                 EWADisableForCube;
105510e230b6Smaya   uint32_t                             YOffset;
105610e230b6Smaya   uint32_t                             XOffset;
105710e230b6Smaya   uint32_t                             AuxiliarySurfaceMode;
105810e230b6Smaya#define AUX_NONE                                 0
105910e230b6Smaya#define AUX_MCS                                  1
106010e230b6Smaya#define AUX_APPEND                               2
106110e230b6Smaya#define AUX_HIZ                                  3
106210e230b6Smaya   uint32_t                             YOffsetforUorUVPlane;
106310e230b6Smaya   uint32_t                             AuxiliarySurfacePitch;
106410e230b6Smaya   uint32_t                             AuxiliarySurfaceQPitch;
106510e230b6Smaya   uint32_t                             XOffsetforUorUVPlane;
106610e230b6Smaya   bool                                 SeparateUVPlaneEnable;
106710e230b6Smaya   float                                ResourceMinLOD;
106896c5ddc4Srjs   enum GFX8_ShaderChannelSelect        ShaderChannelSelectAlpha;
106996c5ddc4Srjs   enum GFX8_ShaderChannelSelect        ShaderChannelSelectBlue;
107096c5ddc4Srjs   enum GFX8_ShaderChannelSelect        ShaderChannelSelectGreen;
107196c5ddc4Srjs   enum GFX8_ShaderChannelSelect        ShaderChannelSelectRed;
107296c5ddc4Srjs   enum GFX8_ClearColor                 AlphaClearColor;
107396c5ddc4Srjs   enum GFX8_ClearColor                 BlueClearColor;
107496c5ddc4Srjs   enum GFX8_ClearColor                 GreenClearColor;
107596c5ddc4Srjs   enum GFX8_ClearColor                 RedClearColor;
107610e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
107710e230b6Smaya   __gen_address_type                   AuxiliarySurfaceBaseAddress;
107810e230b6Smaya   uint32_t                             AuxiliaryTableIndexforMediaCompressedSurface;
107910e230b6Smaya   uint32_t                             YOffsetforVPlane;
108010e230b6Smaya   uint32_t                             XOffsetforVPlane;
108110e230b6Smaya};
108210e230b6Smaya
108396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
108496c5ddc4SrjsGFX8_RENDER_SURFACE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
108510e230b6Smaya                               __attribute__((unused)) void * restrict dst,
108696c5ddc4Srjs                               __attribute__((unused)) const struct GFX8_RENDER_SURFACE_STATE * restrict values)
108710e230b6Smaya{
108810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
108910e230b6Smaya
109010e230b6Smaya   dw[0] =
109110e230b6Smaya      __gen_uint(values->CubeFaceEnablePositiveZ, 0, 0) |
109210e230b6Smaya      __gen_uint(values->CubeFaceEnableNegativeZ, 1, 1) |
109310e230b6Smaya      __gen_uint(values->CubeFaceEnablePositiveY, 2, 2) |
109410e230b6Smaya      __gen_uint(values->CubeFaceEnableNegativeY, 3, 3) |
109510e230b6Smaya      __gen_uint(values->CubeFaceEnablePositiveX, 4, 4) |
109610e230b6Smaya      __gen_uint(values->CubeFaceEnableNegativeX, 5, 5) |
109710e230b6Smaya      __gen_uint(values->MediaBoundaryPixelMode, 6, 7) |
109810e230b6Smaya      __gen_uint(values->RenderCacheReadWriteMode, 8, 8) |
109910e230b6Smaya      __gen_uint(values->SamplerL2BypassModeDisable, 9, 9) |
110010e230b6Smaya      __gen_uint(values->VerticalLineStrideOffset, 10, 10) |
110110e230b6Smaya      __gen_uint(values->VerticalLineStride, 11, 11) |
110210e230b6Smaya      __gen_uint(values->TileMode, 12, 13) |
110310e230b6Smaya      __gen_uint(values->SurfaceHorizontalAlignment, 14, 15) |
110410e230b6Smaya      __gen_uint(values->SurfaceVerticalAlignment, 16, 17) |
110510e230b6Smaya      __gen_uint(values->SurfaceFormat, 18, 26) |
110610e230b6Smaya      __gen_uint(values->SurfaceArray, 28, 28) |
110710e230b6Smaya      __gen_uint(values->SurfaceType, 29, 31);
110810e230b6Smaya
110910e230b6Smaya   dw[1] =
111010e230b6Smaya      __gen_uint(values->SurfaceQPitch, 0, 14) |
111110e230b6Smaya      __gen_ufixed(values->BaseMipLevel, 19, 23, 1) |
111210e230b6Smaya      __gen_uint(values->MOCS, 24, 30);
111310e230b6Smaya
111410e230b6Smaya   dw[2] =
111510e230b6Smaya      __gen_uint(values->Width, 0, 13) |
111610e230b6Smaya      __gen_uint(values->Height, 16, 29);
111710e230b6Smaya
111810e230b6Smaya   dw[3] =
111910e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 17) |
112010e230b6Smaya      __gen_uint(values->Depth, 21, 31);
112110e230b6Smaya
112210e230b6Smaya   dw[4] =
112310e230b6Smaya      __gen_uint(values->MultisamplePositionPaletteIndex, 0, 2) |
112410e230b6Smaya      __gen_uint(values->NumberofMultisamples, 3, 5) |
112510e230b6Smaya      __gen_uint(values->MultisampledSurfaceStorageFormat, 6, 6) |
112610e230b6Smaya      __gen_uint(values->RenderTargetViewExtent, 7, 17) |
112710e230b6Smaya      __gen_uint(values->MinimumArrayElement, 18, 28) |
112810e230b6Smaya      __gen_uint(values->RenderTargetAndSampleUnormRotation, 29, 30);
112910e230b6Smaya
113010e230b6Smaya   dw[5] =
113110e230b6Smaya      __gen_uint(values->MIPCountLOD, 0, 3) |
113210e230b6Smaya      __gen_uint(values->SurfaceMinLOD, 4, 7) |
113310e230b6Smaya      __gen_uint(values->CoherencyType, 14, 14) |
113410e230b6Smaya      __gen_uint(values->EWADisableForCube, 20, 20) |
113510e230b6Smaya      __gen_uint(values->YOffset, 21, 23) |
113610e230b6Smaya      __gen_uint(values->XOffset, 25, 31);
113710e230b6Smaya
113810e230b6Smaya   dw[6] =
113910e230b6Smaya      __gen_uint(values->AuxiliarySurfaceMode, 0, 2) |
114010e230b6Smaya      __gen_uint(values->YOffsetforUorUVPlane, 0, 13) |
114110e230b6Smaya      __gen_uint(values->AuxiliarySurfacePitch, 3, 11) |
114210e230b6Smaya      __gen_uint(values->AuxiliarySurfaceQPitch, 16, 30) |
114310e230b6Smaya      __gen_uint(values->XOffsetforUorUVPlane, 16, 29) |
114410e230b6Smaya      __gen_uint(values->SeparateUVPlaneEnable, 31, 31);
114510e230b6Smaya
114610e230b6Smaya   dw[7] =
114710e230b6Smaya      __gen_ufixed(values->ResourceMinLOD, 0, 11, 8) |
114810e230b6Smaya      __gen_uint(values->ShaderChannelSelectAlpha, 16, 18) |
114910e230b6Smaya      __gen_uint(values->ShaderChannelSelectBlue, 19, 21) |
115010e230b6Smaya      __gen_uint(values->ShaderChannelSelectGreen, 22, 24) |
115110e230b6Smaya      __gen_uint(values->ShaderChannelSelectRed, 25, 27) |
115210e230b6Smaya      __gen_uint(values->AlphaClearColor, 28, 28) |
115310e230b6Smaya      __gen_uint(values->BlueClearColor, 29, 29) |
115410e230b6Smaya      __gen_uint(values->GreenClearColor, 30, 30) |
115510e230b6Smaya      __gen_uint(values->RedClearColor, 31, 31);
115610e230b6Smaya
115710e230b6Smaya   const uint64_t v8_address =
115896c5ddc4Srjs      __gen_address(data, &dw[8], values->SurfaceBaseAddress, 0, 0, 63);
115910e230b6Smaya   dw[8] = v8_address;
116010e230b6Smaya   dw[9] = v8_address >> 32;
116110e230b6Smaya
116210e230b6Smaya   const uint64_t v10 =
116310e230b6Smaya      __gen_uint(values->AuxiliaryTableIndexforMediaCompressedSurface, 21, 31) |
116410e230b6Smaya      __gen_uint(values->YOffsetforVPlane, 32, 45) |
116510e230b6Smaya      __gen_uint(values->XOffsetforVPlane, 48, 61);
116610e230b6Smaya   const uint64_t v10_address =
116796c5ddc4Srjs      __gen_address(data, &dw[10], values->AuxiliarySurfaceBaseAddress, v10, 12, 63);
116810e230b6Smaya   dw[10] = v10_address;
116910e230b6Smaya   dw[11] = (v10_address >> 32) | (v10 >> 32);
117010e230b6Smaya
117110e230b6Smaya   dw[12] = 0;
117210e230b6Smaya
117310e230b6Smaya   dw[13] = 0;
117410e230b6Smaya
117510e230b6Smaya   dw[14] = 0;
117610e230b6Smaya
117710e230b6Smaya   dw[15] = 0;
117810e230b6Smaya}
117910e230b6Smaya
118096c5ddc4Srjs#define GFX8_SAMPLER_BORDER_COLOR_STATE_length      4
118196c5ddc4Srjsstruct GFX8_SAMPLER_BORDER_COLOR_STATE {
118210e230b6Smaya   float                                BorderColorFloatRed;
118310e230b6Smaya   uint32_t                             BorderColor32bitRed;
118410e230b6Smaya   float                                BorderColorFloatGreen;
118510e230b6Smaya   uint32_t                             BorderColor32bitGreen;
118610e230b6Smaya   float                                BorderColorFloatBlue;
118710e230b6Smaya   uint32_t                             BorderColor32bitBlue;
118810e230b6Smaya   float                                BorderColorFloatAlpha;
118910e230b6Smaya   uint32_t                             BorderColor32bitAlpha;
119010e230b6Smaya};
119110e230b6Smaya
119296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
119396c5ddc4SrjsGFX8_SAMPLER_BORDER_COLOR_STATE_pack(__attribute__((unused)) __gen_user_data *data,
119410e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
119596c5ddc4Srjs                                     __attribute__((unused)) const struct GFX8_SAMPLER_BORDER_COLOR_STATE * restrict values)
119610e230b6Smaya{
119710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
119810e230b6Smaya
119910e230b6Smaya   dw[0] =
120010e230b6Smaya      __gen_float(values->BorderColorFloatRed) |
120110e230b6Smaya      __gen_uint(values->BorderColor32bitRed, 0, 31);
120210e230b6Smaya
120310e230b6Smaya   dw[1] =
120410e230b6Smaya      __gen_float(values->BorderColorFloatGreen) |
120510e230b6Smaya      __gen_uint(values->BorderColor32bitGreen, 0, 31);
120610e230b6Smaya
120710e230b6Smaya   dw[2] =
120810e230b6Smaya      __gen_float(values->BorderColorFloatBlue) |
120910e230b6Smaya      __gen_uint(values->BorderColor32bitBlue, 0, 31);
121010e230b6Smaya
121110e230b6Smaya   dw[3] =
121210e230b6Smaya      __gen_float(values->BorderColorFloatAlpha) |
121310e230b6Smaya      __gen_uint(values->BorderColor32bitAlpha, 0, 31);
121410e230b6Smaya}
121510e230b6Smaya
121696c5ddc4Srjs#define GFX8_SAMPLER_STATE_length              4
121796c5ddc4Srjsstruct GFX8_SAMPLER_STATE {
121810e230b6Smaya   uint32_t                             AnisotropicAlgorithm;
121910e230b6Smaya#define LEGACY                                   0
122010e230b6Smaya#define EWAApproximation                         1
122110e230b6Smaya   float                                TextureLODBias;
122210e230b6Smaya   uint32_t                             MinModeFilter;
122310e230b6Smaya#define MAPFILTER_NEAREST                        0
122410e230b6Smaya#define MAPFILTER_LINEAR                         1
122510e230b6Smaya#define MAPFILTER_ANISOTROPIC                    2
122610e230b6Smaya#define MAPFILTER_MONO                           6
122710e230b6Smaya   uint32_t                             MagModeFilter;
122810e230b6Smaya#define MAPFILTER_NEAREST                        0
122910e230b6Smaya#define MAPFILTER_LINEAR                         1
123010e230b6Smaya#define MAPFILTER_ANISOTROPIC                    2
123110e230b6Smaya#define MAPFILTER_MONO                           6
123210e230b6Smaya   uint32_t                             MipModeFilter;
123310e230b6Smaya#define MIPFILTER_NONE                           0
123410e230b6Smaya#define MIPFILTER_NEAREST                        1
123510e230b6Smaya#define MIPFILTER_LINEAR                         3
123610e230b6Smaya   float                                BaseMipLevel;
123710e230b6Smaya   uint32_t                             LODPreClampMode;
123810e230b6Smaya#define CLAMP_MODE_NONE                          0
123910e230b6Smaya#define CLAMP_MODE_OGL                           2
124010e230b6Smaya   uint32_t                             TextureBorderColorMode;
124110e230b6Smaya#define DX10OGL                                  0
124210e230b6Smaya#define DX9                                      1
124310e230b6Smaya   bool                                 SamplerDisable;
124410e230b6Smaya   uint32_t                             CubeSurfaceControlMode;
124510e230b6Smaya#define PROGRAMMED                               0
124610e230b6Smaya#define OVERRIDE                                 1
124710e230b6Smaya   uint32_t                             ShadowFunction;
124896c5ddc4Srjs#define PREFILTEROP_ALWAYS                       0
124996c5ddc4Srjs#define PREFILTEROP_NEVER                        1
125096c5ddc4Srjs#define PREFILTEROP_LESS                         2
125196c5ddc4Srjs#define PREFILTEROP_EQUAL                        3
125296c5ddc4Srjs#define PREFILTEROP_LEQUAL                       4
125396c5ddc4Srjs#define PREFILTEROP_GREATER                      5
125496c5ddc4Srjs#define PREFILTEROP_NOTEQUAL                     6
125596c5ddc4Srjs#define PREFILTEROP_GEQUAL                       7
125610e230b6Smaya   uint32_t                             ChromaKeyMode;
125710e230b6Smaya#define KEYFILTER_KILL_ON_ANY_MATCH              0
125810e230b6Smaya#define KEYFILTER_REPLACE_BLACK                  1
125910e230b6Smaya   uint32_t                             ChromaKeyIndex;
126010e230b6Smaya   bool                                 ChromaKeyEnable;
126110e230b6Smaya   float                                MaxLOD;
126210e230b6Smaya   float                                MinLOD;
126310e230b6Smaya   uint32_t                             LODClampMagnificationMode;
126410e230b6Smaya#define MIPNONE                                  0
126510e230b6Smaya#define MIPFILTER                                1
126610e230b6Smaya   uint64_t                             BorderColorPointer;
126796c5ddc4Srjs   enum GFX8_TextureCoordinateMode      TCZAddressControlMode;
126896c5ddc4Srjs   enum GFX8_TextureCoordinateMode      TCYAddressControlMode;
126996c5ddc4Srjs   enum GFX8_TextureCoordinateMode      TCXAddressControlMode;
127010e230b6Smaya   bool                                 NonnormalizedCoordinateEnable;
127110e230b6Smaya   uint32_t                             TrilinearFilterQuality;
127210e230b6Smaya#define FULL                                     0
127310e230b6Smaya#define HIGH                                     1
127410e230b6Smaya#define MED                                      2
127510e230b6Smaya#define LOW                                      3
127610e230b6Smaya   bool                                 RAddressMinFilterRoundingEnable;
127710e230b6Smaya   bool                                 RAddressMagFilterRoundingEnable;
127810e230b6Smaya   bool                                 VAddressMinFilterRoundingEnable;
127910e230b6Smaya   bool                                 VAddressMagFilterRoundingEnable;
128010e230b6Smaya   bool                                 UAddressMinFilterRoundingEnable;
128110e230b6Smaya   bool                                 UAddressMagFilterRoundingEnable;
128210e230b6Smaya   uint32_t                             MaximumAnisotropy;
128310e230b6Smaya#define RATIO21                                  0
128410e230b6Smaya#define RATIO41                                  1
128510e230b6Smaya#define RATIO61                                  2
128610e230b6Smaya#define RATIO81                                  3
128710e230b6Smaya#define RATIO101                                 4
128810e230b6Smaya#define RATIO121                                 5
128910e230b6Smaya#define RATIO141                                 6
129010e230b6Smaya#define RATIO161                                 7
129110e230b6Smaya};
129210e230b6Smaya
129396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
129496c5ddc4SrjsGFX8_SAMPLER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
129510e230b6Smaya                        __attribute__((unused)) void * restrict dst,
129696c5ddc4Srjs                        __attribute__((unused)) const struct GFX8_SAMPLER_STATE * restrict values)
129710e230b6Smaya{
129810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
129910e230b6Smaya
130010e230b6Smaya   dw[0] =
130110e230b6Smaya      __gen_uint(values->AnisotropicAlgorithm, 0, 0) |
130210e230b6Smaya      __gen_sfixed(values->TextureLODBias, 1, 13, 8) |
130310e230b6Smaya      __gen_uint(values->MinModeFilter, 14, 16) |
130410e230b6Smaya      __gen_uint(values->MagModeFilter, 17, 19) |
130510e230b6Smaya      __gen_uint(values->MipModeFilter, 20, 21) |
130610e230b6Smaya      __gen_ufixed(values->BaseMipLevel, 22, 26, 1) |
130710e230b6Smaya      __gen_uint(values->LODPreClampMode, 27, 28) |
130810e230b6Smaya      __gen_uint(values->TextureBorderColorMode, 29, 29) |
130910e230b6Smaya      __gen_uint(values->SamplerDisable, 31, 31);
131010e230b6Smaya
131110e230b6Smaya   dw[1] =
131210e230b6Smaya      __gen_uint(values->CubeSurfaceControlMode, 0, 0) |
131310e230b6Smaya      __gen_uint(values->ShadowFunction, 1, 3) |
131410e230b6Smaya      __gen_uint(values->ChromaKeyMode, 4, 4) |
131510e230b6Smaya      __gen_uint(values->ChromaKeyIndex, 5, 6) |
131610e230b6Smaya      __gen_uint(values->ChromaKeyEnable, 7, 7) |
131710e230b6Smaya      __gen_ufixed(values->MaxLOD, 8, 19, 8) |
131810e230b6Smaya      __gen_ufixed(values->MinLOD, 20, 31, 8);
131910e230b6Smaya
132010e230b6Smaya   dw[2] =
132110e230b6Smaya      __gen_uint(values->LODClampMagnificationMode, 0, 0) |
132210e230b6Smaya      __gen_offset(values->BorderColorPointer, 6, 23);
132310e230b6Smaya
132410e230b6Smaya   dw[3] =
132510e230b6Smaya      __gen_uint(values->TCZAddressControlMode, 0, 2) |
132610e230b6Smaya      __gen_uint(values->TCYAddressControlMode, 3, 5) |
132710e230b6Smaya      __gen_uint(values->TCXAddressControlMode, 6, 8) |
132810e230b6Smaya      __gen_uint(values->NonnormalizedCoordinateEnable, 10, 10) |
132910e230b6Smaya      __gen_uint(values->TrilinearFilterQuality, 11, 12) |
133010e230b6Smaya      __gen_uint(values->RAddressMinFilterRoundingEnable, 13, 13) |
133110e230b6Smaya      __gen_uint(values->RAddressMagFilterRoundingEnable, 14, 14) |
133210e230b6Smaya      __gen_uint(values->VAddressMinFilterRoundingEnable, 15, 15) |
133310e230b6Smaya      __gen_uint(values->VAddressMagFilterRoundingEnable, 16, 16) |
133410e230b6Smaya      __gen_uint(values->UAddressMinFilterRoundingEnable, 17, 17) |
133510e230b6Smaya      __gen_uint(values->UAddressMagFilterRoundingEnable, 18, 18) |
133610e230b6Smaya      __gen_uint(values->MaximumAnisotropy, 19, 21);
133710e230b6Smaya}
133810e230b6Smaya
133996c5ddc4Srjs#define GFX8_SAMPLER_STATE_8X8_AVS_COEFFICIENTS_length      8
134096c5ddc4Srjsstruct GFX8_SAMPLER_STATE_8X8_AVS_COEFFICIENTS {
134110e230b6Smaya   float                                Table0XFilterCoefficientn0;
134210e230b6Smaya   float                                Table0YFilterCoefficientn0;
134310e230b6Smaya   float                                Table0XFilterCoefficientn1;
134410e230b6Smaya   float                                Table0YFilterCoefficientn1;
134510e230b6Smaya   float                                Table0XFilterCoefficientn2;
134610e230b6Smaya   float                                Table0YFilterCoefficientn2;
134710e230b6Smaya   float                                Table0XFilterCoefficientn3;
134810e230b6Smaya   float                                Table0YFilterCoefficientn3;
134910e230b6Smaya   float                                Table0XFilterCoefficientn4;
135010e230b6Smaya   float                                Table0YFilterCoefficientn4;
135110e230b6Smaya   float                                Table0XFilterCoefficientn5;
135210e230b6Smaya   float                                Table0YFilterCoefficientn5;
135310e230b6Smaya   float                                Table0XFilterCoefficientn6;
135410e230b6Smaya   float                                Table0YFilterCoefficientn6;
135510e230b6Smaya   float                                Table0XFilterCoefficientn7;
135610e230b6Smaya   float                                Table0YFilterCoefficientn7;
135710e230b6Smaya   float                                Table1XFilterCoefficientn2;
135810e230b6Smaya   float                                Table1XFilterCoefficientn3;
135910e230b6Smaya   float                                Table1XFilterCoefficientn4;
136010e230b6Smaya   float                                Table1XFilterCoefficientn5;
136110e230b6Smaya   float                                Table1YFilterCoefficientn2;
136210e230b6Smaya   float                                Table1YFilterCoefficientn3;
136310e230b6Smaya   float                                Table1YFilterCoefficientn4;
136410e230b6Smaya   float                                Table1YFilterCoefficientn5;
136510e230b6Smaya};
136610e230b6Smaya
136796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
136896c5ddc4SrjsGFX8_SAMPLER_STATE_8X8_AVS_COEFFICIENTS_pack(__attribute__((unused)) __gen_user_data *data,
136910e230b6Smaya                                             __attribute__((unused)) void * restrict dst,
137096c5ddc4Srjs                                             __attribute__((unused)) const struct GFX8_SAMPLER_STATE_8X8_AVS_COEFFICIENTS * restrict values)
137110e230b6Smaya{
137210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
137310e230b6Smaya
137410e230b6Smaya   dw[0] =
137510e230b6Smaya      __gen_sfixed(values->Table0XFilterCoefficientn0, 0, 7, 6) |
137610e230b6Smaya      __gen_sfixed(values->Table0YFilterCoefficientn0, 8, 15, 6) |
137710e230b6Smaya      __gen_sfixed(values->Table0XFilterCoefficientn1, 16, 23, 6) |
137810e230b6Smaya      __gen_sfixed(values->Table0YFilterCoefficientn1, 24, 31, 6);
137910e230b6Smaya
138010e230b6Smaya   dw[1] =
138110e230b6Smaya      __gen_sfixed(values->Table0XFilterCoefficientn2, 0, 7, 6) |
138210e230b6Smaya      __gen_sfixed(values->Table0YFilterCoefficientn2, 8, 15, 6) |
138310e230b6Smaya      __gen_sfixed(values->Table0XFilterCoefficientn3, 16, 23, 6) |
138410e230b6Smaya      __gen_sfixed(values->Table0YFilterCoefficientn3, 24, 31, 6);
138510e230b6Smaya
138610e230b6Smaya   dw[2] =
138710e230b6Smaya      __gen_sfixed(values->Table0XFilterCoefficientn4, 0, 7, 6) |
138810e230b6Smaya      __gen_sfixed(values->Table0YFilterCoefficientn4, 8, 15, 6) |
138910e230b6Smaya      __gen_sfixed(values->Table0XFilterCoefficientn5, 16, 23, 6) |
139010e230b6Smaya      __gen_sfixed(values->Table0YFilterCoefficientn5, 24, 31, 6);
139110e230b6Smaya
139210e230b6Smaya   dw[3] =
139310e230b6Smaya      __gen_sfixed(values->Table0XFilterCoefficientn6, 0, 7, 6) |
139410e230b6Smaya      __gen_sfixed(values->Table0YFilterCoefficientn6, 8, 15, 6) |
139510e230b6Smaya      __gen_sfixed(values->Table0XFilterCoefficientn7, 16, 23, 6) |
139610e230b6Smaya      __gen_sfixed(values->Table0YFilterCoefficientn7, 24, 31, 6);
139710e230b6Smaya
139810e230b6Smaya   dw[4] =
139910e230b6Smaya      __gen_sfixed(values->Table1XFilterCoefficientn2, 16, 23, 6) |
140010e230b6Smaya      __gen_sfixed(values->Table1XFilterCoefficientn3, 24, 31, 6);
140110e230b6Smaya
140210e230b6Smaya   dw[5] =
140310e230b6Smaya      __gen_sfixed(values->Table1XFilterCoefficientn4, 0, 7, 6) |
140410e230b6Smaya      __gen_sfixed(values->Table1XFilterCoefficientn5, 8, 15, 6);
140510e230b6Smaya
140610e230b6Smaya   dw[6] =
140710e230b6Smaya      __gen_sfixed(values->Table1YFilterCoefficientn2, 16, 23, 6) |
140810e230b6Smaya      __gen_sfixed(values->Table1YFilterCoefficientn3, 24, 31, 6);
140910e230b6Smaya
141010e230b6Smaya   dw[7] =
141110e230b6Smaya      __gen_sfixed(values->Table1YFilterCoefficientn4, 0, 7, 6) |
141210e230b6Smaya      __gen_sfixed(values->Table1YFilterCoefficientn5, 8, 15, 6);
141310e230b6Smaya}
141410e230b6Smaya
141596c5ddc4Srjs#define GFX8_SCISSOR_RECT_length               2
141696c5ddc4Srjsstruct GFX8_SCISSOR_RECT {
141710e230b6Smaya   uint32_t                             ScissorRectangleXMin;
141810e230b6Smaya   uint32_t                             ScissorRectangleYMin;
141910e230b6Smaya   uint32_t                             ScissorRectangleXMax;
142010e230b6Smaya   uint32_t                             ScissorRectangleYMax;
142110e230b6Smaya};
142210e230b6Smaya
142396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
142496c5ddc4SrjsGFX8_SCISSOR_RECT_pack(__attribute__((unused)) __gen_user_data *data,
142510e230b6Smaya                       __attribute__((unused)) void * restrict dst,
142696c5ddc4Srjs                       __attribute__((unused)) const struct GFX8_SCISSOR_RECT * restrict values)
142710e230b6Smaya{
142810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
142910e230b6Smaya
143010e230b6Smaya   dw[0] =
143110e230b6Smaya      __gen_uint(values->ScissorRectangleXMin, 0, 15) |
143210e230b6Smaya      __gen_uint(values->ScissorRectangleYMin, 16, 31);
143310e230b6Smaya
143410e230b6Smaya   dw[1] =
143510e230b6Smaya      __gen_uint(values->ScissorRectangleXMax, 0, 15) |
143610e230b6Smaya      __gen_uint(values->ScissorRectangleYMax, 16, 31);
143710e230b6Smaya}
143810e230b6Smaya
143996c5ddc4Srjs#define GFX8_SF_CLIP_VIEWPORT_length          16
144096c5ddc4Srjsstruct GFX8_SF_CLIP_VIEWPORT {
144110e230b6Smaya   float                                ViewportMatrixElementm00;
144210e230b6Smaya   float                                ViewportMatrixElementm11;
144310e230b6Smaya   float                                ViewportMatrixElementm22;
144410e230b6Smaya   float                                ViewportMatrixElementm30;
144510e230b6Smaya   float                                ViewportMatrixElementm31;
144610e230b6Smaya   float                                ViewportMatrixElementm32;
144710e230b6Smaya   float                                XMinClipGuardband;
144810e230b6Smaya   float                                XMaxClipGuardband;
144910e230b6Smaya   float                                YMinClipGuardband;
145010e230b6Smaya   float                                YMaxClipGuardband;
145110e230b6Smaya   float                                XMinViewPort;
145210e230b6Smaya   float                                XMaxViewPort;
145310e230b6Smaya   float                                YMinViewPort;
145410e230b6Smaya   float                                YMaxViewPort;
145510e230b6Smaya};
145610e230b6Smaya
145796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
145896c5ddc4SrjsGFX8_SF_CLIP_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
145910e230b6Smaya                           __attribute__((unused)) void * restrict dst,
146096c5ddc4Srjs                           __attribute__((unused)) const struct GFX8_SF_CLIP_VIEWPORT * restrict values)
146110e230b6Smaya{
146210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
146310e230b6Smaya
146410e230b6Smaya   dw[0] =
146510e230b6Smaya      __gen_float(values->ViewportMatrixElementm00);
146610e230b6Smaya
146710e230b6Smaya   dw[1] =
146810e230b6Smaya      __gen_float(values->ViewportMatrixElementm11);
146910e230b6Smaya
147010e230b6Smaya   dw[2] =
147110e230b6Smaya      __gen_float(values->ViewportMatrixElementm22);
147210e230b6Smaya
147310e230b6Smaya   dw[3] =
147410e230b6Smaya      __gen_float(values->ViewportMatrixElementm30);
147510e230b6Smaya
147610e230b6Smaya   dw[4] =
147710e230b6Smaya      __gen_float(values->ViewportMatrixElementm31);
147810e230b6Smaya
147910e230b6Smaya   dw[5] =
148010e230b6Smaya      __gen_float(values->ViewportMatrixElementm32);
148110e230b6Smaya
148210e230b6Smaya   dw[6] = 0;
148310e230b6Smaya
148410e230b6Smaya   dw[7] = 0;
148510e230b6Smaya
148610e230b6Smaya   dw[8] =
148710e230b6Smaya      __gen_float(values->XMinClipGuardband);
148810e230b6Smaya
148910e230b6Smaya   dw[9] =
149010e230b6Smaya      __gen_float(values->XMaxClipGuardband);
149110e230b6Smaya
149210e230b6Smaya   dw[10] =
149310e230b6Smaya      __gen_float(values->YMinClipGuardband);
149410e230b6Smaya
149510e230b6Smaya   dw[11] =
149610e230b6Smaya      __gen_float(values->YMaxClipGuardband);
149710e230b6Smaya
149810e230b6Smaya   dw[12] =
149910e230b6Smaya      __gen_float(values->XMinViewPort);
150010e230b6Smaya
150110e230b6Smaya   dw[13] =
150210e230b6Smaya      __gen_float(values->XMaxViewPort);
150310e230b6Smaya
150410e230b6Smaya   dw[14] =
150510e230b6Smaya      __gen_float(values->YMinViewPort);
150610e230b6Smaya
150710e230b6Smaya   dw[15] =
150810e230b6Smaya      __gen_float(values->YMaxViewPort);
150910e230b6Smaya}
151010e230b6Smaya
151196c5ddc4Srjs#define GFX8_SF_OUTPUT_ATTRIBUTE_DETAIL_length      1
151296c5ddc4Srjsstruct GFX8_SF_OUTPUT_ATTRIBUTE_DETAIL {
151310e230b6Smaya   uint32_t                             SourceAttribute;
151410e230b6Smaya   uint32_t                             SwizzleSelect;
151510e230b6Smaya#define INPUTATTR                                0
151610e230b6Smaya#define INPUTATTR_FACING                         1
151710e230b6Smaya#define INPUTATTR_W                              2
151810e230b6Smaya#define INPUTATTR_FACING_W                       3
151910e230b6Smaya   uint32_t                             ConstantSource;
152010e230b6Smaya#define CONST_0000                               0
152110e230b6Smaya#define CONST_0001_FLOAT                         1
152210e230b6Smaya#define CONST_1111_FLOAT                         2
152310e230b6Smaya#define PRIM_ID                                  3
152410e230b6Smaya   uint32_t                             SwizzleControlMode;
152510e230b6Smaya   bool                                 ComponentOverrideX;
152610e230b6Smaya   bool                                 ComponentOverrideY;
152710e230b6Smaya   bool                                 ComponentOverrideZ;
152810e230b6Smaya   bool                                 ComponentOverrideW;
152910e230b6Smaya};
153010e230b6Smaya
153196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
153296c5ddc4SrjsGFX8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(__attribute__((unused)) __gen_user_data *data,
153310e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
153496c5ddc4Srjs                                     __attribute__((unused)) const struct GFX8_SF_OUTPUT_ATTRIBUTE_DETAIL * restrict values)
153510e230b6Smaya{
153610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
153710e230b6Smaya
153810e230b6Smaya   dw[0] =
153910e230b6Smaya      __gen_uint(values->SourceAttribute, 0, 4) |
154010e230b6Smaya      __gen_uint(values->SwizzleSelect, 6, 7) |
154110e230b6Smaya      __gen_uint(values->ConstantSource, 9, 10) |
154210e230b6Smaya      __gen_uint(values->SwizzleControlMode, 11, 11) |
154310e230b6Smaya      __gen_uint(values->ComponentOverrideX, 12, 12) |
154410e230b6Smaya      __gen_uint(values->ComponentOverrideY, 13, 13) |
154510e230b6Smaya      __gen_uint(values->ComponentOverrideZ, 14, 14) |
154610e230b6Smaya      __gen_uint(values->ComponentOverrideW, 15, 15);
154710e230b6Smaya}
154810e230b6Smaya
154996c5ddc4Srjs#define GFX8_SO_DECL_length                    1
155096c5ddc4Srjsstruct GFX8_SO_DECL {
155110e230b6Smaya   uint32_t                             ComponentMask;
155210e230b6Smaya   uint32_t                             RegisterIndex;
155396c5ddc4Srjs   bool                                 HoleFlag;
155410e230b6Smaya   uint32_t                             OutputBufferSlot;
155510e230b6Smaya};
155610e230b6Smaya
155796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
155896c5ddc4SrjsGFX8_SO_DECL_pack(__attribute__((unused)) __gen_user_data *data,
155910e230b6Smaya                  __attribute__((unused)) void * restrict dst,
156096c5ddc4Srjs                  __attribute__((unused)) const struct GFX8_SO_DECL * restrict values)
156110e230b6Smaya{
156210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
156310e230b6Smaya
156410e230b6Smaya   dw[0] =
156510e230b6Smaya      __gen_uint(values->ComponentMask, 0, 3) |
156610e230b6Smaya      __gen_uint(values->RegisterIndex, 4, 9) |
156710e230b6Smaya      __gen_uint(values->HoleFlag, 11, 11) |
156810e230b6Smaya      __gen_uint(values->OutputBufferSlot, 12, 13);
156910e230b6Smaya}
157010e230b6Smaya
157196c5ddc4Srjs#define GFX8_SO_DECL_ENTRY_length              2
157296c5ddc4Srjsstruct GFX8_SO_DECL_ENTRY {
157396c5ddc4Srjs   struct GFX8_SO_DECL                  Stream0Decl;
157496c5ddc4Srjs   struct GFX8_SO_DECL                  Stream1Decl;
157596c5ddc4Srjs   struct GFX8_SO_DECL                  Stream2Decl;
157696c5ddc4Srjs   struct GFX8_SO_DECL                  Stream3Decl;
157710e230b6Smaya};
157810e230b6Smaya
157996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
158096c5ddc4SrjsGFX8_SO_DECL_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
158110e230b6Smaya                        __attribute__((unused)) void * restrict dst,
158296c5ddc4Srjs                        __attribute__((unused)) const struct GFX8_SO_DECL_ENTRY * restrict values)
158310e230b6Smaya{
158410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
158510e230b6Smaya
158610e230b6Smaya   uint32_t v0_0;
158796c5ddc4Srjs   GFX8_SO_DECL_pack(data, &v0_0, &values->Stream0Decl);
158810e230b6Smaya
158910e230b6Smaya   uint32_t v0_1;
159096c5ddc4Srjs   GFX8_SO_DECL_pack(data, &v0_1, &values->Stream1Decl);
159110e230b6Smaya
159210e230b6Smaya   dw[0] =
159310e230b6Smaya      __gen_uint(v0_0, 0, 15) |
159410e230b6Smaya      __gen_uint(v0_1, 16, 31);
159510e230b6Smaya
159610e230b6Smaya   uint32_t v1_0;
159796c5ddc4Srjs   GFX8_SO_DECL_pack(data, &v1_0, &values->Stream2Decl);
159810e230b6Smaya
159910e230b6Smaya   uint32_t v1_1;
160096c5ddc4Srjs   GFX8_SO_DECL_pack(data, &v1_1, &values->Stream3Decl);
160110e230b6Smaya
160210e230b6Smaya   dw[1] =
160310e230b6Smaya      __gen_uint(v1_0, 0, 15) |
160410e230b6Smaya      __gen_uint(v1_1, 16, 31);
160510e230b6Smaya}
160610e230b6Smaya
160796c5ddc4Srjs#define GFX8_VERTEX_BUFFER_STATE_length        4
160896c5ddc4Srjsstruct GFX8_VERTEX_BUFFER_STATE {
160910e230b6Smaya   uint32_t                             BufferPitch;
161010e230b6Smaya   bool                                 NullVertexBuffer;
161110e230b6Smaya   bool                                 AddressModifyEnable;
161210e230b6Smaya   uint32_t                             MOCS;
161310e230b6Smaya   uint32_t                             VertexBufferIndex;
161410e230b6Smaya   __gen_address_type                   BufferStartingAddress;
161510e230b6Smaya   uint32_t                             BufferSize;
161610e230b6Smaya};
161710e230b6Smaya
161896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
161996c5ddc4SrjsGFX8_VERTEX_BUFFER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
162010e230b6Smaya                              __attribute__((unused)) void * restrict dst,
162196c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_VERTEX_BUFFER_STATE * restrict values)
162210e230b6Smaya{
162310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
162410e230b6Smaya
162510e230b6Smaya   dw[0] =
162610e230b6Smaya      __gen_uint(values->BufferPitch, 0, 11) |
162710e230b6Smaya      __gen_uint(values->NullVertexBuffer, 13, 13) |
162810e230b6Smaya      __gen_uint(values->AddressModifyEnable, 14, 14) |
162910e230b6Smaya      __gen_uint(values->MOCS, 16, 22) |
163010e230b6Smaya      __gen_uint(values->VertexBufferIndex, 26, 31);
163110e230b6Smaya
163210e230b6Smaya   const uint64_t v1_address =
163396c5ddc4Srjs      __gen_address(data, &dw[1], values->BufferStartingAddress, 0, 0, 63);
163410e230b6Smaya   dw[1] = v1_address;
163510e230b6Smaya   dw[2] = v1_address >> 32;
163610e230b6Smaya
163710e230b6Smaya   dw[3] =
163810e230b6Smaya      __gen_uint(values->BufferSize, 0, 31);
163910e230b6Smaya}
164010e230b6Smaya
164196c5ddc4Srjs#define GFX8_VERTEX_ELEMENT_STATE_length       2
164296c5ddc4Srjsstruct GFX8_VERTEX_ELEMENT_STATE {
164310e230b6Smaya   uint32_t                             SourceElementOffset;
164410e230b6Smaya   bool                                 EdgeFlagEnable;
164510e230b6Smaya   uint32_t                             SourceElementFormat;
164610e230b6Smaya   bool                                 Valid;
164710e230b6Smaya   uint32_t                             VertexBufferIndex;
164896c5ddc4Srjs   enum GFX8_3D_Vertex_Component_Control Component3Control;
164996c5ddc4Srjs   enum GFX8_3D_Vertex_Component_Control Component2Control;
165096c5ddc4Srjs   enum GFX8_3D_Vertex_Component_Control Component1Control;
165196c5ddc4Srjs   enum GFX8_3D_Vertex_Component_Control Component0Control;
165210e230b6Smaya};
165310e230b6Smaya
165496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
165596c5ddc4SrjsGFX8_VERTEX_ELEMENT_STATE_pack(__attribute__((unused)) __gen_user_data *data,
165610e230b6Smaya                               __attribute__((unused)) void * restrict dst,
165796c5ddc4Srjs                               __attribute__((unused)) const struct GFX8_VERTEX_ELEMENT_STATE * restrict values)
165810e230b6Smaya{
165910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
166010e230b6Smaya
166110e230b6Smaya   dw[0] =
166210e230b6Smaya      __gen_uint(values->SourceElementOffset, 0, 11) |
166310e230b6Smaya      __gen_uint(values->EdgeFlagEnable, 15, 15) |
166410e230b6Smaya      __gen_uint(values->SourceElementFormat, 16, 24) |
166510e230b6Smaya      __gen_uint(values->Valid, 25, 25) |
166610e230b6Smaya      __gen_uint(values->VertexBufferIndex, 26, 31);
166710e230b6Smaya
166810e230b6Smaya   dw[1] =
166910e230b6Smaya      __gen_uint(values->Component3Control, 16, 18) |
167010e230b6Smaya      __gen_uint(values->Component2Control, 20, 22) |
167110e230b6Smaya      __gen_uint(values->Component1Control, 24, 26) |
167210e230b6Smaya      __gen_uint(values->Component0Control, 28, 30);
167310e230b6Smaya}
167410e230b6Smaya
167596c5ddc4Srjs#define GFX8_3DPRIMITIVE_length                7
167696c5ddc4Srjs#define GFX8_3DPRIMITIVE_length_bias           2
167796c5ddc4Srjs#define GFX8_3DPRIMITIVE_header                 \
167810e230b6Smaya   .DWordLength                         =      5,  \
167910e230b6Smaya   ._3DCommandSubOpcode                 =      0,  \
168010e230b6Smaya   ._3DCommandOpcode                    =      3,  \
168110e230b6Smaya   .CommandSubType                      =      3,  \
168210e230b6Smaya   .CommandType                         =      3
168310e230b6Smaya
168496c5ddc4Srjsstruct GFX8_3DPRIMITIVE {
168510e230b6Smaya   uint32_t                             DWordLength;
168610e230b6Smaya   bool                                 PredicateEnable;
168710e230b6Smaya   bool                                 UAVCoherencyRequired;
168810e230b6Smaya   bool                                 IndirectParameterEnable;
168910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
169010e230b6Smaya   uint32_t                             _3DCommandOpcode;
169110e230b6Smaya   uint32_t                             CommandSubType;
169210e230b6Smaya   uint32_t                             CommandType;
169396c5ddc4Srjs   enum GFX8_3D_Prim_Topo_Type          PrimitiveTopologyType;
169410e230b6Smaya   uint32_t                             VertexAccessType;
169510e230b6Smaya#define SEQUENTIAL                               0
169610e230b6Smaya#define RANDOM                                   1
169710e230b6Smaya   bool                                 EndOffsetEnable;
169810e230b6Smaya   uint32_t                             VertexCountPerInstance;
169910e230b6Smaya   uint32_t                             StartVertexLocation;
170010e230b6Smaya   uint32_t                             InstanceCount;
170110e230b6Smaya   uint32_t                             StartInstanceLocation;
170210e230b6Smaya   int32_t                              BaseVertexLocation;
170310e230b6Smaya};
170410e230b6Smaya
170596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
170696c5ddc4SrjsGFX8_3DPRIMITIVE_pack(__attribute__((unused)) __gen_user_data *data,
170710e230b6Smaya                      __attribute__((unused)) void * restrict dst,
170896c5ddc4Srjs                      __attribute__((unused)) const struct GFX8_3DPRIMITIVE * restrict values)
170910e230b6Smaya{
171010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
171110e230b6Smaya
171210e230b6Smaya   dw[0] =
171310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
171410e230b6Smaya      __gen_uint(values->PredicateEnable, 8, 8) |
171510e230b6Smaya      __gen_uint(values->UAVCoherencyRequired, 9, 9) |
171610e230b6Smaya      __gen_uint(values->IndirectParameterEnable, 10, 10) |
171710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
171810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
171910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
172010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
172110e230b6Smaya
172210e230b6Smaya   dw[1] =
172310e230b6Smaya      __gen_uint(values->PrimitiveTopologyType, 0, 5) |
172410e230b6Smaya      __gen_uint(values->VertexAccessType, 8, 8) |
172510e230b6Smaya      __gen_uint(values->EndOffsetEnable, 9, 9);
172610e230b6Smaya
172710e230b6Smaya   dw[2] =
172810e230b6Smaya      __gen_uint(values->VertexCountPerInstance, 0, 31);
172910e230b6Smaya
173010e230b6Smaya   dw[3] =
173110e230b6Smaya      __gen_uint(values->StartVertexLocation, 0, 31);
173210e230b6Smaya
173310e230b6Smaya   dw[4] =
173410e230b6Smaya      __gen_uint(values->InstanceCount, 0, 31);
173510e230b6Smaya
173610e230b6Smaya   dw[5] =
173710e230b6Smaya      __gen_uint(values->StartInstanceLocation, 0, 31);
173810e230b6Smaya
173910e230b6Smaya   dw[6] =
174010e230b6Smaya      __gen_sint(values->BaseVertexLocation, 0, 31);
174110e230b6Smaya}
174210e230b6Smaya
174396c5ddc4Srjs#define GFX8_3DSTATE_AA_LINE_PARAMETERS_length      3
174496c5ddc4Srjs#define GFX8_3DSTATE_AA_LINE_PARAMETERS_length_bias      2
174596c5ddc4Srjs#define GFX8_3DSTATE_AA_LINE_PARAMETERS_header  \
174610e230b6Smaya   .DWordLength                         =      1,  \
174710e230b6Smaya   ._3DCommandSubOpcode                 =     10,  \
174810e230b6Smaya   ._3DCommandOpcode                    =      1,  \
174910e230b6Smaya   .CommandSubType                      =      3,  \
175010e230b6Smaya   .CommandType                         =      3
175110e230b6Smaya
175296c5ddc4Srjsstruct GFX8_3DSTATE_AA_LINE_PARAMETERS {
175310e230b6Smaya   uint32_t                             DWordLength;
175410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
175510e230b6Smaya   uint32_t                             _3DCommandOpcode;
175610e230b6Smaya   uint32_t                             CommandSubType;
175710e230b6Smaya   uint32_t                             CommandType;
175810e230b6Smaya   float                                AACoverageSlope;
175910e230b6Smaya   float                                AAPointCoverageSlope;
176010e230b6Smaya   float                                AACoverageBias;
176110e230b6Smaya   float                                AAPointCoverageBias;
176210e230b6Smaya   float                                AACoverageEndCapSlope;
176310e230b6Smaya   float                                AAPointCoverageEndCapSlope;
176410e230b6Smaya   float                                AACoverageEndCapBias;
176510e230b6Smaya   float                                AAPointCoverageEndCapBias;
176610e230b6Smaya};
176710e230b6Smaya
176896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
176996c5ddc4SrjsGFX8_3DSTATE_AA_LINE_PARAMETERS_pack(__attribute__((unused)) __gen_user_data *data,
177010e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
177196c5ddc4Srjs                                     __attribute__((unused)) const struct GFX8_3DSTATE_AA_LINE_PARAMETERS * restrict values)
177210e230b6Smaya{
177310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
177410e230b6Smaya
177510e230b6Smaya   dw[0] =
177610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
177710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
177810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
177910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
178010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
178110e230b6Smaya
178210e230b6Smaya   dw[1] =
178310e230b6Smaya      __gen_ufixed(values->AACoverageSlope, 0, 7, 8) |
178410e230b6Smaya      __gen_ufixed(values->AAPointCoverageSlope, 8, 15, 8) |
178510e230b6Smaya      __gen_ufixed(values->AACoverageBias, 16, 23, 8) |
178610e230b6Smaya      __gen_ufixed(values->AAPointCoverageBias, 24, 31, 8);
178710e230b6Smaya
178810e230b6Smaya   dw[2] =
178910e230b6Smaya      __gen_ufixed(values->AACoverageEndCapSlope, 0, 7, 8) |
179010e230b6Smaya      __gen_ufixed(values->AAPointCoverageEndCapSlope, 8, 15, 8) |
179110e230b6Smaya      __gen_ufixed(values->AACoverageEndCapBias, 16, 23, 8) |
179210e230b6Smaya      __gen_ufixed(values->AAPointCoverageEndCapBias, 24, 31, 8);
179310e230b6Smaya}
179410e230b6Smaya
179596c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_EDIT_DS_length_bias      2
179696c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_EDIT_DS_header\
179710e230b6Smaya   .DWordLength                         =      0,  \
179810e230b6Smaya   ._3DCommandSubOpcode                 =     70,  \
179910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
180010e230b6Smaya   .CommandSubType                      =      3,  \
180110e230b6Smaya   .CommandType                         =      3
180210e230b6Smaya
180396c5ddc4Srjsstruct GFX8_3DSTATE_BINDING_TABLE_EDIT_DS {
180410e230b6Smaya   uint32_t                             DWordLength;
180510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
180610e230b6Smaya   uint32_t                             _3DCommandOpcode;
180710e230b6Smaya   uint32_t                             CommandSubType;
180810e230b6Smaya   uint32_t                             CommandType;
180910e230b6Smaya   uint32_t                             BindingTableEditTarget;
181010e230b6Smaya#define AllCores                                 3
181110e230b6Smaya#define Core1                                    2
181210e230b6Smaya#define Core0                                    1
181310e230b6Smaya   uint32_t                             BindingTableBlockClear;
181410e230b6Smaya   /* variable length fields follow */
181510e230b6Smaya};
181610e230b6Smaya
181796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
181896c5ddc4SrjsGFX8_3DSTATE_BINDING_TABLE_EDIT_DS_pack(__attribute__((unused)) __gen_user_data *data,
181910e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
182096c5ddc4Srjs                                        __attribute__((unused)) const struct GFX8_3DSTATE_BINDING_TABLE_EDIT_DS * restrict values)
182110e230b6Smaya{
182210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
182310e230b6Smaya
182410e230b6Smaya   dw[0] =
182510e230b6Smaya      __gen_uint(values->DWordLength, 0, 8) |
182610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
182710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
182810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
182910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
183010e230b6Smaya
183110e230b6Smaya   dw[1] =
183210e230b6Smaya      __gen_uint(values->BindingTableEditTarget, 0, 1) |
183310e230b6Smaya      __gen_uint(values->BindingTableBlockClear, 16, 31);
183410e230b6Smaya}
183510e230b6Smaya
183696c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_EDIT_GS_length_bias      2
183796c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_EDIT_GS_header\
183810e230b6Smaya   .DWordLength                         =      0,  \
183910e230b6Smaya   ._3DCommandSubOpcode                 =     68,  \
184010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
184110e230b6Smaya   .CommandSubType                      =      3,  \
184210e230b6Smaya   .CommandType                         =      3
184310e230b6Smaya
184496c5ddc4Srjsstruct GFX8_3DSTATE_BINDING_TABLE_EDIT_GS {
184510e230b6Smaya   uint32_t                             DWordLength;
184610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
184710e230b6Smaya   uint32_t                             _3DCommandOpcode;
184810e230b6Smaya   uint32_t                             CommandSubType;
184910e230b6Smaya   uint32_t                             CommandType;
185010e230b6Smaya   uint32_t                             BindingTableEditTarget;
185110e230b6Smaya#define AllCores                                 3
185210e230b6Smaya#define Core1                                    2
185310e230b6Smaya#define Core0                                    1
185410e230b6Smaya   uint32_t                             BindingTableBlockClear;
185510e230b6Smaya   /* variable length fields follow */
185610e230b6Smaya};
185710e230b6Smaya
185896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
185996c5ddc4SrjsGFX8_3DSTATE_BINDING_TABLE_EDIT_GS_pack(__attribute__((unused)) __gen_user_data *data,
186010e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
186196c5ddc4Srjs                                        __attribute__((unused)) const struct GFX8_3DSTATE_BINDING_TABLE_EDIT_GS * restrict values)
186210e230b6Smaya{
186310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
186410e230b6Smaya
186510e230b6Smaya   dw[0] =
186610e230b6Smaya      __gen_uint(values->DWordLength, 0, 8) |
186710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
186810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
186910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
187010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
187110e230b6Smaya
187210e230b6Smaya   dw[1] =
187310e230b6Smaya      __gen_uint(values->BindingTableEditTarget, 0, 1) |
187410e230b6Smaya      __gen_uint(values->BindingTableBlockClear, 16, 31);
187510e230b6Smaya}
187610e230b6Smaya
187796c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_EDIT_HS_length_bias      2
187896c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_EDIT_HS_header\
187910e230b6Smaya   .DWordLength                         =      0,  \
188010e230b6Smaya   ._3DCommandSubOpcode                 =     69,  \
188110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
188210e230b6Smaya   .CommandSubType                      =      3,  \
188310e230b6Smaya   .CommandType                         =      3
188410e230b6Smaya
188596c5ddc4Srjsstruct GFX8_3DSTATE_BINDING_TABLE_EDIT_HS {
188610e230b6Smaya   uint32_t                             DWordLength;
188710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
188810e230b6Smaya   uint32_t                             _3DCommandOpcode;
188910e230b6Smaya   uint32_t                             CommandSubType;
189010e230b6Smaya   uint32_t                             CommandType;
189110e230b6Smaya   uint32_t                             BindingTableEditTarget;
189210e230b6Smaya#define AllCores                                 3
189310e230b6Smaya#define Core1                                    2
189410e230b6Smaya#define Core0                                    1
189510e230b6Smaya   uint32_t                             BindingTableBlockClear;
189610e230b6Smaya   /* variable length fields follow */
189710e230b6Smaya};
189810e230b6Smaya
189996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
190096c5ddc4SrjsGFX8_3DSTATE_BINDING_TABLE_EDIT_HS_pack(__attribute__((unused)) __gen_user_data *data,
190110e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
190296c5ddc4Srjs                                        __attribute__((unused)) const struct GFX8_3DSTATE_BINDING_TABLE_EDIT_HS * restrict values)
190310e230b6Smaya{
190410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
190510e230b6Smaya
190610e230b6Smaya   dw[0] =
190710e230b6Smaya      __gen_uint(values->DWordLength, 0, 8) |
190810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
190910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
191010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
191110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
191210e230b6Smaya
191310e230b6Smaya   dw[1] =
191410e230b6Smaya      __gen_uint(values->BindingTableEditTarget, 0, 1) |
191510e230b6Smaya      __gen_uint(values->BindingTableBlockClear, 16, 31);
191610e230b6Smaya}
191710e230b6Smaya
191896c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_EDIT_PS_length_bias      2
191996c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_EDIT_PS_header\
192010e230b6Smaya   .DWordLength                         =      0,  \
192110e230b6Smaya   ._3DCommandSubOpcode                 =     71,  \
192210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
192310e230b6Smaya   .CommandSubType                      =      3,  \
192410e230b6Smaya   .CommandType                         =      3
192510e230b6Smaya
192696c5ddc4Srjsstruct GFX8_3DSTATE_BINDING_TABLE_EDIT_PS {
192710e230b6Smaya   uint32_t                             DWordLength;
192810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
192910e230b6Smaya   uint32_t                             _3DCommandOpcode;
193010e230b6Smaya   uint32_t                             CommandSubType;
193110e230b6Smaya   uint32_t                             CommandType;
193210e230b6Smaya   uint32_t                             BindingTableEditTarget;
193310e230b6Smaya#define AllCores                                 3
193410e230b6Smaya#define Core1                                    2
193510e230b6Smaya#define Core0                                    1
193610e230b6Smaya   uint32_t                             BindingTableBlockClear;
193710e230b6Smaya   /* variable length fields follow */
193810e230b6Smaya};
193910e230b6Smaya
194096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
194196c5ddc4SrjsGFX8_3DSTATE_BINDING_TABLE_EDIT_PS_pack(__attribute__((unused)) __gen_user_data *data,
194210e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
194396c5ddc4Srjs                                        __attribute__((unused)) const struct GFX8_3DSTATE_BINDING_TABLE_EDIT_PS * restrict values)
194410e230b6Smaya{
194510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
194610e230b6Smaya
194710e230b6Smaya   dw[0] =
194810e230b6Smaya      __gen_uint(values->DWordLength, 0, 8) |
194910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
195010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
195110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
195210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
195310e230b6Smaya
195410e230b6Smaya   dw[1] =
195510e230b6Smaya      __gen_uint(values->BindingTableEditTarget, 0, 1) |
195610e230b6Smaya      __gen_uint(values->BindingTableBlockClear, 16, 31);
195710e230b6Smaya}
195810e230b6Smaya
195996c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_EDIT_VS_length_bias      2
196096c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_EDIT_VS_header\
196110e230b6Smaya   .DWordLength                         =      0,  \
196210e230b6Smaya   ._3DCommandSubOpcode                 =     67,  \
196310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
196410e230b6Smaya   .CommandSubType                      =      3,  \
196510e230b6Smaya   .CommandType                         =      3
196610e230b6Smaya
196796c5ddc4Srjsstruct GFX8_3DSTATE_BINDING_TABLE_EDIT_VS {
196810e230b6Smaya   uint32_t                             DWordLength;
196910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
197010e230b6Smaya   uint32_t                             _3DCommandOpcode;
197110e230b6Smaya   uint32_t                             CommandSubType;
197210e230b6Smaya   uint32_t                             CommandType;
197310e230b6Smaya   uint32_t                             BindingTableEditTarget;
197410e230b6Smaya#define AllCores                                 3
197510e230b6Smaya#define Core1                                    2
197610e230b6Smaya#define Core0                                    1
197710e230b6Smaya   uint32_t                             BindingTableBlockClear;
197810e230b6Smaya   /* variable length fields follow */
197910e230b6Smaya};
198010e230b6Smaya
198196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
198296c5ddc4SrjsGFX8_3DSTATE_BINDING_TABLE_EDIT_VS_pack(__attribute__((unused)) __gen_user_data *data,
198310e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
198496c5ddc4Srjs                                        __attribute__((unused)) const struct GFX8_3DSTATE_BINDING_TABLE_EDIT_VS * restrict values)
198510e230b6Smaya{
198610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
198710e230b6Smaya
198810e230b6Smaya   dw[0] =
198910e230b6Smaya      __gen_uint(values->DWordLength, 0, 8) |
199010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
199110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
199210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
199310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
199410e230b6Smaya
199510e230b6Smaya   dw[1] =
199610e230b6Smaya      __gen_uint(values->BindingTableEditTarget, 0, 1) |
199710e230b6Smaya      __gen_uint(values->BindingTableBlockClear, 16, 31);
199810e230b6Smaya}
199910e230b6Smaya
200096c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_POINTERS_DS_length      2
200196c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_POINTERS_DS_length_bias      2
200296c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_POINTERS_DS_header\
200310e230b6Smaya   .DWordLength                         =      0,  \
200410e230b6Smaya   ._3DCommandSubOpcode                 =     40,  \
200510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
200610e230b6Smaya   .CommandSubType                      =      3,  \
200710e230b6Smaya   .CommandType                         =      3
200810e230b6Smaya
200996c5ddc4Srjsstruct GFX8_3DSTATE_BINDING_TABLE_POINTERS_DS {
201010e230b6Smaya   uint32_t                             DWordLength;
201110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
201210e230b6Smaya   uint32_t                             _3DCommandOpcode;
201310e230b6Smaya   uint32_t                             CommandSubType;
201410e230b6Smaya   uint32_t                             CommandType;
201510e230b6Smaya   uint64_t                             PointertoDSBindingTable;
201610e230b6Smaya};
201710e230b6Smaya
201896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
201996c5ddc4SrjsGFX8_3DSTATE_BINDING_TABLE_POINTERS_DS_pack(__attribute__((unused)) __gen_user_data *data,
202010e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
202196c5ddc4Srjs                                            __attribute__((unused)) const struct GFX8_3DSTATE_BINDING_TABLE_POINTERS_DS * restrict values)
202210e230b6Smaya{
202310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
202410e230b6Smaya
202510e230b6Smaya   dw[0] =
202610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
202710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
202810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
202910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
203010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
203110e230b6Smaya
203210e230b6Smaya   dw[1] =
203310e230b6Smaya      __gen_offset(values->PointertoDSBindingTable, 5, 15);
203410e230b6Smaya}
203510e230b6Smaya
203696c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_POINTERS_GS_length      2
203796c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_POINTERS_GS_length_bias      2
203896c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_POINTERS_GS_header\
203910e230b6Smaya   .DWordLength                         =      0,  \
204010e230b6Smaya   ._3DCommandSubOpcode                 =     41,  \
204110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
204210e230b6Smaya   .CommandSubType                      =      3,  \
204310e230b6Smaya   .CommandType                         =      3
204410e230b6Smaya
204596c5ddc4Srjsstruct GFX8_3DSTATE_BINDING_TABLE_POINTERS_GS {
204610e230b6Smaya   uint32_t                             DWordLength;
204710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
204810e230b6Smaya   uint32_t                             _3DCommandOpcode;
204910e230b6Smaya   uint32_t                             CommandSubType;
205010e230b6Smaya   uint32_t                             CommandType;
205110e230b6Smaya   uint64_t                             PointertoGSBindingTable;
205210e230b6Smaya};
205310e230b6Smaya
205496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
205596c5ddc4SrjsGFX8_3DSTATE_BINDING_TABLE_POINTERS_GS_pack(__attribute__((unused)) __gen_user_data *data,
205610e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
205796c5ddc4Srjs                                            __attribute__((unused)) const struct GFX8_3DSTATE_BINDING_TABLE_POINTERS_GS * restrict values)
205810e230b6Smaya{
205910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
206010e230b6Smaya
206110e230b6Smaya   dw[0] =
206210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
206310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
206410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
206510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
206610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
206710e230b6Smaya
206810e230b6Smaya   dw[1] =
206910e230b6Smaya      __gen_offset(values->PointertoGSBindingTable, 5, 15);
207010e230b6Smaya}
207110e230b6Smaya
207296c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_POINTERS_HS_length      2
207396c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_POINTERS_HS_length_bias      2
207496c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_POINTERS_HS_header\
207510e230b6Smaya   .DWordLength                         =      0,  \
207610e230b6Smaya   ._3DCommandSubOpcode                 =     39,  \
207710e230b6Smaya   ._3DCommandOpcode                    =      0,  \
207810e230b6Smaya   .CommandSubType                      =      3,  \
207910e230b6Smaya   .CommandType                         =      3
208010e230b6Smaya
208196c5ddc4Srjsstruct GFX8_3DSTATE_BINDING_TABLE_POINTERS_HS {
208210e230b6Smaya   uint32_t                             DWordLength;
208310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
208410e230b6Smaya   uint32_t                             _3DCommandOpcode;
208510e230b6Smaya   uint32_t                             CommandSubType;
208610e230b6Smaya   uint32_t                             CommandType;
208710e230b6Smaya   uint64_t                             PointertoHSBindingTable;
208810e230b6Smaya};
208910e230b6Smaya
209096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
209196c5ddc4SrjsGFX8_3DSTATE_BINDING_TABLE_POINTERS_HS_pack(__attribute__((unused)) __gen_user_data *data,
209210e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
209396c5ddc4Srjs                                            __attribute__((unused)) const struct GFX8_3DSTATE_BINDING_TABLE_POINTERS_HS * restrict values)
209410e230b6Smaya{
209510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
209610e230b6Smaya
209710e230b6Smaya   dw[0] =
209810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
209910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
210010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
210110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
210210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
210310e230b6Smaya
210410e230b6Smaya   dw[1] =
210510e230b6Smaya      __gen_offset(values->PointertoHSBindingTable, 5, 15);
210610e230b6Smaya}
210710e230b6Smaya
210896c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_POINTERS_PS_length      2
210996c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_POINTERS_PS_length_bias      2
211096c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_POINTERS_PS_header\
211110e230b6Smaya   .DWordLength                         =      0,  \
211210e230b6Smaya   ._3DCommandSubOpcode                 =     42,  \
211310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
211410e230b6Smaya   .CommandSubType                      =      3,  \
211510e230b6Smaya   .CommandType                         =      3
211610e230b6Smaya
211796c5ddc4Srjsstruct GFX8_3DSTATE_BINDING_TABLE_POINTERS_PS {
211810e230b6Smaya   uint32_t                             DWordLength;
211910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
212010e230b6Smaya   uint32_t                             _3DCommandOpcode;
212110e230b6Smaya   uint32_t                             CommandSubType;
212210e230b6Smaya   uint32_t                             CommandType;
212310e230b6Smaya   uint64_t                             PointertoPSBindingTable;
212410e230b6Smaya};
212510e230b6Smaya
212696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
212796c5ddc4SrjsGFX8_3DSTATE_BINDING_TABLE_POINTERS_PS_pack(__attribute__((unused)) __gen_user_data *data,
212810e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
212996c5ddc4Srjs                                            __attribute__((unused)) const struct GFX8_3DSTATE_BINDING_TABLE_POINTERS_PS * restrict values)
213010e230b6Smaya{
213110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
213210e230b6Smaya
213310e230b6Smaya   dw[0] =
213410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
213510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
213610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
213710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
213810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
213910e230b6Smaya
214010e230b6Smaya   dw[1] =
214110e230b6Smaya      __gen_offset(values->PointertoPSBindingTable, 5, 15);
214210e230b6Smaya}
214310e230b6Smaya
214496c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_POINTERS_VS_length      2
214596c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_POINTERS_VS_length_bias      2
214696c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_POINTERS_VS_header\
214710e230b6Smaya   .DWordLength                         =      0,  \
214810e230b6Smaya   ._3DCommandSubOpcode                 =     38,  \
214910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
215010e230b6Smaya   .CommandSubType                      =      3,  \
215110e230b6Smaya   .CommandType                         =      3
215210e230b6Smaya
215396c5ddc4Srjsstruct GFX8_3DSTATE_BINDING_TABLE_POINTERS_VS {
215410e230b6Smaya   uint32_t                             DWordLength;
215510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
215610e230b6Smaya   uint32_t                             _3DCommandOpcode;
215710e230b6Smaya   uint32_t                             CommandSubType;
215810e230b6Smaya   uint32_t                             CommandType;
215910e230b6Smaya   uint64_t                             PointertoVSBindingTable;
216010e230b6Smaya};
216110e230b6Smaya
216296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
216396c5ddc4SrjsGFX8_3DSTATE_BINDING_TABLE_POINTERS_VS_pack(__attribute__((unused)) __gen_user_data *data,
216410e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
216596c5ddc4Srjs                                            __attribute__((unused)) const struct GFX8_3DSTATE_BINDING_TABLE_POINTERS_VS * restrict values)
216610e230b6Smaya{
216710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
216810e230b6Smaya
216910e230b6Smaya   dw[0] =
217010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
217110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
217210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
217310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
217410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
217510e230b6Smaya
217610e230b6Smaya   dw[1] =
217710e230b6Smaya      __gen_offset(values->PointertoVSBindingTable, 5, 15);
217810e230b6Smaya}
217910e230b6Smaya
218096c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_POOL_ALLOC_length      4
218196c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_POOL_ALLOC_length_bias      2
218296c5ddc4Srjs#define GFX8_3DSTATE_BINDING_TABLE_POOL_ALLOC_header\
218310e230b6Smaya   .DWordLength                         =      2,  \
218410e230b6Smaya   ._3DCommandSubOpcode                 =     25,  \
218510e230b6Smaya   ._3DCommandOpcode                    =      1,  \
218610e230b6Smaya   .CommandSubType                      =      3,  \
218710e230b6Smaya   .CommandType                         =      3
218810e230b6Smaya
218996c5ddc4Srjsstruct GFX8_3DSTATE_BINDING_TABLE_POOL_ALLOC {
219010e230b6Smaya   uint32_t                             DWordLength;
219110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
219210e230b6Smaya   uint32_t                             _3DCommandOpcode;
219310e230b6Smaya   uint32_t                             CommandSubType;
219410e230b6Smaya   uint32_t                             CommandType;
219510e230b6Smaya   uint32_t                             MOCS;
219696c5ddc4Srjs   bool                                 BindingTablePoolEnable;
219710e230b6Smaya   __gen_address_type                   BindingTablePoolBaseAddress;
219810e230b6Smaya   uint32_t                             BindingTablePoolBufferSize;
219910e230b6Smaya#define NoValidData                              0
220010e230b6Smaya};
220110e230b6Smaya
220296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
220396c5ddc4SrjsGFX8_3DSTATE_BINDING_TABLE_POOL_ALLOC_pack(__attribute__((unused)) __gen_user_data *data,
220410e230b6Smaya                                           __attribute__((unused)) void * restrict dst,
220596c5ddc4Srjs                                           __attribute__((unused)) const struct GFX8_3DSTATE_BINDING_TABLE_POOL_ALLOC * restrict values)
220610e230b6Smaya{
220710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
220810e230b6Smaya
220910e230b6Smaya   dw[0] =
221010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
221110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
221210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
221310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
221410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
221510e230b6Smaya
221610e230b6Smaya   const uint64_t v1 =
221710e230b6Smaya      __gen_uint(values->MOCS, 0, 6) |
221810e230b6Smaya      __gen_uint(values->BindingTablePoolEnable, 11, 11);
221910e230b6Smaya   const uint64_t v1_address =
222096c5ddc4Srjs      __gen_address(data, &dw[1], values->BindingTablePoolBaseAddress, v1, 12, 63);
222110e230b6Smaya   dw[1] = v1_address;
222210e230b6Smaya   dw[2] = (v1_address >> 32) | (v1 >> 32);
222310e230b6Smaya
222410e230b6Smaya   dw[3] =
222510e230b6Smaya      __gen_uint(values->BindingTablePoolBufferSize, 12, 31);
222610e230b6Smaya}
222710e230b6Smaya
222896c5ddc4Srjs#define GFX8_3DSTATE_BLEND_STATE_POINTERS_length      2
222996c5ddc4Srjs#define GFX8_3DSTATE_BLEND_STATE_POINTERS_length_bias      2
223096c5ddc4Srjs#define GFX8_3DSTATE_BLEND_STATE_POINTERS_header\
223110e230b6Smaya   .DWordLength                         =      0,  \
223210e230b6Smaya   ._3DCommandSubOpcode                 =     36,  \
223310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
223410e230b6Smaya   .CommandSubType                      =      3,  \
223510e230b6Smaya   .CommandType                         =      3
223610e230b6Smaya
223796c5ddc4Srjsstruct GFX8_3DSTATE_BLEND_STATE_POINTERS {
223810e230b6Smaya   uint32_t                             DWordLength;
223910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
224010e230b6Smaya   uint32_t                             _3DCommandOpcode;
224110e230b6Smaya   uint32_t                             CommandSubType;
224210e230b6Smaya   uint32_t                             CommandType;
224310e230b6Smaya   bool                                 BlendStatePointerValid;
224410e230b6Smaya   uint64_t                             BlendStatePointer;
224510e230b6Smaya};
224610e230b6Smaya
224796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
224896c5ddc4SrjsGFX8_3DSTATE_BLEND_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
224910e230b6Smaya                                       __attribute__((unused)) void * restrict dst,
225096c5ddc4Srjs                                       __attribute__((unused)) const struct GFX8_3DSTATE_BLEND_STATE_POINTERS * restrict values)
225110e230b6Smaya{
225210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
225310e230b6Smaya
225410e230b6Smaya   dw[0] =
225510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
225610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
225710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
225810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
225910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
226010e230b6Smaya
226110e230b6Smaya   dw[1] =
226210e230b6Smaya      __gen_uint(values->BlendStatePointerValid, 0, 0) |
226310e230b6Smaya      __gen_offset(values->BlendStatePointer, 6, 31);
226410e230b6Smaya}
226510e230b6Smaya
226696c5ddc4Srjs#define GFX8_3DSTATE_CC_STATE_POINTERS_length      2
226796c5ddc4Srjs#define GFX8_3DSTATE_CC_STATE_POINTERS_length_bias      2
226896c5ddc4Srjs#define GFX8_3DSTATE_CC_STATE_POINTERS_header   \
226910e230b6Smaya   .DWordLength                         =      0,  \
227010e230b6Smaya   ._3DCommandSubOpcode                 =     14,  \
227110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
227210e230b6Smaya   .CommandSubType                      =      3,  \
227310e230b6Smaya   .CommandType                         =      3
227410e230b6Smaya
227596c5ddc4Srjsstruct GFX8_3DSTATE_CC_STATE_POINTERS {
227610e230b6Smaya   uint32_t                             DWordLength;
227710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
227810e230b6Smaya   uint32_t                             _3DCommandOpcode;
227910e230b6Smaya   uint32_t                             CommandSubType;
228010e230b6Smaya   uint32_t                             CommandType;
228110e230b6Smaya   bool                                 ColorCalcStatePointerValid;
228210e230b6Smaya   uint64_t                             ColorCalcStatePointer;
228310e230b6Smaya};
228410e230b6Smaya
228596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
228696c5ddc4SrjsGFX8_3DSTATE_CC_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
228710e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
228896c5ddc4Srjs                                    __attribute__((unused)) const struct GFX8_3DSTATE_CC_STATE_POINTERS * restrict values)
228910e230b6Smaya{
229010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
229110e230b6Smaya
229210e230b6Smaya   dw[0] =
229310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
229410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
229510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
229610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
229710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
229810e230b6Smaya
229910e230b6Smaya   dw[1] =
230010e230b6Smaya      __gen_uint(values->ColorCalcStatePointerValid, 0, 0) |
230110e230b6Smaya      __gen_offset(values->ColorCalcStatePointer, 6, 31);
230210e230b6Smaya}
230310e230b6Smaya
230496c5ddc4Srjs#define GFX8_3DSTATE_CHROMA_KEY_length         4
230596c5ddc4Srjs#define GFX8_3DSTATE_CHROMA_KEY_length_bias      2
230696c5ddc4Srjs#define GFX8_3DSTATE_CHROMA_KEY_header          \
230710e230b6Smaya   .DWordLength                         =      2,  \
230810e230b6Smaya   ._3DCommandSubOpcode                 =      4,  \
230910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
231010e230b6Smaya   .CommandSubType                      =      3,  \
231110e230b6Smaya   .CommandType                         =      3
231210e230b6Smaya
231396c5ddc4Srjsstruct GFX8_3DSTATE_CHROMA_KEY {
231410e230b6Smaya   uint32_t                             DWordLength;
231510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
231610e230b6Smaya   uint32_t                             _3DCommandOpcode;
231710e230b6Smaya   uint32_t                             CommandSubType;
231810e230b6Smaya   uint32_t                             CommandType;
231910e230b6Smaya   uint32_t                             ChromaKeyTableIndex;
232010e230b6Smaya   uint32_t                             ChromaKeyLowValue;
232110e230b6Smaya   uint32_t                             ChromaKeyHighValue;
232210e230b6Smaya};
232310e230b6Smaya
232496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
232596c5ddc4SrjsGFX8_3DSTATE_CHROMA_KEY_pack(__attribute__((unused)) __gen_user_data *data,
232610e230b6Smaya                             __attribute__((unused)) void * restrict dst,
232796c5ddc4Srjs                             __attribute__((unused)) const struct GFX8_3DSTATE_CHROMA_KEY * restrict values)
232810e230b6Smaya{
232910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
233010e230b6Smaya
233110e230b6Smaya   dw[0] =
233210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
233310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
233410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
233510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
233610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
233710e230b6Smaya
233810e230b6Smaya   dw[1] =
233910e230b6Smaya      __gen_uint(values->ChromaKeyTableIndex, 30, 31);
234010e230b6Smaya
234110e230b6Smaya   dw[2] =
234210e230b6Smaya      __gen_uint(values->ChromaKeyLowValue, 0, 31);
234310e230b6Smaya
234410e230b6Smaya   dw[3] =
234510e230b6Smaya      __gen_uint(values->ChromaKeyHighValue, 0, 31);
234610e230b6Smaya}
234710e230b6Smaya
234896c5ddc4Srjs#define GFX8_3DSTATE_CLEAR_PARAMS_length       3
234996c5ddc4Srjs#define GFX8_3DSTATE_CLEAR_PARAMS_length_bias      2
235096c5ddc4Srjs#define GFX8_3DSTATE_CLEAR_PARAMS_header        \
235110e230b6Smaya   .DWordLength                         =      1,  \
235210e230b6Smaya   ._3DCommandSubOpcode                 =      4,  \
235310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
235410e230b6Smaya   .CommandSubType                      =      3,  \
235510e230b6Smaya   .CommandType                         =      3
235610e230b6Smaya
235796c5ddc4Srjsstruct GFX8_3DSTATE_CLEAR_PARAMS {
235810e230b6Smaya   uint32_t                             DWordLength;
235910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
236010e230b6Smaya   uint32_t                             _3DCommandOpcode;
236110e230b6Smaya   uint32_t                             CommandSubType;
236210e230b6Smaya   uint32_t                             CommandType;
236310e230b6Smaya   float                                DepthClearValue;
236410e230b6Smaya   bool                                 DepthClearValueValid;
236510e230b6Smaya};
236610e230b6Smaya
236796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
236896c5ddc4SrjsGFX8_3DSTATE_CLEAR_PARAMS_pack(__attribute__((unused)) __gen_user_data *data,
236910e230b6Smaya                               __attribute__((unused)) void * restrict dst,
237096c5ddc4Srjs                               __attribute__((unused)) const struct GFX8_3DSTATE_CLEAR_PARAMS * restrict values)
237110e230b6Smaya{
237210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
237310e230b6Smaya
237410e230b6Smaya   dw[0] =
237510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
237610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
237710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
237810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
237910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
238010e230b6Smaya
238110e230b6Smaya   dw[1] =
238210e230b6Smaya      __gen_float(values->DepthClearValue);
238310e230b6Smaya
238410e230b6Smaya   dw[2] =
238510e230b6Smaya      __gen_uint(values->DepthClearValueValid, 0, 0);
238610e230b6Smaya}
238710e230b6Smaya
238896c5ddc4Srjs#define GFX8_3DSTATE_CLIP_length               4
238996c5ddc4Srjs#define GFX8_3DSTATE_CLIP_length_bias          2
239096c5ddc4Srjs#define GFX8_3DSTATE_CLIP_header                \
239110e230b6Smaya   .DWordLength                         =      2,  \
239210e230b6Smaya   ._3DCommandSubOpcode                 =     18,  \
239310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
239410e230b6Smaya   .CommandSubType                      =      3,  \
239510e230b6Smaya   .CommandType                         =      3
239610e230b6Smaya
239796c5ddc4Srjsstruct GFX8_3DSTATE_CLIP {
239810e230b6Smaya   uint32_t                             DWordLength;
239910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
240010e230b6Smaya   uint32_t                             _3DCommandOpcode;
240110e230b6Smaya   uint32_t                             CommandSubType;
240210e230b6Smaya   uint32_t                             CommandType;
240310e230b6Smaya   uint32_t                             UserClipDistanceCullTestEnableBitmask;
240410e230b6Smaya   bool                                 StatisticsEnable;
240510e230b6Smaya   bool                                 ForceClipMode;
240610e230b6Smaya   bool                                 ForceUserClipDistanceClipTestEnableBitmask;
240710e230b6Smaya   bool                                 EarlyCullEnable;
240810e230b6Smaya   uint32_t                             VertexSubPixelPrecisionSelect;
240910e230b6Smaya#define _8Bit                                    0
241010e230b6Smaya#define _4Bit                                    1
241110e230b6Smaya   bool                                 ForceUserClipDistanceCullTestEnableBitmask;
241210e230b6Smaya   uint32_t                             TriangleFanProvokingVertexSelect;
241310e230b6Smaya   uint32_t                             LineStripListProvokingVertexSelect;
241410e230b6Smaya   uint32_t                             TriangleStripListProvokingVertexSelect;
241510e230b6Smaya   bool                                 NonPerspectiveBarycentricEnable;
241610e230b6Smaya   bool                                 PerspectiveDivideDisable;
241710e230b6Smaya   uint32_t                             ClipMode;
241810e230b6Smaya#define CLIPMODE_NORMAL                          0
241910e230b6Smaya#define CLIPMODE_REJECT_ALL                      3
242010e230b6Smaya#define CLIPMODE_ACCEPT_ALL                      4
242110e230b6Smaya   uint32_t                             UserClipDistanceClipTestEnableBitmask;
242210e230b6Smaya   bool                                 GuardbandClipTestEnable;
242310e230b6Smaya   bool                                 ViewportXYClipTestEnable;
242410e230b6Smaya   uint32_t                             APIMode;
242510e230b6Smaya#define APIMODE_OGL                              0
242610e230b6Smaya#define APIMODE_D3D                              1
242710e230b6Smaya   bool                                 ClipEnable;
242810e230b6Smaya   uint32_t                             MaximumVPIndex;
242910e230b6Smaya   bool                                 ForceZeroRTAIndexEnable;
243010e230b6Smaya   float                                MaximumPointWidth;
243110e230b6Smaya   float                                MinimumPointWidth;
243210e230b6Smaya};
243310e230b6Smaya
243496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
243596c5ddc4SrjsGFX8_3DSTATE_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
243610e230b6Smaya                       __attribute__((unused)) void * restrict dst,
243796c5ddc4Srjs                       __attribute__((unused)) const struct GFX8_3DSTATE_CLIP * restrict values)
243810e230b6Smaya{
243910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
244010e230b6Smaya
244110e230b6Smaya   dw[0] =
244210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
244310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
244410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
244510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
244610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
244710e230b6Smaya
244810e230b6Smaya   dw[1] =
244910e230b6Smaya      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
245010e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
245110e230b6Smaya      __gen_uint(values->ForceClipMode, 16, 16) |
245210e230b6Smaya      __gen_uint(values->ForceUserClipDistanceClipTestEnableBitmask, 17, 17) |
245310e230b6Smaya      __gen_uint(values->EarlyCullEnable, 18, 18) |
245410e230b6Smaya      __gen_uint(values->VertexSubPixelPrecisionSelect, 19, 19) |
245510e230b6Smaya      __gen_uint(values->ForceUserClipDistanceCullTestEnableBitmask, 20, 20);
245610e230b6Smaya
245710e230b6Smaya   dw[2] =
245810e230b6Smaya      __gen_uint(values->TriangleFanProvokingVertexSelect, 0, 1) |
245910e230b6Smaya      __gen_uint(values->LineStripListProvokingVertexSelect, 2, 3) |
246010e230b6Smaya      __gen_uint(values->TriangleStripListProvokingVertexSelect, 4, 5) |
246110e230b6Smaya      __gen_uint(values->NonPerspectiveBarycentricEnable, 8, 8) |
246210e230b6Smaya      __gen_uint(values->PerspectiveDivideDisable, 9, 9) |
246310e230b6Smaya      __gen_uint(values->ClipMode, 13, 15) |
246410e230b6Smaya      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 16, 23) |
246510e230b6Smaya      __gen_uint(values->GuardbandClipTestEnable, 26, 26) |
246610e230b6Smaya      __gen_uint(values->ViewportXYClipTestEnable, 28, 28) |
246710e230b6Smaya      __gen_uint(values->APIMode, 30, 30) |
246810e230b6Smaya      __gen_uint(values->ClipEnable, 31, 31);
246910e230b6Smaya
247010e230b6Smaya   dw[3] =
247110e230b6Smaya      __gen_uint(values->MaximumVPIndex, 0, 3) |
247210e230b6Smaya      __gen_uint(values->ForceZeroRTAIndexEnable, 5, 5) |
247310e230b6Smaya      __gen_ufixed(values->MaximumPointWidth, 6, 16, 3) |
247410e230b6Smaya      __gen_ufixed(values->MinimumPointWidth, 17, 27, 3);
247510e230b6Smaya}
247610e230b6Smaya
247796c5ddc4Srjs#define GFX8_3DSTATE_CONSTANT_DS_length       11
247896c5ddc4Srjs#define GFX8_3DSTATE_CONSTANT_DS_length_bias      2
247996c5ddc4Srjs#define GFX8_3DSTATE_CONSTANT_DS_header         \
248010e230b6Smaya   .DWordLength                         =      9,  \
248110e230b6Smaya   ._3DCommandSubOpcode                 =     26,  \
248210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
248310e230b6Smaya   .CommandSubType                      =      3,  \
248410e230b6Smaya   .CommandType                         =      3
248510e230b6Smaya
248696c5ddc4Srjsstruct GFX8_3DSTATE_CONSTANT_DS {
248710e230b6Smaya   uint32_t                             DWordLength;
248810e230b6Smaya   uint32_t                             MOCS;
248910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
249010e230b6Smaya   uint32_t                             _3DCommandOpcode;
249110e230b6Smaya   uint32_t                             CommandSubType;
249210e230b6Smaya   uint32_t                             CommandType;
249396c5ddc4Srjs   struct GFX8_3DSTATE_CONSTANT_BODY    ConstantBody;
249410e230b6Smaya};
249510e230b6Smaya
249696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
249796c5ddc4SrjsGFX8_3DSTATE_CONSTANT_DS_pack(__attribute__((unused)) __gen_user_data *data,
249810e230b6Smaya                              __attribute__((unused)) void * restrict dst,
249996c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_3DSTATE_CONSTANT_DS * restrict values)
250010e230b6Smaya{
250110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
250210e230b6Smaya
250310e230b6Smaya   dw[0] =
250410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
250510e230b6Smaya      __gen_uint(values->MOCS, 8, 14) |
250610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
250710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
250810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
250910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
251010e230b6Smaya
251196c5ddc4Srjs   GFX8_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
251210e230b6Smaya}
251310e230b6Smaya
251496c5ddc4Srjs#define GFX8_3DSTATE_CONSTANT_GS_length       11
251596c5ddc4Srjs#define GFX8_3DSTATE_CONSTANT_GS_length_bias      2
251696c5ddc4Srjs#define GFX8_3DSTATE_CONSTANT_GS_header         \
251710e230b6Smaya   .DWordLength                         =      9,  \
251810e230b6Smaya   ._3DCommandSubOpcode                 =     22,  \
251910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
252010e230b6Smaya   .CommandSubType                      =      3,  \
252110e230b6Smaya   .CommandType                         =      3
252210e230b6Smaya
252396c5ddc4Srjsstruct GFX8_3DSTATE_CONSTANT_GS {
252410e230b6Smaya   uint32_t                             DWordLength;
252510e230b6Smaya   uint32_t                             MOCS;
252610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
252710e230b6Smaya   uint32_t                             _3DCommandOpcode;
252810e230b6Smaya   uint32_t                             CommandSubType;
252910e230b6Smaya   uint32_t                             CommandType;
253096c5ddc4Srjs   struct GFX8_3DSTATE_CONSTANT_BODY    ConstantBody;
253110e230b6Smaya};
253210e230b6Smaya
253396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
253496c5ddc4SrjsGFX8_3DSTATE_CONSTANT_GS_pack(__attribute__((unused)) __gen_user_data *data,
253510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
253696c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_3DSTATE_CONSTANT_GS * restrict values)
253710e230b6Smaya{
253810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
253910e230b6Smaya
254010e230b6Smaya   dw[0] =
254110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
254210e230b6Smaya      __gen_uint(values->MOCS, 8, 14) |
254310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
254410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
254510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
254610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
254710e230b6Smaya
254896c5ddc4Srjs   GFX8_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
254910e230b6Smaya}
255010e230b6Smaya
255196c5ddc4Srjs#define GFX8_3DSTATE_CONSTANT_HS_length       11
255296c5ddc4Srjs#define GFX8_3DSTATE_CONSTANT_HS_length_bias      2
255396c5ddc4Srjs#define GFX8_3DSTATE_CONSTANT_HS_header         \
255410e230b6Smaya   .DWordLength                         =      9,  \
255510e230b6Smaya   ._3DCommandSubOpcode                 =     25,  \
255610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
255710e230b6Smaya   .CommandSubType                      =      3,  \
255810e230b6Smaya   .CommandType                         =      3
255910e230b6Smaya
256096c5ddc4Srjsstruct GFX8_3DSTATE_CONSTANT_HS {
256110e230b6Smaya   uint32_t                             DWordLength;
256210e230b6Smaya   uint32_t                             MOCS;
256310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
256410e230b6Smaya   uint32_t                             _3DCommandOpcode;
256510e230b6Smaya   uint32_t                             CommandSubType;
256610e230b6Smaya   uint32_t                             CommandType;
256796c5ddc4Srjs   struct GFX8_3DSTATE_CONSTANT_BODY    ConstantBody;
256810e230b6Smaya};
256910e230b6Smaya
257096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
257196c5ddc4SrjsGFX8_3DSTATE_CONSTANT_HS_pack(__attribute__((unused)) __gen_user_data *data,
257210e230b6Smaya                              __attribute__((unused)) void * restrict dst,
257396c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_3DSTATE_CONSTANT_HS * restrict values)
257410e230b6Smaya{
257510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
257610e230b6Smaya
257710e230b6Smaya   dw[0] =
257810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
257910e230b6Smaya      __gen_uint(values->MOCS, 8, 14) |
258010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
258110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
258210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
258310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
258410e230b6Smaya
258596c5ddc4Srjs   GFX8_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
258610e230b6Smaya}
258710e230b6Smaya
258896c5ddc4Srjs#define GFX8_3DSTATE_CONSTANT_PS_length       11
258996c5ddc4Srjs#define GFX8_3DSTATE_CONSTANT_PS_length_bias      2
259096c5ddc4Srjs#define GFX8_3DSTATE_CONSTANT_PS_header         \
259110e230b6Smaya   .DWordLength                         =      9,  \
259210e230b6Smaya   ._3DCommandSubOpcode                 =     23,  \
259310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
259410e230b6Smaya   .CommandSubType                      =      3,  \
259510e230b6Smaya   .CommandType                         =      3
259610e230b6Smaya
259796c5ddc4Srjsstruct GFX8_3DSTATE_CONSTANT_PS {
259810e230b6Smaya   uint32_t                             DWordLength;
259910e230b6Smaya   uint32_t                             MOCS;
260010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
260110e230b6Smaya   uint32_t                             _3DCommandOpcode;
260210e230b6Smaya   uint32_t                             CommandSubType;
260310e230b6Smaya   uint32_t                             CommandType;
260496c5ddc4Srjs   struct GFX8_3DSTATE_CONSTANT_BODY    ConstantBody;
260510e230b6Smaya};
260610e230b6Smaya
260796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
260896c5ddc4SrjsGFX8_3DSTATE_CONSTANT_PS_pack(__attribute__((unused)) __gen_user_data *data,
260910e230b6Smaya                              __attribute__((unused)) void * restrict dst,
261096c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_3DSTATE_CONSTANT_PS * restrict values)
261110e230b6Smaya{
261210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
261310e230b6Smaya
261410e230b6Smaya   dw[0] =
261510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
261610e230b6Smaya      __gen_uint(values->MOCS, 8, 14) |
261710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
261810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
261910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
262010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
262110e230b6Smaya
262296c5ddc4Srjs   GFX8_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
262310e230b6Smaya}
262410e230b6Smaya
262596c5ddc4Srjs#define GFX8_3DSTATE_CONSTANT_VS_length       11
262696c5ddc4Srjs#define GFX8_3DSTATE_CONSTANT_VS_length_bias      2
262796c5ddc4Srjs#define GFX8_3DSTATE_CONSTANT_VS_header         \
262810e230b6Smaya   .DWordLength                         =      9,  \
262910e230b6Smaya   ._3DCommandSubOpcode                 =     21,  \
263010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
263110e230b6Smaya   .CommandSubType                      =      3,  \
263210e230b6Smaya   .CommandType                         =      3
263310e230b6Smaya
263496c5ddc4Srjsstruct GFX8_3DSTATE_CONSTANT_VS {
263510e230b6Smaya   uint32_t                             DWordLength;
263610e230b6Smaya   uint32_t                             MOCS;
263710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
263810e230b6Smaya   uint32_t                             _3DCommandOpcode;
263910e230b6Smaya   uint32_t                             CommandSubType;
264010e230b6Smaya   uint32_t                             CommandType;
264196c5ddc4Srjs   struct GFX8_3DSTATE_CONSTANT_BODY    ConstantBody;
264210e230b6Smaya};
264310e230b6Smaya
264496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
264596c5ddc4SrjsGFX8_3DSTATE_CONSTANT_VS_pack(__attribute__((unused)) __gen_user_data *data,
264610e230b6Smaya                              __attribute__((unused)) void * restrict dst,
264796c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_3DSTATE_CONSTANT_VS * restrict values)
264810e230b6Smaya{
264910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
265010e230b6Smaya
265110e230b6Smaya   dw[0] =
265210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
265310e230b6Smaya      __gen_uint(values->MOCS, 8, 14) |
265410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
265510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
265610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
265710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
265810e230b6Smaya
265996c5ddc4Srjs   GFX8_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
266010e230b6Smaya}
266110e230b6Smaya
266296c5ddc4Srjs#define GFX8_3DSTATE_DEPTH_BUFFER_length       8
266396c5ddc4Srjs#define GFX8_3DSTATE_DEPTH_BUFFER_length_bias      2
266496c5ddc4Srjs#define GFX8_3DSTATE_DEPTH_BUFFER_header        \
266510e230b6Smaya   .DWordLength                         =      6,  \
266610e230b6Smaya   ._3DCommandSubOpcode                 =      5,  \
266710e230b6Smaya   ._3DCommandOpcode                    =      0,  \
266810e230b6Smaya   .CommandSubType                      =      3,  \
266910e230b6Smaya   .CommandType                         =      3
267010e230b6Smaya
267196c5ddc4Srjsstruct GFX8_3DSTATE_DEPTH_BUFFER {
267210e230b6Smaya   uint32_t                             DWordLength;
267310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
267410e230b6Smaya   uint32_t                             _3DCommandOpcode;
267510e230b6Smaya   uint32_t                             CommandSubType;
267610e230b6Smaya   uint32_t                             CommandType;
267710e230b6Smaya   uint32_t                             SurfacePitch;
267810e230b6Smaya   uint32_t                             SurfaceFormat;
267910e230b6Smaya#define D32_FLOAT                                1
268010e230b6Smaya#define D24_UNORM_X8_UINT                        3
268110e230b6Smaya#define D16_UNORM                                5
268210e230b6Smaya   bool                                 HierarchicalDepthBufferEnable;
268310e230b6Smaya   bool                                 StencilWriteEnable;
268410e230b6Smaya   bool                                 DepthWriteEnable;
268510e230b6Smaya   uint32_t                             SurfaceType;
268610e230b6Smaya#define SURFTYPE_1D                              0
268710e230b6Smaya#define SURFTYPE_2D                              1
268810e230b6Smaya#define SURFTYPE_3D                              2
268910e230b6Smaya#define SURFTYPE_CUBE                            3
269010e230b6Smaya#define SURFTYPE_NULL                            7
269110e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
269210e230b6Smaya   uint32_t                             LOD;
269310e230b6Smaya   uint32_t                             Width;
269410e230b6Smaya   uint32_t                             Height;
269510e230b6Smaya   uint32_t                             MOCS;
269610e230b6Smaya   uint32_t                             MinimumArrayElement;
269710e230b6Smaya   uint32_t                             Depth;
269810e230b6Smaya   uint32_t                             SurfaceQPitch;
269910e230b6Smaya   uint32_t                             RenderTargetViewExtent;
270010e230b6Smaya};
270110e230b6Smaya
270296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
270396c5ddc4SrjsGFX8_3DSTATE_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
270410e230b6Smaya                               __attribute__((unused)) void * restrict dst,
270596c5ddc4Srjs                               __attribute__((unused)) const struct GFX8_3DSTATE_DEPTH_BUFFER * restrict values)
270610e230b6Smaya{
270710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
270810e230b6Smaya
270910e230b6Smaya   dw[0] =
271010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
271110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
271210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
271310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
271410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
271510e230b6Smaya
271610e230b6Smaya   dw[1] =
271710e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 17) |
271810e230b6Smaya      __gen_uint(values->SurfaceFormat, 18, 20) |
271910e230b6Smaya      __gen_uint(values->HierarchicalDepthBufferEnable, 22, 22) |
272010e230b6Smaya      __gen_uint(values->StencilWriteEnable, 27, 27) |
272110e230b6Smaya      __gen_uint(values->DepthWriteEnable, 28, 28) |
272210e230b6Smaya      __gen_uint(values->SurfaceType, 29, 31);
272310e230b6Smaya
272410e230b6Smaya   const uint64_t v2_address =
272596c5ddc4Srjs      __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 0, 63);
272610e230b6Smaya   dw[2] = v2_address;
272710e230b6Smaya   dw[3] = v2_address >> 32;
272810e230b6Smaya
272910e230b6Smaya   dw[4] =
273010e230b6Smaya      __gen_uint(values->LOD, 0, 3) |
273110e230b6Smaya      __gen_uint(values->Width, 4, 17) |
273210e230b6Smaya      __gen_uint(values->Height, 18, 31);
273310e230b6Smaya
273410e230b6Smaya   dw[5] =
273510e230b6Smaya      __gen_uint(values->MOCS, 0, 6) |
273610e230b6Smaya      __gen_uint(values->MinimumArrayElement, 10, 20) |
273710e230b6Smaya      __gen_uint(values->Depth, 21, 31);
273810e230b6Smaya
273910e230b6Smaya   dw[6] = 0;
274010e230b6Smaya
274110e230b6Smaya   dw[7] =
274210e230b6Smaya      __gen_uint(values->SurfaceQPitch, 0, 14) |
274310e230b6Smaya      __gen_uint(values->RenderTargetViewExtent, 21, 31);
274410e230b6Smaya}
274510e230b6Smaya
274696c5ddc4Srjs#define GFX8_3DSTATE_DRAWING_RECTANGLE_length      4
274796c5ddc4Srjs#define GFX8_3DSTATE_DRAWING_RECTANGLE_length_bias      2
274896c5ddc4Srjs#define GFX8_3DSTATE_DRAWING_RECTANGLE_header   \
274910e230b6Smaya   .DWordLength                         =      2,  \
275010e230b6Smaya   ._3DCommandSubOpcode                 =      0,  \
275110e230b6Smaya   ._3DCommandOpcode                    =      1,  \
275210e230b6Smaya   .CommandSubType                      =      3,  \
275310e230b6Smaya   .CommandType                         =      3
275410e230b6Smaya
275596c5ddc4Srjsstruct GFX8_3DSTATE_DRAWING_RECTANGLE {
275610e230b6Smaya   uint32_t                             DWordLength;
275710e230b6Smaya   uint32_t                             CoreModeSelect;
275810e230b6Smaya#define Legacy                                   0
275910e230b6Smaya#define Core0Enabled                             1
276010e230b6Smaya#define Core1Enabled                             2
276110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
276210e230b6Smaya   uint32_t                             _3DCommandOpcode;
276310e230b6Smaya   uint32_t                             CommandSubType;
276410e230b6Smaya   uint32_t                             CommandType;
276510e230b6Smaya   uint32_t                             ClippedDrawingRectangleXMin;
276610e230b6Smaya   uint32_t                             ClippedDrawingRectangleYMin;
276710e230b6Smaya   uint32_t                             ClippedDrawingRectangleXMax;
276810e230b6Smaya   uint32_t                             ClippedDrawingRectangleYMax;
276910e230b6Smaya   int32_t                              DrawingRectangleOriginX;
277010e230b6Smaya   int32_t                              DrawingRectangleOriginY;
277110e230b6Smaya};
277210e230b6Smaya
277396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
277496c5ddc4SrjsGFX8_3DSTATE_DRAWING_RECTANGLE_pack(__attribute__((unused)) __gen_user_data *data,
277510e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
277696c5ddc4Srjs                                    __attribute__((unused)) const struct GFX8_3DSTATE_DRAWING_RECTANGLE * restrict values)
277710e230b6Smaya{
277810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
277910e230b6Smaya
278010e230b6Smaya   dw[0] =
278110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
278210e230b6Smaya      __gen_uint(values->CoreModeSelect, 14, 15) |
278310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
278410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
278510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
278610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
278710e230b6Smaya
278810e230b6Smaya   dw[1] =
278910e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleXMin, 0, 15) |
279010e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleYMin, 16, 31);
279110e230b6Smaya
279210e230b6Smaya   dw[2] =
279310e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleXMax, 0, 15) |
279410e230b6Smaya      __gen_uint(values->ClippedDrawingRectangleYMax, 16, 31);
279510e230b6Smaya
279610e230b6Smaya   dw[3] =
279710e230b6Smaya      __gen_sint(values->DrawingRectangleOriginX, 0, 15) |
279810e230b6Smaya      __gen_sint(values->DrawingRectangleOriginY, 16, 31);
279910e230b6Smaya}
280010e230b6Smaya
280196c5ddc4Srjs#define GFX8_3DSTATE_DS_length                 9
280296c5ddc4Srjs#define GFX8_3DSTATE_DS_length_bias            2
280396c5ddc4Srjs#define GFX8_3DSTATE_DS_header                  \
280410e230b6Smaya   .DWordLength                         =      7,  \
280510e230b6Smaya   ._3DCommandSubOpcode                 =     29,  \
280610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
280710e230b6Smaya   .CommandSubType                      =      3,  \
280810e230b6Smaya   .CommandType                         =      3
280910e230b6Smaya
281096c5ddc4Srjsstruct GFX8_3DSTATE_DS {
281110e230b6Smaya   uint32_t                             DWordLength;
281210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
281310e230b6Smaya   uint32_t                             _3DCommandOpcode;
281410e230b6Smaya   uint32_t                             CommandSubType;
281510e230b6Smaya   uint32_t                             CommandType;
281610e230b6Smaya   uint64_t                             KernelStartPointer;
281710e230b6Smaya   bool                                 SoftwareExceptionEnable;
281810e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
281910e230b6Smaya   bool                                 AccessesUAV;
282010e230b6Smaya   uint32_t                             FloatingPointMode;
282110e230b6Smaya#define IEEE754                                  0
282210e230b6Smaya#define Alternate                                1
282310e230b6Smaya   uint32_t                             ThreadDispatchPriority;
282410e230b6Smaya#define High                                     1
282510e230b6Smaya   uint32_t                             BindingTableEntryCount;
282610e230b6Smaya   uint32_t                             SamplerCount;
282710e230b6Smaya#define NoSamplers                               0
282810e230b6Smaya#define _14Samplers                              1
282910e230b6Smaya#define _58Samplers                              2
283010e230b6Smaya#define _912Samplers                             3
283110e230b6Smaya#define _1316Samplers                            4
283210e230b6Smaya   bool                                 VectorMaskEnable;
283310e230b6Smaya   uint32_t                             SingleDomainPointDispatch;
283410e230b6Smaya   uint32_t                             PerThreadScratchSpace;
283510e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
283610e230b6Smaya   uint32_t                             PatchURBEntryReadOffset;
283710e230b6Smaya   uint32_t                             PatchURBEntryReadLength;
283810e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData;
283910e230b6Smaya   bool                                 Enable;
284010e230b6Smaya   bool                                 CacheDisable;
284110e230b6Smaya   bool                                 ComputeWCoordinateEnable;
284210e230b6Smaya   uint32_t                             DispatchMode;
284310e230b6Smaya#define DISPATCH_MODE_SIMD4X2                    0
284410e230b6Smaya#define DISPATCH_MODE_SIMD8_SINGLE_PATCH         1
284510e230b6Smaya   bool                                 StatisticsEnable;
284610e230b6Smaya   uint32_t                             MaximumNumberofThreads;
284710e230b6Smaya   uint32_t                             UserClipDistanceCullTestEnableBitmask;
284810e230b6Smaya   uint32_t                             UserClipDistanceClipTestEnableBitmask;
284910e230b6Smaya   uint32_t                             VertexURBEntryOutputLength;
285010e230b6Smaya   uint32_t                             VertexURBEntryOutputReadOffset;
285110e230b6Smaya};
285210e230b6Smaya
285396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
285496c5ddc4SrjsGFX8_3DSTATE_DS_pack(__attribute__((unused)) __gen_user_data *data,
285510e230b6Smaya                     __attribute__((unused)) void * restrict dst,
285696c5ddc4Srjs                     __attribute__((unused)) const struct GFX8_3DSTATE_DS * restrict values)
285710e230b6Smaya{
285810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
285910e230b6Smaya
286010e230b6Smaya   dw[0] =
286110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
286210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
286310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
286410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
286510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
286610e230b6Smaya
286710e230b6Smaya   const uint64_t v1 =
286810e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 63);
286910e230b6Smaya   dw[1] = v1;
287010e230b6Smaya   dw[2] = v1 >> 32;
287110e230b6Smaya
287210e230b6Smaya   dw[3] =
287310e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
287410e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
287510e230b6Smaya      __gen_uint(values->AccessesUAV, 14, 14) |
287610e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
287710e230b6Smaya      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
287810e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
287910e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
288010e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
288110e230b6Smaya      __gen_uint(values->SingleDomainPointDispatch, 31, 31);
288210e230b6Smaya
288310e230b6Smaya   const uint64_t v4 =
288410e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
288510e230b6Smaya   const uint64_t v4_address =
288696c5ddc4Srjs      __gen_address(data, &dw[4], values->ScratchSpaceBasePointer, v4, 10, 63);
288710e230b6Smaya   dw[4] = v4_address;
288810e230b6Smaya   dw[5] = (v4_address >> 32) | (v4 >> 32);
288910e230b6Smaya
289010e230b6Smaya   dw[6] =
289110e230b6Smaya      __gen_uint(values->PatchURBEntryReadOffset, 4, 9) |
289210e230b6Smaya      __gen_uint(values->PatchURBEntryReadLength, 11, 17) |
289310e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
289410e230b6Smaya
289510e230b6Smaya   dw[7] =
289610e230b6Smaya      __gen_uint(values->Enable, 0, 0) |
289710e230b6Smaya      __gen_uint(values->CacheDisable, 1, 1) |
289810e230b6Smaya      __gen_uint(values->ComputeWCoordinateEnable, 2, 2) |
289910e230b6Smaya      __gen_uint(values->DispatchMode, 3, 3) |
290010e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
290110e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 21, 29);
290210e230b6Smaya
290310e230b6Smaya   dw[8] =
290410e230b6Smaya      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
290510e230b6Smaya      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 8, 15) |
290610e230b6Smaya      __gen_uint(values->VertexURBEntryOutputLength, 16, 20) |
290710e230b6Smaya      __gen_uint(values->VertexURBEntryOutputReadOffset, 21, 26);
290810e230b6Smaya}
290910e230b6Smaya
291096c5ddc4Srjs#define GFX8_3DSTATE_GATHER_CONSTANT_DS_length_bias      2
291196c5ddc4Srjs#define GFX8_3DSTATE_GATHER_CONSTANT_DS_header  \
291210e230b6Smaya   .DWordLength                         =      1,  \
291310e230b6Smaya   ._3DCommandSubOpcode                 =     55,  \
291410e230b6Smaya   ._3DCommandOpcode                    =      0,  \
291510e230b6Smaya   .CommandSubType                      =      3,  \
291610e230b6Smaya   .CommandType                         =      3
291710e230b6Smaya
291896c5ddc4Srjsstruct GFX8_3DSTATE_GATHER_CONSTANT_DS {
291910e230b6Smaya   uint32_t                             DWordLength;
292010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
292110e230b6Smaya   uint32_t                             _3DCommandOpcode;
292210e230b6Smaya   uint32_t                             CommandSubType;
292310e230b6Smaya   uint32_t                             CommandType;
292410e230b6Smaya   uint32_t                             ConstantBufferBindingTableBlock;
292510e230b6Smaya   uint32_t                             ConstantBufferValid;
292610e230b6Smaya   bool                                 ConstantBufferDx9GenerateStall;
292710e230b6Smaya   uint64_t                             GatherBufferOffset;
292810e230b6Smaya   /* variable length fields follow */
292910e230b6Smaya};
293010e230b6Smaya
293196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
293296c5ddc4SrjsGFX8_3DSTATE_GATHER_CONSTANT_DS_pack(__attribute__((unused)) __gen_user_data *data,
293310e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
293496c5ddc4Srjs                                     __attribute__((unused)) const struct GFX8_3DSTATE_GATHER_CONSTANT_DS * restrict values)
293510e230b6Smaya{
293610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
293710e230b6Smaya
293810e230b6Smaya   dw[0] =
293910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
294010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
294110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
294210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
294310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
294410e230b6Smaya
294510e230b6Smaya   dw[1] =
294610e230b6Smaya      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
294710e230b6Smaya      __gen_uint(values->ConstantBufferValid, 16, 31);
294810e230b6Smaya
294910e230b6Smaya   dw[2] =
295010e230b6Smaya      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
295110e230b6Smaya      __gen_offset(values->GatherBufferOffset, 6, 22);
295210e230b6Smaya}
295310e230b6Smaya
295496c5ddc4Srjs#define GFX8_3DSTATE_GATHER_CONSTANT_GS_length_bias      2
295596c5ddc4Srjs#define GFX8_3DSTATE_GATHER_CONSTANT_GS_header  \
295610e230b6Smaya   .DWordLength                         =      1,  \
295710e230b6Smaya   ._3DCommandSubOpcode                 =     53,  \
295810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
295910e230b6Smaya   .CommandSubType                      =      3,  \
296010e230b6Smaya   .CommandType                         =      3
296110e230b6Smaya
296296c5ddc4Srjsstruct GFX8_3DSTATE_GATHER_CONSTANT_GS {
296310e230b6Smaya   uint32_t                             DWordLength;
296410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
296510e230b6Smaya   uint32_t                             _3DCommandOpcode;
296610e230b6Smaya   uint32_t                             CommandSubType;
296710e230b6Smaya   uint32_t                             CommandType;
296810e230b6Smaya   uint32_t                             ConstantBufferBindingTableBlock;
296910e230b6Smaya   uint32_t                             ConstantBufferValid;
297010e230b6Smaya   bool                                 ConstantBufferDx9GenerateStall;
297110e230b6Smaya   uint64_t                             GatherBufferOffset;
297210e230b6Smaya   /* variable length fields follow */
297310e230b6Smaya};
297410e230b6Smaya
297596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
297696c5ddc4SrjsGFX8_3DSTATE_GATHER_CONSTANT_GS_pack(__attribute__((unused)) __gen_user_data *data,
297710e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
297896c5ddc4Srjs                                     __attribute__((unused)) const struct GFX8_3DSTATE_GATHER_CONSTANT_GS * restrict values)
297910e230b6Smaya{
298010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
298110e230b6Smaya
298210e230b6Smaya   dw[0] =
298310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
298410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
298510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
298610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
298710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
298810e230b6Smaya
298910e230b6Smaya   dw[1] =
299010e230b6Smaya      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
299110e230b6Smaya      __gen_uint(values->ConstantBufferValid, 16, 31);
299210e230b6Smaya
299310e230b6Smaya   dw[2] =
299410e230b6Smaya      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
299510e230b6Smaya      __gen_offset(values->GatherBufferOffset, 6, 22);
299610e230b6Smaya}
299710e230b6Smaya
299896c5ddc4Srjs#define GFX8_3DSTATE_GATHER_CONSTANT_HS_length_bias      2
299996c5ddc4Srjs#define GFX8_3DSTATE_GATHER_CONSTANT_HS_header  \
300010e230b6Smaya   .DWordLength                         =      1,  \
300110e230b6Smaya   ._3DCommandSubOpcode                 =     54,  \
300210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
300310e230b6Smaya   .CommandSubType                      =      3,  \
300410e230b6Smaya   .CommandType                         =      3
300510e230b6Smaya
300696c5ddc4Srjsstruct GFX8_3DSTATE_GATHER_CONSTANT_HS {
300710e230b6Smaya   uint32_t                             DWordLength;
300810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
300910e230b6Smaya   uint32_t                             _3DCommandOpcode;
301010e230b6Smaya   uint32_t                             CommandSubType;
301110e230b6Smaya   uint32_t                             CommandType;
301210e230b6Smaya   uint32_t                             ConstantBufferBindingTableBlock;
301310e230b6Smaya   uint32_t                             ConstantBufferValid;
301410e230b6Smaya   bool                                 ConstantBufferDx9GenerateStall;
301510e230b6Smaya   uint64_t                             GatherBufferOffset;
301610e230b6Smaya   /* variable length fields follow */
301710e230b6Smaya};
301810e230b6Smaya
301996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
302096c5ddc4SrjsGFX8_3DSTATE_GATHER_CONSTANT_HS_pack(__attribute__((unused)) __gen_user_data *data,
302110e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
302296c5ddc4Srjs                                     __attribute__((unused)) const struct GFX8_3DSTATE_GATHER_CONSTANT_HS * restrict values)
302310e230b6Smaya{
302410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
302510e230b6Smaya
302610e230b6Smaya   dw[0] =
302710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
302810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
302910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
303010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
303110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
303210e230b6Smaya
303310e230b6Smaya   dw[1] =
303410e230b6Smaya      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
303510e230b6Smaya      __gen_uint(values->ConstantBufferValid, 16, 31);
303610e230b6Smaya
303710e230b6Smaya   dw[2] =
303810e230b6Smaya      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
303910e230b6Smaya      __gen_offset(values->GatherBufferOffset, 6, 22);
304010e230b6Smaya}
304110e230b6Smaya
304296c5ddc4Srjs#define GFX8_3DSTATE_GATHER_CONSTANT_PS_length_bias      2
304396c5ddc4Srjs#define GFX8_3DSTATE_GATHER_CONSTANT_PS_header  \
304410e230b6Smaya   .DWordLength                         =      1,  \
304510e230b6Smaya   ._3DCommandSubOpcode                 =     56,  \
304610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
304710e230b6Smaya   .CommandSubType                      =      3,  \
304810e230b6Smaya   .CommandType                         =      3
304910e230b6Smaya
305096c5ddc4Srjsstruct GFX8_3DSTATE_GATHER_CONSTANT_PS {
305110e230b6Smaya   uint32_t                             DWordLength;
305210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
305310e230b6Smaya   uint32_t                             _3DCommandOpcode;
305410e230b6Smaya   uint32_t                             CommandSubType;
305510e230b6Smaya   uint32_t                             CommandType;
305610e230b6Smaya   uint32_t                             ConstantBufferBindingTableBlock;
305710e230b6Smaya   uint32_t                             ConstantBufferValid;
305810e230b6Smaya   bool                                 ConstantBufferDx9Enable;
305910e230b6Smaya   bool                                 ConstantBufferDx9GenerateStall;
306010e230b6Smaya   uint64_t                             GatherBufferOffset;
306110e230b6Smaya   /* variable length fields follow */
306210e230b6Smaya};
306310e230b6Smaya
306496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
306596c5ddc4SrjsGFX8_3DSTATE_GATHER_CONSTANT_PS_pack(__attribute__((unused)) __gen_user_data *data,
306610e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
306796c5ddc4Srjs                                     __attribute__((unused)) const struct GFX8_3DSTATE_GATHER_CONSTANT_PS * restrict values)
306810e230b6Smaya{
306910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
307010e230b6Smaya
307110e230b6Smaya   dw[0] =
307210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
307310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
307410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
307510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
307610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
307710e230b6Smaya
307810e230b6Smaya   dw[1] =
307910e230b6Smaya      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
308010e230b6Smaya      __gen_uint(values->ConstantBufferValid, 16, 31);
308110e230b6Smaya
308210e230b6Smaya   dw[2] =
308310e230b6Smaya      __gen_uint(values->ConstantBufferDx9Enable, 4, 4) |
308410e230b6Smaya      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
308510e230b6Smaya      __gen_offset(values->GatherBufferOffset, 6, 22);
308610e230b6Smaya}
308710e230b6Smaya
308896c5ddc4Srjs#define GFX8_3DSTATE_GATHER_CONSTANT_VS_length_bias      2
308996c5ddc4Srjs#define GFX8_3DSTATE_GATHER_CONSTANT_VS_header  \
309010e230b6Smaya   .DWordLength                         =      0,  \
309110e230b6Smaya   ._3DCommandSubOpcode                 =     52,  \
309210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
309310e230b6Smaya   .CommandSubType                      =      3,  \
309410e230b6Smaya   .CommandType                         =      3
309510e230b6Smaya
309696c5ddc4Srjsstruct GFX8_3DSTATE_GATHER_CONSTANT_VS {
309710e230b6Smaya   uint32_t                             DWordLength;
309810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
309910e230b6Smaya   uint32_t                             _3DCommandOpcode;
310010e230b6Smaya   uint32_t                             CommandSubType;
310110e230b6Smaya   uint32_t                             CommandType;
310210e230b6Smaya   uint32_t                             ConstantBufferBindingTableBlock;
310310e230b6Smaya   uint32_t                             ConstantBufferValid;
310410e230b6Smaya   bool                                 ConstantBufferDx9Enable;
310510e230b6Smaya   bool                                 ConstantBufferDx9GenerateStall;
310610e230b6Smaya   uint64_t                             GatherBufferOffset;
310710e230b6Smaya   /* variable length fields follow */
310810e230b6Smaya};
310910e230b6Smaya
311096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
311196c5ddc4SrjsGFX8_3DSTATE_GATHER_CONSTANT_VS_pack(__attribute__((unused)) __gen_user_data *data,
311210e230b6Smaya                                     __attribute__((unused)) void * restrict dst,
311396c5ddc4Srjs                                     __attribute__((unused)) const struct GFX8_3DSTATE_GATHER_CONSTANT_VS * restrict values)
311410e230b6Smaya{
311510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
311610e230b6Smaya
311710e230b6Smaya   dw[0] =
311810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
311910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
312010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
312110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
312210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
312310e230b6Smaya
312410e230b6Smaya   dw[1] =
312510e230b6Smaya      __gen_uint(values->ConstantBufferBindingTableBlock, 12, 15) |
312610e230b6Smaya      __gen_uint(values->ConstantBufferValid, 16, 31);
312710e230b6Smaya
312810e230b6Smaya   dw[2] =
312910e230b6Smaya      __gen_uint(values->ConstantBufferDx9Enable, 4, 4) |
313010e230b6Smaya      __gen_uint(values->ConstantBufferDx9GenerateStall, 5, 5) |
313110e230b6Smaya      __gen_offset(values->GatherBufferOffset, 6, 22);
313210e230b6Smaya}
313310e230b6Smaya
313496c5ddc4Srjs#define GFX8_3DSTATE_GATHER_POOL_ALLOC_length      4
313596c5ddc4Srjs#define GFX8_3DSTATE_GATHER_POOL_ALLOC_length_bias      2
313696c5ddc4Srjs#define GFX8_3DSTATE_GATHER_POOL_ALLOC_header   \
313710e230b6Smaya   .DWordLength                         =      2,  \
313810e230b6Smaya   ._3DCommandSubOpcode                 =     26,  \
313910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
314010e230b6Smaya   .CommandSubType                      =      3,  \
314110e230b6Smaya   .CommandType                         =      3
314210e230b6Smaya
314396c5ddc4Srjsstruct GFX8_3DSTATE_GATHER_POOL_ALLOC {
314410e230b6Smaya   uint32_t                             DWordLength;
314510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
314610e230b6Smaya   uint32_t                             _3DCommandOpcode;
314710e230b6Smaya   uint32_t                             CommandSubType;
314810e230b6Smaya   uint32_t                             CommandType;
314910e230b6Smaya   uint32_t                             MOCS;
315010e230b6Smaya   bool                                 GatherPoolEnable;
315110e230b6Smaya   __gen_address_type                   GatherPoolBaseAddress;
315210e230b6Smaya   uint32_t                             GatherPoolBufferSize;
315310e230b6Smaya};
315410e230b6Smaya
315596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
315696c5ddc4SrjsGFX8_3DSTATE_GATHER_POOL_ALLOC_pack(__attribute__((unused)) __gen_user_data *data,
315710e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
315896c5ddc4Srjs                                    __attribute__((unused)) const struct GFX8_3DSTATE_GATHER_POOL_ALLOC * restrict values)
315910e230b6Smaya{
316010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
316110e230b6Smaya
316210e230b6Smaya   dw[0] =
316310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
316410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
316510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
316610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
316710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
316810e230b6Smaya
316910e230b6Smaya   const uint64_t v1 =
317010e230b6Smaya      __gen_uint(values->MOCS, 0, 6) |
317110e230b6Smaya      __gen_uint(values->GatherPoolEnable, 11, 11);
317210e230b6Smaya   const uint64_t v1_address =
317396c5ddc4Srjs      __gen_address(data, &dw[1], values->GatherPoolBaseAddress, v1, 12, 63);
317410e230b6Smaya   dw[1] = v1_address;
317510e230b6Smaya   dw[2] = (v1_address >> 32) | (v1 >> 32);
317610e230b6Smaya
317710e230b6Smaya   dw[3] =
317810e230b6Smaya      __gen_uint(values->GatherPoolBufferSize, 12, 31);
317910e230b6Smaya}
318010e230b6Smaya
318196c5ddc4Srjs#define GFX8_3DSTATE_GS_length                10
318296c5ddc4Srjs#define GFX8_3DSTATE_GS_length_bias            2
318396c5ddc4Srjs#define GFX8_3DSTATE_GS_header                  \
318410e230b6Smaya   .DWordLength                         =      8,  \
318510e230b6Smaya   ._3DCommandSubOpcode                 =     17,  \
318610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
318710e230b6Smaya   .CommandSubType                      =      3,  \
318810e230b6Smaya   .CommandType                         =      3
318910e230b6Smaya
319096c5ddc4Srjsstruct GFX8_3DSTATE_GS {
319110e230b6Smaya   uint32_t                             DWordLength;
319210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
319310e230b6Smaya   uint32_t                             _3DCommandOpcode;
319410e230b6Smaya   uint32_t                             CommandSubType;
319510e230b6Smaya   uint32_t                             CommandType;
319610e230b6Smaya   uint64_t                             KernelStartPointer;
319710e230b6Smaya   uint32_t                             ExpectedVertexCount;
319810e230b6Smaya   bool                                 SoftwareExceptionEnable;
319910e230b6Smaya   bool                                 MaskStackExceptionEnable;
320010e230b6Smaya   bool                                 AccessesUAV;
320110e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
320210e230b6Smaya   uint32_t                             FloatingPointMode;
320310e230b6Smaya#define IEEE754                                  0
320410e230b6Smaya#define Alternate                                1
320510e230b6Smaya   uint32_t                             ThreadDispatchPriority;
320610e230b6Smaya#define High                                     1
320710e230b6Smaya   uint32_t                             BindingTableEntryCount;
320810e230b6Smaya   uint32_t                             SamplerCount;
320910e230b6Smaya#define NoSamplers                               0
321010e230b6Smaya#define _14Samplers                              1
321110e230b6Smaya#define _58Samplers                              2
321210e230b6Smaya#define _912Samplers                             3
321310e230b6Smaya#define _1316Samplers                            4
321410e230b6Smaya   bool                                 VectorMaskEnable;
321510e230b6Smaya   bool                                 SingleProgramFlow;
321610e230b6Smaya   uint32_t                             PerThreadScratchSpace;
321710e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
321810e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData;
321910e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
322010e230b6Smaya   bool                                 IncludeVertexHandles;
322110e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
322296c5ddc4Srjs   enum GFX8_3D_Prim_Topo_Type          OutputTopology;
322310e230b6Smaya   uint32_t                             OutputVertexSize;
322410e230b6Smaya   bool                                 Enable;
322510e230b6Smaya   bool                                 DiscardAdjacency;
322610e230b6Smaya   uint32_t                             ReorderMode;
322710e230b6Smaya#define LEADING                                  0
322810e230b6Smaya#define TRAILING                                 1
322910e230b6Smaya   uint32_t                             Hint;
323010e230b6Smaya   bool                                 IncludePrimitiveID;
323110e230b6Smaya   uint32_t                             InvocationsIncrementValue;
323210e230b6Smaya   bool                                 StatisticsEnable;
323310e230b6Smaya   uint32_t                             DispatchMode;
323410e230b6Smaya#define DISPATCH_MODE_DualInstance               1
323510e230b6Smaya#define DISPATCH_MODE_DualObject                 2
323610e230b6Smaya#define DISPATCH_MODE_SIMD8                      3
323710e230b6Smaya   uint32_t                             DefaultStreamId;
323810e230b6Smaya   uint32_t                             InstanceControl;
323910e230b6Smaya   uint32_t                             ControlDataHeaderSize;
324010e230b6Smaya   uint32_t                             MaximumNumberofThreads;
324110e230b6Smaya   uint32_t                             StaticOutputVertexCount;
324210e230b6Smaya   bool                                 StaticOutput;
324310e230b6Smaya   uint32_t                             ControlDataFormat;
324410e230b6Smaya#define CUT                                      0
324510e230b6Smaya#define SID                                      1
324610e230b6Smaya   uint32_t                             UserClipDistanceCullTestEnableBitmask;
324710e230b6Smaya   uint32_t                             UserClipDistanceClipTestEnableBitmask;
324810e230b6Smaya   uint32_t                             VertexURBEntryOutputLength;
324910e230b6Smaya   uint32_t                             VertexURBEntryOutputReadOffset;
325010e230b6Smaya};
325110e230b6Smaya
325296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
325396c5ddc4SrjsGFX8_3DSTATE_GS_pack(__attribute__((unused)) __gen_user_data *data,
325410e230b6Smaya                     __attribute__((unused)) void * restrict dst,
325596c5ddc4Srjs                     __attribute__((unused)) const struct GFX8_3DSTATE_GS * restrict values)
325610e230b6Smaya{
325710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
325810e230b6Smaya
325910e230b6Smaya   dw[0] =
326010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
326110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
326210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
326310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
326410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
326510e230b6Smaya
326610e230b6Smaya   const uint64_t v1 =
326710e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 63);
326810e230b6Smaya   dw[1] = v1;
326910e230b6Smaya   dw[2] = v1 >> 32;
327010e230b6Smaya
327110e230b6Smaya   dw[3] =
327210e230b6Smaya      __gen_uint(values->ExpectedVertexCount, 0, 5) |
327310e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
327410e230b6Smaya      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
327510e230b6Smaya      __gen_uint(values->AccessesUAV, 12, 12) |
327610e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
327710e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
327810e230b6Smaya      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
327910e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
328010e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
328110e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
328210e230b6Smaya      __gen_uint(values->SingleProgramFlow, 31, 31);
328310e230b6Smaya
328410e230b6Smaya   const uint64_t v4 =
328510e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
328610e230b6Smaya   const uint64_t v4_address =
328796c5ddc4Srjs      __gen_address(data, &dw[4], values->ScratchSpaceBasePointer, v4, 10, 63);
328810e230b6Smaya   dw[4] = v4_address;
328910e230b6Smaya   dw[5] = (v4_address >> 32) | (v4 >> 32);
329010e230b6Smaya
329110e230b6Smaya   dw[6] =
329210e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData, 0, 3) |
329310e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
329410e230b6Smaya      __gen_uint(values->IncludeVertexHandles, 10, 10) |
329510e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
329610e230b6Smaya      __gen_uint(values->OutputTopology, 17, 22) |
329710e230b6Smaya      __gen_uint(values->OutputVertexSize, 23, 28);
329810e230b6Smaya
329910e230b6Smaya   dw[7] =
330010e230b6Smaya      __gen_uint(values->Enable, 0, 0) |
330110e230b6Smaya      __gen_uint(values->DiscardAdjacency, 1, 1) |
330210e230b6Smaya      __gen_uint(values->ReorderMode, 2, 2) |
330310e230b6Smaya      __gen_uint(values->Hint, 3, 3) |
330410e230b6Smaya      __gen_uint(values->IncludePrimitiveID, 4, 4) |
330510e230b6Smaya      __gen_uint(values->InvocationsIncrementValue, 5, 9) |
330610e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
330710e230b6Smaya      __gen_uint(values->DispatchMode, 11, 12) |
330810e230b6Smaya      __gen_uint(values->DefaultStreamId, 13, 14) |
330910e230b6Smaya      __gen_uint(values->InstanceControl, 15, 19) |
331010e230b6Smaya      __gen_uint(values->ControlDataHeaderSize, 20, 23) |
331110e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 24, 31);
331210e230b6Smaya
331310e230b6Smaya   dw[8] =
331410e230b6Smaya      __gen_uint(values->StaticOutputVertexCount, 16, 26) |
331510e230b6Smaya      __gen_uint(values->StaticOutput, 30, 30) |
331610e230b6Smaya      __gen_uint(values->ControlDataFormat, 31, 31);
331710e230b6Smaya
331810e230b6Smaya   dw[9] =
331910e230b6Smaya      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
332010e230b6Smaya      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 8, 15) |
332110e230b6Smaya      __gen_uint(values->VertexURBEntryOutputLength, 16, 20) |
332210e230b6Smaya      __gen_uint(values->VertexURBEntryOutputReadOffset, 21, 26);
332310e230b6Smaya}
332410e230b6Smaya
332596c5ddc4Srjs#define GFX8_3DSTATE_HIER_DEPTH_BUFFER_length      5
332696c5ddc4Srjs#define GFX8_3DSTATE_HIER_DEPTH_BUFFER_length_bias      2
332796c5ddc4Srjs#define GFX8_3DSTATE_HIER_DEPTH_BUFFER_header   \
332810e230b6Smaya   .DWordLength                         =      3,  \
332910e230b6Smaya   ._3DCommandSubOpcode                 =      7,  \
333010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
333110e230b6Smaya   .CommandSubType                      =      3,  \
333210e230b6Smaya   .CommandType                         =      3
333310e230b6Smaya
333496c5ddc4Srjsstruct GFX8_3DSTATE_HIER_DEPTH_BUFFER {
333510e230b6Smaya   uint32_t                             DWordLength;
333610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
333710e230b6Smaya   uint32_t                             _3DCommandOpcode;
333810e230b6Smaya   uint32_t                             CommandSubType;
333910e230b6Smaya   uint32_t                             CommandType;
334010e230b6Smaya   uint32_t                             SurfacePitch;
334110e230b6Smaya   uint32_t                             MOCS;
334210e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
334310e230b6Smaya   uint32_t                             SurfaceQPitch;
334410e230b6Smaya};
334510e230b6Smaya
334696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
334796c5ddc4SrjsGFX8_3DSTATE_HIER_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
334810e230b6Smaya                                    __attribute__((unused)) void * restrict dst,
334996c5ddc4Srjs                                    __attribute__((unused)) const struct GFX8_3DSTATE_HIER_DEPTH_BUFFER * restrict values)
335010e230b6Smaya{
335110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
335210e230b6Smaya
335310e230b6Smaya   dw[0] =
335410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
335510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
335610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
335710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
335810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
335910e230b6Smaya
336010e230b6Smaya   dw[1] =
336110e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 16) |
336210e230b6Smaya      __gen_uint(values->MOCS, 25, 31);
336310e230b6Smaya
336410e230b6Smaya   const uint64_t v2_address =
336596c5ddc4Srjs      __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 0, 63);
336610e230b6Smaya   dw[2] = v2_address;
336710e230b6Smaya   dw[3] = v2_address >> 32;
336810e230b6Smaya
336910e230b6Smaya   dw[4] =
337010e230b6Smaya      __gen_uint(values->SurfaceQPitch, 0, 14);
337110e230b6Smaya}
337210e230b6Smaya
337396c5ddc4Srjs#define GFX8_3DSTATE_HS_length                 9
337496c5ddc4Srjs#define GFX8_3DSTATE_HS_length_bias            2
337596c5ddc4Srjs#define GFX8_3DSTATE_HS_header                  \
337610e230b6Smaya   .DWordLength                         =      7,  \
337710e230b6Smaya   ._3DCommandSubOpcode                 =     27,  \
337810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
337910e230b6Smaya   .CommandSubType                      =      3,  \
338010e230b6Smaya   .CommandType                         =      3
338110e230b6Smaya
338296c5ddc4Srjsstruct GFX8_3DSTATE_HS {
338310e230b6Smaya   uint32_t                             DWordLength;
338410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
338510e230b6Smaya   uint32_t                             _3DCommandOpcode;
338610e230b6Smaya   uint32_t                             CommandSubType;
338710e230b6Smaya   uint32_t                             CommandType;
338810e230b6Smaya   bool                                 SoftwareExceptionEnable;
338910e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
339010e230b6Smaya   uint32_t                             FloatingPointMode;
339110e230b6Smaya#define IEEE754                                  0
339210e230b6Smaya#define alternate                                1
339310e230b6Smaya   uint32_t                             ThreadDispatchPriority;
339410e230b6Smaya#define High                                     1
339510e230b6Smaya   uint32_t                             BindingTableEntryCount;
339610e230b6Smaya   uint32_t                             SamplerCount;
339710e230b6Smaya#define NoSamplers                               0
339810e230b6Smaya#define _14Samplers                              1
339910e230b6Smaya#define _58Samplers                              2
340010e230b6Smaya#define _912Samplers                             3
340110e230b6Smaya#define _1316Samplers                            4
340210e230b6Smaya   uint32_t                             InstanceCount;
340310e230b6Smaya   uint32_t                             MaximumNumberofThreads;
340410e230b6Smaya   bool                                 StatisticsEnable;
340510e230b6Smaya   bool                                 Enable;
340610e230b6Smaya   uint64_t                             KernelStartPointer;
340710e230b6Smaya   uint32_t                             PerThreadScratchSpace;
340810e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
340910e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
341010e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
341110e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData;
341210e230b6Smaya   bool                                 IncludeVertexHandles;
341310e230b6Smaya   bool                                 AccessesUAV;
341410e230b6Smaya   bool                                 VectorMaskEnable;
341510e230b6Smaya   bool                                 SingleProgramFlow;
341610e230b6Smaya};
341710e230b6Smaya
341896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
341996c5ddc4SrjsGFX8_3DSTATE_HS_pack(__attribute__((unused)) __gen_user_data *data,
342010e230b6Smaya                     __attribute__((unused)) void * restrict dst,
342196c5ddc4Srjs                     __attribute__((unused)) const struct GFX8_3DSTATE_HS * restrict values)
342210e230b6Smaya{
342310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
342410e230b6Smaya
342510e230b6Smaya   dw[0] =
342610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
342710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
342810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
342910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
343010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
343110e230b6Smaya
343210e230b6Smaya   dw[1] =
343310e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 12, 12) |
343410e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
343510e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
343610e230b6Smaya      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
343710e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
343810e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29);
343910e230b6Smaya
344010e230b6Smaya   dw[2] =
344110e230b6Smaya      __gen_uint(values->InstanceCount, 0, 3) |
344210e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 8, 16) |
344310e230b6Smaya      __gen_uint(values->StatisticsEnable, 29, 29) |
344410e230b6Smaya      __gen_uint(values->Enable, 31, 31);
344510e230b6Smaya
344610e230b6Smaya   const uint64_t v3 =
344710e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 63);
344810e230b6Smaya   dw[3] = v3;
344910e230b6Smaya   dw[4] = v3 >> 32;
345010e230b6Smaya
345110e230b6Smaya   const uint64_t v5 =
345210e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
345310e230b6Smaya   const uint64_t v5_address =
345496c5ddc4Srjs      __gen_address(data, &dw[5], values->ScratchSpaceBasePointer, v5, 10, 63);
345510e230b6Smaya   dw[5] = v5_address;
345610e230b6Smaya   dw[6] = (v5_address >> 32) | (v5 >> 32);
345710e230b6Smaya
345810e230b6Smaya   dw[7] =
345910e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
346010e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
346110e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData, 19, 23) |
346210e230b6Smaya      __gen_uint(values->IncludeVertexHandles, 24, 24) |
346310e230b6Smaya      __gen_uint(values->AccessesUAV, 25, 25) |
346410e230b6Smaya      __gen_uint(values->VectorMaskEnable, 26, 26) |
346510e230b6Smaya      __gen_uint(values->SingleProgramFlow, 27, 27);
346610e230b6Smaya
346710e230b6Smaya   dw[8] = 0;
346810e230b6Smaya}
346910e230b6Smaya
347096c5ddc4Srjs#define GFX8_3DSTATE_INDEX_BUFFER_length       5
347196c5ddc4Srjs#define GFX8_3DSTATE_INDEX_BUFFER_length_bias      2
347296c5ddc4Srjs#define GFX8_3DSTATE_INDEX_BUFFER_header        \
347310e230b6Smaya   .DWordLength                         =      3,  \
347410e230b6Smaya   ._3DCommandSubOpcode                 =     10,  \
347510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
347610e230b6Smaya   .CommandSubType                      =      3,  \
347710e230b6Smaya   .CommandType                         =      3
347810e230b6Smaya
347996c5ddc4Srjsstruct GFX8_3DSTATE_INDEX_BUFFER {
348010e230b6Smaya   uint32_t                             DWordLength;
348110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
348210e230b6Smaya   uint32_t                             _3DCommandOpcode;
348310e230b6Smaya   uint32_t                             CommandSubType;
348410e230b6Smaya   uint32_t                             CommandType;
348510e230b6Smaya   uint32_t                             MOCS;
348610e230b6Smaya   uint32_t                             IndexFormat;
348710e230b6Smaya#define INDEX_BYTE                               0
348810e230b6Smaya#define INDEX_WORD                               1
348910e230b6Smaya#define INDEX_DWORD                              2
349010e230b6Smaya   __gen_address_type                   BufferStartingAddress;
349110e230b6Smaya   uint32_t                             BufferSize;
349210e230b6Smaya};
349310e230b6Smaya
349496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
349596c5ddc4SrjsGFX8_3DSTATE_INDEX_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
349610e230b6Smaya                               __attribute__((unused)) void * restrict dst,
349796c5ddc4Srjs                               __attribute__((unused)) const struct GFX8_3DSTATE_INDEX_BUFFER * restrict values)
349810e230b6Smaya{
349910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
350010e230b6Smaya
350110e230b6Smaya   dw[0] =
350210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
350310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
350410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
350510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
350610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
350710e230b6Smaya
350810e230b6Smaya   dw[1] =
350910e230b6Smaya      __gen_uint(values->MOCS, 0, 6) |
351010e230b6Smaya      __gen_uint(values->IndexFormat, 8, 9);
351110e230b6Smaya
351210e230b6Smaya   const uint64_t v2_address =
351396c5ddc4Srjs      __gen_address(data, &dw[2], values->BufferStartingAddress, 0, 0, 63);
351410e230b6Smaya   dw[2] = v2_address;
351510e230b6Smaya   dw[3] = v2_address >> 32;
351610e230b6Smaya
351710e230b6Smaya   dw[4] =
351810e230b6Smaya      __gen_uint(values->BufferSize, 0, 31);
351910e230b6Smaya}
352010e230b6Smaya
352196c5ddc4Srjs#define GFX8_3DSTATE_LINE_STIPPLE_length       3
352296c5ddc4Srjs#define GFX8_3DSTATE_LINE_STIPPLE_length_bias      2
352396c5ddc4Srjs#define GFX8_3DSTATE_LINE_STIPPLE_header        \
352410e230b6Smaya   .DWordLength                         =      1,  \
352510e230b6Smaya   ._3DCommandSubOpcode                 =      8,  \
352610e230b6Smaya   ._3DCommandOpcode                    =      1,  \
352710e230b6Smaya   .CommandSubType                      =      3,  \
352810e230b6Smaya   .CommandType                         =      3
352910e230b6Smaya
353096c5ddc4Srjsstruct GFX8_3DSTATE_LINE_STIPPLE {
353110e230b6Smaya   uint32_t                             DWordLength;
353210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
353310e230b6Smaya   uint32_t                             _3DCommandOpcode;
353410e230b6Smaya   uint32_t                             CommandSubType;
353510e230b6Smaya   uint32_t                             CommandType;
353610e230b6Smaya   uint32_t                             LineStipplePattern;
353710e230b6Smaya   uint32_t                             CurrentStippleIndex;
353810e230b6Smaya   uint32_t                             CurrentRepeatCounter;
353910e230b6Smaya   bool                                 ModifyEnableCurrentRepeatCounterCurrentStippleIndex;
354010e230b6Smaya   uint32_t                             LineStippleRepeatCount;
354110e230b6Smaya   float                                LineStippleInverseRepeatCount;
354210e230b6Smaya};
354310e230b6Smaya
354496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
354596c5ddc4SrjsGFX8_3DSTATE_LINE_STIPPLE_pack(__attribute__((unused)) __gen_user_data *data,
354610e230b6Smaya                               __attribute__((unused)) void * restrict dst,
354796c5ddc4Srjs                               __attribute__((unused)) const struct GFX8_3DSTATE_LINE_STIPPLE * restrict values)
354810e230b6Smaya{
354910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
355010e230b6Smaya
355110e230b6Smaya   dw[0] =
355210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
355310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
355410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
355510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
355610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
355710e230b6Smaya
355810e230b6Smaya   dw[1] =
355910e230b6Smaya      __gen_uint(values->LineStipplePattern, 0, 15) |
356010e230b6Smaya      __gen_uint(values->CurrentStippleIndex, 16, 19) |
356110e230b6Smaya      __gen_uint(values->CurrentRepeatCounter, 21, 29) |
356210e230b6Smaya      __gen_uint(values->ModifyEnableCurrentRepeatCounterCurrentStippleIndex, 31, 31);
356310e230b6Smaya
356410e230b6Smaya   dw[2] =
356510e230b6Smaya      __gen_uint(values->LineStippleRepeatCount, 0, 8) |
356610e230b6Smaya      __gen_ufixed(values->LineStippleInverseRepeatCount, 15, 31, 16);
356710e230b6Smaya}
356810e230b6Smaya
356996c5ddc4Srjs#define GFX8_3DSTATE_MONOFILTER_SIZE_length      2
357096c5ddc4Srjs#define GFX8_3DSTATE_MONOFILTER_SIZE_length_bias      2
357196c5ddc4Srjs#define GFX8_3DSTATE_MONOFILTER_SIZE_header     \
357210e230b6Smaya   .DWordLength                         =      0,  \
357310e230b6Smaya   ._3DCommandSubOpcode                 =     17,  \
357410e230b6Smaya   ._3DCommandOpcode                    =      1,  \
357510e230b6Smaya   .CommandSubType                      =      3,  \
357610e230b6Smaya   .CommandType                         =      3
357710e230b6Smaya
357896c5ddc4Srjsstruct GFX8_3DSTATE_MONOFILTER_SIZE {
357910e230b6Smaya   uint32_t                             DWordLength;
358010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
358110e230b6Smaya   uint32_t                             _3DCommandOpcode;
358210e230b6Smaya   uint32_t                             CommandSubType;
358310e230b6Smaya   uint32_t                             CommandType;
358410e230b6Smaya   uint32_t                             MonochromeFilterHeight;
358510e230b6Smaya   uint32_t                             MonochromeFilterWidth;
358610e230b6Smaya};
358710e230b6Smaya
358896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
358996c5ddc4SrjsGFX8_3DSTATE_MONOFILTER_SIZE_pack(__attribute__((unused)) __gen_user_data *data,
359010e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
359196c5ddc4Srjs                                  __attribute__((unused)) const struct GFX8_3DSTATE_MONOFILTER_SIZE * restrict values)
359210e230b6Smaya{
359310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
359410e230b6Smaya
359510e230b6Smaya   dw[0] =
359610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
359710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
359810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
359910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
360010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
360110e230b6Smaya
360210e230b6Smaya   dw[1] =
360310e230b6Smaya      __gen_uint(values->MonochromeFilterHeight, 0, 2) |
360410e230b6Smaya      __gen_uint(values->MonochromeFilterWidth, 3, 5);
360510e230b6Smaya}
360610e230b6Smaya
360796c5ddc4Srjs#define GFX8_3DSTATE_MULTISAMPLE_length        2
360896c5ddc4Srjs#define GFX8_3DSTATE_MULTISAMPLE_length_bias      2
360996c5ddc4Srjs#define GFX8_3DSTATE_MULTISAMPLE_header         \
361010e230b6Smaya   .DWordLength                         =      0,  \
361110e230b6Smaya   ._3DCommandSubOpcode                 =     13,  \
361210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
361310e230b6Smaya   .CommandSubType                      =      3,  \
361410e230b6Smaya   .CommandType                         =      3
361510e230b6Smaya
361696c5ddc4Srjsstruct GFX8_3DSTATE_MULTISAMPLE {
361710e230b6Smaya   uint32_t                             DWordLength;
361810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
361910e230b6Smaya   uint32_t                             _3DCommandOpcode;
362010e230b6Smaya   uint32_t                             CommandSubType;
362110e230b6Smaya   uint32_t                             CommandType;
362210e230b6Smaya   uint32_t                             NumberofMultisamples;
362310e230b6Smaya   uint32_t                             PixelLocation;
362410e230b6Smaya#define CENTER                                   0
362510e230b6Smaya#define UL_CORNER                                1
362610e230b6Smaya   bool                                 PixelPositionOffsetEnable;
362710e230b6Smaya};
362810e230b6Smaya
362996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
363096c5ddc4SrjsGFX8_3DSTATE_MULTISAMPLE_pack(__attribute__((unused)) __gen_user_data *data,
363110e230b6Smaya                              __attribute__((unused)) void * restrict dst,
363296c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_3DSTATE_MULTISAMPLE * restrict values)
363310e230b6Smaya{
363410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
363510e230b6Smaya
363610e230b6Smaya   dw[0] =
363710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
363810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
363910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
364010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
364110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
364210e230b6Smaya
364310e230b6Smaya   dw[1] =
364410e230b6Smaya      __gen_uint(values->NumberofMultisamples, 1, 3) |
364510e230b6Smaya      __gen_uint(values->PixelLocation, 4, 4) |
364610e230b6Smaya      __gen_uint(values->PixelPositionOffsetEnable, 5, 5);
364710e230b6Smaya}
364810e230b6Smaya
364996c5ddc4Srjs#define GFX8_3DSTATE_POLY_STIPPLE_OFFSET_length      2
365096c5ddc4Srjs#define GFX8_3DSTATE_POLY_STIPPLE_OFFSET_length_bias      2
365196c5ddc4Srjs#define GFX8_3DSTATE_POLY_STIPPLE_OFFSET_header \
365210e230b6Smaya   .DWordLength                         =      0,  \
365310e230b6Smaya   ._3DCommandSubOpcode                 =      6,  \
365410e230b6Smaya   ._3DCommandOpcode                    =      1,  \
365510e230b6Smaya   .CommandSubType                      =      3,  \
365610e230b6Smaya   .CommandType                         =      3
365710e230b6Smaya
365896c5ddc4Srjsstruct GFX8_3DSTATE_POLY_STIPPLE_OFFSET {
365910e230b6Smaya   uint32_t                             DWordLength;
366010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
366110e230b6Smaya   uint32_t                             _3DCommandOpcode;
366210e230b6Smaya   uint32_t                             CommandSubType;
366310e230b6Smaya   uint32_t                             CommandType;
366410e230b6Smaya   uint32_t                             PolygonStippleYOffset;
366510e230b6Smaya   uint32_t                             PolygonStippleXOffset;
366610e230b6Smaya};
366710e230b6Smaya
366896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
366996c5ddc4SrjsGFX8_3DSTATE_POLY_STIPPLE_OFFSET_pack(__attribute__((unused)) __gen_user_data *data,
367010e230b6Smaya                                      __attribute__((unused)) void * restrict dst,
367196c5ddc4Srjs                                      __attribute__((unused)) const struct GFX8_3DSTATE_POLY_STIPPLE_OFFSET * restrict values)
367210e230b6Smaya{
367310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
367410e230b6Smaya
367510e230b6Smaya   dw[0] =
367610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
367710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
367810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
367910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
368010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
368110e230b6Smaya
368210e230b6Smaya   dw[1] =
368310e230b6Smaya      __gen_uint(values->PolygonStippleYOffset, 0, 4) |
368410e230b6Smaya      __gen_uint(values->PolygonStippleXOffset, 8, 12);
368510e230b6Smaya}
368610e230b6Smaya
368796c5ddc4Srjs#define GFX8_3DSTATE_POLY_STIPPLE_PATTERN_length     33
368896c5ddc4Srjs#define GFX8_3DSTATE_POLY_STIPPLE_PATTERN_length_bias      2
368996c5ddc4Srjs#define GFX8_3DSTATE_POLY_STIPPLE_PATTERN_header\
369010e230b6Smaya   .DWordLength                         =     31,  \
369110e230b6Smaya   ._3DCommandSubOpcode                 =      7,  \
369210e230b6Smaya   ._3DCommandOpcode                    =      1,  \
369310e230b6Smaya   .CommandSubType                      =      3,  \
369410e230b6Smaya   .CommandType                         =      3
369510e230b6Smaya
369696c5ddc4Srjsstruct GFX8_3DSTATE_POLY_STIPPLE_PATTERN {
369710e230b6Smaya   uint32_t                             DWordLength;
369810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
369910e230b6Smaya   uint32_t                             _3DCommandOpcode;
370010e230b6Smaya   uint32_t                             CommandSubType;
370110e230b6Smaya   uint32_t                             CommandType;
370210e230b6Smaya   uint32_t                             PatternRow[32];
370310e230b6Smaya};
370410e230b6Smaya
370596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
370696c5ddc4SrjsGFX8_3DSTATE_POLY_STIPPLE_PATTERN_pack(__attribute__((unused)) __gen_user_data *data,
370710e230b6Smaya                                       __attribute__((unused)) void * restrict dst,
370896c5ddc4Srjs                                       __attribute__((unused)) const struct GFX8_3DSTATE_POLY_STIPPLE_PATTERN * restrict values)
370910e230b6Smaya{
371010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
371110e230b6Smaya
371210e230b6Smaya   dw[0] =
371310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
371410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
371510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
371610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
371710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
371810e230b6Smaya
371910e230b6Smaya   dw[1] =
372010e230b6Smaya      __gen_uint(values->PatternRow[0], 0, 31);
372110e230b6Smaya
372210e230b6Smaya   dw[2] =
372310e230b6Smaya      __gen_uint(values->PatternRow[1], 0, 31);
372410e230b6Smaya
372510e230b6Smaya   dw[3] =
372610e230b6Smaya      __gen_uint(values->PatternRow[2], 0, 31);
372710e230b6Smaya
372810e230b6Smaya   dw[4] =
372910e230b6Smaya      __gen_uint(values->PatternRow[3], 0, 31);
373010e230b6Smaya
373110e230b6Smaya   dw[5] =
373210e230b6Smaya      __gen_uint(values->PatternRow[4], 0, 31);
373310e230b6Smaya
373410e230b6Smaya   dw[6] =
373510e230b6Smaya      __gen_uint(values->PatternRow[5], 0, 31);
373610e230b6Smaya
373710e230b6Smaya   dw[7] =
373810e230b6Smaya      __gen_uint(values->PatternRow[6], 0, 31);
373910e230b6Smaya
374010e230b6Smaya   dw[8] =
374110e230b6Smaya      __gen_uint(values->PatternRow[7], 0, 31);
374210e230b6Smaya
374310e230b6Smaya   dw[9] =
374410e230b6Smaya      __gen_uint(values->PatternRow[8], 0, 31);
374510e230b6Smaya
374610e230b6Smaya   dw[10] =
374710e230b6Smaya      __gen_uint(values->PatternRow[9], 0, 31);
374810e230b6Smaya
374910e230b6Smaya   dw[11] =
375010e230b6Smaya      __gen_uint(values->PatternRow[10], 0, 31);
375110e230b6Smaya
375210e230b6Smaya   dw[12] =
375310e230b6Smaya      __gen_uint(values->PatternRow[11], 0, 31);
375410e230b6Smaya
375510e230b6Smaya   dw[13] =
375610e230b6Smaya      __gen_uint(values->PatternRow[12], 0, 31);
375710e230b6Smaya
375810e230b6Smaya   dw[14] =
375910e230b6Smaya      __gen_uint(values->PatternRow[13], 0, 31);
376010e230b6Smaya
376110e230b6Smaya   dw[15] =
376210e230b6Smaya      __gen_uint(values->PatternRow[14], 0, 31);
376310e230b6Smaya
376410e230b6Smaya   dw[16] =
376510e230b6Smaya      __gen_uint(values->PatternRow[15], 0, 31);
376610e230b6Smaya
376710e230b6Smaya   dw[17] =
376810e230b6Smaya      __gen_uint(values->PatternRow[16], 0, 31);
376910e230b6Smaya
377010e230b6Smaya   dw[18] =
377110e230b6Smaya      __gen_uint(values->PatternRow[17], 0, 31);
377210e230b6Smaya
377310e230b6Smaya   dw[19] =
377410e230b6Smaya      __gen_uint(values->PatternRow[18], 0, 31);
377510e230b6Smaya
377610e230b6Smaya   dw[20] =
377710e230b6Smaya      __gen_uint(values->PatternRow[19], 0, 31);
377810e230b6Smaya
377910e230b6Smaya   dw[21] =
378010e230b6Smaya      __gen_uint(values->PatternRow[20], 0, 31);
378110e230b6Smaya
378210e230b6Smaya   dw[22] =
378310e230b6Smaya      __gen_uint(values->PatternRow[21], 0, 31);
378410e230b6Smaya
378510e230b6Smaya   dw[23] =
378610e230b6Smaya      __gen_uint(values->PatternRow[22], 0, 31);
378710e230b6Smaya
378810e230b6Smaya   dw[24] =
378910e230b6Smaya      __gen_uint(values->PatternRow[23], 0, 31);
379010e230b6Smaya
379110e230b6Smaya   dw[25] =
379210e230b6Smaya      __gen_uint(values->PatternRow[24], 0, 31);
379310e230b6Smaya
379410e230b6Smaya   dw[26] =
379510e230b6Smaya      __gen_uint(values->PatternRow[25], 0, 31);
379610e230b6Smaya
379710e230b6Smaya   dw[27] =
379810e230b6Smaya      __gen_uint(values->PatternRow[26], 0, 31);
379910e230b6Smaya
380010e230b6Smaya   dw[28] =
380110e230b6Smaya      __gen_uint(values->PatternRow[27], 0, 31);
380210e230b6Smaya
380310e230b6Smaya   dw[29] =
380410e230b6Smaya      __gen_uint(values->PatternRow[28], 0, 31);
380510e230b6Smaya
380610e230b6Smaya   dw[30] =
380710e230b6Smaya      __gen_uint(values->PatternRow[29], 0, 31);
380810e230b6Smaya
380910e230b6Smaya   dw[31] =
381010e230b6Smaya      __gen_uint(values->PatternRow[30], 0, 31);
381110e230b6Smaya
381210e230b6Smaya   dw[32] =
381310e230b6Smaya      __gen_uint(values->PatternRow[31], 0, 31);
381410e230b6Smaya}
381510e230b6Smaya
381696c5ddc4Srjs#define GFX8_3DSTATE_PS_length                12
381796c5ddc4Srjs#define GFX8_3DSTATE_PS_length_bias            2
381896c5ddc4Srjs#define GFX8_3DSTATE_PS_header                  \
381910e230b6Smaya   .DWordLength                         =     10,  \
382010e230b6Smaya   ._3DCommandSubOpcode                 =     32,  \
382110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
382210e230b6Smaya   .CommandSubType                      =      3,  \
382310e230b6Smaya   .CommandType                         =      3
382410e230b6Smaya
382596c5ddc4Srjsstruct GFX8_3DSTATE_PS {
382610e230b6Smaya   uint32_t                             DWordLength;
382710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
382810e230b6Smaya   uint32_t                             _3DCommandOpcode;
382910e230b6Smaya   uint32_t                             CommandSubType;
383010e230b6Smaya   uint32_t                             CommandType;
383110e230b6Smaya   uint64_t                             KernelStartPointer0;
383210e230b6Smaya   bool                                 SoftwareExceptionEnable;
383310e230b6Smaya   bool                                 MaskStackExceptionEnable;
383410e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
383510e230b6Smaya   uint32_t                             RoundingMode;
383610e230b6Smaya#define RTNE                                     0
383710e230b6Smaya#define RU                                       1
383810e230b6Smaya#define RD                                       2
383910e230b6Smaya#define RTZ                                      3
384010e230b6Smaya   uint32_t                             FloatingPointMode;
384110e230b6Smaya#define IEEE754                                  0
384210e230b6Smaya#define Alternate                                1
384310e230b6Smaya   uint32_t                             ThreadDispatchPriority;
384410e230b6Smaya#define High                                     1
384510e230b6Smaya   uint32_t                             BindingTableEntryCount;
384610e230b6Smaya   uint32_t                             SinglePrecisionDenormalMode;
384710e230b6Smaya#define FlushedtoZero                            0
384810e230b6Smaya#define Retained                                 1
384910e230b6Smaya   uint32_t                             SamplerCount;
385010e230b6Smaya#define NoSamplers                               0
385110e230b6Smaya#define _14Samplers                              1
385210e230b6Smaya#define _58Samplers                              2
385310e230b6Smaya#define _912Samplers                             3
385410e230b6Smaya#define _1316Samplers                            4
385510e230b6Smaya   bool                                 VectorMaskEnable;
385610e230b6Smaya   bool                                 SingleProgramFlow;
385710e230b6Smaya   uint32_t                             PerThreadScratchSpace;
385810e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
385910e230b6Smaya   bool                                 _8PixelDispatchEnable;
386010e230b6Smaya   bool                                 _16PixelDispatchEnable;
386110e230b6Smaya   bool                                 _32PixelDispatchEnable;
386210e230b6Smaya   uint32_t                             PositionXYOffsetSelect;
386310e230b6Smaya#define POSOFFSET_NONE                           0
386410e230b6Smaya#define POSOFFSET_CENTROID                       2
386510e230b6Smaya#define POSOFFSET_SAMPLE                         3
386610e230b6Smaya   bool                                 RenderTargetResolveEnable;
386710e230b6Smaya   bool                                 RenderTargetFastClearEnable;
386810e230b6Smaya   bool                                 PushConstantEnable;
386910e230b6Smaya   uint32_t                             MaximumNumberofThreadsPerPSD;
387010e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForConstantSetupData2;
387110e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForConstantSetupData1;
387210e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForConstantSetupData0;
387310e230b6Smaya   uint64_t                             KernelStartPointer1;
387410e230b6Smaya   uint64_t                             KernelStartPointer2;
387510e230b6Smaya};
387610e230b6Smaya
387796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
387896c5ddc4SrjsGFX8_3DSTATE_PS_pack(__attribute__((unused)) __gen_user_data *data,
387910e230b6Smaya                     __attribute__((unused)) void * restrict dst,
388096c5ddc4Srjs                     __attribute__((unused)) const struct GFX8_3DSTATE_PS * restrict values)
388110e230b6Smaya{
388210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
388310e230b6Smaya
388410e230b6Smaya   dw[0] =
388510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
388610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
388710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
388810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
388910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
389010e230b6Smaya
389110e230b6Smaya   const uint64_t v1 =
389210e230b6Smaya      __gen_offset(values->KernelStartPointer0, 6, 63);
389310e230b6Smaya   dw[1] = v1;
389410e230b6Smaya   dw[2] = v1 >> 32;
389510e230b6Smaya
389610e230b6Smaya   dw[3] =
389710e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
389810e230b6Smaya      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
389910e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
390010e230b6Smaya      __gen_uint(values->RoundingMode, 14, 15) |
390110e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
390210e230b6Smaya      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
390310e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
390410e230b6Smaya      __gen_uint(values->SinglePrecisionDenormalMode, 26, 26) |
390510e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
390610e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
390710e230b6Smaya      __gen_uint(values->SingleProgramFlow, 31, 31);
390810e230b6Smaya
390910e230b6Smaya   const uint64_t v4 =
391010e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
391110e230b6Smaya   const uint64_t v4_address =
391296c5ddc4Srjs      __gen_address(data, &dw[4], values->ScratchSpaceBasePointer, v4, 10, 63);
391310e230b6Smaya   dw[4] = v4_address;
391410e230b6Smaya   dw[5] = (v4_address >> 32) | (v4 >> 32);
391510e230b6Smaya
391610e230b6Smaya   dw[6] =
391710e230b6Smaya      __gen_uint(values->_8PixelDispatchEnable, 0, 0) |
391810e230b6Smaya      __gen_uint(values->_16PixelDispatchEnable, 1, 1) |
391910e230b6Smaya      __gen_uint(values->_32PixelDispatchEnable, 2, 2) |
392010e230b6Smaya      __gen_uint(values->PositionXYOffsetSelect, 3, 4) |
392110e230b6Smaya      __gen_uint(values->RenderTargetResolveEnable, 6, 6) |
392210e230b6Smaya      __gen_uint(values->RenderTargetFastClearEnable, 8, 8) |
392310e230b6Smaya      __gen_uint(values->PushConstantEnable, 11, 11) |
392410e230b6Smaya      __gen_uint(values->MaximumNumberofThreadsPerPSD, 23, 31);
392510e230b6Smaya
392610e230b6Smaya   dw[7] =
392710e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData2, 0, 6) |
392810e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData1, 8, 14) |
392910e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData0, 16, 22);
393010e230b6Smaya
393110e230b6Smaya   const uint64_t v8 =
393210e230b6Smaya      __gen_offset(values->KernelStartPointer1, 6, 63);
393310e230b6Smaya   dw[8] = v8;
393410e230b6Smaya   dw[9] = v8 >> 32;
393510e230b6Smaya
393610e230b6Smaya   const uint64_t v10 =
393710e230b6Smaya      __gen_offset(values->KernelStartPointer2, 6, 63);
393810e230b6Smaya   dw[10] = v10;
393910e230b6Smaya   dw[11] = v10 >> 32;
394010e230b6Smaya}
394110e230b6Smaya
394296c5ddc4Srjs#define GFX8_3DSTATE_PS_BLEND_length           2
394396c5ddc4Srjs#define GFX8_3DSTATE_PS_BLEND_length_bias      2
394496c5ddc4Srjs#define GFX8_3DSTATE_PS_BLEND_header            \
394510e230b6Smaya   .DWordLength                         =      0,  \
394610e230b6Smaya   ._3DCommandSubOpcode                 =     77,  \
394710e230b6Smaya   ._3DCommandOpcode                    =      0,  \
394810e230b6Smaya   .CommandSubType                      =      3,  \
394910e230b6Smaya   .CommandType                         =      3
395010e230b6Smaya
395196c5ddc4Srjsstruct GFX8_3DSTATE_PS_BLEND {
395210e230b6Smaya   uint32_t                             DWordLength;
395310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
395410e230b6Smaya   uint32_t                             _3DCommandOpcode;
395510e230b6Smaya   uint32_t                             CommandSubType;
395610e230b6Smaya   uint32_t                             CommandType;
395710e230b6Smaya   bool                                 IndependentAlphaBlendEnable;
395810e230b6Smaya   bool                                 AlphaTestEnable;
395910e230b6Smaya   uint32_t                             DestinationBlendFactor;
396010e230b6Smaya   uint32_t                             SourceBlendFactor;
396110e230b6Smaya   uint32_t                             DestinationAlphaBlendFactor;
396210e230b6Smaya   uint32_t                             SourceAlphaBlendFactor;
396310e230b6Smaya   bool                                 ColorBufferBlendEnable;
396410e230b6Smaya   bool                                 HasWriteableRT;
396510e230b6Smaya   bool                                 AlphaToCoverageEnable;
396610e230b6Smaya};
396710e230b6Smaya
396896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
396996c5ddc4SrjsGFX8_3DSTATE_PS_BLEND_pack(__attribute__((unused)) __gen_user_data *data,
397010e230b6Smaya                           __attribute__((unused)) void * restrict dst,
397196c5ddc4Srjs                           __attribute__((unused)) const struct GFX8_3DSTATE_PS_BLEND * restrict values)
397210e230b6Smaya{
397310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
397410e230b6Smaya
397510e230b6Smaya   dw[0] =
397610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
397710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
397810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
397910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
398010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
398110e230b6Smaya
398210e230b6Smaya   dw[1] =
398310e230b6Smaya      __gen_uint(values->IndependentAlphaBlendEnable, 7, 7) |
398410e230b6Smaya      __gen_uint(values->AlphaTestEnable, 8, 8) |
398510e230b6Smaya      __gen_uint(values->DestinationBlendFactor, 9, 13) |
398610e230b6Smaya      __gen_uint(values->SourceBlendFactor, 14, 18) |
398710e230b6Smaya      __gen_uint(values->DestinationAlphaBlendFactor, 19, 23) |
398810e230b6Smaya      __gen_uint(values->SourceAlphaBlendFactor, 24, 28) |
398910e230b6Smaya      __gen_uint(values->ColorBufferBlendEnable, 29, 29) |
399010e230b6Smaya      __gen_uint(values->HasWriteableRT, 30, 30) |
399110e230b6Smaya      __gen_uint(values->AlphaToCoverageEnable, 31, 31);
399210e230b6Smaya}
399310e230b6Smaya
399496c5ddc4Srjs#define GFX8_3DSTATE_PS_EXTRA_length           2
399596c5ddc4Srjs#define GFX8_3DSTATE_PS_EXTRA_length_bias      2
399696c5ddc4Srjs#define GFX8_3DSTATE_PS_EXTRA_header            \
399710e230b6Smaya   .DWordLength                         =      0,  \
399810e230b6Smaya   ._3DCommandSubOpcode                 =     79,  \
399910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
400010e230b6Smaya   .CommandSubType                      =      3,  \
400110e230b6Smaya   .CommandType                         =      3
400210e230b6Smaya
400396c5ddc4Srjsstruct GFX8_3DSTATE_PS_EXTRA {
400410e230b6Smaya   uint32_t                             DWordLength;
400510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
400610e230b6Smaya   uint32_t                             _3DCommandOpcode;
400710e230b6Smaya   uint32_t                             CommandSubType;
400810e230b6Smaya   uint32_t                             CommandType;
400910e230b6Smaya   bool                                 PixelShaderUsesInputCoverageMask;
401010e230b6Smaya   bool                                 PixelShaderHasUAV;
401110e230b6Smaya   bool                                 PixelShaderIsPerSample;
401210e230b6Smaya   bool                                 PixelShaderDisablesAlphaToCoverage;
401310e230b6Smaya   bool                                 AttributeEnable;
401410e230b6Smaya   bool                                 PixelShaderUsesSourceW;
401510e230b6Smaya   bool                                 PixelShaderUsesSourceDepth;
401610e230b6Smaya   bool                                 ForceComputedDepth;
401710e230b6Smaya   uint32_t                             PixelShaderComputedDepthMode;
401810e230b6Smaya#define PSCDEPTH_OFF                             0
401910e230b6Smaya#define PSCDEPTH_ON                              1
402010e230b6Smaya#define PSCDEPTH_ON_GE                           2
402110e230b6Smaya#define PSCDEPTH_ON_LE                           3
402210e230b6Smaya   bool                                 PixelShaderKillsPixel;
402310e230b6Smaya   bool                                 oMaskPresenttoRenderTarget;
402410e230b6Smaya   bool                                 PixelShaderDoesnotwritetoRT;
402510e230b6Smaya   bool                                 PixelShaderValid;
402610e230b6Smaya};
402710e230b6Smaya
402896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
402996c5ddc4SrjsGFX8_3DSTATE_PS_EXTRA_pack(__attribute__((unused)) __gen_user_data *data,
403010e230b6Smaya                           __attribute__((unused)) void * restrict dst,
403196c5ddc4Srjs                           __attribute__((unused)) const struct GFX8_3DSTATE_PS_EXTRA * restrict values)
403210e230b6Smaya{
403310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
403410e230b6Smaya
403510e230b6Smaya   dw[0] =
403610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
403710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
403810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
403910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
404010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
404110e230b6Smaya
404210e230b6Smaya   dw[1] =
404310e230b6Smaya      __gen_uint(values->PixelShaderUsesInputCoverageMask, 1, 1) |
404410e230b6Smaya      __gen_uint(values->PixelShaderHasUAV, 2, 2) |
404510e230b6Smaya      __gen_uint(values->PixelShaderIsPerSample, 6, 6) |
404610e230b6Smaya      __gen_uint(values->PixelShaderDisablesAlphaToCoverage, 7, 7) |
404710e230b6Smaya      __gen_uint(values->AttributeEnable, 8, 8) |
404810e230b6Smaya      __gen_uint(values->PixelShaderUsesSourceW, 23, 23) |
404910e230b6Smaya      __gen_uint(values->PixelShaderUsesSourceDepth, 24, 24) |
405010e230b6Smaya      __gen_uint(values->ForceComputedDepth, 25, 25) |
405110e230b6Smaya      __gen_uint(values->PixelShaderComputedDepthMode, 26, 27) |
405210e230b6Smaya      __gen_uint(values->PixelShaderKillsPixel, 28, 28) |
405310e230b6Smaya      __gen_uint(values->oMaskPresenttoRenderTarget, 29, 29) |
405410e230b6Smaya      __gen_uint(values->PixelShaderDoesnotwritetoRT, 30, 30) |
405510e230b6Smaya      __gen_uint(values->PixelShaderValid, 31, 31);
405610e230b6Smaya}
405710e230b6Smaya
405896c5ddc4Srjs#define GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_DS_length      2
405996c5ddc4Srjs#define GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_DS_length_bias      2
406096c5ddc4Srjs#define GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_DS_header\
406110e230b6Smaya   .DWordLength                         =      0,  \
406210e230b6Smaya   ._3DCommandSubOpcode                 =     20,  \
406310e230b6Smaya   ._3DCommandOpcode                    =      1,  \
406410e230b6Smaya   .CommandSubType                      =      3,  \
406510e230b6Smaya   .CommandType                         =      3
406610e230b6Smaya
406796c5ddc4Srjsstruct GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_DS {
406810e230b6Smaya   uint32_t                             DWordLength;
406910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
407010e230b6Smaya   uint32_t                             _3DCommandOpcode;
407110e230b6Smaya   uint32_t                             CommandSubType;
407210e230b6Smaya   uint32_t                             CommandType;
407310e230b6Smaya   uint32_t                             ConstantBufferSize;
407410e230b6Smaya   uint32_t                             ConstantBufferOffset;
407510e230b6Smaya};
407610e230b6Smaya
407796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
407896c5ddc4SrjsGFX8_3DSTATE_PUSH_CONSTANT_ALLOC_DS_pack(__attribute__((unused)) __gen_user_data *data,
407910e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
408096c5ddc4Srjs                                         __attribute__((unused)) const struct GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_DS * restrict values)
408110e230b6Smaya{
408210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
408310e230b6Smaya
408410e230b6Smaya   dw[0] =
408510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
408610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
408710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
408810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
408910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
409010e230b6Smaya
409110e230b6Smaya   dw[1] =
409210e230b6Smaya      __gen_uint(values->ConstantBufferSize, 0, 5) |
409310e230b6Smaya      __gen_uint(values->ConstantBufferOffset, 16, 20);
409410e230b6Smaya}
409510e230b6Smaya
409696c5ddc4Srjs#define GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_GS_length      2
409796c5ddc4Srjs#define GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_GS_length_bias      2
409896c5ddc4Srjs#define GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_GS_header\
409910e230b6Smaya   .DWordLength                         =      0,  \
410010e230b6Smaya   ._3DCommandSubOpcode                 =     21,  \
410110e230b6Smaya   ._3DCommandOpcode                    =      1,  \
410210e230b6Smaya   .CommandSubType                      =      3,  \
410310e230b6Smaya   .CommandType                         =      3
410410e230b6Smaya
410596c5ddc4Srjsstruct GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_GS {
410610e230b6Smaya   uint32_t                             DWordLength;
410710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
410810e230b6Smaya   uint32_t                             _3DCommandOpcode;
410910e230b6Smaya   uint32_t                             CommandSubType;
411010e230b6Smaya   uint32_t                             CommandType;
411110e230b6Smaya   uint32_t                             ConstantBufferSize;
411210e230b6Smaya   uint32_t                             ConstantBufferOffset;
411310e230b6Smaya};
411410e230b6Smaya
411596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
411696c5ddc4SrjsGFX8_3DSTATE_PUSH_CONSTANT_ALLOC_GS_pack(__attribute__((unused)) __gen_user_data *data,
411710e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
411896c5ddc4Srjs                                         __attribute__((unused)) const struct GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_GS * restrict values)
411910e230b6Smaya{
412010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
412110e230b6Smaya
412210e230b6Smaya   dw[0] =
412310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
412410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
412510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
412610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
412710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
412810e230b6Smaya
412910e230b6Smaya   dw[1] =
413010e230b6Smaya      __gen_uint(values->ConstantBufferSize, 0, 5) |
413110e230b6Smaya      __gen_uint(values->ConstantBufferOffset, 16, 20);
413210e230b6Smaya}
413310e230b6Smaya
413496c5ddc4Srjs#define GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_HS_length      2
413596c5ddc4Srjs#define GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_HS_length_bias      2
413696c5ddc4Srjs#define GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_HS_header\
413710e230b6Smaya   .DWordLength                         =      0,  \
413810e230b6Smaya   ._3DCommandSubOpcode                 =     19,  \
413910e230b6Smaya   ._3DCommandOpcode                    =      1,  \
414010e230b6Smaya   .CommandSubType                      =      3,  \
414110e230b6Smaya   .CommandType                         =      3
414210e230b6Smaya
414396c5ddc4Srjsstruct GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_HS {
414410e230b6Smaya   uint32_t                             DWordLength;
414510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
414610e230b6Smaya   uint32_t                             _3DCommandOpcode;
414710e230b6Smaya   uint32_t                             CommandSubType;
414810e230b6Smaya   uint32_t                             CommandType;
414910e230b6Smaya   uint32_t                             ConstantBufferSize;
415010e230b6Smaya   uint32_t                             ConstantBufferOffset;
415110e230b6Smaya};
415210e230b6Smaya
415396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
415496c5ddc4SrjsGFX8_3DSTATE_PUSH_CONSTANT_ALLOC_HS_pack(__attribute__((unused)) __gen_user_data *data,
415510e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
415696c5ddc4Srjs                                         __attribute__((unused)) const struct GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_HS * restrict values)
415710e230b6Smaya{
415810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
415910e230b6Smaya
416010e230b6Smaya   dw[0] =
416110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
416210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
416310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
416410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
416510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
416610e230b6Smaya
416710e230b6Smaya   dw[1] =
416810e230b6Smaya      __gen_uint(values->ConstantBufferSize, 0, 5) |
416910e230b6Smaya      __gen_uint(values->ConstantBufferOffset, 16, 20);
417010e230b6Smaya}
417110e230b6Smaya
417296c5ddc4Srjs#define GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_PS_length      2
417396c5ddc4Srjs#define GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_PS_length_bias      2
417496c5ddc4Srjs#define GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_PS_header\
417510e230b6Smaya   .DWordLength                         =      0,  \
417610e230b6Smaya   ._3DCommandSubOpcode                 =     22,  \
417710e230b6Smaya   ._3DCommandOpcode                    =      1,  \
417810e230b6Smaya   .CommandSubType                      =      3,  \
417910e230b6Smaya   .CommandType                         =      3
418010e230b6Smaya
418196c5ddc4Srjsstruct GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_PS {
418210e230b6Smaya   uint32_t                             DWordLength;
418310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
418410e230b6Smaya   uint32_t                             _3DCommandOpcode;
418510e230b6Smaya   uint32_t                             CommandSubType;
418610e230b6Smaya   uint32_t                             CommandType;
418710e230b6Smaya   uint32_t                             ConstantBufferSize;
418810e230b6Smaya   uint32_t                             ConstantBufferOffset;
418910e230b6Smaya};
419010e230b6Smaya
419196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
419296c5ddc4SrjsGFX8_3DSTATE_PUSH_CONSTANT_ALLOC_PS_pack(__attribute__((unused)) __gen_user_data *data,
419310e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
419496c5ddc4Srjs                                         __attribute__((unused)) const struct GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_PS * restrict values)
419510e230b6Smaya{
419610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
419710e230b6Smaya
419810e230b6Smaya   dw[0] =
419910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
420010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
420110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
420210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
420310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
420410e230b6Smaya
420510e230b6Smaya   dw[1] =
420610e230b6Smaya      __gen_uint(values->ConstantBufferSize, 0, 5) |
420710e230b6Smaya      __gen_uint(values->ConstantBufferOffset, 16, 20);
420810e230b6Smaya}
420910e230b6Smaya
421096c5ddc4Srjs#define GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_VS_length      2
421196c5ddc4Srjs#define GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_VS_length_bias      2
421296c5ddc4Srjs#define GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_VS_header\
421310e230b6Smaya   .DWordLength                         =      0,  \
421410e230b6Smaya   ._3DCommandSubOpcode                 =     18,  \
421510e230b6Smaya   ._3DCommandOpcode                    =      1,  \
421610e230b6Smaya   .CommandSubType                      =      3,  \
421710e230b6Smaya   .CommandType                         =      3
421810e230b6Smaya
421996c5ddc4Srjsstruct GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_VS {
422010e230b6Smaya   uint32_t                             DWordLength;
422110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
422210e230b6Smaya   uint32_t                             _3DCommandOpcode;
422310e230b6Smaya   uint32_t                             CommandSubType;
422410e230b6Smaya   uint32_t                             CommandType;
422510e230b6Smaya   uint32_t                             ConstantBufferSize;
422610e230b6Smaya   uint32_t                             ConstantBufferOffset;
422710e230b6Smaya};
422810e230b6Smaya
422996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
423096c5ddc4SrjsGFX8_3DSTATE_PUSH_CONSTANT_ALLOC_VS_pack(__attribute__((unused)) __gen_user_data *data,
423110e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
423296c5ddc4Srjs                                         __attribute__((unused)) const struct GFX8_3DSTATE_PUSH_CONSTANT_ALLOC_VS * restrict values)
423310e230b6Smaya{
423410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
423510e230b6Smaya
423610e230b6Smaya   dw[0] =
423710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
423810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
423910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
424010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
424110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
424210e230b6Smaya
424310e230b6Smaya   dw[1] =
424410e230b6Smaya      __gen_uint(values->ConstantBufferSize, 0, 5) |
424510e230b6Smaya      __gen_uint(values->ConstantBufferOffset, 16, 20);
424610e230b6Smaya}
424710e230b6Smaya
424896c5ddc4Srjs#define GFX8_3DSTATE_RASTER_length             5
424996c5ddc4Srjs#define GFX8_3DSTATE_RASTER_length_bias        2
425096c5ddc4Srjs#define GFX8_3DSTATE_RASTER_header              \
425110e230b6Smaya   .DWordLength                         =      3,  \
425210e230b6Smaya   ._3DCommandSubOpcode                 =     80,  \
425310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
425410e230b6Smaya   .CommandSubType                      =      3,  \
425510e230b6Smaya   .CommandType                         =      3
425610e230b6Smaya
425796c5ddc4Srjsstruct GFX8_3DSTATE_RASTER {
425810e230b6Smaya   uint32_t                             DWordLength;
425910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
426010e230b6Smaya   uint32_t                             _3DCommandOpcode;
426110e230b6Smaya   uint32_t                             CommandSubType;
426210e230b6Smaya   uint32_t                             CommandType;
426310e230b6Smaya   bool                                 ViewportZClipTestEnable;
426410e230b6Smaya   bool                                 ScissorRectangleEnable;
426510e230b6Smaya   bool                                 AntialiasingEnable;
426610e230b6Smaya   uint32_t                             BackFaceFillMode;
426710e230b6Smaya#define FILL_MODE_SOLID                          0
426810e230b6Smaya#define FILL_MODE_WIREFRAME                      1
426910e230b6Smaya#define FILL_MODE_POINT                          2
427010e230b6Smaya   uint32_t                             FrontFaceFillMode;
427110e230b6Smaya#define FILL_MODE_SOLID                          0
427210e230b6Smaya#define FILL_MODE_WIREFRAME                      1
427310e230b6Smaya#define FILL_MODE_POINT                          2
427410e230b6Smaya   bool                                 GlobalDepthOffsetEnablePoint;
427510e230b6Smaya   bool                                 GlobalDepthOffsetEnableWireframe;
427610e230b6Smaya   bool                                 GlobalDepthOffsetEnableSolid;
427710e230b6Smaya   uint32_t                             DXMultisampleRasterizationMode;
427810e230b6Smaya#define MSRASTMODE_OFF_PIXEL                     0
427910e230b6Smaya#define MSRASTMODE_OFF_PATTERN                   1
428010e230b6Smaya#define MSRASTMODE_ON_PIXEL                      2
428110e230b6Smaya#define MSRASTMODE_ON_PATTERN                    3
428210e230b6Smaya   bool                                 DXMultisampleRasterizationEnable;
428310e230b6Smaya   bool                                 SmoothPointEnable;
428410e230b6Smaya   uint32_t                             ForceMultisampling;
428510e230b6Smaya   uint32_t                             CullMode;
428610e230b6Smaya#define CULLMODE_BOTH                            0
428710e230b6Smaya#define CULLMODE_NONE                            1
428810e230b6Smaya#define CULLMODE_FRONT                           2
428910e230b6Smaya#define CULLMODE_BACK                            3
429010e230b6Smaya   uint32_t                             ForcedSampleCount;
429110e230b6Smaya#define FSC_NUMRASTSAMPLES_0                     0
429210e230b6Smaya#define FSC_NUMRASTSAMPLES_1                     1
429310e230b6Smaya#define FSC_NUMRASTSAMPLES_2                     2
429410e230b6Smaya#define FSC_NUMRASTSAMPLES_4                     3
429510e230b6Smaya#define FSC_NUMRASTSAMPLES_8                     4
429610e230b6Smaya#define FSC_NUMRASTSAMPLES_16                    5
429710e230b6Smaya   uint32_t                             FrontWinding;
429810e230b6Smaya#define Clockwise                                0
429910e230b6Smaya#define CounterClockwise                         1
430010e230b6Smaya   uint32_t                             APIMode;
430110e230b6Smaya#define DX9OGL                                   0
430210e230b6Smaya#define DX100                                    1
430310e230b6Smaya#define DX101                                    2
430410e230b6Smaya   float                                GlobalDepthOffsetConstant;
430510e230b6Smaya   float                                GlobalDepthOffsetScale;
430610e230b6Smaya   float                                GlobalDepthOffsetClamp;
430710e230b6Smaya};
430810e230b6Smaya
430996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
431096c5ddc4SrjsGFX8_3DSTATE_RASTER_pack(__attribute__((unused)) __gen_user_data *data,
431110e230b6Smaya                         __attribute__((unused)) void * restrict dst,
431296c5ddc4Srjs                         __attribute__((unused)) const struct GFX8_3DSTATE_RASTER * restrict values)
431310e230b6Smaya{
431410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
431510e230b6Smaya
431610e230b6Smaya   dw[0] =
431710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
431810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
431910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
432010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
432110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
432210e230b6Smaya
432310e230b6Smaya   dw[1] =
432410e230b6Smaya      __gen_uint(values->ViewportZClipTestEnable, 0, 0) |
432510e230b6Smaya      __gen_uint(values->ScissorRectangleEnable, 1, 1) |
432610e230b6Smaya      __gen_uint(values->AntialiasingEnable, 2, 2) |
432710e230b6Smaya      __gen_uint(values->BackFaceFillMode, 3, 4) |
432810e230b6Smaya      __gen_uint(values->FrontFaceFillMode, 5, 6) |
432910e230b6Smaya      __gen_uint(values->GlobalDepthOffsetEnablePoint, 7, 7) |
433010e230b6Smaya      __gen_uint(values->GlobalDepthOffsetEnableWireframe, 8, 8) |
433110e230b6Smaya      __gen_uint(values->GlobalDepthOffsetEnableSolid, 9, 9) |
433210e230b6Smaya      __gen_uint(values->DXMultisampleRasterizationMode, 10, 11) |
433310e230b6Smaya      __gen_uint(values->DXMultisampleRasterizationEnable, 12, 12) |
433410e230b6Smaya      __gen_uint(values->SmoothPointEnable, 13, 13) |
433510e230b6Smaya      __gen_uint(values->ForceMultisampling, 14, 14) |
433610e230b6Smaya      __gen_uint(values->CullMode, 16, 17) |
433710e230b6Smaya      __gen_uint(values->ForcedSampleCount, 18, 20) |
433810e230b6Smaya      __gen_uint(values->FrontWinding, 21, 21) |
433910e230b6Smaya      __gen_uint(values->APIMode, 22, 23);
434010e230b6Smaya
434110e230b6Smaya   dw[2] =
434210e230b6Smaya      __gen_float(values->GlobalDepthOffsetConstant);
434310e230b6Smaya
434410e230b6Smaya   dw[3] =
434510e230b6Smaya      __gen_float(values->GlobalDepthOffsetScale);
434610e230b6Smaya
434710e230b6Smaya   dw[4] =
434810e230b6Smaya      __gen_float(values->GlobalDepthOffsetClamp);
434910e230b6Smaya}
435010e230b6Smaya
435196c5ddc4Srjs#define GFX8_3DSTATE_SAMPLER_PALETTE_LOAD0_length_bias      2
435296c5ddc4Srjs#define GFX8_3DSTATE_SAMPLER_PALETTE_LOAD0_header\
435310e230b6Smaya   ._3DCommandSubOpcode                 =      2,  \
435410e230b6Smaya   ._3DCommandOpcode                    =      1,  \
435510e230b6Smaya   .CommandSubType                      =      3,  \
435610e230b6Smaya   .CommandType                         =      3
435710e230b6Smaya
435896c5ddc4Srjsstruct GFX8_3DSTATE_SAMPLER_PALETTE_LOAD0 {
435910e230b6Smaya   uint32_t                             DWordLength;
436010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
436110e230b6Smaya   uint32_t                             _3DCommandOpcode;
436210e230b6Smaya   uint32_t                             CommandSubType;
436310e230b6Smaya   uint32_t                             CommandType;
436410e230b6Smaya   /* variable length fields follow */
436510e230b6Smaya};
436610e230b6Smaya
436796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
436896c5ddc4SrjsGFX8_3DSTATE_SAMPLER_PALETTE_LOAD0_pack(__attribute__((unused)) __gen_user_data *data,
436910e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
437096c5ddc4Srjs                                        __attribute__((unused)) const struct GFX8_3DSTATE_SAMPLER_PALETTE_LOAD0 * restrict values)
437110e230b6Smaya{
437210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
437310e230b6Smaya
437410e230b6Smaya   dw[0] =
437510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
437610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
437710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
437810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
437910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
438010e230b6Smaya}
438110e230b6Smaya
438296c5ddc4Srjs#define GFX8_3DSTATE_SAMPLER_PALETTE_LOAD1_length_bias      2
438396c5ddc4Srjs#define GFX8_3DSTATE_SAMPLER_PALETTE_LOAD1_header\
438410e230b6Smaya   .DWordLength                         =      0,  \
438510e230b6Smaya   ._3DCommandSubOpcode                 =     12,  \
438610e230b6Smaya   ._3DCommandOpcode                    =      1,  \
438710e230b6Smaya   .CommandSubType                      =      3,  \
438810e230b6Smaya   .CommandType                         =      3
438910e230b6Smaya
439096c5ddc4Srjsstruct GFX8_3DSTATE_SAMPLER_PALETTE_LOAD1 {
439110e230b6Smaya   uint32_t                             DWordLength;
439210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
439310e230b6Smaya   uint32_t                             _3DCommandOpcode;
439410e230b6Smaya   uint32_t                             CommandSubType;
439510e230b6Smaya   uint32_t                             CommandType;
439610e230b6Smaya   /* variable length fields follow */
439710e230b6Smaya};
439810e230b6Smaya
439996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
440096c5ddc4SrjsGFX8_3DSTATE_SAMPLER_PALETTE_LOAD1_pack(__attribute__((unused)) __gen_user_data *data,
440110e230b6Smaya                                        __attribute__((unused)) void * restrict dst,
440296c5ddc4Srjs                                        __attribute__((unused)) const struct GFX8_3DSTATE_SAMPLER_PALETTE_LOAD1 * restrict values)
440310e230b6Smaya{
440410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
440510e230b6Smaya
440610e230b6Smaya   dw[0] =
440710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
440810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
440910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
441010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
441110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
441210e230b6Smaya}
441310e230b6Smaya
441496c5ddc4Srjs#define GFX8_3DSTATE_SAMPLER_STATE_POINTERS_DS_length      2
441596c5ddc4Srjs#define GFX8_3DSTATE_SAMPLER_STATE_POINTERS_DS_length_bias      2
441696c5ddc4Srjs#define GFX8_3DSTATE_SAMPLER_STATE_POINTERS_DS_header\
441710e230b6Smaya   .DWordLength                         =      0,  \
441810e230b6Smaya   ._3DCommandSubOpcode                 =     45,  \
441910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
442010e230b6Smaya   .CommandSubType                      =      3,  \
442110e230b6Smaya   .CommandType                         =      3
442210e230b6Smaya
442396c5ddc4Srjsstruct GFX8_3DSTATE_SAMPLER_STATE_POINTERS_DS {
442410e230b6Smaya   uint32_t                             DWordLength;
442510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
442610e230b6Smaya   uint32_t                             _3DCommandOpcode;
442710e230b6Smaya   uint32_t                             CommandSubType;
442810e230b6Smaya   uint32_t                             CommandType;
442910e230b6Smaya   uint64_t                             PointertoDSSamplerState;
443010e230b6Smaya};
443110e230b6Smaya
443296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
443396c5ddc4SrjsGFX8_3DSTATE_SAMPLER_STATE_POINTERS_DS_pack(__attribute__((unused)) __gen_user_data *data,
443410e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
443596c5ddc4Srjs                                            __attribute__((unused)) const struct GFX8_3DSTATE_SAMPLER_STATE_POINTERS_DS * restrict values)
443610e230b6Smaya{
443710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
443810e230b6Smaya
443910e230b6Smaya   dw[0] =
444010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
444110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
444210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
444310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
444410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
444510e230b6Smaya
444610e230b6Smaya   dw[1] =
444710e230b6Smaya      __gen_offset(values->PointertoDSSamplerState, 5, 31);
444810e230b6Smaya}
444910e230b6Smaya
445096c5ddc4Srjs#define GFX8_3DSTATE_SAMPLER_STATE_POINTERS_GS_length      2
445196c5ddc4Srjs#define GFX8_3DSTATE_SAMPLER_STATE_POINTERS_GS_length_bias      2
445296c5ddc4Srjs#define GFX8_3DSTATE_SAMPLER_STATE_POINTERS_GS_header\
445310e230b6Smaya   .DWordLength                         =      0,  \
445410e230b6Smaya   ._3DCommandSubOpcode                 =     46,  \
445510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
445610e230b6Smaya   .CommandSubType                      =      3,  \
445710e230b6Smaya   .CommandType                         =      3
445810e230b6Smaya
445996c5ddc4Srjsstruct GFX8_3DSTATE_SAMPLER_STATE_POINTERS_GS {
446010e230b6Smaya   uint32_t                             DWordLength;
446110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
446210e230b6Smaya   uint32_t                             _3DCommandOpcode;
446310e230b6Smaya   uint32_t                             CommandSubType;
446410e230b6Smaya   uint32_t                             CommandType;
446510e230b6Smaya   uint64_t                             PointertoGSSamplerState;
446610e230b6Smaya};
446710e230b6Smaya
446896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
446996c5ddc4SrjsGFX8_3DSTATE_SAMPLER_STATE_POINTERS_GS_pack(__attribute__((unused)) __gen_user_data *data,
447010e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
447196c5ddc4Srjs                                            __attribute__((unused)) const struct GFX8_3DSTATE_SAMPLER_STATE_POINTERS_GS * restrict values)
447210e230b6Smaya{
447310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
447410e230b6Smaya
447510e230b6Smaya   dw[0] =
447610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
447710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
447810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
447910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
448010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
448110e230b6Smaya
448210e230b6Smaya   dw[1] =
448310e230b6Smaya      __gen_offset(values->PointertoGSSamplerState, 5, 31);
448410e230b6Smaya}
448510e230b6Smaya
448696c5ddc4Srjs#define GFX8_3DSTATE_SAMPLER_STATE_POINTERS_HS_length      2
448796c5ddc4Srjs#define GFX8_3DSTATE_SAMPLER_STATE_POINTERS_HS_length_bias      2
448896c5ddc4Srjs#define GFX8_3DSTATE_SAMPLER_STATE_POINTERS_HS_header\
448910e230b6Smaya   .DWordLength                         =      0,  \
449010e230b6Smaya   ._3DCommandSubOpcode                 =     44,  \
449110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
449210e230b6Smaya   .CommandSubType                      =      3,  \
449310e230b6Smaya   .CommandType                         =      3
449410e230b6Smaya
449596c5ddc4Srjsstruct GFX8_3DSTATE_SAMPLER_STATE_POINTERS_HS {
449610e230b6Smaya   uint32_t                             DWordLength;
449710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
449810e230b6Smaya   uint32_t                             _3DCommandOpcode;
449910e230b6Smaya   uint32_t                             CommandSubType;
450010e230b6Smaya   uint32_t                             CommandType;
450110e230b6Smaya   uint64_t                             PointertoHSSamplerState;
450210e230b6Smaya};
450310e230b6Smaya
450496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
450596c5ddc4SrjsGFX8_3DSTATE_SAMPLER_STATE_POINTERS_HS_pack(__attribute__((unused)) __gen_user_data *data,
450610e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
450796c5ddc4Srjs                                            __attribute__((unused)) const struct GFX8_3DSTATE_SAMPLER_STATE_POINTERS_HS * restrict values)
450810e230b6Smaya{
450910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
451010e230b6Smaya
451110e230b6Smaya   dw[0] =
451210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
451310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
451410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
451510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
451610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
451710e230b6Smaya
451810e230b6Smaya   dw[1] =
451910e230b6Smaya      __gen_offset(values->PointertoHSSamplerState, 5, 31);
452010e230b6Smaya}
452110e230b6Smaya
452296c5ddc4Srjs#define GFX8_3DSTATE_SAMPLER_STATE_POINTERS_PS_length      2
452396c5ddc4Srjs#define GFX8_3DSTATE_SAMPLER_STATE_POINTERS_PS_length_bias      2
452496c5ddc4Srjs#define GFX8_3DSTATE_SAMPLER_STATE_POINTERS_PS_header\
452510e230b6Smaya   .DWordLength                         =      0,  \
452610e230b6Smaya   ._3DCommandSubOpcode                 =     47,  \
452710e230b6Smaya   ._3DCommandOpcode                    =      0,  \
452810e230b6Smaya   .CommandSubType                      =      3,  \
452910e230b6Smaya   .CommandType                         =      3
453010e230b6Smaya
453196c5ddc4Srjsstruct GFX8_3DSTATE_SAMPLER_STATE_POINTERS_PS {
453210e230b6Smaya   uint32_t                             DWordLength;
453310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
453410e230b6Smaya   uint32_t                             _3DCommandOpcode;
453510e230b6Smaya   uint32_t                             CommandSubType;
453610e230b6Smaya   uint32_t                             CommandType;
453710e230b6Smaya   uint64_t                             PointertoPSSamplerState;
453810e230b6Smaya};
453910e230b6Smaya
454096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
454196c5ddc4SrjsGFX8_3DSTATE_SAMPLER_STATE_POINTERS_PS_pack(__attribute__((unused)) __gen_user_data *data,
454210e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
454396c5ddc4Srjs                                            __attribute__((unused)) const struct GFX8_3DSTATE_SAMPLER_STATE_POINTERS_PS * restrict values)
454410e230b6Smaya{
454510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
454610e230b6Smaya
454710e230b6Smaya   dw[0] =
454810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
454910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
455010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
455110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
455210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
455310e230b6Smaya
455410e230b6Smaya   dw[1] =
455510e230b6Smaya      __gen_offset(values->PointertoPSSamplerState, 5, 31);
455610e230b6Smaya}
455710e230b6Smaya
455896c5ddc4Srjs#define GFX8_3DSTATE_SAMPLER_STATE_POINTERS_VS_length      2
455996c5ddc4Srjs#define GFX8_3DSTATE_SAMPLER_STATE_POINTERS_VS_length_bias      2
456096c5ddc4Srjs#define GFX8_3DSTATE_SAMPLER_STATE_POINTERS_VS_header\
456110e230b6Smaya   .DWordLength                         =      0,  \
456210e230b6Smaya   ._3DCommandSubOpcode                 =     43,  \
456310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
456410e230b6Smaya   .CommandSubType                      =      3,  \
456510e230b6Smaya   .CommandType                         =      3
456610e230b6Smaya
456796c5ddc4Srjsstruct GFX8_3DSTATE_SAMPLER_STATE_POINTERS_VS {
456810e230b6Smaya   uint32_t                             DWordLength;
456910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
457010e230b6Smaya   uint32_t                             _3DCommandOpcode;
457110e230b6Smaya   uint32_t                             CommandSubType;
457210e230b6Smaya   uint32_t                             CommandType;
457310e230b6Smaya   uint64_t                             PointertoVSSamplerState;
457410e230b6Smaya};
457510e230b6Smaya
457696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
457796c5ddc4SrjsGFX8_3DSTATE_SAMPLER_STATE_POINTERS_VS_pack(__attribute__((unused)) __gen_user_data *data,
457810e230b6Smaya                                            __attribute__((unused)) void * restrict dst,
457996c5ddc4Srjs                                            __attribute__((unused)) const struct GFX8_3DSTATE_SAMPLER_STATE_POINTERS_VS * restrict values)
458010e230b6Smaya{
458110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
458210e230b6Smaya
458310e230b6Smaya   dw[0] =
458410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
458510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
458610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
458710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
458810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
458910e230b6Smaya
459010e230b6Smaya   dw[1] =
459110e230b6Smaya      __gen_offset(values->PointertoVSSamplerState, 5, 31);
459210e230b6Smaya}
459310e230b6Smaya
459496c5ddc4Srjs#define GFX8_3DSTATE_SAMPLE_MASK_length        2
459596c5ddc4Srjs#define GFX8_3DSTATE_SAMPLE_MASK_length_bias      2
459696c5ddc4Srjs#define GFX8_3DSTATE_SAMPLE_MASK_header         \
459710e230b6Smaya   .DWordLength                         =      0,  \
459810e230b6Smaya   ._3DCommandSubOpcode                 =     24,  \
459910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
460010e230b6Smaya   .CommandSubType                      =      3,  \
460110e230b6Smaya   .CommandType                         =      3
460210e230b6Smaya
460396c5ddc4Srjsstruct GFX8_3DSTATE_SAMPLE_MASK {
460410e230b6Smaya   uint32_t                             DWordLength;
460510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
460610e230b6Smaya   uint32_t                             _3DCommandOpcode;
460710e230b6Smaya   uint32_t                             CommandSubType;
460810e230b6Smaya   uint32_t                             CommandType;
460910e230b6Smaya   uint32_t                             SampleMask;
461010e230b6Smaya};
461110e230b6Smaya
461296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
461396c5ddc4SrjsGFX8_3DSTATE_SAMPLE_MASK_pack(__attribute__((unused)) __gen_user_data *data,
461410e230b6Smaya                              __attribute__((unused)) void * restrict dst,
461596c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_3DSTATE_SAMPLE_MASK * restrict values)
461610e230b6Smaya{
461710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
461810e230b6Smaya
461910e230b6Smaya   dw[0] =
462010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
462110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
462210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
462310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
462410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
462510e230b6Smaya
462610e230b6Smaya   dw[1] =
462710e230b6Smaya      __gen_uint(values->SampleMask, 0, 15);
462810e230b6Smaya}
462910e230b6Smaya
463096c5ddc4Srjs#define GFX8_3DSTATE_SAMPLE_PATTERN_length      9
463196c5ddc4Srjs#define GFX8_3DSTATE_SAMPLE_PATTERN_length_bias      2
463296c5ddc4Srjs#define GFX8_3DSTATE_SAMPLE_PATTERN_header      \
463310e230b6Smaya   .DWordLength                         =      7,  \
463410e230b6Smaya   ._3DCommandSubOpcode                 =     28,  \
463510e230b6Smaya   ._3DCommandOpcode                    =      1,  \
463610e230b6Smaya   .CommandSubType                      =      3,  \
463710e230b6Smaya   .CommandType                         =      3
463810e230b6Smaya
463996c5ddc4Srjsstruct GFX8_3DSTATE_SAMPLE_PATTERN {
464010e230b6Smaya   uint32_t                             DWordLength;
464110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
464210e230b6Smaya   uint32_t                             _3DCommandOpcode;
464310e230b6Smaya   uint32_t                             CommandSubType;
464410e230b6Smaya   uint32_t                             CommandType;
464510e230b6Smaya   float                                _8xSample4YOffset;
464610e230b6Smaya   float                                _8xSample4XOffset;
464710e230b6Smaya   float                                _8xSample5YOffset;
464810e230b6Smaya   float                                _8xSample5XOffset;
464910e230b6Smaya   float                                _8xSample6YOffset;
465010e230b6Smaya   float                                _8xSample6XOffset;
465110e230b6Smaya   float                                _8xSample7YOffset;
465210e230b6Smaya   float                                _8xSample7XOffset;
465310e230b6Smaya   float                                _8xSample0YOffset;
465410e230b6Smaya   float                                _8xSample0XOffset;
465510e230b6Smaya   float                                _8xSample1YOffset;
465610e230b6Smaya   float                                _8xSample1XOffset;
465710e230b6Smaya   float                                _8xSample2YOffset;
465810e230b6Smaya   float                                _8xSample2XOffset;
465910e230b6Smaya   float                                _8xSample3YOffset;
466010e230b6Smaya   float                                _8xSample3XOffset;
466110e230b6Smaya   float                                _4xSample0YOffset;
466210e230b6Smaya   float                                _4xSample0XOffset;
466310e230b6Smaya   float                                _4xSample1YOffset;
466410e230b6Smaya   float                                _4xSample1XOffset;
466510e230b6Smaya   float                                _4xSample2YOffset;
466610e230b6Smaya   float                                _4xSample2XOffset;
466710e230b6Smaya   float                                _4xSample3YOffset;
466810e230b6Smaya   float                                _4xSample3XOffset;
466910e230b6Smaya   float                                _2xSample0YOffset;
467010e230b6Smaya   float                                _2xSample0XOffset;
467110e230b6Smaya   float                                _2xSample1YOffset;
467210e230b6Smaya   float                                _2xSample1XOffset;
467310e230b6Smaya   float                                _1xSample0YOffset;
467410e230b6Smaya   float                                _1xSample0XOffset;
467510e230b6Smaya};
467610e230b6Smaya
467796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
467896c5ddc4SrjsGFX8_3DSTATE_SAMPLE_PATTERN_pack(__attribute__((unused)) __gen_user_data *data,
467910e230b6Smaya                                 __attribute__((unused)) void * restrict dst,
468096c5ddc4Srjs                                 __attribute__((unused)) const struct GFX8_3DSTATE_SAMPLE_PATTERN * restrict values)
468110e230b6Smaya{
468210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
468310e230b6Smaya
468410e230b6Smaya   dw[0] =
468510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
468610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
468710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
468810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
468910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
469010e230b6Smaya
469110e230b6Smaya   dw[1] = 0;
469210e230b6Smaya
469310e230b6Smaya   dw[2] = 0;
469410e230b6Smaya
469510e230b6Smaya   dw[3] = 0;
469610e230b6Smaya
469710e230b6Smaya   dw[4] = 0;
469810e230b6Smaya
469910e230b6Smaya   dw[5] =
470010e230b6Smaya      __gen_ufixed(values->_8xSample4YOffset, 0, 3, 4) |
470110e230b6Smaya      __gen_ufixed(values->_8xSample4XOffset, 4, 7, 4) |
470210e230b6Smaya      __gen_ufixed(values->_8xSample5YOffset, 8, 11, 4) |
470310e230b6Smaya      __gen_ufixed(values->_8xSample5XOffset, 12, 15, 4) |
470410e230b6Smaya      __gen_ufixed(values->_8xSample6YOffset, 16, 19, 4) |
470510e230b6Smaya      __gen_ufixed(values->_8xSample6XOffset, 20, 23, 4) |
470610e230b6Smaya      __gen_ufixed(values->_8xSample7YOffset, 24, 27, 4) |
470710e230b6Smaya      __gen_ufixed(values->_8xSample7XOffset, 28, 31, 4);
470810e230b6Smaya
470910e230b6Smaya   dw[6] =
471010e230b6Smaya      __gen_ufixed(values->_8xSample0YOffset, 0, 3, 4) |
471110e230b6Smaya      __gen_ufixed(values->_8xSample0XOffset, 4, 7, 4) |
471210e230b6Smaya      __gen_ufixed(values->_8xSample1YOffset, 8, 11, 4) |
471310e230b6Smaya      __gen_ufixed(values->_8xSample1XOffset, 12, 15, 4) |
471410e230b6Smaya      __gen_ufixed(values->_8xSample2YOffset, 16, 19, 4) |
471510e230b6Smaya      __gen_ufixed(values->_8xSample2XOffset, 20, 23, 4) |
471610e230b6Smaya      __gen_ufixed(values->_8xSample3YOffset, 24, 27, 4) |
471710e230b6Smaya      __gen_ufixed(values->_8xSample3XOffset, 28, 31, 4);
471810e230b6Smaya
471910e230b6Smaya   dw[7] =
472010e230b6Smaya      __gen_ufixed(values->_4xSample0YOffset, 0, 3, 4) |
472110e230b6Smaya      __gen_ufixed(values->_4xSample0XOffset, 4, 7, 4) |
472210e230b6Smaya      __gen_ufixed(values->_4xSample1YOffset, 8, 11, 4) |
472310e230b6Smaya      __gen_ufixed(values->_4xSample1XOffset, 12, 15, 4) |
472410e230b6Smaya      __gen_ufixed(values->_4xSample2YOffset, 16, 19, 4) |
472510e230b6Smaya      __gen_ufixed(values->_4xSample2XOffset, 20, 23, 4) |
472610e230b6Smaya      __gen_ufixed(values->_4xSample3YOffset, 24, 27, 4) |
472710e230b6Smaya      __gen_ufixed(values->_4xSample3XOffset, 28, 31, 4);
472810e230b6Smaya
472910e230b6Smaya   dw[8] =
473010e230b6Smaya      __gen_ufixed(values->_2xSample0YOffset, 0, 3, 4) |
473110e230b6Smaya      __gen_ufixed(values->_2xSample0XOffset, 4, 7, 4) |
473210e230b6Smaya      __gen_ufixed(values->_2xSample1YOffset, 8, 11, 4) |
473310e230b6Smaya      __gen_ufixed(values->_2xSample1XOffset, 12, 15, 4) |
473410e230b6Smaya      __gen_ufixed(values->_1xSample0YOffset, 16, 19, 4) |
473510e230b6Smaya      __gen_ufixed(values->_1xSample0XOffset, 20, 23, 4);
473610e230b6Smaya}
473710e230b6Smaya
473896c5ddc4Srjs#define GFX8_3DSTATE_SBE_length                4
473996c5ddc4Srjs#define GFX8_3DSTATE_SBE_length_bias           2
474096c5ddc4Srjs#define GFX8_3DSTATE_SBE_header                 \
474110e230b6Smaya   .DWordLength                         =      2,  \
474210e230b6Smaya   ._3DCommandSubOpcode                 =     31,  \
474310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
474410e230b6Smaya   .CommandSubType                      =      3,  \
474510e230b6Smaya   .CommandType                         =      3
474610e230b6Smaya
474796c5ddc4Srjsstruct GFX8_3DSTATE_SBE {
474810e230b6Smaya   uint32_t                             DWordLength;
474910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
475010e230b6Smaya   uint32_t                             _3DCommandOpcode;
475110e230b6Smaya   uint32_t                             CommandSubType;
475210e230b6Smaya   uint32_t                             CommandType;
475310e230b6Smaya   uint32_t                             PrimitiveIDOverrideAttributeSelect;
475410e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
475510e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
475610e230b6Smaya   bool                                 PrimitiveIDOverrideComponentX;
475710e230b6Smaya   bool                                 PrimitiveIDOverrideComponentY;
475810e230b6Smaya   bool                                 PrimitiveIDOverrideComponentZ;
475910e230b6Smaya   bool                                 PrimitiveIDOverrideComponentW;
476010e230b6Smaya   uint32_t                             PointSpriteTextureCoordinateOrigin;
476110e230b6Smaya#define UPPERLEFT                                0
476210e230b6Smaya#define LOWERLEFT                                1
476310e230b6Smaya   bool                                 AttributeSwizzleEnable;
476410e230b6Smaya   uint32_t                             NumberofSFOutputAttributes;
476510e230b6Smaya   bool                                 ForceVertexURBEntryReadOffset;
476610e230b6Smaya   bool                                 ForceVertexURBEntryReadLength;
476710e230b6Smaya   uint32_t                             PointSpriteTextureCoordinateEnable;
476810e230b6Smaya   uint32_t                             ConstantInterpolationEnable;
476910e230b6Smaya};
477010e230b6Smaya
477196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
477296c5ddc4SrjsGFX8_3DSTATE_SBE_pack(__attribute__((unused)) __gen_user_data *data,
477310e230b6Smaya                      __attribute__((unused)) void * restrict dst,
477496c5ddc4Srjs                      __attribute__((unused)) const struct GFX8_3DSTATE_SBE * restrict values)
477510e230b6Smaya{
477610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
477710e230b6Smaya
477810e230b6Smaya   dw[0] =
477910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
478010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
478110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
478210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
478310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
478410e230b6Smaya
478510e230b6Smaya   dw[1] =
478610e230b6Smaya      __gen_uint(values->PrimitiveIDOverrideAttributeSelect, 0, 4) |
478710e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 5, 10) |
478810e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 15) |
478910e230b6Smaya      __gen_uint(values->PrimitiveIDOverrideComponentX, 16, 16) |
479010e230b6Smaya      __gen_uint(values->PrimitiveIDOverrideComponentY, 17, 17) |
479110e230b6Smaya      __gen_uint(values->PrimitiveIDOverrideComponentZ, 18, 18) |
479210e230b6Smaya      __gen_uint(values->PrimitiveIDOverrideComponentW, 19, 19) |
479310e230b6Smaya      __gen_uint(values->PointSpriteTextureCoordinateOrigin, 20, 20) |
479410e230b6Smaya      __gen_uint(values->AttributeSwizzleEnable, 21, 21) |
479510e230b6Smaya      __gen_uint(values->NumberofSFOutputAttributes, 22, 27) |
479610e230b6Smaya      __gen_uint(values->ForceVertexURBEntryReadOffset, 28, 28) |
479710e230b6Smaya      __gen_uint(values->ForceVertexURBEntryReadLength, 29, 29);
479810e230b6Smaya
479910e230b6Smaya   dw[2] =
480010e230b6Smaya      __gen_uint(values->PointSpriteTextureCoordinateEnable, 0, 31);
480110e230b6Smaya
480210e230b6Smaya   dw[3] =
480310e230b6Smaya      __gen_uint(values->ConstantInterpolationEnable, 0, 31);
480410e230b6Smaya}
480510e230b6Smaya
480696c5ddc4Srjs#define GFX8_3DSTATE_SBE_SWIZ_length          11
480796c5ddc4Srjs#define GFX8_3DSTATE_SBE_SWIZ_length_bias      2
480896c5ddc4Srjs#define GFX8_3DSTATE_SBE_SWIZ_header            \
480910e230b6Smaya   .DWordLength                         =      9,  \
481010e230b6Smaya   ._3DCommandSubOpcode                 =     81,  \
481110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
481210e230b6Smaya   .CommandSubType                      =      3,  \
481310e230b6Smaya   .CommandType                         =      3
481410e230b6Smaya
481596c5ddc4Srjsstruct GFX8_3DSTATE_SBE_SWIZ {
481610e230b6Smaya   uint32_t                             DWordLength;
481710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
481810e230b6Smaya   uint32_t                             _3DCommandOpcode;
481910e230b6Smaya   uint32_t                             CommandSubType;
482010e230b6Smaya   uint32_t                             CommandType;
482196c5ddc4Srjs   struct GFX8_SF_OUTPUT_ATTRIBUTE_DETAIL Attribute[16];
482210e230b6Smaya   uint32_t                             AttributeWrapShortestEnables[16];
482310e230b6Smaya};
482410e230b6Smaya
482596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
482696c5ddc4SrjsGFX8_3DSTATE_SBE_SWIZ_pack(__attribute__((unused)) __gen_user_data *data,
482710e230b6Smaya                           __attribute__((unused)) void * restrict dst,
482896c5ddc4Srjs                           __attribute__((unused)) const struct GFX8_3DSTATE_SBE_SWIZ * restrict values)
482910e230b6Smaya{
483010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
483110e230b6Smaya
483210e230b6Smaya   dw[0] =
483310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
483410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
483510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
483610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
483710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
483810e230b6Smaya
483910e230b6Smaya   uint32_t v1_0;
484096c5ddc4Srjs   GFX8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v1_0, &values->Attribute[0]);
484110e230b6Smaya
484210e230b6Smaya   uint32_t v1_1;
484396c5ddc4Srjs   GFX8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v1_1, &values->Attribute[1]);
484410e230b6Smaya
484510e230b6Smaya   dw[1] =
484610e230b6Smaya      __gen_uint(v1_0, 0, 15) |
484710e230b6Smaya      __gen_uint(v1_1, 16, 31);
484810e230b6Smaya
484910e230b6Smaya   uint32_t v2_0;
485096c5ddc4Srjs   GFX8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v2_0, &values->Attribute[2]);
485110e230b6Smaya
485210e230b6Smaya   uint32_t v2_1;
485396c5ddc4Srjs   GFX8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v2_1, &values->Attribute[3]);
485410e230b6Smaya
485510e230b6Smaya   dw[2] =
485610e230b6Smaya      __gen_uint(v2_0, 0, 15) |
485710e230b6Smaya      __gen_uint(v2_1, 16, 31);
485810e230b6Smaya
485910e230b6Smaya   uint32_t v3_0;
486096c5ddc4Srjs   GFX8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v3_0, &values->Attribute[4]);
486110e230b6Smaya
486210e230b6Smaya   uint32_t v3_1;
486396c5ddc4Srjs   GFX8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v3_1, &values->Attribute[5]);
486410e230b6Smaya
486510e230b6Smaya   dw[3] =
486610e230b6Smaya      __gen_uint(v3_0, 0, 15) |
486710e230b6Smaya      __gen_uint(v3_1, 16, 31);
486810e230b6Smaya
486910e230b6Smaya   uint32_t v4_0;
487096c5ddc4Srjs   GFX8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v4_0, &values->Attribute[6]);
487110e230b6Smaya
487210e230b6Smaya   uint32_t v4_1;
487396c5ddc4Srjs   GFX8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v4_1, &values->Attribute[7]);
487410e230b6Smaya
487510e230b6Smaya   dw[4] =
487610e230b6Smaya      __gen_uint(v4_0, 0, 15) |
487710e230b6Smaya      __gen_uint(v4_1, 16, 31);
487810e230b6Smaya
487910e230b6Smaya   uint32_t v5_0;
488096c5ddc4Srjs   GFX8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v5_0, &values->Attribute[8]);
488110e230b6Smaya
488210e230b6Smaya   uint32_t v5_1;
488396c5ddc4Srjs   GFX8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v5_1, &values->Attribute[9]);
488410e230b6Smaya
488510e230b6Smaya   dw[5] =
488610e230b6Smaya      __gen_uint(v5_0, 0, 15) |
488710e230b6Smaya      __gen_uint(v5_1, 16, 31);
488810e230b6Smaya
488910e230b6Smaya   uint32_t v6_0;
489096c5ddc4Srjs   GFX8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v6_0, &values->Attribute[10]);
489110e230b6Smaya
489210e230b6Smaya   uint32_t v6_1;
489396c5ddc4Srjs   GFX8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v6_1, &values->Attribute[11]);
489410e230b6Smaya
489510e230b6Smaya   dw[6] =
489610e230b6Smaya      __gen_uint(v6_0, 0, 15) |
489710e230b6Smaya      __gen_uint(v6_1, 16, 31);
489810e230b6Smaya
489910e230b6Smaya   uint32_t v7_0;
490096c5ddc4Srjs   GFX8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v7_0, &values->Attribute[12]);
490110e230b6Smaya
490210e230b6Smaya   uint32_t v7_1;
490396c5ddc4Srjs   GFX8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v7_1, &values->Attribute[13]);
490410e230b6Smaya
490510e230b6Smaya   dw[7] =
490610e230b6Smaya      __gen_uint(v7_0, 0, 15) |
490710e230b6Smaya      __gen_uint(v7_1, 16, 31);
490810e230b6Smaya
490910e230b6Smaya   uint32_t v8_0;
491096c5ddc4Srjs   GFX8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_0, &values->Attribute[14]);
491110e230b6Smaya
491210e230b6Smaya   uint32_t v8_1;
491396c5ddc4Srjs   GFX8_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_1, &values->Attribute[15]);
491410e230b6Smaya
491510e230b6Smaya   dw[8] =
491610e230b6Smaya      __gen_uint(v8_0, 0, 15) |
491710e230b6Smaya      __gen_uint(v8_1, 16, 31);
491810e230b6Smaya
491910e230b6Smaya   dw[9] =
492010e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[0], 0, 3) |
492110e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[1], 4, 7) |
492210e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[2], 8, 11) |
492310e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[3], 12, 15) |
492410e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[4], 16, 19) |
492510e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[5], 20, 23) |
492610e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[6], 24, 27) |
492710e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[7], 28, 31);
492810e230b6Smaya
492910e230b6Smaya   dw[10] =
493010e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[8], 0, 3) |
493110e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[9], 4, 7) |
493210e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[10], 8, 11) |
493310e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[11], 12, 15) |
493410e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[12], 16, 19) |
493510e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[13], 20, 23) |
493610e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[14], 24, 27) |
493710e230b6Smaya      __gen_uint(values->AttributeWrapShortestEnables[15], 28, 31);
493810e230b6Smaya}
493910e230b6Smaya
494096c5ddc4Srjs#define GFX8_3DSTATE_SCISSOR_STATE_POINTERS_length      2
494196c5ddc4Srjs#define GFX8_3DSTATE_SCISSOR_STATE_POINTERS_length_bias      2
494296c5ddc4Srjs#define GFX8_3DSTATE_SCISSOR_STATE_POINTERS_header\
494310e230b6Smaya   .DWordLength                         =      0,  \
494410e230b6Smaya   ._3DCommandSubOpcode                 =     15,  \
494510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
494610e230b6Smaya   .CommandSubType                      =      3,  \
494710e230b6Smaya   .CommandType                         =      3
494810e230b6Smaya
494996c5ddc4Srjsstruct GFX8_3DSTATE_SCISSOR_STATE_POINTERS {
495010e230b6Smaya   uint32_t                             DWordLength;
495110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
495210e230b6Smaya   uint32_t                             _3DCommandOpcode;
495310e230b6Smaya   uint32_t                             CommandSubType;
495410e230b6Smaya   uint32_t                             CommandType;
495510e230b6Smaya   uint64_t                             ScissorRectPointer;
495610e230b6Smaya};
495710e230b6Smaya
495896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
495996c5ddc4SrjsGFX8_3DSTATE_SCISSOR_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
496010e230b6Smaya                                         __attribute__((unused)) void * restrict dst,
496196c5ddc4Srjs                                         __attribute__((unused)) const struct GFX8_3DSTATE_SCISSOR_STATE_POINTERS * restrict values)
496210e230b6Smaya{
496310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
496410e230b6Smaya
496510e230b6Smaya   dw[0] =
496610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
496710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
496810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
496910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
497010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
497110e230b6Smaya
497210e230b6Smaya   dw[1] =
497310e230b6Smaya      __gen_offset(values->ScissorRectPointer, 5, 31);
497410e230b6Smaya}
497510e230b6Smaya
497696c5ddc4Srjs#define GFX8_3DSTATE_SF_length                 4
497796c5ddc4Srjs#define GFX8_3DSTATE_SF_length_bias            2
497896c5ddc4Srjs#define GFX8_3DSTATE_SF_header                  \
497910e230b6Smaya   .DWordLength                         =      2,  \
498010e230b6Smaya   ._3DCommandSubOpcode                 =     19,  \
498110e230b6Smaya   ._3DCommandOpcode                    =      0,  \
498210e230b6Smaya   .CommandSubType                      =      3,  \
498310e230b6Smaya   .CommandType                         =      3
498410e230b6Smaya
498596c5ddc4Srjsstruct GFX8_3DSTATE_SF {
498610e230b6Smaya   uint32_t                             DWordLength;
498710e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
498810e230b6Smaya   uint32_t                             _3DCommandOpcode;
498910e230b6Smaya   uint32_t                             CommandSubType;
499010e230b6Smaya   uint32_t                             CommandType;
499110e230b6Smaya   bool                                 ViewportTransformEnable;
499210e230b6Smaya   bool                                 StatisticsEnable;
499310e230b6Smaya   bool                                 LegacyGlobalDepthBiasEnable;
499410e230b6Smaya   float                                CHVLineWidth;
499510e230b6Smaya   uint32_t                             LineEndCapAntialiasingRegionWidth;
499610e230b6Smaya#define _05pixels                                0
499710e230b6Smaya#define _10pixels                                1
499810e230b6Smaya#define _20pixels                                2
499910e230b6Smaya#define _40pixels                                3
500010e230b6Smaya   float                                LineWidth;
500110e230b6Smaya   float                                PointWidth;
500210e230b6Smaya   uint32_t                             PointWidthSource;
500310e230b6Smaya#define Vertex                                   0
500410e230b6Smaya#define State                                    1
500510e230b6Smaya   uint32_t                             VertexSubPixelPrecisionSelect;
500610e230b6Smaya#define _8Bit                                    0
500710e230b6Smaya#define _4Bit                                    1
500810e230b6Smaya   bool                                 SmoothPointEnable;
500910e230b6Smaya   uint32_t                             AALineDistanceMode;
501010e230b6Smaya#define AALINEDISTANCE_TRUE                      1
501110e230b6Smaya   uint32_t                             TriangleFanProvokingVertexSelect;
501210e230b6Smaya   uint32_t                             LineStripListProvokingVertexSelect;
501310e230b6Smaya   uint32_t                             TriangleStripListProvokingVertexSelect;
501410e230b6Smaya   bool                                 LastPixelEnable;
501510e230b6Smaya};
501610e230b6Smaya
501796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
501896c5ddc4SrjsGFX8_3DSTATE_SF_pack(__attribute__((unused)) __gen_user_data *data,
501910e230b6Smaya                     __attribute__((unused)) void * restrict dst,
502096c5ddc4Srjs                     __attribute__((unused)) const struct GFX8_3DSTATE_SF * restrict values)
502110e230b6Smaya{
502210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
502310e230b6Smaya
502410e230b6Smaya   dw[0] =
502510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
502610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
502710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
502810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
502910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
503010e230b6Smaya
503110e230b6Smaya   dw[1] =
503210e230b6Smaya      __gen_uint(values->ViewportTransformEnable, 1, 1) |
503310e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
503410e230b6Smaya      __gen_uint(values->LegacyGlobalDepthBiasEnable, 11, 11) |
503510e230b6Smaya      __gen_ufixed(values->CHVLineWidth, 12, 29, 7);
503610e230b6Smaya
503710e230b6Smaya   dw[2] =
503810e230b6Smaya      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 16, 17) |
503910e230b6Smaya      __gen_ufixed(values->LineWidth, 18, 27, 7);
504010e230b6Smaya
504110e230b6Smaya   dw[3] =
504210e230b6Smaya      __gen_ufixed(values->PointWidth, 0, 10, 3) |
504310e230b6Smaya      __gen_uint(values->PointWidthSource, 11, 11) |
504410e230b6Smaya      __gen_uint(values->VertexSubPixelPrecisionSelect, 12, 12) |
504510e230b6Smaya      __gen_uint(values->SmoothPointEnable, 13, 13) |
504610e230b6Smaya      __gen_uint(values->AALineDistanceMode, 14, 14) |
504710e230b6Smaya      __gen_uint(values->TriangleFanProvokingVertexSelect, 25, 26) |
504810e230b6Smaya      __gen_uint(values->LineStripListProvokingVertexSelect, 27, 28) |
504910e230b6Smaya      __gen_uint(values->TriangleStripListProvokingVertexSelect, 29, 30) |
505010e230b6Smaya      __gen_uint(values->LastPixelEnable, 31, 31);
505110e230b6Smaya}
505210e230b6Smaya
505396c5ddc4Srjs#define GFX8_3DSTATE_SO_BUFFER_length          8
505496c5ddc4Srjs#define GFX8_3DSTATE_SO_BUFFER_length_bias      2
505596c5ddc4Srjs#define GFX8_3DSTATE_SO_BUFFER_header           \
505610e230b6Smaya   .DWordLength                         =      6,  \
505710e230b6Smaya   ._3DCommandSubOpcode                 =     24,  \
505810e230b6Smaya   ._3DCommandOpcode                    =      1,  \
505910e230b6Smaya   .CommandSubType                      =      3,  \
506010e230b6Smaya   .CommandType                         =      3
506110e230b6Smaya
506296c5ddc4Srjsstruct GFX8_3DSTATE_SO_BUFFER {
506310e230b6Smaya   uint32_t                             DWordLength;
506410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
506510e230b6Smaya   uint32_t                             _3DCommandOpcode;
506610e230b6Smaya   uint32_t                             CommandSubType;
506710e230b6Smaya   uint32_t                             CommandType;
506810e230b6Smaya   bool                                 StreamOutputBufferOffsetAddressEnable;
506910e230b6Smaya   bool                                 StreamOffsetWriteEnable;
507010e230b6Smaya   uint32_t                             MOCS;
507110e230b6Smaya   uint32_t                             SOBufferIndex;
507210e230b6Smaya   bool                                 SOBufferEnable;
507310e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
507410e230b6Smaya   uint32_t                             SurfaceSize;
507510e230b6Smaya   __gen_address_type                   StreamOutputBufferOffsetAddress;
507610e230b6Smaya   uint32_t                             StreamOffset;
507710e230b6Smaya};
507810e230b6Smaya
507996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
508096c5ddc4SrjsGFX8_3DSTATE_SO_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
508110e230b6Smaya                            __attribute__((unused)) void * restrict dst,
508296c5ddc4Srjs                            __attribute__((unused)) const struct GFX8_3DSTATE_SO_BUFFER * restrict values)
508310e230b6Smaya{
508410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
508510e230b6Smaya
508610e230b6Smaya   dw[0] =
508710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
508810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
508910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
509010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
509110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
509210e230b6Smaya
509310e230b6Smaya   dw[1] =
509410e230b6Smaya      __gen_uint(values->StreamOutputBufferOffsetAddressEnable, 20, 20) |
509510e230b6Smaya      __gen_uint(values->StreamOffsetWriteEnable, 21, 21) |
509610e230b6Smaya      __gen_uint(values->MOCS, 22, 28) |
509710e230b6Smaya      __gen_uint(values->SOBufferIndex, 29, 30) |
509810e230b6Smaya      __gen_uint(values->SOBufferEnable, 31, 31);
509910e230b6Smaya
510010e230b6Smaya   const uint64_t v2_address =
510196c5ddc4Srjs      __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 2, 47);
510210e230b6Smaya   dw[2] = v2_address;
510310e230b6Smaya   dw[3] = v2_address >> 32;
510410e230b6Smaya
510510e230b6Smaya   dw[4] =
510610e230b6Smaya      __gen_uint(values->SurfaceSize, 0, 29);
510710e230b6Smaya
510810e230b6Smaya   const uint64_t v5_address =
510996c5ddc4Srjs      __gen_address(data, &dw[5], values->StreamOutputBufferOffsetAddress, 0, 2, 47);
511010e230b6Smaya   dw[5] = v5_address;
511110e230b6Smaya   dw[6] = v5_address >> 32;
511210e230b6Smaya
511310e230b6Smaya   dw[7] =
511410e230b6Smaya      __gen_uint(values->StreamOffset, 0, 31);
511510e230b6Smaya}
511610e230b6Smaya
511796c5ddc4Srjs#define GFX8_3DSTATE_SO_DECL_LIST_length_bias      2
511896c5ddc4Srjs#define GFX8_3DSTATE_SO_DECL_LIST_header        \
511910e230b6Smaya   ._3DCommandSubOpcode                 =     23,  \
512010e230b6Smaya   ._3DCommandOpcode                    =      1,  \
512110e230b6Smaya   .CommandSubType                      =      3,  \
512210e230b6Smaya   .CommandType                         =      3
512310e230b6Smaya
512496c5ddc4Srjsstruct GFX8_3DSTATE_SO_DECL_LIST {
512510e230b6Smaya   uint32_t                             DWordLength;
512610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
512710e230b6Smaya   uint32_t                             _3DCommandOpcode;
512810e230b6Smaya   uint32_t                             CommandSubType;
512910e230b6Smaya   uint32_t                             CommandType;
513010e230b6Smaya   uint32_t                             StreamtoBufferSelects0;
513110e230b6Smaya   uint32_t                             StreamtoBufferSelects1;
513210e230b6Smaya   uint32_t                             StreamtoBufferSelects2;
513310e230b6Smaya   uint32_t                             StreamtoBufferSelects3;
513410e230b6Smaya   uint32_t                             NumEntries0;
513510e230b6Smaya   uint32_t                             NumEntries1;
513610e230b6Smaya   uint32_t                             NumEntries2;
513710e230b6Smaya   uint32_t                             NumEntries3;
513810e230b6Smaya   /* variable length fields follow */
513910e230b6Smaya};
514010e230b6Smaya
514196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
514296c5ddc4SrjsGFX8_3DSTATE_SO_DECL_LIST_pack(__attribute__((unused)) __gen_user_data *data,
514310e230b6Smaya                               __attribute__((unused)) void * restrict dst,
514496c5ddc4Srjs                               __attribute__((unused)) const struct GFX8_3DSTATE_SO_DECL_LIST * restrict values)
514510e230b6Smaya{
514610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
514710e230b6Smaya
514810e230b6Smaya   dw[0] =
514910e230b6Smaya      __gen_uint(values->DWordLength, 0, 8) |
515010e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
515110e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
515210e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
515310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
515410e230b6Smaya
515510e230b6Smaya   dw[1] =
515610e230b6Smaya      __gen_uint(values->StreamtoBufferSelects0, 0, 3) |
515710e230b6Smaya      __gen_uint(values->StreamtoBufferSelects1, 4, 7) |
515810e230b6Smaya      __gen_uint(values->StreamtoBufferSelects2, 8, 11) |
515910e230b6Smaya      __gen_uint(values->StreamtoBufferSelects3, 12, 15);
516010e230b6Smaya
516110e230b6Smaya   dw[2] =
516210e230b6Smaya      __gen_uint(values->NumEntries0, 0, 7) |
516310e230b6Smaya      __gen_uint(values->NumEntries1, 8, 15) |
516410e230b6Smaya      __gen_uint(values->NumEntries2, 16, 23) |
516510e230b6Smaya      __gen_uint(values->NumEntries3, 24, 31);
516610e230b6Smaya}
516710e230b6Smaya
516896c5ddc4Srjs#define GFX8_3DSTATE_STENCIL_BUFFER_length      5
516996c5ddc4Srjs#define GFX8_3DSTATE_STENCIL_BUFFER_length_bias      2
517096c5ddc4Srjs#define GFX8_3DSTATE_STENCIL_BUFFER_header      \
517110e230b6Smaya   .DWordLength                         =      3,  \
517210e230b6Smaya   ._3DCommandSubOpcode                 =      6,  \
517310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
517410e230b6Smaya   .CommandSubType                      =      3,  \
517510e230b6Smaya   .CommandType                         =      3
517610e230b6Smaya
517796c5ddc4Srjsstruct GFX8_3DSTATE_STENCIL_BUFFER {
517810e230b6Smaya   uint32_t                             DWordLength;
517910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
518010e230b6Smaya   uint32_t                             _3DCommandOpcode;
518110e230b6Smaya   uint32_t                             CommandSubType;
518210e230b6Smaya   uint32_t                             CommandType;
518310e230b6Smaya   uint32_t                             SurfacePitch;
518410e230b6Smaya   uint32_t                             MOCS;
518510e230b6Smaya   bool                                 StencilBufferEnable;
518610e230b6Smaya   __gen_address_type                   SurfaceBaseAddress;
518710e230b6Smaya   uint32_t                             SurfaceQPitch;
518810e230b6Smaya};
518910e230b6Smaya
519096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
519196c5ddc4SrjsGFX8_3DSTATE_STENCIL_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
519210e230b6Smaya                                 __attribute__((unused)) void * restrict dst,
519396c5ddc4Srjs                                 __attribute__((unused)) const struct GFX8_3DSTATE_STENCIL_BUFFER * restrict values)
519410e230b6Smaya{
519510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
519610e230b6Smaya
519710e230b6Smaya   dw[0] =
519810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
519910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
520010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
520110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
520210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
520310e230b6Smaya
520410e230b6Smaya   dw[1] =
520510e230b6Smaya      __gen_uint(values->SurfacePitch, 0, 16) |
520610e230b6Smaya      __gen_uint(values->MOCS, 22, 28) |
520710e230b6Smaya      __gen_uint(values->StencilBufferEnable, 31, 31);
520810e230b6Smaya
520910e230b6Smaya   const uint64_t v2_address =
521096c5ddc4Srjs      __gen_address(data, &dw[2], values->SurfaceBaseAddress, 0, 0, 63);
521110e230b6Smaya   dw[2] = v2_address;
521210e230b6Smaya   dw[3] = v2_address >> 32;
521310e230b6Smaya
521410e230b6Smaya   dw[4] =
521510e230b6Smaya      __gen_uint(values->SurfaceQPitch, 0, 14);
521610e230b6Smaya}
521710e230b6Smaya
521896c5ddc4Srjs#define GFX8_3DSTATE_STREAMOUT_length          5
521996c5ddc4Srjs#define GFX8_3DSTATE_STREAMOUT_length_bias      2
522096c5ddc4Srjs#define GFX8_3DSTATE_STREAMOUT_header           \
522110e230b6Smaya   .DWordLength                         =      3,  \
522210e230b6Smaya   ._3DCommandSubOpcode                 =     30,  \
522310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
522410e230b6Smaya   .CommandSubType                      =      3,  \
522510e230b6Smaya   .CommandType                         =      3
522610e230b6Smaya
522796c5ddc4Srjsstruct GFX8_3DSTATE_STREAMOUT {
522810e230b6Smaya   uint32_t                             DWordLength;
522910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
523010e230b6Smaya   uint32_t                             _3DCommandOpcode;
523110e230b6Smaya   uint32_t                             CommandSubType;
523210e230b6Smaya   uint32_t                             CommandType;
523310e230b6Smaya   uint32_t                             ForceRendering;
523410e230b6Smaya#define Resreved                                 1
523510e230b6Smaya#define Force_Off                                2
523610e230b6Smaya#define Force_on                                 3
523710e230b6Smaya   bool                                 SOStatisticsEnable;
523810e230b6Smaya   uint32_t                             ReorderMode;
523910e230b6Smaya#define LEADING                                  0
524010e230b6Smaya#define TRAILING                                 1
524110e230b6Smaya   uint32_t                             RenderStreamSelect;
524210e230b6Smaya   bool                                 RenderingDisable;
524310e230b6Smaya   bool                                 SOFunctionEnable;
524410e230b6Smaya   uint32_t                             Stream0VertexReadLength;
524510e230b6Smaya   uint32_t                             Stream0VertexReadOffset;
524610e230b6Smaya   uint32_t                             Stream1VertexReadLength;
524710e230b6Smaya   uint32_t                             Stream1VertexReadOffset;
524810e230b6Smaya   uint32_t                             Stream2VertexReadLength;
524910e230b6Smaya   uint32_t                             Stream2VertexReadOffset;
525010e230b6Smaya   uint32_t                             Stream3VertexReadLength;
525110e230b6Smaya   uint32_t                             Stream3VertexReadOffset;
525210e230b6Smaya   uint32_t                             Buffer0SurfacePitch;
525310e230b6Smaya   uint32_t                             Buffer1SurfacePitch;
525410e230b6Smaya   uint32_t                             Buffer2SurfacePitch;
525510e230b6Smaya   uint32_t                             Buffer3SurfacePitch;
525610e230b6Smaya};
525710e230b6Smaya
525896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
525996c5ddc4SrjsGFX8_3DSTATE_STREAMOUT_pack(__attribute__((unused)) __gen_user_data *data,
526010e230b6Smaya                            __attribute__((unused)) void * restrict dst,
526196c5ddc4Srjs                            __attribute__((unused)) const struct GFX8_3DSTATE_STREAMOUT * restrict values)
526210e230b6Smaya{
526310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
526410e230b6Smaya
526510e230b6Smaya   dw[0] =
526610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
526710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
526810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
526910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
527010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
527110e230b6Smaya
527210e230b6Smaya   dw[1] =
527310e230b6Smaya      __gen_uint(values->ForceRendering, 23, 24) |
527410e230b6Smaya      __gen_uint(values->SOStatisticsEnable, 25, 25) |
527510e230b6Smaya      __gen_uint(values->ReorderMode, 26, 26) |
527610e230b6Smaya      __gen_uint(values->RenderStreamSelect, 27, 28) |
527710e230b6Smaya      __gen_uint(values->RenderingDisable, 30, 30) |
527810e230b6Smaya      __gen_uint(values->SOFunctionEnable, 31, 31);
527910e230b6Smaya
528010e230b6Smaya   dw[2] =
528110e230b6Smaya      __gen_uint(values->Stream0VertexReadLength, 0, 4) |
528210e230b6Smaya      __gen_uint(values->Stream0VertexReadOffset, 5, 5) |
528310e230b6Smaya      __gen_uint(values->Stream1VertexReadLength, 8, 12) |
528410e230b6Smaya      __gen_uint(values->Stream1VertexReadOffset, 13, 13) |
528510e230b6Smaya      __gen_uint(values->Stream2VertexReadLength, 16, 20) |
528610e230b6Smaya      __gen_uint(values->Stream2VertexReadOffset, 21, 21) |
528710e230b6Smaya      __gen_uint(values->Stream3VertexReadLength, 24, 28) |
528810e230b6Smaya      __gen_uint(values->Stream3VertexReadOffset, 29, 29);
528910e230b6Smaya
529010e230b6Smaya   dw[3] =
529110e230b6Smaya      __gen_uint(values->Buffer0SurfacePitch, 0, 11) |
529210e230b6Smaya      __gen_uint(values->Buffer1SurfacePitch, 16, 27);
529310e230b6Smaya
529410e230b6Smaya   dw[4] =
529510e230b6Smaya      __gen_uint(values->Buffer2SurfacePitch, 0, 11) |
529610e230b6Smaya      __gen_uint(values->Buffer3SurfacePitch, 16, 27);
529710e230b6Smaya}
529810e230b6Smaya
529996c5ddc4Srjs#define GFX8_3DSTATE_TE_length                 4
530096c5ddc4Srjs#define GFX8_3DSTATE_TE_length_bias            2
530196c5ddc4Srjs#define GFX8_3DSTATE_TE_header                  \
530210e230b6Smaya   .DWordLength                         =      2,  \
530310e230b6Smaya   ._3DCommandSubOpcode                 =     28,  \
530410e230b6Smaya   ._3DCommandOpcode                    =      0,  \
530510e230b6Smaya   .CommandSubType                      =      3,  \
530610e230b6Smaya   .CommandType                         =      3
530710e230b6Smaya
530896c5ddc4Srjsstruct GFX8_3DSTATE_TE {
530910e230b6Smaya   uint32_t                             DWordLength;
531010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
531110e230b6Smaya   uint32_t                             _3DCommandOpcode;
531210e230b6Smaya   uint32_t                             CommandSubType;
531310e230b6Smaya   uint32_t                             CommandType;
531410e230b6Smaya   bool                                 TEEnable;
531510e230b6Smaya   uint32_t                             TEMode;
531610e230b6Smaya#define HW_TESS                                  0
531710e230b6Smaya#define SW_TESS                                  1
531810e230b6Smaya   uint32_t                             TEDomain;
531910e230b6Smaya#define QUAD                                     0
532010e230b6Smaya#define TRI                                      1
532110e230b6Smaya#define ISOLINE                                  2
532210e230b6Smaya   uint32_t                             OutputTopology;
532310e230b6Smaya#define OUTPUT_POINT                             0
532410e230b6Smaya#define OUTPUT_LINE                              1
532510e230b6Smaya#define OUTPUT_TRI_CW                            2
532610e230b6Smaya#define OUTPUT_TRI_CCW                           3
532710e230b6Smaya   uint32_t                             Partitioning;
532810e230b6Smaya#define INTEGER                                  0
532910e230b6Smaya#define ODD_FRACTIONAL                           1
533010e230b6Smaya#define EVEN_FRACTIONAL                          2
533110e230b6Smaya   float                                MaximumTessellationFactorOdd;
533210e230b6Smaya   float                                MaximumTessellationFactorNotOdd;
533310e230b6Smaya};
533410e230b6Smaya
533596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
533696c5ddc4SrjsGFX8_3DSTATE_TE_pack(__attribute__((unused)) __gen_user_data *data,
533710e230b6Smaya                     __attribute__((unused)) void * restrict dst,
533896c5ddc4Srjs                     __attribute__((unused)) const struct GFX8_3DSTATE_TE * restrict values)
533910e230b6Smaya{
534010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
534110e230b6Smaya
534210e230b6Smaya   dw[0] =
534310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
534410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
534510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
534610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
534710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
534810e230b6Smaya
534910e230b6Smaya   dw[1] =
535010e230b6Smaya      __gen_uint(values->TEEnable, 0, 0) |
535110e230b6Smaya      __gen_uint(values->TEMode, 1, 2) |
535210e230b6Smaya      __gen_uint(values->TEDomain, 4, 5) |
535310e230b6Smaya      __gen_uint(values->OutputTopology, 8, 9) |
535410e230b6Smaya      __gen_uint(values->Partitioning, 12, 13);
535510e230b6Smaya
535610e230b6Smaya   dw[2] =
535710e230b6Smaya      __gen_float(values->MaximumTessellationFactorOdd);
535810e230b6Smaya
535910e230b6Smaya   dw[3] =
536010e230b6Smaya      __gen_float(values->MaximumTessellationFactorNotOdd);
536110e230b6Smaya}
536210e230b6Smaya
536396c5ddc4Srjs#define GFX8_3DSTATE_URB_DS_length             2
536496c5ddc4Srjs#define GFX8_3DSTATE_URB_DS_length_bias        2
536596c5ddc4Srjs#define GFX8_3DSTATE_URB_DS_header              \
536610e230b6Smaya   .DWordLength                         =      0,  \
536710e230b6Smaya   ._3DCommandSubOpcode                 =     50,  \
536810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
536910e230b6Smaya   .CommandSubType                      =      3,  \
537010e230b6Smaya   .CommandType                         =      3
537110e230b6Smaya
537296c5ddc4Srjsstruct GFX8_3DSTATE_URB_DS {
537310e230b6Smaya   uint32_t                             DWordLength;
537410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
537510e230b6Smaya   uint32_t                             _3DCommandOpcode;
537610e230b6Smaya   uint32_t                             CommandSubType;
537710e230b6Smaya   uint32_t                             CommandType;
537810e230b6Smaya   uint32_t                             DSNumberofURBEntries;
537910e230b6Smaya   uint32_t                             DSURBEntryAllocationSize;
538010e230b6Smaya   uint32_t                             DSURBStartingAddress;
538110e230b6Smaya};
538210e230b6Smaya
538396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
538496c5ddc4SrjsGFX8_3DSTATE_URB_DS_pack(__attribute__((unused)) __gen_user_data *data,
538510e230b6Smaya                         __attribute__((unused)) void * restrict dst,
538696c5ddc4Srjs                         __attribute__((unused)) const struct GFX8_3DSTATE_URB_DS * restrict values)
538710e230b6Smaya{
538810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
538910e230b6Smaya
539010e230b6Smaya   dw[0] =
539110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
539210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
539310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
539410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
539510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
539610e230b6Smaya
539710e230b6Smaya   dw[1] =
539810e230b6Smaya      __gen_uint(values->DSNumberofURBEntries, 0, 15) |
539910e230b6Smaya      __gen_uint(values->DSURBEntryAllocationSize, 16, 24) |
540010e230b6Smaya      __gen_uint(values->DSURBStartingAddress, 25, 31);
540110e230b6Smaya}
540210e230b6Smaya
540396c5ddc4Srjs#define GFX8_3DSTATE_URB_GS_length             2
540496c5ddc4Srjs#define GFX8_3DSTATE_URB_GS_length_bias        2
540596c5ddc4Srjs#define GFX8_3DSTATE_URB_GS_header              \
540610e230b6Smaya   .DWordLength                         =      0,  \
540710e230b6Smaya   ._3DCommandSubOpcode                 =     51,  \
540810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
540910e230b6Smaya   .CommandSubType                      =      3,  \
541010e230b6Smaya   .CommandType                         =      3
541110e230b6Smaya
541296c5ddc4Srjsstruct GFX8_3DSTATE_URB_GS {
541310e230b6Smaya   uint32_t                             DWordLength;
541410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
541510e230b6Smaya   uint32_t                             _3DCommandOpcode;
541610e230b6Smaya   uint32_t                             CommandSubType;
541710e230b6Smaya   uint32_t                             CommandType;
541810e230b6Smaya   uint32_t                             GSNumberofURBEntries;
541910e230b6Smaya   uint32_t                             GSURBEntryAllocationSize;
542010e230b6Smaya   uint32_t                             GSURBStartingAddress;
542110e230b6Smaya};
542210e230b6Smaya
542396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
542496c5ddc4SrjsGFX8_3DSTATE_URB_GS_pack(__attribute__((unused)) __gen_user_data *data,
542510e230b6Smaya                         __attribute__((unused)) void * restrict dst,
542696c5ddc4Srjs                         __attribute__((unused)) const struct GFX8_3DSTATE_URB_GS * restrict values)
542710e230b6Smaya{
542810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
542910e230b6Smaya
543010e230b6Smaya   dw[0] =
543110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
543210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
543310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
543410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
543510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
543610e230b6Smaya
543710e230b6Smaya   dw[1] =
543810e230b6Smaya      __gen_uint(values->GSNumberofURBEntries, 0, 15) |
543910e230b6Smaya      __gen_uint(values->GSURBEntryAllocationSize, 16, 24) |
544010e230b6Smaya      __gen_uint(values->GSURBStartingAddress, 25, 31);
544110e230b6Smaya}
544210e230b6Smaya
544396c5ddc4Srjs#define GFX8_3DSTATE_URB_HS_length             2
544496c5ddc4Srjs#define GFX8_3DSTATE_URB_HS_length_bias        2
544596c5ddc4Srjs#define GFX8_3DSTATE_URB_HS_header              \
544610e230b6Smaya   .DWordLength                         =      0,  \
544710e230b6Smaya   ._3DCommandSubOpcode                 =     49,  \
544810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
544910e230b6Smaya   .CommandSubType                      =      3,  \
545010e230b6Smaya   .CommandType                         =      3
545110e230b6Smaya
545296c5ddc4Srjsstruct GFX8_3DSTATE_URB_HS {
545310e230b6Smaya   uint32_t                             DWordLength;
545410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
545510e230b6Smaya   uint32_t                             _3DCommandOpcode;
545610e230b6Smaya   uint32_t                             CommandSubType;
545710e230b6Smaya   uint32_t                             CommandType;
545810e230b6Smaya   uint32_t                             HSNumberofURBEntries;
545910e230b6Smaya   uint32_t                             HSURBEntryAllocationSize;
546010e230b6Smaya   uint32_t                             HSURBStartingAddress;
546110e230b6Smaya};
546210e230b6Smaya
546396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
546496c5ddc4SrjsGFX8_3DSTATE_URB_HS_pack(__attribute__((unused)) __gen_user_data *data,
546510e230b6Smaya                         __attribute__((unused)) void * restrict dst,
546696c5ddc4Srjs                         __attribute__((unused)) const struct GFX8_3DSTATE_URB_HS * restrict values)
546710e230b6Smaya{
546810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
546910e230b6Smaya
547010e230b6Smaya   dw[0] =
547110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
547210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
547310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
547410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
547510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
547610e230b6Smaya
547710e230b6Smaya   dw[1] =
547810e230b6Smaya      __gen_uint(values->HSNumberofURBEntries, 0, 15) |
547910e230b6Smaya      __gen_uint(values->HSURBEntryAllocationSize, 16, 24) |
548010e230b6Smaya      __gen_uint(values->HSURBStartingAddress, 25, 31);
548110e230b6Smaya}
548210e230b6Smaya
548396c5ddc4Srjs#define GFX8_3DSTATE_URB_VS_length             2
548496c5ddc4Srjs#define GFX8_3DSTATE_URB_VS_length_bias        2
548596c5ddc4Srjs#define GFX8_3DSTATE_URB_VS_header              \
548610e230b6Smaya   .DWordLength                         =      0,  \
548710e230b6Smaya   ._3DCommandSubOpcode                 =     48,  \
548810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
548910e230b6Smaya   .CommandSubType                      =      3,  \
549010e230b6Smaya   .CommandType                         =      3
549110e230b6Smaya
549296c5ddc4Srjsstruct GFX8_3DSTATE_URB_VS {
549310e230b6Smaya   uint32_t                             DWordLength;
549410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
549510e230b6Smaya   uint32_t                             _3DCommandOpcode;
549610e230b6Smaya   uint32_t                             CommandSubType;
549710e230b6Smaya   uint32_t                             CommandType;
549810e230b6Smaya   uint32_t                             VSNumberofURBEntries;
549910e230b6Smaya   uint32_t                             VSURBEntryAllocationSize;
550010e230b6Smaya   uint32_t                             VSURBStartingAddress;
550110e230b6Smaya};
550210e230b6Smaya
550396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
550496c5ddc4SrjsGFX8_3DSTATE_URB_VS_pack(__attribute__((unused)) __gen_user_data *data,
550510e230b6Smaya                         __attribute__((unused)) void * restrict dst,
550696c5ddc4Srjs                         __attribute__((unused)) const struct GFX8_3DSTATE_URB_VS * restrict values)
550710e230b6Smaya{
550810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
550910e230b6Smaya
551010e230b6Smaya   dw[0] =
551110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
551210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
551310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
551410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
551510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
551610e230b6Smaya
551710e230b6Smaya   dw[1] =
551810e230b6Smaya      __gen_uint(values->VSNumberofURBEntries, 0, 15) |
551910e230b6Smaya      __gen_uint(values->VSURBEntryAllocationSize, 16, 24) |
552010e230b6Smaya      __gen_uint(values->VSURBStartingAddress, 25, 31);
552110e230b6Smaya}
552210e230b6Smaya
552396c5ddc4Srjs#define GFX8_3DSTATE_VERTEX_BUFFERS_length_bias      2
552496c5ddc4Srjs#define GFX8_3DSTATE_VERTEX_BUFFERS_header      \
552510e230b6Smaya   .DWordLength                         =      3,  \
552610e230b6Smaya   ._3DCommandSubOpcode                 =      8,  \
552710e230b6Smaya   ._3DCommandOpcode                    =      0,  \
552810e230b6Smaya   .CommandSubType                      =      3,  \
552910e230b6Smaya   .CommandType                         =      3
553010e230b6Smaya
553196c5ddc4Srjsstruct GFX8_3DSTATE_VERTEX_BUFFERS {
553210e230b6Smaya   uint32_t                             DWordLength;
553310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
553410e230b6Smaya   uint32_t                             _3DCommandOpcode;
553510e230b6Smaya   uint32_t                             CommandSubType;
553610e230b6Smaya   uint32_t                             CommandType;
553710e230b6Smaya   /* variable length fields follow */
553810e230b6Smaya};
553910e230b6Smaya
554096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
554196c5ddc4SrjsGFX8_3DSTATE_VERTEX_BUFFERS_pack(__attribute__((unused)) __gen_user_data *data,
554210e230b6Smaya                                 __attribute__((unused)) void * restrict dst,
554396c5ddc4Srjs                                 __attribute__((unused)) const struct GFX8_3DSTATE_VERTEX_BUFFERS * restrict values)
554410e230b6Smaya{
554510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
554610e230b6Smaya
554710e230b6Smaya   dw[0] =
554810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
554910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
555010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
555110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
555210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
555310e230b6Smaya}
555410e230b6Smaya
555596c5ddc4Srjs#define GFX8_3DSTATE_VERTEX_ELEMENTS_length_bias      2
555696c5ddc4Srjs#define GFX8_3DSTATE_VERTEX_ELEMENTS_header     \
555710e230b6Smaya   .DWordLength                         =      1,  \
555810e230b6Smaya   ._3DCommandSubOpcode                 =      9,  \
555910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
556010e230b6Smaya   .CommandSubType                      =      3,  \
556110e230b6Smaya   .CommandType                         =      3
556210e230b6Smaya
556396c5ddc4Srjsstruct GFX8_3DSTATE_VERTEX_ELEMENTS {
556410e230b6Smaya   uint32_t                             DWordLength;
556510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
556610e230b6Smaya   uint32_t                             _3DCommandOpcode;
556710e230b6Smaya   uint32_t                             CommandSubType;
556810e230b6Smaya   uint32_t                             CommandType;
556910e230b6Smaya   /* variable length fields follow */
557010e230b6Smaya};
557110e230b6Smaya
557296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
557396c5ddc4SrjsGFX8_3DSTATE_VERTEX_ELEMENTS_pack(__attribute__((unused)) __gen_user_data *data,
557410e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
557596c5ddc4Srjs                                  __attribute__((unused)) const struct GFX8_3DSTATE_VERTEX_ELEMENTS * restrict values)
557610e230b6Smaya{
557710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
557810e230b6Smaya
557910e230b6Smaya   dw[0] =
558010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
558110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
558210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
558310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
558410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
558510e230b6Smaya}
558610e230b6Smaya
558796c5ddc4Srjs#define GFX8_3DSTATE_VF_length                 2
558896c5ddc4Srjs#define GFX8_3DSTATE_VF_length_bias            2
558996c5ddc4Srjs#define GFX8_3DSTATE_VF_header                  \
559010e230b6Smaya   .DWordLength                         =      0,  \
559110e230b6Smaya   ._3DCommandSubOpcode                 =     12,  \
559210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
559310e230b6Smaya   .CommandSubType                      =      3,  \
559410e230b6Smaya   .CommandType                         =      3
559510e230b6Smaya
559696c5ddc4Srjsstruct GFX8_3DSTATE_VF {
559710e230b6Smaya   uint32_t                             DWordLength;
559810e230b6Smaya   bool                                 IndexedDrawCutIndexEnable;
559910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
560010e230b6Smaya   uint32_t                             _3DCommandOpcode;
560110e230b6Smaya   uint32_t                             CommandSubType;
560210e230b6Smaya   uint32_t                             CommandType;
560310e230b6Smaya   uint32_t                             CutIndex;
560410e230b6Smaya};
560510e230b6Smaya
560696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
560796c5ddc4SrjsGFX8_3DSTATE_VF_pack(__attribute__((unused)) __gen_user_data *data,
560810e230b6Smaya                     __attribute__((unused)) void * restrict dst,
560996c5ddc4Srjs                     __attribute__((unused)) const struct GFX8_3DSTATE_VF * restrict values)
561010e230b6Smaya{
561110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
561210e230b6Smaya
561310e230b6Smaya   dw[0] =
561410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
561510e230b6Smaya      __gen_uint(values->IndexedDrawCutIndexEnable, 8, 8) |
561610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
561710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
561810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
561910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
562010e230b6Smaya
562110e230b6Smaya   dw[1] =
562210e230b6Smaya      __gen_uint(values->CutIndex, 0, 31);
562310e230b6Smaya}
562410e230b6Smaya
562596c5ddc4Srjs#define GFX8_3DSTATE_VF_INSTANCING_length      3
562696c5ddc4Srjs#define GFX8_3DSTATE_VF_INSTANCING_length_bias      2
562796c5ddc4Srjs#define GFX8_3DSTATE_VF_INSTANCING_header       \
562810e230b6Smaya   .DWordLength                         =      1,  \
562910e230b6Smaya   ._3DCommandSubOpcode                 =     73,  \
563010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
563110e230b6Smaya   .CommandSubType                      =      3,  \
563210e230b6Smaya   .CommandType                         =      3
563310e230b6Smaya
563496c5ddc4Srjsstruct GFX8_3DSTATE_VF_INSTANCING {
563510e230b6Smaya   uint32_t                             DWordLength;
563610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
563710e230b6Smaya   uint32_t                             _3DCommandOpcode;
563810e230b6Smaya   uint32_t                             CommandSubType;
563910e230b6Smaya   uint32_t                             CommandType;
564010e230b6Smaya   uint32_t                             VertexElementIndex;
564110e230b6Smaya   bool                                 InstancingEnable;
564210e230b6Smaya   uint32_t                             InstanceDataStepRate;
564310e230b6Smaya};
564410e230b6Smaya
564596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
564696c5ddc4SrjsGFX8_3DSTATE_VF_INSTANCING_pack(__attribute__((unused)) __gen_user_data *data,
564710e230b6Smaya                                __attribute__((unused)) void * restrict dst,
564896c5ddc4Srjs                                __attribute__((unused)) const struct GFX8_3DSTATE_VF_INSTANCING * restrict values)
564910e230b6Smaya{
565010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
565110e230b6Smaya
565210e230b6Smaya   dw[0] =
565310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
565410e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
565510e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
565610e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
565710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
565810e230b6Smaya
565910e230b6Smaya   dw[1] =
566010e230b6Smaya      __gen_uint(values->VertexElementIndex, 0, 5) |
566110e230b6Smaya      __gen_uint(values->InstancingEnable, 8, 8);
566210e230b6Smaya
566310e230b6Smaya   dw[2] =
566410e230b6Smaya      __gen_uint(values->InstanceDataStepRate, 0, 31);
566510e230b6Smaya}
566610e230b6Smaya
566796c5ddc4Srjs#define GFX8_3DSTATE_VF_SGVS_length            2
566896c5ddc4Srjs#define GFX8_3DSTATE_VF_SGVS_length_bias       2
566996c5ddc4Srjs#define GFX8_3DSTATE_VF_SGVS_header             \
567010e230b6Smaya   .DWordLength                         =      0,  \
567110e230b6Smaya   ._3DCommandSubOpcode                 =     74,  \
567210e230b6Smaya   ._3DCommandOpcode                    =      0,  \
567310e230b6Smaya   .CommandSubType                      =      3,  \
567410e230b6Smaya   .CommandType                         =      3
567510e230b6Smaya
567696c5ddc4Srjsstruct GFX8_3DSTATE_VF_SGVS {
567710e230b6Smaya   uint32_t                             DWordLength;
567810e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
567910e230b6Smaya   uint32_t                             _3DCommandOpcode;
568010e230b6Smaya   uint32_t                             CommandSubType;
568110e230b6Smaya   uint32_t                             CommandType;
568210e230b6Smaya   uint32_t                             VertexIDElementOffset;
568310e230b6Smaya   uint32_t                             VertexIDComponentNumber;
568410e230b6Smaya#define COMP_0                                   0
568510e230b6Smaya#define COMP_1                                   1
568610e230b6Smaya#define COMP_2                                   2
568710e230b6Smaya#define COMP_3                                   3
568810e230b6Smaya   bool                                 VertexIDEnable;
568910e230b6Smaya   uint32_t                             InstanceIDElementOffset;
569010e230b6Smaya   uint32_t                             InstanceIDComponentNumber;
569110e230b6Smaya#define COMP_0                                   0
569210e230b6Smaya#define COMP_1                                   1
569310e230b6Smaya#define COMP_2                                   2
569410e230b6Smaya#define COMP_3                                   3
569510e230b6Smaya   bool                                 InstanceIDEnable;
569610e230b6Smaya};
569710e230b6Smaya
569896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
569996c5ddc4SrjsGFX8_3DSTATE_VF_SGVS_pack(__attribute__((unused)) __gen_user_data *data,
570010e230b6Smaya                          __attribute__((unused)) void * restrict dst,
570196c5ddc4Srjs                          __attribute__((unused)) const struct GFX8_3DSTATE_VF_SGVS * restrict values)
570210e230b6Smaya{
570310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
570410e230b6Smaya
570510e230b6Smaya   dw[0] =
570610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
570710e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
570810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
570910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
571010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
571110e230b6Smaya
571210e230b6Smaya   dw[1] =
571310e230b6Smaya      __gen_uint(values->VertexIDElementOffset, 0, 5) |
571410e230b6Smaya      __gen_uint(values->VertexIDComponentNumber, 13, 14) |
571510e230b6Smaya      __gen_uint(values->VertexIDEnable, 15, 15) |
571610e230b6Smaya      __gen_uint(values->InstanceIDElementOffset, 16, 21) |
571710e230b6Smaya      __gen_uint(values->InstanceIDComponentNumber, 29, 30) |
571810e230b6Smaya      __gen_uint(values->InstanceIDEnable, 31, 31);
571910e230b6Smaya}
572010e230b6Smaya
572196c5ddc4Srjs#define GFX8_3DSTATE_VF_STATISTICS_length      1
572296c5ddc4Srjs#define GFX8_3DSTATE_VF_STATISTICS_length_bias      1
572396c5ddc4Srjs#define GFX8_3DSTATE_VF_STATISTICS_header       \
572410e230b6Smaya   ._3DCommandSubOpcode                 =     11,  \
572510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
572610e230b6Smaya   .CommandSubType                      =      1,  \
572710e230b6Smaya   .CommandType                         =      3
572810e230b6Smaya
572996c5ddc4Srjsstruct GFX8_3DSTATE_VF_STATISTICS {
573010e230b6Smaya   bool                                 StatisticsEnable;
573110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
573210e230b6Smaya   uint32_t                             _3DCommandOpcode;
573310e230b6Smaya   uint32_t                             CommandSubType;
573410e230b6Smaya   uint32_t                             CommandType;
573510e230b6Smaya};
573610e230b6Smaya
573796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
573896c5ddc4SrjsGFX8_3DSTATE_VF_STATISTICS_pack(__attribute__((unused)) __gen_user_data *data,
573910e230b6Smaya                                __attribute__((unused)) void * restrict dst,
574096c5ddc4Srjs                                __attribute__((unused)) const struct GFX8_3DSTATE_VF_STATISTICS * restrict values)
574110e230b6Smaya{
574210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
574310e230b6Smaya
574410e230b6Smaya   dw[0] =
574510e230b6Smaya      __gen_uint(values->StatisticsEnable, 0, 0) |
574610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
574710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
574810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
574910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
575010e230b6Smaya}
575110e230b6Smaya
575296c5ddc4Srjs#define GFX8_3DSTATE_VF_TOPOLOGY_length        2
575396c5ddc4Srjs#define GFX8_3DSTATE_VF_TOPOLOGY_length_bias      2
575496c5ddc4Srjs#define GFX8_3DSTATE_VF_TOPOLOGY_header         \
575510e230b6Smaya   .DWordLength                         =      0,  \
575610e230b6Smaya   ._3DCommandSubOpcode                 =     75,  \
575710e230b6Smaya   ._3DCommandOpcode                    =      0,  \
575810e230b6Smaya   .CommandSubType                      =      3,  \
575910e230b6Smaya   .CommandType                         =      3
576010e230b6Smaya
576196c5ddc4Srjsstruct GFX8_3DSTATE_VF_TOPOLOGY {
576210e230b6Smaya   uint32_t                             DWordLength;
576310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
576410e230b6Smaya   uint32_t                             _3DCommandOpcode;
576510e230b6Smaya   uint32_t                             CommandSubType;
576610e230b6Smaya   uint32_t                             CommandType;
576796c5ddc4Srjs   enum GFX8_3D_Prim_Topo_Type          PrimitiveTopologyType;
576810e230b6Smaya};
576910e230b6Smaya
577096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
577196c5ddc4SrjsGFX8_3DSTATE_VF_TOPOLOGY_pack(__attribute__((unused)) __gen_user_data *data,
577210e230b6Smaya                              __attribute__((unused)) void * restrict dst,
577396c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_3DSTATE_VF_TOPOLOGY * restrict values)
577410e230b6Smaya{
577510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
577610e230b6Smaya
577710e230b6Smaya   dw[0] =
577810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
577910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
578010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
578110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
578210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
578310e230b6Smaya
578410e230b6Smaya   dw[1] =
578510e230b6Smaya      __gen_uint(values->PrimitiveTopologyType, 0, 5);
578610e230b6Smaya}
578710e230b6Smaya
578896c5ddc4Srjs#define GFX8_3DSTATE_VIEWPORT_STATE_POINTERS_CC_length      2
578996c5ddc4Srjs#define GFX8_3DSTATE_VIEWPORT_STATE_POINTERS_CC_length_bias      2
579096c5ddc4Srjs#define GFX8_3DSTATE_VIEWPORT_STATE_POINTERS_CC_header\
579110e230b6Smaya   .DWordLength                         =      0,  \
579210e230b6Smaya   ._3DCommandSubOpcode                 =     35,  \
579310e230b6Smaya   ._3DCommandOpcode                    =      0,  \
579410e230b6Smaya   .CommandSubType                      =      3,  \
579510e230b6Smaya   .CommandType                         =      3
579610e230b6Smaya
579796c5ddc4Srjsstruct GFX8_3DSTATE_VIEWPORT_STATE_POINTERS_CC {
579810e230b6Smaya   uint32_t                             DWordLength;
579910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
580010e230b6Smaya   uint32_t                             _3DCommandOpcode;
580110e230b6Smaya   uint32_t                             CommandSubType;
580210e230b6Smaya   uint32_t                             CommandType;
580310e230b6Smaya   uint64_t                             CCViewportPointer;
580410e230b6Smaya};
580510e230b6Smaya
580696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
580796c5ddc4SrjsGFX8_3DSTATE_VIEWPORT_STATE_POINTERS_CC_pack(__attribute__((unused)) __gen_user_data *data,
580810e230b6Smaya                                             __attribute__((unused)) void * restrict dst,
580996c5ddc4Srjs                                             __attribute__((unused)) const struct GFX8_3DSTATE_VIEWPORT_STATE_POINTERS_CC * restrict values)
581010e230b6Smaya{
581110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
581210e230b6Smaya
581310e230b6Smaya   dw[0] =
581410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
581510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
581610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
581710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
581810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
581910e230b6Smaya
582010e230b6Smaya   dw[1] =
582110e230b6Smaya      __gen_offset(values->CCViewportPointer, 5, 31);
582210e230b6Smaya}
582310e230b6Smaya
582496c5ddc4Srjs#define GFX8_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_length      2
582596c5ddc4Srjs#define GFX8_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_length_bias      2
582696c5ddc4Srjs#define GFX8_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_header\
582710e230b6Smaya   .DWordLength                         =      0,  \
582810e230b6Smaya   ._3DCommandSubOpcode                 =     33,  \
582910e230b6Smaya   ._3DCommandOpcode                    =      0,  \
583010e230b6Smaya   .CommandSubType                      =      3,  \
583110e230b6Smaya   .CommandType                         =      3
583210e230b6Smaya
583396c5ddc4Srjsstruct GFX8_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP {
583410e230b6Smaya   uint32_t                             DWordLength;
583510e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
583610e230b6Smaya   uint32_t                             _3DCommandOpcode;
583710e230b6Smaya   uint32_t                             CommandSubType;
583810e230b6Smaya   uint32_t                             CommandType;
583910e230b6Smaya   uint64_t                             SFClipViewportPointer;
584010e230b6Smaya};
584110e230b6Smaya
584296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
584396c5ddc4SrjsGFX8_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
584410e230b6Smaya                                                  __attribute__((unused)) void * restrict dst,
584596c5ddc4Srjs                                                  __attribute__((unused)) const struct GFX8_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP * restrict values)
584610e230b6Smaya{
584710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
584810e230b6Smaya
584910e230b6Smaya   dw[0] =
585010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
585110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
585210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
585310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
585410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
585510e230b6Smaya
585610e230b6Smaya   dw[1] =
585710e230b6Smaya      __gen_offset(values->SFClipViewportPointer, 6, 31);
585810e230b6Smaya}
585910e230b6Smaya
586096c5ddc4Srjs#define GFX8_3DSTATE_VS_length                 9
586196c5ddc4Srjs#define GFX8_3DSTATE_VS_length_bias            2
586296c5ddc4Srjs#define GFX8_3DSTATE_VS_header                  \
586310e230b6Smaya   .DWordLength                         =      7,  \
586410e230b6Smaya   ._3DCommandSubOpcode                 =     16,  \
586510e230b6Smaya   ._3DCommandOpcode                    =      0,  \
586610e230b6Smaya   .CommandSubType                      =      3,  \
586710e230b6Smaya   .CommandType                         =      3
586810e230b6Smaya
586996c5ddc4Srjsstruct GFX8_3DSTATE_VS {
587010e230b6Smaya   uint32_t                             DWordLength;
587110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
587210e230b6Smaya   uint32_t                             _3DCommandOpcode;
587310e230b6Smaya   uint32_t                             CommandSubType;
587410e230b6Smaya   uint32_t                             CommandType;
587510e230b6Smaya   uint64_t                             KernelStartPointer;
587610e230b6Smaya   bool                                 SoftwareExceptionEnable;
587710e230b6Smaya   bool                                 AccessesUAV;
587810e230b6Smaya   bool                                 IllegalOpcodeExceptionEnable;
587910e230b6Smaya   uint32_t                             FloatingPointMode;
588010e230b6Smaya#define IEEE754                                  0
588110e230b6Smaya#define Alternate                                1
588210e230b6Smaya   uint32_t                             ThreadDispatchPriority;
588310e230b6Smaya#define High                                     1
588410e230b6Smaya   uint32_t                             BindingTableEntryCount;
588510e230b6Smaya   uint32_t                             SamplerCount;
588610e230b6Smaya#define NoSamplers                               0
588710e230b6Smaya#define _14Samplers                              1
588810e230b6Smaya#define _58Samplers                              2
588910e230b6Smaya#define _912Samplers                             3
589010e230b6Smaya#define _1316Samplers                            4
589110e230b6Smaya   bool                                 VectorMaskEnable;
589210e230b6Smaya   bool                                 SingleVertexDispatch;
589310e230b6Smaya   uint32_t                             PerThreadScratchSpace;
589410e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
589510e230b6Smaya   uint32_t                             VertexURBEntryReadOffset;
589610e230b6Smaya   uint32_t                             VertexURBEntryReadLength;
589710e230b6Smaya   uint32_t                             DispatchGRFStartRegisterForURBData;
589810e230b6Smaya   bool                                 Enable;
589910e230b6Smaya   bool                                 VertexCacheDisable;
590010e230b6Smaya   bool                                 SIMD8DispatchEnable;
590110e230b6Smaya   bool                                 StatisticsEnable;
590210e230b6Smaya   uint32_t                             MaximumNumberofThreads;
590310e230b6Smaya   uint32_t                             UserClipDistanceCullTestEnableBitmask;
590410e230b6Smaya   uint32_t                             UserClipDistanceClipTestEnableBitmask;
590510e230b6Smaya   uint32_t                             VertexURBEntryOutputLength;
590610e230b6Smaya   uint32_t                             VertexURBEntryOutputReadOffset;
590710e230b6Smaya};
590810e230b6Smaya
590996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
591096c5ddc4SrjsGFX8_3DSTATE_VS_pack(__attribute__((unused)) __gen_user_data *data,
591110e230b6Smaya                     __attribute__((unused)) void * restrict dst,
591296c5ddc4Srjs                     __attribute__((unused)) const struct GFX8_3DSTATE_VS * restrict values)
591310e230b6Smaya{
591410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
591510e230b6Smaya
591610e230b6Smaya   dw[0] =
591710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
591810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
591910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
592010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
592110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
592210e230b6Smaya
592310e230b6Smaya   const uint64_t v1 =
592410e230b6Smaya      __gen_offset(values->KernelStartPointer, 6, 63);
592510e230b6Smaya   dw[1] = v1;
592610e230b6Smaya   dw[2] = v1 >> 32;
592710e230b6Smaya
592810e230b6Smaya   dw[3] =
592910e230b6Smaya      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
593010e230b6Smaya      __gen_uint(values->AccessesUAV, 12, 12) |
593110e230b6Smaya      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
593210e230b6Smaya      __gen_uint(values->FloatingPointMode, 16, 16) |
593310e230b6Smaya      __gen_uint(values->ThreadDispatchPriority, 17, 17) |
593410e230b6Smaya      __gen_uint(values->BindingTableEntryCount, 18, 25) |
593510e230b6Smaya      __gen_uint(values->SamplerCount, 27, 29) |
593610e230b6Smaya      __gen_uint(values->VectorMaskEnable, 30, 30) |
593710e230b6Smaya      __gen_uint(values->SingleVertexDispatch, 31, 31);
593810e230b6Smaya
593910e230b6Smaya   const uint64_t v4 =
594010e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3);
594110e230b6Smaya   const uint64_t v4_address =
594296c5ddc4Srjs      __gen_address(data, &dw[4], values->ScratchSpaceBasePointer, v4, 10, 63);
594310e230b6Smaya   dw[4] = v4_address;
594410e230b6Smaya   dw[5] = (v4_address >> 32) | (v4 >> 32);
594510e230b6Smaya
594610e230b6Smaya   dw[6] =
594710e230b6Smaya      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
594810e230b6Smaya      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
594910e230b6Smaya      __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
595010e230b6Smaya
595110e230b6Smaya   dw[7] =
595210e230b6Smaya      __gen_uint(values->Enable, 0, 0) |
595310e230b6Smaya      __gen_uint(values->VertexCacheDisable, 1, 1) |
595410e230b6Smaya      __gen_uint(values->SIMD8DispatchEnable, 2, 2) |
595510e230b6Smaya      __gen_uint(values->StatisticsEnable, 10, 10) |
595610e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 23, 31);
595710e230b6Smaya
595810e230b6Smaya   dw[8] =
595910e230b6Smaya      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
596010e230b6Smaya      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 8, 15) |
596110e230b6Smaya      __gen_uint(values->VertexURBEntryOutputLength, 16, 20) |
596210e230b6Smaya      __gen_uint(values->VertexURBEntryOutputReadOffset, 21, 26);
596310e230b6Smaya}
596410e230b6Smaya
596596c5ddc4Srjs#define GFX8_3DSTATE_WM_length                 2
596696c5ddc4Srjs#define GFX8_3DSTATE_WM_length_bias            2
596796c5ddc4Srjs#define GFX8_3DSTATE_WM_header                  \
596810e230b6Smaya   .DWordLength                         =      0,  \
596910e230b6Smaya   ._3DCommandSubOpcode                 =     20,  \
597010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
597110e230b6Smaya   .CommandSubType                      =      3,  \
597210e230b6Smaya   .CommandType                         =      3
597310e230b6Smaya
597496c5ddc4Srjsstruct GFX8_3DSTATE_WM {
597510e230b6Smaya   uint32_t                             DWordLength;
597610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
597710e230b6Smaya   uint32_t                             _3DCommandOpcode;
597810e230b6Smaya   uint32_t                             CommandSubType;
597910e230b6Smaya   uint32_t                             CommandType;
598010e230b6Smaya   uint32_t                             ForceKillPixelEnable;
598110e230b6Smaya#define ForceOff                                 1
598210e230b6Smaya#define ForceON                                  2
598310e230b6Smaya   uint32_t                             PointRasterizationRule;
598410e230b6Smaya#define RASTRULE_UPPER_LEFT                      0
598510e230b6Smaya#define RASTRULE_UPPER_RIGHT                     1
598610e230b6Smaya   bool                                 LineStippleEnable;
598710e230b6Smaya   bool                                 PolygonStippleEnable;
598810e230b6Smaya   uint32_t                             LineAntialiasingRegionWidth;
598910e230b6Smaya#define _05pixels                                0
599010e230b6Smaya#define _10pixels                                1
599110e230b6Smaya#define _20pixels                                2
599210e230b6Smaya#define _40pixels                                3
599310e230b6Smaya   uint32_t                             LineEndCapAntialiasingRegionWidth;
599410e230b6Smaya#define _05pixels                                0
599510e230b6Smaya#define _10pixels                                1
599610e230b6Smaya#define _20pixels                                2
599710e230b6Smaya#define _40pixels                                3
599810e230b6Smaya   uint32_t                             BarycentricInterpolationMode;
599910e230b6Smaya#define BIM_PERSPECTIVE_PIXEL                    1
600010e230b6Smaya#define BIM_PERSPECTIVE_CENTROID                 2
600110e230b6Smaya#define BIM_PERSPECTIVE_SAMPLE                   4
600210e230b6Smaya#define BIM_LINEAR_PIXEL                         8
600310e230b6Smaya#define BIM_LINEAR_CENTROID                      16
600410e230b6Smaya#define BIM_LINEAR_SAMPLE                        32
600510e230b6Smaya   uint32_t                             PositionZWInterpolationMode;
600610e230b6Smaya#define INTERP_PIXEL                             0
600710e230b6Smaya#define INTERP_CENTROID                          2
600810e230b6Smaya#define INTERP_SAMPLE                            3
600910e230b6Smaya   uint32_t                             ForceThreadDispatchEnable;
601010e230b6Smaya#define ForceOff                                 1
601110e230b6Smaya#define ForceON                                  2
601210e230b6Smaya   uint32_t                             EarlyDepthStencilControl;
601310e230b6Smaya#define EDSC_NORMAL                              0
601410e230b6Smaya#define EDSC_PSEXEC                              1
601510e230b6Smaya#define EDSC_PREPS                               2
601610e230b6Smaya   bool                                 LegacyDiamondLineRasterization;
601710e230b6Smaya   bool                                 LegacyHierarchicalDepthBufferResolveEnable;
601810e230b6Smaya   bool                                 LegacyDepthBufferResolveEnable;
601910e230b6Smaya   bool                                 LegacyDepthBufferClearEnable;
602010e230b6Smaya   bool                                 StatisticsEnable;
602110e230b6Smaya};
602210e230b6Smaya
602396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
602496c5ddc4SrjsGFX8_3DSTATE_WM_pack(__attribute__((unused)) __gen_user_data *data,
602510e230b6Smaya                     __attribute__((unused)) void * restrict dst,
602696c5ddc4Srjs                     __attribute__((unused)) const struct GFX8_3DSTATE_WM * restrict values)
602710e230b6Smaya{
602810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
602910e230b6Smaya
603010e230b6Smaya   dw[0] =
603110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
603210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
603310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
603410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
603510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
603610e230b6Smaya
603710e230b6Smaya   dw[1] =
603810e230b6Smaya      __gen_uint(values->ForceKillPixelEnable, 0, 1) |
603910e230b6Smaya      __gen_uint(values->PointRasterizationRule, 2, 2) |
604010e230b6Smaya      __gen_uint(values->LineStippleEnable, 3, 3) |
604110e230b6Smaya      __gen_uint(values->PolygonStippleEnable, 4, 4) |
604210e230b6Smaya      __gen_uint(values->LineAntialiasingRegionWidth, 6, 7) |
604310e230b6Smaya      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 8, 9) |
604410e230b6Smaya      __gen_uint(values->BarycentricInterpolationMode, 11, 16) |
604510e230b6Smaya      __gen_uint(values->PositionZWInterpolationMode, 17, 18) |
604610e230b6Smaya      __gen_uint(values->ForceThreadDispatchEnable, 19, 20) |
604710e230b6Smaya      __gen_uint(values->EarlyDepthStencilControl, 21, 22) |
604810e230b6Smaya      __gen_uint(values->LegacyDiamondLineRasterization, 26, 26) |
604910e230b6Smaya      __gen_uint(values->LegacyHierarchicalDepthBufferResolveEnable, 27, 27) |
605010e230b6Smaya      __gen_uint(values->LegacyDepthBufferResolveEnable, 28, 28) |
605110e230b6Smaya      __gen_uint(values->LegacyDepthBufferClearEnable, 30, 30) |
605210e230b6Smaya      __gen_uint(values->StatisticsEnable, 31, 31);
605310e230b6Smaya}
605410e230b6Smaya
605596c5ddc4Srjs#define GFX8_3DSTATE_WM_CHROMAKEY_length       2
605696c5ddc4Srjs#define GFX8_3DSTATE_WM_CHROMAKEY_length_bias      2
605796c5ddc4Srjs#define GFX8_3DSTATE_WM_CHROMAKEY_header        \
605810e230b6Smaya   .DWordLength                         =      0,  \
605910e230b6Smaya   ._3DCommandSubOpcode                 =     76,  \
606010e230b6Smaya   ._3DCommandOpcode                    =      0,  \
606110e230b6Smaya   .CommandSubType                      =      3,  \
606210e230b6Smaya   .CommandType                         =      3
606310e230b6Smaya
606496c5ddc4Srjsstruct GFX8_3DSTATE_WM_CHROMAKEY {
606510e230b6Smaya   uint32_t                             DWordLength;
606610e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
606710e230b6Smaya   uint32_t                             _3DCommandOpcode;
606810e230b6Smaya   uint32_t                             CommandSubType;
606910e230b6Smaya   uint32_t                             CommandType;
607010e230b6Smaya   bool                                 ChromaKeyKillEnable;
607110e230b6Smaya};
607210e230b6Smaya
607396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
607496c5ddc4SrjsGFX8_3DSTATE_WM_CHROMAKEY_pack(__attribute__((unused)) __gen_user_data *data,
607510e230b6Smaya                               __attribute__((unused)) void * restrict dst,
607696c5ddc4Srjs                               __attribute__((unused)) const struct GFX8_3DSTATE_WM_CHROMAKEY * restrict values)
607710e230b6Smaya{
607810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
607910e230b6Smaya
608010e230b6Smaya   dw[0] =
608110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
608210e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
608310e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
608410e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
608510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
608610e230b6Smaya
608710e230b6Smaya   dw[1] =
608810e230b6Smaya      __gen_uint(values->ChromaKeyKillEnable, 31, 31);
608910e230b6Smaya}
609010e230b6Smaya
609196c5ddc4Srjs#define GFX8_3DSTATE_WM_DEPTH_STENCIL_length      3
609296c5ddc4Srjs#define GFX8_3DSTATE_WM_DEPTH_STENCIL_length_bias      2
609396c5ddc4Srjs#define GFX8_3DSTATE_WM_DEPTH_STENCIL_header    \
609410e230b6Smaya   .DWordLength                         =      1,  \
609510e230b6Smaya   ._3DCommandSubOpcode                 =     78,  \
609610e230b6Smaya   ._3DCommandOpcode                    =      0,  \
609710e230b6Smaya   .CommandSubType                      =      3,  \
609810e230b6Smaya   .CommandType                         =      3
609910e230b6Smaya
610096c5ddc4Srjsstruct GFX8_3DSTATE_WM_DEPTH_STENCIL {
610110e230b6Smaya   uint32_t                             DWordLength;
610210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
610310e230b6Smaya   uint32_t                             _3DCommandOpcode;
610410e230b6Smaya   uint32_t                             CommandSubType;
610510e230b6Smaya   uint32_t                             CommandType;
610610e230b6Smaya   bool                                 DepthBufferWriteEnable;
610710e230b6Smaya   bool                                 DepthTestEnable;
610810e230b6Smaya   bool                                 StencilBufferWriteEnable;
610910e230b6Smaya   bool                                 StencilTestEnable;
611010e230b6Smaya   bool                                 DoubleSidedStencilEnable;
611196c5ddc4Srjs   enum GFX8_3D_Compare_Function        DepthTestFunction;
611296c5ddc4Srjs   enum GFX8_3D_Compare_Function        StencilTestFunction;
611396c5ddc4Srjs   enum GFX8_3D_Stencil_Operation       BackfaceStencilPassDepthPassOp;
611496c5ddc4Srjs   enum GFX8_3D_Stencil_Operation       BackfaceStencilPassDepthFailOp;
611596c5ddc4Srjs   enum GFX8_3D_Stencil_Operation       BackfaceStencilFailOp;
611696c5ddc4Srjs   enum GFX8_3D_Compare_Function        BackfaceStencilTestFunction;
611796c5ddc4Srjs   enum GFX8_3D_Stencil_Operation       StencilPassDepthPassOp;
611896c5ddc4Srjs   enum GFX8_3D_Stencil_Operation       StencilPassDepthFailOp;
611996c5ddc4Srjs   enum GFX8_3D_Stencil_Operation       StencilFailOp;
612010e230b6Smaya   uint32_t                             BackfaceStencilWriteMask;
612110e230b6Smaya   uint32_t                             BackfaceStencilTestMask;
612210e230b6Smaya   uint32_t                             StencilWriteMask;
612310e230b6Smaya   uint32_t                             StencilTestMask;
612410e230b6Smaya};
612510e230b6Smaya
612696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
612796c5ddc4SrjsGFX8_3DSTATE_WM_DEPTH_STENCIL_pack(__attribute__((unused)) __gen_user_data *data,
612810e230b6Smaya                                   __attribute__((unused)) void * restrict dst,
612996c5ddc4Srjs                                   __attribute__((unused)) const struct GFX8_3DSTATE_WM_DEPTH_STENCIL * restrict values)
613010e230b6Smaya{
613110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
613210e230b6Smaya
613310e230b6Smaya   dw[0] =
613410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
613510e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
613610e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
613710e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
613810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
613910e230b6Smaya
614010e230b6Smaya   dw[1] =
614110e230b6Smaya      __gen_uint(values->DepthBufferWriteEnable, 0, 0) |
614210e230b6Smaya      __gen_uint(values->DepthTestEnable, 1, 1) |
614310e230b6Smaya      __gen_uint(values->StencilBufferWriteEnable, 2, 2) |
614410e230b6Smaya      __gen_uint(values->StencilTestEnable, 3, 3) |
614510e230b6Smaya      __gen_uint(values->DoubleSidedStencilEnable, 4, 4) |
614610e230b6Smaya      __gen_uint(values->DepthTestFunction, 5, 7) |
614710e230b6Smaya      __gen_uint(values->StencilTestFunction, 8, 10) |
614810e230b6Smaya      __gen_uint(values->BackfaceStencilPassDepthPassOp, 11, 13) |
614910e230b6Smaya      __gen_uint(values->BackfaceStencilPassDepthFailOp, 14, 16) |
615010e230b6Smaya      __gen_uint(values->BackfaceStencilFailOp, 17, 19) |
615110e230b6Smaya      __gen_uint(values->BackfaceStencilTestFunction, 20, 22) |
615210e230b6Smaya      __gen_uint(values->StencilPassDepthPassOp, 23, 25) |
615310e230b6Smaya      __gen_uint(values->StencilPassDepthFailOp, 26, 28) |
615410e230b6Smaya      __gen_uint(values->StencilFailOp, 29, 31);
615510e230b6Smaya
615610e230b6Smaya   dw[2] =
615710e230b6Smaya      __gen_uint(values->BackfaceStencilWriteMask, 0, 7) |
615810e230b6Smaya      __gen_uint(values->BackfaceStencilTestMask, 8, 15) |
615910e230b6Smaya      __gen_uint(values->StencilWriteMask, 16, 23) |
616010e230b6Smaya      __gen_uint(values->StencilTestMask, 24, 31);
616110e230b6Smaya}
616210e230b6Smaya
616396c5ddc4Srjs#define GFX8_3DSTATE_WM_HZ_OP_length           5
616496c5ddc4Srjs#define GFX8_3DSTATE_WM_HZ_OP_length_bias      2
616596c5ddc4Srjs#define GFX8_3DSTATE_WM_HZ_OP_header            \
616610e230b6Smaya   .DWordLength                         =      3,  \
616710e230b6Smaya   ._3DCommandSubOpcode                 =     82,  \
616810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
616910e230b6Smaya   .CommandSubType                      =      3,  \
617010e230b6Smaya   .CommandType                         =      3
617110e230b6Smaya
617296c5ddc4Srjsstruct GFX8_3DSTATE_WM_HZ_OP {
617310e230b6Smaya   uint32_t                             DWordLength;
617410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
617510e230b6Smaya   uint32_t                             _3DCommandOpcode;
617610e230b6Smaya   uint32_t                             CommandSubType;
617710e230b6Smaya   uint32_t                             CommandType;
617810e230b6Smaya   uint32_t                             NumberofMultisamples;
617910e230b6Smaya   uint32_t                             StencilClearValue;
618010e230b6Smaya   bool                                 FullSurfaceDepthandStencilClear;
618110e230b6Smaya   bool                                 PixelPositionOffsetEnable;
618210e230b6Smaya   bool                                 HierarchicalDepthBufferResolveEnable;
618310e230b6Smaya   bool                                 DepthBufferResolveEnable;
618410e230b6Smaya   bool                                 ScissorRectangleEnable;
618510e230b6Smaya   bool                                 DepthBufferClearEnable;
618610e230b6Smaya   bool                                 StencilBufferClearEnable;
618710e230b6Smaya   uint32_t                             ClearRectangleXMin;
618810e230b6Smaya   uint32_t                             ClearRectangleYMin;
618910e230b6Smaya   uint32_t                             ClearRectangleXMax;
619010e230b6Smaya   uint32_t                             ClearRectangleYMax;
619110e230b6Smaya   uint32_t                             SampleMask;
619210e230b6Smaya};
619310e230b6Smaya
619496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
619596c5ddc4SrjsGFX8_3DSTATE_WM_HZ_OP_pack(__attribute__((unused)) __gen_user_data *data,
619610e230b6Smaya                           __attribute__((unused)) void * restrict dst,
619796c5ddc4Srjs                           __attribute__((unused)) const struct GFX8_3DSTATE_WM_HZ_OP * restrict values)
619810e230b6Smaya{
619910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
620010e230b6Smaya
620110e230b6Smaya   dw[0] =
620210e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
620310e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
620410e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
620510e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
620610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
620710e230b6Smaya
620810e230b6Smaya   dw[1] =
620910e230b6Smaya      __gen_uint(values->NumberofMultisamples, 13, 15) |
621010e230b6Smaya      __gen_uint(values->StencilClearValue, 16, 23) |
621110e230b6Smaya      __gen_uint(values->FullSurfaceDepthandStencilClear, 25, 25) |
621210e230b6Smaya      __gen_uint(values->PixelPositionOffsetEnable, 26, 26) |
621310e230b6Smaya      __gen_uint(values->HierarchicalDepthBufferResolveEnable, 27, 27) |
621410e230b6Smaya      __gen_uint(values->DepthBufferResolveEnable, 28, 28) |
621510e230b6Smaya      __gen_uint(values->ScissorRectangleEnable, 29, 29) |
621610e230b6Smaya      __gen_uint(values->DepthBufferClearEnable, 30, 30) |
621710e230b6Smaya      __gen_uint(values->StencilBufferClearEnable, 31, 31);
621810e230b6Smaya
621910e230b6Smaya   dw[2] =
622010e230b6Smaya      __gen_uint(values->ClearRectangleXMin, 0, 15) |
622110e230b6Smaya      __gen_uint(values->ClearRectangleYMin, 16, 31);
622210e230b6Smaya
622310e230b6Smaya   dw[3] =
622410e230b6Smaya      __gen_uint(values->ClearRectangleXMax, 0, 15) |
622510e230b6Smaya      __gen_uint(values->ClearRectangleYMax, 16, 31);
622610e230b6Smaya
622710e230b6Smaya   dw[4] =
622810e230b6Smaya      __gen_uint(values->SampleMask, 0, 15);
622910e230b6Smaya}
623010e230b6Smaya
623196c5ddc4Srjs#define GFX8_GPGPU_CSR_BASE_ADDRESS_length      3
623296c5ddc4Srjs#define GFX8_GPGPU_CSR_BASE_ADDRESS_length_bias      2
623396c5ddc4Srjs#define GFX8_GPGPU_CSR_BASE_ADDRESS_header      \
623410e230b6Smaya   .DWordLength                         =      1,  \
623510e230b6Smaya   ._3DCommandSubOpcode                 =      4,  \
623610e230b6Smaya   ._3DCommandOpcode                    =      1,  \
623710e230b6Smaya   .CommandSubType                      =      0,  \
623810e230b6Smaya   .CommandType                         =      3
623910e230b6Smaya
624096c5ddc4Srjsstruct GFX8_GPGPU_CSR_BASE_ADDRESS {
624110e230b6Smaya   uint32_t                             DWordLength;
624210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
624310e230b6Smaya   uint32_t                             _3DCommandOpcode;
624410e230b6Smaya   uint32_t                             CommandSubType;
624510e230b6Smaya   uint32_t                             CommandType;
624610e230b6Smaya   __gen_address_type                   GPGPUCSRBaseAddress;
624710e230b6Smaya};
624810e230b6Smaya
624996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
625096c5ddc4SrjsGFX8_GPGPU_CSR_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
625110e230b6Smaya                                 __attribute__((unused)) void * restrict dst,
625296c5ddc4Srjs                                 __attribute__((unused)) const struct GFX8_GPGPU_CSR_BASE_ADDRESS * restrict values)
625310e230b6Smaya{
625410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
625510e230b6Smaya
625610e230b6Smaya   dw[0] =
625710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
625810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
625910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
626010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
626110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
626210e230b6Smaya
626310e230b6Smaya   const uint64_t v1_address =
626496c5ddc4Srjs      __gen_address(data, &dw[1], values->GPGPUCSRBaseAddress, 0, 12, 63);
626510e230b6Smaya   dw[1] = v1_address;
626610e230b6Smaya   dw[2] = v1_address >> 32;
626710e230b6Smaya}
626810e230b6Smaya
626996c5ddc4Srjs#define GFX8_GPGPU_WALKER_length              15
627096c5ddc4Srjs#define GFX8_GPGPU_WALKER_length_bias          2
627196c5ddc4Srjs#define GFX8_GPGPU_WALKER_header                \
627210e230b6Smaya   .DWordLength                         =     13,  \
627310e230b6Smaya   .SubOpcode                           =      5,  \
627410e230b6Smaya   .MediaCommandOpcode                  =      1,  \
627510e230b6Smaya   .Pipeline                            =      2,  \
627610e230b6Smaya   .CommandType                         =      3
627710e230b6Smaya
627896c5ddc4Srjsstruct GFX8_GPGPU_WALKER {
627910e230b6Smaya   uint32_t                             DWordLength;
628010e230b6Smaya   bool                                 PredicateEnable;
628110e230b6Smaya   bool                                 IndirectParameterEnable;
628210e230b6Smaya   uint32_t                             SubOpcode;
628310e230b6Smaya   uint32_t                             MediaCommandOpcode;
628410e230b6Smaya   uint32_t                             Pipeline;
628510e230b6Smaya   uint32_t                             CommandType;
628610e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
628710e230b6Smaya   uint32_t                             IndirectDataLength;
628810e230b6Smaya   uint64_t                             IndirectDataStartAddress;
628910e230b6Smaya   uint32_t                             ThreadWidthCounterMaximum;
629010e230b6Smaya   uint32_t                             ThreadHeightCounterMaximum;
629110e230b6Smaya   uint32_t                             ThreadDepthCounterMaximum;
629210e230b6Smaya   uint32_t                             SIMDSize;
629310e230b6Smaya#define SIMD8                                    0
629410e230b6Smaya#define SIMD16                                   1
629510e230b6Smaya#define SIMD32                                   2
629610e230b6Smaya   uint32_t                             ThreadGroupIDStartingX;
629710e230b6Smaya   uint32_t                             ThreadGroupIDXDimension;
629810e230b6Smaya   uint32_t                             ThreadGroupIDStartingY;
629910e230b6Smaya   uint32_t                             ThreadGroupIDYDimension;
630010e230b6Smaya   uint32_t                             ThreadGroupIDStartingResumeZ;
630110e230b6Smaya   uint32_t                             ThreadGroupIDZDimension;
630210e230b6Smaya   uint32_t                             RightExecutionMask;
630310e230b6Smaya   uint32_t                             BottomExecutionMask;
630410e230b6Smaya};
630510e230b6Smaya
630696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
630796c5ddc4SrjsGFX8_GPGPU_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
630810e230b6Smaya                       __attribute__((unused)) void * restrict dst,
630996c5ddc4Srjs                       __attribute__((unused)) const struct GFX8_GPGPU_WALKER * restrict values)
631010e230b6Smaya{
631110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
631210e230b6Smaya
631310e230b6Smaya   dw[0] =
631410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
631510e230b6Smaya      __gen_uint(values->PredicateEnable, 8, 8) |
631610e230b6Smaya      __gen_uint(values->IndirectParameterEnable, 10, 10) |
631710e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
631810e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
631910e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
632010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
632110e230b6Smaya
632210e230b6Smaya   dw[1] =
632310e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
632410e230b6Smaya
632510e230b6Smaya   dw[2] =
632610e230b6Smaya      __gen_uint(values->IndirectDataLength, 0, 16);
632710e230b6Smaya
632810e230b6Smaya   dw[3] =
632910e230b6Smaya      __gen_offset(values->IndirectDataStartAddress, 6, 31);
633010e230b6Smaya
633110e230b6Smaya   dw[4] =
633210e230b6Smaya      __gen_uint(values->ThreadWidthCounterMaximum, 0, 5) |
633310e230b6Smaya      __gen_uint(values->ThreadHeightCounterMaximum, 8, 13) |
633410e230b6Smaya      __gen_uint(values->ThreadDepthCounterMaximum, 16, 21) |
633510e230b6Smaya      __gen_uint(values->SIMDSize, 30, 31);
633610e230b6Smaya
633710e230b6Smaya   dw[5] =
633810e230b6Smaya      __gen_uint(values->ThreadGroupIDStartingX, 0, 31);
633910e230b6Smaya
634010e230b6Smaya   dw[6] = 0;
634110e230b6Smaya
634210e230b6Smaya   dw[7] =
634310e230b6Smaya      __gen_uint(values->ThreadGroupIDXDimension, 0, 31);
634410e230b6Smaya
634510e230b6Smaya   dw[8] =
634610e230b6Smaya      __gen_uint(values->ThreadGroupIDStartingY, 0, 31);
634710e230b6Smaya
634810e230b6Smaya   dw[9] = 0;
634910e230b6Smaya
635010e230b6Smaya   dw[10] =
635110e230b6Smaya      __gen_uint(values->ThreadGroupIDYDimension, 0, 31);
635210e230b6Smaya
635310e230b6Smaya   dw[11] =
635410e230b6Smaya      __gen_uint(values->ThreadGroupIDStartingResumeZ, 0, 31);
635510e230b6Smaya
635610e230b6Smaya   dw[12] =
635710e230b6Smaya      __gen_uint(values->ThreadGroupIDZDimension, 0, 31);
635810e230b6Smaya
635910e230b6Smaya   dw[13] =
636010e230b6Smaya      __gen_uint(values->RightExecutionMask, 0, 31);
636110e230b6Smaya
636210e230b6Smaya   dw[14] =
636310e230b6Smaya      __gen_uint(values->BottomExecutionMask, 0, 31);
636410e230b6Smaya}
636510e230b6Smaya
636696c5ddc4Srjs#define GFX8_MEDIA_CURBE_LOAD_length           4
636796c5ddc4Srjs#define GFX8_MEDIA_CURBE_LOAD_length_bias      2
636896c5ddc4Srjs#define GFX8_MEDIA_CURBE_LOAD_header            \
636910e230b6Smaya   .DWordLength                         =      2,  \
637010e230b6Smaya   .SubOpcode                           =      1,  \
637110e230b6Smaya   .MediaCommandOpcode                  =      0,  \
637210e230b6Smaya   .Pipeline                            =      2,  \
637310e230b6Smaya   .CommandType                         =      3
637410e230b6Smaya
637596c5ddc4Srjsstruct GFX8_MEDIA_CURBE_LOAD {
637610e230b6Smaya   uint32_t                             DWordLength;
637710e230b6Smaya   uint32_t                             SubOpcode;
637810e230b6Smaya   uint32_t                             MediaCommandOpcode;
637910e230b6Smaya   uint32_t                             Pipeline;
638010e230b6Smaya   uint32_t                             CommandType;
638110e230b6Smaya   uint32_t                             CURBETotalDataLength;
638210e230b6Smaya   uint32_t                             CURBEDataStartAddress;
638310e230b6Smaya};
638410e230b6Smaya
638596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
638696c5ddc4SrjsGFX8_MEDIA_CURBE_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
638710e230b6Smaya                           __attribute__((unused)) void * restrict dst,
638896c5ddc4Srjs                           __attribute__((unused)) const struct GFX8_MEDIA_CURBE_LOAD * restrict values)
638910e230b6Smaya{
639010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
639110e230b6Smaya
639210e230b6Smaya   dw[0] =
639310e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
639410e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
639510e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
639610e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
639710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
639810e230b6Smaya
639910e230b6Smaya   dw[1] = 0;
640010e230b6Smaya
640110e230b6Smaya   dw[2] =
640210e230b6Smaya      __gen_uint(values->CURBETotalDataLength, 0, 16);
640310e230b6Smaya
640410e230b6Smaya   dw[3] =
640510e230b6Smaya      __gen_uint(values->CURBEDataStartAddress, 0, 31);
640610e230b6Smaya}
640710e230b6Smaya
640896c5ddc4Srjs#define GFX8_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length      4
640996c5ddc4Srjs#define GFX8_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length_bias      2
641096c5ddc4Srjs#define GFX8_MEDIA_INTERFACE_DESCRIPTOR_LOAD_header\
641110e230b6Smaya   .DWordLength                         =      2,  \
641210e230b6Smaya   .SubOpcode                           =      2,  \
641310e230b6Smaya   .MediaCommandOpcode                  =      0,  \
641410e230b6Smaya   .Pipeline                            =      2,  \
641510e230b6Smaya   .CommandType                         =      3
641610e230b6Smaya
641796c5ddc4Srjsstruct GFX8_MEDIA_INTERFACE_DESCRIPTOR_LOAD {
641810e230b6Smaya   uint32_t                             DWordLength;
641910e230b6Smaya   uint32_t                             SubOpcode;
642010e230b6Smaya   uint32_t                             MediaCommandOpcode;
642110e230b6Smaya   uint32_t                             Pipeline;
642210e230b6Smaya   uint32_t                             CommandType;
642310e230b6Smaya   uint32_t                             InterfaceDescriptorTotalLength;
642410e230b6Smaya   uint64_t                             InterfaceDescriptorDataStartAddress;
642510e230b6Smaya};
642610e230b6Smaya
642796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
642896c5ddc4SrjsGFX8_MEDIA_INTERFACE_DESCRIPTOR_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
642910e230b6Smaya                                          __attribute__((unused)) void * restrict dst,
643096c5ddc4Srjs                                          __attribute__((unused)) const struct GFX8_MEDIA_INTERFACE_DESCRIPTOR_LOAD * restrict values)
643110e230b6Smaya{
643210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
643310e230b6Smaya
643410e230b6Smaya   dw[0] =
643510e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
643610e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
643710e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
643810e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
643910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
644010e230b6Smaya
644110e230b6Smaya   dw[1] = 0;
644210e230b6Smaya
644310e230b6Smaya   dw[2] =
644410e230b6Smaya      __gen_uint(values->InterfaceDescriptorTotalLength, 0, 16);
644510e230b6Smaya
644610e230b6Smaya   dw[3] =
644710e230b6Smaya      __gen_offset(values->InterfaceDescriptorDataStartAddress, 0, 31);
644810e230b6Smaya}
644910e230b6Smaya
645096c5ddc4Srjs#define GFX8_MEDIA_OBJECT_length_bias          2
645196c5ddc4Srjs#define GFX8_MEDIA_OBJECT_header                \
645210e230b6Smaya   .DWordLength                         =      4,  \
645310e230b6Smaya   .MediaCommandSubOpcode               =      0,  \
645410e230b6Smaya   .MediaCommandOpcode                  =      1,  \
645510e230b6Smaya   .MediaCommandPipeline                =      2,  \
645610e230b6Smaya   .CommandType                         =      3
645710e230b6Smaya
645896c5ddc4Srjsstruct GFX8_MEDIA_OBJECT {
645910e230b6Smaya   uint32_t                             DWordLength;
646010e230b6Smaya   uint32_t                             MediaCommandSubOpcode;
646110e230b6Smaya   uint32_t                             MediaCommandOpcode;
646210e230b6Smaya   uint32_t                             MediaCommandPipeline;
646310e230b6Smaya   uint32_t                             CommandType;
646410e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
646510e230b6Smaya   uint32_t                             IndirectDataLength;
646610e230b6Smaya   uint32_t                             SubSliceDestinationSelect;
646710e230b6Smaya#define SubSlice2                                2
646810e230b6Smaya#define SubSlice1                                1
646910e230b6Smaya#define SubSlice0                                0
647010e230b6Smaya   uint32_t                             SliceDestinationSelect;
647110e230b6Smaya#define Slice0                                   0
647210e230b6Smaya#define Slice1                                   1
647310e230b6Smaya#define Slice2                                   2
647410e230b6Smaya   uint32_t                             UseScoreboard;
647510e230b6Smaya#define Notusingscoreboard                       0
647610e230b6Smaya#define Usingscoreboard                          1
647710e230b6Smaya   uint32_t                             ForceDestination;
647810e230b6Smaya   uint32_t                             ThreadSynchronization;
647910e230b6Smaya#define Nothreadsynchronization                  0
648010e230b6Smaya#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
648110e230b6Smaya   bool                                 ChildrenPresent;
648210e230b6Smaya   __gen_address_type                   IndirectDataStartAddress;
648310e230b6Smaya   uint32_t                             ScoreboardX;
648410e230b6Smaya   uint32_t                             ScoredboardY;
648510e230b6Smaya   uint32_t                             ScoreboardMask;
648610e230b6Smaya   uint32_t                             ScoreboardColor;
648710e230b6Smaya   /* variable length fields follow */
648810e230b6Smaya};
648910e230b6Smaya
649096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
649196c5ddc4SrjsGFX8_MEDIA_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
649210e230b6Smaya                       __attribute__((unused)) void * restrict dst,
649396c5ddc4Srjs                       __attribute__((unused)) const struct GFX8_MEDIA_OBJECT * restrict values)
649410e230b6Smaya{
649510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
649610e230b6Smaya
649710e230b6Smaya   dw[0] =
649810e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
649910e230b6Smaya      __gen_uint(values->MediaCommandSubOpcode, 16, 23) |
650010e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
650110e230b6Smaya      __gen_uint(values->MediaCommandPipeline, 27, 28) |
650210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
650310e230b6Smaya
650410e230b6Smaya   dw[1] =
650510e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
650610e230b6Smaya
650710e230b6Smaya   dw[2] =
650810e230b6Smaya      __gen_uint(values->IndirectDataLength, 0, 16) |
650910e230b6Smaya      __gen_uint(values->SubSliceDestinationSelect, 17, 18) |
651010e230b6Smaya      __gen_uint(values->SliceDestinationSelect, 19, 20) |
651110e230b6Smaya      __gen_uint(values->UseScoreboard, 21, 21) |
651210e230b6Smaya      __gen_uint(values->ForceDestination, 22, 22) |
651310e230b6Smaya      __gen_uint(values->ThreadSynchronization, 24, 24) |
651410e230b6Smaya      __gen_uint(values->ChildrenPresent, 31, 31);
651510e230b6Smaya
651696c5ddc4Srjs   dw[3] = __gen_address(data, &dw[3], values->IndirectDataStartAddress, 0, 0, 31);
651710e230b6Smaya
651810e230b6Smaya   dw[4] =
651910e230b6Smaya      __gen_uint(values->ScoreboardX, 0, 8) |
652010e230b6Smaya      __gen_uint(values->ScoredboardY, 16, 24);
652110e230b6Smaya
652210e230b6Smaya   dw[5] =
652310e230b6Smaya      __gen_uint(values->ScoreboardMask, 0, 7) |
652410e230b6Smaya      __gen_uint(values->ScoreboardColor, 16, 19);
652510e230b6Smaya}
652610e230b6Smaya
652796c5ddc4Srjs#define GFX8_MEDIA_OBJECT_GRPID_length_bias      2
652896c5ddc4Srjs#define GFX8_MEDIA_OBJECT_GRPID_header          \
652910e230b6Smaya   .DWordLength                         =      5,  \
653010e230b6Smaya   .MediaCommandSubOpcode               =      6,  \
653110e230b6Smaya   .MediaCommandOpcode                  =      1,  \
653210e230b6Smaya   .MediaCommandPipeline                =      2,  \
653310e230b6Smaya   .CommandType                         =      3
653410e230b6Smaya
653596c5ddc4Srjsstruct GFX8_MEDIA_OBJECT_GRPID {
653610e230b6Smaya   uint32_t                             DWordLength;
653710e230b6Smaya   uint32_t                             MediaCommandSubOpcode;
653810e230b6Smaya   uint32_t                             MediaCommandOpcode;
653910e230b6Smaya   uint32_t                             MediaCommandPipeline;
654010e230b6Smaya   uint32_t                             CommandType;
654110e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
654210e230b6Smaya   uint32_t                             IndirectDataLength;
654310e230b6Smaya   uint32_t                             SubSliceDestinationSelect;
654410e230b6Smaya#define SubSlice2                                2
654510e230b6Smaya#define SubSlice1                                1
654610e230b6Smaya#define SubSlice0                                0
654710e230b6Smaya   uint32_t                             SliceDestinationSelect;
654810e230b6Smaya#define Slice0                                   0
654910e230b6Smaya#define Slice1                                   1
655010e230b6Smaya#define Slice2                                   2
655110e230b6Smaya   uint32_t                             UseScoreboard;
655210e230b6Smaya#define Notusingscoreboard                       0
655310e230b6Smaya#define Usingscoreboard                          1
655410e230b6Smaya   uint32_t                             ForceDestination;
655510e230b6Smaya   uint32_t                             EndofThreadGroup;
655610e230b6Smaya   __gen_address_type                   IndirectDataStartAddress;
655710e230b6Smaya   uint32_t                             ScoreboardX;
655810e230b6Smaya   uint32_t                             ScoreboardY;
655910e230b6Smaya   uint32_t                             ScoreboardMask;
656010e230b6Smaya   uint32_t                             ScoreboardColor;
656110e230b6Smaya   uint32_t                             GroupID;
656210e230b6Smaya   /* variable length fields follow */
656310e230b6Smaya};
656410e230b6Smaya
656596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
656696c5ddc4SrjsGFX8_MEDIA_OBJECT_GRPID_pack(__attribute__((unused)) __gen_user_data *data,
656710e230b6Smaya                             __attribute__((unused)) void * restrict dst,
656896c5ddc4Srjs                             __attribute__((unused)) const struct GFX8_MEDIA_OBJECT_GRPID * restrict values)
656910e230b6Smaya{
657010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
657110e230b6Smaya
657210e230b6Smaya   dw[0] =
657310e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
657410e230b6Smaya      __gen_uint(values->MediaCommandSubOpcode, 16, 23) |
657510e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
657610e230b6Smaya      __gen_uint(values->MediaCommandPipeline, 27, 28) |
657710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
657810e230b6Smaya
657910e230b6Smaya   dw[1] =
658010e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
658110e230b6Smaya
658210e230b6Smaya   dw[2] =
658310e230b6Smaya      __gen_uint(values->IndirectDataLength, 0, 16) |
658410e230b6Smaya      __gen_uint(values->SubSliceDestinationSelect, 17, 18) |
658510e230b6Smaya      __gen_uint(values->SliceDestinationSelect, 19, 20) |
658610e230b6Smaya      __gen_uint(values->UseScoreboard, 21, 21) |
658710e230b6Smaya      __gen_uint(values->ForceDestination, 22, 22) |
658810e230b6Smaya      __gen_uint(values->EndofThreadGroup, 23, 23);
658910e230b6Smaya
659096c5ddc4Srjs   dw[3] = __gen_address(data, &dw[3], values->IndirectDataStartAddress, 0, 0, 31);
659110e230b6Smaya
659210e230b6Smaya   dw[4] =
659310e230b6Smaya      __gen_uint(values->ScoreboardX, 0, 8) |
659410e230b6Smaya      __gen_uint(values->ScoreboardY, 16, 24);
659510e230b6Smaya
659610e230b6Smaya   dw[5] =
659710e230b6Smaya      __gen_uint(values->ScoreboardMask, 0, 7) |
659810e230b6Smaya      __gen_uint(values->ScoreboardColor, 16, 19);
659910e230b6Smaya
660010e230b6Smaya   dw[6] =
660110e230b6Smaya      __gen_uint(values->GroupID, 0, 31);
660210e230b6Smaya}
660310e230b6Smaya
660496c5ddc4Srjs#define GFX8_MEDIA_OBJECT_PRT_length          16
660596c5ddc4Srjs#define GFX8_MEDIA_OBJECT_PRT_length_bias      2
660696c5ddc4Srjs#define GFX8_MEDIA_OBJECT_PRT_header            \
660710e230b6Smaya   .DWordLength                         =     14,  \
660810e230b6Smaya   .SubOpcode                           =      2,  \
660910e230b6Smaya   .MediaCommandOpcode                  =      1,  \
661010e230b6Smaya   .Pipeline                            =      2,  \
661110e230b6Smaya   .CommandType                         =      3
661210e230b6Smaya
661396c5ddc4Srjsstruct GFX8_MEDIA_OBJECT_PRT {
661410e230b6Smaya   uint32_t                             DWordLength;
661510e230b6Smaya   uint32_t                             SubOpcode;
661610e230b6Smaya   uint32_t                             MediaCommandOpcode;
661710e230b6Smaya   uint32_t                             Pipeline;
661810e230b6Smaya   uint32_t                             CommandType;
661910e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
662010e230b6Smaya   uint32_t                             PRT_FenceType;
662110e230b6Smaya#define Rootthreadqueue                          0
662210e230b6Smaya#define VFEstateflush                            1
662310e230b6Smaya   bool                                 PRT_FenceNeeded;
662410e230b6Smaya   bool                                 ChildrenPresent;
662510e230b6Smaya   uint32_t                             InlineData[12];
662610e230b6Smaya};
662710e230b6Smaya
662896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
662996c5ddc4SrjsGFX8_MEDIA_OBJECT_PRT_pack(__attribute__((unused)) __gen_user_data *data,
663010e230b6Smaya                           __attribute__((unused)) void * restrict dst,
663196c5ddc4Srjs                           __attribute__((unused)) const struct GFX8_MEDIA_OBJECT_PRT * restrict values)
663210e230b6Smaya{
663310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
663410e230b6Smaya
663510e230b6Smaya   dw[0] =
663610e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
663710e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
663810e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
663910e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
664010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
664110e230b6Smaya
664210e230b6Smaya   dw[1] =
664310e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
664410e230b6Smaya
664510e230b6Smaya   dw[2] =
664610e230b6Smaya      __gen_uint(values->PRT_FenceType, 22, 22) |
664710e230b6Smaya      __gen_uint(values->PRT_FenceNeeded, 23, 23) |
664810e230b6Smaya      __gen_uint(values->ChildrenPresent, 31, 31);
664910e230b6Smaya
665010e230b6Smaya   dw[3] = 0;
665110e230b6Smaya
665210e230b6Smaya   dw[4] =
665310e230b6Smaya      __gen_uint(values->InlineData[0], 0, 31);
665410e230b6Smaya
665510e230b6Smaya   dw[5] =
665610e230b6Smaya      __gen_uint(values->InlineData[1], 0, 31);
665710e230b6Smaya
665810e230b6Smaya   dw[6] =
665910e230b6Smaya      __gen_uint(values->InlineData[2], 0, 31);
666010e230b6Smaya
666110e230b6Smaya   dw[7] =
666210e230b6Smaya      __gen_uint(values->InlineData[3], 0, 31);
666310e230b6Smaya
666410e230b6Smaya   dw[8] =
666510e230b6Smaya      __gen_uint(values->InlineData[4], 0, 31);
666610e230b6Smaya
666710e230b6Smaya   dw[9] =
666810e230b6Smaya      __gen_uint(values->InlineData[5], 0, 31);
666910e230b6Smaya
667010e230b6Smaya   dw[10] =
667110e230b6Smaya      __gen_uint(values->InlineData[6], 0, 31);
667210e230b6Smaya
667310e230b6Smaya   dw[11] =
667410e230b6Smaya      __gen_uint(values->InlineData[7], 0, 31);
667510e230b6Smaya
667610e230b6Smaya   dw[12] =
667710e230b6Smaya      __gen_uint(values->InlineData[8], 0, 31);
667810e230b6Smaya
667910e230b6Smaya   dw[13] =
668010e230b6Smaya      __gen_uint(values->InlineData[9], 0, 31);
668110e230b6Smaya
668210e230b6Smaya   dw[14] =
668310e230b6Smaya      __gen_uint(values->InlineData[10], 0, 31);
668410e230b6Smaya
668510e230b6Smaya   dw[15] =
668610e230b6Smaya      __gen_uint(values->InlineData[11], 0, 31);
668710e230b6Smaya}
668810e230b6Smaya
668996c5ddc4Srjs#define GFX8_MEDIA_OBJECT_WALKER_length_bias      2
669096c5ddc4Srjs#define GFX8_MEDIA_OBJECT_WALKER_header         \
669110e230b6Smaya   .DWordLength                         =     15,  \
669210e230b6Smaya   .SubOpcode                           =      3,  \
669310e230b6Smaya   .MediaCommandOpcode                  =      1,  \
669410e230b6Smaya   .Pipeline                            =      2,  \
669510e230b6Smaya   .CommandType                         =      3
669610e230b6Smaya
669796c5ddc4Srjsstruct GFX8_MEDIA_OBJECT_WALKER {
669810e230b6Smaya   uint32_t                             DWordLength;
669910e230b6Smaya   uint32_t                             SubOpcode;
670010e230b6Smaya   uint32_t                             MediaCommandOpcode;
670110e230b6Smaya   uint32_t                             Pipeline;
670210e230b6Smaya   uint32_t                             CommandType;
670310e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
670410e230b6Smaya   uint32_t                             IndirectDataLength;
670510e230b6Smaya   uint32_t                             UseScoreboard;
670610e230b6Smaya#define Notusingscoreboard                       0
670710e230b6Smaya#define Usingscoreboard                          1
670810e230b6Smaya   uint32_t                             ThreadSynchronization;
670910e230b6Smaya#define Nothreadsynchronization                  0
671010e230b6Smaya#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
671110e230b6Smaya   uint32_t                             ChildrenPresent;
671210e230b6Smaya   uint64_t                             IndirectDataStartAddress;
671310e230b6Smaya   uint32_t                             ScoreboardMask;
671410e230b6Smaya   uint32_t                             GroupIDLoopSelect;
671510e230b6Smaya   int32_t                              MidLoopUnitX;
671610e230b6Smaya   int32_t                              LocalMidLoopUnitY;
671710e230b6Smaya   uint32_t                             MiddleLoopExtraSteps;
671810e230b6Smaya   uint32_t                             ColorCountMinusOne;
671910e230b6Smaya   uint32_t                             LocalLoopExecCount;
672010e230b6Smaya   uint32_t                             GlobalLoopExecCount;
672110e230b6Smaya   uint32_t                             BlockResolutionX;
672210e230b6Smaya   uint32_t                             BlockResolutionY;
672310e230b6Smaya   uint32_t                             LocalStartX;
672410e230b6Smaya   uint32_t                             LocalStartY;
672510e230b6Smaya   int32_t                              LocalOuterLoopStrideX;
672610e230b6Smaya   int32_t                              LocalOuterLoopStrideY;
672710e230b6Smaya   int32_t                              LocalInnerLoopUnitX;
672810e230b6Smaya   int32_t                              LocalInnerLoopUnitY;
672910e230b6Smaya   uint32_t                             GlobalResolutionX;
673010e230b6Smaya   uint32_t                             GlobalResolutionY;
673110e230b6Smaya   int32_t                              GlobalStartX;
673210e230b6Smaya   int32_t                              GlobalStartY;
673310e230b6Smaya   int32_t                              GlobalOuterLoopStrideX;
673410e230b6Smaya   int32_t                              GlobalOuterLoopStrideY;
673510e230b6Smaya   int32_t                              GlobalInnerLoopUnitX;
673610e230b6Smaya   int32_t                              GlobalInnerLoopUnitY;
673710e230b6Smaya   /* variable length fields follow */
673810e230b6Smaya};
673910e230b6Smaya
674096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
674196c5ddc4SrjsGFX8_MEDIA_OBJECT_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
674210e230b6Smaya                              __attribute__((unused)) void * restrict dst,
674396c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_MEDIA_OBJECT_WALKER * restrict values)
674410e230b6Smaya{
674510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
674610e230b6Smaya
674710e230b6Smaya   dw[0] =
674810e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
674910e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
675010e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
675110e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
675210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
675310e230b6Smaya
675410e230b6Smaya   dw[1] =
675510e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 5);
675610e230b6Smaya
675710e230b6Smaya   dw[2] =
675810e230b6Smaya      __gen_uint(values->IndirectDataLength, 0, 16) |
675910e230b6Smaya      __gen_uint(values->UseScoreboard, 21, 21) |
676010e230b6Smaya      __gen_uint(values->ThreadSynchronization, 24, 24) |
676110e230b6Smaya      __gen_uint(values->ChildrenPresent, 31, 31);
676210e230b6Smaya
676310e230b6Smaya   dw[3] =
676410e230b6Smaya      __gen_offset(values->IndirectDataStartAddress, 0, 31);
676510e230b6Smaya
676610e230b6Smaya   dw[4] = 0;
676710e230b6Smaya
676810e230b6Smaya   dw[5] =
676910e230b6Smaya      __gen_uint(values->ScoreboardMask, 0, 7) |
677010e230b6Smaya      __gen_uint(values->GroupIDLoopSelect, 8, 31);
677110e230b6Smaya
677210e230b6Smaya   dw[6] =
677310e230b6Smaya      __gen_sint(values->MidLoopUnitX, 8, 9) |
677410e230b6Smaya      __gen_sint(values->LocalMidLoopUnitY, 12, 13) |
677510e230b6Smaya      __gen_uint(values->MiddleLoopExtraSteps, 16, 20) |
677610e230b6Smaya      __gen_uint(values->ColorCountMinusOne, 24, 27);
677710e230b6Smaya
677810e230b6Smaya   dw[7] =
677910e230b6Smaya      __gen_uint(values->LocalLoopExecCount, 0, 9) |
678010e230b6Smaya      __gen_uint(values->GlobalLoopExecCount, 16, 25);
678110e230b6Smaya
678210e230b6Smaya   dw[8] =
678310e230b6Smaya      __gen_uint(values->BlockResolutionX, 0, 8) |
678410e230b6Smaya      __gen_uint(values->BlockResolutionY, 16, 24);
678510e230b6Smaya
678610e230b6Smaya   dw[9] =
678710e230b6Smaya      __gen_uint(values->LocalStartX, 0, 8) |
678810e230b6Smaya      __gen_uint(values->LocalStartY, 16, 24);
678910e230b6Smaya
679010e230b6Smaya   dw[10] = 0;
679110e230b6Smaya
679210e230b6Smaya   dw[11] =
679310e230b6Smaya      __gen_sint(values->LocalOuterLoopStrideX, 0, 9) |
679410e230b6Smaya      __gen_sint(values->LocalOuterLoopStrideY, 16, 25);
679510e230b6Smaya
679610e230b6Smaya   dw[12] =
679710e230b6Smaya      __gen_sint(values->LocalInnerLoopUnitX, 0, 9) |
679810e230b6Smaya      __gen_sint(values->LocalInnerLoopUnitY, 16, 25);
679910e230b6Smaya
680010e230b6Smaya   dw[13] =
680110e230b6Smaya      __gen_uint(values->GlobalResolutionX, 0, 8) |
680210e230b6Smaya      __gen_uint(values->GlobalResolutionY, 16, 24);
680310e230b6Smaya
680410e230b6Smaya   dw[14] =
680510e230b6Smaya      __gen_sint(values->GlobalStartX, 0, 9) |
680610e230b6Smaya      __gen_sint(values->GlobalStartY, 16, 25);
680710e230b6Smaya
680810e230b6Smaya   dw[15] =
680910e230b6Smaya      __gen_sint(values->GlobalOuterLoopStrideX, 0, 9) |
681010e230b6Smaya      __gen_sint(values->GlobalOuterLoopStrideY, 16, 25);
681110e230b6Smaya
681210e230b6Smaya   dw[16] =
681310e230b6Smaya      __gen_sint(values->GlobalInnerLoopUnitX, 0, 9) |
681410e230b6Smaya      __gen_sint(values->GlobalInnerLoopUnitY, 16, 25);
681510e230b6Smaya}
681610e230b6Smaya
681796c5ddc4Srjs#define GFX8_MEDIA_STATE_FLUSH_length          2
681896c5ddc4Srjs#define GFX8_MEDIA_STATE_FLUSH_length_bias      2
681996c5ddc4Srjs#define GFX8_MEDIA_STATE_FLUSH_header           \
682010e230b6Smaya   .DWordLength                         =      0,  \
682110e230b6Smaya   .SubOpcode                           =      4,  \
682210e230b6Smaya   .MediaCommandOpcode                  =      0,  \
682310e230b6Smaya   .Pipeline                            =      2,  \
682410e230b6Smaya   .CommandType                         =      3
682510e230b6Smaya
682696c5ddc4Srjsstruct GFX8_MEDIA_STATE_FLUSH {
682710e230b6Smaya   uint32_t                             DWordLength;
682810e230b6Smaya   uint32_t                             SubOpcode;
682910e230b6Smaya   uint32_t                             MediaCommandOpcode;
683010e230b6Smaya   uint32_t                             Pipeline;
683110e230b6Smaya   uint32_t                             CommandType;
683210e230b6Smaya   uint32_t                             InterfaceDescriptorOffset;
683310e230b6Smaya   uint32_t                             WatermarkRequired;
683410e230b6Smaya   bool                                 FlushtoGO;
683510e230b6Smaya};
683610e230b6Smaya
683796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
683896c5ddc4SrjsGFX8_MEDIA_STATE_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
683910e230b6Smaya                            __attribute__((unused)) void * restrict dst,
684096c5ddc4Srjs                            __attribute__((unused)) const struct GFX8_MEDIA_STATE_FLUSH * restrict values)
684110e230b6Smaya{
684210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
684310e230b6Smaya
684410e230b6Smaya   dw[0] =
684510e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
684610e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
684710e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
684810e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
684910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
685010e230b6Smaya
685110e230b6Smaya   dw[1] =
685210e230b6Smaya      __gen_uint(values->InterfaceDescriptorOffset, 0, 5) |
685310e230b6Smaya      __gen_uint(values->WatermarkRequired, 6, 6) |
685410e230b6Smaya      __gen_uint(values->FlushtoGO, 7, 7);
685510e230b6Smaya}
685610e230b6Smaya
685796c5ddc4Srjs#define GFX8_MEDIA_VFE_STATE_length            9
685896c5ddc4Srjs#define GFX8_MEDIA_VFE_STATE_length_bias       2
685996c5ddc4Srjs#define GFX8_MEDIA_VFE_STATE_header             \
686010e230b6Smaya   .DWordLength                         =      7,  \
686110e230b6Smaya   .SubOpcode                           =      0,  \
686210e230b6Smaya   .MediaCommandOpcode                  =      0,  \
686310e230b6Smaya   .Pipeline                            =      2,  \
686410e230b6Smaya   .CommandType                         =      3
686510e230b6Smaya
686696c5ddc4Srjsstruct GFX8_MEDIA_VFE_STATE {
686710e230b6Smaya   uint32_t                             DWordLength;
686810e230b6Smaya   uint32_t                             SubOpcode;
686910e230b6Smaya   uint32_t                             MediaCommandOpcode;
687010e230b6Smaya   uint32_t                             Pipeline;
687110e230b6Smaya   uint32_t                             CommandType;
687210e230b6Smaya   uint32_t                             PerThreadScratchSpace;
687310e230b6Smaya   uint32_t                             StackSize;
687410e230b6Smaya   __gen_address_type                   ScratchSpaceBasePointer;
687510e230b6Smaya   uint32_t                             BypassGatewayControl;
687610e230b6Smaya#define MaintainingOpenGatewayForwardMsgCloseGatewayprotocollegacymode 0
687710e230b6Smaya#define BypassingOpenGatewayCloseGatewayprotocol 1
687810e230b6Smaya   uint32_t                             ResetGatewayTimer;
687910e230b6Smaya#define Maintainingtheexistingtimestampstate     0
688010e230b6Smaya#define Resettingrelativetimerandlatchingtheglobaltimestamp 1
688110e230b6Smaya   uint32_t                             NumberofURBEntries;
688210e230b6Smaya   uint32_t                             MaximumNumberofThreads;
688310e230b6Smaya   uint32_t                             SliceDisable;
688410e230b6Smaya#define AllSubslicesEnabled                      0
688510e230b6Smaya#define OnlySlice0Enabled                        1
688610e230b6Smaya#define OnlySlice0Subslice0Enabled               3
688710e230b6Smaya   uint32_t                             CURBEAllocationSize;
688810e230b6Smaya   uint32_t                             URBEntryAllocationSize;
688910e230b6Smaya   uint32_t                             ScoreboardMask;
689010e230b6Smaya   uint32_t                             ScoreboardType;
689110e230b6Smaya#define StallingScoreboard                       0
689210e230b6Smaya#define NonStallingScoreboard                    1
689310e230b6Smaya   bool                                 ScoreboardEnable;
689410e230b6Smaya   int32_t                              Scoreboard0DeltaX;
689510e230b6Smaya   int32_t                              Scoreboard0DeltaY;
689610e230b6Smaya   int32_t                              Scoreboard1DeltaX;
689710e230b6Smaya   int32_t                              Scoreboard1DeltaY;
689810e230b6Smaya   int32_t                              Scoreboard2DeltaX;
689910e230b6Smaya   int32_t                              Scoreboard2DeltaY;
690010e230b6Smaya   int32_t                              Scoreboard3DeltaX;
690110e230b6Smaya   int32_t                              Scoreboard3DeltaY;
690210e230b6Smaya   int32_t                              Scoreboard4DeltaX;
690310e230b6Smaya   int32_t                              Scoreboard4DeltaY;
690410e230b6Smaya   int32_t                              Scoreboard5DeltaX;
690510e230b6Smaya   int32_t                              Scoreboard5DeltaY;
690610e230b6Smaya   int32_t                              Scoreboard6DeltaX;
690710e230b6Smaya   int32_t                              Scoreboard6DeltaY;
690810e230b6Smaya   int32_t                              Scoreboard7DeltaX;
690910e230b6Smaya   int32_t                              Scoreboard7DeltaY;
691010e230b6Smaya};
691110e230b6Smaya
691296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
691396c5ddc4SrjsGFX8_MEDIA_VFE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
691410e230b6Smaya                          __attribute__((unused)) void * restrict dst,
691596c5ddc4Srjs                          __attribute__((unused)) const struct GFX8_MEDIA_VFE_STATE * restrict values)
691610e230b6Smaya{
691710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
691810e230b6Smaya
691910e230b6Smaya   dw[0] =
692010e230b6Smaya      __gen_uint(values->DWordLength, 0, 15) |
692110e230b6Smaya      __gen_uint(values->SubOpcode, 16, 23) |
692210e230b6Smaya      __gen_uint(values->MediaCommandOpcode, 24, 26) |
692310e230b6Smaya      __gen_uint(values->Pipeline, 27, 28) |
692410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
692510e230b6Smaya
692610e230b6Smaya   const uint64_t v1 =
692710e230b6Smaya      __gen_uint(values->PerThreadScratchSpace, 0, 3) |
692810e230b6Smaya      __gen_uint(values->StackSize, 4, 7);
692910e230b6Smaya   const uint64_t v1_address =
693096c5ddc4Srjs      __gen_address(data, &dw[1], values->ScratchSpaceBasePointer, v1, 10, 47);
693110e230b6Smaya   dw[1] = v1_address;
693210e230b6Smaya   dw[2] = (v1_address >> 32) | (v1 >> 32);
693310e230b6Smaya
693410e230b6Smaya   dw[3] =
693510e230b6Smaya      __gen_uint(values->BypassGatewayControl, 6, 6) |
693610e230b6Smaya      __gen_uint(values->ResetGatewayTimer, 7, 7) |
693710e230b6Smaya      __gen_uint(values->NumberofURBEntries, 8, 15) |
693810e230b6Smaya      __gen_uint(values->MaximumNumberofThreads, 16, 31);
693910e230b6Smaya
694010e230b6Smaya   dw[4] =
694110e230b6Smaya      __gen_uint(values->SliceDisable, 0, 1);
694210e230b6Smaya
694310e230b6Smaya   dw[5] =
694410e230b6Smaya      __gen_uint(values->CURBEAllocationSize, 0, 15) |
694510e230b6Smaya      __gen_uint(values->URBEntryAllocationSize, 16, 31);
694610e230b6Smaya
694710e230b6Smaya   dw[6] =
694810e230b6Smaya      __gen_uint(values->ScoreboardMask, 0, 7) |
694910e230b6Smaya      __gen_uint(values->ScoreboardType, 30, 30) |
695010e230b6Smaya      __gen_uint(values->ScoreboardEnable, 31, 31);
695110e230b6Smaya
695210e230b6Smaya   dw[7] =
695310e230b6Smaya      __gen_sint(values->Scoreboard0DeltaX, 0, 3) |
695410e230b6Smaya      __gen_sint(values->Scoreboard0DeltaY, 4, 7) |
695510e230b6Smaya      __gen_sint(values->Scoreboard1DeltaX, 8, 11) |
695610e230b6Smaya      __gen_sint(values->Scoreboard1DeltaY, 12, 15) |
695710e230b6Smaya      __gen_sint(values->Scoreboard2DeltaX, 16, 19) |
695810e230b6Smaya      __gen_sint(values->Scoreboard2DeltaY, 20, 23) |
695910e230b6Smaya      __gen_sint(values->Scoreboard3DeltaX, 24, 27) |
696010e230b6Smaya      __gen_sint(values->Scoreboard3DeltaY, 28, 31);
696110e230b6Smaya
696210e230b6Smaya   dw[8] =
696310e230b6Smaya      __gen_sint(values->Scoreboard4DeltaX, 0, 3) |
696410e230b6Smaya      __gen_sint(values->Scoreboard4DeltaY, 4, 7) |
696510e230b6Smaya      __gen_sint(values->Scoreboard5DeltaX, 8, 11) |
696610e230b6Smaya      __gen_sint(values->Scoreboard5DeltaY, 12, 15) |
696710e230b6Smaya      __gen_sint(values->Scoreboard6DeltaX, 16, 19) |
696810e230b6Smaya      __gen_sint(values->Scoreboard6DeltaY, 20, 23) |
696910e230b6Smaya      __gen_sint(values->Scoreboard7DeltaX, 24, 27) |
697010e230b6Smaya      __gen_sint(values->Scoreboard7DeltaY, 28, 31);
697110e230b6Smaya}
697210e230b6Smaya
697396c5ddc4Srjs#define GFX8_MI_ARB_CHECK_length               1
697496c5ddc4Srjs#define GFX8_MI_ARB_CHECK_length_bias          1
697596c5ddc4Srjs#define GFX8_MI_ARB_CHECK_header                \
697610e230b6Smaya   .MICommandOpcode                     =      5,  \
697710e230b6Smaya   .CommandType                         =      0
697810e230b6Smaya
697996c5ddc4Srjsstruct GFX8_MI_ARB_CHECK {
698010e230b6Smaya   uint32_t                             MICommandOpcode;
698110e230b6Smaya   uint32_t                             CommandType;
698210e230b6Smaya};
698310e230b6Smaya
698496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
698596c5ddc4SrjsGFX8_MI_ARB_CHECK_pack(__attribute__((unused)) __gen_user_data *data,
698610e230b6Smaya                       __attribute__((unused)) void * restrict dst,
698796c5ddc4Srjs                       __attribute__((unused)) const struct GFX8_MI_ARB_CHECK * restrict values)
698810e230b6Smaya{
698910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
699010e230b6Smaya
699110e230b6Smaya   dw[0] =
699210e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
699310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
699410e230b6Smaya}
699510e230b6Smaya
699696c5ddc4Srjs#define GFX8_MI_ARB_ON_OFF_length              1
699796c5ddc4Srjs#define GFX8_MI_ARB_ON_OFF_length_bias         1
699896c5ddc4Srjs#define GFX8_MI_ARB_ON_OFF_header               \
699910e230b6Smaya   .ArbitrationEnable                   =      1,  \
700010e230b6Smaya   .MICommandOpcode                     =      8,  \
700110e230b6Smaya   .CommandType                         =      0
700210e230b6Smaya
700396c5ddc4Srjsstruct GFX8_MI_ARB_ON_OFF {
700410e230b6Smaya   bool                                 ArbitrationEnable;
700510e230b6Smaya   uint32_t                             MICommandOpcode;
700610e230b6Smaya   uint32_t                             CommandType;
700710e230b6Smaya};
700810e230b6Smaya
700996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
701096c5ddc4SrjsGFX8_MI_ARB_ON_OFF_pack(__attribute__((unused)) __gen_user_data *data,
701110e230b6Smaya                        __attribute__((unused)) void * restrict dst,
701296c5ddc4Srjs                        __attribute__((unused)) const struct GFX8_MI_ARB_ON_OFF * restrict values)
701310e230b6Smaya{
701410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
701510e230b6Smaya
701610e230b6Smaya   dw[0] =
701710e230b6Smaya      __gen_uint(values->ArbitrationEnable, 0, 0) |
701810e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
701910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
702010e230b6Smaya}
702110e230b6Smaya
702296c5ddc4Srjs#define GFX8_MI_ATOMIC_length                  3
702396c5ddc4Srjs#define GFX8_MI_ATOMIC_length_bias             2
702496c5ddc4Srjs#define GFX8_MI_ATOMIC_header                   \
702510e230b6Smaya   .DWordLength                         =      1,  \
702610e230b6Smaya   .MICommandOpcode                     =     47,  \
702710e230b6Smaya   .CommandType                         =      0
702810e230b6Smaya
702996c5ddc4Srjsstruct GFX8_MI_ATOMIC {
703010e230b6Smaya   uint32_t                             DWordLength;
703110e230b6Smaya   uint32_t                             ATOMICOPCODE;
703210e230b6Smaya   uint32_t                             ReturnDataControl;
703310e230b6Smaya   uint32_t                             CSSTALL;
703410e230b6Smaya   uint32_t                             InlineData;
703510e230b6Smaya   uint32_t                             DataSize;
703610e230b6Smaya#define DWORD                                    0
703710e230b6Smaya#define QWORD                                    1
703810e230b6Smaya#define OCTWORD                                  2
703910e230b6Smaya#define RESERVED                                 3
704010e230b6Smaya   bool                                 PostSyncOperation;
704110e230b6Smaya   uint32_t                             MemoryType;
704210e230b6Smaya#define PerProcessGraphicsAddress                0
704310e230b6Smaya#define GlobalGraphicsAddress                    1
704410e230b6Smaya   uint32_t                             MICommandOpcode;
704510e230b6Smaya   uint32_t                             CommandType;
704610e230b6Smaya   __gen_address_type                   MemoryAddress;
704710e230b6Smaya   uint32_t                             Operand1DataDword0;
704810e230b6Smaya   uint32_t                             Operand2DataDword0;
704910e230b6Smaya   uint32_t                             Operand1DataDword1;
705010e230b6Smaya   uint32_t                             Operand2DataDword1;
705110e230b6Smaya   uint32_t                             Operand1DataDword2;
705210e230b6Smaya   uint32_t                             Operand2DataDword2;
705310e230b6Smaya   uint32_t                             Operand1DataDword3;
705410e230b6Smaya   uint32_t                             Operand2DataDword3;
705510e230b6Smaya};
705610e230b6Smaya
705796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
705896c5ddc4SrjsGFX8_MI_ATOMIC_pack(__attribute__((unused)) __gen_user_data *data,
705910e230b6Smaya                    __attribute__((unused)) void * restrict dst,
706096c5ddc4Srjs                    __attribute__((unused)) const struct GFX8_MI_ATOMIC * restrict values)
706110e230b6Smaya{
706210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
706310e230b6Smaya
706410e230b6Smaya   dw[0] =
706510e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
706610e230b6Smaya      __gen_uint(values->ATOMICOPCODE, 8, 15) |
706710e230b6Smaya      __gen_uint(values->ReturnDataControl, 16, 16) |
706810e230b6Smaya      __gen_uint(values->CSSTALL, 17, 17) |
706910e230b6Smaya      __gen_uint(values->InlineData, 18, 18) |
707010e230b6Smaya      __gen_uint(values->DataSize, 19, 20) |
707110e230b6Smaya      __gen_uint(values->PostSyncOperation, 21, 21) |
707210e230b6Smaya      __gen_uint(values->MemoryType, 22, 22) |
707310e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
707410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
707510e230b6Smaya
707610e230b6Smaya   const uint64_t v1_address =
707796c5ddc4Srjs      __gen_address(data, &dw[1], values->MemoryAddress, 0, 2, 47);
707810e230b6Smaya   dw[1] = v1_address;
707910e230b6Smaya   dw[2] = v1_address >> 32;
708010e230b6Smaya}
708110e230b6Smaya
708296c5ddc4Srjs#define GFX8_MI_BATCH_BUFFER_END_length        1
708396c5ddc4Srjs#define GFX8_MI_BATCH_BUFFER_END_length_bias      1
708496c5ddc4Srjs#define GFX8_MI_BATCH_BUFFER_END_header         \
708510e230b6Smaya   .MICommandOpcode                     =     10,  \
708610e230b6Smaya   .CommandType                         =      0
708710e230b6Smaya
708896c5ddc4Srjsstruct GFX8_MI_BATCH_BUFFER_END {
708910e230b6Smaya   uint32_t                             MICommandOpcode;
709010e230b6Smaya   uint32_t                             CommandType;
709110e230b6Smaya};
709210e230b6Smaya
709396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
709496c5ddc4SrjsGFX8_MI_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
709510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
709696c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_MI_BATCH_BUFFER_END * restrict values)
709710e230b6Smaya{
709810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
709910e230b6Smaya
710010e230b6Smaya   dw[0] =
710110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
710210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
710310e230b6Smaya}
710410e230b6Smaya
710596c5ddc4Srjs#define GFX8_MI_BATCH_BUFFER_START_length      3
710696c5ddc4Srjs#define GFX8_MI_BATCH_BUFFER_START_length_bias      2
710796c5ddc4Srjs#define GFX8_MI_BATCH_BUFFER_START_header       \
710810e230b6Smaya   .DWordLength                         =      1,  \
710910e230b6Smaya   .MICommandOpcode                     =     49,  \
711010e230b6Smaya   .CommandType                         =      0
711110e230b6Smaya
711296c5ddc4Srjsstruct GFX8_MI_BATCH_BUFFER_START {
711310e230b6Smaya   uint32_t                             DWordLength;
711410e230b6Smaya   uint32_t                             AddressSpaceIndicator;
711510e230b6Smaya#define ASI_GGTT                                 0
711610e230b6Smaya#define ASI_PPGTT                                1
711710e230b6Smaya   bool                                 ResourceStreamerEnable;
711810e230b6Smaya   bool                                 PredicationEnable;
711910e230b6Smaya   bool                                 AddOffsetEnable;
712010e230b6Smaya   uint32_t                             SecondLevelBatchBuffer;
712110e230b6Smaya#define Firstlevelbatch                          0
712210e230b6Smaya#define Secondlevelbatch                         1
712310e230b6Smaya   uint32_t                             MICommandOpcode;
712410e230b6Smaya   uint32_t                             CommandType;
712510e230b6Smaya   __gen_address_type                   BatchBufferStartAddress;
712610e230b6Smaya};
712710e230b6Smaya
712896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
712996c5ddc4SrjsGFX8_MI_BATCH_BUFFER_START_pack(__attribute__((unused)) __gen_user_data *data,
713010e230b6Smaya                                __attribute__((unused)) void * restrict dst,
713196c5ddc4Srjs                                __attribute__((unused)) const struct GFX8_MI_BATCH_BUFFER_START * restrict values)
713210e230b6Smaya{
713310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
713410e230b6Smaya
713510e230b6Smaya   dw[0] =
713610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
713710e230b6Smaya      __gen_uint(values->AddressSpaceIndicator, 8, 8) |
713810e230b6Smaya      __gen_uint(values->ResourceStreamerEnable, 10, 10) |
713910e230b6Smaya      __gen_uint(values->PredicationEnable, 15, 15) |
714010e230b6Smaya      __gen_uint(values->AddOffsetEnable, 16, 16) |
714110e230b6Smaya      __gen_uint(values->SecondLevelBatchBuffer, 22, 22) |
714210e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
714310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
714410e230b6Smaya
714510e230b6Smaya   const uint64_t v1_address =
714696c5ddc4Srjs      __gen_address(data, &dw[1], values->BatchBufferStartAddress, 0, 2, 47);
714710e230b6Smaya   dw[1] = v1_address;
714810e230b6Smaya   dw[2] = v1_address >> 32;
714910e230b6Smaya}
715010e230b6Smaya
715196c5ddc4Srjs#define GFX8_MI_CLFLUSH_length_bias            2
715296c5ddc4Srjs#define GFX8_MI_CLFLUSH_header                  \
715310e230b6Smaya   .DWordLength                         =      1,  \
715410e230b6Smaya   .MICommandOpcode                     =     39,  \
715510e230b6Smaya   .CommandType                         =      0
715610e230b6Smaya
715796c5ddc4Srjsstruct GFX8_MI_CLFLUSH {
715810e230b6Smaya   uint32_t                             DWordLength;
715910e230b6Smaya   bool                                 UseGlobalGTT;
716010e230b6Smaya   uint32_t                             MICommandOpcode;
716110e230b6Smaya   uint32_t                             CommandType;
716210e230b6Smaya   uint32_t                             StartingCachelineOffset;
716310e230b6Smaya   __gen_address_type                   PageBaseAddress;
716410e230b6Smaya   /* variable length fields follow */
716510e230b6Smaya};
716610e230b6Smaya
716796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
716896c5ddc4SrjsGFX8_MI_CLFLUSH_pack(__attribute__((unused)) __gen_user_data *data,
716910e230b6Smaya                     __attribute__((unused)) void * restrict dst,
717096c5ddc4Srjs                     __attribute__((unused)) const struct GFX8_MI_CLFLUSH * restrict values)
717110e230b6Smaya{
717210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
717310e230b6Smaya
717410e230b6Smaya   dw[0] =
717510e230b6Smaya      __gen_uint(values->DWordLength, 0, 9) |
717610e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
717710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
717810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
717910e230b6Smaya
718010e230b6Smaya   const uint64_t v1 =
718110e230b6Smaya      __gen_uint(values->StartingCachelineOffset, 6, 11);
718210e230b6Smaya   const uint64_t v1_address =
718396c5ddc4Srjs      __gen_address(data, &dw[1], values->PageBaseAddress, v1, 12, 47);
718410e230b6Smaya   dw[1] = v1_address;
718510e230b6Smaya   dw[2] = (v1_address >> 32) | (v1 >> 32);
718610e230b6Smaya}
718710e230b6Smaya
718896c5ddc4Srjs#define GFX8_MI_CONDITIONAL_BATCH_BUFFER_END_length      3
718996c5ddc4Srjs#define GFX8_MI_CONDITIONAL_BATCH_BUFFER_END_length_bias      2
719096c5ddc4Srjs#define GFX8_MI_CONDITIONAL_BATCH_BUFFER_END_header\
719110e230b6Smaya   .DWordLength                         =      1,  \
719210e230b6Smaya   .CompareSemaphore                    =      0,  \
719310e230b6Smaya   .MICommandOpcode                     =     54,  \
719410e230b6Smaya   .CommandType                         =      0
719510e230b6Smaya
719696c5ddc4Srjsstruct GFX8_MI_CONDITIONAL_BATCH_BUFFER_END {
719710e230b6Smaya   uint32_t                             DWordLength;
719810e230b6Smaya   uint32_t                             CompareSemaphore;
719910e230b6Smaya   bool                                 UseGlobalGTT;
720010e230b6Smaya   uint32_t                             MICommandOpcode;
720110e230b6Smaya   uint32_t                             CommandType;
720210e230b6Smaya   uint32_t                             CompareDataDword;
720310e230b6Smaya   __gen_address_type                   CompareAddress;
720410e230b6Smaya};
720510e230b6Smaya
720696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
720796c5ddc4SrjsGFX8_MI_CONDITIONAL_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
720810e230b6Smaya                                          __attribute__((unused)) void * restrict dst,
720996c5ddc4Srjs                                          __attribute__((unused)) const struct GFX8_MI_CONDITIONAL_BATCH_BUFFER_END * restrict values)
721010e230b6Smaya{
721110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
721210e230b6Smaya
721310e230b6Smaya   dw[0] =
721410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
721510e230b6Smaya      __gen_uint(values->CompareSemaphore, 21, 21) |
721610e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
721710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
721810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
721910e230b6Smaya
722010e230b6Smaya   dw[1] =
722110e230b6Smaya      __gen_uint(values->CompareDataDword, 0, 31);
722210e230b6Smaya
722310e230b6Smaya   const uint64_t v2_address =
722496c5ddc4Srjs      __gen_address(data, &dw[2], values->CompareAddress, 0, 3, 47);
722510e230b6Smaya   dw[2] = v2_address;
722610e230b6Smaya   dw[3] = v2_address >> 32;
722710e230b6Smaya}
722810e230b6Smaya
722996c5ddc4Srjs#define GFX8_MI_COPY_MEM_MEM_length            5
723096c5ddc4Srjs#define GFX8_MI_COPY_MEM_MEM_length_bias       2
723196c5ddc4Srjs#define GFX8_MI_COPY_MEM_MEM_header             \
723210e230b6Smaya   .DWordLength                         =      3,  \
723310e230b6Smaya   .MICommandOpcode                     =     46,  \
723410e230b6Smaya   .CommandType                         =      0
723510e230b6Smaya
723696c5ddc4Srjsstruct GFX8_MI_COPY_MEM_MEM {
723710e230b6Smaya   uint32_t                             DWordLength;
723810e230b6Smaya   bool                                 UseGlobalGTTDestination;
723910e230b6Smaya   bool                                 UseGlobalGTTSource;
724010e230b6Smaya   uint32_t                             MICommandOpcode;
724110e230b6Smaya   uint32_t                             CommandType;
724210e230b6Smaya   __gen_address_type                   DestinationMemoryAddress;
724310e230b6Smaya   __gen_address_type                   SourceMemoryAddress;
724410e230b6Smaya};
724510e230b6Smaya
724696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
724796c5ddc4SrjsGFX8_MI_COPY_MEM_MEM_pack(__attribute__((unused)) __gen_user_data *data,
724810e230b6Smaya                          __attribute__((unused)) void * restrict dst,
724996c5ddc4Srjs                          __attribute__((unused)) const struct GFX8_MI_COPY_MEM_MEM * restrict values)
725010e230b6Smaya{
725110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
725210e230b6Smaya
725310e230b6Smaya   dw[0] =
725410e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
725510e230b6Smaya      __gen_uint(values->UseGlobalGTTDestination, 21, 21) |
725610e230b6Smaya      __gen_uint(values->UseGlobalGTTSource, 22, 22) |
725710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
725810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
725910e230b6Smaya
726010e230b6Smaya   const uint64_t v1_address =
726196c5ddc4Srjs      __gen_address(data, &dw[1], values->DestinationMemoryAddress, 0, 2, 63);
726210e230b6Smaya   dw[1] = v1_address;
726310e230b6Smaya   dw[2] = v1_address >> 32;
726410e230b6Smaya
726510e230b6Smaya   const uint64_t v3_address =
726696c5ddc4Srjs      __gen_address(data, &dw[3], values->SourceMemoryAddress, 0, 2, 63);
726710e230b6Smaya   dw[3] = v3_address;
726810e230b6Smaya   dw[4] = v3_address >> 32;
726910e230b6Smaya}
727010e230b6Smaya
727196c5ddc4Srjs#define GFX8_MI_LOAD_REGISTER_IMM_length       3
727296c5ddc4Srjs#define GFX8_MI_LOAD_REGISTER_IMM_length_bias      2
727396c5ddc4Srjs#define GFX8_MI_LOAD_REGISTER_IMM_header        \
727410e230b6Smaya   .DWordLength                         =      1,  \
727510e230b6Smaya   .MICommandOpcode                     =     34,  \
727610e230b6Smaya   .CommandType                         =      0
727710e230b6Smaya
727896c5ddc4Srjsstruct GFX8_MI_LOAD_REGISTER_IMM {
727910e230b6Smaya   uint32_t                             DWordLength;
728010e230b6Smaya   uint32_t                             ByteWriteDisables;
728110e230b6Smaya   uint32_t                             MICommandOpcode;
728210e230b6Smaya   uint32_t                             CommandType;
728310e230b6Smaya   uint64_t                             RegisterOffset;
728410e230b6Smaya   uint32_t                             DataDWord;
728510e230b6Smaya   /* variable length fields follow */
728610e230b6Smaya};
728710e230b6Smaya
728896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
728996c5ddc4SrjsGFX8_MI_LOAD_REGISTER_IMM_pack(__attribute__((unused)) __gen_user_data *data,
729010e230b6Smaya                               __attribute__((unused)) void * restrict dst,
729196c5ddc4Srjs                               __attribute__((unused)) const struct GFX8_MI_LOAD_REGISTER_IMM * 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->ByteWriteDisables, 8, 11) |
729810e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
729910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
730010e230b6Smaya
730110e230b6Smaya   dw[1] =
730210e230b6Smaya      __gen_offset(values->RegisterOffset, 2, 22);
730310e230b6Smaya
730410e230b6Smaya   dw[2] =
730510e230b6Smaya      __gen_uint(values->DataDWord, 0, 31);
730610e230b6Smaya}
730710e230b6Smaya
730896c5ddc4Srjs#define GFX8_MI_LOAD_REGISTER_MEM_length       4
730996c5ddc4Srjs#define GFX8_MI_LOAD_REGISTER_MEM_length_bias      2
731096c5ddc4Srjs#define GFX8_MI_LOAD_REGISTER_MEM_header        \
731110e230b6Smaya   .DWordLength                         =      2,  \
731210e230b6Smaya   .MICommandOpcode                     =     41,  \
731310e230b6Smaya   .CommandType                         =      0
731410e230b6Smaya
731596c5ddc4Srjsstruct GFX8_MI_LOAD_REGISTER_MEM {
731610e230b6Smaya   uint32_t                             DWordLength;
731710e230b6Smaya   bool                                 AsyncModeEnable;
731810e230b6Smaya   bool                                 UseGlobalGTT;
731910e230b6Smaya   uint32_t                             MICommandOpcode;
732010e230b6Smaya   uint32_t                             CommandType;
732110e230b6Smaya   uint64_t                             RegisterAddress;
732210e230b6Smaya   __gen_address_type                   MemoryAddress;
732310e230b6Smaya};
732410e230b6Smaya
732596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
732696c5ddc4SrjsGFX8_MI_LOAD_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
732710e230b6Smaya                               __attribute__((unused)) void * restrict dst,
732896c5ddc4Srjs                               __attribute__((unused)) const struct GFX8_MI_LOAD_REGISTER_MEM * restrict values)
732910e230b6Smaya{
733010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
733110e230b6Smaya
733210e230b6Smaya   dw[0] =
733310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
733410e230b6Smaya      __gen_uint(values->AsyncModeEnable, 21, 21) |
733510e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
733610e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
733710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
733810e230b6Smaya
733910e230b6Smaya   dw[1] =
734010e230b6Smaya      __gen_offset(values->RegisterAddress, 2, 22);
734110e230b6Smaya
734210e230b6Smaya   const uint64_t v2_address =
734396c5ddc4Srjs      __gen_address(data, &dw[2], values->MemoryAddress, 0, 2, 63);
734410e230b6Smaya   dw[2] = v2_address;
734510e230b6Smaya   dw[3] = v2_address >> 32;
734610e230b6Smaya}
734710e230b6Smaya
734896c5ddc4Srjs#define GFX8_MI_LOAD_REGISTER_REG_length       3
734996c5ddc4Srjs#define GFX8_MI_LOAD_REGISTER_REG_length_bias      2
735096c5ddc4Srjs#define GFX8_MI_LOAD_REGISTER_REG_header        \
735110e230b6Smaya   .DWordLength                         =      1,  \
735210e230b6Smaya   .MICommandOpcode                     =     42,  \
735310e230b6Smaya   .CommandType                         =      0
735410e230b6Smaya
735596c5ddc4Srjsstruct GFX8_MI_LOAD_REGISTER_REG {
735610e230b6Smaya   uint32_t                             DWordLength;
735710e230b6Smaya   uint32_t                             MICommandOpcode;
735810e230b6Smaya   uint32_t                             CommandType;
735910e230b6Smaya   uint64_t                             SourceRegisterAddress;
736010e230b6Smaya   uint64_t                             DestinationRegisterAddress;
736110e230b6Smaya};
736210e230b6Smaya
736396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
736496c5ddc4SrjsGFX8_MI_LOAD_REGISTER_REG_pack(__attribute__((unused)) __gen_user_data *data,
736510e230b6Smaya                               __attribute__((unused)) void * restrict dst,
736696c5ddc4Srjs                               __attribute__((unused)) const struct GFX8_MI_LOAD_REGISTER_REG * restrict values)
736710e230b6Smaya{
736810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
736910e230b6Smaya
737010e230b6Smaya   dw[0] =
737110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
737210e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
737310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
737410e230b6Smaya
737510e230b6Smaya   dw[1] =
737610e230b6Smaya      __gen_offset(values->SourceRegisterAddress, 2, 22);
737710e230b6Smaya
737810e230b6Smaya   dw[2] =
737910e230b6Smaya      __gen_offset(values->DestinationRegisterAddress, 2, 22);
738010e230b6Smaya}
738110e230b6Smaya
738296c5ddc4Srjs#define GFX8_MI_LOAD_SCAN_LINES_EXCL_length      2
738396c5ddc4Srjs#define GFX8_MI_LOAD_SCAN_LINES_EXCL_length_bias      2
738496c5ddc4Srjs#define GFX8_MI_LOAD_SCAN_LINES_EXCL_header     \
738510e230b6Smaya   .DWordLength                         =      0,  \
738610e230b6Smaya   .MICommandOpcode                     =     19,  \
738710e230b6Smaya   .CommandType                         =      0
738810e230b6Smaya
738996c5ddc4Srjsstruct GFX8_MI_LOAD_SCAN_LINES_EXCL {
739010e230b6Smaya   uint32_t                             DWordLength;
739110e230b6Smaya   uint32_t                             DisplayPlaneSelect;
739210e230b6Smaya#define DisplayPlaneA                            0
739310e230b6Smaya#define DisplayPlaneB                            1
739410e230b6Smaya#define DisplayPlaneC                            4
739510e230b6Smaya   uint32_t                             MICommandOpcode;
739610e230b6Smaya   uint32_t                             CommandType;
739710e230b6Smaya   uint32_t                             EndScanLineNumber;
739810e230b6Smaya   uint32_t                             StartScanLineNumber;
739910e230b6Smaya};
740010e230b6Smaya
740196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
740296c5ddc4SrjsGFX8_MI_LOAD_SCAN_LINES_EXCL_pack(__attribute__((unused)) __gen_user_data *data,
740310e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
740496c5ddc4Srjs                                  __attribute__((unused)) const struct GFX8_MI_LOAD_SCAN_LINES_EXCL * restrict values)
740510e230b6Smaya{
740610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
740710e230b6Smaya
740810e230b6Smaya   dw[0] =
740910e230b6Smaya      __gen_uint(values->DWordLength, 0, 5) |
741010e230b6Smaya      __gen_uint(values->DisplayPlaneSelect, 19, 21) |
741110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
741210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
741310e230b6Smaya
741410e230b6Smaya   dw[1] =
741510e230b6Smaya      __gen_uint(values->EndScanLineNumber, 0, 12) |
741610e230b6Smaya      __gen_uint(values->StartScanLineNumber, 16, 28);
741710e230b6Smaya}
741810e230b6Smaya
741996c5ddc4Srjs#define GFX8_MI_LOAD_SCAN_LINES_INCL_length      2
742096c5ddc4Srjs#define GFX8_MI_LOAD_SCAN_LINES_INCL_length_bias      2
742196c5ddc4Srjs#define GFX8_MI_LOAD_SCAN_LINES_INCL_header     \
742210e230b6Smaya   .DWordLength                         =      0,  \
742310e230b6Smaya   .MICommandOpcode                     =     18,  \
742410e230b6Smaya   .CommandType                         =      0
742510e230b6Smaya
742696c5ddc4Srjsstruct GFX8_MI_LOAD_SCAN_LINES_INCL {
742710e230b6Smaya   uint32_t                             DWordLength;
742810e230b6Smaya   uint32_t                             ScanLineEventDoneForward;
742910e230b6Smaya   uint32_t                             DisplayPlaneSelect;
743010e230b6Smaya#define DisplayPlaneA                            0
743110e230b6Smaya#define DisplayPlaneB                            1
743210e230b6Smaya#define DisplayPlaneC                            4
743310e230b6Smaya   uint32_t                             MICommandOpcode;
743410e230b6Smaya   uint32_t                             CommandType;
743510e230b6Smaya   uint32_t                             EndScanLineNumber;
743610e230b6Smaya   uint32_t                             StartScanLineNumber;
743710e230b6Smaya};
743810e230b6Smaya
743996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
744096c5ddc4SrjsGFX8_MI_LOAD_SCAN_LINES_INCL_pack(__attribute__((unused)) __gen_user_data *data,
744110e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
744296c5ddc4Srjs                                  __attribute__((unused)) const struct GFX8_MI_LOAD_SCAN_LINES_INCL * restrict values)
744310e230b6Smaya{
744410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
744510e230b6Smaya
744610e230b6Smaya   dw[0] =
744710e230b6Smaya      __gen_uint(values->DWordLength, 0, 5) |
744810e230b6Smaya      __gen_uint(values->ScanLineEventDoneForward, 17, 18) |
744910e230b6Smaya      __gen_uint(values->DisplayPlaneSelect, 19, 21) |
745010e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
745110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
745210e230b6Smaya
745310e230b6Smaya   dw[1] =
745410e230b6Smaya      __gen_uint(values->EndScanLineNumber, 0, 12) |
745510e230b6Smaya      __gen_uint(values->StartScanLineNumber, 16, 28);
745610e230b6Smaya}
745710e230b6Smaya
745896c5ddc4Srjs#define GFX8_MI_LOAD_URB_MEM_length            4
745996c5ddc4Srjs#define GFX8_MI_LOAD_URB_MEM_length_bias       2
746096c5ddc4Srjs#define GFX8_MI_LOAD_URB_MEM_header             \
746110e230b6Smaya   .DWordLength                         =      2,  \
746210e230b6Smaya   .MICommandOpcode                     =     44,  \
746310e230b6Smaya   .CommandType                         =      0
746410e230b6Smaya
746596c5ddc4Srjsstruct GFX8_MI_LOAD_URB_MEM {
746610e230b6Smaya   uint32_t                             DWordLength;
746710e230b6Smaya   uint32_t                             MICommandOpcode;
746810e230b6Smaya   uint32_t                             CommandType;
746910e230b6Smaya   uint32_t                             URBAddress;
747010e230b6Smaya   __gen_address_type                   MemoryAddress;
747110e230b6Smaya};
747210e230b6Smaya
747396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
747496c5ddc4SrjsGFX8_MI_LOAD_URB_MEM_pack(__attribute__((unused)) __gen_user_data *data,
747510e230b6Smaya                          __attribute__((unused)) void * restrict dst,
747696c5ddc4Srjs                          __attribute__((unused)) const struct GFX8_MI_LOAD_URB_MEM * restrict values)
747710e230b6Smaya{
747810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
747910e230b6Smaya
748010e230b6Smaya   dw[0] =
748110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
748210e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
748310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
748410e230b6Smaya
748510e230b6Smaya   dw[1] =
748610e230b6Smaya      __gen_uint(values->URBAddress, 2, 14);
748710e230b6Smaya
748810e230b6Smaya   const uint64_t v2_address =
748996c5ddc4Srjs      __gen_address(data, &dw[2], values->MemoryAddress, 0, 6, 63);
749010e230b6Smaya   dw[2] = v2_address;
749110e230b6Smaya   dw[3] = v2_address >> 32;
749210e230b6Smaya}
749310e230b6Smaya
749496c5ddc4Srjs#define GFX8_MI_MATH_length_bias               2
749596c5ddc4Srjs#define GFX8_MI_MATH_header                     \
749610e230b6Smaya   .DWordLength                         =      0,  \
749710e230b6Smaya   .MICommandOpcode                     =     26,  \
749810e230b6Smaya   .CommandType                         =      0
749910e230b6Smaya
750096c5ddc4Srjsstruct GFX8_MI_MATH {
750110e230b6Smaya   uint32_t                             DWordLength;
750210e230b6Smaya   uint32_t                             MICommandOpcode;
750310e230b6Smaya   uint32_t                             CommandType;
750410e230b6Smaya   /* variable length fields follow */
750510e230b6Smaya};
750610e230b6Smaya
750796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
750896c5ddc4SrjsGFX8_MI_MATH_pack(__attribute__((unused)) __gen_user_data *data,
750910e230b6Smaya                  __attribute__((unused)) void * restrict dst,
751096c5ddc4Srjs                  __attribute__((unused)) const struct GFX8_MI_MATH * restrict values)
751110e230b6Smaya{
751210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
751310e230b6Smaya
751410e230b6Smaya   dw[0] =
751510e230b6Smaya      __gen_uint(values->DWordLength, 0, 5) |
751610e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
751710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
751810e230b6Smaya}
751910e230b6Smaya
752096c5ddc4Srjs#define GFX8_MI_NOOP_length                    1
752196c5ddc4Srjs#define GFX8_MI_NOOP_length_bias               1
752296c5ddc4Srjs#define GFX8_MI_NOOP_header                     \
752310e230b6Smaya   .MICommandOpcode                     =      0,  \
752410e230b6Smaya   .CommandType                         =      0
752510e230b6Smaya
752696c5ddc4Srjsstruct GFX8_MI_NOOP {
752710e230b6Smaya   uint32_t                             IdentificationNumber;
752810e230b6Smaya   bool                                 IdentificationNumberRegisterWriteEnable;
752910e230b6Smaya   uint32_t                             MICommandOpcode;
753010e230b6Smaya   uint32_t                             CommandType;
753110e230b6Smaya};
753210e230b6Smaya
753396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
753496c5ddc4SrjsGFX8_MI_NOOP_pack(__attribute__((unused)) __gen_user_data *data,
753510e230b6Smaya                  __attribute__((unused)) void * restrict dst,
753696c5ddc4Srjs                  __attribute__((unused)) const struct GFX8_MI_NOOP * restrict values)
753710e230b6Smaya{
753810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
753910e230b6Smaya
754010e230b6Smaya   dw[0] =
754110e230b6Smaya      __gen_uint(values->IdentificationNumber, 0, 21) |
754210e230b6Smaya      __gen_uint(values->IdentificationNumberRegisterWriteEnable, 22, 22) |
754310e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
754410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
754510e230b6Smaya}
754610e230b6Smaya
754796c5ddc4Srjs#define GFX8_MI_PREDICATE_length               1
754896c5ddc4Srjs#define GFX8_MI_PREDICATE_length_bias          1
754996c5ddc4Srjs#define GFX8_MI_PREDICATE_header                \
755010e230b6Smaya   .MICommandOpcode                     =     12,  \
755110e230b6Smaya   .CommandType                         =      0
755210e230b6Smaya
755396c5ddc4Srjsstruct GFX8_MI_PREDICATE {
755410e230b6Smaya   uint32_t                             CompareOperation;
755510e230b6Smaya#define COMPARE_TRUE                             0
755610e230b6Smaya#define COMPARE_FALSE                            1
755710e230b6Smaya#define COMPARE_SRCS_EQUAL                       2
755810e230b6Smaya#define COMPARE_DELTAS_EQUAL                     3
755910e230b6Smaya   uint32_t                             CombineOperation;
756010e230b6Smaya#define COMBINE_SET                              0
756110e230b6Smaya#define COMBINE_AND                              1
756210e230b6Smaya#define COMBINE_OR                               2
756310e230b6Smaya#define COMBINE_XOR                              3
756410e230b6Smaya   uint32_t                             LoadOperation;
756510e230b6Smaya#define LOAD_KEEP                                0
756610e230b6Smaya#define LOAD_LOAD                                2
756710e230b6Smaya#define LOAD_LOADINV                             3
756810e230b6Smaya   uint32_t                             MICommandOpcode;
756910e230b6Smaya   uint32_t                             CommandType;
757010e230b6Smaya};
757110e230b6Smaya
757296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
757396c5ddc4SrjsGFX8_MI_PREDICATE_pack(__attribute__((unused)) __gen_user_data *data,
757410e230b6Smaya                       __attribute__((unused)) void * restrict dst,
757596c5ddc4Srjs                       __attribute__((unused)) const struct GFX8_MI_PREDICATE * restrict values)
757610e230b6Smaya{
757710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
757810e230b6Smaya
757910e230b6Smaya   dw[0] =
758010e230b6Smaya      __gen_uint(values->CompareOperation, 0, 1) |
758110e230b6Smaya      __gen_uint(values->CombineOperation, 3, 4) |
758210e230b6Smaya      __gen_uint(values->LoadOperation, 6, 7) |
758310e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
758410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
758510e230b6Smaya}
758610e230b6Smaya
758796c5ddc4Srjs#define GFX8_MI_REPORT_HEAD_length             1
758896c5ddc4Srjs#define GFX8_MI_REPORT_HEAD_length_bias        1
758996c5ddc4Srjs#define GFX8_MI_REPORT_HEAD_header              \
759010e230b6Smaya   .MICommandOpcode                     =      7,  \
759110e230b6Smaya   .CommandType                         =      0
759210e230b6Smaya
759396c5ddc4Srjsstruct GFX8_MI_REPORT_HEAD {
759410e230b6Smaya   uint32_t                             MICommandOpcode;
759510e230b6Smaya   uint32_t                             CommandType;
759610e230b6Smaya};
759710e230b6Smaya
759896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
759996c5ddc4SrjsGFX8_MI_REPORT_HEAD_pack(__attribute__((unused)) __gen_user_data *data,
760010e230b6Smaya                         __attribute__((unused)) void * restrict dst,
760196c5ddc4Srjs                         __attribute__((unused)) const struct GFX8_MI_REPORT_HEAD * restrict values)
760210e230b6Smaya{
760310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
760410e230b6Smaya
760510e230b6Smaya   dw[0] =
760610e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
760710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
760810e230b6Smaya}
760910e230b6Smaya
761096c5ddc4Srjs#define GFX8_MI_REPORT_PERF_COUNT_length       4
761196c5ddc4Srjs#define GFX8_MI_REPORT_PERF_COUNT_length_bias      2
761296c5ddc4Srjs#define GFX8_MI_REPORT_PERF_COUNT_header        \
761310e230b6Smaya   .DWordLength                         =      2,  \
761410e230b6Smaya   .MICommandOpcode                     =     40,  \
761510e230b6Smaya   .CommandType                         =      0
761610e230b6Smaya
761796c5ddc4Srjsstruct GFX8_MI_REPORT_PERF_COUNT {
761810e230b6Smaya   uint32_t                             DWordLength;
761910e230b6Smaya   uint32_t                             MICommandOpcode;
762010e230b6Smaya   uint32_t                             CommandType;
762110e230b6Smaya   bool                                 UseGlobalGTT;
762210e230b6Smaya   uint32_t                             CoreModeEnable;
762310e230b6Smaya   __gen_address_type                   MemoryAddress;
762410e230b6Smaya   uint32_t                             ReportID;
762510e230b6Smaya};
762610e230b6Smaya
762796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
762896c5ddc4SrjsGFX8_MI_REPORT_PERF_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
762910e230b6Smaya                               __attribute__((unused)) void * restrict dst,
763096c5ddc4Srjs                               __attribute__((unused)) const struct GFX8_MI_REPORT_PERF_COUNT * restrict values)
763110e230b6Smaya{
763210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
763310e230b6Smaya
763410e230b6Smaya   dw[0] =
763510e230b6Smaya      __gen_uint(values->DWordLength, 0, 5) |
763610e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
763710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
763810e230b6Smaya
763910e230b6Smaya   const uint64_t v1 =
764010e230b6Smaya      __gen_uint(values->UseGlobalGTT, 0, 0) |
764110e230b6Smaya      __gen_uint(values->CoreModeEnable, 4, 4);
764210e230b6Smaya   const uint64_t v1_address =
764396c5ddc4Srjs      __gen_address(data, &dw[1], values->MemoryAddress, v1, 6, 63);
764410e230b6Smaya   dw[1] = v1_address;
764510e230b6Smaya   dw[2] = (v1_address >> 32) | (v1 >> 32);
764610e230b6Smaya
764710e230b6Smaya   dw[3] =
764810e230b6Smaya      __gen_uint(values->ReportID, 0, 31);
764910e230b6Smaya}
765010e230b6Smaya
765196c5ddc4Srjs#define GFX8_MI_RS_CONTEXT_length              1
765296c5ddc4Srjs#define GFX8_MI_RS_CONTEXT_length_bias         1
765396c5ddc4Srjs#define GFX8_MI_RS_CONTEXT_header               \
765410e230b6Smaya   .MICommandOpcode                     =     15,  \
765510e230b6Smaya   .CommandType                         =      0
765610e230b6Smaya
765796c5ddc4Srjsstruct GFX8_MI_RS_CONTEXT {
765810e230b6Smaya   uint32_t                             ResourceStreamerSave;
765910e230b6Smaya#define RS_Restore                               0
766010e230b6Smaya#define RS_Save                                  1
766110e230b6Smaya   uint32_t                             MICommandOpcode;
766210e230b6Smaya   uint32_t                             CommandType;
766310e230b6Smaya};
766410e230b6Smaya
766596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
766696c5ddc4SrjsGFX8_MI_RS_CONTEXT_pack(__attribute__((unused)) __gen_user_data *data,
766710e230b6Smaya                        __attribute__((unused)) void * restrict dst,
766896c5ddc4Srjs                        __attribute__((unused)) const struct GFX8_MI_RS_CONTEXT * restrict values)
766910e230b6Smaya{
767010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
767110e230b6Smaya
767210e230b6Smaya   dw[0] =
767310e230b6Smaya      __gen_uint(values->ResourceStreamerSave, 0, 0) |
767410e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
767510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
767610e230b6Smaya}
767710e230b6Smaya
767896c5ddc4Srjs#define GFX8_MI_RS_CONTROL_length              1
767996c5ddc4Srjs#define GFX8_MI_RS_CONTROL_length_bias         1
768096c5ddc4Srjs#define GFX8_MI_RS_CONTROL_header               \
768110e230b6Smaya   .MICommandOpcode                     =      6,  \
768210e230b6Smaya   .CommandType                         =      0
768310e230b6Smaya
768496c5ddc4Srjsstruct GFX8_MI_RS_CONTROL {
768510e230b6Smaya   uint32_t                             ResourceStreamerControl;
768610e230b6Smaya#define RS_Stop                                  0
768710e230b6Smaya#define RS_Start                                 1
768810e230b6Smaya   uint32_t                             MICommandOpcode;
768910e230b6Smaya   uint32_t                             CommandType;
769010e230b6Smaya};
769110e230b6Smaya
769296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
769396c5ddc4SrjsGFX8_MI_RS_CONTROL_pack(__attribute__((unused)) __gen_user_data *data,
769410e230b6Smaya                        __attribute__((unused)) void * restrict dst,
769596c5ddc4Srjs                        __attribute__((unused)) const struct GFX8_MI_RS_CONTROL * restrict values)
769610e230b6Smaya{
769710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
769810e230b6Smaya
769910e230b6Smaya   dw[0] =
770010e230b6Smaya      __gen_uint(values->ResourceStreamerControl, 0, 0) |
770110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
770210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
770310e230b6Smaya}
770410e230b6Smaya
770596c5ddc4Srjs#define GFX8_MI_RS_STORE_DATA_IMM_length       4
770696c5ddc4Srjs#define GFX8_MI_RS_STORE_DATA_IMM_length_bias      2
770796c5ddc4Srjs#define GFX8_MI_RS_STORE_DATA_IMM_header        \
770810e230b6Smaya   .DWordLength                         =      2,  \
770910e230b6Smaya   .MICommandOpcode                     =     43,  \
771010e230b6Smaya   .CommandType                         =      0
771110e230b6Smaya
771296c5ddc4Srjsstruct GFX8_MI_RS_STORE_DATA_IMM {
771310e230b6Smaya   uint32_t                             DWordLength;
771410e230b6Smaya   uint32_t                             MICommandOpcode;
771510e230b6Smaya   uint32_t                             CommandType;
771610e230b6Smaya   uint32_t                             CoreModeEnable;
771710e230b6Smaya   __gen_address_type                   DestinationAddress;
771810e230b6Smaya   uint32_t                             DataDWord0;
771910e230b6Smaya};
772010e230b6Smaya
772196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
772296c5ddc4SrjsGFX8_MI_RS_STORE_DATA_IMM_pack(__attribute__((unused)) __gen_user_data *data,
772310e230b6Smaya                               __attribute__((unused)) void * restrict dst,
772496c5ddc4Srjs                               __attribute__((unused)) const struct GFX8_MI_RS_STORE_DATA_IMM * restrict values)
772510e230b6Smaya{
772610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
772710e230b6Smaya
772810e230b6Smaya   dw[0] =
772910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
773010e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
773110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
773210e230b6Smaya
773310e230b6Smaya   const uint64_t v1 =
773410e230b6Smaya      __gen_uint(values->CoreModeEnable, 0, 0);
773510e230b6Smaya   const uint64_t v1_address =
773696c5ddc4Srjs      __gen_address(data, &dw[1], values->DestinationAddress, v1, 2, 63);
773710e230b6Smaya   dw[1] = v1_address;
773810e230b6Smaya   dw[2] = (v1_address >> 32) | (v1 >> 32);
773910e230b6Smaya
774010e230b6Smaya   dw[3] =
774110e230b6Smaya      __gen_uint(values->DataDWord0, 0, 31);
774210e230b6Smaya}
774310e230b6Smaya
774496c5ddc4Srjs#define GFX8_MI_SEMAPHORE_SIGNAL_length        2
774596c5ddc4Srjs#define GFX8_MI_SEMAPHORE_SIGNAL_length_bias      2
774696c5ddc4Srjs#define GFX8_MI_SEMAPHORE_SIGNAL_header         \
774710e230b6Smaya   .DWordLength                         =      0,  \
774810e230b6Smaya   .MICommandOpcode                     =     27,  \
774910e230b6Smaya   .CommandType                         =      0
775010e230b6Smaya
775196c5ddc4Srjsstruct GFX8_MI_SEMAPHORE_SIGNAL {
775210e230b6Smaya   uint32_t                             DWordLength;
775310e230b6Smaya   uint32_t                             TargetEngineSelect;
775410e230b6Smaya#define RCS                                      0
775510e230b6Smaya#define VCS0                                     1
775610e230b6Smaya#define BCS                                      2
775710e230b6Smaya#define VECS                                     3
775810e230b6Smaya#define VCS1                                     4
775910e230b6Smaya   bool                                 PostSyncOperation;
776010e230b6Smaya   uint32_t                             MICommandOpcode;
776110e230b6Smaya   uint32_t                             CommandType;
776210e230b6Smaya   uint32_t                             TargetContextID;
776310e230b6Smaya};
776410e230b6Smaya
776596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
776696c5ddc4SrjsGFX8_MI_SEMAPHORE_SIGNAL_pack(__attribute__((unused)) __gen_user_data *data,
776710e230b6Smaya                              __attribute__((unused)) void * restrict dst,
776896c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_MI_SEMAPHORE_SIGNAL * restrict values)
776910e230b6Smaya{
777010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
777110e230b6Smaya
777210e230b6Smaya   dw[0] =
777310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
777410e230b6Smaya      __gen_uint(values->TargetEngineSelect, 15, 17) |
777510e230b6Smaya      __gen_uint(values->PostSyncOperation, 21, 21) |
777610e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
777710e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
777810e230b6Smaya
777910e230b6Smaya   dw[1] =
778010e230b6Smaya      __gen_uint(values->TargetContextID, 0, 31);
778110e230b6Smaya}
778210e230b6Smaya
778396c5ddc4Srjs#define GFX8_MI_SEMAPHORE_WAIT_length          4
778496c5ddc4Srjs#define GFX8_MI_SEMAPHORE_WAIT_length_bias      2
778596c5ddc4Srjs#define GFX8_MI_SEMAPHORE_WAIT_header           \
778610e230b6Smaya   .DWordLength                         =      2,  \
778710e230b6Smaya   .MICommandOpcode                     =     28,  \
778810e230b6Smaya   .CommandType                         =      0
778910e230b6Smaya
779096c5ddc4Srjsstruct GFX8_MI_SEMAPHORE_WAIT {
779110e230b6Smaya   uint32_t                             DWordLength;
779210e230b6Smaya   uint32_t                             CompareOperation;
779310e230b6Smaya#define COMPARE_SAD_GREATER_THAN_SDD             0
779410e230b6Smaya#define COMPARE_SAD_GREATER_THAN_OR_EQUAL_SDD    1
779510e230b6Smaya#define COMPARE_SAD_LESS_THAN_SDD                2
779610e230b6Smaya#define COMPARE_SAD_LESS_THAN_OR_EQUAL_SDD       3
779710e230b6Smaya#define COMPARE_SAD_EQUAL_SDD                    4
779810e230b6Smaya#define COMPARE_SAD_NOT_EQUAL_SDD                5
779910e230b6Smaya   uint32_t                             WaitMode;
780010e230b6Smaya#define PollingMode                              1
780110e230b6Smaya#define SignalMode                               0
780210e230b6Smaya   uint32_t                             MemoryType;
780310e230b6Smaya#define PerProcessGraphicsAddress                0
780410e230b6Smaya#define GlobalGraphicsAddress                    1
780510e230b6Smaya   uint32_t                             MICommandOpcode;
780610e230b6Smaya   uint32_t                             CommandType;
780710e230b6Smaya   uint32_t                             SemaphoreDataDword;
780810e230b6Smaya   __gen_address_type                   SemaphoreAddress;
780910e230b6Smaya   __gen_address_type                   SemaphoreAddressHigh;
781010e230b6Smaya};
781110e230b6Smaya
781296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
781396c5ddc4SrjsGFX8_MI_SEMAPHORE_WAIT_pack(__attribute__((unused)) __gen_user_data *data,
781410e230b6Smaya                            __attribute__((unused)) void * restrict dst,
781596c5ddc4Srjs                            __attribute__((unused)) const struct GFX8_MI_SEMAPHORE_WAIT * restrict values)
781610e230b6Smaya{
781710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
781810e230b6Smaya
781910e230b6Smaya   dw[0] =
782010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
782110e230b6Smaya      __gen_uint(values->CompareOperation, 12, 14) |
782210e230b6Smaya      __gen_uint(values->WaitMode, 15, 15) |
782310e230b6Smaya      __gen_uint(values->MemoryType, 22, 22) |
782410e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
782510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
782610e230b6Smaya
782710e230b6Smaya   dw[1] =
782810e230b6Smaya      __gen_uint(values->SemaphoreDataDword, 0, 31);
782910e230b6Smaya
783096c5ddc4Srjs   dw[2] = __gen_address(data, &dw[2], values->SemaphoreAddress, 0, 2, 31);
783110e230b6Smaya
783296c5ddc4Srjs   dw[3] = __gen_address(data, &dw[3], values->SemaphoreAddressHigh, 0, 0, 15);
783310e230b6Smaya}
783410e230b6Smaya
783596c5ddc4Srjs#define GFX8_MI_SET_CONTEXT_length             2
783696c5ddc4Srjs#define GFX8_MI_SET_CONTEXT_length_bias        2
783796c5ddc4Srjs#define GFX8_MI_SET_CONTEXT_header              \
783810e230b6Smaya   .DWordLength                         =      0,  \
783910e230b6Smaya   .MICommandOpcode                     =     24,  \
784010e230b6Smaya   .CommandType                         =      0
784110e230b6Smaya
784296c5ddc4Srjsstruct GFX8_MI_SET_CONTEXT {
784310e230b6Smaya   uint32_t                             DWordLength;
784410e230b6Smaya   uint32_t                             MICommandOpcode;
784510e230b6Smaya   uint32_t                             CommandType;
784610e230b6Smaya   uint32_t                             RestoreInhibit;
784710e230b6Smaya   uint32_t                             ForceRestore;
784810e230b6Smaya   bool                                 ResourceStreamerStateRestoreEnable;
784910e230b6Smaya   bool                                 ResourceStreamerStateSaveEnable;
785010e230b6Smaya   bool                                 CoreModeEnable;
785110e230b6Smaya   uint32_t                             ReservedMustbe1;
785210e230b6Smaya   __gen_address_type                   LogicalContextAddress;
785310e230b6Smaya};
785410e230b6Smaya
785596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
785696c5ddc4SrjsGFX8_MI_SET_CONTEXT_pack(__attribute__((unused)) __gen_user_data *data,
785710e230b6Smaya                         __attribute__((unused)) void * restrict dst,
785896c5ddc4Srjs                         __attribute__((unused)) const struct GFX8_MI_SET_CONTEXT * restrict values)
785910e230b6Smaya{
786010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
786110e230b6Smaya
786210e230b6Smaya   dw[0] =
786310e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
786410e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
786510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
786610e230b6Smaya
786710e230b6Smaya   const uint32_t v1 =
786810e230b6Smaya      __gen_uint(values->RestoreInhibit, 0, 0) |
786910e230b6Smaya      __gen_uint(values->ForceRestore, 1, 1) |
787010e230b6Smaya      __gen_uint(values->ResourceStreamerStateRestoreEnable, 2, 2) |
787110e230b6Smaya      __gen_uint(values->ResourceStreamerStateSaveEnable, 3, 3) |
787210e230b6Smaya      __gen_uint(values->CoreModeEnable, 4, 4) |
787310e230b6Smaya      __gen_uint(values->ReservedMustbe1, 8, 8);
787496c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->LogicalContextAddress, v1, 12, 31);
787510e230b6Smaya}
787610e230b6Smaya
787796c5ddc4Srjs#define GFX8_MI_SET_PREDICATE_length           1
787896c5ddc4Srjs#define GFX8_MI_SET_PREDICATE_length_bias      1
787996c5ddc4Srjs#define GFX8_MI_SET_PREDICATE_header            \
788010e230b6Smaya   .MICommandOpcode                     =      1,  \
788110e230b6Smaya   .CommandType                         =      0
788210e230b6Smaya
788396c5ddc4Srjsstruct GFX8_MI_SET_PREDICATE {
788410e230b6Smaya   uint32_t                             PREDICATEENABLE;
788510e230b6Smaya#define NOOPNever                                0
788610e230b6Smaya#define NOOPonResult2clear                       1
788710e230b6Smaya#define NOOPonResult2set                         2
788810e230b6Smaya#define NOOPonResultclear                        3
788910e230b6Smaya#define NOOPonResultset                          4
789010e230b6Smaya#define Executewhenonesliceenabled               5
789110e230b6Smaya#define Executewhentwoslicesareenabled           6
789210e230b6Smaya#define Executewhenthreeslicesareenabled         7
789310e230b6Smaya#define NOOPAlways                               15
789410e230b6Smaya   uint32_t                             MICommandOpcode;
789510e230b6Smaya   uint32_t                             CommandType;
789610e230b6Smaya};
789710e230b6Smaya
789896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
789996c5ddc4SrjsGFX8_MI_SET_PREDICATE_pack(__attribute__((unused)) __gen_user_data *data,
790010e230b6Smaya                           __attribute__((unused)) void * restrict dst,
790196c5ddc4Srjs                           __attribute__((unused)) const struct GFX8_MI_SET_PREDICATE * restrict values)
790210e230b6Smaya{
790310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
790410e230b6Smaya
790510e230b6Smaya   dw[0] =
790610e230b6Smaya      __gen_uint(values->PREDICATEENABLE, 0, 3) |
790710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
790810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
790910e230b6Smaya}
791010e230b6Smaya
791196c5ddc4Srjs#define GFX8_MI_STORE_DATA_IMM_length          4
791296c5ddc4Srjs#define GFX8_MI_STORE_DATA_IMM_length_bias      2
791396c5ddc4Srjs#define GFX8_MI_STORE_DATA_IMM_header           \
791410e230b6Smaya   .DWordLength                         =      2,  \
791510e230b6Smaya   .MICommandOpcode                     =     32,  \
791610e230b6Smaya   .CommandType                         =      0
791710e230b6Smaya
791896c5ddc4Srjsstruct GFX8_MI_STORE_DATA_IMM {
791910e230b6Smaya   uint32_t                             DWordLength;
792010e230b6Smaya   uint32_t                             StoreQword;
792110e230b6Smaya   bool                                 UseGlobalGTT;
792210e230b6Smaya   uint32_t                             MICommandOpcode;
792310e230b6Smaya   uint32_t                             CommandType;
792410e230b6Smaya   uint32_t                             CoreModeEnable;
792510e230b6Smaya   __gen_address_type                   Address;
792610e230b6Smaya   uint64_t                             ImmediateData;
792710e230b6Smaya};
792810e230b6Smaya
792996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
793096c5ddc4SrjsGFX8_MI_STORE_DATA_IMM_pack(__attribute__((unused)) __gen_user_data *data,
793110e230b6Smaya                            __attribute__((unused)) void * restrict dst,
793296c5ddc4Srjs                            __attribute__((unused)) const struct GFX8_MI_STORE_DATA_IMM * restrict values)
793310e230b6Smaya{
793410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
793510e230b6Smaya
793610e230b6Smaya   dw[0] =
793710e230b6Smaya      __gen_uint(values->DWordLength, 0, 9) |
793810e230b6Smaya      __gen_uint(values->StoreQword, 21, 21) |
793910e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
794010e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
794110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
794210e230b6Smaya
794310e230b6Smaya   const uint64_t v1 =
794410e230b6Smaya      __gen_uint(values->CoreModeEnable, 0, 0);
794510e230b6Smaya   const uint64_t v1_address =
794696c5ddc4Srjs      __gen_address(data, &dw[1], values->Address, v1, 2, 47);
794710e230b6Smaya   dw[1] = v1_address;
794810e230b6Smaya   dw[2] = (v1_address >> 32) | (v1 >> 32);
794910e230b6Smaya
795010e230b6Smaya   const uint64_t v3 =
795110e230b6Smaya      __gen_uint(values->ImmediateData, 0, 63);
795210e230b6Smaya   dw[3] = v3;
795310e230b6Smaya   dw[4] = v3 >> 32;
795410e230b6Smaya}
795510e230b6Smaya
795696c5ddc4Srjs#define GFX8_MI_STORE_DATA_INDEX_length        3
795796c5ddc4Srjs#define GFX8_MI_STORE_DATA_INDEX_length_bias      2
795896c5ddc4Srjs#define GFX8_MI_STORE_DATA_INDEX_header         \
795910e230b6Smaya   .DWordLength                         =      1,  \
796010e230b6Smaya   .MICommandOpcode                     =     33,  \
796110e230b6Smaya   .CommandType                         =      0
796210e230b6Smaya
796396c5ddc4Srjsstruct GFX8_MI_STORE_DATA_INDEX {
796410e230b6Smaya   uint32_t                             DWordLength;
796510e230b6Smaya   uint32_t                             UsePerProcessHardwareStatusPage;
796610e230b6Smaya   uint32_t                             MICommandOpcode;
796710e230b6Smaya   uint32_t                             CommandType;
796810e230b6Smaya   uint32_t                             Offset;
796910e230b6Smaya   uint32_t                             DataDWord0;
797010e230b6Smaya   uint32_t                             DataDWord1;
797110e230b6Smaya};
797210e230b6Smaya
797396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
797496c5ddc4SrjsGFX8_MI_STORE_DATA_INDEX_pack(__attribute__((unused)) __gen_user_data *data,
797510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
797696c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_MI_STORE_DATA_INDEX * restrict values)
797710e230b6Smaya{
797810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
797910e230b6Smaya
798010e230b6Smaya   dw[0] =
798110e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
798210e230b6Smaya      __gen_uint(values->UsePerProcessHardwareStatusPage, 21, 21) |
798310e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
798410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
798510e230b6Smaya
798610e230b6Smaya   dw[1] =
798710e230b6Smaya      __gen_uint(values->Offset, 2, 11);
798810e230b6Smaya
798910e230b6Smaya   dw[2] =
799010e230b6Smaya      __gen_uint(values->DataDWord0, 0, 31);
799110e230b6Smaya}
799210e230b6Smaya
799396c5ddc4Srjs#define GFX8_MI_STORE_REGISTER_MEM_length      4
799496c5ddc4Srjs#define GFX8_MI_STORE_REGISTER_MEM_length_bias      2
799596c5ddc4Srjs#define GFX8_MI_STORE_REGISTER_MEM_header       \
799610e230b6Smaya   .DWordLength                         =      2,  \
799710e230b6Smaya   .MICommandOpcode                     =     36,  \
799810e230b6Smaya   .CommandType                         =      0
799910e230b6Smaya
800096c5ddc4Srjsstruct GFX8_MI_STORE_REGISTER_MEM {
800110e230b6Smaya   uint32_t                             DWordLength;
800210e230b6Smaya   bool                                 PredicateEnable;
800310e230b6Smaya   bool                                 UseGlobalGTT;
800410e230b6Smaya   uint32_t                             MICommandOpcode;
800510e230b6Smaya   uint32_t                             CommandType;
800610e230b6Smaya   uint64_t                             RegisterAddress;
800710e230b6Smaya   __gen_address_type                   MemoryAddress;
800810e230b6Smaya};
800910e230b6Smaya
801096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
801196c5ddc4SrjsGFX8_MI_STORE_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
801210e230b6Smaya                                __attribute__((unused)) void * restrict dst,
801396c5ddc4Srjs                                __attribute__((unused)) const struct GFX8_MI_STORE_REGISTER_MEM * restrict values)
801410e230b6Smaya{
801510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
801610e230b6Smaya
801710e230b6Smaya   dw[0] =
801810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
801910e230b6Smaya      __gen_uint(values->PredicateEnable, 21, 21) |
802010e230b6Smaya      __gen_uint(values->UseGlobalGTT, 22, 22) |
802110e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
802210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
802310e230b6Smaya
802410e230b6Smaya   dw[1] =
802510e230b6Smaya      __gen_offset(values->RegisterAddress, 2, 22);
802610e230b6Smaya
802710e230b6Smaya   const uint64_t v2_address =
802896c5ddc4Srjs      __gen_address(data, &dw[2], values->MemoryAddress, 0, 2, 63);
802910e230b6Smaya   dw[2] = v2_address;
803010e230b6Smaya   dw[3] = v2_address >> 32;
803110e230b6Smaya}
803210e230b6Smaya
803396c5ddc4Srjs#define GFX8_MI_STORE_URB_MEM_length           4
803496c5ddc4Srjs#define GFX8_MI_STORE_URB_MEM_length_bias      2
803596c5ddc4Srjs#define GFX8_MI_STORE_URB_MEM_header            \
803610e230b6Smaya   .DWordLength                         =      2,  \
803710e230b6Smaya   .MICommandOpcode                     =     45,  \
803810e230b6Smaya   .CommandType                         =      0
803910e230b6Smaya
804096c5ddc4Srjsstruct GFX8_MI_STORE_URB_MEM {
804110e230b6Smaya   uint32_t                             DWordLength;
804210e230b6Smaya   uint32_t                             MICommandOpcode;
804310e230b6Smaya   uint32_t                             CommandType;
804410e230b6Smaya   uint32_t                             URBAddress;
804510e230b6Smaya   __gen_address_type                   MemoryAddress;
804610e230b6Smaya};
804710e230b6Smaya
804896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
804996c5ddc4SrjsGFX8_MI_STORE_URB_MEM_pack(__attribute__((unused)) __gen_user_data *data,
805010e230b6Smaya                           __attribute__((unused)) void * restrict dst,
805196c5ddc4Srjs                           __attribute__((unused)) const struct GFX8_MI_STORE_URB_MEM * restrict values)
805210e230b6Smaya{
805310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
805410e230b6Smaya
805510e230b6Smaya   dw[0] =
805610e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
805710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
805810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
805910e230b6Smaya
806010e230b6Smaya   dw[1] =
806110e230b6Smaya      __gen_uint(values->URBAddress, 2, 14);
806210e230b6Smaya
806310e230b6Smaya   const uint64_t v2_address =
806496c5ddc4Srjs      __gen_address(data, &dw[2], values->MemoryAddress, 0, 6, 63);
806510e230b6Smaya   dw[2] = v2_address;
806610e230b6Smaya   dw[3] = v2_address >> 32;
806710e230b6Smaya}
806810e230b6Smaya
806996c5ddc4Srjs#define GFX8_MI_SUSPEND_FLUSH_length           1
807096c5ddc4Srjs#define GFX8_MI_SUSPEND_FLUSH_length_bias      1
807196c5ddc4Srjs#define GFX8_MI_SUSPEND_FLUSH_header            \
807210e230b6Smaya   .MICommandOpcode                     =     11,  \
807310e230b6Smaya   .CommandType                         =      0
807410e230b6Smaya
807596c5ddc4Srjsstruct GFX8_MI_SUSPEND_FLUSH {
807610e230b6Smaya   bool                                 SuspendFlush;
807710e230b6Smaya   uint32_t                             MICommandOpcode;
807810e230b6Smaya   uint32_t                             CommandType;
807910e230b6Smaya};
808010e230b6Smaya
808196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
808296c5ddc4SrjsGFX8_MI_SUSPEND_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
808310e230b6Smaya                           __attribute__((unused)) void * restrict dst,
808496c5ddc4Srjs                           __attribute__((unused)) const struct GFX8_MI_SUSPEND_FLUSH * restrict values)
808510e230b6Smaya{
808610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
808710e230b6Smaya
808810e230b6Smaya   dw[0] =
808910e230b6Smaya      __gen_uint(values->SuspendFlush, 0, 0) |
809010e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
809110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
809210e230b6Smaya}
809310e230b6Smaya
809496c5ddc4Srjs#define GFX8_MI_TOPOLOGY_FILTER_length         1
809596c5ddc4Srjs#define GFX8_MI_TOPOLOGY_FILTER_length_bias      1
809696c5ddc4Srjs#define GFX8_MI_TOPOLOGY_FILTER_header          \
809710e230b6Smaya   .MICommandOpcode                     =     13,  \
809810e230b6Smaya   .CommandType                         =      0
809910e230b6Smaya
810096c5ddc4Srjsstruct GFX8_MI_TOPOLOGY_FILTER {
810196c5ddc4Srjs   enum GFX8_3D_Prim_Topo_Type          TopologyFilterValue;
810210e230b6Smaya   uint32_t                             MICommandOpcode;
810310e230b6Smaya   uint32_t                             CommandType;
810410e230b6Smaya};
810510e230b6Smaya
810696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
810796c5ddc4SrjsGFX8_MI_TOPOLOGY_FILTER_pack(__attribute__((unused)) __gen_user_data *data,
810810e230b6Smaya                             __attribute__((unused)) void * restrict dst,
810996c5ddc4Srjs                             __attribute__((unused)) const struct GFX8_MI_TOPOLOGY_FILTER * restrict values)
811010e230b6Smaya{
811110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
811210e230b6Smaya
811310e230b6Smaya   dw[0] =
811410e230b6Smaya      __gen_uint(values->TopologyFilterValue, 0, 5) |
811510e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
811610e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
811710e230b6Smaya}
811810e230b6Smaya
811996c5ddc4Srjs#define GFX8_MI_URB_ATOMIC_ALLOC_length        1
812096c5ddc4Srjs#define GFX8_MI_URB_ATOMIC_ALLOC_length_bias      1
812196c5ddc4Srjs#define GFX8_MI_URB_ATOMIC_ALLOC_header         \
812210e230b6Smaya   .MICommandOpcode                     =      9,  \
812310e230b6Smaya   .CommandType                         =      0
812410e230b6Smaya
812596c5ddc4Srjsstruct GFX8_MI_URB_ATOMIC_ALLOC {
812610e230b6Smaya   uint32_t                             URBAtomicStorageSize;
812710e230b6Smaya   uint32_t                             URBAtomicStorageOffset;
812810e230b6Smaya   uint32_t                             MICommandOpcode;
812910e230b6Smaya   uint32_t                             CommandType;
813010e230b6Smaya};
813110e230b6Smaya
813296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
813396c5ddc4SrjsGFX8_MI_URB_ATOMIC_ALLOC_pack(__attribute__((unused)) __gen_user_data *data,
813410e230b6Smaya                              __attribute__((unused)) void * restrict dst,
813596c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_MI_URB_ATOMIC_ALLOC * restrict values)
813610e230b6Smaya{
813710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
813810e230b6Smaya
813910e230b6Smaya   dw[0] =
814010e230b6Smaya      __gen_uint(values->URBAtomicStorageSize, 0, 8) |
814110e230b6Smaya      __gen_uint(values->URBAtomicStorageOffset, 12, 19) |
814210e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
814310e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
814410e230b6Smaya}
814510e230b6Smaya
814696c5ddc4Srjs#define GFX8_MI_URB_CLEAR_length               2
814796c5ddc4Srjs#define GFX8_MI_URB_CLEAR_length_bias          2
814896c5ddc4Srjs#define GFX8_MI_URB_CLEAR_header                \
814910e230b6Smaya   .DWordLength                         =      0,  \
815010e230b6Smaya   .MICommandOpcode                     =     25,  \
815110e230b6Smaya   .CommandType                         =      0
815210e230b6Smaya
815396c5ddc4Srjsstruct GFX8_MI_URB_CLEAR {
815410e230b6Smaya   uint32_t                             DWordLength;
815510e230b6Smaya   uint32_t                             MICommandOpcode;
815610e230b6Smaya   uint32_t                             CommandType;
815710e230b6Smaya   uint64_t                             URBAddress;
815810e230b6Smaya   uint32_t                             URBClearLength;
815910e230b6Smaya};
816010e230b6Smaya
816196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
816296c5ddc4SrjsGFX8_MI_URB_CLEAR_pack(__attribute__((unused)) __gen_user_data *data,
816310e230b6Smaya                       __attribute__((unused)) void * restrict dst,
816496c5ddc4Srjs                       __attribute__((unused)) const struct GFX8_MI_URB_CLEAR * restrict values)
816510e230b6Smaya{
816610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
816710e230b6Smaya
816810e230b6Smaya   dw[0] =
816910e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
817010e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
817110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
817210e230b6Smaya
817310e230b6Smaya   dw[1] =
817410e230b6Smaya      __gen_offset(values->URBAddress, 0, 14) |
817510e230b6Smaya      __gen_uint(values->URBClearLength, 16, 29);
817610e230b6Smaya}
817710e230b6Smaya
817896c5ddc4Srjs#define GFX8_MI_USER_INTERRUPT_length          1
817996c5ddc4Srjs#define GFX8_MI_USER_INTERRUPT_length_bias      1
818096c5ddc4Srjs#define GFX8_MI_USER_INTERRUPT_header           \
818110e230b6Smaya   .MICommandOpcode                     =      2,  \
818210e230b6Smaya   .CommandType                         =      0
818310e230b6Smaya
818496c5ddc4Srjsstruct GFX8_MI_USER_INTERRUPT {
818510e230b6Smaya   uint32_t                             MICommandOpcode;
818610e230b6Smaya   uint32_t                             CommandType;
818710e230b6Smaya};
818810e230b6Smaya
818996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
819096c5ddc4SrjsGFX8_MI_USER_INTERRUPT_pack(__attribute__((unused)) __gen_user_data *data,
819110e230b6Smaya                            __attribute__((unused)) void * restrict dst,
819296c5ddc4Srjs                            __attribute__((unused)) const struct GFX8_MI_USER_INTERRUPT * restrict values)
819310e230b6Smaya{
819410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
819510e230b6Smaya
819610e230b6Smaya   dw[0] =
819710e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
819810e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
819910e230b6Smaya}
820010e230b6Smaya
820196c5ddc4Srjs#define GFX8_MI_WAIT_FOR_EVENT_length          1
820296c5ddc4Srjs#define GFX8_MI_WAIT_FOR_EVENT_length_bias      1
820396c5ddc4Srjs#define GFX8_MI_WAIT_FOR_EVENT_header           \
820410e230b6Smaya   .MICommandOpcode                     =      3,  \
820510e230b6Smaya   .CommandType                         =      0
820610e230b6Smaya
820796c5ddc4Srjsstruct GFX8_MI_WAIT_FOR_EVENT {
820810e230b6Smaya   bool                                 DisplayPipeAScanLineWaitEnable;
820910e230b6Smaya   bool                                 DisplayPlaneAFlipPendingWaitEnable;
821010e230b6Smaya   bool                                 DisplaySpriteAFlipPendingWaitEnable;
821110e230b6Smaya   bool                                 DisplayPipeAVerticalBlankWaitEnable;
821210e230b6Smaya   bool                                 DisplayPipeBScanLineWaitEnable;
821310e230b6Smaya   bool                                 DisplayPlaneBFlipPendingWaitEnable;
821410e230b6Smaya   bool                                 DisplaySpriteBFlipPendingWaitEnable;
821510e230b6Smaya   bool                                 DisplayPipeBVerticalBlankWaitEnable;
821610e230b6Smaya   bool                                 DisplayPipeCScanLineWaitEnable;
821710e230b6Smaya   bool                                 DisplayPlaneCFlipPendingWaitEnable;
821810e230b6Smaya   bool                                 DisplaySpriteCFlipPendingWaitEnable;
821910e230b6Smaya   bool                                 DisplayPipeCVerticalBlankWaitEnable;
822010e230b6Smaya   uint32_t                             MICommandOpcode;
822110e230b6Smaya   uint32_t                             CommandType;
822210e230b6Smaya};
822310e230b6Smaya
822496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
822596c5ddc4SrjsGFX8_MI_WAIT_FOR_EVENT_pack(__attribute__((unused)) __gen_user_data *data,
822610e230b6Smaya                            __attribute__((unused)) void * restrict dst,
822796c5ddc4Srjs                            __attribute__((unused)) const struct GFX8_MI_WAIT_FOR_EVENT * restrict values)
822810e230b6Smaya{
822910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
823010e230b6Smaya
823110e230b6Smaya   dw[0] =
823210e230b6Smaya      __gen_uint(values->DisplayPipeAScanLineWaitEnable, 0, 0) |
823310e230b6Smaya      __gen_uint(values->DisplayPlaneAFlipPendingWaitEnable, 1, 1) |
823410e230b6Smaya      __gen_uint(values->DisplaySpriteAFlipPendingWaitEnable, 2, 2) |
823510e230b6Smaya      __gen_uint(values->DisplayPipeAVerticalBlankWaitEnable, 3, 3) |
823610e230b6Smaya      __gen_uint(values->DisplayPipeBScanLineWaitEnable, 8, 8) |
823710e230b6Smaya      __gen_uint(values->DisplayPlaneBFlipPendingWaitEnable, 9, 9) |
823810e230b6Smaya      __gen_uint(values->DisplaySpriteBFlipPendingWaitEnable, 10, 10) |
823910e230b6Smaya      __gen_uint(values->DisplayPipeBVerticalBlankWaitEnable, 11, 11) |
824010e230b6Smaya      __gen_uint(values->DisplayPipeCScanLineWaitEnable, 14, 14) |
824110e230b6Smaya      __gen_uint(values->DisplayPlaneCFlipPendingWaitEnable, 15, 15) |
824210e230b6Smaya      __gen_uint(values->DisplaySpriteCFlipPendingWaitEnable, 20, 20) |
824310e230b6Smaya      __gen_uint(values->DisplayPipeCVerticalBlankWaitEnable, 21, 21) |
824410e230b6Smaya      __gen_uint(values->MICommandOpcode, 23, 28) |
824510e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
824610e230b6Smaya}
824710e230b6Smaya
824896c5ddc4Srjs#define GFX8_PIPELINE_SELECT_length            1
824996c5ddc4Srjs#define GFX8_PIPELINE_SELECT_length_bias       1
825096c5ddc4Srjs#define GFX8_PIPELINE_SELECT_header             \
825110e230b6Smaya   ._3DCommandSubOpcode                 =      4,  \
825210e230b6Smaya   ._3DCommandOpcode                    =      1,  \
825310e230b6Smaya   .CommandSubType                      =      1,  \
825410e230b6Smaya   .CommandType                         =      3
825510e230b6Smaya
825696c5ddc4Srjsstruct GFX8_PIPELINE_SELECT {
825710e230b6Smaya   uint32_t                             PipelineSelection;
825810e230b6Smaya#define _3D                                      0
825910e230b6Smaya#define Media                                    1
826010e230b6Smaya#define GPGPU                                    2
826110e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
826210e230b6Smaya   uint32_t                             _3DCommandOpcode;
826310e230b6Smaya   uint32_t                             CommandSubType;
826410e230b6Smaya   uint32_t                             CommandType;
826510e230b6Smaya};
826610e230b6Smaya
826796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
826896c5ddc4SrjsGFX8_PIPELINE_SELECT_pack(__attribute__((unused)) __gen_user_data *data,
826910e230b6Smaya                          __attribute__((unused)) void * restrict dst,
827096c5ddc4Srjs                          __attribute__((unused)) const struct GFX8_PIPELINE_SELECT * restrict values)
827110e230b6Smaya{
827210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
827310e230b6Smaya
827410e230b6Smaya   dw[0] =
827510e230b6Smaya      __gen_uint(values->PipelineSelection, 0, 1) |
827610e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
827710e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
827810e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
827910e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
828010e230b6Smaya}
828110e230b6Smaya
828296c5ddc4Srjs#define GFX8_PIPE_CONTROL_length               6
828396c5ddc4Srjs#define GFX8_PIPE_CONTROL_length_bias          2
828496c5ddc4Srjs#define GFX8_PIPE_CONTROL_header                \
828510e230b6Smaya   .DWordLength                         =      4,  \
828610e230b6Smaya   ._3DCommandSubOpcode                 =      0,  \
828710e230b6Smaya   ._3DCommandOpcode                    =      2,  \
828810e230b6Smaya   .CommandSubType                      =      3,  \
828910e230b6Smaya   .CommandType                         =      3
829010e230b6Smaya
829196c5ddc4Srjsstruct GFX8_PIPE_CONTROL {
829210e230b6Smaya   uint32_t                             DWordLength;
829310e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
829410e230b6Smaya   uint32_t                             _3DCommandOpcode;
829510e230b6Smaya   uint32_t                             CommandSubType;
829610e230b6Smaya   uint32_t                             CommandType;
829710e230b6Smaya   bool                                 DepthCacheFlushEnable;
829810e230b6Smaya   bool                                 StallAtPixelScoreboard;
829910e230b6Smaya   bool                                 StateCacheInvalidationEnable;
830010e230b6Smaya   bool                                 ConstantCacheInvalidationEnable;
830110e230b6Smaya   bool                                 VFCacheInvalidationEnable;
830210e230b6Smaya   bool                                 DCFlushEnable;
830310e230b6Smaya   bool                                 PipeControlFlushEnable;
830410e230b6Smaya   bool                                 NotifyEnable;
830510e230b6Smaya   bool                                 IndirectStatePointersDisable;
830610e230b6Smaya   bool                                 TextureCacheInvalidationEnable;
830710e230b6Smaya   bool                                 InstructionCacheInvalidateEnable;
830810e230b6Smaya   bool                                 RenderTargetCacheFlushEnable;
830910e230b6Smaya   bool                                 DepthStallEnable;
831010e230b6Smaya   uint32_t                             PostSyncOperation;
831110e230b6Smaya#define NoWrite                                  0
831210e230b6Smaya#define WriteImmediateData                       1
831310e230b6Smaya#define WritePSDepthCount                        2
831410e230b6Smaya#define WriteTimestamp                           3
831510e230b6Smaya   bool                                 GenericMediaStateClear;
831610e230b6Smaya   bool                                 TLBInvalidate;
831710e230b6Smaya   bool                                 GlobalSnapshotCountReset;
831810e230b6Smaya   bool                                 CommandStreamerStallEnable;
831910e230b6Smaya   uint32_t                             StoreDataIndex;
832010e230b6Smaya   uint32_t                             LRIPostSyncOperation;
832110e230b6Smaya#define NoLRIOperation                           0
832210e230b6Smaya#define MMIOWriteImmediateData                   1
832310e230b6Smaya   uint32_t                             DestinationAddressType;
832410e230b6Smaya#define DAT_PPGTT                                0
832510e230b6Smaya#define DAT_GGTT                                 1
832610e230b6Smaya   __gen_address_type                   Address;
832710e230b6Smaya   uint64_t                             ImmediateData;
832810e230b6Smaya};
832910e230b6Smaya
833096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
833196c5ddc4SrjsGFX8_PIPE_CONTROL_pack(__attribute__((unused)) __gen_user_data *data,
833210e230b6Smaya                       __attribute__((unused)) void * restrict dst,
833396c5ddc4Srjs                       __attribute__((unused)) const struct GFX8_PIPE_CONTROL * restrict values)
833410e230b6Smaya{
833510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
833610e230b6Smaya
833710e230b6Smaya   dw[0] =
833810e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
833910e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
834010e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
834110e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
834210e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
834310e230b6Smaya
834410e230b6Smaya   dw[1] =
834510e230b6Smaya      __gen_uint(values->DepthCacheFlushEnable, 0, 0) |
834610e230b6Smaya      __gen_uint(values->StallAtPixelScoreboard, 1, 1) |
834710e230b6Smaya      __gen_uint(values->StateCacheInvalidationEnable, 2, 2) |
834810e230b6Smaya      __gen_uint(values->ConstantCacheInvalidationEnable, 3, 3) |
834910e230b6Smaya      __gen_uint(values->VFCacheInvalidationEnable, 4, 4) |
835010e230b6Smaya      __gen_uint(values->DCFlushEnable, 5, 5) |
835110e230b6Smaya      __gen_uint(values->PipeControlFlushEnable, 7, 7) |
835210e230b6Smaya      __gen_uint(values->NotifyEnable, 8, 8) |
835310e230b6Smaya      __gen_uint(values->IndirectStatePointersDisable, 9, 9) |
835410e230b6Smaya      __gen_uint(values->TextureCacheInvalidationEnable, 10, 10) |
835510e230b6Smaya      __gen_uint(values->InstructionCacheInvalidateEnable, 11, 11) |
835610e230b6Smaya      __gen_uint(values->RenderTargetCacheFlushEnable, 12, 12) |
835710e230b6Smaya      __gen_uint(values->DepthStallEnable, 13, 13) |
835810e230b6Smaya      __gen_uint(values->PostSyncOperation, 14, 15) |
835910e230b6Smaya      __gen_uint(values->GenericMediaStateClear, 16, 16) |
836010e230b6Smaya      __gen_uint(values->TLBInvalidate, 18, 18) |
836110e230b6Smaya      __gen_uint(values->GlobalSnapshotCountReset, 19, 19) |
836210e230b6Smaya      __gen_uint(values->CommandStreamerStallEnable, 20, 20) |
836310e230b6Smaya      __gen_uint(values->StoreDataIndex, 21, 21) |
836410e230b6Smaya      __gen_uint(values->LRIPostSyncOperation, 23, 23) |
836510e230b6Smaya      __gen_uint(values->DestinationAddressType, 24, 24);
836610e230b6Smaya
836710e230b6Smaya   const uint64_t v2_address =
836896c5ddc4Srjs      __gen_address(data, &dw[2], values->Address, 0, 2, 47);
836910e230b6Smaya   dw[2] = v2_address;
837010e230b6Smaya   dw[3] = v2_address >> 32;
837110e230b6Smaya
837210e230b6Smaya   const uint64_t v4 =
837310e230b6Smaya      __gen_uint(values->ImmediateData, 0, 63);
837410e230b6Smaya   dw[4] = v4;
837510e230b6Smaya   dw[5] = v4 >> 32;
837610e230b6Smaya}
837710e230b6Smaya
837896c5ddc4Srjs#define GFX8_STATE_BASE_ADDRESS_length        16
837996c5ddc4Srjs#define GFX8_STATE_BASE_ADDRESS_length_bias      2
838096c5ddc4Srjs#define GFX8_STATE_BASE_ADDRESS_header          \
838110e230b6Smaya   .DWordLength                         =     14,  \
838210e230b6Smaya   ._3DCommandSubOpcode                 =      1,  \
838310e230b6Smaya   ._3DCommandOpcode                    =      1,  \
838410e230b6Smaya   .CommandSubType                      =      0,  \
838510e230b6Smaya   .CommandType                         =      3
838610e230b6Smaya
838796c5ddc4Srjsstruct GFX8_STATE_BASE_ADDRESS {
838810e230b6Smaya   uint32_t                             DWordLength;
838910e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
839010e230b6Smaya   uint32_t                             _3DCommandOpcode;
839110e230b6Smaya   uint32_t                             CommandSubType;
839210e230b6Smaya   uint32_t                             CommandType;
839310e230b6Smaya   bool                                 GeneralStateBaseAddressModifyEnable;
839410e230b6Smaya   uint32_t                             GeneralStateMOCS;
839510e230b6Smaya   __gen_address_type                   GeneralStateBaseAddress;
839610e230b6Smaya   uint32_t                             StatelessDataPortAccessMOCS;
839710e230b6Smaya   bool                                 SurfaceStateBaseAddressModifyEnable;
839810e230b6Smaya   uint32_t                             SurfaceStateMOCS;
839910e230b6Smaya   __gen_address_type                   SurfaceStateBaseAddress;
840010e230b6Smaya   bool                                 DynamicStateBaseAddressModifyEnable;
840110e230b6Smaya   uint32_t                             DynamicStateMOCS;
840210e230b6Smaya   __gen_address_type                   DynamicStateBaseAddress;
840310e230b6Smaya   bool                                 IndirectObjectBaseAddressModifyEnable;
840410e230b6Smaya   uint32_t                             IndirectObjectMOCS;
840510e230b6Smaya   __gen_address_type                   IndirectObjectBaseAddress;
840610e230b6Smaya   bool                                 InstructionBaseAddressModifyEnable;
840710e230b6Smaya   uint32_t                             InstructionMOCS;
840810e230b6Smaya   __gen_address_type                   InstructionBaseAddress;
840910e230b6Smaya   bool                                 GeneralStateBufferSizeModifyEnable;
841010e230b6Smaya   uint32_t                             GeneralStateBufferSize;
841110e230b6Smaya   bool                                 DynamicStateBufferSizeModifyEnable;
841210e230b6Smaya   uint32_t                             DynamicStateBufferSize;
841310e230b6Smaya   bool                                 IndirectObjectBufferSizeModifyEnable;
841410e230b6Smaya   uint32_t                             IndirectObjectBufferSize;
841510e230b6Smaya   bool                                 InstructionBuffersizeModifyEnable;
841610e230b6Smaya   uint32_t                             InstructionBufferSize;
841710e230b6Smaya};
841810e230b6Smaya
841996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
842096c5ddc4SrjsGFX8_STATE_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
842110e230b6Smaya                             __attribute__((unused)) void * restrict dst,
842296c5ddc4Srjs                             __attribute__((unused)) const struct GFX8_STATE_BASE_ADDRESS * restrict values)
842310e230b6Smaya{
842410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
842510e230b6Smaya
842610e230b6Smaya   dw[0] =
842710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
842810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
842910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
843010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
843110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
843210e230b6Smaya
843310e230b6Smaya   const uint64_t v1 =
843410e230b6Smaya      __gen_uint(values->GeneralStateBaseAddressModifyEnable, 0, 0) |
843510e230b6Smaya      __gen_uint(values->GeneralStateMOCS, 4, 10);
843610e230b6Smaya   const uint64_t v1_address =
843796c5ddc4Srjs      __gen_address(data, &dw[1], values->GeneralStateBaseAddress, v1, 12, 63);
843810e230b6Smaya   dw[1] = v1_address;
843910e230b6Smaya   dw[2] = (v1_address >> 32) | (v1 >> 32);
844010e230b6Smaya
844110e230b6Smaya   dw[3] =
844210e230b6Smaya      __gen_uint(values->StatelessDataPortAccessMOCS, 16, 22);
844310e230b6Smaya
844410e230b6Smaya   const uint64_t v4 =
844510e230b6Smaya      __gen_uint(values->SurfaceStateBaseAddressModifyEnable, 0, 0) |
844610e230b6Smaya      __gen_uint(values->SurfaceStateMOCS, 4, 10);
844710e230b6Smaya   const uint64_t v4_address =
844896c5ddc4Srjs      __gen_address(data, &dw[4], values->SurfaceStateBaseAddress, v4, 12, 63);
844910e230b6Smaya   dw[4] = v4_address;
845010e230b6Smaya   dw[5] = (v4_address >> 32) | (v4 >> 32);
845110e230b6Smaya
845210e230b6Smaya   const uint64_t v6 =
845310e230b6Smaya      __gen_uint(values->DynamicStateBaseAddressModifyEnable, 0, 0) |
845410e230b6Smaya      __gen_uint(values->DynamicStateMOCS, 4, 10);
845510e230b6Smaya   const uint64_t v6_address =
845696c5ddc4Srjs      __gen_address(data, &dw[6], values->DynamicStateBaseAddress, v6, 12, 63);
845710e230b6Smaya   dw[6] = v6_address;
845810e230b6Smaya   dw[7] = (v6_address >> 32) | (v6 >> 32);
845910e230b6Smaya
846010e230b6Smaya   const uint64_t v8 =
846110e230b6Smaya      __gen_uint(values->IndirectObjectBaseAddressModifyEnable, 0, 0) |
846210e230b6Smaya      __gen_uint(values->IndirectObjectMOCS, 4, 10);
846310e230b6Smaya   const uint64_t v8_address =
846496c5ddc4Srjs      __gen_address(data, &dw[8], values->IndirectObjectBaseAddress, v8, 12, 63);
846510e230b6Smaya   dw[8] = v8_address;
846610e230b6Smaya   dw[9] = (v8_address >> 32) | (v8 >> 32);
846710e230b6Smaya
846810e230b6Smaya   const uint64_t v10 =
846910e230b6Smaya      __gen_uint(values->InstructionBaseAddressModifyEnable, 0, 0) |
847010e230b6Smaya      __gen_uint(values->InstructionMOCS, 4, 10);
847110e230b6Smaya   const uint64_t v10_address =
847296c5ddc4Srjs      __gen_address(data, &dw[10], values->InstructionBaseAddress, v10, 12, 63);
847310e230b6Smaya   dw[10] = v10_address;
847410e230b6Smaya   dw[11] = (v10_address >> 32) | (v10 >> 32);
847510e230b6Smaya
847610e230b6Smaya   dw[12] =
847710e230b6Smaya      __gen_uint(values->GeneralStateBufferSizeModifyEnable, 0, 0) |
847810e230b6Smaya      __gen_uint(values->GeneralStateBufferSize, 12, 31);
847910e230b6Smaya
848010e230b6Smaya   dw[13] =
848110e230b6Smaya      __gen_uint(values->DynamicStateBufferSizeModifyEnable, 0, 0) |
848210e230b6Smaya      __gen_uint(values->DynamicStateBufferSize, 12, 31);
848310e230b6Smaya
848410e230b6Smaya   dw[14] =
848510e230b6Smaya      __gen_uint(values->IndirectObjectBufferSizeModifyEnable, 0, 0) |
848610e230b6Smaya      __gen_uint(values->IndirectObjectBufferSize, 12, 31);
848710e230b6Smaya
848810e230b6Smaya   dw[15] =
848910e230b6Smaya      __gen_uint(values->InstructionBuffersizeModifyEnable, 0, 0) |
849010e230b6Smaya      __gen_uint(values->InstructionBufferSize, 12, 31);
849110e230b6Smaya}
849210e230b6Smaya
849396c5ddc4Srjs#define GFX8_STATE_PREFETCH_length             2
849496c5ddc4Srjs#define GFX8_STATE_PREFETCH_length_bias        2
849596c5ddc4Srjs#define GFX8_STATE_PREFETCH_header              \
849610e230b6Smaya   .DWordLength                         =      0,  \
849710e230b6Smaya   ._3DCommandSubOpcode                 =      3,  \
849810e230b6Smaya   ._3DCommandOpcode                    =      0,  \
849910e230b6Smaya   .CommandSubType                      =      0,  \
850010e230b6Smaya   .CommandType                         =      3
850110e230b6Smaya
850296c5ddc4Srjsstruct GFX8_STATE_PREFETCH {
850310e230b6Smaya   uint32_t                             DWordLength;
850410e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
850510e230b6Smaya   uint32_t                             _3DCommandOpcode;
850610e230b6Smaya   uint32_t                             CommandSubType;
850710e230b6Smaya   uint32_t                             CommandType;
850810e230b6Smaya   uint32_t                             PrefetchCount;
850910e230b6Smaya   __gen_address_type                   PrefetchPointer;
851010e230b6Smaya};
851110e230b6Smaya
851296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
851396c5ddc4SrjsGFX8_STATE_PREFETCH_pack(__attribute__((unused)) __gen_user_data *data,
851410e230b6Smaya                         __attribute__((unused)) void * restrict dst,
851596c5ddc4Srjs                         __attribute__((unused)) const struct GFX8_STATE_PREFETCH * restrict values)
851610e230b6Smaya{
851710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
851810e230b6Smaya
851910e230b6Smaya   dw[0] =
852010e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
852110e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
852210e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
852310e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
852410e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
852510e230b6Smaya
852610e230b6Smaya   const uint32_t v1 =
852710e230b6Smaya      __gen_uint(values->PrefetchCount, 0, 2);
852896c5ddc4Srjs   dw[1] = __gen_address(data, &dw[1], values->PrefetchPointer, v1, 6, 31);
852910e230b6Smaya}
853010e230b6Smaya
853196c5ddc4Srjs#define GFX8_STATE_SIP_length                  3
853296c5ddc4Srjs#define GFX8_STATE_SIP_length_bias             2
853396c5ddc4Srjs#define GFX8_STATE_SIP_header                   \
853410e230b6Smaya   .DWordLength                         =      1,  \
853510e230b6Smaya   ._3DCommandSubOpcode                 =      2,  \
853610e230b6Smaya   ._3DCommandOpcode                    =      1,  \
853710e230b6Smaya   .CommandSubType                      =      0,  \
853810e230b6Smaya   .CommandType                         =      3
853910e230b6Smaya
854096c5ddc4Srjsstruct GFX8_STATE_SIP {
854110e230b6Smaya   uint32_t                             DWordLength;
854210e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
854310e230b6Smaya   uint32_t                             _3DCommandOpcode;
854410e230b6Smaya   uint32_t                             CommandSubType;
854510e230b6Smaya   uint32_t                             CommandType;
854610e230b6Smaya   uint64_t                             SystemInstructionPointer;
854710e230b6Smaya};
854810e230b6Smaya
854996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
855096c5ddc4SrjsGFX8_STATE_SIP_pack(__attribute__((unused)) __gen_user_data *data,
855110e230b6Smaya                    __attribute__((unused)) void * restrict dst,
855296c5ddc4Srjs                    __attribute__((unused)) const struct GFX8_STATE_SIP * restrict values)
855310e230b6Smaya{
855410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
855510e230b6Smaya
855610e230b6Smaya   dw[0] =
855710e230b6Smaya      __gen_uint(values->DWordLength, 0, 7) |
855810e230b6Smaya      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
855910e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
856010e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
856110e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
856210e230b6Smaya
856310e230b6Smaya   const uint64_t v1 =
856410e230b6Smaya      __gen_offset(values->SystemInstructionPointer, 4, 63);
856510e230b6Smaya   dw[1] = v1;
856610e230b6Smaya   dw[2] = v1 >> 32;
856710e230b6Smaya}
856810e230b6Smaya
856996c5ddc4Srjs#define GFX8_SWTESS_BASE_ADDRESS_length        2
857096c5ddc4Srjs#define GFX8_SWTESS_BASE_ADDRESS_length_bias      2
857196c5ddc4Srjs#define GFX8_SWTESS_BASE_ADDRESS_header         \
857210e230b6Smaya   .DWordLength                         =      0,  \
857310e230b6Smaya   ._3DCommandSubOpcode                 =      3,  \
857410e230b6Smaya   ._3DCommandOpcode                    =      1,  \
857510e230b6Smaya   .CommandSubType                      =      0,  \
857610e230b6Smaya   .CommandType                         =      3
857710e230b6Smaya
857896c5ddc4Srjsstruct GFX8_SWTESS_BASE_ADDRESS {
857910e230b6Smaya   uint32_t                             DWordLength;
858010e230b6Smaya   uint32_t                             _3DCommandSubOpcode;
858110e230b6Smaya   uint32_t                             _3DCommandOpcode;
858210e230b6Smaya   uint32_t                             CommandSubType;
858310e230b6Smaya   uint32_t                             CommandType;
858410e230b6Smaya   uint32_t                             SWTessellationMOCS;
858510e230b6Smaya   __gen_address_type                   SWTessellationBaseAddress;
858610e230b6Smaya};
858710e230b6Smaya
858896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
858996c5ddc4SrjsGFX8_SWTESS_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
859010e230b6Smaya                              __attribute__((unused)) void * restrict dst,
859196c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_SWTESS_BASE_ADDRESS * 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->_3DCommandSubOpcode, 16, 23) |
859810e230b6Smaya      __gen_uint(values->_3DCommandOpcode, 24, 26) |
859910e230b6Smaya      __gen_uint(values->CommandSubType, 27, 28) |
860010e230b6Smaya      __gen_uint(values->CommandType, 29, 31);
860110e230b6Smaya
860210e230b6Smaya   const uint64_t v1 =
860310e230b6Smaya      __gen_uint(values->SWTessellationMOCS, 8, 11);
860410e230b6Smaya   const uint64_t v1_address =
860596c5ddc4Srjs      __gen_address(data, &dw[1], values->SWTessellationBaseAddress, v1, 12, 47);
860610e230b6Smaya   dw[1] = v1_address;
860710e230b6Smaya   dw[2] = (v1_address >> 32) | (v1 >> 32);
860810e230b6Smaya}
860910e230b6Smaya
861096c5ddc4Srjs#define GFX8_ACTHD_UDW_num                0x205c
861196c5ddc4Srjs#define GFX8_ACTHD_UDW_length                  1
861296c5ddc4Srjsstruct GFX8_ACTHD_UDW {
861310e230b6Smaya   uint32_t                             HeadPointerUpperDWORD;
861410e230b6Smaya};
861510e230b6Smaya
861696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
861796c5ddc4SrjsGFX8_ACTHD_UDW_pack(__attribute__((unused)) __gen_user_data *data,
861810e230b6Smaya                    __attribute__((unused)) void * restrict dst,
861996c5ddc4Srjs                    __attribute__((unused)) const struct GFX8_ACTHD_UDW * restrict values)
862010e230b6Smaya{
862110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
862210e230b6Smaya
862310e230b6Smaya   dw[0] =
862410e230b6Smaya      __gen_uint(values->HeadPointerUpperDWORD, 0, 15);
862510e230b6Smaya}
862610e230b6Smaya
862796c5ddc4Srjs#define GFX8_BCS_ACTHD_UDW_num            0x2205c
862896c5ddc4Srjs#define GFX8_BCS_ACTHD_UDW_length              1
862996c5ddc4Srjsstruct GFX8_BCS_ACTHD_UDW {
863010e230b6Smaya   uint32_t                             HeadPointerUpperDWORD;
863110e230b6Smaya};
863210e230b6Smaya
863396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
863496c5ddc4SrjsGFX8_BCS_ACTHD_UDW_pack(__attribute__((unused)) __gen_user_data *data,
863510e230b6Smaya                        __attribute__((unused)) void * restrict dst,
863696c5ddc4Srjs                        __attribute__((unused)) const struct GFX8_BCS_ACTHD_UDW * restrict values)
863710e230b6Smaya{
863810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
863910e230b6Smaya
864010e230b6Smaya   dw[0] =
864110e230b6Smaya      __gen_uint(values->HeadPointerUpperDWORD, 0, 15);
864210e230b6Smaya}
864310e230b6Smaya
864496c5ddc4Srjs#define GFX8_BCS_INSTDONE_num             0x2206c
864596c5ddc4Srjs#define GFX8_BCS_INSTDONE_length               1
864696c5ddc4Srjsstruct GFX8_BCS_INSTDONE {
864710e230b6Smaya   bool                                 RingEnable;
864810e230b6Smaya   bool                                 BlitterIDLE;
864910e230b6Smaya   bool                                 GABIDLE;
865010e230b6Smaya   bool                                 BCSDone;
865110e230b6Smaya};
865210e230b6Smaya
865396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
865496c5ddc4SrjsGFX8_BCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
865510e230b6Smaya                       __attribute__((unused)) void * restrict dst,
865696c5ddc4Srjs                       __attribute__((unused)) const struct GFX8_BCS_INSTDONE * restrict values)
865710e230b6Smaya{
865810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
865910e230b6Smaya
866010e230b6Smaya   dw[0] =
866110e230b6Smaya      __gen_uint(values->RingEnable, 0, 0) |
866210e230b6Smaya      __gen_uint(values->BlitterIDLE, 1, 1) |
866310e230b6Smaya      __gen_uint(values->GABIDLE, 2, 2) |
866410e230b6Smaya      __gen_uint(values->BCSDone, 3, 3);
866510e230b6Smaya}
866610e230b6Smaya
866796c5ddc4Srjs#define GFX8_BCS_RING_BUFFER_CTL_num      0x2203c
866896c5ddc4Srjs#define GFX8_BCS_RING_BUFFER_CTL_length        1
866996c5ddc4Srjsstruct GFX8_BCS_RING_BUFFER_CTL {
867010e230b6Smaya   bool                                 RingBufferEnable;
867110e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
867210e230b6Smaya#define MI_AUTOREPORT_OFF                        0
867310e230b6Smaya#define MI_AUTOREPORT_64KB                       1
867410e230b6Smaya#define MI_AUTOREPORT_4KB                        2
867510e230b6Smaya#define MI_AUTOREPORT_128KB                      3
867610e230b6Smaya   bool                                 DisableRegisterAccesses;
867710e230b6Smaya   bool                                 SemaphoreWait;
867810e230b6Smaya   bool                                 RBWait;
867910e230b6Smaya   uint32_t                             BufferLengthinpages1;
868010e230b6Smaya};
868110e230b6Smaya
868296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
868396c5ddc4SrjsGFX8_BCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
868410e230b6Smaya                              __attribute__((unused)) void * restrict dst,
868596c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_BCS_RING_BUFFER_CTL * restrict values)
868610e230b6Smaya{
868710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
868810e230b6Smaya
868910e230b6Smaya   dw[0] =
869010e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
869110e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
869210e230b6Smaya      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
869310e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
869410e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
869510e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
869610e230b6Smaya}
869710e230b6Smaya
869896c5ddc4Srjs#define GFX8_CACHE_MODE_1_num             0x7004
869996c5ddc4Srjs#define GFX8_CACHE_MODE_1_length               1
870096c5ddc4Srjsstruct GFX8_CACHE_MODE_1 {
870110e230b6Smaya   bool                                 RCZReadafterexpansioncontrolfix2;
870210e230b6Smaya   bool                                 DepthReadHitWriteOnlyOptimizationDisable;
870310e230b6Smaya   bool                                 MCSCacheDisable;
870410e230b6Smaya   bool                                 _4X4RCPFESTCOptimizationDisable;
870510e230b6Smaya   uint32_t                             SamplerCacheSetXORselection;
870610e230b6Smaya   uint32_t                             NPPMAFixEnable;
870710e230b6Smaya   uint32_t                             HIZEvictionPolicy;
870810e230b6Smaya   uint32_t                             NPEarlyZFailsDisable;
870910e230b6Smaya   uint32_t                             MSCResolveOptimizationDisable;
871010e230b6Smaya   bool                                 RCZReadafterexpansioncontrolfix2Mask;
871110e230b6Smaya   bool                                 DepthReadHitWriteOnlyOptimizationDisableMask;
871210e230b6Smaya   bool                                 MCSCacheDisableMask;
871310e230b6Smaya   bool                                 _4X4RCPFESTCOptimizationDisableMask;
871410e230b6Smaya   uint32_t                             SamplerCacheSetXORselectionMask;
871510e230b6Smaya   uint32_t                             NPPMAFixEnableMask;
871610e230b6Smaya   uint32_t                             HIZEvictionPolicyMask;
871710e230b6Smaya   uint32_t                             NPEarlyZFailsDisableMask;
871810e230b6Smaya   uint32_t                             MSCResolveOptimizationDisableMask;
871910e230b6Smaya};
872010e230b6Smaya
872196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
872296c5ddc4SrjsGFX8_CACHE_MODE_1_pack(__attribute__((unused)) __gen_user_data *data,
872310e230b6Smaya                       __attribute__((unused)) void * restrict dst,
872496c5ddc4Srjs                       __attribute__((unused)) const struct GFX8_CACHE_MODE_1 * restrict values)
872510e230b6Smaya{
872610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
872710e230b6Smaya
872810e230b6Smaya   dw[0] =
872910e230b6Smaya      __gen_uint(values->RCZReadafterexpansioncontrolfix2, 2, 2) |
873010e230b6Smaya      __gen_uint(values->DepthReadHitWriteOnlyOptimizationDisable, 3, 3) |
873110e230b6Smaya      __gen_uint(values->MCSCacheDisable, 5, 5) |
873210e230b6Smaya      __gen_uint(values->_4X4RCPFESTCOptimizationDisable, 6, 6) |
873310e230b6Smaya      __gen_uint(values->SamplerCacheSetXORselection, 7, 8) |
873410e230b6Smaya      __gen_uint(values->NPPMAFixEnable, 11, 11) |
873510e230b6Smaya      __gen_uint(values->HIZEvictionPolicy, 12, 12) |
873610e230b6Smaya      __gen_uint(values->NPEarlyZFailsDisable, 13, 13) |
873710e230b6Smaya      __gen_uint(values->MSCResolveOptimizationDisable, 14, 14) |
873810e230b6Smaya      __gen_uint(values->RCZReadafterexpansioncontrolfix2Mask, 18, 18) |
873910e230b6Smaya      __gen_uint(values->DepthReadHitWriteOnlyOptimizationDisableMask, 19, 19) |
874010e230b6Smaya      __gen_uint(values->MCSCacheDisableMask, 21, 21) |
874110e230b6Smaya      __gen_uint(values->_4X4RCPFESTCOptimizationDisableMask, 22, 22) |
874210e230b6Smaya      __gen_uint(values->SamplerCacheSetXORselectionMask, 23, 24) |
874310e230b6Smaya      __gen_uint(values->NPPMAFixEnableMask, 27, 27) |
874410e230b6Smaya      __gen_uint(values->HIZEvictionPolicyMask, 28, 28) |
874510e230b6Smaya      __gen_uint(values->NPEarlyZFailsDisableMask, 29, 29) |
874610e230b6Smaya      __gen_uint(values->MSCResolveOptimizationDisableMask, 30, 30);
874710e230b6Smaya}
874810e230b6Smaya
874996c5ddc4Srjs#define GFX8_CL_INVOCATION_COUNT_num      0x2338
875096c5ddc4Srjs#define GFX8_CL_INVOCATION_COUNT_length        2
875196c5ddc4Srjsstruct GFX8_CL_INVOCATION_COUNT {
875210e230b6Smaya   uint64_t                             CLInvocationCountReport;
875310e230b6Smaya};
875410e230b6Smaya
875596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
875696c5ddc4SrjsGFX8_CL_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
875710e230b6Smaya                              __attribute__((unused)) void * restrict dst,
875896c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_CL_INVOCATION_COUNT * restrict values)
875910e230b6Smaya{
876010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
876110e230b6Smaya
876210e230b6Smaya   const uint64_t v0 =
876310e230b6Smaya      __gen_uint(values->CLInvocationCountReport, 0, 63);
876410e230b6Smaya   dw[0] = v0;
876510e230b6Smaya   dw[1] = v0 >> 32;
876610e230b6Smaya}
876710e230b6Smaya
876896c5ddc4Srjs#define GFX8_CL_PRIMITIVES_COUNT_num      0x2340
876996c5ddc4Srjs#define GFX8_CL_PRIMITIVES_COUNT_length        2
877096c5ddc4Srjsstruct GFX8_CL_PRIMITIVES_COUNT {
877110e230b6Smaya   uint64_t                             CLPrimitivesCountReport;
877210e230b6Smaya};
877310e230b6Smaya
877496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
877596c5ddc4SrjsGFX8_CL_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
877610e230b6Smaya                              __attribute__((unused)) void * restrict dst,
877796c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_CL_PRIMITIVES_COUNT * restrict values)
877810e230b6Smaya{
877910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
878010e230b6Smaya
878110e230b6Smaya   const uint64_t v0 =
878210e230b6Smaya      __gen_uint(values->CLPrimitivesCountReport, 0, 63);
878310e230b6Smaya   dw[0] = v0;
878410e230b6Smaya   dw[1] = v0 >> 32;
878510e230b6Smaya}
878610e230b6Smaya
878796c5ddc4Srjs#define GFX8_CS_INVOCATION_COUNT_num      0x2290
878896c5ddc4Srjs#define GFX8_CS_INVOCATION_COUNT_length        2
878996c5ddc4Srjsstruct GFX8_CS_INVOCATION_COUNT {
879010e230b6Smaya   uint64_t                             CSInvocationCountReport;
879110e230b6Smaya};
879210e230b6Smaya
879396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
879496c5ddc4SrjsGFX8_CS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
879510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
879696c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_CS_INVOCATION_COUNT * restrict values)
879710e230b6Smaya{
879810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
879910e230b6Smaya
880010e230b6Smaya   const uint64_t v0 =
880110e230b6Smaya      __gen_uint(values->CSInvocationCountReport, 0, 63);
880210e230b6Smaya   dw[0] = v0;
880310e230b6Smaya   dw[1] = v0 >> 32;
880410e230b6Smaya}
880510e230b6Smaya
880696c5ddc4Srjs#define GFX8_DS_INVOCATION_COUNT_num      0x2308
880796c5ddc4Srjs#define GFX8_DS_INVOCATION_COUNT_length        2
880896c5ddc4Srjsstruct GFX8_DS_INVOCATION_COUNT {
880910e230b6Smaya   uint64_t                             DSInvocationCountReport;
881010e230b6Smaya};
881110e230b6Smaya
881296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
881396c5ddc4SrjsGFX8_DS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
881410e230b6Smaya                              __attribute__((unused)) void * restrict dst,
881596c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_DS_INVOCATION_COUNT * restrict values)
881610e230b6Smaya{
881710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
881810e230b6Smaya
881910e230b6Smaya   const uint64_t v0 =
882010e230b6Smaya      __gen_uint(values->DSInvocationCountReport, 0, 63);
882110e230b6Smaya   dw[0] = v0;
882210e230b6Smaya   dw[1] = v0 >> 32;
882310e230b6Smaya}
882410e230b6Smaya
882596c5ddc4Srjs#define GFX8_FAULT_REG_num                0x4094
882696c5ddc4Srjs#define GFX8_FAULT_REG_length                  1
882796c5ddc4Srjsstruct GFX8_FAULT_REG {
882810e230b6Smaya   bool                                 ValidBit;
882910e230b6Smaya   uint32_t                             FaultType;
883010e230b6Smaya#define InvalidPTEFault                          0
883110e230b6Smaya#define InvalidPDEFault                          1
883210e230b6Smaya#define InvalidPDPEFault                         2
883310e230b6Smaya#define InvalidPML4EFault                        3
883410e230b6Smaya   uint32_t                             SRCIDofFault;
883510e230b6Smaya   uint32_t                             GTTSEL;
883610e230b6Smaya#define PPGTT                                    0
883710e230b6Smaya#define GGTT                                     1
883810e230b6Smaya   uint32_t                             EngineID;
883910e230b6Smaya#define GFX                                      0
884010e230b6Smaya#define MFX0                                     1
884110e230b6Smaya#define MFX1                                     2
884210e230b6Smaya#define VEBX                                     3
884310e230b6Smaya#define BLT                                      4
884410e230b6Smaya#define GUC                                      5
884510e230b6Smaya};
884610e230b6Smaya
884796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
884896c5ddc4SrjsGFX8_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
884910e230b6Smaya                    __attribute__((unused)) void * restrict dst,
885096c5ddc4Srjs                    __attribute__((unused)) const struct GFX8_FAULT_REG * restrict values)
885110e230b6Smaya{
885210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
885310e230b6Smaya
885410e230b6Smaya   dw[0] =
885510e230b6Smaya      __gen_uint(values->ValidBit, 0, 0) |
885610e230b6Smaya      __gen_uint(values->FaultType, 1, 2) |
885710e230b6Smaya      __gen_uint(values->SRCIDofFault, 3, 10) |
885810e230b6Smaya      __gen_uint(values->GTTSEL, 11, 11) |
885910e230b6Smaya      __gen_uint(values->EngineID, 12, 14);
886010e230b6Smaya}
886110e230b6Smaya
886296c5ddc4Srjs#define GFX8_GFX_ARB_ERROR_RPT_num        0x40a0
886396c5ddc4Srjs#define GFX8_GFX_ARB_ERROR_RPT_length          1
886496c5ddc4Srjsstruct GFX8_GFX_ARB_ERROR_RPT {
886510e230b6Smaya   bool                                 TLBPageFaultError;
886610e230b6Smaya   bool                                 RSTRMPAVPReadInvalid;
886710e230b6Smaya   bool                                 InvalidPageDirectoryEntryError;
886810e230b6Smaya   bool                                 ROSTRMPAVPInvalidPhysicalAddress;
886910e230b6Smaya   bool                                 TLBPageVTDTranslationError;
887010e230b6Smaya   bool                                 WRDPPAVPInvalid;
887110e230b6Smaya   bool                                 PageDirectoryEntryVTDTranslationError;
887210e230b6Smaya   bool                                 UnloadedPDError;
887310e230b6Smaya   bool                                 GuCVTdtranslationPageFault2ndlevelUndefineddoorbell;
887410e230b6Smaya   bool                                 NonWBmemorytypeforAdvancedContext;
887510e230b6Smaya   bool                                 PASIDNotEnabled;
887610e230b6Smaya   bool                                 PASIDBoundaryViolation;
887710e230b6Smaya   bool                                 PASIDNotValid;
887810e230b6Smaya   bool                                 PASIDWasZeroForUntranslatedRequest;
887910e230b6Smaya   bool                                 ContextWasNotMarkedAsPresentWhenDoingDMA;
888010e230b6Smaya};
888110e230b6Smaya
888296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
888396c5ddc4SrjsGFX8_GFX_ARB_ERROR_RPT_pack(__attribute__((unused)) __gen_user_data *data,
888410e230b6Smaya                            __attribute__((unused)) void * restrict dst,
888596c5ddc4Srjs                            __attribute__((unused)) const struct GFX8_GFX_ARB_ERROR_RPT * restrict values)
888610e230b6Smaya{
888710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
888810e230b6Smaya
888910e230b6Smaya   dw[0] =
889010e230b6Smaya      __gen_uint(values->TLBPageFaultError, 0, 0) |
889110e230b6Smaya      __gen_uint(values->RSTRMPAVPReadInvalid, 1, 1) |
889210e230b6Smaya      __gen_uint(values->InvalidPageDirectoryEntryError, 2, 2) |
889310e230b6Smaya      __gen_uint(values->ROSTRMPAVPInvalidPhysicalAddress, 3, 3) |
889410e230b6Smaya      __gen_uint(values->TLBPageVTDTranslationError, 4, 4) |
889510e230b6Smaya      __gen_uint(values->WRDPPAVPInvalid, 5, 5) |
889610e230b6Smaya      __gen_uint(values->PageDirectoryEntryVTDTranslationError, 6, 6) |
889710e230b6Smaya      __gen_uint(values->UnloadedPDError, 8, 8) |
889810e230b6Smaya      __gen_uint(values->GuCVTdtranslationPageFault2ndlevelUndefineddoorbell, 9, 9) |
889910e230b6Smaya      __gen_uint(values->NonWBmemorytypeforAdvancedContext, 10, 10) |
890010e230b6Smaya      __gen_uint(values->PASIDNotEnabled, 11, 11) |
890110e230b6Smaya      __gen_uint(values->PASIDBoundaryViolation, 12, 12) |
890210e230b6Smaya      __gen_uint(values->PASIDNotValid, 13, 13) |
890310e230b6Smaya      __gen_uint(values->PASIDWasZeroForUntranslatedRequest, 14, 14) |
890410e230b6Smaya      __gen_uint(values->ContextWasNotMarkedAsPresentWhenDoingDMA, 15, 15);
890510e230b6Smaya}
890610e230b6Smaya
890796c5ddc4Srjs#define GFX8_GS_INVOCATION_COUNT_num      0x2328
890896c5ddc4Srjs#define GFX8_GS_INVOCATION_COUNT_length        2
890996c5ddc4Srjsstruct GFX8_GS_INVOCATION_COUNT {
891010e230b6Smaya   uint64_t                             GSInvocationCountReport;
891110e230b6Smaya};
891210e230b6Smaya
891396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
891496c5ddc4SrjsGFX8_GS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
891510e230b6Smaya                              __attribute__((unused)) void * restrict dst,
891696c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_GS_INVOCATION_COUNT * restrict values)
891710e230b6Smaya{
891810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
891910e230b6Smaya
892010e230b6Smaya   const uint64_t v0 =
892110e230b6Smaya      __gen_uint(values->GSInvocationCountReport, 0, 63);
892210e230b6Smaya   dw[0] = v0;
892310e230b6Smaya   dw[1] = v0 >> 32;
892410e230b6Smaya}
892510e230b6Smaya
892696c5ddc4Srjs#define GFX8_GS_PRIMITIVES_COUNT_num      0x2330
892796c5ddc4Srjs#define GFX8_GS_PRIMITIVES_COUNT_length        2
892896c5ddc4Srjsstruct GFX8_GS_PRIMITIVES_COUNT {
892910e230b6Smaya   uint64_t                             GSPrimitivesCountReport;
893010e230b6Smaya};
893110e230b6Smaya
893296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
893396c5ddc4SrjsGFX8_GS_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
893410e230b6Smaya                              __attribute__((unused)) void * restrict dst,
893596c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_GS_PRIMITIVES_COUNT * restrict values)
893610e230b6Smaya{
893710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
893810e230b6Smaya
893910e230b6Smaya   const uint64_t v0 =
894010e230b6Smaya      __gen_uint(values->GSPrimitivesCountReport, 0, 63);
894110e230b6Smaya   dw[0] = v0;
894210e230b6Smaya   dw[1] = v0 >> 32;
894310e230b6Smaya}
894410e230b6Smaya
894596c5ddc4Srjs#define GFX8_HS_INVOCATION_COUNT_num      0x2300
894696c5ddc4Srjs#define GFX8_HS_INVOCATION_COUNT_length        2
894796c5ddc4Srjsstruct GFX8_HS_INVOCATION_COUNT {
894810e230b6Smaya   uint64_t                             HSInvocationCountReport;
894910e230b6Smaya};
895010e230b6Smaya
895196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
895296c5ddc4SrjsGFX8_HS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
895310e230b6Smaya                              __attribute__((unused)) void * restrict dst,
895496c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_HS_INVOCATION_COUNT * restrict values)
895510e230b6Smaya{
895610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
895710e230b6Smaya
895810e230b6Smaya   const uint64_t v0 =
895910e230b6Smaya      __gen_uint(values->HSInvocationCountReport, 0, 63);
896010e230b6Smaya   dw[0] = v0;
896110e230b6Smaya   dw[1] = v0 >> 32;
896210e230b6Smaya}
896310e230b6Smaya
896496c5ddc4Srjs#define GFX8_IA_PRIMITIVES_COUNT_num      0x2318
896596c5ddc4Srjs#define GFX8_IA_PRIMITIVES_COUNT_length        2
896696c5ddc4Srjsstruct GFX8_IA_PRIMITIVES_COUNT {
896710e230b6Smaya   uint64_t                             IAPrimitivesCountReport;
896810e230b6Smaya};
896910e230b6Smaya
897096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
897196c5ddc4SrjsGFX8_IA_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
897210e230b6Smaya                              __attribute__((unused)) void * restrict dst,
897396c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_IA_PRIMITIVES_COUNT * restrict values)
897410e230b6Smaya{
897510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
897610e230b6Smaya
897710e230b6Smaya   const uint64_t v0 =
897810e230b6Smaya      __gen_uint(values->IAPrimitivesCountReport, 0, 63);
897910e230b6Smaya   dw[0] = v0;
898010e230b6Smaya   dw[1] = v0 >> 32;
898110e230b6Smaya}
898210e230b6Smaya
898396c5ddc4Srjs#define GFX8_IA_VERTICES_COUNT_num        0x2310
898496c5ddc4Srjs#define GFX8_IA_VERTICES_COUNT_length          2
898596c5ddc4Srjsstruct GFX8_IA_VERTICES_COUNT {
898610e230b6Smaya   uint64_t                             IAVerticesCountReport;
898710e230b6Smaya};
898810e230b6Smaya
898996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
899096c5ddc4SrjsGFX8_IA_VERTICES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
899110e230b6Smaya                            __attribute__((unused)) void * restrict dst,
899296c5ddc4Srjs                            __attribute__((unused)) const struct GFX8_IA_VERTICES_COUNT * restrict values)
899310e230b6Smaya{
899410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
899510e230b6Smaya
899610e230b6Smaya   const uint64_t v0 =
899710e230b6Smaya      __gen_uint(values->IAVerticesCountReport, 0, 63);
899810e230b6Smaya   dw[0] = v0;
899910e230b6Smaya   dw[1] = v0 >> 32;
900010e230b6Smaya}
900110e230b6Smaya
900296c5ddc4Srjs#define GFX8_INSTDONE_1_num               0x206c
900396c5ddc4Srjs#define GFX8_INSTDONE_1_length                 1
900496c5ddc4Srjsstruct GFX8_INSTDONE_1 {
900510e230b6Smaya   bool                                 PRB0RingEnable;
900610e230b6Smaya   bool                                 VFGDone;
900710e230b6Smaya   bool                                 VSDone;
900810e230b6Smaya   bool                                 HSDone;
900910e230b6Smaya   bool                                 TEDone;
901010e230b6Smaya   bool                                 DSDone;
901110e230b6Smaya   bool                                 GSDone;
901210e230b6Smaya   bool                                 SOLDone;
901310e230b6Smaya   bool                                 CLDone;
901410e230b6Smaya   bool                                 SFDone;
901510e230b6Smaya   bool                                 TDGDone;
901610e230b6Smaya   bool                                 URBMDone;
901710e230b6Smaya   bool                                 SVGDone;
901810e230b6Smaya   bool                                 GAFSDone;
901910e230b6Smaya   bool                                 VFEDone;
902010e230b6Smaya   bool                                 TSGDone;
902110e230b6Smaya   bool                                 GAFMDone;
902210e230b6Smaya   bool                                 GAMDone;
902310e230b6Smaya   bool                                 RSDone;
902410e230b6Smaya   bool                                 CSDone;
902510e230b6Smaya   bool                                 SDEDone;
902610e230b6Smaya   bool                                 RCCFBCCSDone;
902710e230b6Smaya};
902810e230b6Smaya
902996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
903096c5ddc4SrjsGFX8_INSTDONE_1_pack(__attribute__((unused)) __gen_user_data *data,
903110e230b6Smaya                     __attribute__((unused)) void * restrict dst,
903296c5ddc4Srjs                     __attribute__((unused)) const struct GFX8_INSTDONE_1 * restrict values)
903310e230b6Smaya{
903410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
903510e230b6Smaya
903610e230b6Smaya   dw[0] =
903710e230b6Smaya      __gen_uint(values->PRB0RingEnable, 0, 0) |
903810e230b6Smaya      __gen_uint(values->VFGDone, 1, 1) |
903910e230b6Smaya      __gen_uint(values->VSDone, 2, 2) |
904010e230b6Smaya      __gen_uint(values->HSDone, 3, 3) |
904110e230b6Smaya      __gen_uint(values->TEDone, 4, 4) |
904210e230b6Smaya      __gen_uint(values->DSDone, 5, 5) |
904310e230b6Smaya      __gen_uint(values->GSDone, 6, 6) |
904410e230b6Smaya      __gen_uint(values->SOLDone, 7, 7) |
904510e230b6Smaya      __gen_uint(values->CLDone, 8, 8) |
904610e230b6Smaya      __gen_uint(values->SFDone, 9, 9) |
904710e230b6Smaya      __gen_uint(values->TDGDone, 12, 12) |
904810e230b6Smaya      __gen_uint(values->URBMDone, 13, 13) |
904910e230b6Smaya      __gen_uint(values->SVGDone, 14, 14) |
905010e230b6Smaya      __gen_uint(values->GAFSDone, 15, 15) |
905110e230b6Smaya      __gen_uint(values->VFEDone, 16, 16) |
905210e230b6Smaya      __gen_uint(values->TSGDone, 17, 17) |
905310e230b6Smaya      __gen_uint(values->GAFMDone, 18, 18) |
905410e230b6Smaya      __gen_uint(values->GAMDone, 19, 19) |
905510e230b6Smaya      __gen_uint(values->RSDone, 20, 20) |
905610e230b6Smaya      __gen_uint(values->CSDone, 21, 21) |
905710e230b6Smaya      __gen_uint(values->SDEDone, 22, 22) |
905810e230b6Smaya      __gen_uint(values->RCCFBCCSDone, 23, 23);
905910e230b6Smaya}
906010e230b6Smaya
906196c5ddc4Srjs#define GFX8_INSTPM_num                   0x20c0
906296c5ddc4Srjs#define GFX8_INSTPM_length                     1
906396c5ddc4Srjsstruct GFX8_INSTPM {
906410e230b6Smaya   bool                                 _3DStateInstructionDisable;
906510e230b6Smaya   bool                                 _3DRenderingInstructionDisable;
906610e230b6Smaya   bool                                 MediaInstructionDisable;
906710e230b6Smaya   bool                                 CONSTANT_BUFFERAddressOffsetDisable;
906810e230b6Smaya   bool                                 _3DStateInstructionDisableMask;
906910e230b6Smaya   bool                                 _3DRenderingInstructionDisableMask;
907010e230b6Smaya   bool                                 MediaInstructionDisableMask;
907110e230b6Smaya   bool                                 CONSTANT_BUFFERAddressOffsetDisableMask;
907210e230b6Smaya};
907310e230b6Smaya
907496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
907596c5ddc4SrjsGFX8_INSTPM_pack(__attribute__((unused)) __gen_user_data *data,
907610e230b6Smaya                 __attribute__((unused)) void * restrict dst,
907796c5ddc4Srjs                 __attribute__((unused)) const struct GFX8_INSTPM * restrict values)
907810e230b6Smaya{
907910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
908010e230b6Smaya
908110e230b6Smaya   dw[0] =
908210e230b6Smaya      __gen_uint(values->_3DStateInstructionDisable, 1, 1) |
908310e230b6Smaya      __gen_uint(values->_3DRenderingInstructionDisable, 2, 2) |
908410e230b6Smaya      __gen_uint(values->MediaInstructionDisable, 3, 3) |
908510e230b6Smaya      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisable, 6, 6) |
908610e230b6Smaya      __gen_uint(values->_3DStateInstructionDisableMask, 17, 17) |
908710e230b6Smaya      __gen_uint(values->_3DRenderingInstructionDisableMask, 18, 18) |
908810e230b6Smaya      __gen_uint(values->MediaInstructionDisableMask, 19, 19) |
908910e230b6Smaya      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisableMask, 22, 22);
909010e230b6Smaya}
909110e230b6Smaya
909296c5ddc4Srjs#define GFX8_L3CNTLREG_num                0x7034
909396c5ddc4Srjs#define GFX8_L3CNTLREG_length                  1
909496c5ddc4Srjsstruct GFX8_L3CNTLREG {
909510e230b6Smaya   bool                                 SLMEnable;
909610e230b6Smaya   uint32_t                             URBAllocation;
909710e230b6Smaya   uint32_t                             ROAllocation;
909810e230b6Smaya   uint32_t                             DCAllocation;
909910e230b6Smaya   uint32_t                             AllAllocation;
910010e230b6Smaya};
910110e230b6Smaya
910296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
910396c5ddc4SrjsGFX8_L3CNTLREG_pack(__attribute__((unused)) __gen_user_data *data,
910410e230b6Smaya                    __attribute__((unused)) void * restrict dst,
910596c5ddc4Srjs                    __attribute__((unused)) const struct GFX8_L3CNTLREG * restrict values)
910610e230b6Smaya{
910710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
910810e230b6Smaya
910910e230b6Smaya   dw[0] =
911010e230b6Smaya      __gen_uint(values->SLMEnable, 0, 0) |
911110e230b6Smaya      __gen_uint(values->URBAllocation, 1, 7) |
911210e230b6Smaya      __gen_uint(values->ROAllocation, 11, 17) |
911310e230b6Smaya      __gen_uint(values->DCAllocation, 18, 24) |
911410e230b6Smaya      __gen_uint(values->AllAllocation, 25, 31);
911510e230b6Smaya}
911610e230b6Smaya
911796c5ddc4Srjs#define GFX8_PERFCNT1_num                 0x91b8
911896c5ddc4Srjs#define GFX8_PERFCNT1_length                   2
911996c5ddc4Srjsstruct GFX8_PERFCNT1 {
912096c5ddc4Srjs   uint64_t                             Value;
912196c5ddc4Srjs   uint32_t                             EventSelection;
912296c5ddc4Srjs   bool                                 CounterClear;
912396c5ddc4Srjs   bool                                 EdgeDetect;
912496c5ddc4Srjs   bool                                 OverflowEnable;
912596c5ddc4Srjs   bool                                 CounterEnable;
912696c5ddc4Srjs};
912796c5ddc4Srjs
912896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
912996c5ddc4SrjsGFX8_PERFCNT1_pack(__attribute__((unused)) __gen_user_data *data,
913096c5ddc4Srjs                   __attribute__((unused)) void * restrict dst,
913196c5ddc4Srjs                   __attribute__((unused)) const struct GFX8_PERFCNT1 * restrict values)
913296c5ddc4Srjs{
913396c5ddc4Srjs   uint32_t * restrict dw = (uint32_t * restrict) dst;
913496c5ddc4Srjs
913596c5ddc4Srjs   const uint64_t v0 =
913696c5ddc4Srjs      __gen_uint(values->Value, 0, 43) |
913796c5ddc4Srjs      __gen_uint(values->EventSelection, 52, 59) |
913896c5ddc4Srjs      __gen_uint(values->CounterClear, 60, 60) |
913996c5ddc4Srjs      __gen_uint(values->EdgeDetect, 61, 61) |
914096c5ddc4Srjs      __gen_uint(values->OverflowEnable, 62, 62) |
914196c5ddc4Srjs      __gen_uint(values->CounterEnable, 63, 63);
914296c5ddc4Srjs   dw[0] = v0;
914396c5ddc4Srjs   dw[1] = v0 >> 32;
914496c5ddc4Srjs}
914596c5ddc4Srjs
914696c5ddc4Srjs#define GFX8_PERFCNT2_num                 0x91c0
914796c5ddc4Srjs#define GFX8_PERFCNT2_length                   2
914896c5ddc4Srjsstruct GFX8_PERFCNT2 {
914996c5ddc4Srjs   uint64_t                             Value;
915096c5ddc4Srjs   uint32_t                             EventSelection;
915196c5ddc4Srjs   bool                                 CounterClear;
915296c5ddc4Srjs   bool                                 EdgeDetect;
915396c5ddc4Srjs   bool                                 OverflowEnable;
915496c5ddc4Srjs   bool                                 CounterEnable;
915596c5ddc4Srjs};
915696c5ddc4Srjs
915796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
915896c5ddc4SrjsGFX8_PERFCNT2_pack(__attribute__((unused)) __gen_user_data *data,
915996c5ddc4Srjs                   __attribute__((unused)) void * restrict dst,
916096c5ddc4Srjs                   __attribute__((unused)) const struct GFX8_PERFCNT2 * restrict values)
916196c5ddc4Srjs{
916296c5ddc4Srjs   uint32_t * restrict dw = (uint32_t * restrict) dst;
916396c5ddc4Srjs
916496c5ddc4Srjs   const uint64_t v0 =
916596c5ddc4Srjs      __gen_uint(values->Value, 0, 43) |
916696c5ddc4Srjs      __gen_uint(values->EventSelection, 52, 59) |
916796c5ddc4Srjs      __gen_uint(values->CounterClear, 60, 60) |
916896c5ddc4Srjs      __gen_uint(values->EdgeDetect, 61, 61) |
916996c5ddc4Srjs      __gen_uint(values->OverflowEnable, 62, 62) |
917096c5ddc4Srjs      __gen_uint(values->CounterEnable, 63, 63);
917196c5ddc4Srjs   dw[0] = v0;
917296c5ddc4Srjs   dw[1] = v0 >> 32;
917396c5ddc4Srjs}
917496c5ddc4Srjs
917596c5ddc4Srjs#define GFX8_PS_INVOCATION_COUNT_num      0x2348
917696c5ddc4Srjs#define GFX8_PS_INVOCATION_COUNT_length        2
917796c5ddc4Srjsstruct GFX8_PS_INVOCATION_COUNT {
917810e230b6Smaya   uint64_t                             PSInvocationCountReport;
917910e230b6Smaya};
918010e230b6Smaya
918196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
918296c5ddc4SrjsGFX8_PS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
918310e230b6Smaya                              __attribute__((unused)) void * restrict dst,
918496c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_PS_INVOCATION_COUNT * restrict values)
918510e230b6Smaya{
918610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
918710e230b6Smaya
918810e230b6Smaya   const uint64_t v0 =
918910e230b6Smaya      __gen_uint(values->PSInvocationCountReport, 0, 63);
919010e230b6Smaya   dw[0] = v0;
919110e230b6Smaya   dw[1] = v0 >> 32;
919210e230b6Smaya}
919310e230b6Smaya
919496c5ddc4Srjs#define GFX8_RCS_RING_BUFFER_CTL_num      0x203c
919596c5ddc4Srjs#define GFX8_RCS_RING_BUFFER_CTL_length        1
919696c5ddc4Srjsstruct GFX8_RCS_RING_BUFFER_CTL {
919710e230b6Smaya   bool                                 RingBufferEnable;
919810e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
919910e230b6Smaya#define MI_AUTOREPORT_OFF                        0
920010e230b6Smaya#define MI_AUTOREPORT_64KB                       1
920110e230b6Smaya#define MI_AUTOREPORT_4KB                        2
920210e230b6Smaya#define MI_AUTOREPORT_128KB                      3
920310e230b6Smaya   bool                                 SemaphoreWait;
920410e230b6Smaya   bool                                 RBWait;
920510e230b6Smaya   uint32_t                             BufferLengthinpages1;
920610e230b6Smaya};
920710e230b6Smaya
920896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
920996c5ddc4SrjsGFX8_RCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
921010e230b6Smaya                              __attribute__((unused)) void * restrict dst,
921196c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_RCS_RING_BUFFER_CTL * restrict values)
921210e230b6Smaya{
921310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
921410e230b6Smaya
921510e230b6Smaya   dw[0] =
921610e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
921710e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
921810e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
921910e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
922010e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
922110e230b6Smaya}
922210e230b6Smaya
922396c5ddc4Srjs#define GFX8_ROW_INSTDONE_num             0xe164
922496c5ddc4Srjs#define GFX8_ROW_INSTDONE_length               1
922596c5ddc4Srjsstruct GFX8_ROW_INSTDONE {
922610e230b6Smaya   bool                                 BCDone;
922710e230b6Smaya   bool                                 PSDDone;
922810e230b6Smaya   bool                                 DAPRDone;
922910e230b6Smaya   bool                                 TDLDone;
923010e230b6Smaya   bool                                 ICDone;
923110e230b6Smaya   bool                                 MA0Done;
923210e230b6Smaya   bool                                 EU00DoneSS0;
923310e230b6Smaya   bool                                 EU01DoneSS0;
923410e230b6Smaya   bool                                 EU02DoneSS0;
923510e230b6Smaya   bool                                 EU03DoneSS0;
923610e230b6Smaya   bool                                 EU10DoneSS0;
923710e230b6Smaya   bool                                 EU11DoneSS0;
923810e230b6Smaya   bool                                 EU12DoneSS0;
923910e230b6Smaya   bool                                 EU13DoneSS0;
924010e230b6Smaya   bool                                 MA1DoneSS0;
924110e230b6Smaya};
924210e230b6Smaya
924396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
924496c5ddc4SrjsGFX8_ROW_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
924510e230b6Smaya                       __attribute__((unused)) void * restrict dst,
924696c5ddc4Srjs                       __attribute__((unused)) const struct GFX8_ROW_INSTDONE * restrict values)
924710e230b6Smaya{
924810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
924910e230b6Smaya
925010e230b6Smaya   dw[0] =
925110e230b6Smaya      __gen_uint(values->BCDone, 0, 0) |
925210e230b6Smaya      __gen_uint(values->PSDDone, 1, 1) |
925310e230b6Smaya      __gen_uint(values->DAPRDone, 3, 3) |
925410e230b6Smaya      __gen_uint(values->TDLDone, 6, 6) |
925510e230b6Smaya      __gen_uint(values->ICDone, 12, 12) |
925610e230b6Smaya      __gen_uint(values->MA0Done, 15, 15) |
925710e230b6Smaya      __gen_uint(values->EU00DoneSS0, 16, 16) |
925810e230b6Smaya      __gen_uint(values->EU01DoneSS0, 17, 17) |
925910e230b6Smaya      __gen_uint(values->EU02DoneSS0, 18, 18) |
926010e230b6Smaya      __gen_uint(values->EU03DoneSS0, 19, 19) |
926110e230b6Smaya      __gen_uint(values->EU10DoneSS0, 21, 21) |
926210e230b6Smaya      __gen_uint(values->EU11DoneSS0, 22, 22) |
926310e230b6Smaya      __gen_uint(values->EU12DoneSS0, 23, 23) |
926410e230b6Smaya      __gen_uint(values->EU13DoneSS0, 24, 24) |
926510e230b6Smaya      __gen_uint(values->MA1DoneSS0, 26, 26);
926610e230b6Smaya}
926710e230b6Smaya
926896c5ddc4Srjs#define GFX8_RPSTAT1_num                  0xa01c
926996c5ddc4Srjs#define GFX8_RPSTAT1_length                    1
927096c5ddc4Srjsstruct GFX8_RPSTAT1 {
927196c5ddc4Srjs   uint32_t                             PreviousGTFrequency;
927296c5ddc4Srjs   uint32_t                             CurrentGTFrequency;
927396c5ddc4Srjs};
927496c5ddc4Srjs
927596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
927696c5ddc4SrjsGFX8_RPSTAT1_pack(__attribute__((unused)) __gen_user_data *data,
927796c5ddc4Srjs                  __attribute__((unused)) void * restrict dst,
927896c5ddc4Srjs                  __attribute__((unused)) const struct GFX8_RPSTAT1 * restrict values)
927996c5ddc4Srjs{
928096c5ddc4Srjs   uint32_t * restrict dw = (uint32_t * restrict) dst;
928196c5ddc4Srjs
928296c5ddc4Srjs   dw[0] =
928396c5ddc4Srjs      __gen_uint(values->PreviousGTFrequency, 0, 6) |
928496c5ddc4Srjs      __gen_uint(values->CurrentGTFrequency, 7, 14);
928596c5ddc4Srjs}
928696c5ddc4Srjs
928796c5ddc4Srjs#define GFX8_SAMPLER_INSTDONE_num         0xe160
928896c5ddc4Srjs#define GFX8_SAMPLER_INSTDONE_length           1
928996c5ddc4Srjsstruct GFX8_SAMPLER_INSTDONE {
929010e230b6Smaya   bool                                 IMEDone;
929110e230b6Smaya   bool                                 PL0Done;
929210e230b6Smaya   bool                                 SO0Done;
929310e230b6Smaya   bool                                 DG0Done;
929410e230b6Smaya   bool                                 FT0Done;
929510e230b6Smaya   bool                                 DM0Done;
929610e230b6Smaya   bool                                 SCDone;
929710e230b6Smaya   bool                                 FL0Done;
929810e230b6Smaya   bool                                 QCDone;
929910e230b6Smaya   bool                                 SVSMDone;
930010e230b6Smaya   bool                                 SI0Done;
930110e230b6Smaya   bool                                 MT0Done;
930210e230b6Smaya   bool                                 AVSDone;
930310e230b6Smaya   bool                                 IEFDone;
930410e230b6Smaya   bool                                 CREDone;
930510e230b6Smaya   bool                                 SVSMARB3;
930610e230b6Smaya   bool                                 SVSMARB2;
930710e230b6Smaya   bool                                 SVSMARB1;
930810e230b6Smaya   bool                                 SVSMAdapter;
930910e230b6Smaya   bool                                 BDMDone;
931010e230b6Smaya};
931110e230b6Smaya
931296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
931396c5ddc4SrjsGFX8_SAMPLER_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
931410e230b6Smaya                           __attribute__((unused)) void * restrict dst,
931596c5ddc4Srjs                           __attribute__((unused)) const struct GFX8_SAMPLER_INSTDONE * restrict values)
931610e230b6Smaya{
931710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
931810e230b6Smaya
931910e230b6Smaya   dw[0] =
932010e230b6Smaya      __gen_uint(values->IMEDone, 0, 0) |
932110e230b6Smaya      __gen_uint(values->PL0Done, 1, 1) |
932210e230b6Smaya      __gen_uint(values->SO0Done, 2, 2) |
932310e230b6Smaya      __gen_uint(values->DG0Done, 3, 3) |
932410e230b6Smaya      __gen_uint(values->FT0Done, 4, 4) |
932510e230b6Smaya      __gen_uint(values->DM0Done, 5, 5) |
932610e230b6Smaya      __gen_uint(values->SCDone, 6, 6) |
932710e230b6Smaya      __gen_uint(values->FL0Done, 7, 7) |
932810e230b6Smaya      __gen_uint(values->QCDone, 8, 8) |
932910e230b6Smaya      __gen_uint(values->SVSMDone, 9, 9) |
933010e230b6Smaya      __gen_uint(values->SI0Done, 10, 10) |
933110e230b6Smaya      __gen_uint(values->MT0Done, 11, 11) |
933210e230b6Smaya      __gen_uint(values->AVSDone, 12, 12) |
933310e230b6Smaya      __gen_uint(values->IEFDone, 13, 13) |
933410e230b6Smaya      __gen_uint(values->CREDone, 14, 14) |
933510e230b6Smaya      __gen_uint(values->SVSMARB3, 15, 15) |
933610e230b6Smaya      __gen_uint(values->SVSMARB2, 16, 16) |
933710e230b6Smaya      __gen_uint(values->SVSMARB1, 17, 17) |
933810e230b6Smaya      __gen_uint(values->SVSMAdapter, 18, 18) |
933910e230b6Smaya      __gen_uint(values->BDMDone, 19, 19);
934010e230b6Smaya}
934110e230b6Smaya
934296c5ddc4Srjs#define GFX8_SC_INSTDONE_num              0x7100
934396c5ddc4Srjs#define GFX8_SC_INSTDONE_length                1
934496c5ddc4Srjsstruct GFX8_SC_INSTDONE {
934510e230b6Smaya   bool                                 SVLDone;
934610e230b6Smaya   bool                                 WMFEDone;
934710e230b6Smaya   bool                                 WMBEDone;
934810e230b6Smaya   bool                                 HIZDone;
934910e230b6Smaya   bool                                 STCDone;
935010e230b6Smaya   bool                                 IZDone;
935110e230b6Smaya   bool                                 SBEDone;
935210e230b6Smaya   bool                                 RCZDone;
935310e230b6Smaya   bool                                 RCCDone;
935410e230b6Smaya   bool                                 RCPBEDone;
935510e230b6Smaya   bool                                 RCPFEDone;
935610e230b6Smaya   bool                                 DAPBDone;
935710e230b6Smaya   bool                                 DAPRBEDone;
935810e230b6Smaya   bool                                 SARBDone;
935910e230b6Smaya   bool                                 DC0Done;
936010e230b6Smaya   bool                                 DC1Done;
936110e230b6Smaya   bool                                 DC2Done;
936210e230b6Smaya   bool                                 GW0Done;
936310e230b6Smaya   bool                                 GW1Done;
936410e230b6Smaya   bool                                 GW2Done;
936510e230b6Smaya   bool                                 TDCDone;
936610e230b6Smaya};
936710e230b6Smaya
936896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
936996c5ddc4SrjsGFX8_SC_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
937010e230b6Smaya                      __attribute__((unused)) void * restrict dst,
937196c5ddc4Srjs                      __attribute__((unused)) const struct GFX8_SC_INSTDONE * restrict values)
937210e230b6Smaya{
937310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
937410e230b6Smaya
937510e230b6Smaya   dw[0] =
937610e230b6Smaya      __gen_uint(values->SVLDone, 0, 0) |
937710e230b6Smaya      __gen_uint(values->WMFEDone, 1, 1) |
937810e230b6Smaya      __gen_uint(values->WMBEDone, 2, 2) |
937910e230b6Smaya      __gen_uint(values->HIZDone, 3, 3) |
938010e230b6Smaya      __gen_uint(values->STCDone, 4, 4) |
938110e230b6Smaya      __gen_uint(values->IZDone, 5, 5) |
938210e230b6Smaya      __gen_uint(values->SBEDone, 6, 6) |
938310e230b6Smaya      __gen_uint(values->RCZDone, 8, 8) |
938410e230b6Smaya      __gen_uint(values->RCCDone, 9, 9) |
938510e230b6Smaya      __gen_uint(values->RCPBEDone, 10, 10) |
938610e230b6Smaya      __gen_uint(values->RCPFEDone, 11, 11) |
938710e230b6Smaya      __gen_uint(values->DAPBDone, 12, 12) |
938810e230b6Smaya      __gen_uint(values->DAPRBEDone, 13, 13) |
938910e230b6Smaya      __gen_uint(values->SARBDone, 15, 15) |
939010e230b6Smaya      __gen_uint(values->DC0Done, 16, 16) |
939110e230b6Smaya      __gen_uint(values->DC1Done, 17, 17) |
939210e230b6Smaya      __gen_uint(values->DC2Done, 18, 18) |
939310e230b6Smaya      __gen_uint(values->GW0Done, 20, 20) |
939410e230b6Smaya      __gen_uint(values->GW1Done, 21, 21) |
939510e230b6Smaya      __gen_uint(values->GW2Done, 22, 22) |
939610e230b6Smaya      __gen_uint(values->TDCDone, 24, 24);
939710e230b6Smaya}
939810e230b6Smaya
939996c5ddc4Srjs#define GFX8_SO_NUM_PRIMS_WRITTEN0_num    0x5200
940096c5ddc4Srjs#define GFX8_SO_NUM_PRIMS_WRITTEN0_length      2
940196c5ddc4Srjsstruct GFX8_SO_NUM_PRIMS_WRITTEN0 {
940210e230b6Smaya   uint64_t                             NumPrimsWrittenCount;
940310e230b6Smaya};
940410e230b6Smaya
940596c5ddc4Srjsstatic inline __attribute__((always_inline)) void
940696c5ddc4SrjsGFX8_SO_NUM_PRIMS_WRITTEN0_pack(__attribute__((unused)) __gen_user_data *data,
940710e230b6Smaya                                __attribute__((unused)) void * restrict dst,
940896c5ddc4Srjs                                __attribute__((unused)) const struct GFX8_SO_NUM_PRIMS_WRITTEN0 * restrict values)
940910e230b6Smaya{
941010e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
941110e230b6Smaya
941210e230b6Smaya   const uint64_t v0 =
941310e230b6Smaya      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
941410e230b6Smaya   dw[0] = v0;
941510e230b6Smaya   dw[1] = v0 >> 32;
941610e230b6Smaya}
941710e230b6Smaya
941896c5ddc4Srjs#define GFX8_SO_NUM_PRIMS_WRITTEN1_num    0x5208
941996c5ddc4Srjs#define GFX8_SO_NUM_PRIMS_WRITTEN1_length      2
942096c5ddc4Srjsstruct GFX8_SO_NUM_PRIMS_WRITTEN1 {
942110e230b6Smaya   uint64_t                             NumPrimsWrittenCount;
942210e230b6Smaya};
942310e230b6Smaya
942496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
942596c5ddc4SrjsGFX8_SO_NUM_PRIMS_WRITTEN1_pack(__attribute__((unused)) __gen_user_data *data,
942610e230b6Smaya                                __attribute__((unused)) void * restrict dst,
942796c5ddc4Srjs                                __attribute__((unused)) const struct GFX8_SO_NUM_PRIMS_WRITTEN1 * restrict values)
942810e230b6Smaya{
942910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
943010e230b6Smaya
943110e230b6Smaya   const uint64_t v0 =
943210e230b6Smaya      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
943310e230b6Smaya   dw[0] = v0;
943410e230b6Smaya   dw[1] = v0 >> 32;
943510e230b6Smaya}
943610e230b6Smaya
943796c5ddc4Srjs#define GFX8_SO_NUM_PRIMS_WRITTEN2_num    0x5210
943896c5ddc4Srjs#define GFX8_SO_NUM_PRIMS_WRITTEN2_length      2
943996c5ddc4Srjsstruct GFX8_SO_NUM_PRIMS_WRITTEN2 {
944010e230b6Smaya   uint64_t                             NumPrimsWrittenCount;
944110e230b6Smaya};
944210e230b6Smaya
944396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
944496c5ddc4SrjsGFX8_SO_NUM_PRIMS_WRITTEN2_pack(__attribute__((unused)) __gen_user_data *data,
944510e230b6Smaya                                __attribute__((unused)) void * restrict dst,
944696c5ddc4Srjs                                __attribute__((unused)) const struct GFX8_SO_NUM_PRIMS_WRITTEN2 * restrict values)
944710e230b6Smaya{
944810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
944910e230b6Smaya
945010e230b6Smaya   const uint64_t v0 =
945110e230b6Smaya      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
945210e230b6Smaya   dw[0] = v0;
945310e230b6Smaya   dw[1] = v0 >> 32;
945410e230b6Smaya}
945510e230b6Smaya
945696c5ddc4Srjs#define GFX8_SO_NUM_PRIMS_WRITTEN3_num    0x5218
945796c5ddc4Srjs#define GFX8_SO_NUM_PRIMS_WRITTEN3_length      2
945896c5ddc4Srjsstruct GFX8_SO_NUM_PRIMS_WRITTEN3 {
945910e230b6Smaya   uint64_t                             NumPrimsWrittenCount;
946010e230b6Smaya};
946110e230b6Smaya
946296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
946396c5ddc4SrjsGFX8_SO_NUM_PRIMS_WRITTEN3_pack(__attribute__((unused)) __gen_user_data *data,
946410e230b6Smaya                                __attribute__((unused)) void * restrict dst,
946596c5ddc4Srjs                                __attribute__((unused)) const struct GFX8_SO_NUM_PRIMS_WRITTEN3 * restrict values)
946610e230b6Smaya{
946710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
946810e230b6Smaya
946910e230b6Smaya   const uint64_t v0 =
947010e230b6Smaya      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
947110e230b6Smaya   dw[0] = v0;
947210e230b6Smaya   dw[1] = v0 >> 32;
947310e230b6Smaya}
947410e230b6Smaya
947596c5ddc4Srjs#define GFX8_SO_PRIM_STORAGE_NEEDED0_num  0x5240
947696c5ddc4Srjs#define GFX8_SO_PRIM_STORAGE_NEEDED0_length      2
947796c5ddc4Srjsstruct GFX8_SO_PRIM_STORAGE_NEEDED0 {
947810e230b6Smaya   uint64_t                             PrimStorageNeededCount;
947910e230b6Smaya};
948010e230b6Smaya
948196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
948296c5ddc4SrjsGFX8_SO_PRIM_STORAGE_NEEDED0_pack(__attribute__((unused)) __gen_user_data *data,
948310e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
948496c5ddc4Srjs                                  __attribute__((unused)) const struct GFX8_SO_PRIM_STORAGE_NEEDED0 * restrict values)
948510e230b6Smaya{
948610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
948710e230b6Smaya
948810e230b6Smaya   const uint64_t v0 =
948910e230b6Smaya      __gen_uint(values->PrimStorageNeededCount, 0, 63);
949010e230b6Smaya   dw[0] = v0;
949110e230b6Smaya   dw[1] = v0 >> 32;
949210e230b6Smaya}
949310e230b6Smaya
949496c5ddc4Srjs#define GFX8_SO_PRIM_STORAGE_NEEDED1_num  0x5248
949596c5ddc4Srjs#define GFX8_SO_PRIM_STORAGE_NEEDED1_length      2
949696c5ddc4Srjsstruct GFX8_SO_PRIM_STORAGE_NEEDED1 {
949710e230b6Smaya   uint64_t                             PrimStorageNeededCount;
949810e230b6Smaya};
949910e230b6Smaya
950096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
950196c5ddc4SrjsGFX8_SO_PRIM_STORAGE_NEEDED1_pack(__attribute__((unused)) __gen_user_data *data,
950210e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
950396c5ddc4Srjs                                  __attribute__((unused)) const struct GFX8_SO_PRIM_STORAGE_NEEDED1 * restrict values)
950410e230b6Smaya{
950510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
950610e230b6Smaya
950710e230b6Smaya   const uint64_t v0 =
950810e230b6Smaya      __gen_uint(values->PrimStorageNeededCount, 0, 63);
950910e230b6Smaya   dw[0] = v0;
951010e230b6Smaya   dw[1] = v0 >> 32;
951110e230b6Smaya}
951210e230b6Smaya
951396c5ddc4Srjs#define GFX8_SO_PRIM_STORAGE_NEEDED2_num  0x5250
951496c5ddc4Srjs#define GFX8_SO_PRIM_STORAGE_NEEDED2_length      2
951596c5ddc4Srjsstruct GFX8_SO_PRIM_STORAGE_NEEDED2 {
951610e230b6Smaya   uint64_t                             PrimStorageNeededCount;
951710e230b6Smaya};
951810e230b6Smaya
951996c5ddc4Srjsstatic inline __attribute__((always_inline)) void
952096c5ddc4SrjsGFX8_SO_PRIM_STORAGE_NEEDED2_pack(__attribute__((unused)) __gen_user_data *data,
952110e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
952296c5ddc4Srjs                                  __attribute__((unused)) const struct GFX8_SO_PRIM_STORAGE_NEEDED2 * restrict values)
952310e230b6Smaya{
952410e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
952510e230b6Smaya
952610e230b6Smaya   const uint64_t v0 =
952710e230b6Smaya      __gen_uint(values->PrimStorageNeededCount, 0, 63);
952810e230b6Smaya   dw[0] = v0;
952910e230b6Smaya   dw[1] = v0 >> 32;
953010e230b6Smaya}
953110e230b6Smaya
953296c5ddc4Srjs#define GFX8_SO_PRIM_STORAGE_NEEDED3_num  0x5258
953396c5ddc4Srjs#define GFX8_SO_PRIM_STORAGE_NEEDED3_length      2
953496c5ddc4Srjsstruct GFX8_SO_PRIM_STORAGE_NEEDED3 {
953510e230b6Smaya   uint64_t                             PrimStorageNeededCount;
953610e230b6Smaya};
953710e230b6Smaya
953896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
953996c5ddc4SrjsGFX8_SO_PRIM_STORAGE_NEEDED3_pack(__attribute__((unused)) __gen_user_data *data,
954010e230b6Smaya                                  __attribute__((unused)) void * restrict dst,
954196c5ddc4Srjs                                  __attribute__((unused)) const struct GFX8_SO_PRIM_STORAGE_NEEDED3 * restrict values)
954210e230b6Smaya{
954310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
954410e230b6Smaya
954510e230b6Smaya   const uint64_t v0 =
954610e230b6Smaya      __gen_uint(values->PrimStorageNeededCount, 0, 63);
954710e230b6Smaya   dw[0] = v0;
954810e230b6Smaya   dw[1] = v0 >> 32;
954910e230b6Smaya}
955010e230b6Smaya
955196c5ddc4Srjs#define GFX8_SO_WRITE_OFFSET0_num         0x5280
955296c5ddc4Srjs#define GFX8_SO_WRITE_OFFSET0_length           1
955396c5ddc4Srjsstruct GFX8_SO_WRITE_OFFSET0 {
955410e230b6Smaya   uint64_t                             WriteOffset;
955510e230b6Smaya};
955610e230b6Smaya
955796c5ddc4Srjsstatic inline __attribute__((always_inline)) void
955896c5ddc4SrjsGFX8_SO_WRITE_OFFSET0_pack(__attribute__((unused)) __gen_user_data *data,
955910e230b6Smaya                           __attribute__((unused)) void * restrict dst,
956096c5ddc4Srjs                           __attribute__((unused)) const struct GFX8_SO_WRITE_OFFSET0 * restrict values)
956110e230b6Smaya{
956210e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
956310e230b6Smaya
956410e230b6Smaya   dw[0] =
956510e230b6Smaya      __gen_offset(values->WriteOffset, 2, 31);
956610e230b6Smaya}
956710e230b6Smaya
956896c5ddc4Srjs#define GFX8_SO_WRITE_OFFSET1_num         0x5284
956996c5ddc4Srjs#define GFX8_SO_WRITE_OFFSET1_length           1
957096c5ddc4Srjsstruct GFX8_SO_WRITE_OFFSET1 {
957110e230b6Smaya   uint64_t                             WriteOffset;
957210e230b6Smaya};
957310e230b6Smaya
957496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
957596c5ddc4SrjsGFX8_SO_WRITE_OFFSET1_pack(__attribute__((unused)) __gen_user_data *data,
957610e230b6Smaya                           __attribute__((unused)) void * restrict dst,
957796c5ddc4Srjs                           __attribute__((unused)) const struct GFX8_SO_WRITE_OFFSET1 * restrict values)
957810e230b6Smaya{
957910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
958010e230b6Smaya
958110e230b6Smaya   dw[0] =
958210e230b6Smaya      __gen_offset(values->WriteOffset, 2, 31);
958310e230b6Smaya}
958410e230b6Smaya
958596c5ddc4Srjs#define GFX8_SO_WRITE_OFFSET2_num         0x5288
958696c5ddc4Srjs#define GFX8_SO_WRITE_OFFSET2_length           1
958796c5ddc4Srjsstruct GFX8_SO_WRITE_OFFSET2 {
958810e230b6Smaya   uint64_t                             WriteOffset;
958910e230b6Smaya};
959010e230b6Smaya
959196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
959296c5ddc4SrjsGFX8_SO_WRITE_OFFSET2_pack(__attribute__((unused)) __gen_user_data *data,
959310e230b6Smaya                           __attribute__((unused)) void * restrict dst,
959496c5ddc4Srjs                           __attribute__((unused)) const struct GFX8_SO_WRITE_OFFSET2 * restrict values)
959510e230b6Smaya{
959610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
959710e230b6Smaya
959810e230b6Smaya   dw[0] =
959910e230b6Smaya      __gen_offset(values->WriteOffset, 2, 31);
960010e230b6Smaya}
960110e230b6Smaya
960296c5ddc4Srjs#define GFX8_SO_WRITE_OFFSET3_num         0x528c
960396c5ddc4Srjs#define GFX8_SO_WRITE_OFFSET3_length           1
960496c5ddc4Srjsstruct GFX8_SO_WRITE_OFFSET3 {
960510e230b6Smaya   uint64_t                             WriteOffset;
960610e230b6Smaya};
960710e230b6Smaya
960896c5ddc4Srjsstatic inline __attribute__((always_inline)) void
960996c5ddc4SrjsGFX8_SO_WRITE_OFFSET3_pack(__attribute__((unused)) __gen_user_data *data,
961010e230b6Smaya                           __attribute__((unused)) void * restrict dst,
961196c5ddc4Srjs                           __attribute__((unused)) const struct GFX8_SO_WRITE_OFFSET3 * restrict values)
961210e230b6Smaya{
961310e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
961410e230b6Smaya
961510e230b6Smaya   dw[0] =
961610e230b6Smaya      __gen_offset(values->WriteOffset, 2, 31);
961710e230b6Smaya}
961810e230b6Smaya
961996c5ddc4Srjs#define GFX8_VCS2_RING_BUFFER_CTL_num     0x1203c
962096c5ddc4Srjs#define GFX8_VCS2_RING_BUFFER_CTL_length       1
962196c5ddc4Srjsstruct GFX8_VCS2_RING_BUFFER_CTL {
962210e230b6Smaya   bool                                 RingBufferEnable;
962310e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
962410e230b6Smaya#define MI_AUTOREPORT_OFF                        0
962510e230b6Smaya#define MI_AUTOREPORT_64KB                       1
962610e230b6Smaya#define MI_AUTOREPORT_4KB                        2
962710e230b6Smaya#define MI_AUTOREPORT_128KB                      3
962810e230b6Smaya   bool                                 DisableRegisterAccesses;
962910e230b6Smaya   bool                                 SemaphoreWait;
963010e230b6Smaya   bool                                 RBWait;
963110e230b6Smaya   uint32_t                             BufferLengthinpages1;
963210e230b6Smaya};
963310e230b6Smaya
963496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
963596c5ddc4SrjsGFX8_VCS2_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
963610e230b6Smaya                               __attribute__((unused)) void * restrict dst,
963796c5ddc4Srjs                               __attribute__((unused)) const struct GFX8_VCS2_RING_BUFFER_CTL * restrict values)
963810e230b6Smaya{
963910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
964010e230b6Smaya
964110e230b6Smaya   dw[0] =
964210e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
964310e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
964410e230b6Smaya      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
964510e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
964610e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
964710e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
964810e230b6Smaya}
964910e230b6Smaya
965096c5ddc4Srjs#define GFX8_VCS_ACTHD_UDW_num            0x1205c
965196c5ddc4Srjs#define GFX8_VCS_ACTHD_UDW_length              1
965296c5ddc4Srjsstruct GFX8_VCS_ACTHD_UDW {
965310e230b6Smaya   uint32_t                             HeadPointerUpperDWORD;
965410e230b6Smaya};
965510e230b6Smaya
965696c5ddc4Srjsstatic inline __attribute__((always_inline)) void
965796c5ddc4SrjsGFX8_VCS_ACTHD_UDW_pack(__attribute__((unused)) __gen_user_data *data,
965810e230b6Smaya                        __attribute__((unused)) void * restrict dst,
965996c5ddc4Srjs                        __attribute__((unused)) const struct GFX8_VCS_ACTHD_UDW * restrict values)
966010e230b6Smaya{
966110e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
966210e230b6Smaya
966310e230b6Smaya   dw[0] =
966410e230b6Smaya      __gen_uint(values->HeadPointerUpperDWORD, 0, 15);
966510e230b6Smaya}
966610e230b6Smaya
966796c5ddc4Srjs#define GFX8_VCS_INSTDONE_num             0x1206c
966896c5ddc4Srjs#define GFX8_VCS_INSTDONE_length               1
966996c5ddc4Srjsstruct GFX8_VCS_INSTDONE {
967010e230b6Smaya   bool                                 RingEnable;
967110e230b6Smaya   bool                                 USBDone;
967210e230b6Smaya   bool                                 QRCDone;
967310e230b6Smaya   bool                                 SECDone;
967410e230b6Smaya   bool                                 MPCDone;
967510e230b6Smaya   bool                                 VFTDone;
967610e230b6Smaya   bool                                 BSPDone;
967710e230b6Smaya   bool                                 VLFDone;
967810e230b6Smaya   bool                                 VOPDone;
967910e230b6Smaya   bool                                 VMCDone;
968010e230b6Smaya   bool                                 VIPDone;
968110e230b6Smaya   bool                                 VITDone;
968210e230b6Smaya   bool                                 VDSDone;
968310e230b6Smaya   bool                                 VMXDone;
968410e230b6Smaya   bool                                 VCPDone;
968510e230b6Smaya   bool                                 VCDDone;
968610e230b6Smaya   bool                                 VADDone;
968710e230b6Smaya   bool                                 VMDDone;
968810e230b6Smaya   bool                                 VISDone;
968910e230b6Smaya   bool                                 VACDone;
969010e230b6Smaya   bool                                 VAMDone;
969110e230b6Smaya   bool                                 JPGDone;
969210e230b6Smaya   bool                                 VBPDone;
969310e230b6Smaya   bool                                 VHRDone;
969410e230b6Smaya   bool                                 VCIDone;
969510e230b6Smaya   bool                                 VCRDone;
969610e230b6Smaya   bool                                 VINDone;
969710e230b6Smaya   bool                                 VPRDone;
969810e230b6Smaya   bool                                 VTQDone;
969910e230b6Smaya   bool                                 Reserved;
970010e230b6Smaya   bool                                 VCSDone;
970110e230b6Smaya   bool                                 GACDone;
970210e230b6Smaya};
970310e230b6Smaya
970496c5ddc4Srjsstatic inline __attribute__((always_inline)) void
970596c5ddc4SrjsGFX8_VCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
970610e230b6Smaya                       __attribute__((unused)) void * restrict dst,
970796c5ddc4Srjs                       __attribute__((unused)) const struct GFX8_VCS_INSTDONE * restrict values)
970810e230b6Smaya{
970910e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
971010e230b6Smaya
971110e230b6Smaya   dw[0] =
971210e230b6Smaya      __gen_uint(values->RingEnable, 0, 0) |
971310e230b6Smaya      __gen_uint(values->USBDone, 1, 1) |
971410e230b6Smaya      __gen_uint(values->QRCDone, 2, 2) |
971510e230b6Smaya      __gen_uint(values->SECDone, 3, 3) |
971610e230b6Smaya      __gen_uint(values->MPCDone, 4, 4) |
971710e230b6Smaya      __gen_uint(values->VFTDone, 5, 5) |
971810e230b6Smaya      __gen_uint(values->BSPDone, 6, 6) |
971910e230b6Smaya      __gen_uint(values->VLFDone, 7, 7) |
972010e230b6Smaya      __gen_uint(values->VOPDone, 8, 8) |
972110e230b6Smaya      __gen_uint(values->VMCDone, 9, 9) |
972210e230b6Smaya      __gen_uint(values->VIPDone, 10, 10) |
972310e230b6Smaya      __gen_uint(values->VITDone, 11, 11) |
972410e230b6Smaya      __gen_uint(values->VDSDone, 12, 12) |
972510e230b6Smaya      __gen_uint(values->VMXDone, 13, 13) |
972610e230b6Smaya      __gen_uint(values->VCPDone, 14, 14) |
972710e230b6Smaya      __gen_uint(values->VCDDone, 15, 15) |
972810e230b6Smaya      __gen_uint(values->VADDone, 16, 16) |
972910e230b6Smaya      __gen_uint(values->VMDDone, 17, 17) |
973010e230b6Smaya      __gen_uint(values->VISDone, 18, 18) |
973110e230b6Smaya      __gen_uint(values->VACDone, 19, 19) |
973210e230b6Smaya      __gen_uint(values->VAMDone, 20, 20) |
973310e230b6Smaya      __gen_uint(values->JPGDone, 21, 21) |
973410e230b6Smaya      __gen_uint(values->VBPDone, 22, 22) |
973510e230b6Smaya      __gen_uint(values->VHRDone, 23, 23) |
973610e230b6Smaya      __gen_uint(values->VCIDone, 24, 24) |
973710e230b6Smaya      __gen_uint(values->VCRDone, 25, 25) |
973810e230b6Smaya      __gen_uint(values->VINDone, 26, 26) |
973910e230b6Smaya      __gen_uint(values->VPRDone, 27, 27) |
974010e230b6Smaya      __gen_uint(values->VTQDone, 28, 28) |
974110e230b6Smaya      __gen_uint(values->Reserved, 29, 29) |
974210e230b6Smaya      __gen_uint(values->VCSDone, 30, 30) |
974310e230b6Smaya      __gen_uint(values->GACDone, 31, 31);
974410e230b6Smaya}
974510e230b6Smaya
974696c5ddc4Srjs#define GFX8_VCS_RING_BUFFER_CTL_num      0x1203c
974796c5ddc4Srjs#define GFX8_VCS_RING_BUFFER_CTL_length        1
974896c5ddc4Srjsstruct GFX8_VCS_RING_BUFFER_CTL {
974910e230b6Smaya   bool                                 RingBufferEnable;
975010e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
975110e230b6Smaya#define MI_AUTOREPORT_OFF                        0
975210e230b6Smaya#define MI_AUTOREPORT_64KB                       1
975310e230b6Smaya#define MI_AUTOREPORT_4KB                        2
975410e230b6Smaya#define MI_AUTOREPORT_128KB                      3
975510e230b6Smaya   bool                                 DisableRegisterAccesses;
975610e230b6Smaya   bool                                 SemaphoreWait;
975710e230b6Smaya   bool                                 RBWait;
975810e230b6Smaya   uint32_t                             BufferLengthinpages1;
975910e230b6Smaya};
976010e230b6Smaya
976196c5ddc4Srjsstatic inline __attribute__((always_inline)) void
976296c5ddc4SrjsGFX8_VCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
976310e230b6Smaya                              __attribute__((unused)) void * restrict dst,
976496c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_VCS_RING_BUFFER_CTL * restrict values)
976510e230b6Smaya{
976610e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
976710e230b6Smaya
976810e230b6Smaya   dw[0] =
976910e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
977010e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
977110e230b6Smaya      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
977210e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
977310e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
977410e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
977510e230b6Smaya}
977610e230b6Smaya
977796c5ddc4Srjs#define GFX8_VECS_ACTHD_UDW_num           0x1a05c
977896c5ddc4Srjs#define GFX8_VECS_ACTHD_UDW_length             1
977996c5ddc4Srjsstruct GFX8_VECS_ACTHD_UDW {
978010e230b6Smaya   uint32_t                             HeadPointerUpperDWORD;
978110e230b6Smaya};
978210e230b6Smaya
978396c5ddc4Srjsstatic inline __attribute__((always_inline)) void
978496c5ddc4SrjsGFX8_VECS_ACTHD_UDW_pack(__attribute__((unused)) __gen_user_data *data,
978510e230b6Smaya                         __attribute__((unused)) void * restrict dst,
978696c5ddc4Srjs                         __attribute__((unused)) const struct GFX8_VECS_ACTHD_UDW * restrict values)
978710e230b6Smaya{
978810e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
978910e230b6Smaya
979010e230b6Smaya   dw[0] =
979110e230b6Smaya      __gen_uint(values->HeadPointerUpperDWORD, 0, 15);
979210e230b6Smaya}
979310e230b6Smaya
979496c5ddc4Srjs#define GFX8_VECS_INSTDONE_num            0x1a06c
979596c5ddc4Srjs#define GFX8_VECS_INSTDONE_length              1
979696c5ddc4Srjsstruct GFX8_VECS_INSTDONE {
979710e230b6Smaya   bool                                 RingEnable;
979810e230b6Smaya   bool                                 VECSDone;
979910e230b6Smaya   bool                                 GAMDone;
980010e230b6Smaya};
980110e230b6Smaya
980296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
980396c5ddc4SrjsGFX8_VECS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
980410e230b6Smaya                        __attribute__((unused)) void * restrict dst,
980596c5ddc4Srjs                        __attribute__((unused)) const struct GFX8_VECS_INSTDONE * restrict values)
980610e230b6Smaya{
980710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
980810e230b6Smaya
980910e230b6Smaya   dw[0] =
981010e230b6Smaya      __gen_uint(values->RingEnable, 0, 0) |
981110e230b6Smaya      __gen_uint(values->VECSDone, 30, 30) |
981210e230b6Smaya      __gen_uint(values->GAMDone, 31, 31);
981310e230b6Smaya}
981410e230b6Smaya
981596c5ddc4Srjs#define GFX8_VECS_RING_BUFFER_CTL_num     0x1a03c
981696c5ddc4Srjs#define GFX8_VECS_RING_BUFFER_CTL_length       1
981796c5ddc4Srjsstruct GFX8_VECS_RING_BUFFER_CTL {
981810e230b6Smaya   bool                                 RingBufferEnable;
981910e230b6Smaya   uint32_t                             AutomaticReportHeadPointer;
982010e230b6Smaya#define MI_AUTOREPORT_OFF                        0
982110e230b6Smaya#define MI_AUTOREPORT_64KB                       1
982210e230b6Smaya#define MI_AUTOREPORT_4KB                        2
982310e230b6Smaya#define MI_AUTOREPORT_128KB                      3
982410e230b6Smaya   bool                                 DisableRegisterAccesses;
982510e230b6Smaya   bool                                 SemaphoreWait;
982610e230b6Smaya   bool                                 RBWait;
982710e230b6Smaya   uint32_t                             BufferLengthinpages1;
982810e230b6Smaya};
982910e230b6Smaya
983096c5ddc4Srjsstatic inline __attribute__((always_inline)) void
983196c5ddc4SrjsGFX8_VECS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
983210e230b6Smaya                               __attribute__((unused)) void * restrict dst,
983396c5ddc4Srjs                               __attribute__((unused)) const struct GFX8_VECS_RING_BUFFER_CTL * restrict values)
983410e230b6Smaya{
983510e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
983610e230b6Smaya
983710e230b6Smaya   dw[0] =
983810e230b6Smaya      __gen_uint(values->RingBufferEnable, 0, 0) |
983910e230b6Smaya      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
984010e230b6Smaya      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
984110e230b6Smaya      __gen_uint(values->SemaphoreWait, 10, 10) |
984210e230b6Smaya      __gen_uint(values->RBWait, 11, 11) |
984310e230b6Smaya      __gen_uint(values->BufferLengthinpages1, 12, 20);
984410e230b6Smaya}
984510e230b6Smaya
984696c5ddc4Srjs#define GFX8_VS_INVOCATION_COUNT_num      0x2320
984796c5ddc4Srjs#define GFX8_VS_INVOCATION_COUNT_length        2
984896c5ddc4Srjsstruct GFX8_VS_INVOCATION_COUNT {
984910e230b6Smaya   uint64_t                             VSInvocationCountReport;
985010e230b6Smaya};
985110e230b6Smaya
985296c5ddc4Srjsstatic inline __attribute__((always_inline)) void
985396c5ddc4SrjsGFX8_VS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
985410e230b6Smaya                              __attribute__((unused)) void * restrict dst,
985596c5ddc4Srjs                              __attribute__((unused)) const struct GFX8_VS_INVOCATION_COUNT * restrict values)
985610e230b6Smaya{
985710e230b6Smaya   uint32_t * restrict dw = (uint32_t * restrict) dst;
985810e230b6Smaya
985910e230b6Smaya   const uint64_t v0 =
986010e230b6Smaya      __gen_uint(values->VSInvocationCountReport, 0, 63);
986110e230b6Smaya   dw[0] = v0;
986210e230b6Smaya   dw[1] = v0 >> 32;
986310e230b6Smaya}
986410e230b6Smaya
986596c5ddc4Srjs#endif /* GFX8_PACK_H */
9866