1b8e80941Smrg/*
2b8e80941Smrg * Copyright (C) 2016 Intel Corporation
3b8e80941Smrg *
4b8e80941Smrg * Permission is hereby granted, free of charge, to any person obtaining a
5b8e80941Smrg * copy of this software and associated documentation files (the "Software"),
6b8e80941Smrg * to deal in the Software without restriction, including without limitation
7b8e80941Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8b8e80941Smrg * and/or sell copies of the Software, and to permit persons to whom the
9b8e80941Smrg * Software is furnished to do so, subject to the following conditions:
10b8e80941Smrg *
11b8e80941Smrg * The above copyright notice and this permission notice (including the next
12b8e80941Smrg * paragraph) shall be included in all copies or substantial portions of the
13b8e80941Smrg * Software.
14b8e80941Smrg *
15b8e80941Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16b8e80941Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17b8e80941Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18b8e80941Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19b8e80941Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20b8e80941Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21b8e80941Smrg * IN THE SOFTWARE.
22b8e80941Smrg */
23b8e80941Smrg
24b8e80941Smrg
25b8e80941Smrg/* Instructions, enums and structures for IVB.
26b8e80941Smrg *
27b8e80941Smrg * This file has been generated, do not hand edit.
28b8e80941Smrg */
29b8e80941Smrg
30b8e80941Smrg#ifndef GEN7_PACK_H
31b8e80941Smrg#define GEN7_PACK_H
32b8e80941Smrg
33b8e80941Smrg#include <stdio.h>
34b8e80941Smrg#include <stdint.h>
35b8e80941Smrg#include <stdbool.h>
36b8e80941Smrg#include <assert.h>
37b8e80941Smrg#include <math.h>
38b8e80941Smrg
39b8e80941Smrg#ifndef __gen_validate_value
40b8e80941Smrg#define __gen_validate_value(x)
41b8e80941Smrg#endif
42b8e80941Smrg
43b8e80941Smrg#ifndef __gen_field_functions
44b8e80941Smrg#define __gen_field_functions
45b8e80941Smrg
46b8e80941Smrg#ifdef NDEBUG
47b8e80941Smrg#define NDEBUG_UNUSED __attribute__((unused))
48b8e80941Smrg#else
49b8e80941Smrg#define NDEBUG_UNUSED
50b8e80941Smrg#endif
51b8e80941Smrg
52b8e80941Smrgunion __gen_value {
53b8e80941Smrg   float f;
54b8e80941Smrg   uint32_t dw;
55b8e80941Smrg};
56b8e80941Smrg
57b8e80941Smrgstatic inline uint64_t
58b8e80941Smrg__gen_mbo(uint32_t start, uint32_t end)
59b8e80941Smrg{
60b8e80941Smrg   return (~0ull >> (64 - (end - start + 1))) << start;
61b8e80941Smrg}
62b8e80941Smrg
63b8e80941Smrgstatic inline uint64_t
64b8e80941Smrg__gen_uint(uint64_t v, uint32_t start, NDEBUG_UNUSED uint32_t end)
65b8e80941Smrg{
66b8e80941Smrg   __gen_validate_value(v);
67b8e80941Smrg
68b8e80941Smrg#ifndef NDEBUG
69b8e80941Smrg   const int width = end - start + 1;
70b8e80941Smrg   if (width < 64) {
71b8e80941Smrg      const uint64_t max = (1ull << width) - 1;
72b8e80941Smrg      assert(v <= max);
73b8e80941Smrg   }
74b8e80941Smrg#endif
75b8e80941Smrg
76b8e80941Smrg   return v << start;
77b8e80941Smrg}
78b8e80941Smrg
79b8e80941Smrgstatic inline uint64_t
80b8e80941Smrg__gen_sint(int64_t v, uint32_t start, uint32_t end)
81b8e80941Smrg{
82b8e80941Smrg   const int width = end - start + 1;
83b8e80941Smrg
84b8e80941Smrg   __gen_validate_value(v);
85b8e80941Smrg
86b8e80941Smrg#ifndef NDEBUG
87b8e80941Smrg   if (width < 64) {
88b8e80941Smrg      const int64_t max = (1ll << (width - 1)) - 1;
89b8e80941Smrg      const int64_t min = -(1ll << (width - 1));
90b8e80941Smrg      assert(min <= v && v <= max);
91b8e80941Smrg   }
92b8e80941Smrg#endif
93b8e80941Smrg
94b8e80941Smrg   const uint64_t mask = ~0ull >> (64 - width);
95b8e80941Smrg
96b8e80941Smrg   return (v & mask) << start;
97b8e80941Smrg}
98b8e80941Smrg
99b8e80941Smrgstatic inline uint64_t
100b8e80941Smrg__gen_offset(uint64_t v, NDEBUG_UNUSED uint32_t start, NDEBUG_UNUSED uint32_t end)
101b8e80941Smrg{
102b8e80941Smrg   __gen_validate_value(v);
103b8e80941Smrg#ifndef NDEBUG
104b8e80941Smrg   uint64_t mask = (~0ull >> (64 - (end - start + 1))) << start;
105b8e80941Smrg
106b8e80941Smrg   assert((v & ~mask) == 0);
107b8e80941Smrg#endif
108b8e80941Smrg
109b8e80941Smrg   return v;
110b8e80941Smrg}
111b8e80941Smrg
112b8e80941Smrgstatic inline uint32_t
113b8e80941Smrg__gen_float(float v)
114b8e80941Smrg{
115b8e80941Smrg   __gen_validate_value(v);
116b8e80941Smrg   return ((union __gen_value) { .f = (v) }).dw;
117b8e80941Smrg}
118b8e80941Smrg
119b8e80941Smrgstatic inline uint64_t
120b8e80941Smrg__gen_sfixed(float v, uint32_t start, uint32_t end, uint32_t fract_bits)
121b8e80941Smrg{
122b8e80941Smrg   __gen_validate_value(v);
123b8e80941Smrg
124b8e80941Smrg   const float factor = (1 << fract_bits);
125b8e80941Smrg
126b8e80941Smrg#ifndef NDEBUG
127b8e80941Smrg   const float max = ((1 << (end - start)) - 1) / factor;
128b8e80941Smrg   const float min = -(1 << (end - start)) / factor;
129b8e80941Smrg   assert(min <= v && v <= max);
130b8e80941Smrg#endif
131b8e80941Smrg
132b8e80941Smrg   const int64_t int_val = llroundf(v * factor);
133b8e80941Smrg   const uint64_t mask = ~0ull >> (64 - (end - start + 1));
134b8e80941Smrg
135b8e80941Smrg   return (int_val & mask) << start;
136b8e80941Smrg}
137b8e80941Smrg
138b8e80941Smrgstatic inline uint64_t
139b8e80941Smrg__gen_ufixed(float v, uint32_t start, NDEBUG_UNUSED uint32_t end, uint32_t fract_bits)
140b8e80941Smrg{
141b8e80941Smrg   __gen_validate_value(v);
142b8e80941Smrg
143b8e80941Smrg   const float factor = (1 << fract_bits);
144b8e80941Smrg
145b8e80941Smrg#ifndef NDEBUG
146b8e80941Smrg   const float max = ((1 << (end - start + 1)) - 1) / factor;
147b8e80941Smrg   const float min = 0.0f;
148b8e80941Smrg   assert(min <= v && v <= max);
149b8e80941Smrg#endif
150b8e80941Smrg
151b8e80941Smrg   const uint64_t uint_val = llroundf(v * factor);
152b8e80941Smrg
153b8e80941Smrg   return uint_val << start;
154b8e80941Smrg}
155b8e80941Smrg
156b8e80941Smrg#ifndef __gen_address_type
157b8e80941Smrg#error #define __gen_address_type before including this file
158b8e80941Smrg#endif
159b8e80941Smrg
160b8e80941Smrg#ifndef __gen_user_data
161b8e80941Smrg#error #define __gen_combine_address before including this file
162b8e80941Smrg#endif
163b8e80941Smrg
164b8e80941Smrg#undef NDEBUG_UNUSED
165b8e80941Smrg
166b8e80941Smrg#endif
167b8e80941Smrg
168b8e80941Smrg
169b8e80941Smrgenum GEN7_3D_Color_Buffer_Blend_Factor {
170b8e80941Smrg   BLENDFACTOR_ONE                      =      1,
171b8e80941Smrg   BLENDFACTOR_SRC_COLOR                =      2,
172b8e80941Smrg   BLENDFACTOR_SRC_ALPHA                =      3,
173b8e80941Smrg   BLENDFACTOR_DST_ALPHA                =      4,
174b8e80941Smrg   BLENDFACTOR_DST_COLOR                =      5,
175b8e80941Smrg   BLENDFACTOR_SRC_ALPHA_SATURATE       =      6,
176b8e80941Smrg   BLENDFACTOR_CONST_COLOR              =      7,
177b8e80941Smrg   BLENDFACTOR_CONST_ALPHA              =      8,
178b8e80941Smrg   BLENDFACTOR_SRC1_COLOR               =      9,
179b8e80941Smrg   BLENDFACTOR_SRC1_ALPHA               =     10,
180b8e80941Smrg   BLENDFACTOR_ZERO                     =     17,
181b8e80941Smrg   BLENDFACTOR_INV_SRC_COLOR            =     18,
182b8e80941Smrg   BLENDFACTOR_INV_SRC_ALPHA            =     19,
183b8e80941Smrg   BLENDFACTOR_INV_DST_ALPHA            =     20,
184b8e80941Smrg   BLENDFACTOR_INV_DST_COLOR            =     21,
185b8e80941Smrg   BLENDFACTOR_INV_CONST_COLOR          =     23,
186b8e80941Smrg   BLENDFACTOR_INV_CONST_ALPHA          =     24,
187b8e80941Smrg   BLENDFACTOR_INV_SRC1_COLOR           =     25,
188b8e80941Smrg   BLENDFACTOR_INV_SRC1_ALPHA           =     26,
189b8e80941Smrg};
190b8e80941Smrg
191b8e80941Smrgenum GEN7_3D_Color_Buffer_Blend_Function {
192b8e80941Smrg   BLENDFUNCTION_ADD                    =      0,
193b8e80941Smrg   BLENDFUNCTION_SUBTRACT               =      1,
194b8e80941Smrg   BLENDFUNCTION_REVERSE_SUBTRACT       =      2,
195b8e80941Smrg   BLENDFUNCTION_MIN                    =      3,
196b8e80941Smrg   BLENDFUNCTION_MAX                    =      4,
197b8e80941Smrg};
198b8e80941Smrg
199b8e80941Smrgenum GEN7_3D_Compare_Function {
200b8e80941Smrg   COMPAREFUNCTION_ALWAYS               =      0,
201b8e80941Smrg   COMPAREFUNCTION_NEVER                =      1,
202b8e80941Smrg   COMPAREFUNCTION_LESS                 =      2,
203b8e80941Smrg   COMPAREFUNCTION_EQUAL                =      3,
204b8e80941Smrg   COMPAREFUNCTION_LEQUAL               =      4,
205b8e80941Smrg   COMPAREFUNCTION_GREATER              =      5,
206b8e80941Smrg   COMPAREFUNCTION_NOTEQUAL             =      6,
207b8e80941Smrg   COMPAREFUNCTION_GEQUAL               =      7,
208b8e80941Smrg};
209b8e80941Smrg
210b8e80941Smrgenum GEN7_3D_Logic_Op_Function {
211b8e80941Smrg   LOGICOP_CLEAR                        =      0,
212b8e80941Smrg   LOGICOP_NOR                          =      1,
213b8e80941Smrg   LOGICOP_AND_INVERTED                 =      2,
214b8e80941Smrg   LOGICOP_COPY_INVERTED                =      3,
215b8e80941Smrg   LOGICOP_AND_REVERSE                  =      4,
216b8e80941Smrg   LOGICOP_INVERT                       =      5,
217b8e80941Smrg   LOGICOP_XOR                          =      6,
218b8e80941Smrg   LOGICOP_NAND                         =      7,
219b8e80941Smrg   LOGICOP_AND                          =      8,
220b8e80941Smrg   LOGICOP_EQUIV                        =      9,
221b8e80941Smrg   LOGICOP_NOOP                         =     10,
222b8e80941Smrg   LOGICOP_OR_INVERTED                  =     11,
223b8e80941Smrg   LOGICOP_COPY                         =     12,
224b8e80941Smrg   LOGICOP_OR_REVERSE                   =     13,
225b8e80941Smrg   LOGICOP_OR                           =     14,
226b8e80941Smrg   LOGICOP_SET                          =     15,
227b8e80941Smrg};
228b8e80941Smrg
229b8e80941Smrgenum GEN7_3D_Prim_Topo_Type {
230b8e80941Smrg   _3DPRIM_POINTLIST                    =      1,
231b8e80941Smrg   _3DPRIM_LINELIST                     =      2,
232b8e80941Smrg   _3DPRIM_LINESTRIP                    =      3,
233b8e80941Smrg   _3DPRIM_TRILIST                      =      4,
234b8e80941Smrg   _3DPRIM_TRISTRIP                     =      5,
235b8e80941Smrg   _3DPRIM_TRIFAN                       =      6,
236b8e80941Smrg   _3DPRIM_QUADLIST                     =      7,
237b8e80941Smrg   _3DPRIM_QUADSTRIP                    =      8,
238b8e80941Smrg   _3DPRIM_LINELIST_ADJ                 =      9,
239b8e80941Smrg   _3DPRIM_LINESTRIP_ADJ                =     10,
240b8e80941Smrg   _3DPRIM_TRILIST_ADJ                  =     11,
241b8e80941Smrg   _3DPRIM_TRISTRIP_ADJ                 =     12,
242b8e80941Smrg   _3DPRIM_TRISTRIP_REVERSE             =     13,
243b8e80941Smrg   _3DPRIM_POLYGON                      =     14,
244b8e80941Smrg   _3DPRIM_RECTLIST                     =     15,
245b8e80941Smrg   _3DPRIM_LINELOOP                     =     16,
246b8e80941Smrg   _3DPRIM_POINTLIST_BF                 =     17,
247b8e80941Smrg   _3DPRIM_LINESTRIP_CONT               =     18,
248b8e80941Smrg   _3DPRIM_LINESTRIP_BF                 =     19,
249b8e80941Smrg   _3DPRIM_LINESTRIP_CONT_BF            =     20,
250b8e80941Smrg   _3DPRIM_TRIFAN_NOSTIPPLE             =     22,
251b8e80941Smrg   _3DPRIM_PATCHLIST_1                  =     32,
252b8e80941Smrg   _3DPRIM_PATCHLIST_2                  =     33,
253b8e80941Smrg   _3DPRIM_PATCHLIST_3                  =     34,
254b8e80941Smrg   _3DPRIM_PATCHLIST_4                  =     35,
255b8e80941Smrg   _3DPRIM_PATCHLIST_5                  =     36,
256b8e80941Smrg   _3DPRIM_PATCHLIST_6                  =     37,
257b8e80941Smrg   _3DPRIM_PATCHLIST_7                  =     38,
258b8e80941Smrg   _3DPRIM_PATCHLIST_8                  =     39,
259b8e80941Smrg   _3DPRIM_PATCHLIST_9                  =     40,
260b8e80941Smrg   _3DPRIM_PATCHLIST_10                 =     41,
261b8e80941Smrg   _3DPRIM_PATCHLIST_11                 =     42,
262b8e80941Smrg   _3DPRIM_PATCHLIST_12                 =     43,
263b8e80941Smrg   _3DPRIM_PATCHLIST_13                 =     44,
264b8e80941Smrg   _3DPRIM_PATCHLIST_14                 =     45,
265b8e80941Smrg   _3DPRIM_PATCHLIST_15                 =     46,
266b8e80941Smrg   _3DPRIM_PATCHLIST_16                 =     47,
267b8e80941Smrg   _3DPRIM_PATCHLIST_17                 =     48,
268b8e80941Smrg   _3DPRIM_PATCHLIST_18                 =     49,
269b8e80941Smrg   _3DPRIM_PATCHLIST_19                 =     50,
270b8e80941Smrg   _3DPRIM_PATCHLIST_20                 =     51,
271b8e80941Smrg   _3DPRIM_PATCHLIST_21                 =     52,
272b8e80941Smrg   _3DPRIM_PATCHLIST_22                 =     53,
273b8e80941Smrg   _3DPRIM_PATCHLIST_23                 =     54,
274b8e80941Smrg   _3DPRIM_PATCHLIST_24                 =     55,
275b8e80941Smrg   _3DPRIM_PATCHLIST_25                 =     56,
276b8e80941Smrg   _3DPRIM_PATCHLIST_26                 =     57,
277b8e80941Smrg   _3DPRIM_PATCHLIST_27                 =     58,
278b8e80941Smrg   _3DPRIM_PATCHLIST_28                 =     59,
279b8e80941Smrg   _3DPRIM_PATCHLIST_29                 =     60,
280b8e80941Smrg   _3DPRIM_PATCHLIST_30                 =     61,
281b8e80941Smrg   _3DPRIM_PATCHLIST_31                 =     62,
282b8e80941Smrg   _3DPRIM_PATCHLIST_32                 =     63,
283b8e80941Smrg};
284b8e80941Smrg
285b8e80941Smrgenum GEN7_3D_Stencil_Operation {
286b8e80941Smrg   STENCILOP_KEEP                       =      0,
287b8e80941Smrg   STENCILOP_ZERO                       =      1,
288b8e80941Smrg   STENCILOP_REPLACE                    =      2,
289b8e80941Smrg   STENCILOP_INCRSAT                    =      3,
290b8e80941Smrg   STENCILOP_DECRSAT                    =      4,
291b8e80941Smrg   STENCILOP_INCR                       =      5,
292b8e80941Smrg   STENCILOP_DECR                       =      6,
293b8e80941Smrg   STENCILOP_INVERT                     =      7,
294b8e80941Smrg};
295b8e80941Smrg
296b8e80941Smrgenum GEN7_3D_Vertex_Component_Control {
297b8e80941Smrg   VFCOMP_NOSTORE                       =      0,
298b8e80941Smrg   VFCOMP_STORE_SRC                     =      1,
299b8e80941Smrg   VFCOMP_STORE_0                       =      2,
300b8e80941Smrg   VFCOMP_STORE_1_FP                    =      3,
301b8e80941Smrg   VFCOMP_STORE_1_INT                   =      4,
302b8e80941Smrg   VFCOMP_STORE_VID                     =      5,
303b8e80941Smrg   VFCOMP_STORE_IID                     =      6,
304b8e80941Smrg   VFCOMP_STORE_PID                     =      7,
305b8e80941Smrg};
306b8e80941Smrg
307b8e80941Smrgenum GEN7_TextureCoordinateMode {
308b8e80941Smrg   TCM_WRAP                             =      0,
309b8e80941Smrg   TCM_MIRROR                           =      1,
310b8e80941Smrg   TCM_CLAMP                            =      2,
311b8e80941Smrg   TCM_CUBE                             =      3,
312b8e80941Smrg   TCM_CLAMP_BORDER                     =      4,
313b8e80941Smrg   TCM_MIRROR_ONCE                      =      5,
314b8e80941Smrg};
315b8e80941Smrg
316b8e80941Smrg#define GEN7_3DSTATE_CONSTANT_BODY_length      6
317b8e80941Smrgstruct GEN7_3DSTATE_CONSTANT_BODY {
318b8e80941Smrg   uint32_t                             ReadLength[4];
319b8e80941Smrg   uint32_t                             MOCS;
320b8e80941Smrg   __gen_address_type                   Buffer[4];
321b8e80941Smrg};
322b8e80941Smrg
323b8e80941Smrgstatic inline void
324b8e80941SmrgGEN7_3DSTATE_CONSTANT_BODY_pack(__attribute__((unused)) __gen_user_data *data,
325b8e80941Smrg                                __attribute__((unused)) void * restrict dst,
326b8e80941Smrg                                __attribute__((unused)) const struct GEN7_3DSTATE_CONSTANT_BODY * restrict values)
327b8e80941Smrg{
328b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
329b8e80941Smrg
330b8e80941Smrg   dw[0] =
331b8e80941Smrg      __gen_uint(values->ReadLength[0], 0, 15) |
332b8e80941Smrg      __gen_uint(values->ReadLength[1], 16, 31);
333b8e80941Smrg
334b8e80941Smrg   dw[1] =
335b8e80941Smrg      __gen_uint(values->ReadLength[2], 0, 15) |
336b8e80941Smrg      __gen_uint(values->ReadLength[3], 16, 31);
337b8e80941Smrg
338b8e80941Smrg   const uint32_t v2 =
339b8e80941Smrg      __gen_uint(values->MOCS, 0, 4);
340b8e80941Smrg   dw[2] = __gen_combine_address(data, &dw[2], values->Buffer[0], v2);
341b8e80941Smrg
342b8e80941Smrg   dw[3] = __gen_combine_address(data, &dw[3], values->Buffer[1], 0);
343b8e80941Smrg
344b8e80941Smrg   dw[4] = __gen_combine_address(data, &dw[4], values->Buffer[2], 0);
345b8e80941Smrg
346b8e80941Smrg   dw[5] = __gen_combine_address(data, &dw[5], values->Buffer[3], 0);
347b8e80941Smrg}
348b8e80941Smrg
349b8e80941Smrg#define GEN7_BINDING_TABLE_STATE_length        1
350b8e80941Smrgstruct GEN7_BINDING_TABLE_STATE {
351b8e80941Smrg   uint64_t                             SurfaceStatePointer;
352b8e80941Smrg};
353b8e80941Smrg
354b8e80941Smrgstatic inline void
355b8e80941SmrgGEN7_BINDING_TABLE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
356b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
357b8e80941Smrg                              __attribute__((unused)) const struct GEN7_BINDING_TABLE_STATE * restrict values)
358b8e80941Smrg{
359b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
360b8e80941Smrg
361b8e80941Smrg   dw[0] =
362b8e80941Smrg      __gen_offset(values->SurfaceStatePointer, 5, 31);
363b8e80941Smrg}
364b8e80941Smrg
365b8e80941Smrg#define GEN7_BLEND_STATE_ENTRY_length          2
366b8e80941Smrgstruct GEN7_BLEND_STATE_ENTRY {
367b8e80941Smrg   enum GEN7_3D_Color_Buffer_Blend_Factor DestinationBlendFactor;
368b8e80941Smrg   enum GEN7_3D_Color_Buffer_Blend_Factor SourceBlendFactor;
369b8e80941Smrg   enum GEN7_3D_Color_Buffer_Blend_Function ColorBlendFunction;
370b8e80941Smrg   enum GEN7_3D_Color_Buffer_Blend_Factor DestinationAlphaBlendFactor;
371b8e80941Smrg   enum GEN7_3D_Color_Buffer_Blend_Factor SourceAlphaBlendFactor;
372b8e80941Smrg   enum GEN7_3D_Color_Buffer_Blend_Function AlphaBlendFunction;
373b8e80941Smrg   bool                                 IndependentAlphaBlendEnable;
374b8e80941Smrg   bool                                 ColorBufferBlendEnable;
375b8e80941Smrg   bool                                 PostBlendColorClampEnable;
376b8e80941Smrg   bool                                 PreBlendColorClampEnable;
377b8e80941Smrg   uint32_t                             ColorClampRange;
378b8e80941Smrg#define COLORCLAMP_UNORM                         0
379b8e80941Smrg#define COLORCLAMP_SNORM                         1
380b8e80941Smrg#define COLORCLAMP_RTFORMAT                      2
381b8e80941Smrg   uint32_t                             YDitherOffset;
382b8e80941Smrg   uint32_t                             XDitherOffset;
383b8e80941Smrg   bool                                 ColorDitherEnable;
384b8e80941Smrg   enum GEN7_3D_Compare_Function        AlphaTestFunction;
385b8e80941Smrg   bool                                 AlphaTestEnable;
386b8e80941Smrg   enum GEN7_3D_Logic_Op_Function       LogicOpFunction;
387b8e80941Smrg   bool                                 LogicOpEnable;
388b8e80941Smrg   bool                                 WriteDisableBlue;
389b8e80941Smrg   bool                                 WriteDisableGreen;
390b8e80941Smrg   bool                                 WriteDisableRed;
391b8e80941Smrg   bool                                 WriteDisableAlpha;
392b8e80941Smrg   bool                                 AlphaToCoverageDitherEnable;
393b8e80941Smrg   bool                                 AlphaToOneEnable;
394b8e80941Smrg   bool                                 AlphaToCoverageEnable;
395b8e80941Smrg};
396b8e80941Smrg
397b8e80941Smrgstatic inline void
398b8e80941SmrgGEN7_BLEND_STATE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
399b8e80941Smrg                            __attribute__((unused)) void * restrict dst,
400b8e80941Smrg                            __attribute__((unused)) const struct GEN7_BLEND_STATE_ENTRY * restrict values)
401b8e80941Smrg{
402b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
403b8e80941Smrg
404b8e80941Smrg   dw[0] =
405b8e80941Smrg      __gen_uint(values->DestinationBlendFactor, 0, 4) |
406b8e80941Smrg      __gen_uint(values->SourceBlendFactor, 5, 9) |
407b8e80941Smrg      __gen_uint(values->ColorBlendFunction, 11, 13) |
408b8e80941Smrg      __gen_uint(values->DestinationAlphaBlendFactor, 15, 19) |
409b8e80941Smrg      __gen_uint(values->SourceAlphaBlendFactor, 20, 24) |
410b8e80941Smrg      __gen_uint(values->AlphaBlendFunction, 26, 28) |
411b8e80941Smrg      __gen_uint(values->IndependentAlphaBlendEnable, 30, 30) |
412b8e80941Smrg      __gen_uint(values->ColorBufferBlendEnable, 31, 31);
413b8e80941Smrg
414b8e80941Smrg   dw[1] =
415b8e80941Smrg      __gen_uint(values->PostBlendColorClampEnable, 0, 0) |
416b8e80941Smrg      __gen_uint(values->PreBlendColorClampEnable, 1, 1) |
417b8e80941Smrg      __gen_uint(values->ColorClampRange, 2, 3) |
418b8e80941Smrg      __gen_uint(values->YDitherOffset, 8, 9) |
419b8e80941Smrg      __gen_uint(values->XDitherOffset, 10, 11) |
420b8e80941Smrg      __gen_uint(values->ColorDitherEnable, 12, 12) |
421b8e80941Smrg      __gen_uint(values->AlphaTestFunction, 13, 15) |
422b8e80941Smrg      __gen_uint(values->AlphaTestEnable, 16, 16) |
423b8e80941Smrg      __gen_uint(values->LogicOpFunction, 18, 21) |
424b8e80941Smrg      __gen_uint(values->LogicOpEnable, 22, 22) |
425b8e80941Smrg      __gen_uint(values->WriteDisableBlue, 24, 24) |
426b8e80941Smrg      __gen_uint(values->WriteDisableGreen, 25, 25) |
427b8e80941Smrg      __gen_uint(values->WriteDisableRed, 26, 26) |
428b8e80941Smrg      __gen_uint(values->WriteDisableAlpha, 27, 27) |
429b8e80941Smrg      __gen_uint(values->AlphaToCoverageDitherEnable, 29, 29) |
430b8e80941Smrg      __gen_uint(values->AlphaToOneEnable, 30, 30) |
431b8e80941Smrg      __gen_uint(values->AlphaToCoverageEnable, 31, 31);
432b8e80941Smrg}
433b8e80941Smrg
434b8e80941Smrg#define GEN7_BLEND_STATE_length                0
435b8e80941Smrgstruct GEN7_BLEND_STATE {
436b8e80941Smrg   /* variable length fields follow */
437b8e80941Smrg};
438b8e80941Smrg
439b8e80941Smrgstatic inline void
440b8e80941SmrgGEN7_BLEND_STATE_pack(__attribute__((unused)) __gen_user_data *data,
441b8e80941Smrg                      __attribute__((unused)) void * restrict dst,
442b8e80941Smrg                      __attribute__((unused)) const struct GEN7_BLEND_STATE * restrict values)
443b8e80941Smrg{
444b8e80941Smrg}
445b8e80941Smrg
446b8e80941Smrg#define GEN7_CC_VIEWPORT_length                2
447b8e80941Smrgstruct GEN7_CC_VIEWPORT {
448b8e80941Smrg   float                                MinimumDepth;
449b8e80941Smrg   float                                MaximumDepth;
450b8e80941Smrg};
451b8e80941Smrg
452b8e80941Smrgstatic inline void
453b8e80941SmrgGEN7_CC_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
454b8e80941Smrg                      __attribute__((unused)) void * restrict dst,
455b8e80941Smrg                      __attribute__((unused)) const struct GEN7_CC_VIEWPORT * restrict values)
456b8e80941Smrg{
457b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
458b8e80941Smrg
459b8e80941Smrg   dw[0] =
460b8e80941Smrg      __gen_float(values->MinimumDepth);
461b8e80941Smrg
462b8e80941Smrg   dw[1] =
463b8e80941Smrg      __gen_float(values->MaximumDepth);
464b8e80941Smrg}
465b8e80941Smrg
466b8e80941Smrg#define GEN7_COLOR_CALC_STATE_length           6
467b8e80941Smrgstruct GEN7_COLOR_CALC_STATE {
468b8e80941Smrg   uint32_t                             AlphaTestFormat;
469b8e80941Smrg#define ALPHATEST_UNORM8                         0
470b8e80941Smrg#define ALPHATEST_FLOAT32                        1
471b8e80941Smrg   bool                                 RoundDisableFunctionDisable;
472b8e80941Smrg   uint32_t                             BackfaceStencilReferenceValue;
473b8e80941Smrg   uint32_t                             StencilReferenceValue;
474b8e80941Smrg   uint32_t                             AlphaReferenceValueAsUNORM8;
475b8e80941Smrg   float                                AlphaReferenceValueAsFLOAT32;
476b8e80941Smrg   float                                BlendConstantColorRed;
477b8e80941Smrg   float                                BlendConstantColorGreen;
478b8e80941Smrg   float                                BlendConstantColorBlue;
479b8e80941Smrg   float                                BlendConstantColorAlpha;
480b8e80941Smrg};
481b8e80941Smrg
482b8e80941Smrgstatic inline void
483b8e80941SmrgGEN7_COLOR_CALC_STATE_pack(__attribute__((unused)) __gen_user_data *data,
484b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
485b8e80941Smrg                           __attribute__((unused)) const struct GEN7_COLOR_CALC_STATE * restrict values)
486b8e80941Smrg{
487b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
488b8e80941Smrg
489b8e80941Smrg   dw[0] =
490b8e80941Smrg      __gen_uint(values->AlphaTestFormat, 0, 0) |
491b8e80941Smrg      __gen_uint(values->RoundDisableFunctionDisable, 15, 15) |
492b8e80941Smrg      __gen_uint(values->BackfaceStencilReferenceValue, 16, 23) |
493b8e80941Smrg      __gen_uint(values->StencilReferenceValue, 24, 31);
494b8e80941Smrg
495b8e80941Smrg   dw[1] =
496b8e80941Smrg      __gen_uint(values->AlphaReferenceValueAsUNORM8, 0, 31) |
497b8e80941Smrg      __gen_float(values->AlphaReferenceValueAsFLOAT32);
498b8e80941Smrg
499b8e80941Smrg   dw[2] =
500b8e80941Smrg      __gen_float(values->BlendConstantColorRed);
501b8e80941Smrg
502b8e80941Smrg   dw[3] =
503b8e80941Smrg      __gen_float(values->BlendConstantColorGreen);
504b8e80941Smrg
505b8e80941Smrg   dw[4] =
506b8e80941Smrg      __gen_float(values->BlendConstantColorBlue);
507b8e80941Smrg
508b8e80941Smrg   dw[5] =
509b8e80941Smrg      __gen_float(values->BlendConstantColorAlpha);
510b8e80941Smrg}
511b8e80941Smrg
512b8e80941Smrg#define GEN7_DEPTH_STENCIL_STATE_length        3
513b8e80941Smrgstruct GEN7_DEPTH_STENCIL_STATE {
514b8e80941Smrg   enum GEN7_3D_Stencil_Operation       BackfaceStencilPassDepthPassOp;
515b8e80941Smrg   enum GEN7_3D_Stencil_Operation       BackfaceStencilPassDepthFailOp;
516b8e80941Smrg   enum GEN7_3D_Stencil_Operation       BackfaceStencilFailOp;
517b8e80941Smrg   enum GEN7_3D_Compare_Function        BackfaceStencilTestFunction;
518b8e80941Smrg   bool                                 DoubleSidedStencilEnable;
519b8e80941Smrg   bool                                 StencilBufferWriteEnable;
520b8e80941Smrg   enum GEN7_3D_Stencil_Operation       StencilPassDepthPassOp;
521b8e80941Smrg   enum GEN7_3D_Stencil_Operation       StencilPassDepthFailOp;
522b8e80941Smrg   enum GEN7_3D_Stencil_Operation       StencilFailOp;
523b8e80941Smrg   enum GEN7_3D_Compare_Function        StencilTestFunction;
524b8e80941Smrg   bool                                 StencilTestEnable;
525b8e80941Smrg   uint32_t                             BackfaceStencilWriteMask;
526b8e80941Smrg   uint32_t                             BackfaceStencilTestMask;
527b8e80941Smrg   uint32_t                             StencilWriteMask;
528b8e80941Smrg   uint32_t                             StencilTestMask;
529b8e80941Smrg   bool                                 DepthBufferWriteEnable;
530b8e80941Smrg   enum GEN7_3D_Compare_Function        DepthTestFunction;
531b8e80941Smrg   bool                                 DepthTestEnable;
532b8e80941Smrg};
533b8e80941Smrg
534b8e80941Smrgstatic inline void
535b8e80941SmrgGEN7_DEPTH_STENCIL_STATE_pack(__attribute__((unused)) __gen_user_data *data,
536b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
537b8e80941Smrg                              __attribute__((unused)) const struct GEN7_DEPTH_STENCIL_STATE * restrict values)
538b8e80941Smrg{
539b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
540b8e80941Smrg
541b8e80941Smrg   dw[0] =
542b8e80941Smrg      __gen_uint(values->BackfaceStencilPassDepthPassOp, 3, 5) |
543b8e80941Smrg      __gen_uint(values->BackfaceStencilPassDepthFailOp, 6, 8) |
544b8e80941Smrg      __gen_uint(values->BackfaceStencilFailOp, 9, 11) |
545b8e80941Smrg      __gen_uint(values->BackfaceStencilTestFunction, 12, 14) |
546b8e80941Smrg      __gen_uint(values->DoubleSidedStencilEnable, 15, 15) |
547b8e80941Smrg      __gen_uint(values->StencilBufferWriteEnable, 18, 18) |
548b8e80941Smrg      __gen_uint(values->StencilPassDepthPassOp, 19, 21) |
549b8e80941Smrg      __gen_uint(values->StencilPassDepthFailOp, 22, 24) |
550b8e80941Smrg      __gen_uint(values->StencilFailOp, 25, 27) |
551b8e80941Smrg      __gen_uint(values->StencilTestFunction, 28, 30) |
552b8e80941Smrg      __gen_uint(values->StencilTestEnable, 31, 31);
553b8e80941Smrg
554b8e80941Smrg   dw[1] =
555b8e80941Smrg      __gen_uint(values->BackfaceStencilWriteMask, 0, 7) |
556b8e80941Smrg      __gen_uint(values->BackfaceStencilTestMask, 8, 15) |
557b8e80941Smrg      __gen_uint(values->StencilWriteMask, 16, 23) |
558b8e80941Smrg      __gen_uint(values->StencilTestMask, 24, 31);
559b8e80941Smrg
560b8e80941Smrg   dw[2] =
561b8e80941Smrg      __gen_uint(values->DepthBufferWriteEnable, 26, 26) |
562b8e80941Smrg      __gen_uint(values->DepthTestFunction, 27, 29) |
563b8e80941Smrg      __gen_uint(values->DepthTestEnable, 31, 31);
564b8e80941Smrg}
565b8e80941Smrg
566b8e80941Smrg#define GEN7_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT_length      2
567b8e80941Smrgstruct GEN7_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT {
568b8e80941Smrg   bool                                 MBErrorConcealmentPSliceWeightPredictionDisable;
569b8e80941Smrg   bool                                 MBErrorConcealmentPSliceMotionVectorsOverrideDisable;
570b8e80941Smrg   bool                                 MBErrorConcealmentPSliceReferenceIndexOverrideDisable;
571b8e80941Smrg   bool                                 MBErrorConcealmentBSpatialWeightPredictionDisable;
572b8e80941Smrg   bool                                 MBErrorConcealmentBSpatialMotionVectorsOverrideDisable;
573b8e80941Smrg   bool                                 MBErrorConcealmentBSpatialReferenceIndexOverrideDisable;
574b8e80941Smrg   uint32_t                             MBErrorConcealmentBSpatialPredictionMode;
575b8e80941Smrg   bool                                 MBHeaderErrorHandling;
576b8e80941Smrg   bool                                 EntropyErrorHandling;
577b8e80941Smrg   bool                                 MPRErrorHandling;
578b8e80941Smrg   bool                                 BSDPrematureCompleteErrorHandling;
579b8e80941Smrg   uint32_t                             ConcealmentPictureID;
580b8e80941Smrg   bool                                 MBErrorConcealmentBTemporalWeightPredictionDisable;
581b8e80941Smrg   bool                                 MBErrorConcealmentBTemporalMotionVectorsOverrideEnable;
582b8e80941Smrg   bool                                 MBErrorConcealmentBTemporalReferenceIndexOverrideEnable;
583b8e80941Smrg   uint32_t                             MBErrorConcealmentBTemporalPredictionMode;
584b8e80941Smrg   bool                                 InitCurrentMBNumber;
585b8e80941Smrg   uint32_t                             ConcealmentMethod;
586b8e80941Smrg   uint32_t                             FirstMBBitOffset;
587b8e80941Smrg   bool                                 LastSlice;
588b8e80941Smrg   bool                                 EmulationPreventionBytePresent;
589b8e80941Smrg   bool                                 FixPrevMBSkipped;
590b8e80941Smrg   uint32_t                             FirstMBByteOffsetofSliceDataorSliceHeader;
591b8e80941Smrg};
592b8e80941Smrg
593b8e80941Smrgstatic inline void
594b8e80941SmrgGEN7_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
595b8e80941Smrg                                                         __attribute__((unused)) void * restrict dst,
596b8e80941Smrg                                                         __attribute__((unused)) const struct GEN7_INLINE_DATA_DESCRIPTION_FOR_MFD_AVC_BSD_OBJECT * restrict values)
597b8e80941Smrg{
598b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
599b8e80941Smrg
600b8e80941Smrg   dw[0] =
601b8e80941Smrg      __gen_uint(values->MBErrorConcealmentPSliceWeightPredictionDisable, 0, 0) |
602b8e80941Smrg      __gen_uint(values->MBErrorConcealmentPSliceMotionVectorsOverrideDisable, 1, 1) |
603b8e80941Smrg      __gen_uint(values->MBErrorConcealmentPSliceReferenceIndexOverrideDisable, 2, 2) |
604b8e80941Smrg      __gen_uint(values->MBErrorConcealmentBSpatialWeightPredictionDisable, 3, 3) |
605b8e80941Smrg      __gen_uint(values->MBErrorConcealmentBSpatialMotionVectorsOverrideDisable, 4, 4) |
606b8e80941Smrg      __gen_uint(values->MBErrorConcealmentBSpatialReferenceIndexOverrideDisable, 5, 5) |
607b8e80941Smrg      __gen_uint(values->MBErrorConcealmentBSpatialPredictionMode, 6, 7) |
608b8e80941Smrg      __gen_uint(values->MBHeaderErrorHandling, 8, 8) |
609b8e80941Smrg      __gen_uint(values->EntropyErrorHandling, 10, 10) |
610b8e80941Smrg      __gen_uint(values->MPRErrorHandling, 12, 12) |
611b8e80941Smrg      __gen_uint(values->BSDPrematureCompleteErrorHandling, 14, 14) |
612b8e80941Smrg      __gen_uint(values->ConcealmentPictureID, 16, 21) |
613b8e80941Smrg      __gen_uint(values->MBErrorConcealmentBTemporalWeightPredictionDisable, 24, 24) |
614b8e80941Smrg      __gen_uint(values->MBErrorConcealmentBTemporalMotionVectorsOverrideEnable, 25, 25) |
615b8e80941Smrg      __gen_uint(values->MBErrorConcealmentBTemporalReferenceIndexOverrideEnable, 26, 26) |
616b8e80941Smrg      __gen_uint(values->MBErrorConcealmentBTemporalPredictionMode, 27, 28) |
617b8e80941Smrg      __gen_uint(values->InitCurrentMBNumber, 30, 30) |
618b8e80941Smrg      __gen_uint(values->ConcealmentMethod, 31, 31);
619b8e80941Smrg
620b8e80941Smrg   dw[1] =
621b8e80941Smrg      __gen_uint(values->FirstMBBitOffset, 0, 2) |
622b8e80941Smrg      __gen_uint(values->LastSlice, 3, 3) |
623b8e80941Smrg      __gen_uint(values->EmulationPreventionBytePresent, 4, 4) |
624b8e80941Smrg      __gen_uint(values->FixPrevMBSkipped, 7, 7) |
625b8e80941Smrg      __gen_uint(values->FirstMBByteOffsetofSliceDataorSliceHeader, 16, 31);
626b8e80941Smrg}
627b8e80941Smrg
628b8e80941Smrg#define GEN7_INTERFACE_DESCRIPTOR_DATA_length      8
629b8e80941Smrgstruct GEN7_INTERFACE_DESCRIPTOR_DATA {
630b8e80941Smrg   uint64_t                             KernelStartPointer;
631b8e80941Smrg   bool                                 SoftwareExceptionEnable;
632b8e80941Smrg   bool                                 MaskStackExceptionEnable;
633b8e80941Smrg   bool                                 IllegalOpcodeExceptionEnable;
634b8e80941Smrg   uint32_t                             FloatingPointMode;
635b8e80941Smrg#define IEEE754                                  0
636b8e80941Smrg#define Alternate                                1
637b8e80941Smrg   uint32_t                             ThreadPriority;
638b8e80941Smrg#define NormalPriority                           0
639b8e80941Smrg#define HighPriority                             1
640b8e80941Smrg   bool                                 SingleProgramFlow;
641b8e80941Smrg   uint32_t                             SamplerCount;
642b8e80941Smrg#define Nosamplersused                           0
643b8e80941Smrg#define Between1and4samplersused                 1
644b8e80941Smrg#define Between5and8samplersused                 2
645b8e80941Smrg#define Between9and12samplersused                3
646b8e80941Smrg#define Between13and16samplersused               4
647b8e80941Smrg   uint64_t                             SamplerStatePointer;
648b8e80941Smrg   uint32_t                             BindingTableEntryCount;
649b8e80941Smrg   uint64_t                             BindingTablePointer;
650b8e80941Smrg   uint32_t                             ConstantURBEntryReadOffset;
651b8e80941Smrg   uint32_t                             ConstantURBEntryReadLength;
652b8e80941Smrg   uint32_t                             NumberofThreadsinGPGPUThreadGroup;
653b8e80941Smrg   uint32_t                             SharedLocalMemorySize;
654b8e80941Smrg   bool                                 BarrierEnable;
655b8e80941Smrg   uint32_t                             RoundingMode;
656b8e80941Smrg#define RTNE                                     0
657b8e80941Smrg#define RU                                       1
658b8e80941Smrg#define RD                                       2
659b8e80941Smrg#define RTZ                                      3
660b8e80941Smrg};
661b8e80941Smrg
662b8e80941Smrgstatic inline void
663b8e80941SmrgGEN7_INTERFACE_DESCRIPTOR_DATA_pack(__attribute__((unused)) __gen_user_data *data,
664b8e80941Smrg                                    __attribute__((unused)) void * restrict dst,
665b8e80941Smrg                                    __attribute__((unused)) const struct GEN7_INTERFACE_DESCRIPTOR_DATA * restrict values)
666b8e80941Smrg{
667b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
668b8e80941Smrg
669b8e80941Smrg   dw[0] =
670b8e80941Smrg      __gen_offset(values->KernelStartPointer, 6, 31);
671b8e80941Smrg
672b8e80941Smrg   dw[1] =
673b8e80941Smrg      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
674b8e80941Smrg      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
675b8e80941Smrg      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
676b8e80941Smrg      __gen_uint(values->FloatingPointMode, 16, 16) |
677b8e80941Smrg      __gen_uint(values->ThreadPriority, 17, 17) |
678b8e80941Smrg      __gen_uint(values->SingleProgramFlow, 18, 18);
679b8e80941Smrg
680b8e80941Smrg   dw[2] =
681b8e80941Smrg      __gen_uint(values->SamplerCount, 2, 4) |
682b8e80941Smrg      __gen_offset(values->SamplerStatePointer, 5, 31);
683b8e80941Smrg
684b8e80941Smrg   dw[3] =
685b8e80941Smrg      __gen_uint(values->BindingTableEntryCount, 0, 4) |
686b8e80941Smrg      __gen_offset(values->BindingTablePointer, 5, 15);
687b8e80941Smrg
688b8e80941Smrg   dw[4] =
689b8e80941Smrg      __gen_uint(values->ConstantURBEntryReadOffset, 0, 15) |
690b8e80941Smrg      __gen_uint(values->ConstantURBEntryReadLength, 16, 31);
691b8e80941Smrg
692b8e80941Smrg   dw[5] =
693b8e80941Smrg      __gen_uint(values->NumberofThreadsinGPGPUThreadGroup, 0, 7) |
694b8e80941Smrg      __gen_uint(values->SharedLocalMemorySize, 16, 20) |
695b8e80941Smrg      __gen_uint(values->BarrierEnable, 21, 21) |
696b8e80941Smrg      __gen_uint(values->RoundingMode, 22, 23);
697b8e80941Smrg
698b8e80941Smrg   dw[6] = 0;
699b8e80941Smrg
700b8e80941Smrg   dw[7] = 0;
701b8e80941Smrg}
702b8e80941Smrg
703b8e80941Smrg#define GEN7_MEMORY_OBJECT_CONTROL_STATE_length      1
704b8e80941Smrgstruct GEN7_MEMORY_OBJECT_CONTROL_STATE {
705b8e80941Smrg   uint32_t                             L3CacheabilityControlL3CC;
706b8e80941Smrg   uint32_t                             LLCCacheabilityControlLLCCC;
707b8e80941Smrg   uint32_t                             GraphicsDataTypeGFDT;
708b8e80941Smrg};
709b8e80941Smrg
710b8e80941Smrgstatic inline void
711b8e80941SmrgGEN7_MEMORY_OBJECT_CONTROL_STATE_pack(__attribute__((unused)) __gen_user_data *data,
712b8e80941Smrg                                      __attribute__((unused)) void * restrict dst,
713b8e80941Smrg                                      __attribute__((unused)) const struct GEN7_MEMORY_OBJECT_CONTROL_STATE * restrict values)
714b8e80941Smrg{
715b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
716b8e80941Smrg
717b8e80941Smrg   dw[0] =
718b8e80941Smrg      __gen_uint(values->L3CacheabilityControlL3CC, 0, 0) |
719b8e80941Smrg      __gen_uint(values->LLCCacheabilityControlLLCCC, 1, 1) |
720b8e80941Smrg      __gen_uint(values->GraphicsDataTypeGFDT, 2, 2);
721b8e80941Smrg}
722b8e80941Smrg
723b8e80941Smrg#define GEN7_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION_length      2
724b8e80941Smrgstruct GEN7_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION {
725b8e80941Smrg   uint32_t                             FirstMBBitOffset;
726b8e80941Smrg   bool                                 LastMB;
727b8e80941Smrg   bool                                 LastPicSlice;
728b8e80941Smrg   uint32_t                             MBCount;
729b8e80941Smrg   uint32_t                             SliceVerticalPosition;
730b8e80941Smrg   uint32_t                             SliceHorizontalPosition;
731b8e80941Smrg   uint32_t                             QuantizerScaleCode;
732b8e80941Smrg};
733b8e80941Smrg
734b8e80941Smrgstatic inline void
735b8e80941SmrgGEN7_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION_pack(__attribute__((unused)) __gen_user_data *data,
736b8e80941Smrg                                                       __attribute__((unused)) void * restrict dst,
737b8e80941Smrg                                                       __attribute__((unused)) const struct GEN7_MFD_MPEG2_BSD_OBJECT_INLINE_DATA_DESCRIPTION * restrict values)
738b8e80941Smrg{
739b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
740b8e80941Smrg
741b8e80941Smrg   dw[0] =
742b8e80941Smrg      __gen_uint(values->FirstMBBitOffset, 0, 2) |
743b8e80941Smrg      __gen_uint(values->LastMB, 3, 3) |
744b8e80941Smrg      __gen_uint(values->LastPicSlice, 5, 5) |
745b8e80941Smrg      __gen_uint(values->MBCount, 8, 14) |
746b8e80941Smrg      __gen_uint(values->SliceVerticalPosition, 16, 22) |
747b8e80941Smrg      __gen_uint(values->SliceHorizontalPosition, 24, 30);
748b8e80941Smrg
749b8e80941Smrg   dw[1] =
750b8e80941Smrg      __gen_uint(values->QuantizerScaleCode, 24, 28);
751b8e80941Smrg}
752b8e80941Smrg
753b8e80941Smrg#define GEN7_PALETTE_ENTRY_length              1
754b8e80941Smrgstruct GEN7_PALETTE_ENTRY {
755b8e80941Smrg   uint32_t                             Blue;
756b8e80941Smrg   uint32_t                             Green;
757b8e80941Smrg   uint32_t                             Red;
758b8e80941Smrg   uint32_t                             Alpha;
759b8e80941Smrg};
760b8e80941Smrg
761b8e80941Smrgstatic inline void
762b8e80941SmrgGEN7_PALETTE_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
763b8e80941Smrg                        __attribute__((unused)) void * restrict dst,
764b8e80941Smrg                        __attribute__((unused)) const struct GEN7_PALETTE_ENTRY * restrict values)
765b8e80941Smrg{
766b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
767b8e80941Smrg
768b8e80941Smrg   dw[0] =
769b8e80941Smrg      __gen_uint(values->Blue, 0, 7) |
770b8e80941Smrg      __gen_uint(values->Green, 8, 15) |
771b8e80941Smrg      __gen_uint(values->Red, 16, 23) |
772b8e80941Smrg      __gen_uint(values->Alpha, 24, 31);
773b8e80941Smrg}
774b8e80941Smrg
775b8e80941Smrg#define GEN7_RENDER_SURFACE_STATE_length       8
776b8e80941Smrgstruct GEN7_RENDER_SURFACE_STATE {
777b8e80941Smrg   bool                                 CubeFaceEnablePositiveZ;
778b8e80941Smrg   bool                                 CubeFaceEnableNegativeZ;
779b8e80941Smrg   bool                                 CubeFaceEnablePositiveY;
780b8e80941Smrg   bool                                 CubeFaceEnableNegativeY;
781b8e80941Smrg   bool                                 CubeFaceEnablePositiveX;
782b8e80941Smrg   bool                                 CubeFaceEnableNegativeX;
783b8e80941Smrg   uint32_t                             MediaBoundaryPixelMode;
784b8e80941Smrg#define NORMAL_MODE                              0
785b8e80941Smrg#define PROGRESSIVE_FRAME                        2
786b8e80941Smrg#define INTERLACED_FRAME                         3
787b8e80941Smrg   uint32_t                             RenderCacheReadWriteMode;
788b8e80941Smrg   uint32_t                             SurfaceArraySpacing;
789b8e80941Smrg#define ARYSPC_FULL                              0
790b8e80941Smrg#define ARYSPC_LOD0                              1
791b8e80941Smrg   uint32_t                             VerticalLineStrideOffset;
792b8e80941Smrg   uint32_t                             VerticalLineStride;
793b8e80941Smrg   uint32_t                             TileWalk;
794b8e80941Smrg#define TILEWALK_XMAJOR                          0
795b8e80941Smrg#define TILEWALK_YMAJOR                          1
796b8e80941Smrg   bool                                 TiledSurface;
797b8e80941Smrg   uint32_t                             SurfaceHorizontalAlignment;
798b8e80941Smrg#define HALIGN_4                                 0
799b8e80941Smrg#define HALIGN_8                                 1
800b8e80941Smrg   uint32_t                             SurfaceVerticalAlignment;
801b8e80941Smrg#define VALIGN_2                                 0
802b8e80941Smrg#define VALIGN_4                                 1
803b8e80941Smrg   uint32_t                             SurfaceFormat;
804b8e80941Smrg   bool                                 SurfaceArray;
805b8e80941Smrg   uint32_t                             SurfaceType;
806b8e80941Smrg#define SURFTYPE_1D                              0
807b8e80941Smrg#define SURFTYPE_2D                              1
808b8e80941Smrg#define SURFTYPE_3D                              2
809b8e80941Smrg#define SURFTYPE_CUBE                            3
810b8e80941Smrg#define SURFTYPE_BUFFER                          4
811b8e80941Smrg#define SURFTYPE_STRBUF                          5
812b8e80941Smrg#define SURFTYPE_NULL                            7
813b8e80941Smrg   __gen_address_type                   SurfaceBaseAddress;
814b8e80941Smrg   uint32_t                             Width;
815b8e80941Smrg   uint32_t                             Height;
816b8e80941Smrg   uint32_t                             SurfacePitch;
817b8e80941Smrg   uint32_t                             Depth;
818b8e80941Smrg   uint32_t                             MultisamplePositionPaletteIndex;
819b8e80941Smrg   uint32_t                             StrbufMinimumArrayElement;
820b8e80941Smrg   uint32_t                             NumberofMultisamples;
821b8e80941Smrg#define MULTISAMPLECOUNT_1                       0
822b8e80941Smrg#define MULTISAMPLECOUNT_4                       2
823b8e80941Smrg#define MULTISAMPLECOUNT_8                       3
824b8e80941Smrg   uint32_t                             MultisampledSurfaceStorageFormat;
825b8e80941Smrg#define MSFMT_MSS                                0
826b8e80941Smrg#define MSFMT_DEPTH_STENCIL                      1
827b8e80941Smrg   uint32_t                             RenderTargetViewExtent;
828b8e80941Smrg   uint32_t                             MinimumArrayElement;
829b8e80941Smrg   uint32_t                             RenderTargetRotation;
830b8e80941Smrg#define RTROTATE_0DEG                            0
831b8e80941Smrg#define RTROTATE_90DEG                           1
832b8e80941Smrg#define RTROTATE_270DEG                          3
833b8e80941Smrg   uint32_t                             MIPCountLOD;
834b8e80941Smrg   uint32_t                             SurfaceMinLOD;
835b8e80941Smrg   uint32_t                             MOCS;
836b8e80941Smrg   uint32_t                             YOffset;
837b8e80941Smrg   uint32_t                             XOffset;
838b8e80941Smrg   bool                                 MCSEnable;
839b8e80941Smrg   uint32_t                             YOffsetforUVPlane;
840b8e80941Smrg   bool                                 AppendCounterEnable;
841b8e80941Smrg   uint32_t                             AuxiliarySurfacePitch;
842b8e80941Smrg   __gen_address_type                   AppendCounterAddress;
843b8e80941Smrg   __gen_address_type                   AuxiliarySurfaceBaseAddress;
844b8e80941Smrg   uint32_t                             XOffsetforUVPlane;
845b8e80941Smrg   uint32_t                             ReservedMBZ;
846b8e80941Smrg   float                                ResourceMinLOD;
847b8e80941Smrg   uint32_t                             AlphaClearColor;
848b8e80941Smrg#define CC_ZERO                                  0
849b8e80941Smrg#define CC_ONE                                   1
850b8e80941Smrg   uint32_t                             BlueClearColor;
851b8e80941Smrg#define CC_ZERO                                  0
852b8e80941Smrg#define CC_ONE                                   1
853b8e80941Smrg   uint32_t                             GreenClearColor;
854b8e80941Smrg#define CC_ZERO                                  0
855b8e80941Smrg#define CC_ONE                                   1
856b8e80941Smrg   uint32_t                             RedClearColor;
857b8e80941Smrg#define CC_ZERO                                  0
858b8e80941Smrg#define CC_ONE                                   1
859b8e80941Smrg};
860b8e80941Smrg
861b8e80941Smrgstatic inline void
862b8e80941SmrgGEN7_RENDER_SURFACE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
863b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
864b8e80941Smrg                               __attribute__((unused)) const struct GEN7_RENDER_SURFACE_STATE * restrict values)
865b8e80941Smrg{
866b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
867b8e80941Smrg
868b8e80941Smrg   dw[0] =
869b8e80941Smrg      __gen_uint(values->CubeFaceEnablePositiveZ, 0, 0) |
870b8e80941Smrg      __gen_uint(values->CubeFaceEnableNegativeZ, 1, 1) |
871b8e80941Smrg      __gen_uint(values->CubeFaceEnablePositiveY, 2, 2) |
872b8e80941Smrg      __gen_uint(values->CubeFaceEnableNegativeY, 3, 3) |
873b8e80941Smrg      __gen_uint(values->CubeFaceEnablePositiveX, 4, 4) |
874b8e80941Smrg      __gen_uint(values->CubeFaceEnableNegativeX, 5, 5) |
875b8e80941Smrg      __gen_uint(values->MediaBoundaryPixelMode, 6, 7) |
876b8e80941Smrg      __gen_uint(values->RenderCacheReadWriteMode, 8, 8) |
877b8e80941Smrg      __gen_uint(values->SurfaceArraySpacing, 10, 10) |
878b8e80941Smrg      __gen_uint(values->VerticalLineStrideOffset, 11, 11) |
879b8e80941Smrg      __gen_uint(values->VerticalLineStride, 12, 12) |
880b8e80941Smrg      __gen_uint(values->TileWalk, 13, 13) |
881b8e80941Smrg      __gen_uint(values->TiledSurface, 14, 14) |
882b8e80941Smrg      __gen_uint(values->SurfaceHorizontalAlignment, 15, 15) |
883b8e80941Smrg      __gen_uint(values->SurfaceVerticalAlignment, 16, 17) |
884b8e80941Smrg      __gen_uint(values->SurfaceFormat, 18, 26) |
885b8e80941Smrg      __gen_uint(values->SurfaceArray, 28, 28) |
886b8e80941Smrg      __gen_uint(values->SurfaceType, 29, 31);
887b8e80941Smrg
888b8e80941Smrg   dw[1] = __gen_combine_address(data, &dw[1], values->SurfaceBaseAddress, 0);
889b8e80941Smrg
890b8e80941Smrg   dw[2] =
891b8e80941Smrg      __gen_uint(values->Width, 0, 13) |
892b8e80941Smrg      __gen_uint(values->Height, 16, 29);
893b8e80941Smrg
894b8e80941Smrg   dw[3] =
895b8e80941Smrg      __gen_uint(values->SurfacePitch, 0, 17) |
896b8e80941Smrg      __gen_uint(values->Depth, 21, 31);
897b8e80941Smrg
898b8e80941Smrg   dw[4] =
899b8e80941Smrg      __gen_uint(values->MultisamplePositionPaletteIndex, 0, 2) |
900b8e80941Smrg      __gen_uint(values->StrbufMinimumArrayElement, 0, 26) |
901b8e80941Smrg      __gen_uint(values->NumberofMultisamples, 3, 5) |
902b8e80941Smrg      __gen_uint(values->MultisampledSurfaceStorageFormat, 6, 6) |
903b8e80941Smrg      __gen_uint(values->RenderTargetViewExtent, 7, 17) |
904b8e80941Smrg      __gen_uint(values->MinimumArrayElement, 18, 28) |
905b8e80941Smrg      __gen_uint(values->RenderTargetRotation, 29, 30);
906b8e80941Smrg
907b8e80941Smrg   dw[5] =
908b8e80941Smrg      __gen_uint(values->MIPCountLOD, 0, 3) |
909b8e80941Smrg      __gen_uint(values->SurfaceMinLOD, 4, 7) |
910b8e80941Smrg      __gen_uint(values->MOCS, 16, 19) |
911b8e80941Smrg      __gen_uint(values->YOffset, 20, 23) |
912b8e80941Smrg      __gen_uint(values->XOffset, 25, 31);
913b8e80941Smrg
914b8e80941Smrg   const uint32_t v6 =
915b8e80941Smrg      __gen_uint(values->MCSEnable, 0, 0) |
916b8e80941Smrg      __gen_uint(values->YOffsetforUVPlane, 0, 13) |
917b8e80941Smrg      __gen_uint(values->AppendCounterEnable, 1, 1) |
918b8e80941Smrg      __gen_uint(values->AuxiliarySurfacePitch, 3, 11) |
919b8e80941Smrg      __gen_uint(values->XOffsetforUVPlane, 16, 29) |
920b8e80941Smrg      __gen_uint(values->ReservedMBZ, 30, 31);
921b8e80941Smrg   dw[6] = __gen_combine_address(data, &dw[6], values->AuxiliarySurfaceBaseAddress, v6);
922b8e80941Smrg
923b8e80941Smrg   dw[7] =
924b8e80941Smrg      __gen_ufixed(values->ResourceMinLOD, 0, 11, 8) |
925b8e80941Smrg      __gen_uint(values->AlphaClearColor, 28, 28) |
926b8e80941Smrg      __gen_uint(values->BlueClearColor, 29, 29) |
927b8e80941Smrg      __gen_uint(values->GreenClearColor, 30, 30) |
928b8e80941Smrg      __gen_uint(values->RedClearColor, 31, 31);
929b8e80941Smrg}
930b8e80941Smrg
931b8e80941Smrg#define GEN7_SAMPLER_BORDER_COLOR_STATE_length      4
932b8e80941Smrgstruct GEN7_SAMPLER_BORDER_COLOR_STATE {
933b8e80941Smrg   uint32_t                             BorderColorUnormRed;
934b8e80941Smrg   float                                BorderColorFloatRed;
935b8e80941Smrg   uint32_t                             BorderColorUnormGreen;
936b8e80941Smrg   uint32_t                             BorderColorUnormBlue;
937b8e80941Smrg   uint32_t                             BorderColorUnormAlpha;
938b8e80941Smrg   float                                BorderColorFloatGreen;
939b8e80941Smrg   float                                BorderColorFloatBlue;
940b8e80941Smrg   float                                BorderColorFloatAlpha;
941b8e80941Smrg};
942b8e80941Smrg
943b8e80941Smrgstatic inline void
944b8e80941SmrgGEN7_SAMPLER_BORDER_COLOR_STATE_pack(__attribute__((unused)) __gen_user_data *data,
945b8e80941Smrg                                     __attribute__((unused)) void * restrict dst,
946b8e80941Smrg                                     __attribute__((unused)) const struct GEN7_SAMPLER_BORDER_COLOR_STATE * restrict values)
947b8e80941Smrg{
948b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
949b8e80941Smrg
950b8e80941Smrg   dw[0] =
951b8e80941Smrg      __gen_uint(values->BorderColorUnormRed, 0, 7) |
952b8e80941Smrg      __gen_float(values->BorderColorFloatRed) |
953b8e80941Smrg      __gen_uint(values->BorderColorUnormGreen, 8, 15) |
954b8e80941Smrg      __gen_uint(values->BorderColorUnormBlue, 16, 23) |
955b8e80941Smrg      __gen_uint(values->BorderColorUnormAlpha, 24, 31);
956b8e80941Smrg
957b8e80941Smrg   dw[1] =
958b8e80941Smrg      __gen_float(values->BorderColorFloatGreen);
959b8e80941Smrg
960b8e80941Smrg   dw[2] =
961b8e80941Smrg      __gen_float(values->BorderColorFloatBlue);
962b8e80941Smrg
963b8e80941Smrg   dw[3] =
964b8e80941Smrg      __gen_float(values->BorderColorFloatAlpha);
965b8e80941Smrg}
966b8e80941Smrg
967b8e80941Smrg#define GEN7_SAMPLER_STATE_length              4
968b8e80941Smrgstruct GEN7_SAMPLER_STATE {
969b8e80941Smrg   uint32_t                             AnisotropicAlgorithm;
970b8e80941Smrg#define LEGACY                                   0
971b8e80941Smrg#define EWAApproximation                         1
972b8e80941Smrg   float                                TextureLODBias;
973b8e80941Smrg   uint32_t                             MinModeFilter;
974b8e80941Smrg#define MAPFILTER_NEAREST                        0
975b8e80941Smrg#define MAPFILTER_LINEAR                         1
976b8e80941Smrg#define MAPFILTER_ANISOTROPIC                    2
977b8e80941Smrg#define MAPFILTER_MONO                           6
978b8e80941Smrg   uint32_t                             MagModeFilter;
979b8e80941Smrg#define MAPFILTER_NEAREST                        0
980b8e80941Smrg#define MAPFILTER_LINEAR                         1
981b8e80941Smrg#define MAPFILTER_ANISOTROPIC                    2
982b8e80941Smrg#define MAPFILTER_MONO                           6
983b8e80941Smrg   uint32_t                             MipModeFilter;
984b8e80941Smrg#define MIPFILTER_NONE                           0
985b8e80941Smrg#define MIPFILTER_NEAREST                        1
986b8e80941Smrg#define MIPFILTER_LINEAR                         3
987b8e80941Smrg   float                                BaseMipLevel;
988b8e80941Smrg   uint32_t                             LODPreClampEnable;
989b8e80941Smrg#define CLAMP_ENABLE_OGL                         1
990b8e80941Smrg   uint32_t                             TextureBorderColorMode;
991b8e80941Smrg#define DX10OGL                                  0
992b8e80941Smrg#define DX9                                      1
993b8e80941Smrg   bool                                 SamplerDisable;
994b8e80941Smrg   uint32_t                             CubeSurfaceControlMode;
995b8e80941Smrg#define PROGRAMMED                               0
996b8e80941Smrg#define OVERRIDE                                 1
997b8e80941Smrg   uint32_t                             ShadowFunction;
998b8e80941Smrg#define PREFILTEROPALWAYS                        0
999b8e80941Smrg#define PREFILTEROPNEVER                         1
1000b8e80941Smrg#define PREFILTEROPLESS                          2
1001b8e80941Smrg#define PREFILTEROPEQUAL                         3
1002b8e80941Smrg#define PREFILTEROPLEQUAL                        4
1003b8e80941Smrg#define PREFILTEROPGREATER                       5
1004b8e80941Smrg#define PREFILTEROPNOTEQUAL                      6
1005b8e80941Smrg#define PREFILTEROPGEQUAL                        7
1006b8e80941Smrg   float                                MaxLOD;
1007b8e80941Smrg   float                                MinLOD;
1008b8e80941Smrg   uint64_t                             BorderColorPointer;
1009b8e80941Smrg   enum GEN7_TextureCoordinateMode      TCZAddressControlMode;
1010b8e80941Smrg   enum GEN7_TextureCoordinateMode      TCYAddressControlMode;
1011b8e80941Smrg   enum GEN7_TextureCoordinateMode      TCXAddressControlMode;
1012b8e80941Smrg   bool                                 NonnormalizedCoordinateEnable;
1013b8e80941Smrg   uint32_t                             TrilinearFilterQuality;
1014b8e80941Smrg#define FULL                                     0
1015b8e80941Smrg#define MED                                      2
1016b8e80941Smrg#define LOW                                      3
1017b8e80941Smrg   bool                                 RAddressMinFilterRoundingEnable;
1018b8e80941Smrg   bool                                 RAddressMagFilterRoundingEnable;
1019b8e80941Smrg   bool                                 VAddressMinFilterRoundingEnable;
1020b8e80941Smrg   bool                                 VAddressMagFilterRoundingEnable;
1021b8e80941Smrg   bool                                 UAddressMinFilterRoundingEnable;
1022b8e80941Smrg   bool                                 UAddressMagFilterRoundingEnable;
1023b8e80941Smrg   uint32_t                             MaximumAnisotropy;
1024b8e80941Smrg#define RATIO21                                  0
1025b8e80941Smrg#define RATIO41                                  1
1026b8e80941Smrg#define RATIO61                                  2
1027b8e80941Smrg#define RATIO81                                  3
1028b8e80941Smrg#define RATIO101                                 4
1029b8e80941Smrg#define RATIO121                                 5
1030b8e80941Smrg#define RATIO141                                 6
1031b8e80941Smrg#define RATIO161                                 7
1032b8e80941Smrg   uint32_t                             ChromaKeyMode;
1033b8e80941Smrg#define KEYFILTER_KILL_ON_ANY_MATCH              0
1034b8e80941Smrg#define KEYFILTER_REPLACE_BLACK                  1
1035b8e80941Smrg   uint32_t                             ChromaKeyIndex;
1036b8e80941Smrg   bool                                 ChromaKeyEnable;
1037b8e80941Smrg};
1038b8e80941Smrg
1039b8e80941Smrgstatic inline void
1040b8e80941SmrgGEN7_SAMPLER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
1041b8e80941Smrg                        __attribute__((unused)) void * restrict dst,
1042b8e80941Smrg                        __attribute__((unused)) const struct GEN7_SAMPLER_STATE * restrict values)
1043b8e80941Smrg{
1044b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1045b8e80941Smrg
1046b8e80941Smrg   dw[0] =
1047b8e80941Smrg      __gen_uint(values->AnisotropicAlgorithm, 0, 0) |
1048b8e80941Smrg      __gen_sfixed(values->TextureLODBias, 1, 13, 8) |
1049b8e80941Smrg      __gen_uint(values->MinModeFilter, 14, 16) |
1050b8e80941Smrg      __gen_uint(values->MagModeFilter, 17, 19) |
1051b8e80941Smrg      __gen_uint(values->MipModeFilter, 20, 21) |
1052b8e80941Smrg      __gen_ufixed(values->BaseMipLevel, 22, 26, 1) |
1053b8e80941Smrg      __gen_uint(values->LODPreClampEnable, 28, 28) |
1054b8e80941Smrg      __gen_uint(values->TextureBorderColorMode, 29, 29) |
1055b8e80941Smrg      __gen_uint(values->SamplerDisable, 31, 31);
1056b8e80941Smrg
1057b8e80941Smrg   dw[1] =
1058b8e80941Smrg      __gen_uint(values->CubeSurfaceControlMode, 0, 0) |
1059b8e80941Smrg      __gen_uint(values->ShadowFunction, 1, 3) |
1060b8e80941Smrg      __gen_ufixed(values->MaxLOD, 8, 19, 8) |
1061b8e80941Smrg      __gen_ufixed(values->MinLOD, 20, 31, 8);
1062b8e80941Smrg
1063b8e80941Smrg   dw[2] =
1064b8e80941Smrg      __gen_offset(values->BorderColorPointer, 5, 31);
1065b8e80941Smrg
1066b8e80941Smrg   dw[3] =
1067b8e80941Smrg      __gen_uint(values->TCZAddressControlMode, 0, 2) |
1068b8e80941Smrg      __gen_uint(values->TCYAddressControlMode, 3, 5) |
1069b8e80941Smrg      __gen_uint(values->TCXAddressControlMode, 6, 8) |
1070b8e80941Smrg      __gen_uint(values->NonnormalizedCoordinateEnable, 10, 10) |
1071b8e80941Smrg      __gen_uint(values->TrilinearFilterQuality, 11, 12) |
1072b8e80941Smrg      __gen_uint(values->RAddressMinFilterRoundingEnable, 13, 13) |
1073b8e80941Smrg      __gen_uint(values->RAddressMagFilterRoundingEnable, 14, 14) |
1074b8e80941Smrg      __gen_uint(values->VAddressMinFilterRoundingEnable, 15, 15) |
1075b8e80941Smrg      __gen_uint(values->VAddressMagFilterRoundingEnable, 16, 16) |
1076b8e80941Smrg      __gen_uint(values->UAddressMinFilterRoundingEnable, 17, 17) |
1077b8e80941Smrg      __gen_uint(values->UAddressMagFilterRoundingEnable, 18, 18) |
1078b8e80941Smrg      __gen_uint(values->MaximumAnisotropy, 19, 21) |
1079b8e80941Smrg      __gen_uint(values->ChromaKeyMode, 22, 22) |
1080b8e80941Smrg      __gen_uint(values->ChromaKeyIndex, 23, 24) |
1081b8e80941Smrg      __gen_uint(values->ChromaKeyEnable, 25, 25);
1082b8e80941Smrg}
1083b8e80941Smrg
1084b8e80941Smrg#define GEN7_SCISSOR_RECT_length               2
1085b8e80941Smrgstruct GEN7_SCISSOR_RECT {
1086b8e80941Smrg   uint32_t                             ScissorRectangleXMin;
1087b8e80941Smrg   uint32_t                             ScissorRectangleYMin;
1088b8e80941Smrg   uint32_t                             ScissorRectangleXMax;
1089b8e80941Smrg   uint32_t                             ScissorRectangleYMax;
1090b8e80941Smrg};
1091b8e80941Smrg
1092b8e80941Smrgstatic inline void
1093b8e80941SmrgGEN7_SCISSOR_RECT_pack(__attribute__((unused)) __gen_user_data *data,
1094b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
1095b8e80941Smrg                       __attribute__((unused)) const struct GEN7_SCISSOR_RECT * restrict values)
1096b8e80941Smrg{
1097b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1098b8e80941Smrg
1099b8e80941Smrg   dw[0] =
1100b8e80941Smrg      __gen_uint(values->ScissorRectangleXMin, 0, 15) |
1101b8e80941Smrg      __gen_uint(values->ScissorRectangleYMin, 16, 31);
1102b8e80941Smrg
1103b8e80941Smrg   dw[1] =
1104b8e80941Smrg      __gen_uint(values->ScissorRectangleXMax, 0, 15) |
1105b8e80941Smrg      __gen_uint(values->ScissorRectangleYMax, 16, 31);
1106b8e80941Smrg}
1107b8e80941Smrg
1108b8e80941Smrg#define GEN7_SF_CLIP_VIEWPORT_length          16
1109b8e80941Smrgstruct GEN7_SF_CLIP_VIEWPORT {
1110b8e80941Smrg   float                                ViewportMatrixElementm00;
1111b8e80941Smrg   float                                ViewportMatrixElementm11;
1112b8e80941Smrg   float                                ViewportMatrixElementm22;
1113b8e80941Smrg   float                                ViewportMatrixElementm30;
1114b8e80941Smrg   float                                ViewportMatrixElementm31;
1115b8e80941Smrg   float                                ViewportMatrixElementm32;
1116b8e80941Smrg   float                                XMinClipGuardband;
1117b8e80941Smrg   float                                XMaxClipGuardband;
1118b8e80941Smrg   float                                YMinClipGuardband;
1119b8e80941Smrg   float                                YMaxClipGuardband;
1120b8e80941Smrg};
1121b8e80941Smrg
1122b8e80941Smrgstatic inline void
1123b8e80941SmrgGEN7_SF_CLIP_VIEWPORT_pack(__attribute__((unused)) __gen_user_data *data,
1124b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
1125b8e80941Smrg                           __attribute__((unused)) const struct GEN7_SF_CLIP_VIEWPORT * restrict values)
1126b8e80941Smrg{
1127b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1128b8e80941Smrg
1129b8e80941Smrg   dw[0] =
1130b8e80941Smrg      __gen_float(values->ViewportMatrixElementm00);
1131b8e80941Smrg
1132b8e80941Smrg   dw[1] =
1133b8e80941Smrg      __gen_float(values->ViewportMatrixElementm11);
1134b8e80941Smrg
1135b8e80941Smrg   dw[2] =
1136b8e80941Smrg      __gen_float(values->ViewportMatrixElementm22);
1137b8e80941Smrg
1138b8e80941Smrg   dw[3] =
1139b8e80941Smrg      __gen_float(values->ViewportMatrixElementm30);
1140b8e80941Smrg
1141b8e80941Smrg   dw[4] =
1142b8e80941Smrg      __gen_float(values->ViewportMatrixElementm31);
1143b8e80941Smrg
1144b8e80941Smrg   dw[5] =
1145b8e80941Smrg      __gen_float(values->ViewportMatrixElementm32);
1146b8e80941Smrg
1147b8e80941Smrg   dw[6] = 0;
1148b8e80941Smrg
1149b8e80941Smrg   dw[7] = 0;
1150b8e80941Smrg
1151b8e80941Smrg   dw[8] =
1152b8e80941Smrg      __gen_float(values->XMinClipGuardband);
1153b8e80941Smrg
1154b8e80941Smrg   dw[9] =
1155b8e80941Smrg      __gen_float(values->XMaxClipGuardband);
1156b8e80941Smrg
1157b8e80941Smrg   dw[10] =
1158b8e80941Smrg      __gen_float(values->YMinClipGuardband);
1159b8e80941Smrg
1160b8e80941Smrg   dw[11] =
1161b8e80941Smrg      __gen_float(values->YMaxClipGuardband);
1162b8e80941Smrg
1163b8e80941Smrg   dw[12] = 0;
1164b8e80941Smrg
1165b8e80941Smrg   dw[13] = 0;
1166b8e80941Smrg
1167b8e80941Smrg   dw[14] = 0;
1168b8e80941Smrg
1169b8e80941Smrg   dw[15] = 0;
1170b8e80941Smrg}
1171b8e80941Smrg
1172b8e80941Smrg#define GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_length      1
1173b8e80941Smrgstruct GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL {
1174b8e80941Smrg   uint32_t                             SourceAttribute;
1175b8e80941Smrg   uint32_t                             SwizzleSelect;
1176b8e80941Smrg#define INPUTATTR                                0
1177b8e80941Smrg#define INPUTATTR_FACING                         1
1178b8e80941Smrg#define INPUTATTR_W                              2
1179b8e80941Smrg#define INPUTATTR_FACING_W                       3
1180b8e80941Smrg   uint32_t                             ConstantSource;
1181b8e80941Smrg#define CONST_0000                               0
1182b8e80941Smrg#define CONST_0001_FLOAT                         1
1183b8e80941Smrg#define CONST_1111_FLOAT                         2
1184b8e80941Smrg#define PRIM_ID                                  3
1185b8e80941Smrg   uint32_t                             SwizzleControlMode;
1186b8e80941Smrg   bool                                 ComponentOverrideX;
1187b8e80941Smrg   bool                                 ComponentOverrideY;
1188b8e80941Smrg   bool                                 ComponentOverrideZ;
1189b8e80941Smrg   bool                                 ComponentOverrideW;
1190b8e80941Smrg};
1191b8e80941Smrg
1192b8e80941Smrgstatic inline void
1193b8e80941SmrgGEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(__attribute__((unused)) __gen_user_data *data,
1194b8e80941Smrg                                     __attribute__((unused)) void * restrict dst,
1195b8e80941Smrg                                     __attribute__((unused)) const struct GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL * restrict values)
1196b8e80941Smrg{
1197b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1198b8e80941Smrg
1199b8e80941Smrg   dw[0] =
1200b8e80941Smrg      __gen_uint(values->SourceAttribute, 0, 4) |
1201b8e80941Smrg      __gen_uint(values->SwizzleSelect, 6, 7) |
1202b8e80941Smrg      __gen_uint(values->ConstantSource, 9, 10) |
1203b8e80941Smrg      __gen_uint(values->SwizzleControlMode, 11, 11) |
1204b8e80941Smrg      __gen_uint(values->ComponentOverrideX, 12, 12) |
1205b8e80941Smrg      __gen_uint(values->ComponentOverrideY, 13, 13) |
1206b8e80941Smrg      __gen_uint(values->ComponentOverrideZ, 14, 14) |
1207b8e80941Smrg      __gen_uint(values->ComponentOverrideW, 15, 15);
1208b8e80941Smrg}
1209b8e80941Smrg
1210b8e80941Smrg#define GEN7_SO_DECL_length                    1
1211b8e80941Smrgstruct GEN7_SO_DECL {
1212b8e80941Smrg   uint32_t                             ComponentMask;
1213b8e80941Smrg   uint32_t                             RegisterIndex;
1214b8e80941Smrg   uint32_t                             HoleFlag;
1215b8e80941Smrg   uint32_t                             OutputBufferSlot;
1216b8e80941Smrg};
1217b8e80941Smrg
1218b8e80941Smrgstatic inline void
1219b8e80941SmrgGEN7_SO_DECL_pack(__attribute__((unused)) __gen_user_data *data,
1220b8e80941Smrg                  __attribute__((unused)) void * restrict dst,
1221b8e80941Smrg                  __attribute__((unused)) const struct GEN7_SO_DECL * restrict values)
1222b8e80941Smrg{
1223b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1224b8e80941Smrg
1225b8e80941Smrg   dw[0] =
1226b8e80941Smrg      __gen_uint(values->ComponentMask, 0, 3) |
1227b8e80941Smrg      __gen_uint(values->RegisterIndex, 4, 9) |
1228b8e80941Smrg      __gen_uint(values->HoleFlag, 11, 11) |
1229b8e80941Smrg      __gen_uint(values->OutputBufferSlot, 12, 13);
1230b8e80941Smrg}
1231b8e80941Smrg
1232b8e80941Smrg#define GEN7_SO_DECL_ENTRY_length              2
1233b8e80941Smrgstruct GEN7_SO_DECL_ENTRY {
1234b8e80941Smrg   struct GEN7_SO_DECL                  Stream0Decl;
1235b8e80941Smrg   struct GEN7_SO_DECL                  Stream1Decl;
1236b8e80941Smrg   struct GEN7_SO_DECL                  Stream2Decl;
1237b8e80941Smrg   struct GEN7_SO_DECL                  Stream3Decl;
1238b8e80941Smrg};
1239b8e80941Smrg
1240b8e80941Smrgstatic inline void
1241b8e80941SmrgGEN7_SO_DECL_ENTRY_pack(__attribute__((unused)) __gen_user_data *data,
1242b8e80941Smrg                        __attribute__((unused)) void * restrict dst,
1243b8e80941Smrg                        __attribute__((unused)) const struct GEN7_SO_DECL_ENTRY * restrict values)
1244b8e80941Smrg{
1245b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1246b8e80941Smrg
1247b8e80941Smrg   uint32_t v0_0;
1248b8e80941Smrg   GEN7_SO_DECL_pack(data, &v0_0, &values->Stream0Decl);
1249b8e80941Smrg
1250b8e80941Smrg   uint32_t v0_1;
1251b8e80941Smrg   GEN7_SO_DECL_pack(data, &v0_1, &values->Stream1Decl);
1252b8e80941Smrg
1253b8e80941Smrg   dw[0] =
1254b8e80941Smrg      __gen_uint(v0_0, 0, 15) |
1255b8e80941Smrg      __gen_uint(v0_1, 16, 31);
1256b8e80941Smrg
1257b8e80941Smrg   uint32_t v1_0;
1258b8e80941Smrg   GEN7_SO_DECL_pack(data, &v1_0, &values->Stream2Decl);
1259b8e80941Smrg
1260b8e80941Smrg   uint32_t v1_1;
1261b8e80941Smrg   GEN7_SO_DECL_pack(data, &v1_1, &values->Stream3Decl);
1262b8e80941Smrg
1263b8e80941Smrg   dw[1] =
1264b8e80941Smrg      __gen_uint(v1_0, 0, 15) |
1265b8e80941Smrg      __gen_uint(v1_1, 16, 31);
1266b8e80941Smrg}
1267b8e80941Smrg
1268b8e80941Smrg#define GEN7_VERTEX_BUFFER_STATE_length        4
1269b8e80941Smrgstruct GEN7_VERTEX_BUFFER_STATE {
1270b8e80941Smrg   uint32_t                             BufferPitch;
1271b8e80941Smrg   bool                                 VertexFetchInvalidate;
1272b8e80941Smrg   bool                                 NullVertexBuffer;
1273b8e80941Smrg   bool                                 AddressModifyEnable;
1274b8e80941Smrg   uint32_t                             MOCS;
1275b8e80941Smrg   uint32_t                             BufferAccessType;
1276b8e80941Smrg#define VERTEXDATA                               0
1277b8e80941Smrg#define INSTANCEDATA                             1
1278b8e80941Smrg   uint32_t                             VertexBufferIndex;
1279b8e80941Smrg   __gen_address_type                   BufferStartingAddress;
1280b8e80941Smrg   __gen_address_type                   EndAddress;
1281b8e80941Smrg   uint32_t                             InstanceDataStepRate;
1282b8e80941Smrg};
1283b8e80941Smrg
1284b8e80941Smrgstatic inline void
1285b8e80941SmrgGEN7_VERTEX_BUFFER_STATE_pack(__attribute__((unused)) __gen_user_data *data,
1286b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
1287b8e80941Smrg                              __attribute__((unused)) const struct GEN7_VERTEX_BUFFER_STATE * restrict values)
1288b8e80941Smrg{
1289b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1290b8e80941Smrg
1291b8e80941Smrg   dw[0] =
1292b8e80941Smrg      __gen_uint(values->BufferPitch, 0, 11) |
1293b8e80941Smrg      __gen_uint(values->VertexFetchInvalidate, 12, 12) |
1294b8e80941Smrg      __gen_uint(values->NullVertexBuffer, 13, 13) |
1295b8e80941Smrg      __gen_uint(values->AddressModifyEnable, 14, 14) |
1296b8e80941Smrg      __gen_uint(values->MOCS, 16, 19) |
1297b8e80941Smrg      __gen_uint(values->BufferAccessType, 20, 20) |
1298b8e80941Smrg      __gen_uint(values->VertexBufferIndex, 26, 31);
1299b8e80941Smrg
1300b8e80941Smrg   dw[1] = __gen_combine_address(data, &dw[1], values->BufferStartingAddress, 0);
1301b8e80941Smrg
1302b8e80941Smrg   dw[2] = __gen_combine_address(data, &dw[2], values->EndAddress, 0);
1303b8e80941Smrg
1304b8e80941Smrg   dw[3] =
1305b8e80941Smrg      __gen_uint(values->InstanceDataStepRate, 0, 31);
1306b8e80941Smrg}
1307b8e80941Smrg
1308b8e80941Smrg#define GEN7_VERTEX_ELEMENT_STATE_length       2
1309b8e80941Smrgstruct GEN7_VERTEX_ELEMENT_STATE {
1310b8e80941Smrg   uint32_t                             SourceElementOffset;
1311b8e80941Smrg   bool                                 EdgeFlagEnable;
1312b8e80941Smrg   uint32_t                             SourceElementFormat;
1313b8e80941Smrg   bool                                 Valid;
1314b8e80941Smrg   uint32_t                             VertexBufferIndex;
1315b8e80941Smrg   enum GEN7_3D_Vertex_Component_Control Component3Control;
1316b8e80941Smrg   enum GEN7_3D_Vertex_Component_Control Component2Control;
1317b8e80941Smrg   enum GEN7_3D_Vertex_Component_Control Component1Control;
1318b8e80941Smrg   enum GEN7_3D_Vertex_Component_Control Component0Control;
1319b8e80941Smrg};
1320b8e80941Smrg
1321b8e80941Smrgstatic inline void
1322b8e80941SmrgGEN7_VERTEX_ELEMENT_STATE_pack(__attribute__((unused)) __gen_user_data *data,
1323b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
1324b8e80941Smrg                               __attribute__((unused)) const struct GEN7_VERTEX_ELEMENT_STATE * restrict values)
1325b8e80941Smrg{
1326b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1327b8e80941Smrg
1328b8e80941Smrg   dw[0] =
1329b8e80941Smrg      __gen_uint(values->SourceElementOffset, 0, 11) |
1330b8e80941Smrg      __gen_uint(values->EdgeFlagEnable, 15, 15) |
1331b8e80941Smrg      __gen_uint(values->SourceElementFormat, 16, 24) |
1332b8e80941Smrg      __gen_uint(values->Valid, 25, 25) |
1333b8e80941Smrg      __gen_uint(values->VertexBufferIndex, 26, 31);
1334b8e80941Smrg
1335b8e80941Smrg   dw[1] =
1336b8e80941Smrg      __gen_uint(values->Component3Control, 16, 18) |
1337b8e80941Smrg      __gen_uint(values->Component2Control, 20, 22) |
1338b8e80941Smrg      __gen_uint(values->Component1Control, 24, 26) |
1339b8e80941Smrg      __gen_uint(values->Component0Control, 28, 30);
1340b8e80941Smrg}
1341b8e80941Smrg
1342b8e80941Smrg#define GEN7_3DPRIMITIVE_length                7
1343b8e80941Smrg#define GEN7_3DPRIMITIVE_length_bias           2
1344b8e80941Smrg#define GEN7_3DPRIMITIVE_header                 \
1345b8e80941Smrg   .DWordLength                         =      5,  \
1346b8e80941Smrg   ._3DCommandSubOpcode                 =      0,  \
1347b8e80941Smrg   ._3DCommandOpcode                    =      3,  \
1348b8e80941Smrg   .CommandSubType                      =      3,  \
1349b8e80941Smrg   .CommandType                         =      3
1350b8e80941Smrg
1351b8e80941Smrgstruct GEN7_3DPRIMITIVE {
1352b8e80941Smrg   uint32_t                             DWordLength;
1353b8e80941Smrg   bool                                 PredicateEnable;
1354b8e80941Smrg   bool                                 IndirectParameterEnable;
1355b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1356b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1357b8e80941Smrg   uint32_t                             CommandSubType;
1358b8e80941Smrg   uint32_t                             CommandType;
1359b8e80941Smrg   enum GEN7_3D_Prim_Topo_Type          PrimitiveTopologyType;
1360b8e80941Smrg   uint32_t                             VertexAccessType;
1361b8e80941Smrg#define SEQUENTIAL                               0
1362b8e80941Smrg#define RANDOM                                   1
1363b8e80941Smrg   bool                                 EndOffsetEnable;
1364b8e80941Smrg   uint32_t                             VertexCountPerInstance;
1365b8e80941Smrg   uint32_t                             StartVertexLocation;
1366b8e80941Smrg   uint32_t                             InstanceCount;
1367b8e80941Smrg   uint32_t                             StartInstanceLocation;
1368b8e80941Smrg   int32_t                              BaseVertexLocation;
1369b8e80941Smrg};
1370b8e80941Smrg
1371b8e80941Smrgstatic inline void
1372b8e80941SmrgGEN7_3DPRIMITIVE_pack(__attribute__((unused)) __gen_user_data *data,
1373b8e80941Smrg                      __attribute__((unused)) void * restrict dst,
1374b8e80941Smrg                      __attribute__((unused)) const struct GEN7_3DPRIMITIVE * restrict values)
1375b8e80941Smrg{
1376b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1377b8e80941Smrg
1378b8e80941Smrg   dw[0] =
1379b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
1380b8e80941Smrg      __gen_uint(values->PredicateEnable, 8, 8) |
1381b8e80941Smrg      __gen_uint(values->IndirectParameterEnable, 10, 10) |
1382b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1383b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1384b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1385b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1386b8e80941Smrg
1387b8e80941Smrg   dw[1] =
1388b8e80941Smrg      __gen_uint(values->PrimitiveTopologyType, 0, 5) |
1389b8e80941Smrg      __gen_uint(values->VertexAccessType, 8, 8) |
1390b8e80941Smrg      __gen_uint(values->EndOffsetEnable, 9, 9);
1391b8e80941Smrg
1392b8e80941Smrg   dw[2] =
1393b8e80941Smrg      __gen_uint(values->VertexCountPerInstance, 0, 31);
1394b8e80941Smrg
1395b8e80941Smrg   dw[3] =
1396b8e80941Smrg      __gen_uint(values->StartVertexLocation, 0, 31);
1397b8e80941Smrg
1398b8e80941Smrg   dw[4] =
1399b8e80941Smrg      __gen_uint(values->InstanceCount, 0, 31);
1400b8e80941Smrg
1401b8e80941Smrg   dw[5] =
1402b8e80941Smrg      __gen_uint(values->StartInstanceLocation, 0, 31);
1403b8e80941Smrg
1404b8e80941Smrg   dw[6] =
1405b8e80941Smrg      __gen_sint(values->BaseVertexLocation, 0, 31);
1406b8e80941Smrg}
1407b8e80941Smrg
1408b8e80941Smrg#define GEN7_3DSTATE_AA_LINE_PARAMETERS_length      3
1409b8e80941Smrg#define GEN7_3DSTATE_AA_LINE_PARAMETERS_length_bias      2
1410b8e80941Smrg#define GEN7_3DSTATE_AA_LINE_PARAMETERS_header  \
1411b8e80941Smrg   .DWordLength                         =      1,  \
1412b8e80941Smrg   ._3DCommandSubOpcode                 =     10,  \
1413b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
1414b8e80941Smrg   .CommandSubType                      =      3,  \
1415b8e80941Smrg   .CommandType                         =      3
1416b8e80941Smrg
1417b8e80941Smrgstruct GEN7_3DSTATE_AA_LINE_PARAMETERS {
1418b8e80941Smrg   uint32_t                             DWordLength;
1419b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1420b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1421b8e80941Smrg   uint32_t                             CommandSubType;
1422b8e80941Smrg   uint32_t                             CommandType;
1423b8e80941Smrg   float                                AACoverageSlope;
1424b8e80941Smrg   float                                AACoverageBias;
1425b8e80941Smrg   float                                AACoverageEndCapSlope;
1426b8e80941Smrg   float                                AACoverageEndCapBias;
1427b8e80941Smrg};
1428b8e80941Smrg
1429b8e80941Smrgstatic inline void
1430b8e80941SmrgGEN7_3DSTATE_AA_LINE_PARAMETERS_pack(__attribute__((unused)) __gen_user_data *data,
1431b8e80941Smrg                                     __attribute__((unused)) void * restrict dst,
1432b8e80941Smrg                                     __attribute__((unused)) const struct GEN7_3DSTATE_AA_LINE_PARAMETERS * restrict values)
1433b8e80941Smrg{
1434b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1435b8e80941Smrg
1436b8e80941Smrg   dw[0] =
1437b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
1438b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1439b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1440b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1441b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1442b8e80941Smrg
1443b8e80941Smrg   dw[1] =
1444b8e80941Smrg      __gen_ufixed(values->AACoverageSlope, 0, 7, 8) |
1445b8e80941Smrg      __gen_ufixed(values->AACoverageBias, 16, 23, 8);
1446b8e80941Smrg
1447b8e80941Smrg   dw[2] =
1448b8e80941Smrg      __gen_ufixed(values->AACoverageEndCapSlope, 0, 7, 8) |
1449b8e80941Smrg      __gen_ufixed(values->AACoverageEndCapBias, 16, 23, 8);
1450b8e80941Smrg}
1451b8e80941Smrg
1452b8e80941Smrg#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_DS_length      2
1453b8e80941Smrg#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_DS_length_bias      2
1454b8e80941Smrg#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_DS_header\
1455b8e80941Smrg   .DWordLength                         =      0,  \
1456b8e80941Smrg   ._3DCommandSubOpcode                 =     40,  \
1457b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
1458b8e80941Smrg   .CommandSubType                      =      3,  \
1459b8e80941Smrg   .CommandType                         =      3
1460b8e80941Smrg
1461b8e80941Smrgstruct GEN7_3DSTATE_BINDING_TABLE_POINTERS_DS {
1462b8e80941Smrg   uint32_t                             DWordLength;
1463b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1464b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1465b8e80941Smrg   uint32_t                             CommandSubType;
1466b8e80941Smrg   uint32_t                             CommandType;
1467b8e80941Smrg   uint64_t                             PointertoDSBindingTable;
1468b8e80941Smrg};
1469b8e80941Smrg
1470b8e80941Smrgstatic inline void
1471b8e80941SmrgGEN7_3DSTATE_BINDING_TABLE_POINTERS_DS_pack(__attribute__((unused)) __gen_user_data *data,
1472b8e80941Smrg                                            __attribute__((unused)) void * restrict dst,
1473b8e80941Smrg                                            __attribute__((unused)) const struct GEN7_3DSTATE_BINDING_TABLE_POINTERS_DS * restrict values)
1474b8e80941Smrg{
1475b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1476b8e80941Smrg
1477b8e80941Smrg   dw[0] =
1478b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
1479b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1480b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1481b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1482b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1483b8e80941Smrg
1484b8e80941Smrg   dw[1] =
1485b8e80941Smrg      __gen_offset(values->PointertoDSBindingTable, 5, 15);
1486b8e80941Smrg}
1487b8e80941Smrg
1488b8e80941Smrg#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_GS_length      2
1489b8e80941Smrg#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_GS_length_bias      2
1490b8e80941Smrg#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_GS_header\
1491b8e80941Smrg   .DWordLength                         =      0,  \
1492b8e80941Smrg   ._3DCommandSubOpcode                 =     41,  \
1493b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
1494b8e80941Smrg   .CommandSubType                      =      3,  \
1495b8e80941Smrg   .CommandType                         =      3
1496b8e80941Smrg
1497b8e80941Smrgstruct GEN7_3DSTATE_BINDING_TABLE_POINTERS_GS {
1498b8e80941Smrg   uint32_t                             DWordLength;
1499b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1500b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1501b8e80941Smrg   uint32_t                             CommandSubType;
1502b8e80941Smrg   uint32_t                             CommandType;
1503b8e80941Smrg   uint64_t                             PointertoGSBindingTable;
1504b8e80941Smrg};
1505b8e80941Smrg
1506b8e80941Smrgstatic inline void
1507b8e80941SmrgGEN7_3DSTATE_BINDING_TABLE_POINTERS_GS_pack(__attribute__((unused)) __gen_user_data *data,
1508b8e80941Smrg                                            __attribute__((unused)) void * restrict dst,
1509b8e80941Smrg                                            __attribute__((unused)) const struct GEN7_3DSTATE_BINDING_TABLE_POINTERS_GS * restrict values)
1510b8e80941Smrg{
1511b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1512b8e80941Smrg
1513b8e80941Smrg   dw[0] =
1514b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
1515b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1516b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1517b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1518b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1519b8e80941Smrg
1520b8e80941Smrg   dw[1] =
1521b8e80941Smrg      __gen_offset(values->PointertoGSBindingTable, 5, 15);
1522b8e80941Smrg}
1523b8e80941Smrg
1524b8e80941Smrg#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_HS_length      2
1525b8e80941Smrg#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_HS_length_bias      2
1526b8e80941Smrg#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_HS_header\
1527b8e80941Smrg   .DWordLength                         =      0,  \
1528b8e80941Smrg   ._3DCommandSubOpcode                 =     39,  \
1529b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
1530b8e80941Smrg   .CommandSubType                      =      3,  \
1531b8e80941Smrg   .CommandType                         =      3
1532b8e80941Smrg
1533b8e80941Smrgstruct GEN7_3DSTATE_BINDING_TABLE_POINTERS_HS {
1534b8e80941Smrg   uint32_t                             DWordLength;
1535b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1536b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1537b8e80941Smrg   uint32_t                             CommandSubType;
1538b8e80941Smrg   uint32_t                             CommandType;
1539b8e80941Smrg   uint64_t                             PointertoHSBindingTable;
1540b8e80941Smrg};
1541b8e80941Smrg
1542b8e80941Smrgstatic inline void
1543b8e80941SmrgGEN7_3DSTATE_BINDING_TABLE_POINTERS_HS_pack(__attribute__((unused)) __gen_user_data *data,
1544b8e80941Smrg                                            __attribute__((unused)) void * restrict dst,
1545b8e80941Smrg                                            __attribute__((unused)) const struct GEN7_3DSTATE_BINDING_TABLE_POINTERS_HS * restrict values)
1546b8e80941Smrg{
1547b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1548b8e80941Smrg
1549b8e80941Smrg   dw[0] =
1550b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
1551b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1552b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1553b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1554b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1555b8e80941Smrg
1556b8e80941Smrg   dw[1] =
1557b8e80941Smrg      __gen_offset(values->PointertoHSBindingTable, 5, 15);
1558b8e80941Smrg}
1559b8e80941Smrg
1560b8e80941Smrg#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_PS_length      2
1561b8e80941Smrg#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_PS_length_bias      2
1562b8e80941Smrg#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_PS_header\
1563b8e80941Smrg   .DWordLength                         =      0,  \
1564b8e80941Smrg   ._3DCommandSubOpcode                 =     42,  \
1565b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
1566b8e80941Smrg   .CommandSubType                      =      3,  \
1567b8e80941Smrg   .CommandType                         =      3
1568b8e80941Smrg
1569b8e80941Smrgstruct GEN7_3DSTATE_BINDING_TABLE_POINTERS_PS {
1570b8e80941Smrg   uint32_t                             DWordLength;
1571b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1572b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1573b8e80941Smrg   uint32_t                             CommandSubType;
1574b8e80941Smrg   uint32_t                             CommandType;
1575b8e80941Smrg   uint64_t                             PointertoPSBindingTable;
1576b8e80941Smrg};
1577b8e80941Smrg
1578b8e80941Smrgstatic inline void
1579b8e80941SmrgGEN7_3DSTATE_BINDING_TABLE_POINTERS_PS_pack(__attribute__((unused)) __gen_user_data *data,
1580b8e80941Smrg                                            __attribute__((unused)) void * restrict dst,
1581b8e80941Smrg                                            __attribute__((unused)) const struct GEN7_3DSTATE_BINDING_TABLE_POINTERS_PS * restrict values)
1582b8e80941Smrg{
1583b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1584b8e80941Smrg
1585b8e80941Smrg   dw[0] =
1586b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
1587b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1588b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1589b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1590b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1591b8e80941Smrg
1592b8e80941Smrg   dw[1] =
1593b8e80941Smrg      __gen_offset(values->PointertoPSBindingTable, 5, 15);
1594b8e80941Smrg}
1595b8e80941Smrg
1596b8e80941Smrg#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_VS_length      2
1597b8e80941Smrg#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_VS_length_bias      2
1598b8e80941Smrg#define GEN7_3DSTATE_BINDING_TABLE_POINTERS_VS_header\
1599b8e80941Smrg   .DWordLength                         =      0,  \
1600b8e80941Smrg   ._3DCommandSubOpcode                 =     38,  \
1601b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
1602b8e80941Smrg   .CommandSubType                      =      3,  \
1603b8e80941Smrg   .CommandType                         =      3
1604b8e80941Smrg
1605b8e80941Smrgstruct GEN7_3DSTATE_BINDING_TABLE_POINTERS_VS {
1606b8e80941Smrg   uint32_t                             DWordLength;
1607b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1608b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1609b8e80941Smrg   uint32_t                             CommandSubType;
1610b8e80941Smrg   uint32_t                             CommandType;
1611b8e80941Smrg   uint64_t                             PointertoVSBindingTable;
1612b8e80941Smrg};
1613b8e80941Smrg
1614b8e80941Smrgstatic inline void
1615b8e80941SmrgGEN7_3DSTATE_BINDING_TABLE_POINTERS_VS_pack(__attribute__((unused)) __gen_user_data *data,
1616b8e80941Smrg                                            __attribute__((unused)) void * restrict dst,
1617b8e80941Smrg                                            __attribute__((unused)) const struct GEN7_3DSTATE_BINDING_TABLE_POINTERS_VS * restrict values)
1618b8e80941Smrg{
1619b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1620b8e80941Smrg
1621b8e80941Smrg   dw[0] =
1622b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
1623b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1624b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1625b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1626b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1627b8e80941Smrg
1628b8e80941Smrg   dw[1] =
1629b8e80941Smrg      __gen_offset(values->PointertoVSBindingTable, 5, 15);
1630b8e80941Smrg}
1631b8e80941Smrg
1632b8e80941Smrg#define GEN7_3DSTATE_BLEND_STATE_POINTERS_length      2
1633b8e80941Smrg#define GEN7_3DSTATE_BLEND_STATE_POINTERS_length_bias      2
1634b8e80941Smrg#define GEN7_3DSTATE_BLEND_STATE_POINTERS_header\
1635b8e80941Smrg   .DWordLength                         =      0,  \
1636b8e80941Smrg   ._3DCommandSubOpcode                 =     36,  \
1637b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
1638b8e80941Smrg   .CommandSubType                      =      3,  \
1639b8e80941Smrg   .CommandType                         =      3
1640b8e80941Smrg
1641b8e80941Smrgstruct GEN7_3DSTATE_BLEND_STATE_POINTERS {
1642b8e80941Smrg   uint32_t                             DWordLength;
1643b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1644b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1645b8e80941Smrg   uint32_t                             CommandSubType;
1646b8e80941Smrg   uint32_t                             CommandType;
1647b8e80941Smrg   uint64_t                             BlendStatePointer;
1648b8e80941Smrg};
1649b8e80941Smrg
1650b8e80941Smrgstatic inline void
1651b8e80941SmrgGEN7_3DSTATE_BLEND_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
1652b8e80941Smrg                                       __attribute__((unused)) void * restrict dst,
1653b8e80941Smrg                                       __attribute__((unused)) const struct GEN7_3DSTATE_BLEND_STATE_POINTERS * restrict values)
1654b8e80941Smrg{
1655b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1656b8e80941Smrg
1657b8e80941Smrg   dw[0] =
1658b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
1659b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1660b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1661b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1662b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1663b8e80941Smrg
1664b8e80941Smrg   dw[1] =
1665b8e80941Smrg      __gen_mbo(0, 0) |
1666b8e80941Smrg      __gen_offset(values->BlendStatePointer, 6, 31);
1667b8e80941Smrg}
1668b8e80941Smrg
1669b8e80941Smrg#define GEN7_3DSTATE_CC_STATE_POINTERS_length      2
1670b8e80941Smrg#define GEN7_3DSTATE_CC_STATE_POINTERS_length_bias      2
1671b8e80941Smrg#define GEN7_3DSTATE_CC_STATE_POINTERS_header   \
1672b8e80941Smrg   .DWordLength                         =      0,  \
1673b8e80941Smrg   ._3DCommandSubOpcode                 =     14,  \
1674b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
1675b8e80941Smrg   .CommandSubType                      =      3,  \
1676b8e80941Smrg   .CommandType                         =      3
1677b8e80941Smrg
1678b8e80941Smrgstruct GEN7_3DSTATE_CC_STATE_POINTERS {
1679b8e80941Smrg   uint32_t                             DWordLength;
1680b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1681b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1682b8e80941Smrg   uint32_t                             CommandSubType;
1683b8e80941Smrg   uint32_t                             CommandType;
1684b8e80941Smrg   uint64_t                             ColorCalcStatePointer;
1685b8e80941Smrg};
1686b8e80941Smrg
1687b8e80941Smrgstatic inline void
1688b8e80941SmrgGEN7_3DSTATE_CC_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
1689b8e80941Smrg                                    __attribute__((unused)) void * restrict dst,
1690b8e80941Smrg                                    __attribute__((unused)) const struct GEN7_3DSTATE_CC_STATE_POINTERS * restrict values)
1691b8e80941Smrg{
1692b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1693b8e80941Smrg
1694b8e80941Smrg   dw[0] =
1695b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
1696b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1697b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1698b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1699b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1700b8e80941Smrg
1701b8e80941Smrg   dw[1] =
1702b8e80941Smrg      __gen_mbo(0, 0) |
1703b8e80941Smrg      __gen_offset(values->ColorCalcStatePointer, 6, 31);
1704b8e80941Smrg}
1705b8e80941Smrg
1706b8e80941Smrg#define GEN7_3DSTATE_CHROMA_KEY_length         4
1707b8e80941Smrg#define GEN7_3DSTATE_CHROMA_KEY_length_bias      2
1708b8e80941Smrg#define GEN7_3DSTATE_CHROMA_KEY_header          \
1709b8e80941Smrg   .DWordLength                         =      2,  \
1710b8e80941Smrg   ._3DCommandSubOpcode                 =      4,  \
1711b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
1712b8e80941Smrg   .CommandSubType                      =      3,  \
1713b8e80941Smrg   .CommandType                         =      3
1714b8e80941Smrg
1715b8e80941Smrgstruct GEN7_3DSTATE_CHROMA_KEY {
1716b8e80941Smrg   uint32_t                             DWordLength;
1717b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1718b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1719b8e80941Smrg   uint32_t                             CommandSubType;
1720b8e80941Smrg   uint32_t                             CommandType;
1721b8e80941Smrg   uint32_t                             ChromaKeyTableIndex;
1722b8e80941Smrg   uint32_t                             ChromaKeyLowValue;
1723b8e80941Smrg   uint32_t                             ChromaKeyHighValue;
1724b8e80941Smrg};
1725b8e80941Smrg
1726b8e80941Smrgstatic inline void
1727b8e80941SmrgGEN7_3DSTATE_CHROMA_KEY_pack(__attribute__((unused)) __gen_user_data *data,
1728b8e80941Smrg                             __attribute__((unused)) void * restrict dst,
1729b8e80941Smrg                             __attribute__((unused)) const struct GEN7_3DSTATE_CHROMA_KEY * restrict values)
1730b8e80941Smrg{
1731b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1732b8e80941Smrg
1733b8e80941Smrg   dw[0] =
1734b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
1735b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1736b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1737b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1738b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1739b8e80941Smrg
1740b8e80941Smrg   dw[1] =
1741b8e80941Smrg      __gen_uint(values->ChromaKeyTableIndex, 30, 31);
1742b8e80941Smrg
1743b8e80941Smrg   dw[2] =
1744b8e80941Smrg      __gen_uint(values->ChromaKeyLowValue, 0, 31);
1745b8e80941Smrg
1746b8e80941Smrg   dw[3] =
1747b8e80941Smrg      __gen_uint(values->ChromaKeyHighValue, 0, 31);
1748b8e80941Smrg}
1749b8e80941Smrg
1750b8e80941Smrg#define GEN7_3DSTATE_CLEAR_PARAMS_length       3
1751b8e80941Smrg#define GEN7_3DSTATE_CLEAR_PARAMS_length_bias      2
1752b8e80941Smrg#define GEN7_3DSTATE_CLEAR_PARAMS_header        \
1753b8e80941Smrg   .DWordLength                         =      1,  \
1754b8e80941Smrg   ._3DCommandSubOpcode                 =      4,  \
1755b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
1756b8e80941Smrg   .CommandSubType                      =      3,  \
1757b8e80941Smrg   .CommandType                         =      3
1758b8e80941Smrg
1759b8e80941Smrgstruct GEN7_3DSTATE_CLEAR_PARAMS {
1760b8e80941Smrg   uint32_t                             DWordLength;
1761b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1762b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1763b8e80941Smrg   uint32_t                             CommandSubType;
1764b8e80941Smrg   uint32_t                             CommandType;
1765b8e80941Smrg   uint32_t                             DepthClearValue;
1766b8e80941Smrg   bool                                 DepthClearValueValid;
1767b8e80941Smrg};
1768b8e80941Smrg
1769b8e80941Smrgstatic inline void
1770b8e80941SmrgGEN7_3DSTATE_CLEAR_PARAMS_pack(__attribute__((unused)) __gen_user_data *data,
1771b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
1772b8e80941Smrg                               __attribute__((unused)) const struct GEN7_3DSTATE_CLEAR_PARAMS * restrict values)
1773b8e80941Smrg{
1774b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1775b8e80941Smrg
1776b8e80941Smrg   dw[0] =
1777b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
1778b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1779b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1780b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1781b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1782b8e80941Smrg
1783b8e80941Smrg   dw[1] =
1784b8e80941Smrg      __gen_uint(values->DepthClearValue, 0, 31);
1785b8e80941Smrg
1786b8e80941Smrg   dw[2] =
1787b8e80941Smrg      __gen_uint(values->DepthClearValueValid, 0, 0);
1788b8e80941Smrg}
1789b8e80941Smrg
1790b8e80941Smrg#define GEN7_3DSTATE_CLIP_length               4
1791b8e80941Smrg#define GEN7_3DSTATE_CLIP_length_bias          2
1792b8e80941Smrg#define GEN7_3DSTATE_CLIP_header                \
1793b8e80941Smrg   .DWordLength                         =      2,  \
1794b8e80941Smrg   ._3DCommandSubOpcode                 =     18,  \
1795b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
1796b8e80941Smrg   .CommandSubType                      =      3,  \
1797b8e80941Smrg   .CommandType                         =      3
1798b8e80941Smrg
1799b8e80941Smrgstruct GEN7_3DSTATE_CLIP {
1800b8e80941Smrg   uint32_t                             DWordLength;
1801b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1802b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1803b8e80941Smrg   uint32_t                             CommandSubType;
1804b8e80941Smrg   uint32_t                             CommandType;
1805b8e80941Smrg   uint32_t                             UserClipDistanceCullTestEnableBitmask;
1806b8e80941Smrg   bool                                 StatisticsEnable;
1807b8e80941Smrg   uint32_t                             CullMode;
1808b8e80941Smrg#define CULLMODE_BOTH                            0
1809b8e80941Smrg#define CULLMODE_NONE                            1
1810b8e80941Smrg#define CULLMODE_FRONT                           2
1811b8e80941Smrg#define CULLMODE_BACK                            3
1812b8e80941Smrg   bool                                 EarlyCullEnable;
1813b8e80941Smrg   uint32_t                             VertexSubPixelPrecisionSelect;
1814b8e80941Smrg   uint32_t                             FrontWinding;
1815b8e80941Smrg   uint32_t                             TriangleFanProvokingVertexSelect;
1816b8e80941Smrg#define Vertex0                                  0
1817b8e80941Smrg#define Vertex1                                  1
1818b8e80941Smrg#define Vertex2                                  2
1819b8e80941Smrg   uint32_t                             LineStripListProvokingVertexSelect;
1820b8e80941Smrg#define Vertex0                                  0
1821b8e80941Smrg#define Vertex1                                  1
1822b8e80941Smrg   uint32_t                             TriangleStripListProvokingVertexSelect;
1823b8e80941Smrg#define Vertex0                                  0
1824b8e80941Smrg#define Vertex1                                  1
1825b8e80941Smrg#define Vertex2                                  2
1826b8e80941Smrg   bool                                 NonPerspectiveBarycentricEnable;
1827b8e80941Smrg   bool                                 PerspectiveDivideDisable;
1828b8e80941Smrg   uint32_t                             ClipMode;
1829b8e80941Smrg#define CLIPMODE_NORMAL                          0
1830b8e80941Smrg#define CLIPMODE_REJECT_ALL                      3
1831b8e80941Smrg#define CLIPMODE_ACCEPT_ALL                      4
1832b8e80941Smrg   uint32_t                             UserClipDistanceClipTestEnableBitmask;
1833b8e80941Smrg   bool                                 GuardbandClipTestEnable;
1834b8e80941Smrg   bool                                 ViewportZClipTestEnable;
1835b8e80941Smrg   bool                                 ViewportXYClipTestEnable;
1836b8e80941Smrg   uint32_t                             APIMode;
1837b8e80941Smrg#define APIMODE_OGL                              0
1838b8e80941Smrg#define APIMODE_D3D                              1
1839b8e80941Smrg   bool                                 ClipEnable;
1840b8e80941Smrg   uint32_t                             MaximumVPIndex;
1841b8e80941Smrg   bool                                 ForceZeroRTAIndexEnable;
1842b8e80941Smrg   float                                MaximumPointWidth;
1843b8e80941Smrg   float                                MinimumPointWidth;
1844b8e80941Smrg};
1845b8e80941Smrg
1846b8e80941Smrgstatic inline void
1847b8e80941SmrgGEN7_3DSTATE_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
1848b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
1849b8e80941Smrg                       __attribute__((unused)) const struct GEN7_3DSTATE_CLIP * restrict values)
1850b8e80941Smrg{
1851b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1852b8e80941Smrg
1853b8e80941Smrg   dw[0] =
1854b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
1855b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1856b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1857b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1858b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1859b8e80941Smrg
1860b8e80941Smrg   dw[1] =
1861b8e80941Smrg      __gen_uint(values->UserClipDistanceCullTestEnableBitmask, 0, 7) |
1862b8e80941Smrg      __gen_uint(values->StatisticsEnable, 10, 10) |
1863b8e80941Smrg      __gen_uint(values->CullMode, 16, 17) |
1864b8e80941Smrg      __gen_uint(values->EarlyCullEnable, 18, 18) |
1865b8e80941Smrg      __gen_uint(values->VertexSubPixelPrecisionSelect, 19, 19) |
1866b8e80941Smrg      __gen_uint(values->FrontWinding, 20, 20);
1867b8e80941Smrg
1868b8e80941Smrg   dw[2] =
1869b8e80941Smrg      __gen_uint(values->TriangleFanProvokingVertexSelect, 0, 1) |
1870b8e80941Smrg      __gen_uint(values->LineStripListProvokingVertexSelect, 2, 3) |
1871b8e80941Smrg      __gen_uint(values->TriangleStripListProvokingVertexSelect, 4, 5) |
1872b8e80941Smrg      __gen_uint(values->NonPerspectiveBarycentricEnable, 8, 8) |
1873b8e80941Smrg      __gen_uint(values->PerspectiveDivideDisable, 9, 9) |
1874b8e80941Smrg      __gen_uint(values->ClipMode, 13, 15) |
1875b8e80941Smrg      __gen_uint(values->UserClipDistanceClipTestEnableBitmask, 16, 23) |
1876b8e80941Smrg      __gen_uint(values->GuardbandClipTestEnable, 26, 26) |
1877b8e80941Smrg      __gen_uint(values->ViewportZClipTestEnable, 27, 27) |
1878b8e80941Smrg      __gen_uint(values->ViewportXYClipTestEnable, 28, 28) |
1879b8e80941Smrg      __gen_uint(values->APIMode, 30, 30) |
1880b8e80941Smrg      __gen_uint(values->ClipEnable, 31, 31);
1881b8e80941Smrg
1882b8e80941Smrg   dw[3] =
1883b8e80941Smrg      __gen_uint(values->MaximumVPIndex, 0, 3) |
1884b8e80941Smrg      __gen_uint(values->ForceZeroRTAIndexEnable, 5, 5) |
1885b8e80941Smrg      __gen_ufixed(values->MaximumPointWidth, 6, 16, 3) |
1886b8e80941Smrg      __gen_ufixed(values->MinimumPointWidth, 17, 27, 3);
1887b8e80941Smrg}
1888b8e80941Smrg
1889b8e80941Smrg#define GEN7_3DSTATE_CONSTANT_DS_length        7
1890b8e80941Smrg#define GEN7_3DSTATE_CONSTANT_DS_length_bias      2
1891b8e80941Smrg#define GEN7_3DSTATE_CONSTANT_DS_header         \
1892b8e80941Smrg   .DWordLength                         =      5,  \
1893b8e80941Smrg   ._3DCommandSubOpcode                 =     26,  \
1894b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
1895b8e80941Smrg   .CommandSubType                      =      3,  \
1896b8e80941Smrg   .CommandType                         =      3
1897b8e80941Smrg
1898b8e80941Smrgstruct GEN7_3DSTATE_CONSTANT_DS {
1899b8e80941Smrg   uint32_t                             DWordLength;
1900b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1901b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1902b8e80941Smrg   uint32_t                             CommandSubType;
1903b8e80941Smrg   uint32_t                             CommandType;
1904b8e80941Smrg   struct GEN7_3DSTATE_CONSTANT_BODY    ConstantBody;
1905b8e80941Smrg};
1906b8e80941Smrg
1907b8e80941Smrgstatic inline void
1908b8e80941SmrgGEN7_3DSTATE_CONSTANT_DS_pack(__attribute__((unused)) __gen_user_data *data,
1909b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
1910b8e80941Smrg                              __attribute__((unused)) const struct GEN7_3DSTATE_CONSTANT_DS * restrict values)
1911b8e80941Smrg{
1912b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1913b8e80941Smrg
1914b8e80941Smrg   dw[0] =
1915b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
1916b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1917b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1918b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1919b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1920b8e80941Smrg
1921b8e80941Smrg   GEN7_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
1922b8e80941Smrg}
1923b8e80941Smrg
1924b8e80941Smrg#define GEN7_3DSTATE_CONSTANT_GS_length        7
1925b8e80941Smrg#define GEN7_3DSTATE_CONSTANT_GS_length_bias      2
1926b8e80941Smrg#define GEN7_3DSTATE_CONSTANT_GS_header         \
1927b8e80941Smrg   .DWordLength                         =      5,  \
1928b8e80941Smrg   ._3DCommandSubOpcode                 =     22,  \
1929b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
1930b8e80941Smrg   .CommandSubType                      =      3,  \
1931b8e80941Smrg   .CommandType                         =      3
1932b8e80941Smrg
1933b8e80941Smrgstruct GEN7_3DSTATE_CONSTANT_GS {
1934b8e80941Smrg   uint32_t                             DWordLength;
1935b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1936b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1937b8e80941Smrg   uint32_t                             CommandSubType;
1938b8e80941Smrg   uint32_t                             CommandType;
1939b8e80941Smrg   struct GEN7_3DSTATE_CONSTANT_BODY    ConstantBody;
1940b8e80941Smrg};
1941b8e80941Smrg
1942b8e80941Smrgstatic inline void
1943b8e80941SmrgGEN7_3DSTATE_CONSTANT_GS_pack(__attribute__((unused)) __gen_user_data *data,
1944b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
1945b8e80941Smrg                              __attribute__((unused)) const struct GEN7_3DSTATE_CONSTANT_GS * restrict values)
1946b8e80941Smrg{
1947b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1948b8e80941Smrg
1949b8e80941Smrg   dw[0] =
1950b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
1951b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1952b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1953b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1954b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1955b8e80941Smrg
1956b8e80941Smrg   GEN7_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
1957b8e80941Smrg}
1958b8e80941Smrg
1959b8e80941Smrg#define GEN7_3DSTATE_CONSTANT_HS_length        7
1960b8e80941Smrg#define GEN7_3DSTATE_CONSTANT_HS_length_bias      2
1961b8e80941Smrg#define GEN7_3DSTATE_CONSTANT_HS_header         \
1962b8e80941Smrg   .DWordLength                         =      5,  \
1963b8e80941Smrg   ._3DCommandSubOpcode                 =     25,  \
1964b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
1965b8e80941Smrg   .CommandSubType                      =      3,  \
1966b8e80941Smrg   .CommandType                         =      3
1967b8e80941Smrg
1968b8e80941Smrgstruct GEN7_3DSTATE_CONSTANT_HS {
1969b8e80941Smrg   uint32_t                             DWordLength;
1970b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
1971b8e80941Smrg   uint32_t                             _3DCommandOpcode;
1972b8e80941Smrg   uint32_t                             CommandSubType;
1973b8e80941Smrg   uint32_t                             CommandType;
1974b8e80941Smrg   struct GEN7_3DSTATE_CONSTANT_BODY    ConstantBody;
1975b8e80941Smrg};
1976b8e80941Smrg
1977b8e80941Smrgstatic inline void
1978b8e80941SmrgGEN7_3DSTATE_CONSTANT_HS_pack(__attribute__((unused)) __gen_user_data *data,
1979b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
1980b8e80941Smrg                              __attribute__((unused)) const struct GEN7_3DSTATE_CONSTANT_HS * restrict values)
1981b8e80941Smrg{
1982b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
1983b8e80941Smrg
1984b8e80941Smrg   dw[0] =
1985b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
1986b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
1987b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
1988b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
1989b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
1990b8e80941Smrg
1991b8e80941Smrg   GEN7_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
1992b8e80941Smrg}
1993b8e80941Smrg
1994b8e80941Smrg#define GEN7_3DSTATE_CONSTANT_PS_length        7
1995b8e80941Smrg#define GEN7_3DSTATE_CONSTANT_PS_length_bias      2
1996b8e80941Smrg#define GEN7_3DSTATE_CONSTANT_PS_header         \
1997b8e80941Smrg   .DWordLength                         =      5,  \
1998b8e80941Smrg   ._3DCommandSubOpcode                 =     23,  \
1999b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2000b8e80941Smrg   .CommandSubType                      =      3,  \
2001b8e80941Smrg   .CommandType                         =      3
2002b8e80941Smrg
2003b8e80941Smrgstruct GEN7_3DSTATE_CONSTANT_PS {
2004b8e80941Smrg   uint32_t                             DWordLength;
2005b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2006b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2007b8e80941Smrg   uint32_t                             CommandSubType;
2008b8e80941Smrg   uint32_t                             CommandType;
2009b8e80941Smrg   struct GEN7_3DSTATE_CONSTANT_BODY    ConstantBody;
2010b8e80941Smrg};
2011b8e80941Smrg
2012b8e80941Smrgstatic inline void
2013b8e80941SmrgGEN7_3DSTATE_CONSTANT_PS_pack(__attribute__((unused)) __gen_user_data *data,
2014b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
2015b8e80941Smrg                              __attribute__((unused)) const struct GEN7_3DSTATE_CONSTANT_PS * restrict values)
2016b8e80941Smrg{
2017b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2018b8e80941Smrg
2019b8e80941Smrg   dw[0] =
2020b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2021b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2022b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2023b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2024b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2025b8e80941Smrg
2026b8e80941Smrg   GEN7_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
2027b8e80941Smrg}
2028b8e80941Smrg
2029b8e80941Smrg#define GEN7_3DSTATE_CONSTANT_VS_length        7
2030b8e80941Smrg#define GEN7_3DSTATE_CONSTANT_VS_length_bias      2
2031b8e80941Smrg#define GEN7_3DSTATE_CONSTANT_VS_header         \
2032b8e80941Smrg   .DWordLength                         =      5,  \
2033b8e80941Smrg   ._3DCommandSubOpcode                 =     21,  \
2034b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2035b8e80941Smrg   .CommandSubType                      =      3,  \
2036b8e80941Smrg   .CommandType                         =      3
2037b8e80941Smrg
2038b8e80941Smrgstruct GEN7_3DSTATE_CONSTANT_VS {
2039b8e80941Smrg   uint32_t                             DWordLength;
2040b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2041b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2042b8e80941Smrg   uint32_t                             CommandSubType;
2043b8e80941Smrg   uint32_t                             CommandType;
2044b8e80941Smrg   struct GEN7_3DSTATE_CONSTANT_BODY    ConstantBody;
2045b8e80941Smrg};
2046b8e80941Smrg
2047b8e80941Smrgstatic inline void
2048b8e80941SmrgGEN7_3DSTATE_CONSTANT_VS_pack(__attribute__((unused)) __gen_user_data *data,
2049b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
2050b8e80941Smrg                              __attribute__((unused)) const struct GEN7_3DSTATE_CONSTANT_VS * restrict values)
2051b8e80941Smrg{
2052b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2053b8e80941Smrg
2054b8e80941Smrg   dw[0] =
2055b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2056b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2057b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2058b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2059b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2060b8e80941Smrg
2061b8e80941Smrg   GEN7_3DSTATE_CONSTANT_BODY_pack(data, &dw[1], &values->ConstantBody);
2062b8e80941Smrg}
2063b8e80941Smrg
2064b8e80941Smrg#define GEN7_3DSTATE_DEPTH_BUFFER_length       7
2065b8e80941Smrg#define GEN7_3DSTATE_DEPTH_BUFFER_length_bias      2
2066b8e80941Smrg#define GEN7_3DSTATE_DEPTH_BUFFER_header        \
2067b8e80941Smrg   .DWordLength                         =      5,  \
2068b8e80941Smrg   ._3DCommandSubOpcode                 =      5,  \
2069b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2070b8e80941Smrg   .CommandSubType                      =      3,  \
2071b8e80941Smrg   .CommandType                         =      3
2072b8e80941Smrg
2073b8e80941Smrgstruct GEN7_3DSTATE_DEPTH_BUFFER {
2074b8e80941Smrg   uint32_t                             DWordLength;
2075b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2076b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2077b8e80941Smrg   uint32_t                             CommandSubType;
2078b8e80941Smrg   uint32_t                             CommandType;
2079b8e80941Smrg   uint32_t                             SurfacePitch;
2080b8e80941Smrg   uint32_t                             SurfaceFormat;
2081b8e80941Smrg#define D32_FLOAT                                1
2082b8e80941Smrg#define D24_UNORM_X8_UINT                        3
2083b8e80941Smrg#define D16_UNORM                                5
2084b8e80941Smrg   bool                                 HierarchicalDepthBufferEnable;
2085b8e80941Smrg   bool                                 StencilWriteEnable;
2086b8e80941Smrg   bool                                 DepthWriteEnable;
2087b8e80941Smrg   uint32_t                             SurfaceType;
2088b8e80941Smrg#define SURFTYPE_1D                              0
2089b8e80941Smrg#define SURFTYPE_2D                              1
2090b8e80941Smrg#define SURFTYPE_3D                              2
2091b8e80941Smrg#define SURFTYPE_CUBE                            3
2092b8e80941Smrg#define SURFTYPE_NULL                            7
2093b8e80941Smrg   __gen_address_type                   SurfaceBaseAddress;
2094b8e80941Smrg   uint32_t                             LOD;
2095b8e80941Smrg   uint32_t                             Width;
2096b8e80941Smrg   uint32_t                             Height;
2097b8e80941Smrg   uint32_t                             MOCS;
2098b8e80941Smrg   uint32_t                             MinimumArrayElement;
2099b8e80941Smrg   uint32_t                             Depth;
2100b8e80941Smrg#define SURFTYPE_CUBEmustbezero                  0
2101b8e80941Smrg   int32_t                              DepthCoordinateOffsetX;
2102b8e80941Smrg   int32_t                              DepthCoordinateOffsetY;
2103b8e80941Smrg   uint32_t                             RenderTargetViewExtent;
2104b8e80941Smrg};
2105b8e80941Smrg
2106b8e80941Smrgstatic inline void
2107b8e80941SmrgGEN7_3DSTATE_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
2108b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
2109b8e80941Smrg                               __attribute__((unused)) const struct GEN7_3DSTATE_DEPTH_BUFFER * restrict values)
2110b8e80941Smrg{
2111b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2112b8e80941Smrg
2113b8e80941Smrg   dw[0] =
2114b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2115b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2116b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2117b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2118b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2119b8e80941Smrg
2120b8e80941Smrg   dw[1] =
2121b8e80941Smrg      __gen_uint(values->SurfacePitch, 0, 17) |
2122b8e80941Smrg      __gen_uint(values->SurfaceFormat, 18, 20) |
2123b8e80941Smrg      __gen_uint(values->HierarchicalDepthBufferEnable, 22, 22) |
2124b8e80941Smrg      __gen_uint(values->StencilWriteEnable, 27, 27) |
2125b8e80941Smrg      __gen_uint(values->DepthWriteEnable, 28, 28) |
2126b8e80941Smrg      __gen_uint(values->SurfaceType, 29, 31);
2127b8e80941Smrg
2128b8e80941Smrg   dw[2] = __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
2129b8e80941Smrg
2130b8e80941Smrg   dw[3] =
2131b8e80941Smrg      __gen_uint(values->LOD, 0, 3) |
2132b8e80941Smrg      __gen_uint(values->Width, 4, 17) |
2133b8e80941Smrg      __gen_uint(values->Height, 18, 31);
2134b8e80941Smrg
2135b8e80941Smrg   dw[4] =
2136b8e80941Smrg      __gen_uint(values->MOCS, 0, 3) |
2137b8e80941Smrg      __gen_uint(values->MinimumArrayElement, 10, 20) |
2138b8e80941Smrg      __gen_uint(values->Depth, 21, 31);
2139b8e80941Smrg
2140b8e80941Smrg   dw[5] =
2141b8e80941Smrg      __gen_sint(values->DepthCoordinateOffsetX, 0, 15) |
2142b8e80941Smrg      __gen_sint(values->DepthCoordinateOffsetY, 16, 31);
2143b8e80941Smrg
2144b8e80941Smrg   dw[6] =
2145b8e80941Smrg      __gen_uint(values->RenderTargetViewExtent, 21, 31);
2146b8e80941Smrg}
2147b8e80941Smrg
2148b8e80941Smrg#define GEN7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS_length      2
2149b8e80941Smrg#define GEN7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS_length_bias      2
2150b8e80941Smrg#define GEN7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS_header\
2151b8e80941Smrg   .DWordLength                         =      0,  \
2152b8e80941Smrg   ._3DCommandSubOpcode                 =     37,  \
2153b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2154b8e80941Smrg   .CommandSubType                      =      3,  \
2155b8e80941Smrg   .CommandType                         =      3
2156b8e80941Smrg
2157b8e80941Smrgstruct GEN7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS {
2158b8e80941Smrg   uint32_t                             DWordLength;
2159b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2160b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2161b8e80941Smrg   uint32_t                             CommandSubType;
2162b8e80941Smrg   uint32_t                             CommandType;
2163b8e80941Smrg   uint64_t                             PointertoDEPTH_STENCIL_STATE;
2164b8e80941Smrg};
2165b8e80941Smrg
2166b8e80941Smrgstatic inline void
2167b8e80941SmrgGEN7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
2168b8e80941Smrg                                               __attribute__((unused)) void * restrict dst,
2169b8e80941Smrg                                               __attribute__((unused)) const struct GEN7_3DSTATE_DEPTH_STENCIL_STATE_POINTERS * restrict values)
2170b8e80941Smrg{
2171b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2172b8e80941Smrg
2173b8e80941Smrg   dw[0] =
2174b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2175b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2176b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2177b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2178b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2179b8e80941Smrg
2180b8e80941Smrg   dw[1] =
2181b8e80941Smrg      __gen_mbo(0, 0) |
2182b8e80941Smrg      __gen_offset(values->PointertoDEPTH_STENCIL_STATE, 6, 31);
2183b8e80941Smrg}
2184b8e80941Smrg
2185b8e80941Smrg#define GEN7_3DSTATE_DRAWING_RECTANGLE_length      4
2186b8e80941Smrg#define GEN7_3DSTATE_DRAWING_RECTANGLE_length_bias      2
2187b8e80941Smrg#define GEN7_3DSTATE_DRAWING_RECTANGLE_header   \
2188b8e80941Smrg   .DWordLength                         =      2,  \
2189b8e80941Smrg   ._3DCommandSubOpcode                 =      0,  \
2190b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
2191b8e80941Smrg   .CommandSubType                      =      3,  \
2192b8e80941Smrg   .CommandType                         =      3
2193b8e80941Smrg
2194b8e80941Smrgstruct GEN7_3DSTATE_DRAWING_RECTANGLE {
2195b8e80941Smrg   uint32_t                             DWordLength;
2196b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2197b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2198b8e80941Smrg   uint32_t                             CommandSubType;
2199b8e80941Smrg   uint32_t                             CommandType;
2200b8e80941Smrg   uint32_t                             ClippedDrawingRectangleXMin;
2201b8e80941Smrg   uint32_t                             ClippedDrawingRectangleYMin;
2202b8e80941Smrg   uint32_t                             ClippedDrawingRectangleXMax;
2203b8e80941Smrg   uint32_t                             ClippedDrawingRectangleYMax;
2204b8e80941Smrg   int32_t                              DrawingRectangleOriginX;
2205b8e80941Smrg   int32_t                              DrawingRectangleOriginY;
2206b8e80941Smrg};
2207b8e80941Smrg
2208b8e80941Smrgstatic inline void
2209b8e80941SmrgGEN7_3DSTATE_DRAWING_RECTANGLE_pack(__attribute__((unused)) __gen_user_data *data,
2210b8e80941Smrg                                    __attribute__((unused)) void * restrict dst,
2211b8e80941Smrg                                    __attribute__((unused)) const struct GEN7_3DSTATE_DRAWING_RECTANGLE * restrict values)
2212b8e80941Smrg{
2213b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2214b8e80941Smrg
2215b8e80941Smrg   dw[0] =
2216b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2217b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2218b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2219b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2220b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2221b8e80941Smrg
2222b8e80941Smrg   dw[1] =
2223b8e80941Smrg      __gen_uint(values->ClippedDrawingRectangleXMin, 0, 15) |
2224b8e80941Smrg      __gen_uint(values->ClippedDrawingRectangleYMin, 16, 31);
2225b8e80941Smrg
2226b8e80941Smrg   dw[2] =
2227b8e80941Smrg      __gen_uint(values->ClippedDrawingRectangleXMax, 0, 15) |
2228b8e80941Smrg      __gen_uint(values->ClippedDrawingRectangleYMax, 16, 31);
2229b8e80941Smrg
2230b8e80941Smrg   dw[3] =
2231b8e80941Smrg      __gen_sint(values->DrawingRectangleOriginX, 0, 15) |
2232b8e80941Smrg      __gen_sint(values->DrawingRectangleOriginY, 16, 31);
2233b8e80941Smrg}
2234b8e80941Smrg
2235b8e80941Smrg#define GEN7_3DSTATE_DS_length                 6
2236b8e80941Smrg#define GEN7_3DSTATE_DS_length_bias            2
2237b8e80941Smrg#define GEN7_3DSTATE_DS_header                  \
2238b8e80941Smrg   .DWordLength                         =      4,  \
2239b8e80941Smrg   ._3DCommandSubOpcode                 =     29,  \
2240b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2241b8e80941Smrg   .CommandSubType                      =      3,  \
2242b8e80941Smrg   .CommandType                         =      3
2243b8e80941Smrg
2244b8e80941Smrgstruct GEN7_3DSTATE_DS {
2245b8e80941Smrg   uint32_t                             DWordLength;
2246b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2247b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2248b8e80941Smrg   uint32_t                             CommandSubType;
2249b8e80941Smrg   uint32_t                             CommandType;
2250b8e80941Smrg   uint64_t                             KernelStartPointer;
2251b8e80941Smrg   bool                                 SoftwareExceptionEnable;
2252b8e80941Smrg   bool                                 IllegalOpcodeExceptionEnable;
2253b8e80941Smrg   uint32_t                             FloatingPointMode;
2254b8e80941Smrg#define IEEE754                                  0
2255b8e80941Smrg#define Alternate                                1
2256b8e80941Smrg   uint32_t                             BindingTableEntryCount;
2257b8e80941Smrg   uint32_t                             SamplerCount;
2258b8e80941Smrg#define NoSamplers                               0
2259b8e80941Smrg#define _14Samplers                              1
2260b8e80941Smrg#define _58Samplers                              2
2261b8e80941Smrg#define _912Samplers                             3
2262b8e80941Smrg#define _1316Samplers                            4
2263b8e80941Smrg   bool                                 VectorMaskEnable;
2264b8e80941Smrg   uint32_t                             SingleDomainPointDispatch;
2265b8e80941Smrg   uint32_t                             PerThreadScratchSpace;
2266b8e80941Smrg   __gen_address_type                   ScratchSpaceBasePointer;
2267b8e80941Smrg   uint32_t                             PatchURBEntryReadOffset;
2268b8e80941Smrg   uint32_t                             PatchURBEntryReadLength;
2269b8e80941Smrg   uint32_t                             DispatchGRFStartRegisterForURBData;
2270b8e80941Smrg   bool                                 Enable;
2271b8e80941Smrg   bool                                 DSCacheDisable;
2272b8e80941Smrg   bool                                 ComputeWCoordinateEnable;
2273b8e80941Smrg   bool                                 StatisticsEnable;
2274b8e80941Smrg   uint32_t                             MaximumNumberofThreads;
2275b8e80941Smrg};
2276b8e80941Smrg
2277b8e80941Smrgstatic inline void
2278b8e80941SmrgGEN7_3DSTATE_DS_pack(__attribute__((unused)) __gen_user_data *data,
2279b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
2280b8e80941Smrg                     __attribute__((unused)) const struct GEN7_3DSTATE_DS * restrict values)
2281b8e80941Smrg{
2282b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2283b8e80941Smrg
2284b8e80941Smrg   dw[0] =
2285b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2286b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2287b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2288b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2289b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2290b8e80941Smrg
2291b8e80941Smrg   dw[1] =
2292b8e80941Smrg      __gen_offset(values->KernelStartPointer, 6, 31);
2293b8e80941Smrg
2294b8e80941Smrg   dw[2] =
2295b8e80941Smrg      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
2296b8e80941Smrg      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
2297b8e80941Smrg      __gen_uint(values->FloatingPointMode, 16, 16) |
2298b8e80941Smrg      __gen_uint(values->BindingTableEntryCount, 18, 25) |
2299b8e80941Smrg      __gen_uint(values->SamplerCount, 27, 29) |
2300b8e80941Smrg      __gen_uint(values->VectorMaskEnable, 30, 30) |
2301b8e80941Smrg      __gen_uint(values->SingleDomainPointDispatch, 31, 31);
2302b8e80941Smrg
2303b8e80941Smrg   const uint32_t v3 =
2304b8e80941Smrg      __gen_uint(values->PerThreadScratchSpace, 0, 3);
2305b8e80941Smrg   dw[3] = __gen_combine_address(data, &dw[3], values->ScratchSpaceBasePointer, v3);
2306b8e80941Smrg
2307b8e80941Smrg   dw[4] =
2308b8e80941Smrg      __gen_uint(values->PatchURBEntryReadOffset, 4, 9) |
2309b8e80941Smrg      __gen_uint(values->PatchURBEntryReadLength, 11, 17) |
2310b8e80941Smrg      __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
2311b8e80941Smrg
2312b8e80941Smrg   dw[5] =
2313b8e80941Smrg      __gen_uint(values->Enable, 0, 0) |
2314b8e80941Smrg      __gen_uint(values->DSCacheDisable, 1, 1) |
2315b8e80941Smrg      __gen_uint(values->ComputeWCoordinateEnable, 2, 2) |
2316b8e80941Smrg      __gen_uint(values->StatisticsEnable, 10, 10) |
2317b8e80941Smrg      __gen_uint(values->MaximumNumberofThreads, 25, 31);
2318b8e80941Smrg}
2319b8e80941Smrg
2320b8e80941Smrg#define GEN7_3DSTATE_GS_length                 7
2321b8e80941Smrg#define GEN7_3DSTATE_GS_length_bias            2
2322b8e80941Smrg#define GEN7_3DSTATE_GS_header                  \
2323b8e80941Smrg   .DWordLength                         =      5,  \
2324b8e80941Smrg   ._3DCommandSubOpcode                 =     17,  \
2325b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2326b8e80941Smrg   .CommandSubType                      =      3,  \
2327b8e80941Smrg   .CommandType                         =      3
2328b8e80941Smrg
2329b8e80941Smrgstruct GEN7_3DSTATE_GS {
2330b8e80941Smrg   uint32_t                             DWordLength;
2331b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2332b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2333b8e80941Smrg   uint32_t                             CommandSubType;
2334b8e80941Smrg   uint32_t                             CommandType;
2335b8e80941Smrg   uint64_t                             KernelStartPointer;
2336b8e80941Smrg   bool                                 SoftwareExceptionEnable;
2337b8e80941Smrg   bool                                 MaskStackExceptionEnable;
2338b8e80941Smrg   bool                                 IllegalOpcodeExceptionEnable;
2339b8e80941Smrg   uint32_t                             FloatingPointMode;
2340b8e80941Smrg#define IEEE754                                  0
2341b8e80941Smrg#define alternate                                1
2342b8e80941Smrg   uint32_t                             ThreadPriority;
2343b8e80941Smrg#define NormalPriority                           0
2344b8e80941Smrg#define HighPriority                             1
2345b8e80941Smrg   uint32_t                             BindingTableEntryCount;
2346b8e80941Smrg   uint32_t                             SamplerCount;
2347b8e80941Smrg#define NoSamplers                               0
2348b8e80941Smrg#define _14Samplers                              1
2349b8e80941Smrg#define _58Samplers                              2
2350b8e80941Smrg#define _912Samplers                             3
2351b8e80941Smrg#define _1316Samplers                            4
2352b8e80941Smrg   bool                                 VectorMaskEnable;
2353b8e80941Smrg   bool                                 SingleProgramFlow;
2354b8e80941Smrg   uint32_t                             PerThreadScratchSpace;
2355b8e80941Smrg   __gen_address_type                   ScratchSpaceBasePointer;
2356b8e80941Smrg   uint32_t                             DispatchGRFStartRegisterForURBData;
2357b8e80941Smrg   uint32_t                             VertexURBEntryReadOffset;
2358b8e80941Smrg   bool                                 IncludeVertexHandles;
2359b8e80941Smrg   uint32_t                             VertexURBEntryReadLength;
2360b8e80941Smrg   enum GEN7_3D_Prim_Topo_Type          OutputTopology;
2361b8e80941Smrg   uint32_t                             OutputVertexSize;
2362b8e80941Smrg   bool                                 Enable;
2363b8e80941Smrg   bool                                 DiscardAdjacency;
2364b8e80941Smrg   uint32_t                             ReorderMode;
2365b8e80941Smrg#define LEADING                                  0
2366b8e80941Smrg#define TRAILING                                 1
2367b8e80941Smrg   uint32_t                             Hint;
2368b8e80941Smrg   bool                                 IncludePrimitiveID;
2369b8e80941Smrg   uint32_t                             GSInvocationsIncrementValue;
2370b8e80941Smrg   uint32_t                             StatisticsEnable;
2371b8e80941Smrg   uint32_t                             DispatchMode;
2372b8e80941Smrg#define DISPATCH_MODE_SINGLE                     0
2373b8e80941Smrg#define DISPATCH_MODE_DUAL_INSTANCE              1
2374b8e80941Smrg#define DISPATCH_MODE_DUAL_OBJECT                2
2375b8e80941Smrg   uint32_t                             DefaultStreamID;
2376b8e80941Smrg   uint32_t                             InstanceControl;
2377b8e80941Smrg   uint32_t                             ControlDataHeaderSize;
2378b8e80941Smrg   uint32_t                             ControlDataFormat;
2379b8e80941Smrg#define GSCTL_CUT                                0
2380b8e80941Smrg#define GSCTL_SID                                1
2381b8e80941Smrg   uint32_t                             MaximumNumberofThreads;
2382b8e80941Smrg   uint64_t                             SemaphoreHandle;
2383b8e80941Smrg};
2384b8e80941Smrg
2385b8e80941Smrgstatic inline void
2386b8e80941SmrgGEN7_3DSTATE_GS_pack(__attribute__((unused)) __gen_user_data *data,
2387b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
2388b8e80941Smrg                     __attribute__((unused)) const struct GEN7_3DSTATE_GS * restrict values)
2389b8e80941Smrg{
2390b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2391b8e80941Smrg
2392b8e80941Smrg   dw[0] =
2393b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2394b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2395b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2396b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2397b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2398b8e80941Smrg
2399b8e80941Smrg   dw[1] =
2400b8e80941Smrg      __gen_offset(values->KernelStartPointer, 6, 31);
2401b8e80941Smrg
2402b8e80941Smrg   dw[2] =
2403b8e80941Smrg      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
2404b8e80941Smrg      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
2405b8e80941Smrg      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
2406b8e80941Smrg      __gen_uint(values->FloatingPointMode, 16, 16) |
2407b8e80941Smrg      __gen_uint(values->ThreadPriority, 17, 17) |
2408b8e80941Smrg      __gen_uint(values->BindingTableEntryCount, 18, 25) |
2409b8e80941Smrg      __gen_uint(values->SamplerCount, 27, 29) |
2410b8e80941Smrg      __gen_uint(values->VectorMaskEnable, 30, 30) |
2411b8e80941Smrg      __gen_uint(values->SingleProgramFlow, 31, 31);
2412b8e80941Smrg
2413b8e80941Smrg   const uint32_t v3 =
2414b8e80941Smrg      __gen_uint(values->PerThreadScratchSpace, 0, 3);
2415b8e80941Smrg   dw[3] = __gen_combine_address(data, &dw[3], values->ScratchSpaceBasePointer, v3);
2416b8e80941Smrg
2417b8e80941Smrg   dw[4] =
2418b8e80941Smrg      __gen_uint(values->DispatchGRFStartRegisterForURBData, 0, 3) |
2419b8e80941Smrg      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
2420b8e80941Smrg      __gen_uint(values->IncludeVertexHandles, 10, 10) |
2421b8e80941Smrg      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
2422b8e80941Smrg      __gen_uint(values->OutputTopology, 17, 22) |
2423b8e80941Smrg      __gen_uint(values->OutputVertexSize, 23, 28);
2424b8e80941Smrg
2425b8e80941Smrg   dw[5] =
2426b8e80941Smrg      __gen_uint(values->Enable, 0, 0) |
2427b8e80941Smrg      __gen_uint(values->DiscardAdjacency, 1, 1) |
2428b8e80941Smrg      __gen_uint(values->ReorderMode, 2, 2) |
2429b8e80941Smrg      __gen_uint(values->Hint, 3, 3) |
2430b8e80941Smrg      __gen_uint(values->IncludePrimitiveID, 4, 4) |
2431b8e80941Smrg      __gen_uint(values->GSInvocationsIncrementValue, 5, 9) |
2432b8e80941Smrg      __gen_uint(values->StatisticsEnable, 10, 10) |
2433b8e80941Smrg      __gen_uint(values->DispatchMode, 11, 12) |
2434b8e80941Smrg      __gen_uint(values->DefaultStreamID, 13, 14) |
2435b8e80941Smrg      __gen_uint(values->InstanceControl, 15, 19) |
2436b8e80941Smrg      __gen_uint(values->ControlDataHeaderSize, 20, 23) |
2437b8e80941Smrg      __gen_uint(values->ControlDataFormat, 24, 24) |
2438b8e80941Smrg      __gen_uint(values->MaximumNumberofThreads, 25, 31);
2439b8e80941Smrg
2440b8e80941Smrg   dw[6] =
2441b8e80941Smrg      __gen_offset(values->SemaphoreHandle, 0, 11);
2442b8e80941Smrg}
2443b8e80941Smrg
2444b8e80941Smrg#define GEN7_3DSTATE_HIER_DEPTH_BUFFER_length      3
2445b8e80941Smrg#define GEN7_3DSTATE_HIER_DEPTH_BUFFER_length_bias      2
2446b8e80941Smrg#define GEN7_3DSTATE_HIER_DEPTH_BUFFER_header   \
2447b8e80941Smrg   .DWordLength                         =      1,  \
2448b8e80941Smrg   ._3DCommandSubOpcode                 =      7,  \
2449b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2450b8e80941Smrg   .CommandSubType                      =      3,  \
2451b8e80941Smrg   .CommandType                         =      3
2452b8e80941Smrg
2453b8e80941Smrgstruct GEN7_3DSTATE_HIER_DEPTH_BUFFER {
2454b8e80941Smrg   uint32_t                             DWordLength;
2455b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2456b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2457b8e80941Smrg   uint32_t                             CommandSubType;
2458b8e80941Smrg   uint32_t                             CommandType;
2459b8e80941Smrg   uint32_t                             SurfacePitch;
2460b8e80941Smrg   uint32_t                             MOCS;
2461b8e80941Smrg   __gen_address_type                   SurfaceBaseAddress;
2462b8e80941Smrg};
2463b8e80941Smrg
2464b8e80941Smrgstatic inline void
2465b8e80941SmrgGEN7_3DSTATE_HIER_DEPTH_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
2466b8e80941Smrg                                    __attribute__((unused)) void * restrict dst,
2467b8e80941Smrg                                    __attribute__((unused)) const struct GEN7_3DSTATE_HIER_DEPTH_BUFFER * restrict values)
2468b8e80941Smrg{
2469b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2470b8e80941Smrg
2471b8e80941Smrg   dw[0] =
2472b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2473b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2474b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2475b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2476b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2477b8e80941Smrg
2478b8e80941Smrg   dw[1] =
2479b8e80941Smrg      __gen_uint(values->SurfacePitch, 0, 16) |
2480b8e80941Smrg      __gen_uint(values->MOCS, 25, 28);
2481b8e80941Smrg
2482b8e80941Smrg   dw[2] = __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
2483b8e80941Smrg}
2484b8e80941Smrg
2485b8e80941Smrg#define GEN7_3DSTATE_HS_length                 7
2486b8e80941Smrg#define GEN7_3DSTATE_HS_length_bias            2
2487b8e80941Smrg#define GEN7_3DSTATE_HS_header                  \
2488b8e80941Smrg   .DWordLength                         =      5,  \
2489b8e80941Smrg   ._3DCommandSubOpcode                 =     27,  \
2490b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2491b8e80941Smrg   .CommandSubType                      =      3,  \
2492b8e80941Smrg   .CommandType                         =      3
2493b8e80941Smrg
2494b8e80941Smrgstruct GEN7_3DSTATE_HS {
2495b8e80941Smrg   uint32_t                             DWordLength;
2496b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2497b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2498b8e80941Smrg   uint32_t                             CommandSubType;
2499b8e80941Smrg   uint32_t                             CommandType;
2500b8e80941Smrg   uint32_t                             MaximumNumberofThreads;
2501b8e80941Smrg   bool                                 SoftwareExceptionEnable;
2502b8e80941Smrg   bool                                 IllegalOpcodeExceptionEnable;
2503b8e80941Smrg   uint32_t                             FloatingPointMode;
2504b8e80941Smrg#define IEEE754                                  0
2505b8e80941Smrg#define alternate                                1
2506b8e80941Smrg   uint32_t                             BindingTableEntryCount;
2507b8e80941Smrg   uint32_t                             SamplerCount;
2508b8e80941Smrg#define NoSamplers                               0
2509b8e80941Smrg#define _14Samplers                              1
2510b8e80941Smrg#define _58Samplers                              2
2511b8e80941Smrg#define _912Samplers                             3
2512b8e80941Smrg#define _1316Samplers                            4
2513b8e80941Smrg   uint32_t                             InstanceCount;
2514b8e80941Smrg   bool                                 StatisticsEnable;
2515b8e80941Smrg   bool                                 Enable;
2516b8e80941Smrg   uint64_t                             KernelStartPointer;
2517b8e80941Smrg   uint32_t                             PerThreadScratchSpace;
2518b8e80941Smrg   __gen_address_type                   ScratchSpaceBasePointer;
2519b8e80941Smrg   uint32_t                             VertexURBEntryReadOffset;
2520b8e80941Smrg   uint32_t                             VertexURBEntryReadLength;
2521b8e80941Smrg   uint32_t                             DispatchGRFStartRegisterForURBData;
2522b8e80941Smrg   bool                                 IncludeVertexHandles;
2523b8e80941Smrg   bool                                 VectorMaskEnable;
2524b8e80941Smrg   bool                                 SingleProgramFlow;
2525b8e80941Smrg   uint64_t                             SemaphoreHandle;
2526b8e80941Smrg};
2527b8e80941Smrg
2528b8e80941Smrgstatic inline void
2529b8e80941SmrgGEN7_3DSTATE_HS_pack(__attribute__((unused)) __gen_user_data *data,
2530b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
2531b8e80941Smrg                     __attribute__((unused)) const struct GEN7_3DSTATE_HS * restrict values)
2532b8e80941Smrg{
2533b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2534b8e80941Smrg
2535b8e80941Smrg   dw[0] =
2536b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2537b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2538b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2539b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2540b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2541b8e80941Smrg
2542b8e80941Smrg   dw[1] =
2543b8e80941Smrg      __gen_uint(values->MaximumNumberofThreads, 0, 6) |
2544b8e80941Smrg      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
2545b8e80941Smrg      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
2546b8e80941Smrg      __gen_uint(values->FloatingPointMode, 16, 16) |
2547b8e80941Smrg      __gen_uint(values->BindingTableEntryCount, 18, 25) |
2548b8e80941Smrg      __gen_uint(values->SamplerCount, 27, 29);
2549b8e80941Smrg
2550b8e80941Smrg   dw[2] =
2551b8e80941Smrg      __gen_uint(values->InstanceCount, 0, 3) |
2552b8e80941Smrg      __gen_uint(values->StatisticsEnable, 29, 29) |
2553b8e80941Smrg      __gen_uint(values->Enable, 31, 31);
2554b8e80941Smrg
2555b8e80941Smrg   dw[3] =
2556b8e80941Smrg      __gen_offset(values->KernelStartPointer, 6, 31);
2557b8e80941Smrg
2558b8e80941Smrg   const uint32_t v4 =
2559b8e80941Smrg      __gen_uint(values->PerThreadScratchSpace, 0, 3);
2560b8e80941Smrg   dw[4] = __gen_combine_address(data, &dw[4], values->ScratchSpaceBasePointer, v4);
2561b8e80941Smrg
2562b8e80941Smrg   dw[5] =
2563b8e80941Smrg      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
2564b8e80941Smrg      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
2565b8e80941Smrg      __gen_uint(values->DispatchGRFStartRegisterForURBData, 19, 23) |
2566b8e80941Smrg      __gen_uint(values->IncludeVertexHandles, 24, 24) |
2567b8e80941Smrg      __gen_uint(values->VectorMaskEnable, 26, 26) |
2568b8e80941Smrg      __gen_uint(values->SingleProgramFlow, 27, 27);
2569b8e80941Smrg
2570b8e80941Smrg   dw[6] =
2571b8e80941Smrg      __gen_offset(values->SemaphoreHandle, 0, 11);
2572b8e80941Smrg}
2573b8e80941Smrg
2574b8e80941Smrg#define GEN7_3DSTATE_INDEX_BUFFER_length       3
2575b8e80941Smrg#define GEN7_3DSTATE_INDEX_BUFFER_length_bias      2
2576b8e80941Smrg#define GEN7_3DSTATE_INDEX_BUFFER_header        \
2577b8e80941Smrg   .DWordLength                         =      1,  \
2578b8e80941Smrg   ._3DCommandSubOpcode                 =     10,  \
2579b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2580b8e80941Smrg   .CommandSubType                      =      3,  \
2581b8e80941Smrg   .CommandType                         =      3
2582b8e80941Smrg
2583b8e80941Smrgstruct GEN7_3DSTATE_INDEX_BUFFER {
2584b8e80941Smrg   uint32_t                             DWordLength;
2585b8e80941Smrg   uint32_t                             IndexFormat;
2586b8e80941Smrg#define INDEX_BYTE                               0
2587b8e80941Smrg#define INDEX_WORD                               1
2588b8e80941Smrg#define INDEX_DWORD                              2
2589b8e80941Smrg   bool                                 CutIndexEnable;
2590b8e80941Smrg   uint32_t                             MOCS;
2591b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2592b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2593b8e80941Smrg   uint32_t                             CommandSubType;
2594b8e80941Smrg   uint32_t                             CommandType;
2595b8e80941Smrg   __gen_address_type                   BufferStartingAddress;
2596b8e80941Smrg   __gen_address_type                   BufferEndingAddress;
2597b8e80941Smrg};
2598b8e80941Smrg
2599b8e80941Smrgstatic inline void
2600b8e80941SmrgGEN7_3DSTATE_INDEX_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
2601b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
2602b8e80941Smrg                               __attribute__((unused)) const struct GEN7_3DSTATE_INDEX_BUFFER * restrict values)
2603b8e80941Smrg{
2604b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2605b8e80941Smrg
2606b8e80941Smrg   dw[0] =
2607b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2608b8e80941Smrg      __gen_uint(values->IndexFormat, 8, 9) |
2609b8e80941Smrg      __gen_uint(values->CutIndexEnable, 10, 10) |
2610b8e80941Smrg      __gen_uint(values->MOCS, 12, 15) |
2611b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2612b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2613b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2614b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2615b8e80941Smrg
2616b8e80941Smrg   dw[1] = __gen_combine_address(data, &dw[1], values->BufferStartingAddress, 0);
2617b8e80941Smrg
2618b8e80941Smrg   dw[2] = __gen_combine_address(data, &dw[2], values->BufferEndingAddress, 0);
2619b8e80941Smrg}
2620b8e80941Smrg
2621b8e80941Smrg#define GEN7_3DSTATE_LINE_STIPPLE_length       3
2622b8e80941Smrg#define GEN7_3DSTATE_LINE_STIPPLE_length_bias      2
2623b8e80941Smrg#define GEN7_3DSTATE_LINE_STIPPLE_header        \
2624b8e80941Smrg   .DWordLength                         =      1,  \
2625b8e80941Smrg   ._3DCommandSubOpcode                 =      8,  \
2626b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
2627b8e80941Smrg   .CommandSubType                      =      3,  \
2628b8e80941Smrg   .CommandType                         =      3
2629b8e80941Smrg
2630b8e80941Smrgstruct GEN7_3DSTATE_LINE_STIPPLE {
2631b8e80941Smrg   uint32_t                             DWordLength;
2632b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2633b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2634b8e80941Smrg   uint32_t                             CommandSubType;
2635b8e80941Smrg   uint32_t                             CommandType;
2636b8e80941Smrg   uint32_t                             LineStipplePattern;
2637b8e80941Smrg   uint32_t                             CurrentStippleIndex;
2638b8e80941Smrg   uint32_t                             CurrentRepeatCounter;
2639b8e80941Smrg   bool                                 ModifyEnableCurrentRepeatCounterCurrentStippleIndex;
2640b8e80941Smrg   uint32_t                             LineStippleRepeatCount;
2641b8e80941Smrg   float                                LineStippleInverseRepeatCount;
2642b8e80941Smrg};
2643b8e80941Smrg
2644b8e80941Smrgstatic inline void
2645b8e80941SmrgGEN7_3DSTATE_LINE_STIPPLE_pack(__attribute__((unused)) __gen_user_data *data,
2646b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
2647b8e80941Smrg                               __attribute__((unused)) const struct GEN7_3DSTATE_LINE_STIPPLE * restrict values)
2648b8e80941Smrg{
2649b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2650b8e80941Smrg
2651b8e80941Smrg   dw[0] =
2652b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2653b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2654b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2655b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2656b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2657b8e80941Smrg
2658b8e80941Smrg   dw[1] =
2659b8e80941Smrg      __gen_uint(values->LineStipplePattern, 0, 15) |
2660b8e80941Smrg      __gen_uint(values->CurrentStippleIndex, 16, 19) |
2661b8e80941Smrg      __gen_uint(values->CurrentRepeatCounter, 21, 29) |
2662b8e80941Smrg      __gen_uint(values->ModifyEnableCurrentRepeatCounterCurrentStippleIndex, 31, 31);
2663b8e80941Smrg
2664b8e80941Smrg   dw[2] =
2665b8e80941Smrg      __gen_uint(values->LineStippleRepeatCount, 0, 8) |
2666b8e80941Smrg      __gen_ufixed(values->LineStippleInverseRepeatCount, 15, 31, 16);
2667b8e80941Smrg}
2668b8e80941Smrg
2669b8e80941Smrg#define GEN7_3DSTATE_MONOFILTER_SIZE_length      2
2670b8e80941Smrg#define GEN7_3DSTATE_MONOFILTER_SIZE_length_bias      2
2671b8e80941Smrg#define GEN7_3DSTATE_MONOFILTER_SIZE_header     \
2672b8e80941Smrg   .DWordLength                         =      0,  \
2673b8e80941Smrg   ._3DCommandSubOpcode                 =     17,  \
2674b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
2675b8e80941Smrg   .CommandSubType                      =      3,  \
2676b8e80941Smrg   .CommandType                         =      3
2677b8e80941Smrg
2678b8e80941Smrgstruct GEN7_3DSTATE_MONOFILTER_SIZE {
2679b8e80941Smrg   uint32_t                             DWordLength;
2680b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2681b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2682b8e80941Smrg   uint32_t                             CommandSubType;
2683b8e80941Smrg   uint32_t                             CommandType;
2684b8e80941Smrg   uint32_t                             MonochromeFilterHeight;
2685b8e80941Smrg   uint32_t                             MonochromeFilterWidth;
2686b8e80941Smrg};
2687b8e80941Smrg
2688b8e80941Smrgstatic inline void
2689b8e80941SmrgGEN7_3DSTATE_MONOFILTER_SIZE_pack(__attribute__((unused)) __gen_user_data *data,
2690b8e80941Smrg                                  __attribute__((unused)) void * restrict dst,
2691b8e80941Smrg                                  __attribute__((unused)) const struct GEN7_3DSTATE_MONOFILTER_SIZE * restrict values)
2692b8e80941Smrg{
2693b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2694b8e80941Smrg
2695b8e80941Smrg   dw[0] =
2696b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2697b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2698b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2699b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2700b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2701b8e80941Smrg
2702b8e80941Smrg   dw[1] =
2703b8e80941Smrg      __gen_uint(values->MonochromeFilterHeight, 0, 2) |
2704b8e80941Smrg      __gen_uint(values->MonochromeFilterWidth, 3, 5);
2705b8e80941Smrg}
2706b8e80941Smrg
2707b8e80941Smrg#define GEN7_3DSTATE_MULTISAMPLE_length        4
2708b8e80941Smrg#define GEN7_3DSTATE_MULTISAMPLE_length_bias      2
2709b8e80941Smrg#define GEN7_3DSTATE_MULTISAMPLE_header         \
2710b8e80941Smrg   .DWordLength                         =      2,  \
2711b8e80941Smrg   ._3DCommandSubOpcode                 =     13,  \
2712b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
2713b8e80941Smrg   .CommandSubType                      =      3,  \
2714b8e80941Smrg   .CommandType                         =      3
2715b8e80941Smrg
2716b8e80941Smrgstruct GEN7_3DSTATE_MULTISAMPLE {
2717b8e80941Smrg   uint32_t                             DWordLength;
2718b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2719b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2720b8e80941Smrg   uint32_t                             CommandSubType;
2721b8e80941Smrg   uint32_t                             CommandType;
2722b8e80941Smrg   uint32_t                             NumberofMultisamples;
2723b8e80941Smrg#define NUMSAMPLES_1                             0
2724b8e80941Smrg#define NUMSAMPLES_4                             2
2725b8e80941Smrg#define NUMSAMPLES_8                             3
2726b8e80941Smrg   uint32_t                             PixelLocation;
2727b8e80941Smrg#define CENTER                                   0
2728b8e80941Smrg#define UL_CORNER                                1
2729b8e80941Smrg   float                                Sample0YOffset;
2730b8e80941Smrg   float                                Sample0XOffset;
2731b8e80941Smrg   float                                Sample1YOffset;
2732b8e80941Smrg   float                                Sample1XOffset;
2733b8e80941Smrg   float                                Sample2YOffset;
2734b8e80941Smrg   float                                Sample2XOffset;
2735b8e80941Smrg   float                                Sample3YOffset;
2736b8e80941Smrg   float                                Sample3XOffset;
2737b8e80941Smrg   float                                Sample4YOffset;
2738b8e80941Smrg   float                                Sample4XOffset;
2739b8e80941Smrg   float                                Sample5YOffset;
2740b8e80941Smrg   float                                Sample5XOffset;
2741b8e80941Smrg   float                                Sample6YOffset;
2742b8e80941Smrg   float                                Sample6XOffset;
2743b8e80941Smrg   float                                Sample7YOffset;
2744b8e80941Smrg   float                                Sample7XOffset;
2745b8e80941Smrg};
2746b8e80941Smrg
2747b8e80941Smrgstatic inline void
2748b8e80941SmrgGEN7_3DSTATE_MULTISAMPLE_pack(__attribute__((unused)) __gen_user_data *data,
2749b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
2750b8e80941Smrg                              __attribute__((unused)) const struct GEN7_3DSTATE_MULTISAMPLE * restrict values)
2751b8e80941Smrg{
2752b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2753b8e80941Smrg
2754b8e80941Smrg   dw[0] =
2755b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2756b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2757b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2758b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2759b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2760b8e80941Smrg
2761b8e80941Smrg   dw[1] =
2762b8e80941Smrg      __gen_uint(values->NumberofMultisamples, 1, 3) |
2763b8e80941Smrg      __gen_uint(values->PixelLocation, 4, 4);
2764b8e80941Smrg
2765b8e80941Smrg   dw[2] =
2766b8e80941Smrg      __gen_ufixed(values->Sample0YOffset, 0, 3, 4) |
2767b8e80941Smrg      __gen_ufixed(values->Sample0XOffset, 4, 7, 4) |
2768b8e80941Smrg      __gen_ufixed(values->Sample1YOffset, 8, 11, 4) |
2769b8e80941Smrg      __gen_ufixed(values->Sample1XOffset, 12, 15, 4) |
2770b8e80941Smrg      __gen_ufixed(values->Sample2YOffset, 16, 19, 4) |
2771b8e80941Smrg      __gen_ufixed(values->Sample2XOffset, 20, 23, 4) |
2772b8e80941Smrg      __gen_ufixed(values->Sample3YOffset, 24, 27, 4) |
2773b8e80941Smrg      __gen_ufixed(values->Sample3XOffset, 28, 31, 4);
2774b8e80941Smrg
2775b8e80941Smrg   dw[3] =
2776b8e80941Smrg      __gen_ufixed(values->Sample4YOffset, 0, 3, 4) |
2777b8e80941Smrg      __gen_ufixed(values->Sample4XOffset, 4, 7, 4) |
2778b8e80941Smrg      __gen_ufixed(values->Sample5YOffset, 8, 11, 4) |
2779b8e80941Smrg      __gen_ufixed(values->Sample5XOffset, 12, 15, 4) |
2780b8e80941Smrg      __gen_ufixed(values->Sample6YOffset, 16, 19, 4) |
2781b8e80941Smrg      __gen_ufixed(values->Sample6XOffset, 20, 23, 4) |
2782b8e80941Smrg      __gen_ufixed(values->Sample7YOffset, 24, 27, 4) |
2783b8e80941Smrg      __gen_ufixed(values->Sample7XOffset, 28, 31, 4);
2784b8e80941Smrg}
2785b8e80941Smrg
2786b8e80941Smrg#define GEN7_3DSTATE_POLY_STIPPLE_OFFSET_length      2
2787b8e80941Smrg#define GEN7_3DSTATE_POLY_STIPPLE_OFFSET_length_bias      2
2788b8e80941Smrg#define GEN7_3DSTATE_POLY_STIPPLE_OFFSET_header \
2789b8e80941Smrg   .DWordLength                         =      0,  \
2790b8e80941Smrg   ._3DCommandSubOpcode                 =      6,  \
2791b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
2792b8e80941Smrg   .CommandSubType                      =      3,  \
2793b8e80941Smrg   .CommandType                         =      3
2794b8e80941Smrg
2795b8e80941Smrgstruct GEN7_3DSTATE_POLY_STIPPLE_OFFSET {
2796b8e80941Smrg   uint32_t                             DWordLength;
2797b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2798b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2799b8e80941Smrg   uint32_t                             CommandSubType;
2800b8e80941Smrg   uint32_t                             CommandType;
2801b8e80941Smrg   uint32_t                             PolygonStippleYOffset;
2802b8e80941Smrg   uint32_t                             PolygonStippleXOffset;
2803b8e80941Smrg};
2804b8e80941Smrg
2805b8e80941Smrgstatic inline void
2806b8e80941SmrgGEN7_3DSTATE_POLY_STIPPLE_OFFSET_pack(__attribute__((unused)) __gen_user_data *data,
2807b8e80941Smrg                                      __attribute__((unused)) void * restrict dst,
2808b8e80941Smrg                                      __attribute__((unused)) const struct GEN7_3DSTATE_POLY_STIPPLE_OFFSET * restrict values)
2809b8e80941Smrg{
2810b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2811b8e80941Smrg
2812b8e80941Smrg   dw[0] =
2813b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2814b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2815b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2816b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2817b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2818b8e80941Smrg
2819b8e80941Smrg   dw[1] =
2820b8e80941Smrg      __gen_uint(values->PolygonStippleYOffset, 0, 4) |
2821b8e80941Smrg      __gen_uint(values->PolygonStippleXOffset, 8, 12);
2822b8e80941Smrg}
2823b8e80941Smrg
2824b8e80941Smrg#define GEN7_3DSTATE_POLY_STIPPLE_PATTERN_length     33
2825b8e80941Smrg#define GEN7_3DSTATE_POLY_STIPPLE_PATTERN_length_bias      2
2826b8e80941Smrg#define GEN7_3DSTATE_POLY_STIPPLE_PATTERN_header\
2827b8e80941Smrg   .DWordLength                         =     31,  \
2828b8e80941Smrg   ._3DCommandSubOpcode                 =      7,  \
2829b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
2830b8e80941Smrg   .CommandSubType                      =      3,  \
2831b8e80941Smrg   .CommandType                         =      3
2832b8e80941Smrg
2833b8e80941Smrgstruct GEN7_3DSTATE_POLY_STIPPLE_PATTERN {
2834b8e80941Smrg   uint32_t                             DWordLength;
2835b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2836b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2837b8e80941Smrg   uint32_t                             CommandSubType;
2838b8e80941Smrg   uint32_t                             CommandType;
2839b8e80941Smrg   uint32_t                             PatternRow[32];
2840b8e80941Smrg};
2841b8e80941Smrg
2842b8e80941Smrgstatic inline void
2843b8e80941SmrgGEN7_3DSTATE_POLY_STIPPLE_PATTERN_pack(__attribute__((unused)) __gen_user_data *data,
2844b8e80941Smrg                                       __attribute__((unused)) void * restrict dst,
2845b8e80941Smrg                                       __attribute__((unused)) const struct GEN7_3DSTATE_POLY_STIPPLE_PATTERN * restrict values)
2846b8e80941Smrg{
2847b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
2848b8e80941Smrg
2849b8e80941Smrg   dw[0] =
2850b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
2851b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
2852b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
2853b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
2854b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
2855b8e80941Smrg
2856b8e80941Smrg   dw[1] =
2857b8e80941Smrg      __gen_uint(values->PatternRow[0], 0, 31);
2858b8e80941Smrg
2859b8e80941Smrg   dw[2] =
2860b8e80941Smrg      __gen_uint(values->PatternRow[1], 0, 31);
2861b8e80941Smrg
2862b8e80941Smrg   dw[3] =
2863b8e80941Smrg      __gen_uint(values->PatternRow[2], 0, 31);
2864b8e80941Smrg
2865b8e80941Smrg   dw[4] =
2866b8e80941Smrg      __gen_uint(values->PatternRow[3], 0, 31);
2867b8e80941Smrg
2868b8e80941Smrg   dw[5] =
2869b8e80941Smrg      __gen_uint(values->PatternRow[4], 0, 31);
2870b8e80941Smrg
2871b8e80941Smrg   dw[6] =
2872b8e80941Smrg      __gen_uint(values->PatternRow[5], 0, 31);
2873b8e80941Smrg
2874b8e80941Smrg   dw[7] =
2875b8e80941Smrg      __gen_uint(values->PatternRow[6], 0, 31);
2876b8e80941Smrg
2877b8e80941Smrg   dw[8] =
2878b8e80941Smrg      __gen_uint(values->PatternRow[7], 0, 31);
2879b8e80941Smrg
2880b8e80941Smrg   dw[9] =
2881b8e80941Smrg      __gen_uint(values->PatternRow[8], 0, 31);
2882b8e80941Smrg
2883b8e80941Smrg   dw[10] =
2884b8e80941Smrg      __gen_uint(values->PatternRow[9], 0, 31);
2885b8e80941Smrg
2886b8e80941Smrg   dw[11] =
2887b8e80941Smrg      __gen_uint(values->PatternRow[10], 0, 31);
2888b8e80941Smrg
2889b8e80941Smrg   dw[12] =
2890b8e80941Smrg      __gen_uint(values->PatternRow[11], 0, 31);
2891b8e80941Smrg
2892b8e80941Smrg   dw[13] =
2893b8e80941Smrg      __gen_uint(values->PatternRow[12], 0, 31);
2894b8e80941Smrg
2895b8e80941Smrg   dw[14] =
2896b8e80941Smrg      __gen_uint(values->PatternRow[13], 0, 31);
2897b8e80941Smrg
2898b8e80941Smrg   dw[15] =
2899b8e80941Smrg      __gen_uint(values->PatternRow[14], 0, 31);
2900b8e80941Smrg
2901b8e80941Smrg   dw[16] =
2902b8e80941Smrg      __gen_uint(values->PatternRow[15], 0, 31);
2903b8e80941Smrg
2904b8e80941Smrg   dw[17] =
2905b8e80941Smrg      __gen_uint(values->PatternRow[16], 0, 31);
2906b8e80941Smrg
2907b8e80941Smrg   dw[18] =
2908b8e80941Smrg      __gen_uint(values->PatternRow[17], 0, 31);
2909b8e80941Smrg
2910b8e80941Smrg   dw[19] =
2911b8e80941Smrg      __gen_uint(values->PatternRow[18], 0, 31);
2912b8e80941Smrg
2913b8e80941Smrg   dw[20] =
2914b8e80941Smrg      __gen_uint(values->PatternRow[19], 0, 31);
2915b8e80941Smrg
2916b8e80941Smrg   dw[21] =
2917b8e80941Smrg      __gen_uint(values->PatternRow[20], 0, 31);
2918b8e80941Smrg
2919b8e80941Smrg   dw[22] =
2920b8e80941Smrg      __gen_uint(values->PatternRow[21], 0, 31);
2921b8e80941Smrg
2922b8e80941Smrg   dw[23] =
2923b8e80941Smrg      __gen_uint(values->PatternRow[22], 0, 31);
2924b8e80941Smrg
2925b8e80941Smrg   dw[24] =
2926b8e80941Smrg      __gen_uint(values->PatternRow[23], 0, 31);
2927b8e80941Smrg
2928b8e80941Smrg   dw[25] =
2929b8e80941Smrg      __gen_uint(values->PatternRow[24], 0, 31);
2930b8e80941Smrg
2931b8e80941Smrg   dw[26] =
2932b8e80941Smrg      __gen_uint(values->PatternRow[25], 0, 31);
2933b8e80941Smrg
2934b8e80941Smrg   dw[27] =
2935b8e80941Smrg      __gen_uint(values->PatternRow[26], 0, 31);
2936b8e80941Smrg
2937b8e80941Smrg   dw[28] =
2938b8e80941Smrg      __gen_uint(values->PatternRow[27], 0, 31);
2939b8e80941Smrg
2940b8e80941Smrg   dw[29] =
2941b8e80941Smrg      __gen_uint(values->PatternRow[28], 0, 31);
2942b8e80941Smrg
2943b8e80941Smrg   dw[30] =
2944b8e80941Smrg      __gen_uint(values->PatternRow[29], 0, 31);
2945b8e80941Smrg
2946b8e80941Smrg   dw[31] =
2947b8e80941Smrg      __gen_uint(values->PatternRow[30], 0, 31);
2948b8e80941Smrg
2949b8e80941Smrg   dw[32] =
2950b8e80941Smrg      __gen_uint(values->PatternRow[31], 0, 31);
2951b8e80941Smrg}
2952b8e80941Smrg
2953b8e80941Smrg#define GEN7_3DSTATE_PS_length                 8
2954b8e80941Smrg#define GEN7_3DSTATE_PS_length_bias            2
2955b8e80941Smrg#define GEN7_3DSTATE_PS_header                  \
2956b8e80941Smrg   .DWordLength                         =      6,  \
2957b8e80941Smrg   ._3DCommandSubOpcode                 =     32,  \
2958b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
2959b8e80941Smrg   .CommandSubType                      =      3,  \
2960b8e80941Smrg   .CommandType                         =      3
2961b8e80941Smrg
2962b8e80941Smrgstruct GEN7_3DSTATE_PS {
2963b8e80941Smrg   uint32_t                             DWordLength;
2964b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
2965b8e80941Smrg   uint32_t                             _3DCommandOpcode;
2966b8e80941Smrg   uint32_t                             CommandSubType;
2967b8e80941Smrg   uint32_t                             CommandType;
2968b8e80941Smrg   uint64_t                             KernelStartPointer0;
2969b8e80941Smrg   bool                                 SoftwareExceptionEnable;
2970b8e80941Smrg   bool                                 MaskStackExceptionEnable;
2971b8e80941Smrg   bool                                 IllegalOpcodeExceptionEnable;
2972b8e80941Smrg   uint32_t                             RoundingMode;
2973b8e80941Smrg#define RTNE                                     0
2974b8e80941Smrg#define RU                                       1
2975b8e80941Smrg#define RD                                       2
2976b8e80941Smrg#define RTZ                                      3
2977b8e80941Smrg   uint32_t                             FloatingPointMode;
2978b8e80941Smrg#define IEEE745                                  0
2979b8e80941Smrg#define Alt                                      1
2980b8e80941Smrg   uint32_t                             BindingTableEntryCount;
2981b8e80941Smrg   uint32_t                             DenormalMode;
2982b8e80941Smrg#define FTZ                                      0
2983b8e80941Smrg#define RET                                      1
2984b8e80941Smrg   uint32_t                             SamplerCount;
2985b8e80941Smrg   bool                                 VectorMaskEnable;
2986b8e80941Smrg   bool                                 SingleProgramFlow;
2987b8e80941Smrg   uint32_t                             PerThreadScratchSpace;
2988b8e80941Smrg   __gen_address_type                   ScratchSpaceBasePointer;
2989b8e80941Smrg   bool                                 _8PixelDispatchEnable;
2990b8e80941Smrg   bool                                 _16PixelDispatchEnable;
2991b8e80941Smrg   bool                                 _32PixelDispatchEnable;
2992b8e80941Smrg   uint32_t                             PositionXYOffsetSelect;
2993b8e80941Smrg#define POSOFFSET_NONE                           0
2994b8e80941Smrg#define POSOFFSET_CENTROID                       2
2995b8e80941Smrg#define POSOFFSET_SAMPLE                         3
2996b8e80941Smrg   bool                                 RenderTargetResolveEnable;
2997b8e80941Smrg   bool                                 DualSourceBlendEnable;
2998b8e80941Smrg   bool                                 RenderTargetFastClearEnable;
2999b8e80941Smrg   bool                                 oMaskPresenttoRenderTarget;
3000b8e80941Smrg   bool                                 AttributeEnable;
3001b8e80941Smrg   bool                                 PushConstantEnable;
3002b8e80941Smrg   uint32_t                             MaximumNumberofThreads;
3003b8e80941Smrg   uint32_t                             DispatchGRFStartRegisterForConstantSetupData2;
3004b8e80941Smrg   uint32_t                             DispatchGRFStartRegisterForConstantSetupData1;
3005b8e80941Smrg   uint32_t                             DispatchGRFStartRegisterForConstantSetupData0;
3006b8e80941Smrg   uint64_t                             KernelStartPointer1;
3007b8e80941Smrg   uint64_t                             KernelStartPointer2;
3008b8e80941Smrg};
3009b8e80941Smrg
3010b8e80941Smrgstatic inline void
3011b8e80941SmrgGEN7_3DSTATE_PS_pack(__attribute__((unused)) __gen_user_data *data,
3012b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
3013b8e80941Smrg                     __attribute__((unused)) const struct GEN7_3DSTATE_PS * restrict values)
3014b8e80941Smrg{
3015b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3016b8e80941Smrg
3017b8e80941Smrg   dw[0] =
3018b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3019b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3020b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3021b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3022b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3023b8e80941Smrg
3024b8e80941Smrg   dw[1] =
3025b8e80941Smrg      __gen_offset(values->KernelStartPointer0, 6, 31);
3026b8e80941Smrg
3027b8e80941Smrg   dw[2] =
3028b8e80941Smrg      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
3029b8e80941Smrg      __gen_uint(values->MaskStackExceptionEnable, 11, 11) |
3030b8e80941Smrg      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
3031b8e80941Smrg      __gen_uint(values->RoundingMode, 14, 15) |
3032b8e80941Smrg      __gen_uint(values->FloatingPointMode, 16, 16) |
3033b8e80941Smrg      __gen_uint(values->BindingTableEntryCount, 18, 25) |
3034b8e80941Smrg      __gen_uint(values->DenormalMode, 26, 26) |
3035b8e80941Smrg      __gen_uint(values->SamplerCount, 27, 29) |
3036b8e80941Smrg      __gen_uint(values->VectorMaskEnable, 30, 30) |
3037b8e80941Smrg      __gen_uint(values->SingleProgramFlow, 31, 31);
3038b8e80941Smrg
3039b8e80941Smrg   const uint32_t v3 =
3040b8e80941Smrg      __gen_uint(values->PerThreadScratchSpace, 0, 3);
3041b8e80941Smrg   dw[3] = __gen_combine_address(data, &dw[3], values->ScratchSpaceBasePointer, v3);
3042b8e80941Smrg
3043b8e80941Smrg   dw[4] =
3044b8e80941Smrg      __gen_uint(values->_8PixelDispatchEnable, 0, 0) |
3045b8e80941Smrg      __gen_uint(values->_16PixelDispatchEnable, 1, 1) |
3046b8e80941Smrg      __gen_uint(values->_32PixelDispatchEnable, 2, 2) |
3047b8e80941Smrg      __gen_uint(values->PositionXYOffsetSelect, 3, 4) |
3048b8e80941Smrg      __gen_uint(values->RenderTargetResolveEnable, 6, 6) |
3049b8e80941Smrg      __gen_uint(values->DualSourceBlendEnable, 7, 7) |
3050b8e80941Smrg      __gen_uint(values->RenderTargetFastClearEnable, 8, 8) |
3051b8e80941Smrg      __gen_uint(values->oMaskPresenttoRenderTarget, 9, 9) |
3052b8e80941Smrg      __gen_uint(values->AttributeEnable, 10, 10) |
3053b8e80941Smrg      __gen_uint(values->PushConstantEnable, 11, 11) |
3054b8e80941Smrg      __gen_uint(values->MaximumNumberofThreads, 24, 31);
3055b8e80941Smrg
3056b8e80941Smrg   dw[5] =
3057b8e80941Smrg      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData2, 0, 6) |
3058b8e80941Smrg      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData1, 8, 14) |
3059b8e80941Smrg      __gen_uint(values->DispatchGRFStartRegisterForConstantSetupData0, 16, 22);
3060b8e80941Smrg
3061b8e80941Smrg   dw[6] =
3062b8e80941Smrg      __gen_offset(values->KernelStartPointer1, 6, 31);
3063b8e80941Smrg
3064b8e80941Smrg   dw[7] =
3065b8e80941Smrg      __gen_offset(values->KernelStartPointer2, 6, 31);
3066b8e80941Smrg}
3067b8e80941Smrg
3068b8e80941Smrg#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_DS_length      2
3069b8e80941Smrg#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_DS_length_bias      2
3070b8e80941Smrg#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_DS_header\
3071b8e80941Smrg   .DWordLength                         =      0,  \
3072b8e80941Smrg   ._3DCommandSubOpcode                 =     20,  \
3073b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
3074b8e80941Smrg   .CommandSubType                      =      3,  \
3075b8e80941Smrg   .CommandType                         =      3
3076b8e80941Smrg
3077b8e80941Smrgstruct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_DS {
3078b8e80941Smrg   uint32_t                             DWordLength;
3079b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3080b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3081b8e80941Smrg   uint32_t                             CommandSubType;
3082b8e80941Smrg   uint32_t                             CommandType;
3083b8e80941Smrg   uint32_t                             ConstantBufferSize;
3084b8e80941Smrg#define _0KB                                     0
3085b8e80941Smrg   uint32_t                             ConstantBufferOffset;
3086b8e80941Smrg#define _0KB                                     0
3087b8e80941Smrg};
3088b8e80941Smrg
3089b8e80941Smrgstatic inline void
3090b8e80941SmrgGEN7_3DSTATE_PUSH_CONSTANT_ALLOC_DS_pack(__attribute__((unused)) __gen_user_data *data,
3091b8e80941Smrg                                         __attribute__((unused)) void * restrict dst,
3092b8e80941Smrg                                         __attribute__((unused)) const struct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_DS * restrict values)
3093b8e80941Smrg{
3094b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3095b8e80941Smrg
3096b8e80941Smrg   dw[0] =
3097b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3098b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3099b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3100b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3101b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3102b8e80941Smrg
3103b8e80941Smrg   dw[1] =
3104b8e80941Smrg      __gen_uint(values->ConstantBufferSize, 0, 4) |
3105b8e80941Smrg      __gen_uint(values->ConstantBufferOffset, 16, 19);
3106b8e80941Smrg}
3107b8e80941Smrg
3108b8e80941Smrg#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_GS_length      2
3109b8e80941Smrg#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_GS_length_bias      2
3110b8e80941Smrg#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_GS_header\
3111b8e80941Smrg   .DWordLength                         =      0,  \
3112b8e80941Smrg   ._3DCommandSubOpcode                 =     21,  \
3113b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
3114b8e80941Smrg   .CommandSubType                      =      3,  \
3115b8e80941Smrg   .CommandType                         =      3
3116b8e80941Smrg
3117b8e80941Smrgstruct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_GS {
3118b8e80941Smrg   uint32_t                             DWordLength;
3119b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3120b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3121b8e80941Smrg   uint32_t                             CommandSubType;
3122b8e80941Smrg   uint32_t                             CommandType;
3123b8e80941Smrg   uint32_t                             ConstantBufferSize;
3124b8e80941Smrg#define _0KB                                     0
3125b8e80941Smrg   uint32_t                             ConstantBufferOffset;
3126b8e80941Smrg#define _0KB                                     0
3127b8e80941Smrg};
3128b8e80941Smrg
3129b8e80941Smrgstatic inline void
3130b8e80941SmrgGEN7_3DSTATE_PUSH_CONSTANT_ALLOC_GS_pack(__attribute__((unused)) __gen_user_data *data,
3131b8e80941Smrg                                         __attribute__((unused)) void * restrict dst,
3132b8e80941Smrg                                         __attribute__((unused)) const struct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_GS * restrict values)
3133b8e80941Smrg{
3134b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3135b8e80941Smrg
3136b8e80941Smrg   dw[0] =
3137b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3138b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3139b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3140b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3141b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3142b8e80941Smrg
3143b8e80941Smrg   dw[1] =
3144b8e80941Smrg      __gen_uint(values->ConstantBufferSize, 0, 4) |
3145b8e80941Smrg      __gen_uint(values->ConstantBufferOffset, 16, 19);
3146b8e80941Smrg}
3147b8e80941Smrg
3148b8e80941Smrg#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_HS_length      2
3149b8e80941Smrg#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_HS_length_bias      2
3150b8e80941Smrg#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_HS_header\
3151b8e80941Smrg   .DWordLength                         =      0,  \
3152b8e80941Smrg   ._3DCommandSubOpcode                 =     19,  \
3153b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
3154b8e80941Smrg   .CommandSubType                      =      3,  \
3155b8e80941Smrg   .CommandType                         =      3
3156b8e80941Smrg
3157b8e80941Smrgstruct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_HS {
3158b8e80941Smrg   uint32_t                             DWordLength;
3159b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3160b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3161b8e80941Smrg   uint32_t                             CommandSubType;
3162b8e80941Smrg   uint32_t                             CommandType;
3163b8e80941Smrg   uint32_t                             ConstantBufferSize;
3164b8e80941Smrg#define _0KB                                     0
3165b8e80941Smrg   uint32_t                             ConstantBufferOffset;
3166b8e80941Smrg#define _0KB                                     0
3167b8e80941Smrg};
3168b8e80941Smrg
3169b8e80941Smrgstatic inline void
3170b8e80941SmrgGEN7_3DSTATE_PUSH_CONSTANT_ALLOC_HS_pack(__attribute__((unused)) __gen_user_data *data,
3171b8e80941Smrg                                         __attribute__((unused)) void * restrict dst,
3172b8e80941Smrg                                         __attribute__((unused)) const struct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_HS * restrict values)
3173b8e80941Smrg{
3174b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3175b8e80941Smrg
3176b8e80941Smrg   dw[0] =
3177b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3178b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3179b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3180b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3181b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3182b8e80941Smrg
3183b8e80941Smrg   dw[1] =
3184b8e80941Smrg      __gen_uint(values->ConstantBufferSize, 0, 4) |
3185b8e80941Smrg      __gen_uint(values->ConstantBufferOffset, 16, 19);
3186b8e80941Smrg}
3187b8e80941Smrg
3188b8e80941Smrg#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_PS_length      2
3189b8e80941Smrg#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_PS_length_bias      2
3190b8e80941Smrg#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_PS_header\
3191b8e80941Smrg   .DWordLength                         =      0,  \
3192b8e80941Smrg   ._3DCommandSubOpcode                 =     22,  \
3193b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
3194b8e80941Smrg   .CommandSubType                      =      3,  \
3195b8e80941Smrg   .CommandType                         =      3
3196b8e80941Smrg
3197b8e80941Smrgstruct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_PS {
3198b8e80941Smrg   uint32_t                             DWordLength;
3199b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3200b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3201b8e80941Smrg   uint32_t                             CommandSubType;
3202b8e80941Smrg   uint32_t                             CommandType;
3203b8e80941Smrg   uint32_t                             ConstantBufferSize;
3204b8e80941Smrg#define _0KB                                     0
3205b8e80941Smrg   uint32_t                             ConstantBufferOffset;
3206b8e80941Smrg#define _0KB                                     0
3207b8e80941Smrg};
3208b8e80941Smrg
3209b8e80941Smrgstatic inline void
3210b8e80941SmrgGEN7_3DSTATE_PUSH_CONSTANT_ALLOC_PS_pack(__attribute__((unused)) __gen_user_data *data,
3211b8e80941Smrg                                         __attribute__((unused)) void * restrict dst,
3212b8e80941Smrg                                         __attribute__((unused)) const struct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_PS * restrict values)
3213b8e80941Smrg{
3214b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3215b8e80941Smrg
3216b8e80941Smrg   dw[0] =
3217b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3218b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3219b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3220b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3221b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3222b8e80941Smrg
3223b8e80941Smrg   dw[1] =
3224b8e80941Smrg      __gen_uint(values->ConstantBufferSize, 0, 4) |
3225b8e80941Smrg      __gen_uint(values->ConstantBufferOffset, 16, 19);
3226b8e80941Smrg}
3227b8e80941Smrg
3228b8e80941Smrg#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_VS_length      2
3229b8e80941Smrg#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_VS_length_bias      2
3230b8e80941Smrg#define GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_VS_header\
3231b8e80941Smrg   .DWordLength                         =      0,  \
3232b8e80941Smrg   ._3DCommandSubOpcode                 =     18,  \
3233b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
3234b8e80941Smrg   .CommandSubType                      =      3,  \
3235b8e80941Smrg   .CommandType                         =      3
3236b8e80941Smrg
3237b8e80941Smrgstruct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_VS {
3238b8e80941Smrg   uint32_t                             DWordLength;
3239b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3240b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3241b8e80941Smrg   uint32_t                             CommandSubType;
3242b8e80941Smrg   uint32_t                             CommandType;
3243b8e80941Smrg   uint32_t                             ConstantBufferSize;
3244b8e80941Smrg#define _0KB                                     0
3245b8e80941Smrg   uint32_t                             ConstantBufferOffset;
3246b8e80941Smrg#define _0KB                                     0
3247b8e80941Smrg};
3248b8e80941Smrg
3249b8e80941Smrgstatic inline void
3250b8e80941SmrgGEN7_3DSTATE_PUSH_CONSTANT_ALLOC_VS_pack(__attribute__((unused)) __gen_user_data *data,
3251b8e80941Smrg                                         __attribute__((unused)) void * restrict dst,
3252b8e80941Smrg                                         __attribute__((unused)) const struct GEN7_3DSTATE_PUSH_CONSTANT_ALLOC_VS * restrict values)
3253b8e80941Smrg{
3254b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3255b8e80941Smrg
3256b8e80941Smrg   dw[0] =
3257b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3258b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3259b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3260b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3261b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3262b8e80941Smrg
3263b8e80941Smrg   dw[1] =
3264b8e80941Smrg      __gen_uint(values->ConstantBufferSize, 0, 4) |
3265b8e80941Smrg      __gen_uint(values->ConstantBufferOffset, 16, 19);
3266b8e80941Smrg}
3267b8e80941Smrg
3268b8e80941Smrg#define GEN7_3DSTATE_SAMPLER_PALETTE_LOAD0_length_bias      2
3269b8e80941Smrg#define GEN7_3DSTATE_SAMPLER_PALETTE_LOAD0_header\
3270b8e80941Smrg   ._3DCommandSubOpcode                 =      2,  \
3271b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
3272b8e80941Smrg   .CommandSubType                      =      3,  \
3273b8e80941Smrg   .CommandType                         =      3
3274b8e80941Smrg
3275b8e80941Smrgstruct GEN7_3DSTATE_SAMPLER_PALETTE_LOAD0 {
3276b8e80941Smrg   uint32_t                             DWordLength;
3277b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3278b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3279b8e80941Smrg   uint32_t                             CommandSubType;
3280b8e80941Smrg   uint32_t                             CommandType;
3281b8e80941Smrg   /* variable length fields follow */
3282b8e80941Smrg};
3283b8e80941Smrg
3284b8e80941Smrgstatic inline void
3285b8e80941SmrgGEN7_3DSTATE_SAMPLER_PALETTE_LOAD0_pack(__attribute__((unused)) __gen_user_data *data,
3286b8e80941Smrg                                        __attribute__((unused)) void * restrict dst,
3287b8e80941Smrg                                        __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_PALETTE_LOAD0 * restrict values)
3288b8e80941Smrg{
3289b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3290b8e80941Smrg
3291b8e80941Smrg   dw[0] =
3292b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3293b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3294b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3295b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3296b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3297b8e80941Smrg}
3298b8e80941Smrg
3299b8e80941Smrg#define GEN7_3DSTATE_SAMPLER_PALETTE_LOAD1_length_bias      2
3300b8e80941Smrg#define GEN7_3DSTATE_SAMPLER_PALETTE_LOAD1_header\
3301b8e80941Smrg   .DWordLength                         =      0,  \
3302b8e80941Smrg   ._3DCommandSubOpcode                 =     12,  \
3303b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
3304b8e80941Smrg   .CommandSubType                      =      3,  \
3305b8e80941Smrg   .CommandType                         =      3
3306b8e80941Smrg
3307b8e80941Smrgstruct GEN7_3DSTATE_SAMPLER_PALETTE_LOAD1 {
3308b8e80941Smrg   uint32_t                             DWordLength;
3309b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3310b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3311b8e80941Smrg   uint32_t                             CommandSubType;
3312b8e80941Smrg   uint32_t                             CommandType;
3313b8e80941Smrg   /* variable length fields follow */
3314b8e80941Smrg};
3315b8e80941Smrg
3316b8e80941Smrgstatic inline void
3317b8e80941SmrgGEN7_3DSTATE_SAMPLER_PALETTE_LOAD1_pack(__attribute__((unused)) __gen_user_data *data,
3318b8e80941Smrg                                        __attribute__((unused)) void * restrict dst,
3319b8e80941Smrg                                        __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_PALETTE_LOAD1 * restrict values)
3320b8e80941Smrg{
3321b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3322b8e80941Smrg
3323b8e80941Smrg   dw[0] =
3324b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3325b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3326b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3327b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3328b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3329b8e80941Smrg}
3330b8e80941Smrg
3331b8e80941Smrg#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_DS_length      2
3332b8e80941Smrg#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_DS_length_bias      2
3333b8e80941Smrg#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_DS_header\
3334b8e80941Smrg   .DWordLength                         =      0,  \
3335b8e80941Smrg   ._3DCommandSubOpcode                 =     45,  \
3336b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
3337b8e80941Smrg   .CommandSubType                      =      3,  \
3338b8e80941Smrg   .CommandType                         =      3
3339b8e80941Smrg
3340b8e80941Smrgstruct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_DS {
3341b8e80941Smrg   uint32_t                             DWordLength;
3342b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3343b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3344b8e80941Smrg   uint32_t                             CommandSubType;
3345b8e80941Smrg   uint32_t                             CommandType;
3346b8e80941Smrg   uint64_t                             PointertoDSSamplerState;
3347b8e80941Smrg};
3348b8e80941Smrg
3349b8e80941Smrgstatic inline void
3350b8e80941SmrgGEN7_3DSTATE_SAMPLER_STATE_POINTERS_DS_pack(__attribute__((unused)) __gen_user_data *data,
3351b8e80941Smrg                                            __attribute__((unused)) void * restrict dst,
3352b8e80941Smrg                                            __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_DS * restrict values)
3353b8e80941Smrg{
3354b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3355b8e80941Smrg
3356b8e80941Smrg   dw[0] =
3357b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3358b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3359b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3360b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3361b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3362b8e80941Smrg
3363b8e80941Smrg   dw[1] =
3364b8e80941Smrg      __gen_offset(values->PointertoDSSamplerState, 5, 31);
3365b8e80941Smrg}
3366b8e80941Smrg
3367b8e80941Smrg#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_GS_length      2
3368b8e80941Smrg#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_GS_length_bias      2
3369b8e80941Smrg#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_GS_header\
3370b8e80941Smrg   .DWordLength                         =      0,  \
3371b8e80941Smrg   ._3DCommandSubOpcode                 =     46,  \
3372b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
3373b8e80941Smrg   .CommandSubType                      =      3,  \
3374b8e80941Smrg   .CommandType                         =      3
3375b8e80941Smrg
3376b8e80941Smrgstruct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_GS {
3377b8e80941Smrg   uint32_t                             DWordLength;
3378b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3379b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3380b8e80941Smrg   uint32_t                             CommandSubType;
3381b8e80941Smrg   uint32_t                             CommandType;
3382b8e80941Smrg   uint64_t                             PointertoGSSamplerState;
3383b8e80941Smrg};
3384b8e80941Smrg
3385b8e80941Smrgstatic inline void
3386b8e80941SmrgGEN7_3DSTATE_SAMPLER_STATE_POINTERS_GS_pack(__attribute__((unused)) __gen_user_data *data,
3387b8e80941Smrg                                            __attribute__((unused)) void * restrict dst,
3388b8e80941Smrg                                            __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_GS * restrict values)
3389b8e80941Smrg{
3390b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3391b8e80941Smrg
3392b8e80941Smrg   dw[0] =
3393b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3394b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3395b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3396b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3397b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3398b8e80941Smrg
3399b8e80941Smrg   dw[1] =
3400b8e80941Smrg      __gen_offset(values->PointertoGSSamplerState, 5, 31);
3401b8e80941Smrg}
3402b8e80941Smrg
3403b8e80941Smrg#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_HS_length      2
3404b8e80941Smrg#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_HS_length_bias      2
3405b8e80941Smrg#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_HS_header\
3406b8e80941Smrg   .DWordLength                         =      0,  \
3407b8e80941Smrg   ._3DCommandSubOpcode                 =     44,  \
3408b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
3409b8e80941Smrg   .CommandSubType                      =      3,  \
3410b8e80941Smrg   .CommandType                         =      3
3411b8e80941Smrg
3412b8e80941Smrgstruct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_HS {
3413b8e80941Smrg   uint32_t                             DWordLength;
3414b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3415b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3416b8e80941Smrg   uint32_t                             CommandSubType;
3417b8e80941Smrg   uint32_t                             CommandType;
3418b8e80941Smrg   uint64_t                             PointertoHSSamplerState;
3419b8e80941Smrg};
3420b8e80941Smrg
3421b8e80941Smrgstatic inline void
3422b8e80941SmrgGEN7_3DSTATE_SAMPLER_STATE_POINTERS_HS_pack(__attribute__((unused)) __gen_user_data *data,
3423b8e80941Smrg                                            __attribute__((unused)) void * restrict dst,
3424b8e80941Smrg                                            __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_HS * restrict values)
3425b8e80941Smrg{
3426b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3427b8e80941Smrg
3428b8e80941Smrg   dw[0] =
3429b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3430b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3431b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3432b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3433b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3434b8e80941Smrg
3435b8e80941Smrg   dw[1] =
3436b8e80941Smrg      __gen_offset(values->PointertoHSSamplerState, 5, 31);
3437b8e80941Smrg}
3438b8e80941Smrg
3439b8e80941Smrg#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_PS_length      2
3440b8e80941Smrg#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_PS_length_bias      2
3441b8e80941Smrg#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_PS_header\
3442b8e80941Smrg   .DWordLength                         =      0,  \
3443b8e80941Smrg   ._3DCommandSubOpcode                 =     47,  \
3444b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
3445b8e80941Smrg   .CommandSubType                      =      3,  \
3446b8e80941Smrg   .CommandType                         =      3
3447b8e80941Smrg
3448b8e80941Smrgstruct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_PS {
3449b8e80941Smrg   uint32_t                             DWordLength;
3450b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3451b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3452b8e80941Smrg   uint32_t                             CommandSubType;
3453b8e80941Smrg   uint32_t                             CommandType;
3454b8e80941Smrg   uint64_t                             PointertoPSSamplerState;
3455b8e80941Smrg};
3456b8e80941Smrg
3457b8e80941Smrgstatic inline void
3458b8e80941SmrgGEN7_3DSTATE_SAMPLER_STATE_POINTERS_PS_pack(__attribute__((unused)) __gen_user_data *data,
3459b8e80941Smrg                                            __attribute__((unused)) void * restrict dst,
3460b8e80941Smrg                                            __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_PS * restrict values)
3461b8e80941Smrg{
3462b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3463b8e80941Smrg
3464b8e80941Smrg   dw[0] =
3465b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3466b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3467b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3468b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3469b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3470b8e80941Smrg
3471b8e80941Smrg   dw[1] =
3472b8e80941Smrg      __gen_offset(values->PointertoPSSamplerState, 5, 31);
3473b8e80941Smrg}
3474b8e80941Smrg
3475b8e80941Smrg#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_VS_length      2
3476b8e80941Smrg#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_VS_length_bias      2
3477b8e80941Smrg#define GEN7_3DSTATE_SAMPLER_STATE_POINTERS_VS_header\
3478b8e80941Smrg   .DWordLength                         =      0,  \
3479b8e80941Smrg   ._3DCommandSubOpcode                 =     43,  \
3480b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
3481b8e80941Smrg   .CommandSubType                      =      3,  \
3482b8e80941Smrg   .CommandType                         =      3
3483b8e80941Smrg
3484b8e80941Smrgstruct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_VS {
3485b8e80941Smrg   uint32_t                             DWordLength;
3486b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3487b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3488b8e80941Smrg   uint32_t                             CommandSubType;
3489b8e80941Smrg   uint32_t                             CommandType;
3490b8e80941Smrg   uint64_t                             PointertoVSSamplerState;
3491b8e80941Smrg};
3492b8e80941Smrg
3493b8e80941Smrgstatic inline void
3494b8e80941SmrgGEN7_3DSTATE_SAMPLER_STATE_POINTERS_VS_pack(__attribute__((unused)) __gen_user_data *data,
3495b8e80941Smrg                                            __attribute__((unused)) void * restrict dst,
3496b8e80941Smrg                                            __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLER_STATE_POINTERS_VS * restrict values)
3497b8e80941Smrg{
3498b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3499b8e80941Smrg
3500b8e80941Smrg   dw[0] =
3501b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3502b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3503b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3504b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3505b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3506b8e80941Smrg
3507b8e80941Smrg   dw[1] =
3508b8e80941Smrg      __gen_offset(values->PointertoVSSamplerState, 5, 31);
3509b8e80941Smrg}
3510b8e80941Smrg
3511b8e80941Smrg#define GEN7_3DSTATE_SAMPLE_MASK_length        2
3512b8e80941Smrg#define GEN7_3DSTATE_SAMPLE_MASK_length_bias      2
3513b8e80941Smrg#define GEN7_3DSTATE_SAMPLE_MASK_header         \
3514b8e80941Smrg   .DWordLength                         =      0,  \
3515b8e80941Smrg   ._3DCommandSubOpcode                 =     24,  \
3516b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
3517b8e80941Smrg   .CommandSubType                      =      3,  \
3518b8e80941Smrg   .CommandType                         =      3
3519b8e80941Smrg
3520b8e80941Smrgstruct GEN7_3DSTATE_SAMPLE_MASK {
3521b8e80941Smrg   uint32_t                             DWordLength;
3522b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3523b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3524b8e80941Smrg   uint32_t                             CommandSubType;
3525b8e80941Smrg   uint32_t                             CommandType;
3526b8e80941Smrg   uint32_t                             SampleMask;
3527b8e80941Smrg};
3528b8e80941Smrg
3529b8e80941Smrgstatic inline void
3530b8e80941SmrgGEN7_3DSTATE_SAMPLE_MASK_pack(__attribute__((unused)) __gen_user_data *data,
3531b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
3532b8e80941Smrg                              __attribute__((unused)) const struct GEN7_3DSTATE_SAMPLE_MASK * restrict values)
3533b8e80941Smrg{
3534b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3535b8e80941Smrg
3536b8e80941Smrg   dw[0] =
3537b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3538b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3539b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3540b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3541b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3542b8e80941Smrg
3543b8e80941Smrg   dw[1] =
3544b8e80941Smrg      __gen_uint(values->SampleMask, 0, 7);
3545b8e80941Smrg}
3546b8e80941Smrg
3547b8e80941Smrg#define GEN7_3DSTATE_SBE_length               14
3548b8e80941Smrg#define GEN7_3DSTATE_SBE_length_bias           2
3549b8e80941Smrg#define GEN7_3DSTATE_SBE_header                 \
3550b8e80941Smrg   .DWordLength                         =     12,  \
3551b8e80941Smrg   ._3DCommandSubOpcode                 =     31,  \
3552b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
3553b8e80941Smrg   .CommandSubType                      =      3,  \
3554b8e80941Smrg   .CommandType                         =      3
3555b8e80941Smrg
3556b8e80941Smrgstruct GEN7_3DSTATE_SBE {
3557b8e80941Smrg   uint32_t                             DWordLength;
3558b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3559b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3560b8e80941Smrg   uint32_t                             CommandSubType;
3561b8e80941Smrg   uint32_t                             CommandType;
3562b8e80941Smrg   uint32_t                             VertexURBEntryReadOffset;
3563b8e80941Smrg   uint32_t                             VertexURBEntryReadLength;
3564b8e80941Smrg   uint32_t                             PointSpriteTextureCoordinateOrigin;
3565b8e80941Smrg#define UPPERLEFT                                0
3566b8e80941Smrg#define LOWERLEFT                                1
3567b8e80941Smrg   bool                                 AttributeSwizzleEnable;
3568b8e80941Smrg   uint32_t                             NumberofSFOutputAttributes;
3569b8e80941Smrg   uint32_t                             AttributeSwizzleControlMode;
3570b8e80941Smrg#define SWIZ_0_15                                0
3571b8e80941Smrg#define SWIZ_16_31                               1
3572b8e80941Smrg   struct GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL Attribute[16];
3573b8e80941Smrg   uint32_t                             PointSpriteTextureCoordinateEnable;
3574b8e80941Smrg   uint32_t                             ConstantInterpolationEnable;
3575b8e80941Smrg   uint32_t                             Attribute0WrapShortestEnables;
3576b8e80941Smrg   uint32_t                             Attribute1WrapShortestEnables;
3577b8e80941Smrg   uint32_t                             Attribute2WrapShortestEnables;
3578b8e80941Smrg   uint32_t                             Attribute3WrapShortestEnables;
3579b8e80941Smrg   uint32_t                             Attribute4WrapShortestEnables;
3580b8e80941Smrg   uint32_t                             Attribute5WrapShortestEnables;
3581b8e80941Smrg   uint32_t                             Attribute6WrapShortestEnables;
3582b8e80941Smrg   uint32_t                             Attribute7WrapShortestEnables;
3583b8e80941Smrg   uint32_t                             Attribute8WrapShortestEnables;
3584b8e80941Smrg   uint32_t                             Attribute9WrapShortestEnables;
3585b8e80941Smrg   uint32_t                             Attribute10WrapShortestEnables;
3586b8e80941Smrg   uint32_t                             Attribute11WrapShortestEnables;
3587b8e80941Smrg   uint32_t                             Attribute12WrapShortestEnables;
3588b8e80941Smrg   uint32_t                             Attribute13WrapShortestEnables;
3589b8e80941Smrg   uint32_t                             Attribute14WrapShortestEnables;
3590b8e80941Smrg   uint32_t                             Attribute15WrapShortestEnables;
3591b8e80941Smrg};
3592b8e80941Smrg
3593b8e80941Smrgstatic inline void
3594b8e80941SmrgGEN7_3DSTATE_SBE_pack(__attribute__((unused)) __gen_user_data *data,
3595b8e80941Smrg                      __attribute__((unused)) void * restrict dst,
3596b8e80941Smrg                      __attribute__((unused)) const struct GEN7_3DSTATE_SBE * restrict values)
3597b8e80941Smrg{
3598b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3599b8e80941Smrg
3600b8e80941Smrg   dw[0] =
3601b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3602b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3603b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3604b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3605b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3606b8e80941Smrg
3607b8e80941Smrg   dw[1] =
3608b8e80941Smrg      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
3609b8e80941Smrg      __gen_uint(values->VertexURBEntryReadLength, 11, 15) |
3610b8e80941Smrg      __gen_uint(values->PointSpriteTextureCoordinateOrigin, 20, 20) |
3611b8e80941Smrg      __gen_uint(values->AttributeSwizzleEnable, 21, 21) |
3612b8e80941Smrg      __gen_uint(values->NumberofSFOutputAttributes, 22, 27) |
3613b8e80941Smrg      __gen_uint(values->AttributeSwizzleControlMode, 28, 28);
3614b8e80941Smrg
3615b8e80941Smrg   uint32_t v2_0;
3616b8e80941Smrg   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v2_0, &values->Attribute[0]);
3617b8e80941Smrg
3618b8e80941Smrg   uint32_t v2_1;
3619b8e80941Smrg   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v2_1, &values->Attribute[1]);
3620b8e80941Smrg
3621b8e80941Smrg   dw[2] =
3622b8e80941Smrg      __gen_uint(v2_0, 0, 15) |
3623b8e80941Smrg      __gen_uint(v2_1, 16, 31);
3624b8e80941Smrg
3625b8e80941Smrg   uint32_t v3_0;
3626b8e80941Smrg   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v3_0, &values->Attribute[2]);
3627b8e80941Smrg
3628b8e80941Smrg   uint32_t v3_1;
3629b8e80941Smrg   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v3_1, &values->Attribute[3]);
3630b8e80941Smrg
3631b8e80941Smrg   dw[3] =
3632b8e80941Smrg      __gen_uint(v3_0, 0, 15) |
3633b8e80941Smrg      __gen_uint(v3_1, 16, 31);
3634b8e80941Smrg
3635b8e80941Smrg   uint32_t v4_0;
3636b8e80941Smrg   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v4_0, &values->Attribute[4]);
3637b8e80941Smrg
3638b8e80941Smrg   uint32_t v4_1;
3639b8e80941Smrg   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v4_1, &values->Attribute[5]);
3640b8e80941Smrg
3641b8e80941Smrg   dw[4] =
3642b8e80941Smrg      __gen_uint(v4_0, 0, 15) |
3643b8e80941Smrg      __gen_uint(v4_1, 16, 31);
3644b8e80941Smrg
3645b8e80941Smrg   uint32_t v5_0;
3646b8e80941Smrg   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v5_0, &values->Attribute[6]);
3647b8e80941Smrg
3648b8e80941Smrg   uint32_t v5_1;
3649b8e80941Smrg   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v5_1, &values->Attribute[7]);
3650b8e80941Smrg
3651b8e80941Smrg   dw[5] =
3652b8e80941Smrg      __gen_uint(v5_0, 0, 15) |
3653b8e80941Smrg      __gen_uint(v5_1, 16, 31);
3654b8e80941Smrg
3655b8e80941Smrg   uint32_t v6_0;
3656b8e80941Smrg   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v6_0, &values->Attribute[8]);
3657b8e80941Smrg
3658b8e80941Smrg   uint32_t v6_1;
3659b8e80941Smrg   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v6_1, &values->Attribute[9]);
3660b8e80941Smrg
3661b8e80941Smrg   dw[6] =
3662b8e80941Smrg      __gen_uint(v6_0, 0, 15) |
3663b8e80941Smrg      __gen_uint(v6_1, 16, 31);
3664b8e80941Smrg
3665b8e80941Smrg   uint32_t v7_0;
3666b8e80941Smrg   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v7_0, &values->Attribute[10]);
3667b8e80941Smrg
3668b8e80941Smrg   uint32_t v7_1;
3669b8e80941Smrg   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v7_1, &values->Attribute[11]);
3670b8e80941Smrg
3671b8e80941Smrg   dw[7] =
3672b8e80941Smrg      __gen_uint(v7_0, 0, 15) |
3673b8e80941Smrg      __gen_uint(v7_1, 16, 31);
3674b8e80941Smrg
3675b8e80941Smrg   uint32_t v8_0;
3676b8e80941Smrg   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_0, &values->Attribute[12]);
3677b8e80941Smrg
3678b8e80941Smrg   uint32_t v8_1;
3679b8e80941Smrg   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v8_1, &values->Attribute[13]);
3680b8e80941Smrg
3681b8e80941Smrg   dw[8] =
3682b8e80941Smrg      __gen_uint(v8_0, 0, 15) |
3683b8e80941Smrg      __gen_uint(v8_1, 16, 31);
3684b8e80941Smrg
3685b8e80941Smrg   uint32_t v9_0;
3686b8e80941Smrg   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v9_0, &values->Attribute[14]);
3687b8e80941Smrg
3688b8e80941Smrg   uint32_t v9_1;
3689b8e80941Smrg   GEN7_SF_OUTPUT_ATTRIBUTE_DETAIL_pack(data, &v9_1, &values->Attribute[15]);
3690b8e80941Smrg
3691b8e80941Smrg   dw[9] =
3692b8e80941Smrg      __gen_uint(v9_0, 0, 15) |
3693b8e80941Smrg      __gen_uint(v9_1, 16, 31);
3694b8e80941Smrg
3695b8e80941Smrg   dw[10] =
3696b8e80941Smrg      __gen_uint(values->PointSpriteTextureCoordinateEnable, 0, 31);
3697b8e80941Smrg
3698b8e80941Smrg   dw[11] =
3699b8e80941Smrg      __gen_uint(values->ConstantInterpolationEnable, 0, 31);
3700b8e80941Smrg
3701b8e80941Smrg   dw[12] =
3702b8e80941Smrg      __gen_uint(values->Attribute0WrapShortestEnables, 0, 3) |
3703b8e80941Smrg      __gen_uint(values->Attribute1WrapShortestEnables, 4, 7) |
3704b8e80941Smrg      __gen_uint(values->Attribute2WrapShortestEnables, 8, 11) |
3705b8e80941Smrg      __gen_uint(values->Attribute3WrapShortestEnables, 12, 15) |
3706b8e80941Smrg      __gen_uint(values->Attribute4WrapShortestEnables, 16, 19) |
3707b8e80941Smrg      __gen_uint(values->Attribute5WrapShortestEnables, 20, 23) |
3708b8e80941Smrg      __gen_uint(values->Attribute6WrapShortestEnables, 24, 27) |
3709b8e80941Smrg      __gen_uint(values->Attribute7WrapShortestEnables, 28, 31);
3710b8e80941Smrg
3711b8e80941Smrg   dw[13] =
3712b8e80941Smrg      __gen_uint(values->Attribute8WrapShortestEnables, 0, 3) |
3713b8e80941Smrg      __gen_uint(values->Attribute9WrapShortestEnables, 4, 7) |
3714b8e80941Smrg      __gen_uint(values->Attribute10WrapShortestEnables, 8, 11) |
3715b8e80941Smrg      __gen_uint(values->Attribute11WrapShortestEnables, 12, 15) |
3716b8e80941Smrg      __gen_uint(values->Attribute12WrapShortestEnables, 16, 19) |
3717b8e80941Smrg      __gen_uint(values->Attribute13WrapShortestEnables, 20, 23) |
3718b8e80941Smrg      __gen_uint(values->Attribute14WrapShortestEnables, 24, 27) |
3719b8e80941Smrg      __gen_uint(values->Attribute15WrapShortestEnables, 28, 31);
3720b8e80941Smrg}
3721b8e80941Smrg
3722b8e80941Smrg#define GEN7_3DSTATE_SCISSOR_STATE_POINTERS_length      2
3723b8e80941Smrg#define GEN7_3DSTATE_SCISSOR_STATE_POINTERS_length_bias      2
3724b8e80941Smrg#define GEN7_3DSTATE_SCISSOR_STATE_POINTERS_header\
3725b8e80941Smrg   .DWordLength                         =      0,  \
3726b8e80941Smrg   ._3DCommandSubOpcode                 =     15,  \
3727b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
3728b8e80941Smrg   .CommandSubType                      =      3,  \
3729b8e80941Smrg   .CommandType                         =      3
3730b8e80941Smrg
3731b8e80941Smrgstruct GEN7_3DSTATE_SCISSOR_STATE_POINTERS {
3732b8e80941Smrg   uint32_t                             DWordLength;
3733b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3734b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3735b8e80941Smrg   uint32_t                             CommandSubType;
3736b8e80941Smrg   uint32_t                             CommandType;
3737b8e80941Smrg   uint64_t                             ScissorRectPointer;
3738b8e80941Smrg};
3739b8e80941Smrg
3740b8e80941Smrgstatic inline void
3741b8e80941SmrgGEN7_3DSTATE_SCISSOR_STATE_POINTERS_pack(__attribute__((unused)) __gen_user_data *data,
3742b8e80941Smrg                                         __attribute__((unused)) void * restrict dst,
3743b8e80941Smrg                                         __attribute__((unused)) const struct GEN7_3DSTATE_SCISSOR_STATE_POINTERS * restrict values)
3744b8e80941Smrg{
3745b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3746b8e80941Smrg
3747b8e80941Smrg   dw[0] =
3748b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3749b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3750b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3751b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3752b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3753b8e80941Smrg
3754b8e80941Smrg   dw[1] =
3755b8e80941Smrg      __gen_offset(values->ScissorRectPointer, 5, 31);
3756b8e80941Smrg}
3757b8e80941Smrg
3758b8e80941Smrg#define GEN7_3DSTATE_SF_length                 7
3759b8e80941Smrg#define GEN7_3DSTATE_SF_length_bias            2
3760b8e80941Smrg#define GEN7_3DSTATE_SF_header                  \
3761b8e80941Smrg   .DWordLength                         =      5,  \
3762b8e80941Smrg   ._3DCommandSubOpcode                 =     19,  \
3763b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
3764b8e80941Smrg   .CommandSubType                      =      3,  \
3765b8e80941Smrg   .CommandType                         =      3
3766b8e80941Smrg
3767b8e80941Smrgstruct GEN7_3DSTATE_SF {
3768b8e80941Smrg   uint32_t                             DWordLength;
3769b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3770b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3771b8e80941Smrg   uint32_t                             CommandSubType;
3772b8e80941Smrg   uint32_t                             CommandType;
3773b8e80941Smrg   uint32_t                             FrontWinding;
3774b8e80941Smrg   bool                                 ViewportTransformEnable;
3775b8e80941Smrg   uint32_t                             BackFaceFillMode;
3776b8e80941Smrg#define FILL_MODE_SOLID                          0
3777b8e80941Smrg#define FILL_MODE_WIREFRAME                      1
3778b8e80941Smrg#define FILL_MODE_POINT                          2
3779b8e80941Smrg   uint32_t                             FrontFaceFillMode;
3780b8e80941Smrg#define FILL_MODE_SOLID                          0
3781b8e80941Smrg#define FILL_MODE_WIREFRAME                      1
3782b8e80941Smrg#define FILL_MODE_POINT                          2
3783b8e80941Smrg   bool                                 GlobalDepthOffsetEnablePoint;
3784b8e80941Smrg   bool                                 GlobalDepthOffsetEnableWireframe;
3785b8e80941Smrg   bool                                 GlobalDepthOffsetEnableSolid;
3786b8e80941Smrg   bool                                 StatisticsEnable;
3787b8e80941Smrg   bool                                 LegacyGlobalDepthBiasEnable;
3788b8e80941Smrg   uint32_t                             DepthBufferSurfaceFormat;
3789b8e80941Smrg#define D32_FLOAT_S8X24_UINT                     0
3790b8e80941Smrg#define D32_FLOAT                                1
3791b8e80941Smrg#define D24_UNORM_S8_UINT                        2
3792b8e80941Smrg#define D24_UNORM_X8_UINT                        3
3793b8e80941Smrg#define D16_UNORM                                5
3794b8e80941Smrg   uint32_t                             MultisampleRasterizationMode;
3795b8e80941Smrg#define MSRASTMODE_OFF_PIXEL                     0
3796b8e80941Smrg#define MSRASTMODE_OFF_PATTERN                   1
3797b8e80941Smrg#define MSRASTMODE_ON_PIXEL                      2
3798b8e80941Smrg#define MSRASTMODE_ON_PATTERN                    3
3799b8e80941Smrg   bool                                 ScissorRectangleEnable;
3800b8e80941Smrg   uint32_t                             LineEndCapAntialiasingRegionWidth;
3801b8e80941Smrg#define _05pixels                                0
3802b8e80941Smrg#define _10pixels                                1
3803b8e80941Smrg#define _20pixels                                2
3804b8e80941Smrg#define _40pixels                                3
3805b8e80941Smrg   float                                LineWidth;
3806b8e80941Smrg   uint32_t                             CullMode;
3807b8e80941Smrg#define CULLMODE_BOTH                            0
3808b8e80941Smrg#define CULLMODE_NONE                            1
3809b8e80941Smrg#define CULLMODE_FRONT                           2
3810b8e80941Smrg#define CULLMODE_BACK                            3
3811b8e80941Smrg   bool                                 AntiAliasingEnable;
3812b8e80941Smrg   float                                PointWidth;
3813b8e80941Smrg   uint32_t                             PointWidthSource;
3814b8e80941Smrg#define Vertex                                   0
3815b8e80941Smrg#define State                                    1
3816b8e80941Smrg   uint32_t                             VertexSubPixelPrecisionSelect;
3817b8e80941Smrg#define _8Bit                                    0
3818b8e80941Smrg#define _4Bit                                    1
3819b8e80941Smrg   uint32_t                             AALineDistanceMode;
3820b8e80941Smrg#define AALINEDISTANCE_TRUE                      1
3821b8e80941Smrg   uint32_t                             TriangleFanProvokingVertexSelect;
3822b8e80941Smrg#define Vertex0                                  0
3823b8e80941Smrg#define Vertex1                                  1
3824b8e80941Smrg#define Vertex2                                  2
3825b8e80941Smrg   uint32_t                             LineStripListProvokingVertexSelect;
3826b8e80941Smrg   uint32_t                             TriangleStripListProvokingVertexSelect;
3827b8e80941Smrg#define Vertex0                                  0
3828b8e80941Smrg#define Vertex1                                  1
3829b8e80941Smrg#define Vertex2                                  2
3830b8e80941Smrg   bool                                 LastPixelEnable;
3831b8e80941Smrg   float                                GlobalDepthOffsetConstant;
3832b8e80941Smrg   float                                GlobalDepthOffsetScale;
3833b8e80941Smrg   float                                GlobalDepthOffsetClamp;
3834b8e80941Smrg};
3835b8e80941Smrg
3836b8e80941Smrgstatic inline void
3837b8e80941SmrgGEN7_3DSTATE_SF_pack(__attribute__((unused)) __gen_user_data *data,
3838b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
3839b8e80941Smrg                     __attribute__((unused)) const struct GEN7_3DSTATE_SF * restrict values)
3840b8e80941Smrg{
3841b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3842b8e80941Smrg
3843b8e80941Smrg   dw[0] =
3844b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3845b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3846b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3847b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3848b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3849b8e80941Smrg
3850b8e80941Smrg   dw[1] =
3851b8e80941Smrg      __gen_uint(values->FrontWinding, 0, 0) |
3852b8e80941Smrg      __gen_uint(values->ViewportTransformEnable, 1, 1) |
3853b8e80941Smrg      __gen_uint(values->BackFaceFillMode, 3, 4) |
3854b8e80941Smrg      __gen_uint(values->FrontFaceFillMode, 5, 6) |
3855b8e80941Smrg      __gen_uint(values->GlobalDepthOffsetEnablePoint, 7, 7) |
3856b8e80941Smrg      __gen_uint(values->GlobalDepthOffsetEnableWireframe, 8, 8) |
3857b8e80941Smrg      __gen_uint(values->GlobalDepthOffsetEnableSolid, 9, 9) |
3858b8e80941Smrg      __gen_uint(values->StatisticsEnable, 10, 10) |
3859b8e80941Smrg      __gen_uint(values->LegacyGlobalDepthBiasEnable, 11, 11) |
3860b8e80941Smrg      __gen_uint(values->DepthBufferSurfaceFormat, 12, 14);
3861b8e80941Smrg
3862b8e80941Smrg   dw[2] =
3863b8e80941Smrg      __gen_uint(values->MultisampleRasterizationMode, 8, 9) |
3864b8e80941Smrg      __gen_uint(values->ScissorRectangleEnable, 11, 11) |
3865b8e80941Smrg      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 16, 17) |
3866b8e80941Smrg      __gen_ufixed(values->LineWidth, 18, 27, 7) |
3867b8e80941Smrg      __gen_uint(values->CullMode, 29, 30) |
3868b8e80941Smrg      __gen_uint(values->AntiAliasingEnable, 31, 31);
3869b8e80941Smrg
3870b8e80941Smrg   dw[3] =
3871b8e80941Smrg      __gen_ufixed(values->PointWidth, 0, 10, 3) |
3872b8e80941Smrg      __gen_uint(values->PointWidthSource, 11, 11) |
3873b8e80941Smrg      __gen_uint(values->VertexSubPixelPrecisionSelect, 12, 12) |
3874b8e80941Smrg      __gen_uint(values->AALineDistanceMode, 14, 14) |
3875b8e80941Smrg      __gen_uint(values->TriangleFanProvokingVertexSelect, 25, 26) |
3876b8e80941Smrg      __gen_uint(values->LineStripListProvokingVertexSelect, 27, 28) |
3877b8e80941Smrg      __gen_uint(values->TriangleStripListProvokingVertexSelect, 29, 30) |
3878b8e80941Smrg      __gen_uint(values->LastPixelEnable, 31, 31);
3879b8e80941Smrg
3880b8e80941Smrg   dw[4] =
3881b8e80941Smrg      __gen_float(values->GlobalDepthOffsetConstant);
3882b8e80941Smrg
3883b8e80941Smrg   dw[5] =
3884b8e80941Smrg      __gen_float(values->GlobalDepthOffsetScale);
3885b8e80941Smrg
3886b8e80941Smrg   dw[6] =
3887b8e80941Smrg      __gen_float(values->GlobalDepthOffsetClamp);
3888b8e80941Smrg}
3889b8e80941Smrg
3890b8e80941Smrg#define GEN7_3DSTATE_SO_BUFFER_length          4
3891b8e80941Smrg#define GEN7_3DSTATE_SO_BUFFER_length_bias      2
3892b8e80941Smrg#define GEN7_3DSTATE_SO_BUFFER_header           \
3893b8e80941Smrg   .DWordLength                         =      2,  \
3894b8e80941Smrg   ._3DCommandSubOpcode                 =     24,  \
3895b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
3896b8e80941Smrg   .CommandSubType                      =      3,  \
3897b8e80941Smrg   .CommandType                         =      3
3898b8e80941Smrg
3899b8e80941Smrgstruct GEN7_3DSTATE_SO_BUFFER {
3900b8e80941Smrg   uint32_t                             DWordLength;
3901b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3902b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3903b8e80941Smrg   uint32_t                             CommandSubType;
3904b8e80941Smrg   uint32_t                             CommandType;
3905b8e80941Smrg   uint32_t                             SurfacePitch;
3906b8e80941Smrg   uint32_t                             MOCS;
3907b8e80941Smrg   uint32_t                             SOBufferIndex;
3908b8e80941Smrg   __gen_address_type                   SurfaceBaseAddress;
3909b8e80941Smrg   __gen_address_type                   SurfaceEndAddress;
3910b8e80941Smrg};
3911b8e80941Smrg
3912b8e80941Smrgstatic inline void
3913b8e80941SmrgGEN7_3DSTATE_SO_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
3914b8e80941Smrg                            __attribute__((unused)) void * restrict dst,
3915b8e80941Smrg                            __attribute__((unused)) const struct GEN7_3DSTATE_SO_BUFFER * restrict values)
3916b8e80941Smrg{
3917b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3918b8e80941Smrg
3919b8e80941Smrg   dw[0] =
3920b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
3921b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3922b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3923b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3924b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3925b8e80941Smrg
3926b8e80941Smrg   dw[1] =
3927b8e80941Smrg      __gen_uint(values->SurfacePitch, 0, 11) |
3928b8e80941Smrg      __gen_uint(values->MOCS, 25, 28) |
3929b8e80941Smrg      __gen_uint(values->SOBufferIndex, 29, 30);
3930b8e80941Smrg
3931b8e80941Smrg   dw[2] = __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
3932b8e80941Smrg
3933b8e80941Smrg   dw[3] = __gen_combine_address(data, &dw[3], values->SurfaceEndAddress, 0);
3934b8e80941Smrg}
3935b8e80941Smrg
3936b8e80941Smrg#define GEN7_3DSTATE_SO_DECL_LIST_length_bias      2
3937b8e80941Smrg#define GEN7_3DSTATE_SO_DECL_LIST_header        \
3938b8e80941Smrg   ._3DCommandSubOpcode                 =     23,  \
3939b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
3940b8e80941Smrg   .CommandSubType                      =      3,  \
3941b8e80941Smrg   .CommandType                         =      3
3942b8e80941Smrg
3943b8e80941Smrgstruct GEN7_3DSTATE_SO_DECL_LIST {
3944b8e80941Smrg   uint32_t                             DWordLength;
3945b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3946b8e80941Smrg   uint32_t                             _3DCommandOpcode;
3947b8e80941Smrg   uint32_t                             CommandSubType;
3948b8e80941Smrg   uint32_t                             CommandType;
3949b8e80941Smrg   uint32_t                             StreamtoBufferSelects0;
3950b8e80941Smrg   uint32_t                             StreamtoBufferSelects1;
3951b8e80941Smrg   uint32_t                             StreamtoBufferSelects2;
3952b8e80941Smrg   uint32_t                             StreamtoBufferSelects3;
3953b8e80941Smrg   uint32_t                             NumEntries0;
3954b8e80941Smrg   uint32_t                             NumEntries1;
3955b8e80941Smrg   uint32_t                             NumEntries2;
3956b8e80941Smrg   uint32_t                             NumEntries3;
3957b8e80941Smrg   /* variable length fields follow */
3958b8e80941Smrg};
3959b8e80941Smrg
3960b8e80941Smrgstatic inline void
3961b8e80941SmrgGEN7_3DSTATE_SO_DECL_LIST_pack(__attribute__((unused)) __gen_user_data *data,
3962b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
3963b8e80941Smrg                               __attribute__((unused)) const struct GEN7_3DSTATE_SO_DECL_LIST * restrict values)
3964b8e80941Smrg{
3965b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
3966b8e80941Smrg
3967b8e80941Smrg   dw[0] =
3968b8e80941Smrg      __gen_uint(values->DWordLength, 0, 8) |
3969b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
3970b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
3971b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
3972b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
3973b8e80941Smrg
3974b8e80941Smrg   dw[1] =
3975b8e80941Smrg      __gen_uint(values->StreamtoBufferSelects0, 0, 3) |
3976b8e80941Smrg      __gen_uint(values->StreamtoBufferSelects1, 4, 7) |
3977b8e80941Smrg      __gen_uint(values->StreamtoBufferSelects2, 8, 11) |
3978b8e80941Smrg      __gen_uint(values->StreamtoBufferSelects3, 12, 15);
3979b8e80941Smrg
3980b8e80941Smrg   dw[2] =
3981b8e80941Smrg      __gen_uint(values->NumEntries0, 0, 7) |
3982b8e80941Smrg      __gen_uint(values->NumEntries1, 8, 15) |
3983b8e80941Smrg      __gen_uint(values->NumEntries2, 16, 23) |
3984b8e80941Smrg      __gen_uint(values->NumEntries3, 24, 31);
3985b8e80941Smrg}
3986b8e80941Smrg
3987b8e80941Smrg#define GEN7_3DSTATE_STENCIL_BUFFER_length      3
3988b8e80941Smrg#define GEN7_3DSTATE_STENCIL_BUFFER_length_bias      2
3989b8e80941Smrg#define GEN7_3DSTATE_STENCIL_BUFFER_header      \
3990b8e80941Smrg   .DWordLength                         =      1,  \
3991b8e80941Smrg   ._3DCommandSubOpcode                 =      6,  \
3992b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
3993b8e80941Smrg   .CommandSubType                      =      3,  \
3994b8e80941Smrg   .CommandType                         =      3
3995b8e80941Smrg
3996b8e80941Smrgstruct GEN7_3DSTATE_STENCIL_BUFFER {
3997b8e80941Smrg   uint32_t                             DWordLength;
3998b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
3999b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4000b8e80941Smrg   uint32_t                             CommandSubType;
4001b8e80941Smrg   uint32_t                             CommandType;
4002b8e80941Smrg   uint32_t                             SurfacePitch;
4003b8e80941Smrg   uint32_t                             MOCS;
4004b8e80941Smrg   __gen_address_type                   SurfaceBaseAddress;
4005b8e80941Smrg};
4006b8e80941Smrg
4007b8e80941Smrgstatic inline void
4008b8e80941SmrgGEN7_3DSTATE_STENCIL_BUFFER_pack(__attribute__((unused)) __gen_user_data *data,
4009b8e80941Smrg                                 __attribute__((unused)) void * restrict dst,
4010b8e80941Smrg                                 __attribute__((unused)) const struct GEN7_3DSTATE_STENCIL_BUFFER * restrict values)
4011b8e80941Smrg{
4012b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4013b8e80941Smrg
4014b8e80941Smrg   dw[0] =
4015b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4016b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4017b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4018b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4019b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4020b8e80941Smrg
4021b8e80941Smrg   dw[1] =
4022b8e80941Smrg      __gen_uint(values->SurfacePitch, 0, 16) |
4023b8e80941Smrg      __gen_uint(values->MOCS, 25, 28);
4024b8e80941Smrg
4025b8e80941Smrg   dw[2] = __gen_combine_address(data, &dw[2], values->SurfaceBaseAddress, 0);
4026b8e80941Smrg}
4027b8e80941Smrg
4028b8e80941Smrg#define GEN7_3DSTATE_STREAMOUT_length          3
4029b8e80941Smrg#define GEN7_3DSTATE_STREAMOUT_length_bias      2
4030b8e80941Smrg#define GEN7_3DSTATE_STREAMOUT_header           \
4031b8e80941Smrg   .DWordLength                         =      1,  \
4032b8e80941Smrg   ._3DCommandSubOpcode                 =     30,  \
4033b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4034b8e80941Smrg   .CommandSubType                      =      3,  \
4035b8e80941Smrg   .CommandType                         =      3
4036b8e80941Smrg
4037b8e80941Smrgstruct GEN7_3DSTATE_STREAMOUT {
4038b8e80941Smrg   uint32_t                             DWordLength;
4039b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4040b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4041b8e80941Smrg   uint32_t                             CommandSubType;
4042b8e80941Smrg   uint32_t                             CommandType;
4043b8e80941Smrg   bool                                 SOBufferEnable0;
4044b8e80941Smrg   bool                                 SOBufferEnable1;
4045b8e80941Smrg   bool                                 SOBufferEnable2;
4046b8e80941Smrg   bool                                 SOBufferEnable3;
4047b8e80941Smrg   bool                                 SOStatisticsEnable;
4048b8e80941Smrg   uint32_t                             ReorderMode;
4049b8e80941Smrg#define LEADING                                  0
4050b8e80941Smrg#define TRAILING                                 1
4051b8e80941Smrg   uint32_t                             RenderStreamSelect;
4052b8e80941Smrg   bool                                 RenderingDisable;
4053b8e80941Smrg   bool                                 SOFunctionEnable;
4054b8e80941Smrg   uint32_t                             Stream0VertexReadLength;
4055b8e80941Smrg   uint32_t                             Stream0VertexReadOffset;
4056b8e80941Smrg   uint32_t                             Stream1VertexReadLength;
4057b8e80941Smrg   uint32_t                             Stream1VertexReadOffset;
4058b8e80941Smrg   uint32_t                             Stream2VertexReadLength;
4059b8e80941Smrg   uint32_t                             Stream2VertexReadOffset;
4060b8e80941Smrg   uint32_t                             Stream3VertexReadLength;
4061b8e80941Smrg   uint32_t                             Stream3VertexReadOffset;
4062b8e80941Smrg};
4063b8e80941Smrg
4064b8e80941Smrgstatic inline void
4065b8e80941SmrgGEN7_3DSTATE_STREAMOUT_pack(__attribute__((unused)) __gen_user_data *data,
4066b8e80941Smrg                            __attribute__((unused)) void * restrict dst,
4067b8e80941Smrg                            __attribute__((unused)) const struct GEN7_3DSTATE_STREAMOUT * restrict values)
4068b8e80941Smrg{
4069b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4070b8e80941Smrg
4071b8e80941Smrg   dw[0] =
4072b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4073b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4074b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4075b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4076b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4077b8e80941Smrg
4078b8e80941Smrg   dw[1] =
4079b8e80941Smrg      __gen_uint(values->SOBufferEnable0, 8, 8) |
4080b8e80941Smrg      __gen_uint(values->SOBufferEnable1, 9, 9) |
4081b8e80941Smrg      __gen_uint(values->SOBufferEnable2, 10, 10) |
4082b8e80941Smrg      __gen_uint(values->SOBufferEnable3, 11, 11) |
4083b8e80941Smrg      __gen_uint(values->SOStatisticsEnable, 25, 25) |
4084b8e80941Smrg      __gen_uint(values->ReorderMode, 26, 26) |
4085b8e80941Smrg      __gen_uint(values->RenderStreamSelect, 27, 28) |
4086b8e80941Smrg      __gen_uint(values->RenderingDisable, 30, 30) |
4087b8e80941Smrg      __gen_uint(values->SOFunctionEnable, 31, 31);
4088b8e80941Smrg
4089b8e80941Smrg   dw[2] =
4090b8e80941Smrg      __gen_uint(values->Stream0VertexReadLength, 0, 4) |
4091b8e80941Smrg      __gen_uint(values->Stream0VertexReadOffset, 5, 5) |
4092b8e80941Smrg      __gen_uint(values->Stream1VertexReadLength, 8, 12) |
4093b8e80941Smrg      __gen_uint(values->Stream1VertexReadOffset, 13, 13) |
4094b8e80941Smrg      __gen_uint(values->Stream2VertexReadLength, 16, 20) |
4095b8e80941Smrg      __gen_uint(values->Stream2VertexReadOffset, 21, 21) |
4096b8e80941Smrg      __gen_uint(values->Stream3VertexReadLength, 24, 28) |
4097b8e80941Smrg      __gen_uint(values->Stream3VertexReadOffset, 29, 29);
4098b8e80941Smrg}
4099b8e80941Smrg
4100b8e80941Smrg#define GEN7_3DSTATE_TE_length                 4
4101b8e80941Smrg#define GEN7_3DSTATE_TE_length_bias            2
4102b8e80941Smrg#define GEN7_3DSTATE_TE_header                  \
4103b8e80941Smrg   .DWordLength                         =      2,  \
4104b8e80941Smrg   ._3DCommandSubOpcode                 =     28,  \
4105b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4106b8e80941Smrg   .CommandSubType                      =      3,  \
4107b8e80941Smrg   .CommandType                         =      3
4108b8e80941Smrg
4109b8e80941Smrgstruct GEN7_3DSTATE_TE {
4110b8e80941Smrg   uint32_t                             DWordLength;
4111b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4112b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4113b8e80941Smrg   uint32_t                             CommandSubType;
4114b8e80941Smrg   uint32_t                             CommandType;
4115b8e80941Smrg   bool                                 TEEnable;
4116b8e80941Smrg   uint32_t                             TEMode;
4117b8e80941Smrg#define HW_TESS                                  0
4118b8e80941Smrg#define SW_TESS                                  1
4119b8e80941Smrg   uint32_t                             TEDomain;
4120b8e80941Smrg#define QUAD                                     0
4121b8e80941Smrg#define TRI                                      1
4122b8e80941Smrg#define ISOLINE                                  2
4123b8e80941Smrg   uint32_t                             OutputTopology;
4124b8e80941Smrg#define OUTPUT_POINT                             0
4125b8e80941Smrg#define OUTPUT_LINE                              1
4126b8e80941Smrg#define OUTPUT_TRI_CW                            2
4127b8e80941Smrg#define OUTPUT_TRI_CCW                           3
4128b8e80941Smrg   uint32_t                             Partitioning;
4129b8e80941Smrg#define INTEGER                                  0
4130b8e80941Smrg#define ODD_FRACTIONAL                           1
4131b8e80941Smrg#define EVEN_FRACTIONAL                          2
4132b8e80941Smrg   float                                MaximumTessellationFactorOdd;
4133b8e80941Smrg   float                                MaximumTessellationFactorNotOdd;
4134b8e80941Smrg};
4135b8e80941Smrg
4136b8e80941Smrgstatic inline void
4137b8e80941SmrgGEN7_3DSTATE_TE_pack(__attribute__((unused)) __gen_user_data *data,
4138b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
4139b8e80941Smrg                     __attribute__((unused)) const struct GEN7_3DSTATE_TE * restrict values)
4140b8e80941Smrg{
4141b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4142b8e80941Smrg
4143b8e80941Smrg   dw[0] =
4144b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4145b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4146b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4147b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4148b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4149b8e80941Smrg
4150b8e80941Smrg   dw[1] =
4151b8e80941Smrg      __gen_uint(values->TEEnable, 0, 0) |
4152b8e80941Smrg      __gen_uint(values->TEMode, 1, 2) |
4153b8e80941Smrg      __gen_uint(values->TEDomain, 4, 5) |
4154b8e80941Smrg      __gen_uint(values->OutputTopology, 8, 9) |
4155b8e80941Smrg      __gen_uint(values->Partitioning, 12, 13);
4156b8e80941Smrg
4157b8e80941Smrg   dw[2] =
4158b8e80941Smrg      __gen_float(values->MaximumTessellationFactorOdd);
4159b8e80941Smrg
4160b8e80941Smrg   dw[3] =
4161b8e80941Smrg      __gen_float(values->MaximumTessellationFactorNotOdd);
4162b8e80941Smrg}
4163b8e80941Smrg
4164b8e80941Smrg#define GEN7_3DSTATE_URB_DS_length             2
4165b8e80941Smrg#define GEN7_3DSTATE_URB_DS_length_bias        2
4166b8e80941Smrg#define GEN7_3DSTATE_URB_DS_header              \
4167b8e80941Smrg   .DWordLength                         =      0,  \
4168b8e80941Smrg   ._3DCommandSubOpcode                 =     50,  \
4169b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4170b8e80941Smrg   .CommandSubType                      =      3,  \
4171b8e80941Smrg   .CommandType                         =      3
4172b8e80941Smrg
4173b8e80941Smrgstruct GEN7_3DSTATE_URB_DS {
4174b8e80941Smrg   uint32_t                             DWordLength;
4175b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4176b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4177b8e80941Smrg   uint32_t                             CommandSubType;
4178b8e80941Smrg   uint32_t                             CommandType;
4179b8e80941Smrg   uint32_t                             DSNumberofURBEntries;
4180b8e80941Smrg   uint32_t                             DSURBEntryAllocationSize;
4181b8e80941Smrg   uint32_t                             DSURBStartingAddress;
4182b8e80941Smrg};
4183b8e80941Smrg
4184b8e80941Smrgstatic inline void
4185b8e80941SmrgGEN7_3DSTATE_URB_DS_pack(__attribute__((unused)) __gen_user_data *data,
4186b8e80941Smrg                         __attribute__((unused)) void * restrict dst,
4187b8e80941Smrg                         __attribute__((unused)) const struct GEN7_3DSTATE_URB_DS * restrict values)
4188b8e80941Smrg{
4189b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4190b8e80941Smrg
4191b8e80941Smrg   dw[0] =
4192b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4193b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4194b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4195b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4196b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4197b8e80941Smrg
4198b8e80941Smrg   dw[1] =
4199b8e80941Smrg      __gen_uint(values->DSNumberofURBEntries, 0, 15) |
4200b8e80941Smrg      __gen_uint(values->DSURBEntryAllocationSize, 16, 24) |
4201b8e80941Smrg      __gen_uint(values->DSURBStartingAddress, 25, 29);
4202b8e80941Smrg}
4203b8e80941Smrg
4204b8e80941Smrg#define GEN7_3DSTATE_URB_GS_length             2
4205b8e80941Smrg#define GEN7_3DSTATE_URB_GS_length_bias        2
4206b8e80941Smrg#define GEN7_3DSTATE_URB_GS_header              \
4207b8e80941Smrg   .DWordLength                         =      0,  \
4208b8e80941Smrg   ._3DCommandSubOpcode                 =     51,  \
4209b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4210b8e80941Smrg   .CommandSubType                      =      3,  \
4211b8e80941Smrg   .CommandType                         =      3
4212b8e80941Smrg
4213b8e80941Smrgstruct GEN7_3DSTATE_URB_GS {
4214b8e80941Smrg   uint32_t                             DWordLength;
4215b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4216b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4217b8e80941Smrg   uint32_t                             CommandSubType;
4218b8e80941Smrg   uint32_t                             CommandType;
4219b8e80941Smrg   uint32_t                             GSNumberofURBEntries;
4220b8e80941Smrg   uint32_t                             GSURBEntryAllocationSize;
4221b8e80941Smrg   uint32_t                             GSURBStartingAddress;
4222b8e80941Smrg};
4223b8e80941Smrg
4224b8e80941Smrgstatic inline void
4225b8e80941SmrgGEN7_3DSTATE_URB_GS_pack(__attribute__((unused)) __gen_user_data *data,
4226b8e80941Smrg                         __attribute__((unused)) void * restrict dst,
4227b8e80941Smrg                         __attribute__((unused)) const struct GEN7_3DSTATE_URB_GS * restrict values)
4228b8e80941Smrg{
4229b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4230b8e80941Smrg
4231b8e80941Smrg   dw[0] =
4232b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4233b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4234b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4235b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4236b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4237b8e80941Smrg
4238b8e80941Smrg   dw[1] =
4239b8e80941Smrg      __gen_uint(values->GSNumberofURBEntries, 0, 15) |
4240b8e80941Smrg      __gen_uint(values->GSURBEntryAllocationSize, 16, 24) |
4241b8e80941Smrg      __gen_uint(values->GSURBStartingAddress, 25, 29);
4242b8e80941Smrg}
4243b8e80941Smrg
4244b8e80941Smrg#define GEN7_3DSTATE_URB_HS_length             2
4245b8e80941Smrg#define GEN7_3DSTATE_URB_HS_length_bias        2
4246b8e80941Smrg#define GEN7_3DSTATE_URB_HS_header              \
4247b8e80941Smrg   .DWordLength                         =      0,  \
4248b8e80941Smrg   ._3DCommandSubOpcode                 =     49,  \
4249b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4250b8e80941Smrg   .CommandSubType                      =      3,  \
4251b8e80941Smrg   .CommandType                         =      3
4252b8e80941Smrg
4253b8e80941Smrgstruct GEN7_3DSTATE_URB_HS {
4254b8e80941Smrg   uint32_t                             DWordLength;
4255b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4256b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4257b8e80941Smrg   uint32_t                             CommandSubType;
4258b8e80941Smrg   uint32_t                             CommandType;
4259b8e80941Smrg   uint32_t                             HSNumberofURBEntries;
4260b8e80941Smrg   uint32_t                             HSURBEntryAllocationSize;
4261b8e80941Smrg   uint32_t                             HSURBStartingAddress;
4262b8e80941Smrg};
4263b8e80941Smrg
4264b8e80941Smrgstatic inline void
4265b8e80941SmrgGEN7_3DSTATE_URB_HS_pack(__attribute__((unused)) __gen_user_data *data,
4266b8e80941Smrg                         __attribute__((unused)) void * restrict dst,
4267b8e80941Smrg                         __attribute__((unused)) const struct GEN7_3DSTATE_URB_HS * restrict values)
4268b8e80941Smrg{
4269b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4270b8e80941Smrg
4271b8e80941Smrg   dw[0] =
4272b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4273b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4274b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4275b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4276b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4277b8e80941Smrg
4278b8e80941Smrg   dw[1] =
4279b8e80941Smrg      __gen_uint(values->HSNumberofURBEntries, 0, 15) |
4280b8e80941Smrg      __gen_uint(values->HSURBEntryAllocationSize, 16, 24) |
4281b8e80941Smrg      __gen_uint(values->HSURBStartingAddress, 25, 29);
4282b8e80941Smrg}
4283b8e80941Smrg
4284b8e80941Smrg#define GEN7_3DSTATE_URB_VS_length             2
4285b8e80941Smrg#define GEN7_3DSTATE_URB_VS_length_bias        2
4286b8e80941Smrg#define GEN7_3DSTATE_URB_VS_header              \
4287b8e80941Smrg   .DWordLength                         =      0,  \
4288b8e80941Smrg   ._3DCommandSubOpcode                 =     48,  \
4289b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4290b8e80941Smrg   .CommandSubType                      =      3,  \
4291b8e80941Smrg   .CommandType                         =      3
4292b8e80941Smrg
4293b8e80941Smrgstruct GEN7_3DSTATE_URB_VS {
4294b8e80941Smrg   uint32_t                             DWordLength;
4295b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4296b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4297b8e80941Smrg   uint32_t                             CommandSubType;
4298b8e80941Smrg   uint32_t                             CommandType;
4299b8e80941Smrg   uint32_t                             VSNumberofURBEntries;
4300b8e80941Smrg   uint32_t                             VSURBEntryAllocationSize;
4301b8e80941Smrg   uint32_t                             VSURBStartingAddress;
4302b8e80941Smrg};
4303b8e80941Smrg
4304b8e80941Smrgstatic inline void
4305b8e80941SmrgGEN7_3DSTATE_URB_VS_pack(__attribute__((unused)) __gen_user_data *data,
4306b8e80941Smrg                         __attribute__((unused)) void * restrict dst,
4307b8e80941Smrg                         __attribute__((unused)) const struct GEN7_3DSTATE_URB_VS * restrict values)
4308b8e80941Smrg{
4309b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4310b8e80941Smrg
4311b8e80941Smrg   dw[0] =
4312b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4313b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4314b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4315b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4316b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4317b8e80941Smrg
4318b8e80941Smrg   dw[1] =
4319b8e80941Smrg      __gen_uint(values->VSNumberofURBEntries, 0, 15) |
4320b8e80941Smrg      __gen_uint(values->VSURBEntryAllocationSize, 16, 24) |
4321b8e80941Smrg      __gen_uint(values->VSURBStartingAddress, 25, 29);
4322b8e80941Smrg}
4323b8e80941Smrg
4324b8e80941Smrg#define GEN7_3DSTATE_VERTEX_BUFFERS_length_bias      2
4325b8e80941Smrg#define GEN7_3DSTATE_VERTEX_BUFFERS_header      \
4326b8e80941Smrg   .DWordLength                         =      3,  \
4327b8e80941Smrg   ._3DCommandSubOpcode                 =      8,  \
4328b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4329b8e80941Smrg   .CommandSubType                      =      3,  \
4330b8e80941Smrg   .CommandType                         =      3
4331b8e80941Smrg
4332b8e80941Smrgstruct GEN7_3DSTATE_VERTEX_BUFFERS {
4333b8e80941Smrg   uint32_t                             DWordLength;
4334b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4335b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4336b8e80941Smrg   uint32_t                             CommandSubType;
4337b8e80941Smrg   uint32_t                             CommandType;
4338b8e80941Smrg   /* variable length fields follow */
4339b8e80941Smrg};
4340b8e80941Smrg
4341b8e80941Smrgstatic inline void
4342b8e80941SmrgGEN7_3DSTATE_VERTEX_BUFFERS_pack(__attribute__((unused)) __gen_user_data *data,
4343b8e80941Smrg                                 __attribute__((unused)) void * restrict dst,
4344b8e80941Smrg                                 __attribute__((unused)) const struct GEN7_3DSTATE_VERTEX_BUFFERS * restrict values)
4345b8e80941Smrg{
4346b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4347b8e80941Smrg
4348b8e80941Smrg   dw[0] =
4349b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4350b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4351b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4352b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4353b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4354b8e80941Smrg}
4355b8e80941Smrg
4356b8e80941Smrg#define GEN7_3DSTATE_VERTEX_ELEMENTS_length_bias      2
4357b8e80941Smrg#define GEN7_3DSTATE_VERTEX_ELEMENTS_header     \
4358b8e80941Smrg   .DWordLength                         =      1,  \
4359b8e80941Smrg   ._3DCommandSubOpcode                 =      9,  \
4360b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4361b8e80941Smrg   .CommandSubType                      =      3,  \
4362b8e80941Smrg   .CommandType                         =      3
4363b8e80941Smrg
4364b8e80941Smrgstruct GEN7_3DSTATE_VERTEX_ELEMENTS {
4365b8e80941Smrg   uint32_t                             DWordLength;
4366b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4367b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4368b8e80941Smrg   uint32_t                             CommandSubType;
4369b8e80941Smrg   uint32_t                             CommandType;
4370b8e80941Smrg   /* variable length fields follow */
4371b8e80941Smrg};
4372b8e80941Smrg
4373b8e80941Smrgstatic inline void
4374b8e80941SmrgGEN7_3DSTATE_VERTEX_ELEMENTS_pack(__attribute__((unused)) __gen_user_data *data,
4375b8e80941Smrg                                  __attribute__((unused)) void * restrict dst,
4376b8e80941Smrg                                  __attribute__((unused)) const struct GEN7_3DSTATE_VERTEX_ELEMENTS * restrict values)
4377b8e80941Smrg{
4378b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4379b8e80941Smrg
4380b8e80941Smrg   dw[0] =
4381b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4382b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4383b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4384b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4385b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4386b8e80941Smrg}
4387b8e80941Smrg
4388b8e80941Smrg#define GEN7_3DSTATE_VF_STATISTICS_length      1
4389b8e80941Smrg#define GEN7_3DSTATE_VF_STATISTICS_length_bias      1
4390b8e80941Smrg#define GEN7_3DSTATE_VF_STATISTICS_header       \
4391b8e80941Smrg   ._3DCommandSubOpcode                 =     11,  \
4392b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4393b8e80941Smrg   .CommandSubType                      =      1,  \
4394b8e80941Smrg   .CommandType                         =      3
4395b8e80941Smrg
4396b8e80941Smrgstruct GEN7_3DSTATE_VF_STATISTICS {
4397b8e80941Smrg   bool                                 StatisticsEnable;
4398b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4399b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4400b8e80941Smrg   uint32_t                             CommandSubType;
4401b8e80941Smrg   uint32_t                             CommandType;
4402b8e80941Smrg};
4403b8e80941Smrg
4404b8e80941Smrgstatic inline void
4405b8e80941SmrgGEN7_3DSTATE_VF_STATISTICS_pack(__attribute__((unused)) __gen_user_data *data,
4406b8e80941Smrg                                __attribute__((unused)) void * restrict dst,
4407b8e80941Smrg                                __attribute__((unused)) const struct GEN7_3DSTATE_VF_STATISTICS * restrict values)
4408b8e80941Smrg{
4409b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4410b8e80941Smrg
4411b8e80941Smrg   dw[0] =
4412b8e80941Smrg      __gen_uint(values->StatisticsEnable, 0, 0) |
4413b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4414b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4415b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4416b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4417b8e80941Smrg}
4418b8e80941Smrg
4419b8e80941Smrg#define GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_CC_length      2
4420b8e80941Smrg#define GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_CC_length_bias      2
4421b8e80941Smrg#define GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_CC_header\
4422b8e80941Smrg   .DWordLength                         =      0,  \
4423b8e80941Smrg   ._3DCommandSubOpcode                 =     35,  \
4424b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4425b8e80941Smrg   .CommandSubType                      =      3,  \
4426b8e80941Smrg   .CommandType                         =      3
4427b8e80941Smrg
4428b8e80941Smrgstruct GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_CC {
4429b8e80941Smrg   uint32_t                             DWordLength;
4430b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4431b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4432b8e80941Smrg   uint32_t                             CommandSubType;
4433b8e80941Smrg   uint32_t                             CommandType;
4434b8e80941Smrg   uint64_t                             CCViewportPointer;
4435b8e80941Smrg};
4436b8e80941Smrg
4437b8e80941Smrgstatic inline void
4438b8e80941SmrgGEN7_3DSTATE_VIEWPORT_STATE_POINTERS_CC_pack(__attribute__((unused)) __gen_user_data *data,
4439b8e80941Smrg                                             __attribute__((unused)) void * restrict dst,
4440b8e80941Smrg                                             __attribute__((unused)) const struct GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_CC * restrict values)
4441b8e80941Smrg{
4442b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4443b8e80941Smrg
4444b8e80941Smrg   dw[0] =
4445b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4446b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4447b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4448b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4449b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4450b8e80941Smrg
4451b8e80941Smrg   dw[1] =
4452b8e80941Smrg      __gen_offset(values->CCViewportPointer, 5, 31);
4453b8e80941Smrg}
4454b8e80941Smrg
4455b8e80941Smrg#define GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_length      2
4456b8e80941Smrg#define GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_length_bias      2
4457b8e80941Smrg#define GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_header\
4458b8e80941Smrg   .DWordLength                         =      0,  \
4459b8e80941Smrg   ._3DCommandSubOpcode                 =     33,  \
4460b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4461b8e80941Smrg   .CommandSubType                      =      3,  \
4462b8e80941Smrg   .CommandType                         =      3
4463b8e80941Smrg
4464b8e80941Smrgstruct GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP {
4465b8e80941Smrg   uint32_t                             DWordLength;
4466b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4467b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4468b8e80941Smrg   uint32_t                             CommandSubType;
4469b8e80941Smrg   uint32_t                             CommandType;
4470b8e80941Smrg   uint64_t                             SFClipViewportPointer;
4471b8e80941Smrg};
4472b8e80941Smrg
4473b8e80941Smrgstatic inline void
4474b8e80941SmrgGEN7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP_pack(__attribute__((unused)) __gen_user_data *data,
4475b8e80941Smrg                                                  __attribute__((unused)) void * restrict dst,
4476b8e80941Smrg                                                  __attribute__((unused)) const struct GEN7_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP * restrict values)
4477b8e80941Smrg{
4478b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4479b8e80941Smrg
4480b8e80941Smrg   dw[0] =
4481b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4482b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4483b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4484b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4485b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4486b8e80941Smrg
4487b8e80941Smrg   dw[1] =
4488b8e80941Smrg      __gen_offset(values->SFClipViewportPointer, 6, 31);
4489b8e80941Smrg}
4490b8e80941Smrg
4491b8e80941Smrg#define GEN7_3DSTATE_VS_length                 6
4492b8e80941Smrg#define GEN7_3DSTATE_VS_length_bias            2
4493b8e80941Smrg#define GEN7_3DSTATE_VS_header                  \
4494b8e80941Smrg   .DWordLength                         =      4,  \
4495b8e80941Smrg   ._3DCommandSubOpcode                 =     16,  \
4496b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4497b8e80941Smrg   .CommandSubType                      =      3,  \
4498b8e80941Smrg   .CommandType                         =      3
4499b8e80941Smrg
4500b8e80941Smrgstruct GEN7_3DSTATE_VS {
4501b8e80941Smrg   uint32_t                             DWordLength;
4502b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4503b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4504b8e80941Smrg   uint32_t                             CommandSubType;
4505b8e80941Smrg   uint32_t                             CommandType;
4506b8e80941Smrg   uint64_t                             KernelStartPointer;
4507b8e80941Smrg   bool                                 SoftwareExceptionEnable;
4508b8e80941Smrg   bool                                 IllegalOpcodeExceptionEnable;
4509b8e80941Smrg   uint32_t                             FloatingPointMode;
4510b8e80941Smrg#define IEEE754                                  0
4511b8e80941Smrg#define Alternate                                1
4512b8e80941Smrg   uint32_t                             BindingTableEntryCount;
4513b8e80941Smrg   uint32_t                             SamplerCount;
4514b8e80941Smrg#define NoSamplers                               0
4515b8e80941Smrg#define _14Samplers                              1
4516b8e80941Smrg#define _58Samplers                              2
4517b8e80941Smrg#define _912Samplers                             3
4518b8e80941Smrg#define _1316Samplers                            4
4519b8e80941Smrg   bool                                 VectorMaskEnable;
4520b8e80941Smrg   bool                                 SingleVertexDispatch;
4521b8e80941Smrg   uint32_t                             PerThreadScratchSpace;
4522b8e80941Smrg   __gen_address_type                   ScratchSpaceBasePointer;
4523b8e80941Smrg   uint32_t                             VertexURBEntryReadOffset;
4524b8e80941Smrg   uint32_t                             VertexURBEntryReadLength;
4525b8e80941Smrg   uint32_t                             DispatchGRFStartRegisterForURBData;
4526b8e80941Smrg   bool                                 Enable;
4527b8e80941Smrg   bool                                 VertexCacheDisable;
4528b8e80941Smrg   bool                                 StatisticsEnable;
4529b8e80941Smrg   uint32_t                             MaximumNumberofThreads;
4530b8e80941Smrg};
4531b8e80941Smrg
4532b8e80941Smrgstatic inline void
4533b8e80941SmrgGEN7_3DSTATE_VS_pack(__attribute__((unused)) __gen_user_data *data,
4534b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
4535b8e80941Smrg                     __attribute__((unused)) const struct GEN7_3DSTATE_VS * restrict values)
4536b8e80941Smrg{
4537b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4538b8e80941Smrg
4539b8e80941Smrg   dw[0] =
4540b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4541b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4542b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4543b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4544b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4545b8e80941Smrg
4546b8e80941Smrg   dw[1] =
4547b8e80941Smrg      __gen_offset(values->KernelStartPointer, 6, 31);
4548b8e80941Smrg
4549b8e80941Smrg   dw[2] =
4550b8e80941Smrg      __gen_uint(values->SoftwareExceptionEnable, 7, 7) |
4551b8e80941Smrg      __gen_uint(values->IllegalOpcodeExceptionEnable, 13, 13) |
4552b8e80941Smrg      __gen_uint(values->FloatingPointMode, 16, 16) |
4553b8e80941Smrg      __gen_uint(values->BindingTableEntryCount, 18, 25) |
4554b8e80941Smrg      __gen_uint(values->SamplerCount, 27, 29) |
4555b8e80941Smrg      __gen_uint(values->VectorMaskEnable, 30, 30) |
4556b8e80941Smrg      __gen_uint(values->SingleVertexDispatch, 31, 31);
4557b8e80941Smrg
4558b8e80941Smrg   const uint32_t v3 =
4559b8e80941Smrg      __gen_uint(values->PerThreadScratchSpace, 0, 3);
4560b8e80941Smrg   dw[3] = __gen_combine_address(data, &dw[3], values->ScratchSpaceBasePointer, v3);
4561b8e80941Smrg
4562b8e80941Smrg   dw[4] =
4563b8e80941Smrg      __gen_uint(values->VertexURBEntryReadOffset, 4, 9) |
4564b8e80941Smrg      __gen_uint(values->VertexURBEntryReadLength, 11, 16) |
4565b8e80941Smrg      __gen_uint(values->DispatchGRFStartRegisterForURBData, 20, 24);
4566b8e80941Smrg
4567b8e80941Smrg   dw[5] =
4568b8e80941Smrg      __gen_uint(values->Enable, 0, 0) |
4569b8e80941Smrg      __gen_uint(values->VertexCacheDisable, 1, 1) |
4570b8e80941Smrg      __gen_uint(values->StatisticsEnable, 10, 10) |
4571b8e80941Smrg      __gen_uint(values->MaximumNumberofThreads, 25, 31);
4572b8e80941Smrg}
4573b8e80941Smrg
4574b8e80941Smrg#define GEN7_3DSTATE_WM_length                 3
4575b8e80941Smrg#define GEN7_3DSTATE_WM_length_bias            2
4576b8e80941Smrg#define GEN7_3DSTATE_WM_header                  \
4577b8e80941Smrg   .DWordLength                         =      1,  \
4578b8e80941Smrg   ._3DCommandSubOpcode                 =     20,  \
4579b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
4580b8e80941Smrg   .CommandSubType                      =      3,  \
4581b8e80941Smrg   .CommandType                         =      3
4582b8e80941Smrg
4583b8e80941Smrgstruct GEN7_3DSTATE_WM {
4584b8e80941Smrg   uint32_t                             DWordLength;
4585b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
4586b8e80941Smrg   uint32_t                             _3DCommandOpcode;
4587b8e80941Smrg   uint32_t                             CommandSubType;
4588b8e80941Smrg   uint32_t                             CommandType;
4589b8e80941Smrg   uint32_t                             MultisampleRasterizationMode;
4590b8e80941Smrg#define MSRASTMODE_OFF_PIXEL                     0
4591b8e80941Smrg#define MSRASTMODE_OFF_PATTERN                   1
4592b8e80941Smrg#define MSRASTMODE_ON_PIXEL                      2
4593b8e80941Smrg#define MSRASTMODE_ON_PATTERN                    3
4594b8e80941Smrg   uint32_t                             PointRasterizationRule;
4595b8e80941Smrg#define RASTRULE_UPPER_LEFT                      0
4596b8e80941Smrg#define RASTRULE_UPPER_RIGHT                     1
4597b8e80941Smrg   bool                                 LineStippleEnable;
4598b8e80941Smrg   bool                                 PolygonStippleEnable;
4599b8e80941Smrg   uint32_t                             LineAntialiasingRegionWidth;
4600b8e80941Smrg#define _05pixels                                0
4601b8e80941Smrg#define _10pixels                                1
4602b8e80941Smrg#define _20pixels                                2
4603b8e80941Smrg#define _40pixels                                3
4604b8e80941Smrg   uint32_t                             LineEndCapAntialiasingRegionWidth;
4605b8e80941Smrg   bool                                 PixelShaderUsesInputCoverageMask;
4606b8e80941Smrg   uint32_t                             BarycentricInterpolationMode;
4607b8e80941Smrg#define BIM_PERSPECTIVE_PIXEL                    1
4608b8e80941Smrg#define BIM_PERSPECTIVE_CENTROID                 2
4609b8e80941Smrg#define BIM_PERSPECTIVE_SAMPLE                   4
4610b8e80941Smrg#define BIM_LINEAR_PIXEL                         8
4611b8e80941Smrg#define BIM_LINEAR_CENTROID                      16
4612b8e80941Smrg#define BIM_LINEAR_SAMPLE                        32
4613b8e80941Smrg   uint32_t                             PositionZWInterpolationMode;
4614b8e80941Smrg#define INTERP_PIXEL                             0
4615b8e80941Smrg#define INTERP_CENTROID                          2
4616b8e80941Smrg#define INTERP_SAMPLE                            3
4617b8e80941Smrg   bool                                 PixelShaderUsesSourceW;
4618b8e80941Smrg   bool                                 PixelShaderUsesSourceDepth;
4619b8e80941Smrg   uint32_t                             EarlyDepthStencilControl;
4620b8e80941Smrg#define EDSC_NORMAL                              0
4621b8e80941Smrg#define EDSC_PSEXEC                              1
4622b8e80941Smrg#define EDSC_PREPS                               2
4623b8e80941Smrg   uint32_t                             PixelShaderComputedDepthMode;
4624b8e80941Smrg#define PSCDEPTH_OFF                             0
4625b8e80941Smrg#define PSCDEPTH_ON                              1
4626b8e80941Smrg#define PSCDEPTH_ON_GE                           2
4627b8e80941Smrg#define PSCDEPTH_ON_LE                           3
4628b8e80941Smrg   bool                                 PixelShaderKillsPixel;
4629b8e80941Smrg   bool                                 LegacyDiamondLineRasterization;
4630b8e80941Smrg   bool                                 HierarchicalDepthBufferResolveEnable;
4631b8e80941Smrg   bool                                 DepthBufferResolveEnable;
4632b8e80941Smrg   bool                                 ThreadDispatchEnable;
4633b8e80941Smrg   bool                                 DepthBufferClear;
4634b8e80941Smrg   bool                                 StatisticsEnable;
4635b8e80941Smrg   uint32_t                             MultisampleDispatchMode;
4636b8e80941Smrg#define MSDISPMODE_PERSAMPLE                     0
4637b8e80941Smrg#define MSDISPMODE_PERPIXEL                      1
4638b8e80941Smrg};
4639b8e80941Smrg
4640b8e80941Smrgstatic inline void
4641b8e80941SmrgGEN7_3DSTATE_WM_pack(__attribute__((unused)) __gen_user_data *data,
4642b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
4643b8e80941Smrg                     __attribute__((unused)) const struct GEN7_3DSTATE_WM * restrict values)
4644b8e80941Smrg{
4645b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4646b8e80941Smrg
4647b8e80941Smrg   dw[0] =
4648b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4649b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
4650b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
4651b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
4652b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4653b8e80941Smrg
4654b8e80941Smrg   dw[1] =
4655b8e80941Smrg      __gen_uint(values->MultisampleRasterizationMode, 0, 1) |
4656b8e80941Smrg      __gen_uint(values->PointRasterizationRule, 2, 2) |
4657b8e80941Smrg      __gen_uint(values->LineStippleEnable, 3, 3) |
4658b8e80941Smrg      __gen_uint(values->PolygonStippleEnable, 4, 4) |
4659b8e80941Smrg      __gen_uint(values->LineAntialiasingRegionWidth, 6, 7) |
4660b8e80941Smrg      __gen_uint(values->LineEndCapAntialiasingRegionWidth, 8, 9) |
4661b8e80941Smrg      __gen_uint(values->PixelShaderUsesInputCoverageMask, 10, 10) |
4662b8e80941Smrg      __gen_uint(values->BarycentricInterpolationMode, 11, 16) |
4663b8e80941Smrg      __gen_uint(values->PositionZWInterpolationMode, 17, 18) |
4664b8e80941Smrg      __gen_uint(values->PixelShaderUsesSourceW, 19, 19) |
4665b8e80941Smrg      __gen_uint(values->PixelShaderUsesSourceDepth, 20, 20) |
4666b8e80941Smrg      __gen_uint(values->EarlyDepthStencilControl, 21, 22) |
4667b8e80941Smrg      __gen_uint(values->PixelShaderComputedDepthMode, 23, 24) |
4668b8e80941Smrg      __gen_uint(values->PixelShaderKillsPixel, 25, 25) |
4669b8e80941Smrg      __gen_uint(values->LegacyDiamondLineRasterization, 26, 26) |
4670b8e80941Smrg      __gen_uint(values->HierarchicalDepthBufferResolveEnable, 27, 27) |
4671b8e80941Smrg      __gen_uint(values->DepthBufferResolveEnable, 28, 28) |
4672b8e80941Smrg      __gen_uint(values->ThreadDispatchEnable, 29, 29) |
4673b8e80941Smrg      __gen_uint(values->DepthBufferClear, 30, 30) |
4674b8e80941Smrg      __gen_uint(values->StatisticsEnable, 31, 31);
4675b8e80941Smrg
4676b8e80941Smrg   dw[2] =
4677b8e80941Smrg      __gen_uint(values->MultisampleDispatchMode, 31, 31);
4678b8e80941Smrg}
4679b8e80941Smrg
4680b8e80941Smrg#define GEN7_GPGPU_OBJECT_length               8
4681b8e80941Smrg#define GEN7_GPGPU_OBJECT_length_bias          2
4682b8e80941Smrg#define GEN7_GPGPU_OBJECT_header                \
4683b8e80941Smrg   .DWordLength                         =      6,  \
4684b8e80941Smrg   .SubOpcode                           =      4,  \
4685b8e80941Smrg   .MediaCommandOpcode                  =      1,  \
4686b8e80941Smrg   .Pipeline                            =      2,  \
4687b8e80941Smrg   .CommandType                         =      3
4688b8e80941Smrg
4689b8e80941Smrgstruct GEN7_GPGPU_OBJECT {
4690b8e80941Smrg   uint32_t                             DWordLength;
4691b8e80941Smrg   bool                                 PredicateEnable;
4692b8e80941Smrg   uint32_t                             SubOpcode;
4693b8e80941Smrg   uint32_t                             MediaCommandOpcode;
4694b8e80941Smrg   uint32_t                             Pipeline;
4695b8e80941Smrg   uint32_t                             CommandType;
4696b8e80941Smrg   uint32_t                             InterfaceDescriptorOffset;
4697b8e80941Smrg   uint32_t                             SharedLocalMemoryFixedOffset;
4698b8e80941Smrg   uint32_t                             IndirectDataLength;
4699b8e80941Smrg   uint32_t                             HalfSliceDestinationSelect;
4700b8e80941Smrg#define HalfSlice1                               2
4701b8e80941Smrg#define HalfSlice0                               1
4702b8e80941Smrg#define EitherHalfSlice                          0
4703b8e80941Smrg   uint32_t                             EndofThreadGroup;
4704b8e80941Smrg   uint32_t                             SharedLocalMemoryOffset;
4705b8e80941Smrg   uint64_t                             IndirectDataStartAddress;
4706b8e80941Smrg   uint32_t                             ThreadGroupIDX;
4707b8e80941Smrg   uint32_t                             ThreadGroupIDY;
4708b8e80941Smrg   uint32_t                             ThreadGroupIDZ;
4709b8e80941Smrg   uint32_t                             ExecutionMask;
4710b8e80941Smrg};
4711b8e80941Smrg
4712b8e80941Smrgstatic inline void
4713b8e80941SmrgGEN7_GPGPU_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
4714b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
4715b8e80941Smrg                       __attribute__((unused)) const struct GEN7_GPGPU_OBJECT * restrict values)
4716b8e80941Smrg{
4717b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4718b8e80941Smrg
4719b8e80941Smrg   dw[0] =
4720b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4721b8e80941Smrg      __gen_uint(values->PredicateEnable, 8, 8) |
4722b8e80941Smrg      __gen_uint(values->SubOpcode, 16, 23) |
4723b8e80941Smrg      __gen_uint(values->MediaCommandOpcode, 24, 26) |
4724b8e80941Smrg      __gen_uint(values->Pipeline, 27, 28) |
4725b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4726b8e80941Smrg
4727b8e80941Smrg   dw[1] =
4728b8e80941Smrg      __gen_uint(values->InterfaceDescriptorOffset, 0, 4) |
4729b8e80941Smrg      __gen_uint(values->SharedLocalMemoryFixedOffset, 7, 7);
4730b8e80941Smrg
4731b8e80941Smrg   dw[2] =
4732b8e80941Smrg      __gen_uint(values->IndirectDataLength, 0, 16) |
4733b8e80941Smrg      __gen_uint(values->HalfSliceDestinationSelect, 17, 18) |
4734b8e80941Smrg      __gen_uint(values->EndofThreadGroup, 24, 24) |
4735b8e80941Smrg      __gen_uint(values->SharedLocalMemoryOffset, 28, 31);
4736b8e80941Smrg
4737b8e80941Smrg   dw[3] =
4738b8e80941Smrg      __gen_offset(values->IndirectDataStartAddress, 0, 31);
4739b8e80941Smrg
4740b8e80941Smrg   dw[4] =
4741b8e80941Smrg      __gen_uint(values->ThreadGroupIDX, 0, 31);
4742b8e80941Smrg
4743b8e80941Smrg   dw[5] =
4744b8e80941Smrg      __gen_uint(values->ThreadGroupIDY, 0, 31);
4745b8e80941Smrg
4746b8e80941Smrg   dw[6] =
4747b8e80941Smrg      __gen_uint(values->ThreadGroupIDZ, 0, 31);
4748b8e80941Smrg
4749b8e80941Smrg   dw[7] =
4750b8e80941Smrg      __gen_uint(values->ExecutionMask, 0, 31);
4751b8e80941Smrg}
4752b8e80941Smrg
4753b8e80941Smrg#define GEN7_GPGPU_WALKER_length              11
4754b8e80941Smrg#define GEN7_GPGPU_WALKER_length_bias          2
4755b8e80941Smrg#define GEN7_GPGPU_WALKER_header                \
4756b8e80941Smrg   .DWordLength                         =      9,  \
4757b8e80941Smrg   .SubOpcodeA                          =      5,  \
4758b8e80941Smrg   .MediaCommandOpcode                  =      1,  \
4759b8e80941Smrg   .Pipeline                            =      2,  \
4760b8e80941Smrg   .CommandType                         =      3
4761b8e80941Smrg
4762b8e80941Smrgstruct GEN7_GPGPU_WALKER {
4763b8e80941Smrg   uint32_t                             DWordLength;
4764b8e80941Smrg   bool                                 PredicateEnable;
4765b8e80941Smrg   bool                                 IndirectParameterEnable;
4766b8e80941Smrg   uint32_t                             SubOpcodeA;
4767b8e80941Smrg   uint32_t                             MediaCommandOpcode;
4768b8e80941Smrg   uint32_t                             Pipeline;
4769b8e80941Smrg   uint32_t                             CommandType;
4770b8e80941Smrg   uint32_t                             InterfaceDescriptorOffset;
4771b8e80941Smrg   uint32_t                             ThreadWidthCounterMaximum;
4772b8e80941Smrg   uint32_t                             ThreadHeightCounterMaximum;
4773b8e80941Smrg   uint32_t                             ThreadDepthCounterMaximum;
4774b8e80941Smrg   uint32_t                             SIMDSize;
4775b8e80941Smrg#define SIMD8                                    0
4776b8e80941Smrg#define SIMD16                                   1
4777b8e80941Smrg#define SIMD32                                   2
4778b8e80941Smrg   uint32_t                             ThreadGroupIDStartingX;
4779b8e80941Smrg   uint32_t                             ThreadGroupIDXDimension;
4780b8e80941Smrg   uint32_t                             ThreadGroupIDStartingY;
4781b8e80941Smrg   uint32_t                             ThreadGroupIDYDimension;
4782b8e80941Smrg   uint32_t                             ThreadGroupIDStartingZ;
4783b8e80941Smrg   uint32_t                             ThreadGroupIDZDimension;
4784b8e80941Smrg   uint32_t                             RightExecutionMask;
4785b8e80941Smrg   uint32_t                             BottomExecutionMask;
4786b8e80941Smrg};
4787b8e80941Smrg
4788b8e80941Smrgstatic inline void
4789b8e80941SmrgGEN7_GPGPU_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
4790b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
4791b8e80941Smrg                       __attribute__((unused)) const struct GEN7_GPGPU_WALKER * restrict values)
4792b8e80941Smrg{
4793b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4794b8e80941Smrg
4795b8e80941Smrg   dw[0] =
4796b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
4797b8e80941Smrg      __gen_uint(values->PredicateEnable, 8, 8) |
4798b8e80941Smrg      __gen_uint(values->IndirectParameterEnable, 10, 10) |
4799b8e80941Smrg      __gen_uint(values->SubOpcodeA, 16, 23) |
4800b8e80941Smrg      __gen_uint(values->MediaCommandOpcode, 24, 26) |
4801b8e80941Smrg      __gen_uint(values->Pipeline, 27, 28) |
4802b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4803b8e80941Smrg
4804b8e80941Smrg   dw[1] =
4805b8e80941Smrg      __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
4806b8e80941Smrg
4807b8e80941Smrg   dw[2] =
4808b8e80941Smrg      __gen_uint(values->ThreadWidthCounterMaximum, 0, 5) |
4809b8e80941Smrg      __gen_uint(values->ThreadHeightCounterMaximum, 8, 13) |
4810b8e80941Smrg      __gen_uint(values->ThreadDepthCounterMaximum, 16, 21) |
4811b8e80941Smrg      __gen_uint(values->SIMDSize, 30, 31);
4812b8e80941Smrg
4813b8e80941Smrg   dw[3] =
4814b8e80941Smrg      __gen_uint(values->ThreadGroupIDStartingX, 0, 31);
4815b8e80941Smrg
4816b8e80941Smrg   dw[4] =
4817b8e80941Smrg      __gen_uint(values->ThreadGroupIDXDimension, 0, 31);
4818b8e80941Smrg
4819b8e80941Smrg   dw[5] =
4820b8e80941Smrg      __gen_uint(values->ThreadGroupIDStartingY, 0, 31);
4821b8e80941Smrg
4822b8e80941Smrg   dw[6] =
4823b8e80941Smrg      __gen_uint(values->ThreadGroupIDYDimension, 0, 31);
4824b8e80941Smrg
4825b8e80941Smrg   dw[7] =
4826b8e80941Smrg      __gen_uint(values->ThreadGroupIDStartingZ, 0, 31);
4827b8e80941Smrg
4828b8e80941Smrg   dw[8] =
4829b8e80941Smrg      __gen_uint(values->ThreadGroupIDZDimension, 0, 31);
4830b8e80941Smrg
4831b8e80941Smrg   dw[9] =
4832b8e80941Smrg      __gen_uint(values->RightExecutionMask, 0, 31);
4833b8e80941Smrg
4834b8e80941Smrg   dw[10] =
4835b8e80941Smrg      __gen_uint(values->BottomExecutionMask, 0, 31);
4836b8e80941Smrg}
4837b8e80941Smrg
4838b8e80941Smrg#define GEN7_MEDIA_CURBE_LOAD_length           4
4839b8e80941Smrg#define GEN7_MEDIA_CURBE_LOAD_length_bias      2
4840b8e80941Smrg#define GEN7_MEDIA_CURBE_LOAD_header            \
4841b8e80941Smrg   .DWordLength                         =      2,  \
4842b8e80941Smrg   .SubOpcode                           =      1,  \
4843b8e80941Smrg   .MediaCommandOpcode                  =      0,  \
4844b8e80941Smrg   .Pipeline                            =      2,  \
4845b8e80941Smrg   .CommandType                         =      3
4846b8e80941Smrg
4847b8e80941Smrgstruct GEN7_MEDIA_CURBE_LOAD {
4848b8e80941Smrg   uint32_t                             DWordLength;
4849b8e80941Smrg   uint32_t                             SubOpcode;
4850b8e80941Smrg   uint32_t                             MediaCommandOpcode;
4851b8e80941Smrg   uint32_t                             Pipeline;
4852b8e80941Smrg   uint32_t                             CommandType;
4853b8e80941Smrg   uint32_t                             CURBETotalDataLength;
4854b8e80941Smrg   uint32_t                             CURBEDataStartAddress;
4855b8e80941Smrg};
4856b8e80941Smrg
4857b8e80941Smrgstatic inline void
4858b8e80941SmrgGEN7_MEDIA_CURBE_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
4859b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
4860b8e80941Smrg                           __attribute__((unused)) const struct GEN7_MEDIA_CURBE_LOAD * restrict values)
4861b8e80941Smrg{
4862b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4863b8e80941Smrg
4864b8e80941Smrg   dw[0] =
4865b8e80941Smrg      __gen_uint(values->DWordLength, 0, 15) |
4866b8e80941Smrg      __gen_uint(values->SubOpcode, 16, 23) |
4867b8e80941Smrg      __gen_uint(values->MediaCommandOpcode, 24, 26) |
4868b8e80941Smrg      __gen_uint(values->Pipeline, 27, 28) |
4869b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4870b8e80941Smrg
4871b8e80941Smrg   dw[1] = 0;
4872b8e80941Smrg
4873b8e80941Smrg   dw[2] =
4874b8e80941Smrg      __gen_uint(values->CURBETotalDataLength, 0, 16);
4875b8e80941Smrg
4876b8e80941Smrg   dw[3] =
4877b8e80941Smrg      __gen_uint(values->CURBEDataStartAddress, 0, 31);
4878b8e80941Smrg}
4879b8e80941Smrg
4880b8e80941Smrg#define GEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length      4
4881b8e80941Smrg#define GEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD_length_bias      2
4882b8e80941Smrg#define GEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD_header\
4883b8e80941Smrg   .DWordLength                         =      2,  \
4884b8e80941Smrg   .SubOpcode                           =      2,  \
4885b8e80941Smrg   .MediaCommandOpcode                  =      0,  \
4886b8e80941Smrg   .Pipeline                            =      2,  \
4887b8e80941Smrg   .CommandType                         =      3
4888b8e80941Smrg
4889b8e80941Smrgstruct GEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD {
4890b8e80941Smrg   uint32_t                             DWordLength;
4891b8e80941Smrg   uint32_t                             SubOpcode;
4892b8e80941Smrg   uint32_t                             MediaCommandOpcode;
4893b8e80941Smrg   uint32_t                             Pipeline;
4894b8e80941Smrg   uint32_t                             CommandType;
4895b8e80941Smrg   uint32_t                             InterfaceDescriptorTotalLength;
4896b8e80941Smrg   uint64_t                             InterfaceDescriptorDataStartAddress;
4897b8e80941Smrg};
4898b8e80941Smrg
4899b8e80941Smrgstatic inline void
4900b8e80941SmrgGEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD_pack(__attribute__((unused)) __gen_user_data *data,
4901b8e80941Smrg                                          __attribute__((unused)) void * restrict dst,
4902b8e80941Smrg                                          __attribute__((unused)) const struct GEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD * restrict values)
4903b8e80941Smrg{
4904b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4905b8e80941Smrg
4906b8e80941Smrg   dw[0] =
4907b8e80941Smrg      __gen_uint(values->DWordLength, 0, 15) |
4908b8e80941Smrg      __gen_uint(values->SubOpcode, 16, 23) |
4909b8e80941Smrg      __gen_uint(values->MediaCommandOpcode, 24, 26) |
4910b8e80941Smrg      __gen_uint(values->Pipeline, 27, 28) |
4911b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4912b8e80941Smrg
4913b8e80941Smrg   dw[1] = 0;
4914b8e80941Smrg
4915b8e80941Smrg   dw[2] =
4916b8e80941Smrg      __gen_uint(values->InterfaceDescriptorTotalLength, 0, 16);
4917b8e80941Smrg
4918b8e80941Smrg   dw[3] =
4919b8e80941Smrg      __gen_offset(values->InterfaceDescriptorDataStartAddress, 0, 31);
4920b8e80941Smrg}
4921b8e80941Smrg
4922b8e80941Smrg#define GEN7_MEDIA_OBJECT_length_bias          2
4923b8e80941Smrg#define GEN7_MEDIA_OBJECT_header                \
4924b8e80941Smrg   .DWordLength                         =      4,  \
4925b8e80941Smrg   .MediaCommandSubOpcode               =      0,  \
4926b8e80941Smrg   .MediaCommandOpcode                  =      1,  \
4927b8e80941Smrg   .MediaCommandPipeline                =      2,  \
4928b8e80941Smrg   .CommandType                         =      3
4929b8e80941Smrg
4930b8e80941Smrgstruct GEN7_MEDIA_OBJECT {
4931b8e80941Smrg   uint32_t                             DWordLength;
4932b8e80941Smrg   uint32_t                             MediaCommandSubOpcode;
4933b8e80941Smrg   uint32_t                             MediaCommandOpcode;
4934b8e80941Smrg   uint32_t                             MediaCommandPipeline;
4935b8e80941Smrg   uint32_t                             CommandType;
4936b8e80941Smrg   uint32_t                             InterfaceDescriptorOffset;
4937b8e80941Smrg   uint32_t                             IndirectDataLength;
4938b8e80941Smrg   uint32_t                             HalfSliceDestinationSelect;
4939b8e80941Smrg#define HalfSlice1                               2
4940b8e80941Smrg#define HalfSlice0                               1
4941b8e80941Smrg#define Eitherhalfslice                          0
4942b8e80941Smrg   uint32_t                             UseScoreboard;
4943b8e80941Smrg#define Notusingscoreboard                       0
4944b8e80941Smrg#define Usingscoreboard                          1
4945b8e80941Smrg   uint32_t                             ThreadSynchronization;
4946b8e80941Smrg#define Nothreadsynchronization                  0
4947b8e80941Smrg#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
4948b8e80941Smrg   bool                                 ChildrenPresent;
4949b8e80941Smrg   __gen_address_type                   IndirectDataStartAddress;
4950b8e80941Smrg   uint32_t                             ScoreboardX;
4951b8e80941Smrg   uint32_t                             ScoredboardY;
4952b8e80941Smrg   uint32_t                             ScoreboardMask;
4953b8e80941Smrg   uint32_t                             ScoreboardColor;
4954b8e80941Smrg   /* variable length fields follow */
4955b8e80941Smrg};
4956b8e80941Smrg
4957b8e80941Smrgstatic inline void
4958b8e80941SmrgGEN7_MEDIA_OBJECT_pack(__attribute__((unused)) __gen_user_data *data,
4959b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
4960b8e80941Smrg                       __attribute__((unused)) const struct GEN7_MEDIA_OBJECT * restrict values)
4961b8e80941Smrg{
4962b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
4963b8e80941Smrg
4964b8e80941Smrg   dw[0] =
4965b8e80941Smrg      __gen_uint(values->DWordLength, 0, 15) |
4966b8e80941Smrg      __gen_uint(values->MediaCommandSubOpcode, 16, 23) |
4967b8e80941Smrg      __gen_uint(values->MediaCommandOpcode, 24, 26) |
4968b8e80941Smrg      __gen_uint(values->MediaCommandPipeline, 27, 28) |
4969b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
4970b8e80941Smrg
4971b8e80941Smrg   dw[1] =
4972b8e80941Smrg      __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
4973b8e80941Smrg
4974b8e80941Smrg   dw[2] =
4975b8e80941Smrg      __gen_uint(values->IndirectDataLength, 0, 16) |
4976b8e80941Smrg      __gen_uint(values->HalfSliceDestinationSelect, 17, 18) |
4977b8e80941Smrg      __gen_uint(values->UseScoreboard, 21, 21) |
4978b8e80941Smrg      __gen_uint(values->ThreadSynchronization, 24, 24) |
4979b8e80941Smrg      __gen_uint(values->ChildrenPresent, 31, 31);
4980b8e80941Smrg
4981b8e80941Smrg   dw[3] = __gen_combine_address(data, &dw[3], values->IndirectDataStartAddress, 0);
4982b8e80941Smrg
4983b8e80941Smrg   dw[4] =
4984b8e80941Smrg      __gen_uint(values->ScoreboardX, 0, 8) |
4985b8e80941Smrg      __gen_uint(values->ScoredboardY, 16, 24);
4986b8e80941Smrg
4987b8e80941Smrg   dw[5] =
4988b8e80941Smrg      __gen_uint(values->ScoreboardMask, 0, 7) |
4989b8e80941Smrg      __gen_uint(values->ScoreboardColor, 16, 19);
4990b8e80941Smrg}
4991b8e80941Smrg
4992b8e80941Smrg#define GEN7_MEDIA_OBJECT_PRT_length          16
4993b8e80941Smrg#define GEN7_MEDIA_OBJECT_PRT_length_bias      2
4994b8e80941Smrg#define GEN7_MEDIA_OBJECT_PRT_header            \
4995b8e80941Smrg   .DWordLength                         =     14,  \
4996b8e80941Smrg   .SubOpcode                           =      2,  \
4997b8e80941Smrg   .MediaCommandOpcode                  =      1,  \
4998b8e80941Smrg   .Pipeline                            =      2,  \
4999b8e80941Smrg   .CommandType                         =      3
5000b8e80941Smrg
5001b8e80941Smrgstruct GEN7_MEDIA_OBJECT_PRT {
5002b8e80941Smrg   uint32_t                             DWordLength;
5003b8e80941Smrg   uint32_t                             SubOpcode;
5004b8e80941Smrg   uint32_t                             MediaCommandOpcode;
5005b8e80941Smrg   uint32_t                             Pipeline;
5006b8e80941Smrg   uint32_t                             CommandType;
5007b8e80941Smrg   uint32_t                             InterfaceDescriptorOffset;
5008b8e80941Smrg   uint32_t                             PRT_FenceType;
5009b8e80941Smrg#define Rootthreadqueue                          0
5010b8e80941Smrg#define VFEstateflush                            1
5011b8e80941Smrg   bool                                 PRT_FenceNeeded;
5012b8e80941Smrg   bool                                 ChildrenPresent;
5013b8e80941Smrg   uint32_t                             InlineData[12];
5014b8e80941Smrg};
5015b8e80941Smrg
5016b8e80941Smrgstatic inline void
5017b8e80941SmrgGEN7_MEDIA_OBJECT_PRT_pack(__attribute__((unused)) __gen_user_data *data,
5018b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
5019b8e80941Smrg                           __attribute__((unused)) const struct GEN7_MEDIA_OBJECT_PRT * restrict values)
5020b8e80941Smrg{
5021b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5022b8e80941Smrg
5023b8e80941Smrg   dw[0] =
5024b8e80941Smrg      __gen_uint(values->DWordLength, 0, 15) |
5025b8e80941Smrg      __gen_uint(values->SubOpcode, 16, 23) |
5026b8e80941Smrg      __gen_uint(values->MediaCommandOpcode, 24, 26) |
5027b8e80941Smrg      __gen_uint(values->Pipeline, 27, 28) |
5028b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5029b8e80941Smrg
5030b8e80941Smrg   dw[1] =
5031b8e80941Smrg      __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
5032b8e80941Smrg
5033b8e80941Smrg   dw[2] =
5034b8e80941Smrg      __gen_uint(values->PRT_FenceType, 22, 22) |
5035b8e80941Smrg      __gen_uint(values->PRT_FenceNeeded, 23, 23) |
5036b8e80941Smrg      __gen_uint(values->ChildrenPresent, 31, 31);
5037b8e80941Smrg
5038b8e80941Smrg   dw[3] = 0;
5039b8e80941Smrg
5040b8e80941Smrg   dw[4] =
5041b8e80941Smrg      __gen_uint(values->InlineData[0], 0, 31);
5042b8e80941Smrg
5043b8e80941Smrg   dw[5] =
5044b8e80941Smrg      __gen_uint(values->InlineData[1], 0, 31);
5045b8e80941Smrg
5046b8e80941Smrg   dw[6] =
5047b8e80941Smrg      __gen_uint(values->InlineData[2], 0, 31);
5048b8e80941Smrg
5049b8e80941Smrg   dw[7] =
5050b8e80941Smrg      __gen_uint(values->InlineData[3], 0, 31);
5051b8e80941Smrg
5052b8e80941Smrg   dw[8] =
5053b8e80941Smrg      __gen_uint(values->InlineData[4], 0, 31);
5054b8e80941Smrg
5055b8e80941Smrg   dw[9] =
5056b8e80941Smrg      __gen_uint(values->InlineData[5], 0, 31);
5057b8e80941Smrg
5058b8e80941Smrg   dw[10] =
5059b8e80941Smrg      __gen_uint(values->InlineData[6], 0, 31);
5060b8e80941Smrg
5061b8e80941Smrg   dw[11] =
5062b8e80941Smrg      __gen_uint(values->InlineData[7], 0, 31);
5063b8e80941Smrg
5064b8e80941Smrg   dw[12] =
5065b8e80941Smrg      __gen_uint(values->InlineData[8], 0, 31);
5066b8e80941Smrg
5067b8e80941Smrg   dw[13] =
5068b8e80941Smrg      __gen_uint(values->InlineData[9], 0, 31);
5069b8e80941Smrg
5070b8e80941Smrg   dw[14] =
5071b8e80941Smrg      __gen_uint(values->InlineData[10], 0, 31);
5072b8e80941Smrg
5073b8e80941Smrg   dw[15] =
5074b8e80941Smrg      __gen_uint(values->InlineData[11], 0, 31);
5075b8e80941Smrg}
5076b8e80941Smrg
5077b8e80941Smrg#define GEN7_MEDIA_OBJECT_WALKER_length_bias      2
5078b8e80941Smrg#define GEN7_MEDIA_OBJECT_WALKER_header         \
5079b8e80941Smrg   .DWordLength                         =     15,  \
5080b8e80941Smrg   .SubOpcode                           =      3,  \
5081b8e80941Smrg   .MediaCommandOpcode                  =      1,  \
5082b8e80941Smrg   .Pipeline                            =      2,  \
5083b8e80941Smrg   .CommandType                         =      3
5084b8e80941Smrg
5085b8e80941Smrgstruct GEN7_MEDIA_OBJECT_WALKER {
5086b8e80941Smrg   uint32_t                             DWordLength;
5087b8e80941Smrg   uint32_t                             SubOpcode;
5088b8e80941Smrg   uint32_t                             MediaCommandOpcode;
5089b8e80941Smrg   uint32_t                             Pipeline;
5090b8e80941Smrg   uint32_t                             CommandType;
5091b8e80941Smrg   uint32_t                             InterfaceDescriptorOffset;
5092b8e80941Smrg   uint32_t                             IndirectDataLength;
5093b8e80941Smrg   uint32_t                             UseScoreboard;
5094b8e80941Smrg#define Notusingscoreboard                       0
5095b8e80941Smrg#define Usingscoreboard                          1
5096b8e80941Smrg   uint32_t                             ThreadSynchronization;
5097b8e80941Smrg#define Nothreadsynchronization                  0
5098b8e80941Smrg#define Threaddispatchissynchronizedbythespawnrootthreadmessage 1
5099b8e80941Smrg   uint32_t                             ChildrenPresent;
5100b8e80941Smrg   uint64_t                             IndirectDataStartAddress;
5101b8e80941Smrg   uint32_t                             ScoreboardMask;
5102b8e80941Smrg   int32_t                              MidLoopUnitX;
5103b8e80941Smrg   int32_t                              LocalMidLoopUnitY;
5104b8e80941Smrg   uint32_t                             MiddleLoopExtraSteps;
5105b8e80941Smrg   uint32_t                             ColorCountMinusOne;
5106b8e80941Smrg   uint32_t                             Repel;
5107b8e80941Smrg   uint32_t                             DualMode;
5108b8e80941Smrg   uint32_t                             LocalLoopExecCount;
5109b8e80941Smrg   uint32_t                             GlobalLoopExecCount;
5110b8e80941Smrg   uint32_t                             BlockResolutionX;
5111b8e80941Smrg   uint32_t                             BlockResolutionY;
5112b8e80941Smrg   uint32_t                             LocalStartX;
5113b8e80941Smrg   uint32_t                             LocalStartY;
5114b8e80941Smrg   uint32_t                             LocalEndX;
5115b8e80941Smrg   uint32_t                             LocalEndY;
5116b8e80941Smrg   int32_t                              LocalOuterLoopStrideX;
5117b8e80941Smrg   int32_t                              LocalOuterLoopStrideY;
5118b8e80941Smrg   int32_t                              LocalInnerLoopUnitX;
5119b8e80941Smrg   int32_t                              LocalInnerLoopUnitY;
5120b8e80941Smrg   uint32_t                             GlobalResolutionX;
5121b8e80941Smrg   uint32_t                             GlobalResolutionY;
5122b8e80941Smrg   int32_t                              GlobalStartX;
5123b8e80941Smrg   int32_t                              GlobalStartY;
5124b8e80941Smrg   int32_t                              GlobalOuterLoopStrideX;
5125b8e80941Smrg   int32_t                              GlobalOuterLoopStrideY;
5126b8e80941Smrg   int32_t                              GlobalInnerLoopUnitX;
5127b8e80941Smrg   int32_t                              GlobalInnerLoopUnitY;
5128b8e80941Smrg   /* variable length fields follow */
5129b8e80941Smrg};
5130b8e80941Smrg
5131b8e80941Smrgstatic inline void
5132b8e80941SmrgGEN7_MEDIA_OBJECT_WALKER_pack(__attribute__((unused)) __gen_user_data *data,
5133b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
5134b8e80941Smrg                              __attribute__((unused)) const struct GEN7_MEDIA_OBJECT_WALKER * restrict values)
5135b8e80941Smrg{
5136b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5137b8e80941Smrg
5138b8e80941Smrg   dw[0] =
5139b8e80941Smrg      __gen_uint(values->DWordLength, 0, 15) |
5140b8e80941Smrg      __gen_uint(values->SubOpcode, 16, 23) |
5141b8e80941Smrg      __gen_uint(values->MediaCommandOpcode, 24, 26) |
5142b8e80941Smrg      __gen_uint(values->Pipeline, 27, 28) |
5143b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5144b8e80941Smrg
5145b8e80941Smrg   dw[1] =
5146b8e80941Smrg      __gen_uint(values->InterfaceDescriptorOffset, 0, 4);
5147b8e80941Smrg
5148b8e80941Smrg   dw[2] =
5149b8e80941Smrg      __gen_uint(values->IndirectDataLength, 0, 16) |
5150b8e80941Smrg      __gen_uint(values->UseScoreboard, 21, 21) |
5151b8e80941Smrg      __gen_uint(values->ThreadSynchronization, 24, 24) |
5152b8e80941Smrg      __gen_uint(values->ChildrenPresent, 31, 31);
5153b8e80941Smrg
5154b8e80941Smrg   dw[3] =
5155b8e80941Smrg      __gen_offset(values->IndirectDataStartAddress, 0, 31);
5156b8e80941Smrg
5157b8e80941Smrg   dw[4] = 0;
5158b8e80941Smrg
5159b8e80941Smrg   dw[5] =
5160b8e80941Smrg      __gen_uint(values->ScoreboardMask, 0, 7);
5161b8e80941Smrg
5162b8e80941Smrg   dw[6] =
5163b8e80941Smrg      __gen_sint(values->MidLoopUnitX, 8, 9) |
5164b8e80941Smrg      __gen_sint(values->LocalMidLoopUnitY, 12, 13) |
5165b8e80941Smrg      __gen_uint(values->MiddleLoopExtraSteps, 16, 20) |
5166b8e80941Smrg      __gen_uint(values->ColorCountMinusOne, 24, 27) |
5167b8e80941Smrg      __gen_uint(values->Repel, 30, 30) |
5168b8e80941Smrg      __gen_uint(values->DualMode, 31, 31);
5169b8e80941Smrg
5170b8e80941Smrg   dw[7] =
5171b8e80941Smrg      __gen_uint(values->LocalLoopExecCount, 0, 9) |
5172b8e80941Smrg      __gen_uint(values->GlobalLoopExecCount, 16, 25);
5173b8e80941Smrg
5174b8e80941Smrg   dw[8] =
5175b8e80941Smrg      __gen_uint(values->BlockResolutionX, 0, 8) |
5176b8e80941Smrg      __gen_uint(values->BlockResolutionY, 16, 24);
5177b8e80941Smrg
5178b8e80941Smrg   dw[9] =
5179b8e80941Smrg      __gen_uint(values->LocalStartX, 0, 8) |
5180b8e80941Smrg      __gen_uint(values->LocalStartY, 16, 24);
5181b8e80941Smrg
5182b8e80941Smrg   dw[10] =
5183b8e80941Smrg      __gen_uint(values->LocalEndX, 0, 8) |
5184b8e80941Smrg      __gen_uint(values->LocalEndY, 16, 24);
5185b8e80941Smrg
5186b8e80941Smrg   dw[11] =
5187b8e80941Smrg      __gen_sint(values->LocalOuterLoopStrideX, 0, 9) |
5188b8e80941Smrg      __gen_sint(values->LocalOuterLoopStrideY, 16, 25);
5189b8e80941Smrg
5190b8e80941Smrg   dw[12] =
5191b8e80941Smrg      __gen_sint(values->LocalInnerLoopUnitX, 0, 9) |
5192b8e80941Smrg      __gen_sint(values->LocalInnerLoopUnitY, 16, 25);
5193b8e80941Smrg
5194b8e80941Smrg   dw[13] =
5195b8e80941Smrg      __gen_uint(values->GlobalResolutionX, 0, 8) |
5196b8e80941Smrg      __gen_uint(values->GlobalResolutionY, 16, 24);
5197b8e80941Smrg
5198b8e80941Smrg   dw[14] =
5199b8e80941Smrg      __gen_sint(values->GlobalStartX, 0, 9) |
5200b8e80941Smrg      __gen_sint(values->GlobalStartY, 16, 25);
5201b8e80941Smrg
5202b8e80941Smrg   dw[15] =
5203b8e80941Smrg      __gen_sint(values->GlobalOuterLoopStrideX, 0, 9) |
5204b8e80941Smrg      __gen_sint(values->GlobalOuterLoopStrideY, 16, 25);
5205b8e80941Smrg
5206b8e80941Smrg   dw[16] =
5207b8e80941Smrg      __gen_sint(values->GlobalInnerLoopUnitX, 0, 9) |
5208b8e80941Smrg      __gen_sint(values->GlobalInnerLoopUnitY, 16, 25);
5209b8e80941Smrg}
5210b8e80941Smrg
5211b8e80941Smrg#define GEN7_MEDIA_STATE_FLUSH_length          2
5212b8e80941Smrg#define GEN7_MEDIA_STATE_FLUSH_length_bias      2
5213b8e80941Smrg#define GEN7_MEDIA_STATE_FLUSH_header           \
5214b8e80941Smrg   .DWordLength                         =      0,  \
5215b8e80941Smrg   .SubOpcode                           =      4,  \
5216b8e80941Smrg   .MediaCommandOpcode                  =      0,  \
5217b8e80941Smrg   .Pipeline                            =      2,  \
5218b8e80941Smrg   .CommandType                         =      3
5219b8e80941Smrg
5220b8e80941Smrgstruct GEN7_MEDIA_STATE_FLUSH {
5221b8e80941Smrg   uint32_t                             DWordLength;
5222b8e80941Smrg   uint32_t                             SubOpcode;
5223b8e80941Smrg   uint32_t                             MediaCommandOpcode;
5224b8e80941Smrg   uint32_t                             Pipeline;
5225b8e80941Smrg   uint32_t                             CommandType;
5226b8e80941Smrg   uint32_t                             InterfaceDescriptorOffset;
5227b8e80941Smrg   uint32_t                             WatermarkRequired;
5228b8e80941Smrg};
5229b8e80941Smrg
5230b8e80941Smrgstatic inline void
5231b8e80941SmrgGEN7_MEDIA_STATE_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
5232b8e80941Smrg                            __attribute__((unused)) void * restrict dst,
5233b8e80941Smrg                            __attribute__((unused)) const struct GEN7_MEDIA_STATE_FLUSH * restrict values)
5234b8e80941Smrg{
5235b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5236b8e80941Smrg
5237b8e80941Smrg   dw[0] =
5238b8e80941Smrg      __gen_uint(values->DWordLength, 0, 15) |
5239b8e80941Smrg      __gen_uint(values->SubOpcode, 16, 23) |
5240b8e80941Smrg      __gen_uint(values->MediaCommandOpcode, 24, 26) |
5241b8e80941Smrg      __gen_uint(values->Pipeline, 27, 28) |
5242b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5243b8e80941Smrg
5244b8e80941Smrg   dw[1] =
5245b8e80941Smrg      __gen_uint(values->InterfaceDescriptorOffset, 0, 5) |
5246b8e80941Smrg      __gen_uint(values->WatermarkRequired, 6, 6);
5247b8e80941Smrg}
5248b8e80941Smrg
5249b8e80941Smrg#define GEN7_MEDIA_VFE_STATE_length            8
5250b8e80941Smrg#define GEN7_MEDIA_VFE_STATE_length_bias       2
5251b8e80941Smrg#define GEN7_MEDIA_VFE_STATE_header             \
5252b8e80941Smrg   .DWordLength                         =      6,  \
5253b8e80941Smrg   .SubOpcode                           =      0,  \
5254b8e80941Smrg   .MediaCommandOpcode                  =      0,  \
5255b8e80941Smrg   .Pipeline                            =      2,  \
5256b8e80941Smrg   .CommandType                         =      3
5257b8e80941Smrg
5258b8e80941Smrgstruct GEN7_MEDIA_VFE_STATE {
5259b8e80941Smrg   uint32_t                             DWordLength;
5260b8e80941Smrg   uint32_t                             SubOpcode;
5261b8e80941Smrg   uint32_t                             MediaCommandOpcode;
5262b8e80941Smrg   uint32_t                             Pipeline;
5263b8e80941Smrg   uint32_t                             CommandType;
5264b8e80941Smrg   uint32_t                             PerThreadScratchSpace;
5265b8e80941Smrg   __gen_address_type                   ScratchSpaceBasePointer;
5266b8e80941Smrg   uint32_t                             GPGPUMode;
5267b8e80941Smrg   uint32_t                             GatewayMMIOAccessControl;
5268b8e80941Smrg#define NoMMIOreadwriteallowed                   0
5269b8e80941Smrg#define MMIOreadwritetoanyaddress                2
5270b8e80941Smrg   uint32_t                             BypassGatewayControl;
5271b8e80941Smrg#define MaintainingOpenGatewayForwardMsgCloseGatewayprotocollegacymode 0
5272b8e80941Smrg#define BypassingOpenGatewayCloseGatewayprotocol 1
5273b8e80941Smrg   uint32_t                             ResetGatewayTimer;
5274b8e80941Smrg#define Maintainingtheexistingtimestampstate     0
5275b8e80941Smrg#define Resettingrelativetimerandlatchingtheglobaltimestamp 1
5276b8e80941Smrg   uint32_t                             NumberofURBEntries;
5277b8e80941Smrg   uint32_t                             MaximumNumberofThreads;
5278b8e80941Smrg   uint32_t                             CURBEAllocationSize;
5279b8e80941Smrg   uint32_t                             URBEntryAllocationSize;
5280b8e80941Smrg   uint32_t                             ScoreboardMask;
5281b8e80941Smrg   uint32_t                             ScoreboardType;
5282b8e80941Smrg#define StallingScoreboard                       0
5283b8e80941Smrg#define NonStallingScoreboard                    1
5284b8e80941Smrg   uint32_t                             ScoreboardEnable;
5285b8e80941Smrg#define Scoreboarddisabled                       0
5286b8e80941Smrg#define Scoreboardenabled                        1
5287b8e80941Smrg   int32_t                              Scoreboard0DeltaX;
5288b8e80941Smrg   int32_t                              Scoreboard0DeltaY;
5289b8e80941Smrg   int32_t                              Scoreboard1DeltaX;
5290b8e80941Smrg   int32_t                              Scoreboard1DeltaY;
5291b8e80941Smrg   int32_t                              Scoreboard2DeltaX;
5292b8e80941Smrg   int32_t                              Scoreboard2DeltaY;
5293b8e80941Smrg   int32_t                              Scoreboard3DeltaX;
5294b8e80941Smrg   int32_t                              Scoreboard3DeltaY;
5295b8e80941Smrg   int32_t                              Scoreboard4DeltaX;
5296b8e80941Smrg   int32_t                              Scoreboard4DeltaY;
5297b8e80941Smrg   int32_t                              Scoreboard5DeltaX;
5298b8e80941Smrg   int32_t                              Scoreboard5DeltaY;
5299b8e80941Smrg   int32_t                              Scoreboard6DeltaX;
5300b8e80941Smrg   int32_t                              Scoreboard6DeltaY;
5301b8e80941Smrg   int32_t                              Scoreboard7DeltaX;
5302b8e80941Smrg   int32_t                              Scoreboard7DeltaY;
5303b8e80941Smrg};
5304b8e80941Smrg
5305b8e80941Smrgstatic inline void
5306b8e80941SmrgGEN7_MEDIA_VFE_STATE_pack(__attribute__((unused)) __gen_user_data *data,
5307b8e80941Smrg                          __attribute__((unused)) void * restrict dst,
5308b8e80941Smrg                          __attribute__((unused)) const struct GEN7_MEDIA_VFE_STATE * restrict values)
5309b8e80941Smrg{
5310b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5311b8e80941Smrg
5312b8e80941Smrg   dw[0] =
5313b8e80941Smrg      __gen_uint(values->DWordLength, 0, 15) |
5314b8e80941Smrg      __gen_uint(values->SubOpcode, 16, 23) |
5315b8e80941Smrg      __gen_uint(values->MediaCommandOpcode, 24, 26) |
5316b8e80941Smrg      __gen_uint(values->Pipeline, 27, 28) |
5317b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5318b8e80941Smrg
5319b8e80941Smrg   const uint32_t v1 =
5320b8e80941Smrg      __gen_uint(values->PerThreadScratchSpace, 0, 3);
5321b8e80941Smrg   dw[1] = __gen_combine_address(data, &dw[1], values->ScratchSpaceBasePointer, v1);
5322b8e80941Smrg
5323b8e80941Smrg   dw[2] =
5324b8e80941Smrg      __gen_uint(values->GPGPUMode, 2, 2) |
5325b8e80941Smrg      __gen_uint(values->GatewayMMIOAccessControl, 3, 4) |
5326b8e80941Smrg      __gen_uint(values->BypassGatewayControl, 6, 6) |
5327b8e80941Smrg      __gen_uint(values->ResetGatewayTimer, 7, 7) |
5328b8e80941Smrg      __gen_uint(values->NumberofURBEntries, 8, 15) |
5329b8e80941Smrg      __gen_uint(values->MaximumNumberofThreads, 16, 31);
5330b8e80941Smrg
5331b8e80941Smrg   dw[3] = 0;
5332b8e80941Smrg
5333b8e80941Smrg   dw[4] =
5334b8e80941Smrg      __gen_uint(values->CURBEAllocationSize, 0, 15) |
5335b8e80941Smrg      __gen_uint(values->URBEntryAllocationSize, 16, 31);
5336b8e80941Smrg
5337b8e80941Smrg   dw[5] =
5338b8e80941Smrg      __gen_uint(values->ScoreboardMask, 0, 7) |
5339b8e80941Smrg      __gen_uint(values->ScoreboardType, 30, 30) |
5340b8e80941Smrg      __gen_uint(values->ScoreboardEnable, 31, 31);
5341b8e80941Smrg
5342b8e80941Smrg   dw[6] =
5343b8e80941Smrg      __gen_sint(values->Scoreboard0DeltaX, 0, 3) |
5344b8e80941Smrg      __gen_sint(values->Scoreboard0DeltaY, 4, 7) |
5345b8e80941Smrg      __gen_sint(values->Scoreboard1DeltaX, 8, 11) |
5346b8e80941Smrg      __gen_sint(values->Scoreboard1DeltaY, 12, 15) |
5347b8e80941Smrg      __gen_sint(values->Scoreboard2DeltaX, 16, 19) |
5348b8e80941Smrg      __gen_sint(values->Scoreboard2DeltaY, 20, 23) |
5349b8e80941Smrg      __gen_sint(values->Scoreboard3DeltaX, 24, 27) |
5350b8e80941Smrg      __gen_sint(values->Scoreboard3DeltaY, 28, 31);
5351b8e80941Smrg
5352b8e80941Smrg   dw[7] =
5353b8e80941Smrg      __gen_sint(values->Scoreboard4DeltaX, 0, 3) |
5354b8e80941Smrg      __gen_sint(values->Scoreboard4DeltaY, 4, 7) |
5355b8e80941Smrg      __gen_sint(values->Scoreboard5DeltaX, 8, 11) |
5356b8e80941Smrg      __gen_sint(values->Scoreboard5DeltaY, 12, 15) |
5357b8e80941Smrg      __gen_sint(values->Scoreboard6DeltaX, 16, 19) |
5358b8e80941Smrg      __gen_sint(values->Scoreboard6DeltaY, 20, 23) |
5359b8e80941Smrg      __gen_sint(values->Scoreboard7DeltaX, 24, 27) |
5360b8e80941Smrg      __gen_sint(values->Scoreboard7DeltaY, 28, 31);
5361b8e80941Smrg}
5362b8e80941Smrg
5363b8e80941Smrg#define GEN7_MI_ARB_CHECK_length               1
5364b8e80941Smrg#define GEN7_MI_ARB_CHECK_length_bias          1
5365b8e80941Smrg#define GEN7_MI_ARB_CHECK_header                \
5366b8e80941Smrg   .MICommandOpcode                     =      5,  \
5367b8e80941Smrg   .CommandType                         =      0
5368b8e80941Smrg
5369b8e80941Smrgstruct GEN7_MI_ARB_CHECK {
5370b8e80941Smrg   uint32_t                             MICommandOpcode;
5371b8e80941Smrg   uint32_t                             CommandType;
5372b8e80941Smrg};
5373b8e80941Smrg
5374b8e80941Smrgstatic inline void
5375b8e80941SmrgGEN7_MI_ARB_CHECK_pack(__attribute__((unused)) __gen_user_data *data,
5376b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
5377b8e80941Smrg                       __attribute__((unused)) const struct GEN7_MI_ARB_CHECK * restrict values)
5378b8e80941Smrg{
5379b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5380b8e80941Smrg
5381b8e80941Smrg   dw[0] =
5382b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
5383b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5384b8e80941Smrg}
5385b8e80941Smrg
5386b8e80941Smrg#define GEN7_MI_ARB_ON_OFF_length              1
5387b8e80941Smrg#define GEN7_MI_ARB_ON_OFF_length_bias         1
5388b8e80941Smrg#define GEN7_MI_ARB_ON_OFF_header               \
5389b8e80941Smrg   .MICommandOpcode                     =      8,  \
5390b8e80941Smrg   .CommandType                         =      0
5391b8e80941Smrg
5392b8e80941Smrgstruct GEN7_MI_ARB_ON_OFF {
5393b8e80941Smrg   bool                                 ArbitrationEnable;
5394b8e80941Smrg   uint32_t                             MICommandOpcode;
5395b8e80941Smrg   uint32_t                             CommandType;
5396b8e80941Smrg};
5397b8e80941Smrg
5398b8e80941Smrgstatic inline void
5399b8e80941SmrgGEN7_MI_ARB_ON_OFF_pack(__attribute__((unused)) __gen_user_data *data,
5400b8e80941Smrg                        __attribute__((unused)) void * restrict dst,
5401b8e80941Smrg                        __attribute__((unused)) const struct GEN7_MI_ARB_ON_OFF * restrict values)
5402b8e80941Smrg{
5403b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5404b8e80941Smrg
5405b8e80941Smrg   dw[0] =
5406b8e80941Smrg      __gen_uint(values->ArbitrationEnable, 0, 0) |
5407b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
5408b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5409b8e80941Smrg}
5410b8e80941Smrg
5411b8e80941Smrg#define GEN7_MI_BATCH_BUFFER_END_length        1
5412b8e80941Smrg#define GEN7_MI_BATCH_BUFFER_END_length_bias      1
5413b8e80941Smrg#define GEN7_MI_BATCH_BUFFER_END_header         \
5414b8e80941Smrg   .MICommandOpcode                     =     10,  \
5415b8e80941Smrg   .CommandType                         =      0
5416b8e80941Smrg
5417b8e80941Smrgstruct GEN7_MI_BATCH_BUFFER_END {
5418b8e80941Smrg   uint32_t                             MICommandOpcode;
5419b8e80941Smrg   uint32_t                             CommandType;
5420b8e80941Smrg};
5421b8e80941Smrg
5422b8e80941Smrgstatic inline void
5423b8e80941SmrgGEN7_MI_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
5424b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
5425b8e80941Smrg                              __attribute__((unused)) const struct GEN7_MI_BATCH_BUFFER_END * restrict values)
5426b8e80941Smrg{
5427b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5428b8e80941Smrg
5429b8e80941Smrg   dw[0] =
5430b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
5431b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5432b8e80941Smrg}
5433b8e80941Smrg
5434b8e80941Smrg#define GEN7_MI_BATCH_BUFFER_START_length      2
5435b8e80941Smrg#define GEN7_MI_BATCH_BUFFER_START_length_bias      2
5436b8e80941Smrg#define GEN7_MI_BATCH_BUFFER_START_header       \
5437b8e80941Smrg   .DWordLength                         =      0,  \
5438b8e80941Smrg   .MICommandOpcode                     =     49,  \
5439b8e80941Smrg   .CommandType                         =      0
5440b8e80941Smrg
5441b8e80941Smrgstruct GEN7_MI_BATCH_BUFFER_START {
5442b8e80941Smrg   uint32_t                             DWordLength;
5443b8e80941Smrg   uint32_t                             AddressSpaceIndicator;
5444b8e80941Smrg#define ASI_GGTT                                 0
5445b8e80941Smrg#define ASI_PPGTT                                1
5446b8e80941Smrg   bool                                 ClearCommandBufferEnable;
5447b8e80941Smrg   uint32_t                             MICommandOpcode;
5448b8e80941Smrg   uint32_t                             CommandType;
5449b8e80941Smrg   __gen_address_type                   BatchBufferStartAddress;
5450b8e80941Smrg};
5451b8e80941Smrg
5452b8e80941Smrgstatic inline void
5453b8e80941SmrgGEN7_MI_BATCH_BUFFER_START_pack(__attribute__((unused)) __gen_user_data *data,
5454b8e80941Smrg                                __attribute__((unused)) void * restrict dst,
5455b8e80941Smrg                                __attribute__((unused)) const struct GEN7_MI_BATCH_BUFFER_START * restrict values)
5456b8e80941Smrg{
5457b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5458b8e80941Smrg
5459b8e80941Smrg   dw[0] =
5460b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5461b8e80941Smrg      __gen_uint(values->AddressSpaceIndicator, 8, 8) |
5462b8e80941Smrg      __gen_uint(values->ClearCommandBufferEnable, 11, 11) |
5463b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
5464b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5465b8e80941Smrg
5466b8e80941Smrg   dw[1] = __gen_combine_address(data, &dw[1], values->BatchBufferStartAddress, 0);
5467b8e80941Smrg}
5468b8e80941Smrg
5469b8e80941Smrg#define GEN7_MI_CLFLUSH_length_bias            2
5470b8e80941Smrg#define GEN7_MI_CLFLUSH_header                  \
5471b8e80941Smrg   .DWordLength                         =      1,  \
5472b8e80941Smrg   .MICommandOpcode                     =     39,  \
5473b8e80941Smrg   .CommandType                         =      0
5474b8e80941Smrg
5475b8e80941Smrgstruct GEN7_MI_CLFLUSH {
5476b8e80941Smrg   uint32_t                             DWordLength;
5477b8e80941Smrg   bool                                 UseGlobalGTT;
5478b8e80941Smrg   uint32_t                             MICommandOpcode;
5479b8e80941Smrg   uint32_t                             CommandType;
5480b8e80941Smrg   uint32_t                             StartingCachelineOffset;
5481b8e80941Smrg   __gen_address_type                   PageBaseAddress;
5482b8e80941Smrg   __gen_address_type                   PageBaseAddressHigh;
5483b8e80941Smrg   /* variable length fields follow */
5484b8e80941Smrg};
5485b8e80941Smrg
5486b8e80941Smrgstatic inline void
5487b8e80941SmrgGEN7_MI_CLFLUSH_pack(__attribute__((unused)) __gen_user_data *data,
5488b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
5489b8e80941Smrg                     __attribute__((unused)) const struct GEN7_MI_CLFLUSH * restrict values)
5490b8e80941Smrg{
5491b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5492b8e80941Smrg
5493b8e80941Smrg   dw[0] =
5494b8e80941Smrg      __gen_uint(values->DWordLength, 0, 9) |
5495b8e80941Smrg      __gen_uint(values->UseGlobalGTT, 22, 22) |
5496b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
5497b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5498b8e80941Smrg
5499b8e80941Smrg   const uint32_t v1 =
5500b8e80941Smrg      __gen_uint(values->StartingCachelineOffset, 6, 11);
5501b8e80941Smrg   dw[1] = __gen_combine_address(data, &dw[1], values->PageBaseAddress, v1);
5502b8e80941Smrg
5503b8e80941Smrg   dw[2] = __gen_combine_address(data, &dw[2], values->PageBaseAddressHigh, 0);
5504b8e80941Smrg}
5505b8e80941Smrg
5506b8e80941Smrg#define GEN7_MI_CONDITIONAL_BATCH_BUFFER_END_length      2
5507b8e80941Smrg#define GEN7_MI_CONDITIONAL_BATCH_BUFFER_END_length_bias      2
5508b8e80941Smrg#define GEN7_MI_CONDITIONAL_BATCH_BUFFER_END_header\
5509b8e80941Smrg   .DWordLength                         =      0,  \
5510b8e80941Smrg   .CompareSemaphore                    =      0,  \
5511b8e80941Smrg   .MICommandOpcode                     =     54,  \
5512b8e80941Smrg   .CommandType                         =      0
5513b8e80941Smrg
5514b8e80941Smrgstruct GEN7_MI_CONDITIONAL_BATCH_BUFFER_END {
5515b8e80941Smrg   uint32_t                             DWordLength;
5516b8e80941Smrg   uint32_t                             CompareSemaphore;
5517b8e80941Smrg   bool                                 UseGlobalGTT;
5518b8e80941Smrg   uint32_t                             MICommandOpcode;
5519b8e80941Smrg   uint32_t                             CommandType;
5520b8e80941Smrg   uint32_t                             CompareDataDword;
5521b8e80941Smrg   __gen_address_type                   CompareAddress;
5522b8e80941Smrg};
5523b8e80941Smrg
5524b8e80941Smrgstatic inline void
5525b8e80941SmrgGEN7_MI_CONDITIONAL_BATCH_BUFFER_END_pack(__attribute__((unused)) __gen_user_data *data,
5526b8e80941Smrg                                          __attribute__((unused)) void * restrict dst,
5527b8e80941Smrg                                          __attribute__((unused)) const struct GEN7_MI_CONDITIONAL_BATCH_BUFFER_END * restrict values)
5528b8e80941Smrg{
5529b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5530b8e80941Smrg
5531b8e80941Smrg   dw[0] =
5532b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5533b8e80941Smrg      __gen_uint(values->CompareSemaphore, 21, 21) |
5534b8e80941Smrg      __gen_uint(values->UseGlobalGTT, 22, 22) |
5535b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
5536b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5537b8e80941Smrg
5538b8e80941Smrg   dw[1] =
5539b8e80941Smrg      __gen_uint(values->CompareDataDword, 0, 31);
5540b8e80941Smrg}
5541b8e80941Smrg
5542b8e80941Smrg#define GEN7_MI_FLUSH_length                   1
5543b8e80941Smrg#define GEN7_MI_FLUSH_length_bias              1
5544b8e80941Smrg#define GEN7_MI_FLUSH_header                    \
5545b8e80941Smrg   .MICommandOpcode                     =      4,  \
5546b8e80941Smrg   .CommandType                         =      0
5547b8e80941Smrg
5548b8e80941Smrgstruct GEN7_MI_FLUSH {
5549b8e80941Smrg   uint32_t                             StateInstructionCacheInvalidate;
5550b8e80941Smrg#define DontInvalidate                           0
5551b8e80941Smrg#define Invalidate                               1
5552b8e80941Smrg   uint32_t                             RenderCacheFlushInhibit;
5553b8e80941Smrg#define Flush                                    0
5554b8e80941Smrg#define DontFlush                                1
5555b8e80941Smrg   uint32_t                             GlobalSnapshotCountReset;
5556b8e80941Smrg#define DontReset                                0
5557b8e80941Smrg#define Reset                                    1
5558b8e80941Smrg   bool                                 GenericMediaStateClear;
5559b8e80941Smrg   bool                                 IndirectStatePointersDisable;
5560b8e80941Smrg   uint32_t                             MICommandOpcode;
5561b8e80941Smrg   uint32_t                             CommandType;
5562b8e80941Smrg};
5563b8e80941Smrg
5564b8e80941Smrgstatic inline void
5565b8e80941SmrgGEN7_MI_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
5566b8e80941Smrg                   __attribute__((unused)) void * restrict dst,
5567b8e80941Smrg                   __attribute__((unused)) const struct GEN7_MI_FLUSH * restrict values)
5568b8e80941Smrg{
5569b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5570b8e80941Smrg
5571b8e80941Smrg   dw[0] =
5572b8e80941Smrg      __gen_uint(values->StateInstructionCacheInvalidate, 1, 1) |
5573b8e80941Smrg      __gen_uint(values->RenderCacheFlushInhibit, 2, 2) |
5574b8e80941Smrg      __gen_uint(values->GlobalSnapshotCountReset, 3, 3) |
5575b8e80941Smrg      __gen_uint(values->GenericMediaStateClear, 4, 4) |
5576b8e80941Smrg      __gen_uint(values->IndirectStatePointersDisable, 5, 5) |
5577b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
5578b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5579b8e80941Smrg}
5580b8e80941Smrg
5581b8e80941Smrg#define GEN7_MI_LOAD_REGISTER_IMM_length       3
5582b8e80941Smrg#define GEN7_MI_LOAD_REGISTER_IMM_length_bias      2
5583b8e80941Smrg#define GEN7_MI_LOAD_REGISTER_IMM_header        \
5584b8e80941Smrg   .DWordLength                         =      1,  \
5585b8e80941Smrg   .MICommandOpcode                     =     34,  \
5586b8e80941Smrg   .CommandType                         =      0
5587b8e80941Smrg
5588b8e80941Smrgstruct GEN7_MI_LOAD_REGISTER_IMM {
5589b8e80941Smrg   uint32_t                             DWordLength;
5590b8e80941Smrg   uint32_t                             ByteWriteDisables;
5591b8e80941Smrg   uint32_t                             MICommandOpcode;
5592b8e80941Smrg   uint32_t                             CommandType;
5593b8e80941Smrg   uint64_t                             RegisterOffset;
5594b8e80941Smrg   uint32_t                             DataDWord;
5595b8e80941Smrg   /* variable length fields follow */
5596b8e80941Smrg};
5597b8e80941Smrg
5598b8e80941Smrgstatic inline void
5599b8e80941SmrgGEN7_MI_LOAD_REGISTER_IMM_pack(__attribute__((unused)) __gen_user_data *data,
5600b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
5601b8e80941Smrg                               __attribute__((unused)) const struct GEN7_MI_LOAD_REGISTER_IMM * restrict values)
5602b8e80941Smrg{
5603b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5604b8e80941Smrg
5605b8e80941Smrg   dw[0] =
5606b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5607b8e80941Smrg      __gen_uint(values->ByteWriteDisables, 8, 11) |
5608b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
5609b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5610b8e80941Smrg
5611b8e80941Smrg   dw[1] =
5612b8e80941Smrg      __gen_offset(values->RegisterOffset, 2, 22);
5613b8e80941Smrg
5614b8e80941Smrg   dw[2] =
5615b8e80941Smrg      __gen_uint(values->DataDWord, 0, 31);
5616b8e80941Smrg}
5617b8e80941Smrg
5618b8e80941Smrg#define GEN7_MI_LOAD_REGISTER_MEM_length       3
5619b8e80941Smrg#define GEN7_MI_LOAD_REGISTER_MEM_length_bias      2
5620b8e80941Smrg#define GEN7_MI_LOAD_REGISTER_MEM_header        \
5621b8e80941Smrg   .DWordLength                         =      1,  \
5622b8e80941Smrg   .MICommandOpcode                     =     41,  \
5623b8e80941Smrg   .CommandType                         =      0
5624b8e80941Smrg
5625b8e80941Smrgstruct GEN7_MI_LOAD_REGISTER_MEM {
5626b8e80941Smrg   uint32_t                             DWordLength;
5627b8e80941Smrg   bool                                 AsyncModeEnable;
5628b8e80941Smrg   bool                                 UseGlobalGTT;
5629b8e80941Smrg   uint32_t                             MICommandOpcode;
5630b8e80941Smrg   uint32_t                             CommandType;
5631b8e80941Smrg   uint64_t                             RegisterAddress;
5632b8e80941Smrg   __gen_address_type                   MemoryAddress;
5633b8e80941Smrg};
5634b8e80941Smrg
5635b8e80941Smrgstatic inline void
5636b8e80941SmrgGEN7_MI_LOAD_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
5637b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
5638b8e80941Smrg                               __attribute__((unused)) const struct GEN7_MI_LOAD_REGISTER_MEM * restrict values)
5639b8e80941Smrg{
5640b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5641b8e80941Smrg
5642b8e80941Smrg   dw[0] =
5643b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5644b8e80941Smrg      __gen_uint(values->AsyncModeEnable, 21, 21) |
5645b8e80941Smrg      __gen_uint(values->UseGlobalGTT, 22, 22) |
5646b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
5647b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5648b8e80941Smrg
5649b8e80941Smrg   dw[1] =
5650b8e80941Smrg      __gen_offset(values->RegisterAddress, 2, 22);
5651b8e80941Smrg
5652b8e80941Smrg   dw[2] = __gen_combine_address(data, &dw[2], values->MemoryAddress, 0);
5653b8e80941Smrg}
5654b8e80941Smrg
5655b8e80941Smrg#define GEN7_MI_NOOP_length                    1
5656b8e80941Smrg#define GEN7_MI_NOOP_length_bias               1
5657b8e80941Smrg#define GEN7_MI_NOOP_header                     \
5658b8e80941Smrg   .MICommandOpcode                     =      0,  \
5659b8e80941Smrg   .CommandType                         =      0
5660b8e80941Smrg
5661b8e80941Smrgstruct GEN7_MI_NOOP {
5662b8e80941Smrg   uint32_t                             IdentificationNumber;
5663b8e80941Smrg   bool                                 IdentificationNumberRegisterWriteEnable;
5664b8e80941Smrg   uint32_t                             MICommandOpcode;
5665b8e80941Smrg   uint32_t                             CommandType;
5666b8e80941Smrg};
5667b8e80941Smrg
5668b8e80941Smrgstatic inline void
5669b8e80941SmrgGEN7_MI_NOOP_pack(__attribute__((unused)) __gen_user_data *data,
5670b8e80941Smrg                  __attribute__((unused)) void * restrict dst,
5671b8e80941Smrg                  __attribute__((unused)) const struct GEN7_MI_NOOP * restrict values)
5672b8e80941Smrg{
5673b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5674b8e80941Smrg
5675b8e80941Smrg   dw[0] =
5676b8e80941Smrg      __gen_uint(values->IdentificationNumber, 0, 21) |
5677b8e80941Smrg      __gen_uint(values->IdentificationNumberRegisterWriteEnable, 22, 22) |
5678b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
5679b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5680b8e80941Smrg}
5681b8e80941Smrg
5682b8e80941Smrg#define GEN7_MI_PREDICATE_length               1
5683b8e80941Smrg#define GEN7_MI_PREDICATE_length_bias          1
5684b8e80941Smrg#define GEN7_MI_PREDICATE_header                \
5685b8e80941Smrg   .MICommandOpcode                     =     12,  \
5686b8e80941Smrg   .CommandType                         =      0
5687b8e80941Smrg
5688b8e80941Smrgstruct GEN7_MI_PREDICATE {
5689b8e80941Smrg   uint32_t                             CompareOperation;
5690b8e80941Smrg#define COMPARE_TRUE                             0
5691b8e80941Smrg#define COMPARE_FALSE                            1
5692b8e80941Smrg#define COMPARE_SRCS_EQUAL                       2
5693b8e80941Smrg#define COMPARE_DELTAS_EQUAL                     3
5694b8e80941Smrg   uint32_t                             CombineOperation;
5695b8e80941Smrg#define COMBINE_SET                              0
5696b8e80941Smrg#define COMBINE_AND                              1
5697b8e80941Smrg#define COMBINE_OR                               2
5698b8e80941Smrg#define COMBINE_XOR                              3
5699b8e80941Smrg   uint32_t                             LoadOperation;
5700b8e80941Smrg#define LOAD_KEEP                                0
5701b8e80941Smrg#define LOAD_LOAD                                2
5702b8e80941Smrg#define LOAD_LOADINV                             3
5703b8e80941Smrg   uint32_t                             MICommandOpcode;
5704b8e80941Smrg   uint32_t                             CommandType;
5705b8e80941Smrg};
5706b8e80941Smrg
5707b8e80941Smrgstatic inline void
5708b8e80941SmrgGEN7_MI_PREDICATE_pack(__attribute__((unused)) __gen_user_data *data,
5709b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
5710b8e80941Smrg                       __attribute__((unused)) const struct GEN7_MI_PREDICATE * restrict values)
5711b8e80941Smrg{
5712b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5713b8e80941Smrg
5714b8e80941Smrg   dw[0] =
5715b8e80941Smrg      __gen_uint(values->CompareOperation, 0, 1) |
5716b8e80941Smrg      __gen_uint(values->CombineOperation, 3, 4) |
5717b8e80941Smrg      __gen_uint(values->LoadOperation, 6, 7) |
5718b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
5719b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5720b8e80941Smrg}
5721b8e80941Smrg
5722b8e80941Smrg#define GEN7_MI_REPORT_HEAD_length             1
5723b8e80941Smrg#define GEN7_MI_REPORT_HEAD_length_bias        1
5724b8e80941Smrg#define GEN7_MI_REPORT_HEAD_header              \
5725b8e80941Smrg   .MICommandOpcode                     =      7,  \
5726b8e80941Smrg   .CommandType                         =      0
5727b8e80941Smrg
5728b8e80941Smrgstruct GEN7_MI_REPORT_HEAD {
5729b8e80941Smrg   uint32_t                             MICommandOpcode;
5730b8e80941Smrg   uint32_t                             CommandType;
5731b8e80941Smrg};
5732b8e80941Smrg
5733b8e80941Smrgstatic inline void
5734b8e80941SmrgGEN7_MI_REPORT_HEAD_pack(__attribute__((unused)) __gen_user_data *data,
5735b8e80941Smrg                         __attribute__((unused)) void * restrict dst,
5736b8e80941Smrg                         __attribute__((unused)) const struct GEN7_MI_REPORT_HEAD * restrict values)
5737b8e80941Smrg{
5738b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5739b8e80941Smrg
5740b8e80941Smrg   dw[0] =
5741b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
5742b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5743b8e80941Smrg}
5744b8e80941Smrg
5745b8e80941Smrg#define GEN7_MI_REPORT_PERF_COUNT_length       3
5746b8e80941Smrg#define GEN7_MI_REPORT_PERF_COUNT_length_bias      2
5747b8e80941Smrg#define GEN7_MI_REPORT_PERF_COUNT_header        \
5748b8e80941Smrg   .DWordLength                         =      1,  \
5749b8e80941Smrg   .MICommandOpcode                     =     40,  \
5750b8e80941Smrg   .CommandType                         =      0
5751b8e80941Smrg
5752b8e80941Smrgstruct GEN7_MI_REPORT_PERF_COUNT {
5753b8e80941Smrg   uint32_t                             DWordLength;
5754b8e80941Smrg   uint32_t                             MICommandOpcode;
5755b8e80941Smrg   uint32_t                             CommandType;
5756b8e80941Smrg   bool                                 UseGlobalGTT;
5757b8e80941Smrg   __gen_address_type                   MemoryAddress;
5758b8e80941Smrg   uint32_t                             ReportID;
5759b8e80941Smrg};
5760b8e80941Smrg
5761b8e80941Smrgstatic inline void
5762b8e80941SmrgGEN7_MI_REPORT_PERF_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
5763b8e80941Smrg                               __attribute__((unused)) void * restrict dst,
5764b8e80941Smrg                               __attribute__((unused)) const struct GEN7_MI_REPORT_PERF_COUNT * restrict values)
5765b8e80941Smrg{
5766b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5767b8e80941Smrg
5768b8e80941Smrg   dw[0] =
5769b8e80941Smrg      __gen_uint(values->DWordLength, 0, 5) |
5770b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
5771b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5772b8e80941Smrg
5773b8e80941Smrg   const uint32_t v1 =
5774b8e80941Smrg      __gen_uint(values->UseGlobalGTT, 0, 0);
5775b8e80941Smrg   dw[1] = __gen_combine_address(data, &dw[1], values->MemoryAddress, v1);
5776b8e80941Smrg
5777b8e80941Smrg   dw[2] =
5778b8e80941Smrg      __gen_uint(values->ReportID, 0, 31);
5779b8e80941Smrg}
5780b8e80941Smrg
5781b8e80941Smrg#define GEN7_MI_SEMAPHORE_MBOX_length          3
5782b8e80941Smrg#define GEN7_MI_SEMAPHORE_MBOX_length_bias      2
5783b8e80941Smrg#define GEN7_MI_SEMAPHORE_MBOX_header           \
5784b8e80941Smrg   .DWordLength                         =      1,  \
5785b8e80941Smrg   .MICommandOpcode                     =     22,  \
5786b8e80941Smrg   .CommandType                         =      0
5787b8e80941Smrg
5788b8e80941Smrgstruct GEN7_MI_SEMAPHORE_MBOX {
5789b8e80941Smrg   uint32_t                             DWordLength;
5790b8e80941Smrg   uint32_t                             RegisterSelect;
5791b8e80941Smrg#define RVSYNC                                   0
5792b8e80941Smrg#define RBSYNC                                   2
5793b8e80941Smrg#define UseGeneralRegisterSelect                 3
5794b8e80941Smrg   uint32_t                             MICommandOpcode;
5795b8e80941Smrg   uint32_t                             CommandType;
5796b8e80941Smrg   uint32_t                             SemaphoreDataDword;
5797b8e80941Smrg};
5798b8e80941Smrg
5799b8e80941Smrgstatic inline void
5800b8e80941SmrgGEN7_MI_SEMAPHORE_MBOX_pack(__attribute__((unused)) __gen_user_data *data,
5801b8e80941Smrg                            __attribute__((unused)) void * restrict dst,
5802b8e80941Smrg                            __attribute__((unused)) const struct GEN7_MI_SEMAPHORE_MBOX * restrict values)
5803b8e80941Smrg{
5804b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5805b8e80941Smrg
5806b8e80941Smrg   dw[0] =
5807b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5808b8e80941Smrg      __gen_uint(values->RegisterSelect, 16, 17) |
5809b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
5810b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5811b8e80941Smrg
5812b8e80941Smrg   dw[1] =
5813b8e80941Smrg      __gen_uint(values->SemaphoreDataDword, 0, 31);
5814b8e80941Smrg
5815b8e80941Smrg   dw[2] = 0;
5816b8e80941Smrg}
5817b8e80941Smrg
5818b8e80941Smrg#define GEN7_MI_SET_CONTEXT_length             2
5819b8e80941Smrg#define GEN7_MI_SET_CONTEXT_length_bias        2
5820b8e80941Smrg#define GEN7_MI_SET_CONTEXT_header              \
5821b8e80941Smrg   .DWordLength                         =      0,  \
5822b8e80941Smrg   .MICommandOpcode                     =     24,  \
5823b8e80941Smrg   .CommandType                         =      0
5824b8e80941Smrg
5825b8e80941Smrgstruct GEN7_MI_SET_CONTEXT {
5826b8e80941Smrg   uint32_t                             DWordLength;
5827b8e80941Smrg   uint32_t                             MICommandOpcode;
5828b8e80941Smrg   uint32_t                             CommandType;
5829b8e80941Smrg   uint32_t                             RestoreInhibit;
5830b8e80941Smrg   uint32_t                             ForceRestore;
5831b8e80941Smrg   bool                                 ExtendedStateRestoreEnable;
5832b8e80941Smrg   bool                                 ExtendedStateSaveEnable;
5833b8e80941Smrg   uint32_t                             ReservedMustbe1;
5834b8e80941Smrg   __gen_address_type                   LogicalContextAddress;
5835b8e80941Smrg};
5836b8e80941Smrg
5837b8e80941Smrgstatic inline void
5838b8e80941SmrgGEN7_MI_SET_CONTEXT_pack(__attribute__((unused)) __gen_user_data *data,
5839b8e80941Smrg                         __attribute__((unused)) void * restrict dst,
5840b8e80941Smrg                         __attribute__((unused)) const struct GEN7_MI_SET_CONTEXT * restrict values)
5841b8e80941Smrg{
5842b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5843b8e80941Smrg
5844b8e80941Smrg   dw[0] =
5845b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5846b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
5847b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5848b8e80941Smrg
5849b8e80941Smrg   const uint32_t v1 =
5850b8e80941Smrg      __gen_uint(values->RestoreInhibit, 0, 0) |
5851b8e80941Smrg      __gen_uint(values->ForceRestore, 1, 1) |
5852b8e80941Smrg      __gen_uint(values->ExtendedStateRestoreEnable, 2, 2) |
5853b8e80941Smrg      __gen_uint(values->ExtendedStateSaveEnable, 3, 3) |
5854b8e80941Smrg      __gen_uint(values->ReservedMustbe1, 8, 8);
5855b8e80941Smrg   dw[1] = __gen_combine_address(data, &dw[1], values->LogicalContextAddress, v1);
5856b8e80941Smrg}
5857b8e80941Smrg
5858b8e80941Smrg#define GEN7_MI_STORE_DATA_IMM_length          4
5859b8e80941Smrg#define GEN7_MI_STORE_DATA_IMM_length_bias      2
5860b8e80941Smrg#define GEN7_MI_STORE_DATA_IMM_header           \
5861b8e80941Smrg   .DWordLength                         =      2,  \
5862b8e80941Smrg   .MICommandOpcode                     =     32,  \
5863b8e80941Smrg   .CommandType                         =      0
5864b8e80941Smrg
5865b8e80941Smrgstruct GEN7_MI_STORE_DATA_IMM {
5866b8e80941Smrg   uint32_t                             DWordLength;
5867b8e80941Smrg   bool                                 UseGlobalGTT;
5868b8e80941Smrg   uint32_t                             MICommandOpcode;
5869b8e80941Smrg   uint32_t                             CommandType;
5870b8e80941Smrg   uint32_t                             CoreModeEnable;
5871b8e80941Smrg   __gen_address_type                   Address;
5872b8e80941Smrg   uint64_t                             ImmediateData;
5873b8e80941Smrg};
5874b8e80941Smrg
5875b8e80941Smrgstatic inline void
5876b8e80941SmrgGEN7_MI_STORE_DATA_IMM_pack(__attribute__((unused)) __gen_user_data *data,
5877b8e80941Smrg                            __attribute__((unused)) void * restrict dst,
5878b8e80941Smrg                            __attribute__((unused)) const struct GEN7_MI_STORE_DATA_IMM * restrict values)
5879b8e80941Smrg{
5880b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5881b8e80941Smrg
5882b8e80941Smrg   dw[0] =
5883b8e80941Smrg      __gen_uint(values->DWordLength, 0, 5) |
5884b8e80941Smrg      __gen_uint(values->UseGlobalGTT, 22, 22) |
5885b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
5886b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5887b8e80941Smrg
5888b8e80941Smrg   dw[1] = 0;
5889b8e80941Smrg
5890b8e80941Smrg   const uint32_t v2 =
5891b8e80941Smrg      __gen_uint(values->CoreModeEnable, 0, 0);
5892b8e80941Smrg   dw[2] = __gen_combine_address(data, &dw[2], values->Address, v2);
5893b8e80941Smrg
5894b8e80941Smrg   const uint64_t v3 =
5895b8e80941Smrg      __gen_uint(values->ImmediateData, 0, 63);
5896b8e80941Smrg   dw[3] = v3;
5897b8e80941Smrg   dw[4] = v3 >> 32;
5898b8e80941Smrg}
5899b8e80941Smrg
5900b8e80941Smrg#define GEN7_MI_STORE_DATA_INDEX_length        3
5901b8e80941Smrg#define GEN7_MI_STORE_DATA_INDEX_length_bias      2
5902b8e80941Smrg#define GEN7_MI_STORE_DATA_INDEX_header         \
5903b8e80941Smrg   .DWordLength                         =      1,  \
5904b8e80941Smrg   .MICommandOpcode                     =     33,  \
5905b8e80941Smrg   .CommandType                         =      0
5906b8e80941Smrg
5907b8e80941Smrgstruct GEN7_MI_STORE_DATA_INDEX {
5908b8e80941Smrg   uint32_t                             DWordLength;
5909b8e80941Smrg   uint32_t                             MICommandOpcode;
5910b8e80941Smrg   uint32_t                             CommandType;
5911b8e80941Smrg   uint32_t                             Offset;
5912b8e80941Smrg   uint32_t                             DataDWord0;
5913b8e80941Smrg   uint32_t                             DataDWord1;
5914b8e80941Smrg};
5915b8e80941Smrg
5916b8e80941Smrgstatic inline void
5917b8e80941SmrgGEN7_MI_STORE_DATA_INDEX_pack(__attribute__((unused)) __gen_user_data *data,
5918b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
5919b8e80941Smrg                              __attribute__((unused)) const struct GEN7_MI_STORE_DATA_INDEX * restrict values)
5920b8e80941Smrg{
5921b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5922b8e80941Smrg
5923b8e80941Smrg   dw[0] =
5924b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5925b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
5926b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5927b8e80941Smrg
5928b8e80941Smrg   dw[1] =
5929b8e80941Smrg      __gen_uint(values->Offset, 2, 11);
5930b8e80941Smrg
5931b8e80941Smrg   dw[2] =
5932b8e80941Smrg      __gen_uint(values->DataDWord0, 0, 31);
5933b8e80941Smrg}
5934b8e80941Smrg
5935b8e80941Smrg#define GEN7_MI_STORE_REGISTER_MEM_length      3
5936b8e80941Smrg#define GEN7_MI_STORE_REGISTER_MEM_length_bias      2
5937b8e80941Smrg#define GEN7_MI_STORE_REGISTER_MEM_header       \
5938b8e80941Smrg   .DWordLength                         =      1,  \
5939b8e80941Smrg   .MICommandOpcode                     =     36,  \
5940b8e80941Smrg   .CommandType                         =      0
5941b8e80941Smrg
5942b8e80941Smrgstruct GEN7_MI_STORE_REGISTER_MEM {
5943b8e80941Smrg   uint32_t                             DWordLength;
5944b8e80941Smrg   bool                                 UseGlobalGTT;
5945b8e80941Smrg   uint32_t                             MICommandOpcode;
5946b8e80941Smrg   uint32_t                             CommandType;
5947b8e80941Smrg   uint64_t                             RegisterAddress;
5948b8e80941Smrg   __gen_address_type                   MemoryAddress;
5949b8e80941Smrg};
5950b8e80941Smrg
5951b8e80941Smrgstatic inline void
5952b8e80941SmrgGEN7_MI_STORE_REGISTER_MEM_pack(__attribute__((unused)) __gen_user_data *data,
5953b8e80941Smrg                                __attribute__((unused)) void * restrict dst,
5954b8e80941Smrg                                __attribute__((unused)) const struct GEN7_MI_STORE_REGISTER_MEM * restrict values)
5955b8e80941Smrg{
5956b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5957b8e80941Smrg
5958b8e80941Smrg   dw[0] =
5959b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
5960b8e80941Smrg      __gen_uint(values->UseGlobalGTT, 22, 22) |
5961b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
5962b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5963b8e80941Smrg
5964b8e80941Smrg   dw[1] =
5965b8e80941Smrg      __gen_offset(values->RegisterAddress, 2, 22);
5966b8e80941Smrg
5967b8e80941Smrg   dw[2] = __gen_combine_address(data, &dw[2], values->MemoryAddress, 0);
5968b8e80941Smrg}
5969b8e80941Smrg
5970b8e80941Smrg#define GEN7_MI_SUSPEND_FLUSH_length           1
5971b8e80941Smrg#define GEN7_MI_SUSPEND_FLUSH_length_bias      1
5972b8e80941Smrg#define GEN7_MI_SUSPEND_FLUSH_header            \
5973b8e80941Smrg   .MICommandOpcode                     =     11,  \
5974b8e80941Smrg   .CommandType                         =      0
5975b8e80941Smrg
5976b8e80941Smrgstruct GEN7_MI_SUSPEND_FLUSH {
5977b8e80941Smrg   bool                                 SuspendFlush;
5978b8e80941Smrg   uint32_t                             MICommandOpcode;
5979b8e80941Smrg   uint32_t                             CommandType;
5980b8e80941Smrg};
5981b8e80941Smrg
5982b8e80941Smrgstatic inline void
5983b8e80941SmrgGEN7_MI_SUSPEND_FLUSH_pack(__attribute__((unused)) __gen_user_data *data,
5984b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
5985b8e80941Smrg                           __attribute__((unused)) const struct GEN7_MI_SUSPEND_FLUSH * restrict values)
5986b8e80941Smrg{
5987b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
5988b8e80941Smrg
5989b8e80941Smrg   dw[0] =
5990b8e80941Smrg      __gen_uint(values->SuspendFlush, 0, 0) |
5991b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
5992b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
5993b8e80941Smrg}
5994b8e80941Smrg
5995b8e80941Smrg#define GEN7_MI_TOPOLOGY_FILTER_length         1
5996b8e80941Smrg#define GEN7_MI_TOPOLOGY_FILTER_length_bias      1
5997b8e80941Smrg#define GEN7_MI_TOPOLOGY_FILTER_header          \
5998b8e80941Smrg   .MICommandOpcode                     =     13,  \
5999b8e80941Smrg   .CommandType                         =      0
6000b8e80941Smrg
6001b8e80941Smrgstruct GEN7_MI_TOPOLOGY_FILTER {
6002b8e80941Smrg   enum GEN7_3D_Prim_Topo_Type          TopologyFilterValue;
6003b8e80941Smrg   uint32_t                             MICommandOpcode;
6004b8e80941Smrg   uint32_t                             CommandType;
6005b8e80941Smrg};
6006b8e80941Smrg
6007b8e80941Smrgstatic inline void
6008b8e80941SmrgGEN7_MI_TOPOLOGY_FILTER_pack(__attribute__((unused)) __gen_user_data *data,
6009b8e80941Smrg                             __attribute__((unused)) void * restrict dst,
6010b8e80941Smrg                             __attribute__((unused)) const struct GEN7_MI_TOPOLOGY_FILTER * restrict values)
6011b8e80941Smrg{
6012b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6013b8e80941Smrg
6014b8e80941Smrg   dw[0] =
6015b8e80941Smrg      __gen_uint(values->TopologyFilterValue, 0, 5) |
6016b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
6017b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6018b8e80941Smrg}
6019b8e80941Smrg
6020b8e80941Smrg#define GEN7_MI_URB_CLEAR_length               2
6021b8e80941Smrg#define GEN7_MI_URB_CLEAR_length_bias          2
6022b8e80941Smrg#define GEN7_MI_URB_CLEAR_header                \
6023b8e80941Smrg   .DWordLength                         =      0,  \
6024b8e80941Smrg   .MICommandOpcode                     =     25,  \
6025b8e80941Smrg   .CommandType                         =      0
6026b8e80941Smrg
6027b8e80941Smrgstruct GEN7_MI_URB_CLEAR {
6028b8e80941Smrg   uint32_t                             DWordLength;
6029b8e80941Smrg   uint32_t                             MICommandOpcode;
6030b8e80941Smrg   uint32_t                             CommandType;
6031b8e80941Smrg   uint64_t                             URBAddress;
6032b8e80941Smrg   uint32_t                             URBClearLength;
6033b8e80941Smrg};
6034b8e80941Smrg
6035b8e80941Smrgstatic inline void
6036b8e80941SmrgGEN7_MI_URB_CLEAR_pack(__attribute__((unused)) __gen_user_data *data,
6037b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
6038b8e80941Smrg                       __attribute__((unused)) const struct GEN7_MI_URB_CLEAR * restrict values)
6039b8e80941Smrg{
6040b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6041b8e80941Smrg
6042b8e80941Smrg   dw[0] =
6043b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
6044b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
6045b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6046b8e80941Smrg
6047b8e80941Smrg   dw[1] =
6048b8e80941Smrg      __gen_offset(values->URBAddress, 0, 13) |
6049b8e80941Smrg      __gen_uint(values->URBClearLength, 16, 28);
6050b8e80941Smrg}
6051b8e80941Smrg
6052b8e80941Smrg#define GEN7_MI_USER_INTERRUPT_length          1
6053b8e80941Smrg#define GEN7_MI_USER_INTERRUPT_length_bias      1
6054b8e80941Smrg#define GEN7_MI_USER_INTERRUPT_header           \
6055b8e80941Smrg   .MICommandOpcode                     =      2,  \
6056b8e80941Smrg   .CommandType                         =      0
6057b8e80941Smrg
6058b8e80941Smrgstruct GEN7_MI_USER_INTERRUPT {
6059b8e80941Smrg   uint32_t                             MICommandOpcode;
6060b8e80941Smrg   uint32_t                             CommandType;
6061b8e80941Smrg};
6062b8e80941Smrg
6063b8e80941Smrgstatic inline void
6064b8e80941SmrgGEN7_MI_USER_INTERRUPT_pack(__attribute__((unused)) __gen_user_data *data,
6065b8e80941Smrg                            __attribute__((unused)) void * restrict dst,
6066b8e80941Smrg                            __attribute__((unused)) const struct GEN7_MI_USER_INTERRUPT * restrict values)
6067b8e80941Smrg{
6068b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6069b8e80941Smrg
6070b8e80941Smrg   dw[0] =
6071b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
6072b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6073b8e80941Smrg}
6074b8e80941Smrg
6075b8e80941Smrg#define GEN7_MI_WAIT_FOR_EVENT_length          1
6076b8e80941Smrg#define GEN7_MI_WAIT_FOR_EVENT_length_bias      1
6077b8e80941Smrg#define GEN7_MI_WAIT_FOR_EVENT_header           \
6078b8e80941Smrg   .MICommandOpcode                     =      3,  \
6079b8e80941Smrg   .CommandType                         =      0
6080b8e80941Smrg
6081b8e80941Smrgstruct GEN7_MI_WAIT_FOR_EVENT {
6082b8e80941Smrg   bool                                 DisplayPipeAScanLineWaitEnable;
6083b8e80941Smrg   bool                                 DisplayPlaneAFlipPendingWaitEnable;
6084b8e80941Smrg   bool                                 DisplaySpriteAFlipPendingWaitEnable;
6085b8e80941Smrg   bool                                 DisplayPipeAVerticalBlankWaitEnable;
6086b8e80941Smrg   bool                                 DisplayPipeAHorizontalBlankWaitEnable;
6087b8e80941Smrg   bool                                 DisplayPipeBScanLineWaitEnable;
6088b8e80941Smrg   bool                                 DisplayPlaneBFlipPendingWaitEnable;
6089b8e80941Smrg   bool                                 DisplaySpriteBFlipPendingWaitEnable;
6090b8e80941Smrg   bool                                 DisplayPipeBVerticalBlankWaitEnable;
6091b8e80941Smrg   bool                                 DisplayPipeBHorizontalBlankWaitEnable;
6092b8e80941Smrg   bool                                 DisplayPipeCScanLineWaitEnable;
6093b8e80941Smrg   bool                                 DisplayPlaneCFlipPendingWaitEnable;
6094b8e80941Smrg   uint32_t                             ConditionCodeWaitSelect;
6095b8e80941Smrg#define Notenabled                               0
6096b8e80941Smrg   bool                                 DisplaySpriteCFlipPendingWaitEnable;
6097b8e80941Smrg   bool                                 DisplayPipeCVerticalBlankWaitEnable;
6098b8e80941Smrg   bool                                 DisplayPipeCHorizontalBlankWaitEnable;
6099b8e80941Smrg   uint32_t                             MICommandOpcode;
6100b8e80941Smrg   uint32_t                             CommandType;
6101b8e80941Smrg};
6102b8e80941Smrg
6103b8e80941Smrgstatic inline void
6104b8e80941SmrgGEN7_MI_WAIT_FOR_EVENT_pack(__attribute__((unused)) __gen_user_data *data,
6105b8e80941Smrg                            __attribute__((unused)) void * restrict dst,
6106b8e80941Smrg                            __attribute__((unused)) const struct GEN7_MI_WAIT_FOR_EVENT * restrict values)
6107b8e80941Smrg{
6108b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6109b8e80941Smrg
6110b8e80941Smrg   dw[0] =
6111b8e80941Smrg      __gen_uint(values->DisplayPipeAScanLineWaitEnable, 0, 0) |
6112b8e80941Smrg      __gen_uint(values->DisplayPlaneAFlipPendingWaitEnable, 1, 1) |
6113b8e80941Smrg      __gen_uint(values->DisplaySpriteAFlipPendingWaitEnable, 2, 2) |
6114b8e80941Smrg      __gen_uint(values->DisplayPipeAVerticalBlankWaitEnable, 3, 3) |
6115b8e80941Smrg      __gen_uint(values->DisplayPipeAHorizontalBlankWaitEnable, 5, 5) |
6116b8e80941Smrg      __gen_uint(values->DisplayPipeBScanLineWaitEnable, 8, 8) |
6117b8e80941Smrg      __gen_uint(values->DisplayPlaneBFlipPendingWaitEnable, 9, 9) |
6118b8e80941Smrg      __gen_uint(values->DisplaySpriteBFlipPendingWaitEnable, 10, 10) |
6119b8e80941Smrg      __gen_uint(values->DisplayPipeBVerticalBlankWaitEnable, 11, 11) |
6120b8e80941Smrg      __gen_uint(values->DisplayPipeBHorizontalBlankWaitEnable, 13, 13) |
6121b8e80941Smrg      __gen_uint(values->DisplayPipeCScanLineWaitEnable, 14, 14) |
6122b8e80941Smrg      __gen_uint(values->DisplayPlaneCFlipPendingWaitEnable, 15, 15) |
6123b8e80941Smrg      __gen_uint(values->ConditionCodeWaitSelect, 16, 19) |
6124b8e80941Smrg      __gen_uint(values->DisplaySpriteCFlipPendingWaitEnable, 20, 20) |
6125b8e80941Smrg      __gen_uint(values->DisplayPipeCVerticalBlankWaitEnable, 21, 21) |
6126b8e80941Smrg      __gen_uint(values->DisplayPipeCHorizontalBlankWaitEnable, 22, 22) |
6127b8e80941Smrg      __gen_uint(values->MICommandOpcode, 23, 28) |
6128b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6129b8e80941Smrg}
6130b8e80941Smrg
6131b8e80941Smrg#define GEN7_PIPELINE_SELECT_length            1
6132b8e80941Smrg#define GEN7_PIPELINE_SELECT_length_bias       1
6133b8e80941Smrg#define GEN7_PIPELINE_SELECT_header             \
6134b8e80941Smrg   ._3DCommandSubOpcode                 =      4,  \
6135b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
6136b8e80941Smrg   .CommandSubType                      =      1,  \
6137b8e80941Smrg   .CommandType                         =      3
6138b8e80941Smrg
6139b8e80941Smrgstruct GEN7_PIPELINE_SELECT {
6140b8e80941Smrg   uint32_t                             PipelineSelection;
6141b8e80941Smrg#define _3D                                      0
6142b8e80941Smrg#define Media                                    1
6143b8e80941Smrg#define GPGPU                                    2
6144b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
6145b8e80941Smrg   uint32_t                             _3DCommandOpcode;
6146b8e80941Smrg   uint32_t                             CommandSubType;
6147b8e80941Smrg   uint32_t                             CommandType;
6148b8e80941Smrg};
6149b8e80941Smrg
6150b8e80941Smrgstatic inline void
6151b8e80941SmrgGEN7_PIPELINE_SELECT_pack(__attribute__((unused)) __gen_user_data *data,
6152b8e80941Smrg                          __attribute__((unused)) void * restrict dst,
6153b8e80941Smrg                          __attribute__((unused)) const struct GEN7_PIPELINE_SELECT * restrict values)
6154b8e80941Smrg{
6155b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6156b8e80941Smrg
6157b8e80941Smrg   dw[0] =
6158b8e80941Smrg      __gen_uint(values->PipelineSelection, 0, 1) |
6159b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6160b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6161b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
6162b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6163b8e80941Smrg}
6164b8e80941Smrg
6165b8e80941Smrg#define GEN7_PIPE_CONTROL_length               5
6166b8e80941Smrg#define GEN7_PIPE_CONTROL_length_bias          2
6167b8e80941Smrg#define GEN7_PIPE_CONTROL_header                \
6168b8e80941Smrg   .DWordLength                         =      3,  \
6169b8e80941Smrg   ._3DCommandSubOpcode                 =      0,  \
6170b8e80941Smrg   ._3DCommandOpcode                    =      2,  \
6171b8e80941Smrg   .CommandSubType                      =      3,  \
6172b8e80941Smrg   .CommandType                         =      3
6173b8e80941Smrg
6174b8e80941Smrgstruct GEN7_PIPE_CONTROL {
6175b8e80941Smrg   uint32_t                             DWordLength;
6176b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
6177b8e80941Smrg   uint32_t                             _3DCommandOpcode;
6178b8e80941Smrg   uint32_t                             CommandSubType;
6179b8e80941Smrg   uint32_t                             CommandType;
6180b8e80941Smrg   bool                                 DepthCacheFlushEnable;
6181b8e80941Smrg   bool                                 StallAtPixelScoreboard;
6182b8e80941Smrg   bool                                 StateCacheInvalidationEnable;
6183b8e80941Smrg   bool                                 ConstantCacheInvalidationEnable;
6184b8e80941Smrg   bool                                 VFCacheInvalidationEnable;
6185b8e80941Smrg   bool                                 DCFlushEnable;
6186b8e80941Smrg   bool                                 PipeControlFlushEnable;
6187b8e80941Smrg   bool                                 NotifyEnable;
6188b8e80941Smrg   bool                                 IndirectStatePointersDisable;
6189b8e80941Smrg   bool                                 TextureCacheInvalidationEnable;
6190b8e80941Smrg   bool                                 InstructionCacheInvalidateEnable;
6191b8e80941Smrg   bool                                 RenderTargetCacheFlushEnable;
6192b8e80941Smrg   bool                                 DepthStallEnable;
6193b8e80941Smrg   uint32_t                             PostSyncOperation;
6194b8e80941Smrg#define NoWrite                                  0
6195b8e80941Smrg#define WriteImmediateData                       1
6196b8e80941Smrg#define WritePSDepthCount                        2
6197b8e80941Smrg#define WriteTimestamp                           3
6198b8e80941Smrg   bool                                 GenericMediaStateClear;
6199b8e80941Smrg   bool                                 TLBInvalidate;
6200b8e80941Smrg   bool                                 GlobalSnapshotCountReset;
6201b8e80941Smrg   bool                                 CommandStreamerStallEnable;
6202b8e80941Smrg   uint32_t                             StoreDataIndex;
6203b8e80941Smrg   uint32_t                             LRIPostSyncOperation;
6204b8e80941Smrg#define NoLRIOperation                           0
6205b8e80941Smrg#define MMIOWriteImmediateData                   1
6206b8e80941Smrg   uint32_t                             DestinationAddressType;
6207b8e80941Smrg#define DAT_PPGTT                                0
6208b8e80941Smrg#define DAT_GGTT                                 1
6209b8e80941Smrg   __gen_address_type                   Address;
6210b8e80941Smrg   uint64_t                             ImmediateData;
6211b8e80941Smrg};
6212b8e80941Smrg
6213b8e80941Smrgstatic inline void
6214b8e80941SmrgGEN7_PIPE_CONTROL_pack(__attribute__((unused)) __gen_user_data *data,
6215b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
6216b8e80941Smrg                       __attribute__((unused)) const struct GEN7_PIPE_CONTROL * restrict values)
6217b8e80941Smrg{
6218b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6219b8e80941Smrg
6220b8e80941Smrg   dw[0] =
6221b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
6222b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6223b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6224b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
6225b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6226b8e80941Smrg
6227b8e80941Smrg   dw[1] =
6228b8e80941Smrg      __gen_uint(values->DepthCacheFlushEnable, 0, 0) |
6229b8e80941Smrg      __gen_uint(values->StallAtPixelScoreboard, 1, 1) |
6230b8e80941Smrg      __gen_uint(values->StateCacheInvalidationEnable, 2, 2) |
6231b8e80941Smrg      __gen_uint(values->ConstantCacheInvalidationEnable, 3, 3) |
6232b8e80941Smrg      __gen_uint(values->VFCacheInvalidationEnable, 4, 4) |
6233b8e80941Smrg      __gen_uint(values->DCFlushEnable, 5, 5) |
6234b8e80941Smrg      __gen_uint(values->PipeControlFlushEnable, 7, 7) |
6235b8e80941Smrg      __gen_uint(values->NotifyEnable, 8, 8) |
6236b8e80941Smrg      __gen_uint(values->IndirectStatePointersDisable, 9, 9) |
6237b8e80941Smrg      __gen_uint(values->TextureCacheInvalidationEnable, 10, 10) |
6238b8e80941Smrg      __gen_uint(values->InstructionCacheInvalidateEnable, 11, 11) |
6239b8e80941Smrg      __gen_uint(values->RenderTargetCacheFlushEnable, 12, 12) |
6240b8e80941Smrg      __gen_uint(values->DepthStallEnable, 13, 13) |
6241b8e80941Smrg      __gen_uint(values->PostSyncOperation, 14, 15) |
6242b8e80941Smrg      __gen_uint(values->GenericMediaStateClear, 16, 16) |
6243b8e80941Smrg      __gen_uint(values->TLBInvalidate, 18, 18) |
6244b8e80941Smrg      __gen_uint(values->GlobalSnapshotCountReset, 19, 19) |
6245b8e80941Smrg      __gen_uint(values->CommandStreamerStallEnable, 20, 20) |
6246b8e80941Smrg      __gen_uint(values->StoreDataIndex, 21, 21) |
6247b8e80941Smrg      __gen_uint(values->LRIPostSyncOperation, 23, 23) |
6248b8e80941Smrg      __gen_uint(values->DestinationAddressType, 24, 24);
6249b8e80941Smrg
6250b8e80941Smrg   dw[2] = __gen_combine_address(data, &dw[2], values->Address, 0);
6251b8e80941Smrg
6252b8e80941Smrg   const uint64_t v3 =
6253b8e80941Smrg      __gen_uint(values->ImmediateData, 0, 63);
6254b8e80941Smrg   dw[3] = v3;
6255b8e80941Smrg   dw[4] = v3 >> 32;
6256b8e80941Smrg}
6257b8e80941Smrg
6258b8e80941Smrg#define GEN7_STATE_BASE_ADDRESS_length        10
6259b8e80941Smrg#define GEN7_STATE_BASE_ADDRESS_length_bias      2
6260b8e80941Smrg#define GEN7_STATE_BASE_ADDRESS_header          \
6261b8e80941Smrg   .DWordLength                         =      8,  \
6262b8e80941Smrg   ._3DCommandSubOpcode                 =      1,  \
6263b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
6264b8e80941Smrg   .CommandSubType                      =      0,  \
6265b8e80941Smrg   .CommandType                         =      3
6266b8e80941Smrg
6267b8e80941Smrgstruct GEN7_STATE_BASE_ADDRESS {
6268b8e80941Smrg   uint32_t                             DWordLength;
6269b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
6270b8e80941Smrg   uint32_t                             _3DCommandOpcode;
6271b8e80941Smrg   uint32_t                             CommandSubType;
6272b8e80941Smrg   uint32_t                             CommandType;
6273b8e80941Smrg   bool                                 GeneralStateBaseAddressModifyEnable;
6274b8e80941Smrg   uint32_t                             StatelessDataPortAccessForceWriteThru;
6275b8e80941Smrg   uint32_t                             StatelessDataPortAccessMOCS;
6276b8e80941Smrg   uint32_t                             GeneralStateMOCS;
6277b8e80941Smrg   __gen_address_type                   GeneralStateBaseAddress;
6278b8e80941Smrg   bool                                 SurfaceStateBaseAddressModifyEnable;
6279b8e80941Smrg   uint32_t                             SurfaceStateMOCS;
6280b8e80941Smrg   __gen_address_type                   SurfaceStateBaseAddress;
6281b8e80941Smrg   bool                                 DynamicStateBaseAddressModifyEnable;
6282b8e80941Smrg   uint32_t                             DynamicStateMOCS;
6283b8e80941Smrg   __gen_address_type                   DynamicStateBaseAddress;
6284b8e80941Smrg   bool                                 IndirectObjectBaseAddressModifyEnable;
6285b8e80941Smrg   uint32_t                             IndirectObjectMOCS;
6286b8e80941Smrg   __gen_address_type                   IndirectObjectBaseAddress;
6287b8e80941Smrg   bool                                 InstructionBaseAddressModifyEnable;
6288b8e80941Smrg   uint32_t                             InstructionMOCS;
6289b8e80941Smrg   __gen_address_type                   InstructionBaseAddress;
6290b8e80941Smrg   bool                                 GeneralStateAccessUpperBoundModifyEnable;
6291b8e80941Smrg   __gen_address_type                   GeneralStateAccessUpperBound;
6292b8e80941Smrg   bool                                 DynamicStateAccessUpperBoundModifyEnable;
6293b8e80941Smrg   __gen_address_type                   DynamicStateAccessUpperBound;
6294b8e80941Smrg   bool                                 IndirectObjectAccessUpperBoundModifyEnable;
6295b8e80941Smrg   __gen_address_type                   IndirectObjectAccessUpperBound;
6296b8e80941Smrg   bool                                 InstructionAccessUpperBoundModifyEnable;
6297b8e80941Smrg   __gen_address_type                   InstructionAccessUpperBound;
6298b8e80941Smrg};
6299b8e80941Smrg
6300b8e80941Smrgstatic inline void
6301b8e80941SmrgGEN7_STATE_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
6302b8e80941Smrg                             __attribute__((unused)) void * restrict dst,
6303b8e80941Smrg                             __attribute__((unused)) const struct GEN7_STATE_BASE_ADDRESS * restrict values)
6304b8e80941Smrg{
6305b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6306b8e80941Smrg
6307b8e80941Smrg   dw[0] =
6308b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
6309b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6310b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6311b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
6312b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6313b8e80941Smrg
6314b8e80941Smrg   const uint32_t v1 =
6315b8e80941Smrg      __gen_uint(values->GeneralStateBaseAddressModifyEnable, 0, 0) |
6316b8e80941Smrg      __gen_uint(values->StatelessDataPortAccessForceWriteThru, 3, 3) |
6317b8e80941Smrg      __gen_uint(values->StatelessDataPortAccessMOCS, 4, 7) |
6318b8e80941Smrg      __gen_uint(values->GeneralStateMOCS, 8, 11);
6319b8e80941Smrg   dw[1] = __gen_combine_address(data, &dw[1], values->GeneralStateBaseAddress, v1);
6320b8e80941Smrg
6321b8e80941Smrg   const uint32_t v2 =
6322b8e80941Smrg      __gen_uint(values->SurfaceStateBaseAddressModifyEnable, 0, 0) |
6323b8e80941Smrg      __gen_uint(values->SurfaceStateMOCS, 8, 11);
6324b8e80941Smrg   dw[2] = __gen_combine_address(data, &dw[2], values->SurfaceStateBaseAddress, v2);
6325b8e80941Smrg
6326b8e80941Smrg   const uint32_t v3 =
6327b8e80941Smrg      __gen_uint(values->DynamicStateBaseAddressModifyEnable, 0, 0) |
6328b8e80941Smrg      __gen_uint(values->DynamicStateMOCS, 8, 11);
6329b8e80941Smrg   dw[3] = __gen_combine_address(data, &dw[3], values->DynamicStateBaseAddress, v3);
6330b8e80941Smrg
6331b8e80941Smrg   const uint32_t v4 =
6332b8e80941Smrg      __gen_uint(values->IndirectObjectBaseAddressModifyEnable, 0, 0) |
6333b8e80941Smrg      __gen_uint(values->IndirectObjectMOCS, 8, 11);
6334b8e80941Smrg   dw[4] = __gen_combine_address(data, &dw[4], values->IndirectObjectBaseAddress, v4);
6335b8e80941Smrg
6336b8e80941Smrg   const uint32_t v5 =
6337b8e80941Smrg      __gen_uint(values->InstructionBaseAddressModifyEnable, 0, 0) |
6338b8e80941Smrg      __gen_uint(values->InstructionMOCS, 8, 11);
6339b8e80941Smrg   dw[5] = __gen_combine_address(data, &dw[5], values->InstructionBaseAddress, v5);
6340b8e80941Smrg
6341b8e80941Smrg   const uint32_t v6 =
6342b8e80941Smrg      __gen_uint(values->GeneralStateAccessUpperBoundModifyEnable, 0, 0);
6343b8e80941Smrg   dw[6] = __gen_combine_address(data, &dw[6], values->GeneralStateAccessUpperBound, v6);
6344b8e80941Smrg
6345b8e80941Smrg   const uint32_t v7 =
6346b8e80941Smrg      __gen_uint(values->DynamicStateAccessUpperBoundModifyEnable, 0, 0);
6347b8e80941Smrg   dw[7] = __gen_combine_address(data, &dw[7], values->DynamicStateAccessUpperBound, v7);
6348b8e80941Smrg
6349b8e80941Smrg   const uint32_t v8 =
6350b8e80941Smrg      __gen_uint(values->IndirectObjectAccessUpperBoundModifyEnable, 0, 0);
6351b8e80941Smrg   dw[8] = __gen_combine_address(data, &dw[8], values->IndirectObjectAccessUpperBound, v8);
6352b8e80941Smrg
6353b8e80941Smrg   const uint32_t v9 =
6354b8e80941Smrg      __gen_uint(values->InstructionAccessUpperBoundModifyEnable, 0, 0);
6355b8e80941Smrg   dw[9] = __gen_combine_address(data, &dw[9], values->InstructionAccessUpperBound, v9);
6356b8e80941Smrg}
6357b8e80941Smrg
6358b8e80941Smrg#define GEN7_STATE_PREFETCH_length             2
6359b8e80941Smrg#define GEN7_STATE_PREFETCH_length_bias        2
6360b8e80941Smrg#define GEN7_STATE_PREFETCH_header              \
6361b8e80941Smrg   .DWordLength                         =      0,  \
6362b8e80941Smrg   ._3DCommandSubOpcode                 =      3,  \
6363b8e80941Smrg   ._3DCommandOpcode                    =      0,  \
6364b8e80941Smrg   .CommandSubType                      =      0,  \
6365b8e80941Smrg   .CommandType                         =      3
6366b8e80941Smrg
6367b8e80941Smrgstruct GEN7_STATE_PREFETCH {
6368b8e80941Smrg   uint32_t                             DWordLength;
6369b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
6370b8e80941Smrg   uint32_t                             _3DCommandOpcode;
6371b8e80941Smrg   uint32_t                             CommandSubType;
6372b8e80941Smrg   uint32_t                             CommandType;
6373b8e80941Smrg   uint32_t                             PrefetchCount;
6374b8e80941Smrg   __gen_address_type                   PrefetchPointer;
6375b8e80941Smrg};
6376b8e80941Smrg
6377b8e80941Smrgstatic inline void
6378b8e80941SmrgGEN7_STATE_PREFETCH_pack(__attribute__((unused)) __gen_user_data *data,
6379b8e80941Smrg                         __attribute__((unused)) void * restrict dst,
6380b8e80941Smrg                         __attribute__((unused)) const struct GEN7_STATE_PREFETCH * restrict values)
6381b8e80941Smrg{
6382b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6383b8e80941Smrg
6384b8e80941Smrg   dw[0] =
6385b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
6386b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6387b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6388b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
6389b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6390b8e80941Smrg
6391b8e80941Smrg   const uint32_t v1 =
6392b8e80941Smrg      __gen_uint(values->PrefetchCount, 0, 2);
6393b8e80941Smrg   dw[1] = __gen_combine_address(data, &dw[1], values->PrefetchPointer, v1);
6394b8e80941Smrg}
6395b8e80941Smrg
6396b8e80941Smrg#define GEN7_STATE_SIP_length                  2
6397b8e80941Smrg#define GEN7_STATE_SIP_length_bias             2
6398b8e80941Smrg#define GEN7_STATE_SIP_header                   \
6399b8e80941Smrg   .DWordLength                         =      0,  \
6400b8e80941Smrg   ._3DCommandSubOpcode                 =      2,  \
6401b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
6402b8e80941Smrg   .CommandSubType                      =      0,  \
6403b8e80941Smrg   .CommandType                         =      3
6404b8e80941Smrg
6405b8e80941Smrgstruct GEN7_STATE_SIP {
6406b8e80941Smrg   uint32_t                             DWordLength;
6407b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
6408b8e80941Smrg   uint32_t                             _3DCommandOpcode;
6409b8e80941Smrg   uint32_t                             CommandSubType;
6410b8e80941Smrg   uint32_t                             CommandType;
6411b8e80941Smrg   uint64_t                             SystemInstructionPointer;
6412b8e80941Smrg};
6413b8e80941Smrg
6414b8e80941Smrgstatic inline void
6415b8e80941SmrgGEN7_STATE_SIP_pack(__attribute__((unused)) __gen_user_data *data,
6416b8e80941Smrg                    __attribute__((unused)) void * restrict dst,
6417b8e80941Smrg                    __attribute__((unused)) const struct GEN7_STATE_SIP * restrict values)
6418b8e80941Smrg{
6419b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6420b8e80941Smrg
6421b8e80941Smrg   dw[0] =
6422b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
6423b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6424b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6425b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
6426b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6427b8e80941Smrg
6428b8e80941Smrg   dw[1] =
6429b8e80941Smrg      __gen_offset(values->SystemInstructionPointer, 4, 31);
6430b8e80941Smrg}
6431b8e80941Smrg
6432b8e80941Smrg#define GEN7_SWTESS_BASE_ADDRESS_length        2
6433b8e80941Smrg#define GEN7_SWTESS_BASE_ADDRESS_length_bias      2
6434b8e80941Smrg#define GEN7_SWTESS_BASE_ADDRESS_header         \
6435b8e80941Smrg   .DWordLength                         =      0,  \
6436b8e80941Smrg   ._3DCommandSubOpcode                 =      3,  \
6437b8e80941Smrg   ._3DCommandOpcode                    =      1,  \
6438b8e80941Smrg   .CommandSubType                      =      0,  \
6439b8e80941Smrg   .CommandType                         =      3
6440b8e80941Smrg
6441b8e80941Smrgstruct GEN7_SWTESS_BASE_ADDRESS {
6442b8e80941Smrg   uint32_t                             DWordLength;
6443b8e80941Smrg   uint32_t                             _3DCommandSubOpcode;
6444b8e80941Smrg   uint32_t                             _3DCommandOpcode;
6445b8e80941Smrg   uint32_t                             CommandSubType;
6446b8e80941Smrg   uint32_t                             CommandType;
6447b8e80941Smrg   uint32_t                             SWTessellationMOCS;
6448b8e80941Smrg   __gen_address_type                   SWTessellationBaseAddress;
6449b8e80941Smrg};
6450b8e80941Smrg
6451b8e80941Smrgstatic inline void
6452b8e80941SmrgGEN7_SWTESS_BASE_ADDRESS_pack(__attribute__((unused)) __gen_user_data *data,
6453b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
6454b8e80941Smrg                              __attribute__((unused)) const struct GEN7_SWTESS_BASE_ADDRESS * restrict values)
6455b8e80941Smrg{
6456b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6457b8e80941Smrg
6458b8e80941Smrg   dw[0] =
6459b8e80941Smrg      __gen_uint(values->DWordLength, 0, 7) |
6460b8e80941Smrg      __gen_uint(values->_3DCommandSubOpcode, 16, 23) |
6461b8e80941Smrg      __gen_uint(values->_3DCommandOpcode, 24, 26) |
6462b8e80941Smrg      __gen_uint(values->CommandSubType, 27, 28) |
6463b8e80941Smrg      __gen_uint(values->CommandType, 29, 31);
6464b8e80941Smrg
6465b8e80941Smrg   const uint32_t v1 =
6466b8e80941Smrg      __gen_uint(values->SWTessellationMOCS, 8, 11);
6467b8e80941Smrg   dw[1] = __gen_combine_address(data, &dw[1], values->SWTessellationBaseAddress, v1);
6468b8e80941Smrg}
6469b8e80941Smrg
6470b8e80941Smrg#define GEN7_BCS_FAULT_REG_num            0x4294
6471b8e80941Smrg#define GEN7_BCS_FAULT_REG_length              1
6472b8e80941Smrgstruct GEN7_BCS_FAULT_REG {
6473b8e80941Smrg   bool                                 ValidBit;
6474b8e80941Smrg   uint32_t                             FaultType;
6475b8e80941Smrg#define PageFault                                0
6476b8e80941Smrg#define InvalidPDFault                           1
6477b8e80941Smrg#define UnloadedPDFault                          2
6478b8e80941Smrg#define InvalidandUnloadedPDfault                3
6479b8e80941Smrg   uint32_t                             SRCIDofFault;
6480b8e80941Smrg   uint32_t                             GTTSEL;
6481b8e80941Smrg#define PPGTT                                    0
6482b8e80941Smrg#define GGTT                                     1
6483b8e80941Smrg   __gen_address_type                   VirtualAddressofFault;
6484b8e80941Smrg};
6485b8e80941Smrg
6486b8e80941Smrgstatic inline void
6487b8e80941SmrgGEN7_BCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
6488b8e80941Smrg                        __attribute__((unused)) void * restrict dst,
6489b8e80941Smrg                        __attribute__((unused)) const struct GEN7_BCS_FAULT_REG * restrict values)
6490b8e80941Smrg{
6491b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6492b8e80941Smrg
6493b8e80941Smrg   const uint32_t v0 =
6494b8e80941Smrg      __gen_uint(values->ValidBit, 0, 0) |
6495b8e80941Smrg      __gen_uint(values->FaultType, 1, 2) |
6496b8e80941Smrg      __gen_uint(values->SRCIDofFault, 3, 10) |
6497b8e80941Smrg      __gen_uint(values->GTTSEL, 11, 11);
6498b8e80941Smrg   dw[0] = __gen_combine_address(data, &dw[0], values->VirtualAddressofFault, v0);
6499b8e80941Smrg}
6500b8e80941Smrg
6501b8e80941Smrg#define GEN7_BCS_INSTDONE_num             0x2206c
6502b8e80941Smrg#define GEN7_BCS_INSTDONE_length               1
6503b8e80941Smrgstruct GEN7_BCS_INSTDONE {
6504b8e80941Smrg   bool                                 RingEnable;
6505b8e80941Smrg   bool                                 BlitterIDLE;
6506b8e80941Smrg   bool                                 GABIDLE;
6507b8e80941Smrg   bool                                 BCSDone;
6508b8e80941Smrg};
6509b8e80941Smrg
6510b8e80941Smrgstatic inline void
6511b8e80941SmrgGEN7_BCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
6512b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
6513b8e80941Smrg                       __attribute__((unused)) const struct GEN7_BCS_INSTDONE * restrict values)
6514b8e80941Smrg{
6515b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6516b8e80941Smrg
6517b8e80941Smrg   dw[0] =
6518b8e80941Smrg      __gen_uint(values->RingEnable, 0, 0) |
6519b8e80941Smrg      __gen_uint(values->BlitterIDLE, 1, 1) |
6520b8e80941Smrg      __gen_uint(values->GABIDLE, 2, 2) |
6521b8e80941Smrg      __gen_uint(values->BCSDone, 3, 3);
6522b8e80941Smrg}
6523b8e80941Smrg
6524b8e80941Smrg#define GEN7_BCS_RING_BUFFER_CTL_num      0x2203c
6525b8e80941Smrg#define GEN7_BCS_RING_BUFFER_CTL_length        1
6526b8e80941Smrgstruct GEN7_BCS_RING_BUFFER_CTL {
6527b8e80941Smrg   bool                                 RingBufferEnable;
6528b8e80941Smrg   uint32_t                             AutomaticReportHeadPointer;
6529b8e80941Smrg#define MI_AUTOREPORT_OFF                        0
6530b8e80941Smrg#define MI_AUTOREPORT_64KB                       1
6531b8e80941Smrg#define MI_AUTOREPORT_4KB                        2
6532b8e80941Smrg#define MI_AUTOREPORT_128KB                      3
6533b8e80941Smrg   bool                                 DisableRegisterAccesses;
6534b8e80941Smrg   bool                                 SemaphoreWait;
6535b8e80941Smrg   bool                                 RBWait;
6536b8e80941Smrg   uint32_t                             BufferLengthinpages1;
6537b8e80941Smrg};
6538b8e80941Smrg
6539b8e80941Smrgstatic inline void
6540b8e80941SmrgGEN7_BCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
6541b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
6542b8e80941Smrg                              __attribute__((unused)) const struct GEN7_BCS_RING_BUFFER_CTL * restrict values)
6543b8e80941Smrg{
6544b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6545b8e80941Smrg
6546b8e80941Smrg   dw[0] =
6547b8e80941Smrg      __gen_uint(values->RingBufferEnable, 0, 0) |
6548b8e80941Smrg      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
6549b8e80941Smrg      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
6550b8e80941Smrg      __gen_uint(values->SemaphoreWait, 10, 10) |
6551b8e80941Smrg      __gen_uint(values->RBWait, 11, 11) |
6552b8e80941Smrg      __gen_uint(values->BufferLengthinpages1, 12, 20);
6553b8e80941Smrg}
6554b8e80941Smrg
6555b8e80941Smrg#define GEN7_CL_INVOCATION_COUNT_num      0x2338
6556b8e80941Smrg#define GEN7_CL_INVOCATION_COUNT_length        2
6557b8e80941Smrgstruct GEN7_CL_INVOCATION_COUNT {
6558b8e80941Smrg   uint64_t                             CLInvocationCountReport;
6559b8e80941Smrg};
6560b8e80941Smrg
6561b8e80941Smrgstatic inline void
6562b8e80941SmrgGEN7_CL_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
6563b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
6564b8e80941Smrg                              __attribute__((unused)) const struct GEN7_CL_INVOCATION_COUNT * restrict values)
6565b8e80941Smrg{
6566b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6567b8e80941Smrg
6568b8e80941Smrg   const uint64_t v0 =
6569b8e80941Smrg      __gen_uint(values->CLInvocationCountReport, 0, 63);
6570b8e80941Smrg   dw[0] = v0;
6571b8e80941Smrg   dw[1] = v0 >> 32;
6572b8e80941Smrg}
6573b8e80941Smrg
6574b8e80941Smrg#define GEN7_CL_PRIMITIVES_COUNT_num      0x2340
6575b8e80941Smrg#define GEN7_CL_PRIMITIVES_COUNT_length        2
6576b8e80941Smrgstruct GEN7_CL_PRIMITIVES_COUNT {
6577b8e80941Smrg   uint64_t                             CLPrimitivesCountReport;
6578b8e80941Smrg};
6579b8e80941Smrg
6580b8e80941Smrgstatic inline void
6581b8e80941SmrgGEN7_CL_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
6582b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
6583b8e80941Smrg                              __attribute__((unused)) const struct GEN7_CL_PRIMITIVES_COUNT * restrict values)
6584b8e80941Smrg{
6585b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6586b8e80941Smrg
6587b8e80941Smrg   const uint64_t v0 =
6588b8e80941Smrg      __gen_uint(values->CLPrimitivesCountReport, 0, 63);
6589b8e80941Smrg   dw[0] = v0;
6590b8e80941Smrg   dw[1] = v0 >> 32;
6591b8e80941Smrg}
6592b8e80941Smrg
6593b8e80941Smrg#define GEN7_CS_INVOCATION_COUNT_num      0x2290
6594b8e80941Smrg#define GEN7_CS_INVOCATION_COUNT_length        2
6595b8e80941Smrgstruct GEN7_CS_INVOCATION_COUNT {
6596b8e80941Smrg   uint64_t                             CSInvocationCountReport;
6597b8e80941Smrg};
6598b8e80941Smrg
6599b8e80941Smrgstatic inline void
6600b8e80941SmrgGEN7_CS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
6601b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
6602b8e80941Smrg                              __attribute__((unused)) const struct GEN7_CS_INVOCATION_COUNT * restrict values)
6603b8e80941Smrg{
6604b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6605b8e80941Smrg
6606b8e80941Smrg   const uint64_t v0 =
6607b8e80941Smrg      __gen_uint(values->CSInvocationCountReport, 0, 63);
6608b8e80941Smrg   dw[0] = v0;
6609b8e80941Smrg   dw[1] = v0 >> 32;
6610b8e80941Smrg}
6611b8e80941Smrg
6612b8e80941Smrg#define GEN7_DS_INVOCATION_COUNT_num      0x2308
6613b8e80941Smrg#define GEN7_DS_INVOCATION_COUNT_length        2
6614b8e80941Smrgstruct GEN7_DS_INVOCATION_COUNT {
6615b8e80941Smrg   uint64_t                             DSInvocationCountReport;
6616b8e80941Smrg};
6617b8e80941Smrg
6618b8e80941Smrgstatic inline void
6619b8e80941SmrgGEN7_DS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
6620b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
6621b8e80941Smrg                              __attribute__((unused)) const struct GEN7_DS_INVOCATION_COUNT * restrict values)
6622b8e80941Smrg{
6623b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6624b8e80941Smrg
6625b8e80941Smrg   const uint64_t v0 =
6626b8e80941Smrg      __gen_uint(values->DSInvocationCountReport, 0, 63);
6627b8e80941Smrg   dw[0] = v0;
6628b8e80941Smrg   dw[1] = v0 >> 32;
6629b8e80941Smrg}
6630b8e80941Smrg
6631b8e80941Smrg#define GEN7_ERR_INT_num                  0x44040
6632b8e80941Smrg#define GEN7_ERR_INT_length                    1
6633b8e80941Smrgstruct GEN7_ERR_INT {
6634b8e80941Smrg   bool                                 PrimaryAGTTFaultStatus;
6635b8e80941Smrg   bool                                 PrimaryBGTTFaultStatus;
6636b8e80941Smrg   bool                                 SpriteAGTTFaultStatus;
6637b8e80941Smrg   bool                                 SpriteBGTTFaultStatus;
6638b8e80941Smrg   bool                                 CursorAGTTFaultStatus;
6639b8e80941Smrg   bool                                 CursorBGTTFaultStatus;
6640b8e80941Smrg   bool                                 Invalidpagetableentrydata;
6641b8e80941Smrg   bool                                 InvalidGTTpagetableentry;
6642b8e80941Smrg};
6643b8e80941Smrg
6644b8e80941Smrgstatic inline void
6645b8e80941SmrgGEN7_ERR_INT_pack(__attribute__((unused)) __gen_user_data *data,
6646b8e80941Smrg                  __attribute__((unused)) void * restrict dst,
6647b8e80941Smrg                  __attribute__((unused)) const struct GEN7_ERR_INT * restrict values)
6648b8e80941Smrg{
6649b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6650b8e80941Smrg
6651b8e80941Smrg   dw[0] =
6652b8e80941Smrg      __gen_uint(values->PrimaryAGTTFaultStatus, 0, 0) |
6653b8e80941Smrg      __gen_uint(values->PrimaryBGTTFaultStatus, 1, 1) |
6654b8e80941Smrg      __gen_uint(values->SpriteAGTTFaultStatus, 2, 2) |
6655b8e80941Smrg      __gen_uint(values->SpriteBGTTFaultStatus, 3, 3) |
6656b8e80941Smrg      __gen_uint(values->CursorAGTTFaultStatus, 4, 4) |
6657b8e80941Smrg      __gen_uint(values->CursorBGTTFaultStatus, 5, 5) |
6658b8e80941Smrg      __gen_uint(values->Invalidpagetableentrydata, 6, 6) |
6659b8e80941Smrg      __gen_uint(values->InvalidGTTpagetableentry, 7, 7);
6660b8e80941Smrg}
6661b8e80941Smrg
6662b8e80941Smrg#define GEN7_GFX_ARB_ERROR_RPT_num        0x40a0
6663b8e80941Smrg#define GEN7_GFX_ARB_ERROR_RPT_length          1
6664b8e80941Smrgstruct GEN7_GFX_ARB_ERROR_RPT {
6665b8e80941Smrg   bool                                 TLBPageFaultError;
6666b8e80941Smrg   bool                                 ContextPageFaultError;
6667b8e80941Smrg   bool                                 InvalidPageDirectoryentryerror;
6668b8e80941Smrg   bool                                 HardwareStatusPageFaultError;
6669b8e80941Smrg   bool                                 TLBPageVTDTranslationError;
6670b8e80941Smrg   bool                                 ContextPageVTDTranslationError;
6671b8e80941Smrg   bool                                 PageDirectoryEntryVTDTranslationError;
6672b8e80941Smrg   bool                                 HardwareStatusPageVTDTranslationError;
6673b8e80941Smrg   bool                                 UnloadedPDError;
6674b8e80941Smrg};
6675b8e80941Smrg
6676b8e80941Smrgstatic inline void
6677b8e80941SmrgGEN7_GFX_ARB_ERROR_RPT_pack(__attribute__((unused)) __gen_user_data *data,
6678b8e80941Smrg                            __attribute__((unused)) void * restrict dst,
6679b8e80941Smrg                            __attribute__((unused)) const struct GEN7_GFX_ARB_ERROR_RPT * restrict values)
6680b8e80941Smrg{
6681b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6682b8e80941Smrg
6683b8e80941Smrg   dw[0] =
6684b8e80941Smrg      __gen_uint(values->TLBPageFaultError, 0, 0) |
6685b8e80941Smrg      __gen_uint(values->ContextPageFaultError, 1, 1) |
6686b8e80941Smrg      __gen_uint(values->InvalidPageDirectoryentryerror, 2, 2) |
6687b8e80941Smrg      __gen_uint(values->HardwareStatusPageFaultError, 3, 3) |
6688b8e80941Smrg      __gen_uint(values->TLBPageVTDTranslationError, 4, 4) |
6689b8e80941Smrg      __gen_uint(values->ContextPageVTDTranslationError, 5, 5) |
6690b8e80941Smrg      __gen_uint(values->PageDirectoryEntryVTDTranslationError, 6, 6) |
6691b8e80941Smrg      __gen_uint(values->HardwareStatusPageVTDTranslationError, 7, 7) |
6692b8e80941Smrg      __gen_uint(values->UnloadedPDError, 8, 8);
6693b8e80941Smrg}
6694b8e80941Smrg
6695b8e80941Smrg#define GEN7_GS_INVOCATION_COUNT_num      0x2328
6696b8e80941Smrg#define GEN7_GS_INVOCATION_COUNT_length        2
6697b8e80941Smrgstruct GEN7_GS_INVOCATION_COUNT {
6698b8e80941Smrg   uint64_t                             GSInvocationCountReport;
6699b8e80941Smrg};
6700b8e80941Smrg
6701b8e80941Smrgstatic inline void
6702b8e80941SmrgGEN7_GS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
6703b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
6704b8e80941Smrg                              __attribute__((unused)) const struct GEN7_GS_INVOCATION_COUNT * restrict values)
6705b8e80941Smrg{
6706b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6707b8e80941Smrg
6708b8e80941Smrg   const uint64_t v0 =
6709b8e80941Smrg      __gen_uint(values->GSInvocationCountReport, 0, 63);
6710b8e80941Smrg   dw[0] = v0;
6711b8e80941Smrg   dw[1] = v0 >> 32;
6712b8e80941Smrg}
6713b8e80941Smrg
6714b8e80941Smrg#define GEN7_GS_PRIMITIVES_COUNT_num      0x2330
6715b8e80941Smrg#define GEN7_GS_PRIMITIVES_COUNT_length        2
6716b8e80941Smrgstruct GEN7_GS_PRIMITIVES_COUNT {
6717b8e80941Smrg   uint64_t                             GSPrimitivesCountReport;
6718b8e80941Smrg};
6719b8e80941Smrg
6720b8e80941Smrgstatic inline void
6721b8e80941SmrgGEN7_GS_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
6722b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
6723b8e80941Smrg                              __attribute__((unused)) const struct GEN7_GS_PRIMITIVES_COUNT * restrict values)
6724b8e80941Smrg{
6725b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6726b8e80941Smrg
6727b8e80941Smrg   const uint64_t v0 =
6728b8e80941Smrg      __gen_uint(values->GSPrimitivesCountReport, 0, 63);
6729b8e80941Smrg   dw[0] = v0;
6730b8e80941Smrg   dw[1] = v0 >> 32;
6731b8e80941Smrg}
6732b8e80941Smrg
6733b8e80941Smrg#define GEN7_HS_INVOCATION_COUNT_num      0x2300
6734b8e80941Smrg#define GEN7_HS_INVOCATION_COUNT_length        2
6735b8e80941Smrgstruct GEN7_HS_INVOCATION_COUNT {
6736b8e80941Smrg   uint64_t                             HSInvocationCountReport;
6737b8e80941Smrg};
6738b8e80941Smrg
6739b8e80941Smrgstatic inline void
6740b8e80941SmrgGEN7_HS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
6741b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
6742b8e80941Smrg                              __attribute__((unused)) const struct GEN7_HS_INVOCATION_COUNT * restrict values)
6743b8e80941Smrg{
6744b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6745b8e80941Smrg
6746b8e80941Smrg   const uint64_t v0 =
6747b8e80941Smrg      __gen_uint(values->HSInvocationCountReport, 0, 63);
6748b8e80941Smrg   dw[0] = v0;
6749b8e80941Smrg   dw[1] = v0 >> 32;
6750b8e80941Smrg}
6751b8e80941Smrg
6752b8e80941Smrg#define GEN7_IA_PRIMITIVES_COUNT_num      0x2318
6753b8e80941Smrg#define GEN7_IA_PRIMITIVES_COUNT_length        2
6754b8e80941Smrgstruct GEN7_IA_PRIMITIVES_COUNT {
6755b8e80941Smrg   uint64_t                             IAPrimitivesCountReport;
6756b8e80941Smrg};
6757b8e80941Smrg
6758b8e80941Smrgstatic inline void
6759b8e80941SmrgGEN7_IA_PRIMITIVES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
6760b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
6761b8e80941Smrg                              __attribute__((unused)) const struct GEN7_IA_PRIMITIVES_COUNT * restrict values)
6762b8e80941Smrg{
6763b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6764b8e80941Smrg
6765b8e80941Smrg   const uint64_t v0 =
6766b8e80941Smrg      __gen_uint(values->IAPrimitivesCountReport, 0, 63);
6767b8e80941Smrg   dw[0] = v0;
6768b8e80941Smrg   dw[1] = v0 >> 32;
6769b8e80941Smrg}
6770b8e80941Smrg
6771b8e80941Smrg#define GEN7_IA_VERTICES_COUNT_num        0x2310
6772b8e80941Smrg#define GEN7_IA_VERTICES_COUNT_length          2
6773b8e80941Smrgstruct GEN7_IA_VERTICES_COUNT {
6774b8e80941Smrg   uint64_t                             IAVerticesCountReport;
6775b8e80941Smrg};
6776b8e80941Smrg
6777b8e80941Smrgstatic inline void
6778b8e80941SmrgGEN7_IA_VERTICES_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
6779b8e80941Smrg                            __attribute__((unused)) void * restrict dst,
6780b8e80941Smrg                            __attribute__((unused)) const struct GEN7_IA_VERTICES_COUNT * restrict values)
6781b8e80941Smrg{
6782b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6783b8e80941Smrg
6784b8e80941Smrg   const uint64_t v0 =
6785b8e80941Smrg      __gen_uint(values->IAVerticesCountReport, 0, 63);
6786b8e80941Smrg   dw[0] = v0;
6787b8e80941Smrg   dw[1] = v0 >> 32;
6788b8e80941Smrg}
6789b8e80941Smrg
6790b8e80941Smrg#define GEN7_INSTDONE_1_num               0x206c
6791b8e80941Smrg#define GEN7_INSTDONE_1_length                 1
6792b8e80941Smrgstruct GEN7_INSTDONE_1 {
6793b8e80941Smrg   bool                                 PRB0RingEnable;
6794b8e80941Smrg   bool                                 VFGDone;
6795b8e80941Smrg   bool                                 VSDone;
6796b8e80941Smrg   bool                                 HSDone;
6797b8e80941Smrg   bool                                 TEDone;
6798b8e80941Smrg   bool                                 DSDone;
6799b8e80941Smrg   bool                                 GSDone;
6800b8e80941Smrg   bool                                 SOLDone;
6801b8e80941Smrg   bool                                 CLDone;
6802b8e80941Smrg   bool                                 SFDone;
6803b8e80941Smrg   bool                                 TDGDone;
6804b8e80941Smrg   bool                                 URBMDone;
6805b8e80941Smrg   bool                                 SVGDone;
6806b8e80941Smrg   bool                                 GAFSDone;
6807b8e80941Smrg   bool                                 VFEDone;
6808b8e80941Smrg   bool                                 TSGDone;
6809b8e80941Smrg   bool                                 GAFMDone;
6810b8e80941Smrg   bool                                 GAMDone;
6811b8e80941Smrg   bool                                 SDEDone;
6812b8e80941Smrg   bool                                 RCCFBCCSDone;
6813b8e80941Smrg};
6814b8e80941Smrg
6815b8e80941Smrgstatic inline void
6816b8e80941SmrgGEN7_INSTDONE_1_pack(__attribute__((unused)) __gen_user_data *data,
6817b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
6818b8e80941Smrg                     __attribute__((unused)) const struct GEN7_INSTDONE_1 * restrict values)
6819b8e80941Smrg{
6820b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6821b8e80941Smrg
6822b8e80941Smrg   dw[0] =
6823b8e80941Smrg      __gen_uint(values->PRB0RingEnable, 0, 0) |
6824b8e80941Smrg      __gen_uint(values->VFGDone, 1, 1) |
6825b8e80941Smrg      __gen_uint(values->VSDone, 2, 2) |
6826b8e80941Smrg      __gen_uint(values->HSDone, 3, 3) |
6827b8e80941Smrg      __gen_uint(values->TEDone, 4, 4) |
6828b8e80941Smrg      __gen_uint(values->DSDone, 5, 5) |
6829b8e80941Smrg      __gen_uint(values->GSDone, 6, 6) |
6830b8e80941Smrg      __gen_uint(values->SOLDone, 7, 7) |
6831b8e80941Smrg      __gen_uint(values->CLDone, 8, 8) |
6832b8e80941Smrg      __gen_uint(values->SFDone, 9, 9) |
6833b8e80941Smrg      __gen_uint(values->TDGDone, 12, 12) |
6834b8e80941Smrg      __gen_uint(values->URBMDone, 13, 13) |
6835b8e80941Smrg      __gen_uint(values->SVGDone, 14, 14) |
6836b8e80941Smrg      __gen_uint(values->GAFSDone, 15, 15) |
6837b8e80941Smrg      __gen_uint(values->VFEDone, 16, 16) |
6838b8e80941Smrg      __gen_uint(values->TSGDone, 17, 17) |
6839b8e80941Smrg      __gen_uint(values->GAFMDone, 18, 18) |
6840b8e80941Smrg      __gen_uint(values->GAMDone, 19, 19) |
6841b8e80941Smrg      __gen_uint(values->SDEDone, 22, 22) |
6842b8e80941Smrg      __gen_uint(values->RCCFBCCSDone, 23, 23);
6843b8e80941Smrg}
6844b8e80941Smrg
6845b8e80941Smrg#define GEN7_INSTPM_num                   0x20c0
6846b8e80941Smrg#define GEN7_INSTPM_length                     1
6847b8e80941Smrgstruct GEN7_INSTPM {
6848b8e80941Smrg   bool                                 _3DStateInstructionDisable;
6849b8e80941Smrg   bool                                 _3DRenderingInstructionDisable;
6850b8e80941Smrg   bool                                 MediaInstructionDisable;
6851b8e80941Smrg   bool                                 CONSTANT_BUFFERAddressOffsetDisable;
6852b8e80941Smrg   bool                                 _3DStateInstructionDisableMask;
6853b8e80941Smrg   bool                                 _3DRenderingInstructionDisableMask;
6854b8e80941Smrg   bool                                 MediaInstructionDisableMask;
6855b8e80941Smrg   bool                                 CONSTANT_BUFFERAddressOffsetDisableMask;
6856b8e80941Smrg};
6857b8e80941Smrg
6858b8e80941Smrgstatic inline void
6859b8e80941SmrgGEN7_INSTPM_pack(__attribute__((unused)) __gen_user_data *data,
6860b8e80941Smrg                 __attribute__((unused)) void * restrict dst,
6861b8e80941Smrg                 __attribute__((unused)) const struct GEN7_INSTPM * restrict values)
6862b8e80941Smrg{
6863b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6864b8e80941Smrg
6865b8e80941Smrg   dw[0] =
6866b8e80941Smrg      __gen_uint(values->_3DStateInstructionDisable, 1, 1) |
6867b8e80941Smrg      __gen_uint(values->_3DRenderingInstructionDisable, 2, 2) |
6868b8e80941Smrg      __gen_uint(values->MediaInstructionDisable, 3, 3) |
6869b8e80941Smrg      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisable, 6, 6) |
6870b8e80941Smrg      __gen_uint(values->_3DStateInstructionDisableMask, 17, 17) |
6871b8e80941Smrg      __gen_uint(values->_3DRenderingInstructionDisableMask, 18, 18) |
6872b8e80941Smrg      __gen_uint(values->MediaInstructionDisableMask, 19, 19) |
6873b8e80941Smrg      __gen_uint(values->CONSTANT_BUFFERAddressOffsetDisableMask, 22, 22);
6874b8e80941Smrg}
6875b8e80941Smrg
6876b8e80941Smrg#define GEN7_L3CNTLREG2_num               0xb020
6877b8e80941Smrg#define GEN7_L3CNTLREG2_length                 1
6878b8e80941Smrgstruct GEN7_L3CNTLREG2 {
6879b8e80941Smrg   uint32_t                             SLMEnable;
6880b8e80941Smrg   uint32_t                             URBAllocation;
6881b8e80941Smrg   uint32_t                             URBLowBandwidth;
6882b8e80941Smrg   uint32_t                             ALLAllocation;
6883b8e80941Smrg   uint32_t                             ROAllocation;
6884b8e80941Smrg   uint32_t                             ROLowBandwidth;
6885b8e80941Smrg   uint32_t                             DCAllocation;
6886b8e80941Smrg   uint32_t                             DCLowBandwidth;
6887b8e80941Smrg};
6888b8e80941Smrg
6889b8e80941Smrgstatic inline void
6890b8e80941SmrgGEN7_L3CNTLREG2_pack(__attribute__((unused)) __gen_user_data *data,
6891b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
6892b8e80941Smrg                     __attribute__((unused)) const struct GEN7_L3CNTLREG2 * restrict values)
6893b8e80941Smrg{
6894b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6895b8e80941Smrg
6896b8e80941Smrg   dw[0] =
6897b8e80941Smrg      __gen_uint(values->SLMEnable, 0, 0) |
6898b8e80941Smrg      __gen_uint(values->URBAllocation, 1, 6) |
6899b8e80941Smrg      __gen_uint(values->URBLowBandwidth, 7, 7) |
6900b8e80941Smrg      __gen_uint(values->ALLAllocation, 8, 13) |
6901b8e80941Smrg      __gen_uint(values->ROAllocation, 14, 19) |
6902b8e80941Smrg      __gen_uint(values->ROLowBandwidth, 20, 20) |
6903b8e80941Smrg      __gen_uint(values->DCAllocation, 21, 26) |
6904b8e80941Smrg      __gen_uint(values->DCLowBandwidth, 27, 27);
6905b8e80941Smrg}
6906b8e80941Smrg
6907b8e80941Smrg#define GEN7_L3CNTLREG3_num               0xb024
6908b8e80941Smrg#define GEN7_L3CNTLREG3_length                 1
6909b8e80941Smrgstruct GEN7_L3CNTLREG3 {
6910b8e80941Smrg   uint32_t                             ISAllocation;
6911b8e80941Smrg   uint32_t                             ISLowBandwidth;
6912b8e80941Smrg   uint32_t                             CAllocation;
6913b8e80941Smrg   uint32_t                             CLowBandwidth;
6914b8e80941Smrg   uint32_t                             TAllocation;
6915b8e80941Smrg   uint32_t                             TLowBandwidth;
6916b8e80941Smrg};
6917b8e80941Smrg
6918b8e80941Smrgstatic inline void
6919b8e80941SmrgGEN7_L3CNTLREG3_pack(__attribute__((unused)) __gen_user_data *data,
6920b8e80941Smrg                     __attribute__((unused)) void * restrict dst,
6921b8e80941Smrg                     __attribute__((unused)) const struct GEN7_L3CNTLREG3 * restrict values)
6922b8e80941Smrg{
6923b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6924b8e80941Smrg
6925b8e80941Smrg   dw[0] =
6926b8e80941Smrg      __gen_uint(values->ISAllocation, 1, 6) |
6927b8e80941Smrg      __gen_uint(values->ISLowBandwidth, 7, 7) |
6928b8e80941Smrg      __gen_uint(values->CAllocation, 8, 13) |
6929b8e80941Smrg      __gen_uint(values->CLowBandwidth, 14, 14) |
6930b8e80941Smrg      __gen_uint(values->TAllocation, 15, 20) |
6931b8e80941Smrg      __gen_uint(values->TLowBandwidth, 21, 21);
6932b8e80941Smrg}
6933b8e80941Smrg
6934b8e80941Smrg#define GEN7_L3SQCREG1_num                0xb010
6935b8e80941Smrg#define GEN7_L3SQCREG1_length                  1
6936b8e80941Smrgstruct GEN7_L3SQCREG1 {
6937b8e80941Smrg   uint32_t                             ConvertDC_UC;
6938b8e80941Smrg   uint32_t                             ConvertIS_UC;
6939b8e80941Smrg   uint32_t                             ConvertC_UC;
6940b8e80941Smrg   uint32_t                             ConvertT_UC;
6941b8e80941Smrg};
6942b8e80941Smrg
6943b8e80941Smrgstatic inline void
6944b8e80941SmrgGEN7_L3SQCREG1_pack(__attribute__((unused)) __gen_user_data *data,
6945b8e80941Smrg                    __attribute__((unused)) void * restrict dst,
6946b8e80941Smrg                    __attribute__((unused)) const struct GEN7_L3SQCREG1 * restrict values)
6947b8e80941Smrg{
6948b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6949b8e80941Smrg
6950b8e80941Smrg   dw[0] =
6951b8e80941Smrg      __gen_uint(values->ConvertDC_UC, 24, 24) |
6952b8e80941Smrg      __gen_uint(values->ConvertIS_UC, 25, 25) |
6953b8e80941Smrg      __gen_uint(values->ConvertC_UC, 26, 26) |
6954b8e80941Smrg      __gen_uint(values->ConvertT_UC, 27, 27);
6955b8e80941Smrg}
6956b8e80941Smrg
6957b8e80941Smrg#define GEN7_PS_INVOCATION_COUNT_num      0x2348
6958b8e80941Smrg#define GEN7_PS_INVOCATION_COUNT_length        2
6959b8e80941Smrgstruct GEN7_PS_INVOCATION_COUNT {
6960b8e80941Smrg   uint64_t                             PSInvocationCountReport;
6961b8e80941Smrg};
6962b8e80941Smrg
6963b8e80941Smrgstatic inline void
6964b8e80941SmrgGEN7_PS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
6965b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
6966b8e80941Smrg                              __attribute__((unused)) const struct GEN7_PS_INVOCATION_COUNT * restrict values)
6967b8e80941Smrg{
6968b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6969b8e80941Smrg
6970b8e80941Smrg   const uint64_t v0 =
6971b8e80941Smrg      __gen_uint(values->PSInvocationCountReport, 0, 63);
6972b8e80941Smrg   dw[0] = v0;
6973b8e80941Smrg   dw[1] = v0 >> 32;
6974b8e80941Smrg}
6975b8e80941Smrg
6976b8e80941Smrg#define GEN7_RCS_FAULT_REG_num            0x4094
6977b8e80941Smrg#define GEN7_RCS_FAULT_REG_length              1
6978b8e80941Smrgstruct GEN7_RCS_FAULT_REG {
6979b8e80941Smrg   bool                                 ValidBit;
6980b8e80941Smrg   uint32_t                             FaultType;
6981b8e80941Smrg#define PageFault                                0
6982b8e80941Smrg#define InvalidPDFault                           1
6983b8e80941Smrg#define UnloadedPDFault                          2
6984b8e80941Smrg#define InvalidandUnloadedPDfault                3
6985b8e80941Smrg   uint32_t                             SRCIDofFault;
6986b8e80941Smrg   uint32_t                             GTTSEL;
6987b8e80941Smrg#define PPGTT                                    0
6988b8e80941Smrg#define GGTT                                     1
6989b8e80941Smrg   __gen_address_type                   VirtualAddressofFault;
6990b8e80941Smrg};
6991b8e80941Smrg
6992b8e80941Smrgstatic inline void
6993b8e80941SmrgGEN7_RCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
6994b8e80941Smrg                        __attribute__((unused)) void * restrict dst,
6995b8e80941Smrg                        __attribute__((unused)) const struct GEN7_RCS_FAULT_REG * restrict values)
6996b8e80941Smrg{
6997b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
6998b8e80941Smrg
6999b8e80941Smrg   const uint32_t v0 =
7000b8e80941Smrg      __gen_uint(values->ValidBit, 0, 0) |
7001b8e80941Smrg      __gen_uint(values->FaultType, 1, 2) |
7002b8e80941Smrg      __gen_uint(values->SRCIDofFault, 3, 10) |
7003b8e80941Smrg      __gen_uint(values->GTTSEL, 11, 11);
7004b8e80941Smrg   dw[0] = __gen_combine_address(data, &dw[0], values->VirtualAddressofFault, v0);
7005b8e80941Smrg}
7006b8e80941Smrg
7007b8e80941Smrg#define GEN7_RCS_RING_BUFFER_CTL_num      0x203c
7008b8e80941Smrg#define GEN7_RCS_RING_BUFFER_CTL_length        1
7009b8e80941Smrgstruct GEN7_RCS_RING_BUFFER_CTL {
7010b8e80941Smrg   bool                                 RingBufferEnable;
7011b8e80941Smrg   uint32_t                             AutomaticReportHeadPointer;
7012b8e80941Smrg#define MI_AUTOREPORT_OFF                        0
7013b8e80941Smrg#define MI_AUTOREPORT_64KBMI_AUTOREPORT_4KB      1
7014b8e80941Smrg#define MI_AUTOREPORT_128KB                      3
7015b8e80941Smrg   bool                                 SemaphoreWait;
7016b8e80941Smrg   bool                                 RBWait;
7017b8e80941Smrg   uint32_t                             BufferLengthinpages1;
7018b8e80941Smrg};
7019b8e80941Smrg
7020b8e80941Smrgstatic inline void
7021b8e80941SmrgGEN7_RCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
7022b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
7023b8e80941Smrg                              __attribute__((unused)) const struct GEN7_RCS_RING_BUFFER_CTL * restrict values)
7024b8e80941Smrg{
7025b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7026b8e80941Smrg
7027b8e80941Smrg   dw[0] =
7028b8e80941Smrg      __gen_uint(values->RingBufferEnable, 0, 0) |
7029b8e80941Smrg      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
7030b8e80941Smrg      __gen_uint(values->SemaphoreWait, 10, 10) |
7031b8e80941Smrg      __gen_uint(values->RBWait, 11, 11) |
7032b8e80941Smrg      __gen_uint(values->BufferLengthinpages1, 12, 20);
7033b8e80941Smrg}
7034b8e80941Smrg
7035b8e80941Smrg#define GEN7_ROW_INSTDONE_num             0xe164
7036b8e80941Smrg#define GEN7_ROW_INSTDONE_length               1
7037b8e80941Smrgstruct GEN7_ROW_INSTDONE {
7038b8e80941Smrg   bool                                 BCDone;
7039b8e80941Smrg   bool                                 PSDDone;
7040b8e80941Smrg   bool                                 DCDone;
7041b8e80941Smrg   bool                                 DAPRDone;
7042b8e80941Smrg   bool                                 TDLDone;
7043b8e80941Smrg   bool                                 GWDone;
7044b8e80941Smrg   bool                                 ICDone;
7045b8e80941Smrg   bool                                 EU00DoneSS0;
7046b8e80941Smrg   bool                                 EU01DoneSS0;
7047b8e80941Smrg   bool                                 EU02DoneSS0;
7048b8e80941Smrg   bool                                 EU03DoneSS0;
7049b8e80941Smrg   bool                                 MA0DoneSS0;
7050b8e80941Smrg   bool                                 EU10DoneSS0;
7051b8e80941Smrg   bool                                 EU11DoneSS0;
7052b8e80941Smrg   bool                                 EU12DoneSS0;
7053b8e80941Smrg   bool                                 EU13DoneSS0;
7054b8e80941Smrg   bool                                 MA1Done;
7055b8e80941Smrg};
7056b8e80941Smrg
7057b8e80941Smrgstatic inline void
7058b8e80941SmrgGEN7_ROW_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
7059b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
7060b8e80941Smrg                       __attribute__((unused)) const struct GEN7_ROW_INSTDONE * restrict values)
7061b8e80941Smrg{
7062b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7063b8e80941Smrg
7064b8e80941Smrg   dw[0] =
7065b8e80941Smrg      __gen_uint(values->BCDone, 0, 0) |
7066b8e80941Smrg      __gen_uint(values->PSDDone, 1, 1) |
7067b8e80941Smrg      __gen_uint(values->DCDone, 2, 2) |
7068b8e80941Smrg      __gen_uint(values->DAPRDone, 3, 3) |
7069b8e80941Smrg      __gen_uint(values->TDLDone, 6, 6) |
7070b8e80941Smrg      __gen_uint(values->GWDone, 8, 8) |
7071b8e80941Smrg      __gen_uint(values->ICDone, 12, 12) |
7072b8e80941Smrg      __gen_uint(values->EU00DoneSS0, 16, 16) |
7073b8e80941Smrg      __gen_uint(values->EU01DoneSS0, 17, 17) |
7074b8e80941Smrg      __gen_uint(values->EU02DoneSS0, 18, 18) |
7075b8e80941Smrg      __gen_uint(values->EU03DoneSS0, 19, 19) |
7076b8e80941Smrg      __gen_uint(values->MA0DoneSS0, 20, 20) |
7077b8e80941Smrg      __gen_uint(values->EU10DoneSS0, 21, 21) |
7078b8e80941Smrg      __gen_uint(values->EU11DoneSS0, 22, 22) |
7079b8e80941Smrg      __gen_uint(values->EU12DoneSS0, 23, 23) |
7080b8e80941Smrg      __gen_uint(values->EU13DoneSS0, 24, 24) |
7081b8e80941Smrg      __gen_uint(values->MA1Done, 25, 25);
7082b8e80941Smrg}
7083b8e80941Smrg
7084b8e80941Smrg#define GEN7_SAMPLER_INSTDONE_num         0xe160
7085b8e80941Smrg#define GEN7_SAMPLER_INSTDONE_length           1
7086b8e80941Smrgstruct GEN7_SAMPLER_INSTDONE {
7087b8e80941Smrg   bool                                 VMEDone;
7088b8e80941Smrg   bool                                 PL0Done;
7089b8e80941Smrg   bool                                 SO0Done;
7090b8e80941Smrg   bool                                 DG0Done;
7091b8e80941Smrg   bool                                 FT0Done;
7092b8e80941Smrg   bool                                 DM0Done;
7093b8e80941Smrg   bool                                 SCDone;
7094b8e80941Smrg   bool                                 FL0Done;
7095b8e80941Smrg   bool                                 QCDone;
7096b8e80941Smrg   bool                                 SVSMDone;
7097b8e80941Smrg   bool                                 SI0Done;
7098b8e80941Smrg   bool                                 MT0Done;
7099b8e80941Smrg   bool                                 AVSDone;
7100b8e80941Smrg   bool                                 IEFDone;
7101b8e80941Smrg   bool                                 VDIDone;
7102b8e80941Smrg   bool                                 SVSMARB3;
7103b8e80941Smrg   bool                                 SVSMARB2;
7104b8e80941Smrg   bool                                 SVSMARB1;
7105b8e80941Smrg   bool                                 SVSMAdapter;
7106b8e80941Smrg};
7107b8e80941Smrg
7108b8e80941Smrgstatic inline void
7109b8e80941SmrgGEN7_SAMPLER_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
7110b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
7111b8e80941Smrg                           __attribute__((unused)) const struct GEN7_SAMPLER_INSTDONE * restrict values)
7112b8e80941Smrg{
7113b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7114b8e80941Smrg
7115b8e80941Smrg   dw[0] =
7116b8e80941Smrg      __gen_uint(values->VMEDone, 0, 0) |
7117b8e80941Smrg      __gen_uint(values->PL0Done, 1, 1) |
7118b8e80941Smrg      __gen_uint(values->SO0Done, 2, 2) |
7119b8e80941Smrg      __gen_uint(values->DG0Done, 3, 3) |
7120b8e80941Smrg      __gen_uint(values->FT0Done, 4, 4) |
7121b8e80941Smrg      __gen_uint(values->DM0Done, 5, 5) |
7122b8e80941Smrg      __gen_uint(values->SCDone, 6, 6) |
7123b8e80941Smrg      __gen_uint(values->FL0Done, 7, 7) |
7124b8e80941Smrg      __gen_uint(values->QCDone, 8, 8) |
7125b8e80941Smrg      __gen_uint(values->SVSMDone, 9, 9) |
7126b8e80941Smrg      __gen_uint(values->SI0Done, 10, 10) |
7127b8e80941Smrg      __gen_uint(values->MT0Done, 11, 11) |
7128b8e80941Smrg      __gen_uint(values->AVSDone, 12, 12) |
7129b8e80941Smrg      __gen_uint(values->IEFDone, 13, 13) |
7130b8e80941Smrg      __gen_uint(values->VDIDone, 14, 14) |
7131b8e80941Smrg      __gen_uint(values->SVSMARB3, 15, 15) |
7132b8e80941Smrg      __gen_uint(values->SVSMARB2, 16, 16) |
7133b8e80941Smrg      __gen_uint(values->SVSMARB1, 17, 17) |
7134b8e80941Smrg      __gen_uint(values->SVSMAdapter, 18, 18);
7135b8e80941Smrg}
7136b8e80941Smrg
7137b8e80941Smrg#define GEN7_SC_INSTDONE_num              0x7100
7138b8e80941Smrg#define GEN7_SC_INSTDONE_length                1
7139b8e80941Smrgstruct GEN7_SC_INSTDONE {
7140b8e80941Smrg   bool                                 SVLDone;
7141b8e80941Smrg   bool                                 WMFEDone;
7142b8e80941Smrg   bool                                 WMBEDone;
7143b8e80941Smrg   bool                                 HIZDone;
7144b8e80941Smrg   bool                                 STCDone;
7145b8e80941Smrg   bool                                 IZDone;
7146b8e80941Smrg   bool                                 SBEDone;
7147b8e80941Smrg   bool                                 RCZDone;
7148b8e80941Smrg   bool                                 RCCDone;
7149b8e80941Smrg   bool                                 RCPBEDone;
7150b8e80941Smrg   bool                                 RCPFEDone;
7151b8e80941Smrg   bool                                 DAPBDone;
7152b8e80941Smrg   bool                                 DAPRBEDone;
7153b8e80941Smrg   bool                                 IECPDone;
7154b8e80941Smrg   bool                                 SARBDone;
7155b8e80941Smrg   bool                                 VSCDone;
7156b8e80941Smrg};
7157b8e80941Smrg
7158b8e80941Smrgstatic inline void
7159b8e80941SmrgGEN7_SC_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
7160b8e80941Smrg                      __attribute__((unused)) void * restrict dst,
7161b8e80941Smrg                      __attribute__((unused)) const struct GEN7_SC_INSTDONE * restrict values)
7162b8e80941Smrg{
7163b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7164b8e80941Smrg
7165b8e80941Smrg   dw[0] =
7166b8e80941Smrg      __gen_uint(values->SVLDone, 0, 0) |
7167b8e80941Smrg      __gen_uint(values->WMFEDone, 1, 1) |
7168b8e80941Smrg      __gen_uint(values->WMBEDone, 2, 2) |
7169b8e80941Smrg      __gen_uint(values->HIZDone, 3, 3) |
7170b8e80941Smrg      __gen_uint(values->STCDone, 4, 4) |
7171b8e80941Smrg      __gen_uint(values->IZDone, 5, 5) |
7172b8e80941Smrg      __gen_uint(values->SBEDone, 6, 6) |
7173b8e80941Smrg      __gen_uint(values->RCZDone, 8, 8) |
7174b8e80941Smrg      __gen_uint(values->RCCDone, 9, 9) |
7175b8e80941Smrg      __gen_uint(values->RCPBEDone, 10, 10) |
7176b8e80941Smrg      __gen_uint(values->RCPFEDone, 11, 11) |
7177b8e80941Smrg      __gen_uint(values->DAPBDone, 12, 12) |
7178b8e80941Smrg      __gen_uint(values->DAPRBEDone, 13, 13) |
7179b8e80941Smrg      __gen_uint(values->IECPDone, 14, 14) |
7180b8e80941Smrg      __gen_uint(values->SARBDone, 15, 15) |
7181b8e80941Smrg      __gen_uint(values->VSCDone, 16, 16);
7182b8e80941Smrg}
7183b8e80941Smrg
7184b8e80941Smrg#define GEN7_SO_NUM_PRIMS_WRITTEN0_num    0x5200
7185b8e80941Smrg#define GEN7_SO_NUM_PRIMS_WRITTEN0_length      2
7186b8e80941Smrgstruct GEN7_SO_NUM_PRIMS_WRITTEN0 {
7187b8e80941Smrg   uint64_t                             NumPrimsWrittenCount;
7188b8e80941Smrg};
7189b8e80941Smrg
7190b8e80941Smrgstatic inline void
7191b8e80941SmrgGEN7_SO_NUM_PRIMS_WRITTEN0_pack(__attribute__((unused)) __gen_user_data *data,
7192b8e80941Smrg                                __attribute__((unused)) void * restrict dst,
7193b8e80941Smrg                                __attribute__((unused)) const struct GEN7_SO_NUM_PRIMS_WRITTEN0 * restrict values)
7194b8e80941Smrg{
7195b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7196b8e80941Smrg
7197b8e80941Smrg   const uint64_t v0 =
7198b8e80941Smrg      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
7199b8e80941Smrg   dw[0] = v0;
7200b8e80941Smrg   dw[1] = v0 >> 32;
7201b8e80941Smrg}
7202b8e80941Smrg
7203b8e80941Smrg#define GEN7_SO_NUM_PRIMS_WRITTEN1_num    0x5208
7204b8e80941Smrg#define GEN7_SO_NUM_PRIMS_WRITTEN1_length      2
7205b8e80941Smrgstruct GEN7_SO_NUM_PRIMS_WRITTEN1 {
7206b8e80941Smrg   uint64_t                             NumPrimsWrittenCount;
7207b8e80941Smrg};
7208b8e80941Smrg
7209b8e80941Smrgstatic inline void
7210b8e80941SmrgGEN7_SO_NUM_PRIMS_WRITTEN1_pack(__attribute__((unused)) __gen_user_data *data,
7211b8e80941Smrg                                __attribute__((unused)) void * restrict dst,
7212b8e80941Smrg                                __attribute__((unused)) const struct GEN7_SO_NUM_PRIMS_WRITTEN1 * restrict values)
7213b8e80941Smrg{
7214b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7215b8e80941Smrg
7216b8e80941Smrg   const uint64_t v0 =
7217b8e80941Smrg      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
7218b8e80941Smrg   dw[0] = v0;
7219b8e80941Smrg   dw[1] = v0 >> 32;
7220b8e80941Smrg}
7221b8e80941Smrg
7222b8e80941Smrg#define GEN7_SO_NUM_PRIMS_WRITTEN2_num    0x5210
7223b8e80941Smrg#define GEN7_SO_NUM_PRIMS_WRITTEN2_length      2
7224b8e80941Smrgstruct GEN7_SO_NUM_PRIMS_WRITTEN2 {
7225b8e80941Smrg   uint64_t                             NumPrimsWrittenCount;
7226b8e80941Smrg};
7227b8e80941Smrg
7228b8e80941Smrgstatic inline void
7229b8e80941SmrgGEN7_SO_NUM_PRIMS_WRITTEN2_pack(__attribute__((unused)) __gen_user_data *data,
7230b8e80941Smrg                                __attribute__((unused)) void * restrict dst,
7231b8e80941Smrg                                __attribute__((unused)) const struct GEN7_SO_NUM_PRIMS_WRITTEN2 * restrict values)
7232b8e80941Smrg{
7233b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7234b8e80941Smrg
7235b8e80941Smrg   const uint64_t v0 =
7236b8e80941Smrg      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
7237b8e80941Smrg   dw[0] = v0;
7238b8e80941Smrg   dw[1] = v0 >> 32;
7239b8e80941Smrg}
7240b8e80941Smrg
7241b8e80941Smrg#define GEN7_SO_NUM_PRIMS_WRITTEN3_num    0x5218
7242b8e80941Smrg#define GEN7_SO_NUM_PRIMS_WRITTEN3_length      2
7243b8e80941Smrgstruct GEN7_SO_NUM_PRIMS_WRITTEN3 {
7244b8e80941Smrg   uint64_t                             NumPrimsWrittenCount;
7245b8e80941Smrg};
7246b8e80941Smrg
7247b8e80941Smrgstatic inline void
7248b8e80941SmrgGEN7_SO_NUM_PRIMS_WRITTEN3_pack(__attribute__((unused)) __gen_user_data *data,
7249b8e80941Smrg                                __attribute__((unused)) void * restrict dst,
7250b8e80941Smrg                                __attribute__((unused)) const struct GEN7_SO_NUM_PRIMS_WRITTEN3 * restrict values)
7251b8e80941Smrg{
7252b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7253b8e80941Smrg
7254b8e80941Smrg   const uint64_t v0 =
7255b8e80941Smrg      __gen_uint(values->NumPrimsWrittenCount, 0, 63);
7256b8e80941Smrg   dw[0] = v0;
7257b8e80941Smrg   dw[1] = v0 >> 32;
7258b8e80941Smrg}
7259b8e80941Smrg
7260b8e80941Smrg#define GEN7_SO_PRIM_STORAGE_NEEDED0_num  0x5240
7261b8e80941Smrg#define GEN7_SO_PRIM_STORAGE_NEEDED0_length      2
7262b8e80941Smrgstruct GEN7_SO_PRIM_STORAGE_NEEDED0 {
7263b8e80941Smrg   uint64_t                             PrimStorageNeededCount;
7264b8e80941Smrg};
7265b8e80941Smrg
7266b8e80941Smrgstatic inline void
7267b8e80941SmrgGEN7_SO_PRIM_STORAGE_NEEDED0_pack(__attribute__((unused)) __gen_user_data *data,
7268b8e80941Smrg                                  __attribute__((unused)) void * restrict dst,
7269b8e80941Smrg                                  __attribute__((unused)) const struct GEN7_SO_PRIM_STORAGE_NEEDED0 * restrict values)
7270b8e80941Smrg{
7271b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7272b8e80941Smrg
7273b8e80941Smrg   const uint64_t v0 =
7274b8e80941Smrg      __gen_uint(values->PrimStorageNeededCount, 0, 63);
7275b8e80941Smrg   dw[0] = v0;
7276b8e80941Smrg   dw[1] = v0 >> 32;
7277b8e80941Smrg}
7278b8e80941Smrg
7279b8e80941Smrg#define GEN7_SO_PRIM_STORAGE_NEEDED1_num  0x5248
7280b8e80941Smrg#define GEN7_SO_PRIM_STORAGE_NEEDED1_length      2
7281b8e80941Smrgstruct GEN7_SO_PRIM_STORAGE_NEEDED1 {
7282b8e80941Smrg   uint64_t                             PrimStorageNeededCount;
7283b8e80941Smrg};
7284b8e80941Smrg
7285b8e80941Smrgstatic inline void
7286b8e80941SmrgGEN7_SO_PRIM_STORAGE_NEEDED1_pack(__attribute__((unused)) __gen_user_data *data,
7287b8e80941Smrg                                  __attribute__((unused)) void * restrict dst,
7288b8e80941Smrg                                  __attribute__((unused)) const struct GEN7_SO_PRIM_STORAGE_NEEDED1 * restrict values)
7289b8e80941Smrg{
7290b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7291b8e80941Smrg
7292b8e80941Smrg   const uint64_t v0 =
7293b8e80941Smrg      __gen_uint(values->PrimStorageNeededCount, 0, 63);
7294b8e80941Smrg   dw[0] = v0;
7295b8e80941Smrg   dw[1] = v0 >> 32;
7296b8e80941Smrg}
7297b8e80941Smrg
7298b8e80941Smrg#define GEN7_SO_PRIM_STORAGE_NEEDED2_num  0x5250
7299b8e80941Smrg#define GEN7_SO_PRIM_STORAGE_NEEDED2_length      2
7300b8e80941Smrgstruct GEN7_SO_PRIM_STORAGE_NEEDED2 {
7301b8e80941Smrg   uint64_t                             PrimStorageNeededCount;
7302b8e80941Smrg};
7303b8e80941Smrg
7304b8e80941Smrgstatic inline void
7305b8e80941SmrgGEN7_SO_PRIM_STORAGE_NEEDED2_pack(__attribute__((unused)) __gen_user_data *data,
7306b8e80941Smrg                                  __attribute__((unused)) void * restrict dst,
7307b8e80941Smrg                                  __attribute__((unused)) const struct GEN7_SO_PRIM_STORAGE_NEEDED2 * restrict values)
7308b8e80941Smrg{
7309b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7310b8e80941Smrg
7311b8e80941Smrg   const uint64_t v0 =
7312b8e80941Smrg      __gen_uint(values->PrimStorageNeededCount, 0, 63);
7313b8e80941Smrg   dw[0] = v0;
7314b8e80941Smrg   dw[1] = v0 >> 32;
7315b8e80941Smrg}
7316b8e80941Smrg
7317b8e80941Smrg#define GEN7_SO_PRIM_STORAGE_NEEDED3_num  0x5258
7318b8e80941Smrg#define GEN7_SO_PRIM_STORAGE_NEEDED3_length      2
7319b8e80941Smrgstruct GEN7_SO_PRIM_STORAGE_NEEDED3 {
7320b8e80941Smrg   uint64_t                             PrimStorageNeededCount;
7321b8e80941Smrg};
7322b8e80941Smrg
7323b8e80941Smrgstatic inline void
7324b8e80941SmrgGEN7_SO_PRIM_STORAGE_NEEDED3_pack(__attribute__((unused)) __gen_user_data *data,
7325b8e80941Smrg                                  __attribute__((unused)) void * restrict dst,
7326b8e80941Smrg                                  __attribute__((unused)) const struct GEN7_SO_PRIM_STORAGE_NEEDED3 * restrict values)
7327b8e80941Smrg{
7328b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7329b8e80941Smrg
7330b8e80941Smrg   const uint64_t v0 =
7331b8e80941Smrg      __gen_uint(values->PrimStorageNeededCount, 0, 63);
7332b8e80941Smrg   dw[0] = v0;
7333b8e80941Smrg   dw[1] = v0 >> 32;
7334b8e80941Smrg}
7335b8e80941Smrg
7336b8e80941Smrg#define GEN7_SO_WRITE_OFFSET0_num         0x5280
7337b8e80941Smrg#define GEN7_SO_WRITE_OFFSET0_length           1
7338b8e80941Smrgstruct GEN7_SO_WRITE_OFFSET0 {
7339b8e80941Smrg   uint64_t                             WriteOffset;
7340b8e80941Smrg};
7341b8e80941Smrg
7342b8e80941Smrgstatic inline void
7343b8e80941SmrgGEN7_SO_WRITE_OFFSET0_pack(__attribute__((unused)) __gen_user_data *data,
7344b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
7345b8e80941Smrg                           __attribute__((unused)) const struct GEN7_SO_WRITE_OFFSET0 * restrict values)
7346b8e80941Smrg{
7347b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7348b8e80941Smrg
7349b8e80941Smrg   dw[0] =
7350b8e80941Smrg      __gen_offset(values->WriteOffset, 2, 31);
7351b8e80941Smrg}
7352b8e80941Smrg
7353b8e80941Smrg#define GEN7_SO_WRITE_OFFSET1_num         0x5284
7354b8e80941Smrg#define GEN7_SO_WRITE_OFFSET1_length           1
7355b8e80941Smrgstruct GEN7_SO_WRITE_OFFSET1 {
7356b8e80941Smrg   uint64_t                             WriteOffset;
7357b8e80941Smrg};
7358b8e80941Smrg
7359b8e80941Smrgstatic inline void
7360b8e80941SmrgGEN7_SO_WRITE_OFFSET1_pack(__attribute__((unused)) __gen_user_data *data,
7361b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
7362b8e80941Smrg                           __attribute__((unused)) const struct GEN7_SO_WRITE_OFFSET1 * restrict values)
7363b8e80941Smrg{
7364b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7365b8e80941Smrg
7366b8e80941Smrg   dw[0] =
7367b8e80941Smrg      __gen_offset(values->WriteOffset, 2, 31);
7368b8e80941Smrg}
7369b8e80941Smrg
7370b8e80941Smrg#define GEN7_SO_WRITE_OFFSET2_num         0x5288
7371b8e80941Smrg#define GEN7_SO_WRITE_OFFSET2_length           1
7372b8e80941Smrgstruct GEN7_SO_WRITE_OFFSET2 {
7373b8e80941Smrg   uint64_t                             WriteOffset;
7374b8e80941Smrg};
7375b8e80941Smrg
7376b8e80941Smrgstatic inline void
7377b8e80941SmrgGEN7_SO_WRITE_OFFSET2_pack(__attribute__((unused)) __gen_user_data *data,
7378b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
7379b8e80941Smrg                           __attribute__((unused)) const struct GEN7_SO_WRITE_OFFSET2 * restrict values)
7380b8e80941Smrg{
7381b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7382b8e80941Smrg
7383b8e80941Smrg   dw[0] =
7384b8e80941Smrg      __gen_offset(values->WriteOffset, 2, 31);
7385b8e80941Smrg}
7386b8e80941Smrg
7387b8e80941Smrg#define GEN7_SO_WRITE_OFFSET3_num         0x528c
7388b8e80941Smrg#define GEN7_SO_WRITE_OFFSET3_length           1
7389b8e80941Smrgstruct GEN7_SO_WRITE_OFFSET3 {
7390b8e80941Smrg   uint64_t                             WriteOffset;
7391b8e80941Smrg};
7392b8e80941Smrg
7393b8e80941Smrgstatic inline void
7394b8e80941SmrgGEN7_SO_WRITE_OFFSET3_pack(__attribute__((unused)) __gen_user_data *data,
7395b8e80941Smrg                           __attribute__((unused)) void * restrict dst,
7396b8e80941Smrg                           __attribute__((unused)) const struct GEN7_SO_WRITE_OFFSET3 * restrict values)
7397b8e80941Smrg{
7398b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7399b8e80941Smrg
7400b8e80941Smrg   dw[0] =
7401b8e80941Smrg      __gen_offset(values->WriteOffset, 2, 31);
7402b8e80941Smrg}
7403b8e80941Smrg
7404b8e80941Smrg#define GEN7_VCS_FAULT_REG_num            0x4194
7405b8e80941Smrg#define GEN7_VCS_FAULT_REG_length              1
7406b8e80941Smrgstruct GEN7_VCS_FAULT_REG {
7407b8e80941Smrg   bool                                 ValidBit;
7408b8e80941Smrg   uint32_t                             FaultType;
7409b8e80941Smrg#define PageFault                                0
7410b8e80941Smrg#define InvalidPDFault                           1
7411b8e80941Smrg#define UnloadedPDFault                          2
7412b8e80941Smrg#define InvalidandUnloadedPDfault                3
7413b8e80941Smrg   uint32_t                             SRCIDofFault;
7414b8e80941Smrg   uint32_t                             GTTSEL;
7415b8e80941Smrg#define PPGTT                                    0
7416b8e80941Smrg#define GGTT                                     1
7417b8e80941Smrg   __gen_address_type                   VirtualAddressofFault;
7418b8e80941Smrg};
7419b8e80941Smrg
7420b8e80941Smrgstatic inline void
7421b8e80941SmrgGEN7_VCS_FAULT_REG_pack(__attribute__((unused)) __gen_user_data *data,
7422b8e80941Smrg                        __attribute__((unused)) void * restrict dst,
7423b8e80941Smrg                        __attribute__((unused)) const struct GEN7_VCS_FAULT_REG * restrict values)
7424b8e80941Smrg{
7425b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7426b8e80941Smrg
7427b8e80941Smrg   const uint32_t v0 =
7428b8e80941Smrg      __gen_uint(values->ValidBit, 0, 0) |
7429b8e80941Smrg      __gen_uint(values->FaultType, 1, 2) |
7430b8e80941Smrg      __gen_uint(values->SRCIDofFault, 3, 10) |
7431b8e80941Smrg      __gen_uint(values->GTTSEL, 11, 11);
7432b8e80941Smrg   dw[0] = __gen_combine_address(data, &dw[0], values->VirtualAddressofFault, v0);
7433b8e80941Smrg}
7434b8e80941Smrg
7435b8e80941Smrg#define GEN7_VCS_INSTDONE_num             0x1206c
7436b8e80941Smrg#define GEN7_VCS_INSTDONE_length               1
7437b8e80941Smrgstruct GEN7_VCS_INSTDONE {
7438b8e80941Smrg   bool                                 RingEnable;
7439b8e80941Smrg   bool                                 USBDone;
7440b8e80941Smrg   bool                                 QRCDone;
7441b8e80941Smrg   bool                                 SECDone;
7442b8e80941Smrg   bool                                 MPCDone;
7443b8e80941Smrg   bool                                 VFTDone;
7444b8e80941Smrg   bool                                 BSPDone;
7445b8e80941Smrg   bool                                 VLFDone;
7446b8e80941Smrg   bool                                 VOPDone;
7447b8e80941Smrg   bool                                 VMCDone;
7448b8e80941Smrg   bool                                 VIPDone;
7449b8e80941Smrg   bool                                 VITDone;
7450b8e80941Smrg   bool                                 VDSDone;
7451b8e80941Smrg   bool                                 VMXDone;
7452b8e80941Smrg   bool                                 VCPDone;
7453b8e80941Smrg   bool                                 VCDDone;
7454b8e80941Smrg   bool                                 VADDone;
7455b8e80941Smrg   bool                                 VMDDone;
7456b8e80941Smrg   bool                                 VISDone;
7457b8e80941Smrg   bool                                 VACDone;
7458b8e80941Smrg   bool                                 VAMDone;
7459b8e80941Smrg   bool                                 JPGDone;
7460b8e80941Smrg   bool                                 VBPDone;
7461b8e80941Smrg   bool                                 VHRDone;
7462b8e80941Smrg   bool                                 VCIDone;
7463b8e80941Smrg   bool                                 VCRDone;
7464b8e80941Smrg   bool                                 VINDone;
7465b8e80941Smrg   bool                                 VPRDone;
7466b8e80941Smrg   bool                                 VTQDone;
7467b8e80941Smrg   bool                                 VCSDone;
7468b8e80941Smrg   bool                                 GACDone;
7469b8e80941Smrg};
7470b8e80941Smrg
7471b8e80941Smrgstatic inline void
7472b8e80941SmrgGEN7_VCS_INSTDONE_pack(__attribute__((unused)) __gen_user_data *data,
7473b8e80941Smrg                       __attribute__((unused)) void * restrict dst,
7474b8e80941Smrg                       __attribute__((unused)) const struct GEN7_VCS_INSTDONE * restrict values)
7475b8e80941Smrg{
7476b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7477b8e80941Smrg
7478b8e80941Smrg   dw[0] =
7479b8e80941Smrg      __gen_uint(values->RingEnable, 0, 0) |
7480b8e80941Smrg      __gen_uint(values->USBDone, 1, 1) |
7481b8e80941Smrg      __gen_uint(values->QRCDone, 2, 2) |
7482b8e80941Smrg      __gen_uint(values->SECDone, 3, 3) |
7483b8e80941Smrg      __gen_uint(values->MPCDone, 4, 4) |
7484b8e80941Smrg      __gen_uint(values->VFTDone, 5, 5) |
7485b8e80941Smrg      __gen_uint(values->BSPDone, 6, 6) |
7486b8e80941Smrg      __gen_uint(values->VLFDone, 7, 7) |
7487b8e80941Smrg      __gen_uint(values->VOPDone, 8, 8) |
7488b8e80941Smrg      __gen_uint(values->VMCDone, 9, 9) |
7489b8e80941Smrg      __gen_uint(values->VIPDone, 10, 10) |
7490b8e80941Smrg      __gen_uint(values->VITDone, 11, 11) |
7491b8e80941Smrg      __gen_uint(values->VDSDone, 12, 12) |
7492b8e80941Smrg      __gen_uint(values->VMXDone, 13, 13) |
7493b8e80941Smrg      __gen_uint(values->VCPDone, 14, 14) |
7494b8e80941Smrg      __gen_uint(values->VCDDone, 15, 15) |
7495b8e80941Smrg      __gen_uint(values->VADDone, 16, 16) |
7496b8e80941Smrg      __gen_uint(values->VMDDone, 17, 17) |
7497b8e80941Smrg      __gen_uint(values->VISDone, 18, 18) |
7498b8e80941Smrg      __gen_uint(values->VACDone, 19, 19) |
7499b8e80941Smrg      __gen_uint(values->VAMDone, 20, 20) |
7500b8e80941Smrg      __gen_uint(values->JPGDone, 21, 21) |
7501b8e80941Smrg      __gen_uint(values->VBPDone, 22, 22) |
7502b8e80941Smrg      __gen_uint(values->VHRDone, 23, 23) |
7503b8e80941Smrg      __gen_uint(values->VCIDone, 24, 24) |
7504b8e80941Smrg      __gen_uint(values->VCRDone, 25, 25) |
7505b8e80941Smrg      __gen_uint(values->VINDone, 26, 26) |
7506b8e80941Smrg      __gen_uint(values->VPRDone, 27, 27) |
7507b8e80941Smrg      __gen_uint(values->VTQDone, 28, 28) |
7508b8e80941Smrg      __gen_uint(values->VCSDone, 30, 30) |
7509b8e80941Smrg      __gen_uint(values->GACDone, 31, 31);
7510b8e80941Smrg}
7511b8e80941Smrg
7512b8e80941Smrg#define GEN7_VCS_RING_BUFFER_CTL_num      0x1203c
7513b8e80941Smrg#define GEN7_VCS_RING_BUFFER_CTL_length        1
7514b8e80941Smrgstruct GEN7_VCS_RING_BUFFER_CTL {
7515b8e80941Smrg   bool                                 RingBufferEnable;
7516b8e80941Smrg   uint32_t                             AutomaticReportHeadPointer;
7517b8e80941Smrg#define MI_AUTOREPORT_OFF                        0
7518b8e80941Smrg#define MI_AUTOREPORT_64KB                       1
7519b8e80941Smrg#define MI_AUTOREPORT_4KB                        2
7520b8e80941Smrg#define MI_AUTOREPORT_128KB                      3
7521b8e80941Smrg   bool                                 DisableRegisterAccesses;
7522b8e80941Smrg   bool                                 SemaphoreWait;
7523b8e80941Smrg   bool                                 RBWait;
7524b8e80941Smrg   uint32_t                             BufferLengthinpages1;
7525b8e80941Smrg};
7526b8e80941Smrg
7527b8e80941Smrgstatic inline void
7528b8e80941SmrgGEN7_VCS_RING_BUFFER_CTL_pack(__attribute__((unused)) __gen_user_data *data,
7529b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
7530b8e80941Smrg                              __attribute__((unused)) const struct GEN7_VCS_RING_BUFFER_CTL * restrict values)
7531b8e80941Smrg{
7532b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7533b8e80941Smrg
7534b8e80941Smrg   dw[0] =
7535b8e80941Smrg      __gen_uint(values->RingBufferEnable, 0, 0) |
7536b8e80941Smrg      __gen_uint(values->AutomaticReportHeadPointer, 1, 2) |
7537b8e80941Smrg      __gen_uint(values->DisableRegisterAccesses, 8, 8) |
7538b8e80941Smrg      __gen_uint(values->SemaphoreWait, 10, 10) |
7539b8e80941Smrg      __gen_uint(values->RBWait, 11, 11) |
7540b8e80941Smrg      __gen_uint(values->BufferLengthinpages1, 12, 20);
7541b8e80941Smrg}
7542b8e80941Smrg
7543b8e80941Smrg#define GEN7_VS_INVOCATION_COUNT_num      0x2320
7544b8e80941Smrg#define GEN7_VS_INVOCATION_COUNT_length        2
7545b8e80941Smrgstruct GEN7_VS_INVOCATION_COUNT {
7546b8e80941Smrg   uint64_t                             VSInvocationCountReport;
7547b8e80941Smrg};
7548b8e80941Smrg
7549b8e80941Smrgstatic inline void
7550b8e80941SmrgGEN7_VS_INVOCATION_COUNT_pack(__attribute__((unused)) __gen_user_data *data,
7551b8e80941Smrg                              __attribute__((unused)) void * restrict dst,
7552b8e80941Smrg                              __attribute__((unused)) const struct GEN7_VS_INVOCATION_COUNT * restrict values)
7553b8e80941Smrg{
7554b8e80941Smrg   uint32_t * restrict dw = (uint32_t * restrict) dst;
7555b8e80941Smrg
7556b8e80941Smrg   const uint64_t v0 =
7557b8e80941Smrg      __gen_uint(values->VSInvocationCountReport, 0, 63);
7558b8e80941Smrg   dw[0] = v0;
7559b8e80941Smrg   dw[1] = v0 >> 32;
7560b8e80941Smrg}
7561b8e80941Smrg
7562b8e80941Smrg#endif /* GEN7_PACK_H */
7563