• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Generated code, see v3d_packet_v21.xml, v3d_packet_v33.xml and gen_pack_header.py */
2 
3 
4 /* Packets, enums and structures for V3D 2.1.
5  *
6  * This file has been generated, do not hand edit.
7  */
8 
9 #ifndef V3D21_PACK_H
10 #define V3D21_PACK_H
11 
12 #include "cle/v3d_packet_helpers.h"
13 
14 
15 enum V3D21_Compare_Function {
16         V3D_COMPARE_FUNC_NEVER               =      0,
17         V3D_COMPARE_FUNC_LESS                =      1,
18         V3D_COMPARE_FUNC_EQUAL               =      2,
19         V3D_COMPARE_FUNC_LEQUAL              =      3,
20         V3D_COMPARE_FUNC_GREATER             =      4,
21         V3D_COMPARE_FUNC_NOTEQUAL            =      5,
22         V3D_COMPARE_FUNC_GEQUAL              =      6,
23         V3D_COMPARE_FUNC_ALWAYS              =      7,
24 };
25 
26 enum V3D21_Primitive {
27         V3D_PRIM_POINTS                      =      0,
28         V3D_PRIM_LINES                       =      1,
29         V3D_PRIM_LINE_LOOP                   =      2,
30         V3D_PRIM_LINE_STRIP                  =      3,
31         V3D_PRIM_TRIANGLES                   =      4,
32         V3D_PRIM_TRIANGLE_STRIP              =      5,
33         V3D_PRIM_TRIANGLE_FAN                =      6,
34 };
35 
36 #define V3D21_HALT_opcode                      0
37 #define V3D21_HALT_header                       \
38    .opcode                              =      0
39 
40 struct V3D21_HALT {
41    uint32_t                             opcode;
42 };
43 
44 static inline void
V3D21_HALT_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_HALT * restrict values)45 V3D21_HALT_pack(__gen_user_data *data, uint8_t * restrict cl,
46                 const struct V3D21_HALT * restrict values)
47 {
48    cl[ 0] = __gen_uint(values->opcode, 0, 7);
49 
50 }
51 
52 #define V3D21_HALT_length                      1
53 #ifdef __gen_unpack_address
54 static inline void
V3D21_HALT_unpack(const uint8_t * restrict cl,struct V3D21_HALT * restrict values)55 V3D21_HALT_unpack(const uint8_t * restrict cl,
56                   struct V3D21_HALT * restrict values)
57 {
58    values->opcode = __gen_unpack_uint(cl, 0, 7);
59 }
60 #endif
61 
62 
63 #define V3D21_NOP_opcode                       1
64 #define V3D21_NOP_header                        \
65    .opcode                              =      1
66 
67 struct V3D21_NOP {
68    uint32_t                             opcode;
69 };
70 
71 static inline void
V3D21_NOP_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_NOP * restrict values)72 V3D21_NOP_pack(__gen_user_data *data, uint8_t * restrict cl,
73                const struct V3D21_NOP * restrict values)
74 {
75    cl[ 0] = __gen_uint(values->opcode, 0, 7);
76 
77 }
78 
79 #define V3D21_NOP_length                       1
80 #ifdef __gen_unpack_address
81 static inline void
V3D21_NOP_unpack(const uint8_t * restrict cl,struct V3D21_NOP * restrict values)82 V3D21_NOP_unpack(const uint8_t * restrict cl,
83                  struct V3D21_NOP * restrict values)
84 {
85    values->opcode = __gen_unpack_uint(cl, 0, 7);
86 }
87 #endif
88 
89 
90 #define V3D21_FLUSH_opcode                     4
91 #define V3D21_FLUSH_header                      \
92    .opcode                              =      4
93 
94 struct V3D21_FLUSH {
95    uint32_t                             opcode;
96 };
97 
98 static inline void
V3D21_FLUSH_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_FLUSH * restrict values)99 V3D21_FLUSH_pack(__gen_user_data *data, uint8_t * restrict cl,
100                  const struct V3D21_FLUSH * restrict values)
101 {
102    cl[ 0] = __gen_uint(values->opcode, 0, 7);
103 
104 }
105 
106 #define V3D21_FLUSH_length                     1
107 #ifdef __gen_unpack_address
108 static inline void
V3D21_FLUSH_unpack(const uint8_t * restrict cl,struct V3D21_FLUSH * restrict values)109 V3D21_FLUSH_unpack(const uint8_t * restrict cl,
110                    struct V3D21_FLUSH * restrict values)
111 {
112    values->opcode = __gen_unpack_uint(cl, 0, 7);
113 }
114 #endif
115 
116 
117 #define V3D21_FLUSH_ALL_STATE_opcode           5
118 #define V3D21_FLUSH_ALL_STATE_header            \
119    .opcode                              =      5
120 
121 struct V3D21_FLUSH_ALL_STATE {
122    uint32_t                             opcode;
123 };
124 
125 static inline void
V3D21_FLUSH_ALL_STATE_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_FLUSH_ALL_STATE * restrict values)126 V3D21_FLUSH_ALL_STATE_pack(__gen_user_data *data, uint8_t * restrict cl,
127                            const struct V3D21_FLUSH_ALL_STATE * restrict values)
128 {
129    cl[ 0] = __gen_uint(values->opcode, 0, 7);
130 
131 }
132 
133 #define V3D21_FLUSH_ALL_STATE_length           1
134 #ifdef __gen_unpack_address
135 static inline void
V3D21_FLUSH_ALL_STATE_unpack(const uint8_t * restrict cl,struct V3D21_FLUSH_ALL_STATE * restrict values)136 V3D21_FLUSH_ALL_STATE_unpack(const uint8_t * restrict cl,
137                              struct V3D21_FLUSH_ALL_STATE * restrict values)
138 {
139    values->opcode = __gen_unpack_uint(cl, 0, 7);
140 }
141 #endif
142 
143 
144 #define V3D21_START_TILE_BINNING_opcode        6
145 #define V3D21_START_TILE_BINNING_header         \
146    .opcode                              =      6
147 
148 struct V3D21_START_TILE_BINNING {
149    uint32_t                             opcode;
150 };
151 
152 static inline void
V3D21_START_TILE_BINNING_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_START_TILE_BINNING * restrict values)153 V3D21_START_TILE_BINNING_pack(__gen_user_data *data, uint8_t * restrict cl,
154                               const struct V3D21_START_TILE_BINNING * restrict values)
155 {
156    cl[ 0] = __gen_uint(values->opcode, 0, 7);
157 
158 }
159 
160 #define V3D21_START_TILE_BINNING_length        1
161 #ifdef __gen_unpack_address
162 static inline void
V3D21_START_TILE_BINNING_unpack(const uint8_t * restrict cl,struct V3D21_START_TILE_BINNING * restrict values)163 V3D21_START_TILE_BINNING_unpack(const uint8_t * restrict cl,
164                                 struct V3D21_START_TILE_BINNING * restrict values)
165 {
166    values->opcode = __gen_unpack_uint(cl, 0, 7);
167 }
168 #endif
169 
170 
171 #define V3D21_INCREMENT_SEMAPHORE_opcode       7
172 #define V3D21_INCREMENT_SEMAPHORE_header        \
173    .opcode                              =      7
174 
175 struct V3D21_INCREMENT_SEMAPHORE {
176    uint32_t                             opcode;
177 };
178 
179 static inline void
V3D21_INCREMENT_SEMAPHORE_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_INCREMENT_SEMAPHORE * restrict values)180 V3D21_INCREMENT_SEMAPHORE_pack(__gen_user_data *data, uint8_t * restrict cl,
181                                const struct V3D21_INCREMENT_SEMAPHORE * restrict values)
182 {
183    cl[ 0] = __gen_uint(values->opcode, 0, 7);
184 
185 }
186 
187 #define V3D21_INCREMENT_SEMAPHORE_length       1
188 #ifdef __gen_unpack_address
189 static inline void
V3D21_INCREMENT_SEMAPHORE_unpack(const uint8_t * restrict cl,struct V3D21_INCREMENT_SEMAPHORE * restrict values)190 V3D21_INCREMENT_SEMAPHORE_unpack(const uint8_t * restrict cl,
191                                  struct V3D21_INCREMENT_SEMAPHORE * restrict values)
192 {
193    values->opcode = __gen_unpack_uint(cl, 0, 7);
194 }
195 #endif
196 
197 
198 #define V3D21_WAIT_ON_SEMAPHORE_opcode         8
199 #define V3D21_WAIT_ON_SEMAPHORE_header          \
200    .opcode                              =      8
201 
202 struct V3D21_WAIT_ON_SEMAPHORE {
203    uint32_t                             opcode;
204 };
205 
206 static inline void
V3D21_WAIT_ON_SEMAPHORE_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_WAIT_ON_SEMAPHORE * restrict values)207 V3D21_WAIT_ON_SEMAPHORE_pack(__gen_user_data *data, uint8_t * restrict cl,
208                              const struct V3D21_WAIT_ON_SEMAPHORE * restrict values)
209 {
210    cl[ 0] = __gen_uint(values->opcode, 0, 7);
211 
212 }
213 
214 #define V3D21_WAIT_ON_SEMAPHORE_length         1
215 #ifdef __gen_unpack_address
216 static inline void
V3D21_WAIT_ON_SEMAPHORE_unpack(const uint8_t * restrict cl,struct V3D21_WAIT_ON_SEMAPHORE * restrict values)217 V3D21_WAIT_ON_SEMAPHORE_unpack(const uint8_t * restrict cl,
218                                struct V3D21_WAIT_ON_SEMAPHORE * restrict values)
219 {
220    values->opcode = __gen_unpack_uint(cl, 0, 7);
221 }
222 #endif
223 
224 
225 #define V3D21_BRANCH_opcode                   16
226 #define V3D21_BRANCH_header                     \
227    .opcode                              =     16
228 
229 struct V3D21_BRANCH {
230    uint32_t                             opcode;
231    __gen_address_type                   address;
232 };
233 
234 static inline void
V3D21_BRANCH_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_BRANCH * restrict values)235 V3D21_BRANCH_pack(__gen_user_data *data, uint8_t * restrict cl,
236                   const struct V3D21_BRANCH * restrict values)
237 {
238    cl[ 0] = __gen_uint(values->opcode, 0, 7);
239 
240    __gen_emit_reloc(data, &values->address);
241    cl[ 1] = __gen_address_offset(&values->address);
242 
243    cl[ 2] = __gen_address_offset(&values->address) >> 8;
244 
245    cl[ 3] = __gen_address_offset(&values->address) >> 16;
246 
247    cl[ 4] = __gen_address_offset(&values->address) >> 24;
248 
249 }
250 
251 #define V3D21_BRANCH_length                    5
252 #ifdef __gen_unpack_address
253 static inline void
V3D21_BRANCH_unpack(const uint8_t * restrict cl,struct V3D21_BRANCH * restrict values)254 V3D21_BRANCH_unpack(const uint8_t * restrict cl,
255                     struct V3D21_BRANCH * restrict values)
256 {
257    values->opcode = __gen_unpack_uint(cl, 0, 7);
258    values->address = __gen_unpack_address(cl, 8, 39);
259 }
260 #endif
261 
262 
263 #define V3D21_BRANCH_TO_SUB_LIST_opcode       17
264 #define V3D21_BRANCH_TO_SUB_LIST_header         \
265    .opcode                              =     17
266 
267 struct V3D21_BRANCH_TO_SUB_LIST {
268    uint32_t                             opcode;
269    __gen_address_type                   address;
270 };
271 
272 static inline void
V3D21_BRANCH_TO_SUB_LIST_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_BRANCH_TO_SUB_LIST * restrict values)273 V3D21_BRANCH_TO_SUB_LIST_pack(__gen_user_data *data, uint8_t * restrict cl,
274                               const struct V3D21_BRANCH_TO_SUB_LIST * restrict values)
275 {
276    cl[ 0] = __gen_uint(values->opcode, 0, 7);
277 
278    __gen_emit_reloc(data, &values->address);
279    cl[ 1] = __gen_address_offset(&values->address);
280 
281    cl[ 2] = __gen_address_offset(&values->address) >> 8;
282 
283    cl[ 3] = __gen_address_offset(&values->address) >> 16;
284 
285    cl[ 4] = __gen_address_offset(&values->address) >> 24;
286 
287 }
288 
289 #define V3D21_BRANCH_TO_SUB_LIST_length        5
290 #ifdef __gen_unpack_address
291 static inline void
V3D21_BRANCH_TO_SUB_LIST_unpack(const uint8_t * restrict cl,struct V3D21_BRANCH_TO_SUB_LIST * restrict values)292 V3D21_BRANCH_TO_SUB_LIST_unpack(const uint8_t * restrict cl,
293                                 struct V3D21_BRANCH_TO_SUB_LIST * restrict values)
294 {
295    values->opcode = __gen_unpack_uint(cl, 0, 7);
296    values->address = __gen_unpack_address(cl, 8, 39);
297 }
298 #endif
299 
300 
301 #define V3D21_RETURN_FROM_SUB_LIST_opcode     18
302 #define V3D21_RETURN_FROM_SUB_LIST_header       \
303    .opcode                              =     18
304 
305 struct V3D21_RETURN_FROM_SUB_LIST {
306    uint32_t                             opcode;
307 };
308 
309 static inline void
V3D21_RETURN_FROM_SUB_LIST_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_RETURN_FROM_SUB_LIST * restrict values)310 V3D21_RETURN_FROM_SUB_LIST_pack(__gen_user_data *data, uint8_t * restrict cl,
311                                 const struct V3D21_RETURN_FROM_SUB_LIST * restrict values)
312 {
313    cl[ 0] = __gen_uint(values->opcode, 0, 7);
314 
315 }
316 
317 #define V3D21_RETURN_FROM_SUB_LIST_length      1
318 #ifdef __gen_unpack_address
319 static inline void
V3D21_RETURN_FROM_SUB_LIST_unpack(const uint8_t * restrict cl,struct V3D21_RETURN_FROM_SUB_LIST * restrict values)320 V3D21_RETURN_FROM_SUB_LIST_unpack(const uint8_t * restrict cl,
321                                   struct V3D21_RETURN_FROM_SUB_LIST * restrict values)
322 {
323    values->opcode = __gen_unpack_uint(cl, 0, 7);
324 }
325 #endif
326 
327 
328 #define V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_opcode     24
329 #define V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_header\
330    .opcode                              =     24
331 
332 struct V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER {
333    uint32_t                             opcode;
334 };
335 
336 static inline void
V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER * restrict values)337 V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_pack(__gen_user_data *data, uint8_t * restrict cl,
338                                                          const struct V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER * restrict values)
339 {
340    cl[ 0] = __gen_uint(values->opcode, 0, 7);
341 
342 }
343 
344 #define V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_length      1
345 #ifdef __gen_unpack_address
346 static inline void
V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_unpack(const uint8_t * restrict cl,struct V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER * restrict values)347 V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_unpack(const uint8_t * restrict cl,
348                                                            struct V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER * restrict values)
349 {
350    values->opcode = __gen_unpack_uint(cl, 0, 7);
351 }
352 #endif
353 
354 
355 #define V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_AND_EOF_opcode     25
356 #define V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_AND_EOF_header\
357    .opcode                              =     25
358 
359 struct V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_AND_EOF {
360    uint32_t                             opcode;
361 };
362 
363 static inline void
V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_AND_EOF_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_AND_EOF * restrict values)364 V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_AND_EOF_pack(__gen_user_data *data, uint8_t * restrict cl,
365                                                                  const struct V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_AND_EOF * restrict values)
366 {
367    cl[ 0] = __gen_uint(values->opcode, 0, 7);
368 
369 }
370 
371 #define V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_AND_EOF_length      1
372 #ifdef __gen_unpack_address
373 static inline void
V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_AND_EOF_unpack(const uint8_t * restrict cl,struct V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_AND_EOF * restrict values)374 V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_AND_EOF_unpack(const uint8_t * restrict cl,
375                                                                    struct V3D21_STORE_MULTI_SAMPLE_RESOLVED_TILE_COLOR_BUFFER_AND_EOF * restrict values)
376 {
377    values->opcode = __gen_unpack_uint(cl, 0, 7);
378 }
379 #endif
380 
381 
382 #define V3D21_STORE_FULL_RESOLUTION_TILE_BUFFER_opcode     26
383 #define V3D21_STORE_FULL_RESOLUTION_TILE_BUFFER_header\
384    .opcode                              =     26
385 
386 struct V3D21_STORE_FULL_RESOLUTION_TILE_BUFFER {
387    uint32_t                             opcode;
388    __gen_address_type                   address;
389    bool                                 last_tile;
390    bool                                 disable_clear_on_write;
391    bool                                 disable_z_stencil_buffer_write;
392    bool                                 disable_color_buffer_write;
393 };
394 
395 static inline void
V3D21_STORE_FULL_RESOLUTION_TILE_BUFFER_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_STORE_FULL_RESOLUTION_TILE_BUFFER * restrict values)396 V3D21_STORE_FULL_RESOLUTION_TILE_BUFFER_pack(__gen_user_data *data, uint8_t * restrict cl,
397                                              const struct V3D21_STORE_FULL_RESOLUTION_TILE_BUFFER * restrict values)
398 {
399    cl[ 0] = __gen_uint(values->opcode, 0, 7);
400 
401    __gen_emit_reloc(data, &values->address);
402    cl[ 1] = __gen_address_offset(&values->address) |
403             __gen_uint(values->last_tile, 3, 3) |
404             __gen_uint(values->disable_clear_on_write, 2, 2) |
405             __gen_uint(values->disable_z_stencil_buffer_write, 1, 1) |
406             __gen_uint(values->disable_color_buffer_write, 0, 0);
407 
408    cl[ 2] = __gen_address_offset(&values->address) >> 8;
409 
410    cl[ 3] = __gen_address_offset(&values->address) >> 16;
411 
412    cl[ 4] = __gen_address_offset(&values->address) >> 24;
413 
414 }
415 
416 #define V3D21_STORE_FULL_RESOLUTION_TILE_BUFFER_length      5
417 #ifdef __gen_unpack_address
418 static inline void
V3D21_STORE_FULL_RESOLUTION_TILE_BUFFER_unpack(const uint8_t * restrict cl,struct V3D21_STORE_FULL_RESOLUTION_TILE_BUFFER * restrict values)419 V3D21_STORE_FULL_RESOLUTION_TILE_BUFFER_unpack(const uint8_t * restrict cl,
420                                                struct V3D21_STORE_FULL_RESOLUTION_TILE_BUFFER * restrict values)
421 {
422    values->opcode = __gen_unpack_uint(cl, 0, 7);
423    values->address = __gen_unpack_address(cl, 12, 39);
424    values->last_tile = __gen_unpack_uint(cl, 11, 11);
425    values->disable_clear_on_write = __gen_unpack_uint(cl, 10, 10);
426    values->disable_z_stencil_buffer_write = __gen_unpack_uint(cl, 9, 9);
427    values->disable_color_buffer_write = __gen_unpack_uint(cl, 8, 8);
428 }
429 #endif
430 
431 
432 #define V3D21_RE_LOAD_FULL_RESOLUTION_TILE_BUFFER_opcode     27
433 #define V3D21_RE_LOAD_FULL_RESOLUTION_TILE_BUFFER_header\
434    .opcode                              =     27
435 
436 struct V3D21_RE_LOAD_FULL_RESOLUTION_TILE_BUFFER {
437    uint32_t                             opcode;
438    __gen_address_type                   address;
439    bool                                 disable_z_stencil_buffer_read;
440    bool                                 disable_color_buffer_read;
441 };
442 
443 static inline void
V3D21_RE_LOAD_FULL_RESOLUTION_TILE_BUFFER_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_RE_LOAD_FULL_RESOLUTION_TILE_BUFFER * restrict values)444 V3D21_RE_LOAD_FULL_RESOLUTION_TILE_BUFFER_pack(__gen_user_data *data, uint8_t * restrict cl,
445                                                const struct V3D21_RE_LOAD_FULL_RESOLUTION_TILE_BUFFER * restrict values)
446 {
447    cl[ 0] = __gen_uint(values->opcode, 0, 7);
448 
449    __gen_emit_reloc(data, &values->address);
450    cl[ 1] = __gen_address_offset(&values->address) |
451             __gen_uint(values->disable_z_stencil_buffer_read, 1, 1) |
452             __gen_uint(values->disable_color_buffer_read, 0, 0);
453 
454    cl[ 2] = __gen_address_offset(&values->address) >> 8;
455 
456    cl[ 3] = __gen_address_offset(&values->address) >> 16;
457 
458    cl[ 4] = __gen_address_offset(&values->address) >> 24;
459 
460 }
461 
462 #define V3D21_RE_LOAD_FULL_RESOLUTION_TILE_BUFFER_length      5
463 #ifdef __gen_unpack_address
464 static inline void
V3D21_RE_LOAD_FULL_RESOLUTION_TILE_BUFFER_unpack(const uint8_t * restrict cl,struct V3D21_RE_LOAD_FULL_RESOLUTION_TILE_BUFFER * restrict values)465 V3D21_RE_LOAD_FULL_RESOLUTION_TILE_BUFFER_unpack(const uint8_t * restrict cl,
466                                                  struct V3D21_RE_LOAD_FULL_RESOLUTION_TILE_BUFFER * restrict values)
467 {
468    values->opcode = __gen_unpack_uint(cl, 0, 7);
469    values->address = __gen_unpack_address(cl, 12, 39);
470    values->disable_z_stencil_buffer_read = __gen_unpack_uint(cl, 9, 9);
471    values->disable_color_buffer_read = __gen_unpack_uint(cl, 8, 8);
472 }
473 #endif
474 
475 
476 #define V3D21_STORE_TILE_BUFFER_GENERAL_opcode     28
477 #define V3D21_STORE_TILE_BUFFER_GENERAL_header  \
478    .opcode                              =     28
479 
480 struct V3D21_STORE_TILE_BUFFER_GENERAL {
481    uint32_t                             opcode;
482    __gen_address_type                   memory_base_address_of_frame_tile_dump_buffer;
483    bool                                 last_tile_of_frame;
484    bool                                 disable_vg_mask_buffer_dump;
485    bool                                 disable_z_stencil_buffer_dump;
486    bool                                 disable_color_buffer_dump;
487    bool                                 disable_vg_mask_buffer_clear_on_store_dump;
488    bool                                 disable_z_stencil_buffer_clear_on_store_dump;
489    bool                                 disable_color_buffer_clear_on_store_dump;
490    uint32_t                             pixel_color_format;
491 #define RGBA8888                                 0
492 #define BGR565_DITHERED                          1
493 #define BGR565_NO_DITHER                         2
494    uint32_t                             mode;
495 #define SAMPLE_0                                 0
496 #define DECIMATE_X4                              1
497 #define DECIMATE_X16                             2
498    uint32_t                             format;
499 #define RASTER                                   0
500 #define T                                        1
501 #define LT                                       2
502    uint32_t                             buffer_to_store;
503 #define NONE                                     0
504 #define COLOR                                    1
505 #define Z_STENCIL                                2
506 #define Z                                        3
507 #define VG_MASK                                  4
508 };
509 
510 static inline void
V3D21_STORE_TILE_BUFFER_GENERAL_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_STORE_TILE_BUFFER_GENERAL * restrict values)511 V3D21_STORE_TILE_BUFFER_GENERAL_pack(__gen_user_data *data, uint8_t * restrict cl,
512                                      const struct V3D21_STORE_TILE_BUFFER_GENERAL * restrict values)
513 {
514    cl[ 0] = __gen_uint(values->opcode, 0, 7);
515 
516    cl[ 1] = __gen_uint(values->mode, 6, 7) |
517             __gen_uint(values->format, 4, 5) |
518             __gen_uint(values->buffer_to_store, 0, 2);
519 
520    cl[ 2] = __gen_uint(values->disable_vg_mask_buffer_clear_on_store_dump, 7, 7) |
521             __gen_uint(values->disable_z_stencil_buffer_clear_on_store_dump, 6, 6) |
522             __gen_uint(values->disable_color_buffer_clear_on_store_dump, 5, 5) |
523             __gen_uint(values->pixel_color_format, 0, 1);
524 
525    __gen_emit_reloc(data, &values->memory_base_address_of_frame_tile_dump_buffer);
526    cl[ 3] = __gen_address_offset(&values->memory_base_address_of_frame_tile_dump_buffer) |
527             __gen_uint(values->last_tile_of_frame, 3, 3) |
528             __gen_uint(values->disable_vg_mask_buffer_dump, 2, 2) |
529             __gen_uint(values->disable_z_stencil_buffer_dump, 1, 1) |
530             __gen_uint(values->disable_color_buffer_dump, 0, 0);
531 
532    cl[ 4] = __gen_address_offset(&values->memory_base_address_of_frame_tile_dump_buffer) >> 8;
533 
534    cl[ 5] = __gen_address_offset(&values->memory_base_address_of_frame_tile_dump_buffer) >> 16;
535 
536    cl[ 6] = __gen_address_offset(&values->memory_base_address_of_frame_tile_dump_buffer) >> 24;
537 
538 }
539 
540 #define V3D21_STORE_TILE_BUFFER_GENERAL_length      7
541 #ifdef __gen_unpack_address
542 static inline void
V3D21_STORE_TILE_BUFFER_GENERAL_unpack(const uint8_t * restrict cl,struct V3D21_STORE_TILE_BUFFER_GENERAL * restrict values)543 V3D21_STORE_TILE_BUFFER_GENERAL_unpack(const uint8_t * restrict cl,
544                                        struct V3D21_STORE_TILE_BUFFER_GENERAL * restrict values)
545 {
546    values->opcode = __gen_unpack_uint(cl, 0, 7);
547    values->memory_base_address_of_frame_tile_dump_buffer = __gen_unpack_address(cl, 28, 55);
548    values->last_tile_of_frame = __gen_unpack_uint(cl, 27, 27);
549    values->disable_vg_mask_buffer_dump = __gen_unpack_uint(cl, 26, 26);
550    values->disable_z_stencil_buffer_dump = __gen_unpack_uint(cl, 25, 25);
551    values->disable_color_buffer_dump = __gen_unpack_uint(cl, 24, 24);
552    values->disable_vg_mask_buffer_clear_on_store_dump = __gen_unpack_uint(cl, 23, 23);
553    values->disable_z_stencil_buffer_clear_on_store_dump = __gen_unpack_uint(cl, 22, 22);
554    values->disable_color_buffer_clear_on_store_dump = __gen_unpack_uint(cl, 21, 21);
555    values->pixel_color_format = __gen_unpack_uint(cl, 16, 17);
556    values->mode = __gen_unpack_uint(cl, 14, 15);
557    values->format = __gen_unpack_uint(cl, 12, 13);
558    values->buffer_to_store = __gen_unpack_uint(cl, 8, 10);
559 }
560 #endif
561 
562 
563 #define V3D21_LOAD_TILE_BUFFER_GENERAL_opcode     29
564 #define V3D21_LOAD_TILE_BUFFER_GENERAL_header   \
565    .opcode                              =     29
566 
567 struct V3D21_LOAD_TILE_BUFFER_GENERAL {
568    uint32_t                             opcode;
569    __gen_address_type                   memory_base_address_of_frame_tile_dump_buffer;
570    bool                                 disable_vg_mask_buffer_load;
571    bool                                 disable_z_stencil_buffer_load;
572    bool                                 disable_color_buffer_load;
573    uint32_t                             pixel_color_format;
574 #define RGBA8888                                 0
575 #define BGR565_DITHERED                          1
576 #define BGR565_NO_DITHER                         2
577    uint32_t                             mode;
578 #define SAMPLE_0                                 0
579 #define DECIMATE_X4                              1
580 #define DECIMATE_X16                             2
581    uint32_t                             format;
582 #define RASTER                                   0
583 #define T                                        1
584 #define LT                                       2
585    uint32_t                             buffer_to_store;
586 #define NONE                                     0
587 #define COLOR                                    1
588 #define Z_STENCIL                                2
589 #define Z                                        3
590 #define VG_MASK                                  4
591 };
592 
593 static inline void
V3D21_LOAD_TILE_BUFFER_GENERAL_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_LOAD_TILE_BUFFER_GENERAL * restrict values)594 V3D21_LOAD_TILE_BUFFER_GENERAL_pack(__gen_user_data *data, uint8_t * restrict cl,
595                                     const struct V3D21_LOAD_TILE_BUFFER_GENERAL * restrict values)
596 {
597    cl[ 0] = __gen_uint(values->opcode, 0, 7);
598 
599    cl[ 1] = __gen_uint(values->mode, 6, 7) |
600             __gen_uint(values->format, 4, 5) |
601             __gen_uint(values->buffer_to_store, 0, 2);
602 
603    cl[ 2] = __gen_uint(values->pixel_color_format, 0, 1);
604 
605    __gen_emit_reloc(data, &values->memory_base_address_of_frame_tile_dump_buffer);
606    cl[ 3] = __gen_address_offset(&values->memory_base_address_of_frame_tile_dump_buffer) |
607             __gen_uint(values->disable_vg_mask_buffer_load, 2, 2) |
608             __gen_uint(values->disable_z_stencil_buffer_load, 1, 1) |
609             __gen_uint(values->disable_color_buffer_load, 0, 0);
610 
611    cl[ 4] = __gen_address_offset(&values->memory_base_address_of_frame_tile_dump_buffer) >> 8;
612 
613    cl[ 5] = __gen_address_offset(&values->memory_base_address_of_frame_tile_dump_buffer) >> 16;
614 
615    cl[ 6] = __gen_address_offset(&values->memory_base_address_of_frame_tile_dump_buffer) >> 24;
616 
617 }
618 
619 #define V3D21_LOAD_TILE_BUFFER_GENERAL_length      7
620 #ifdef __gen_unpack_address
621 static inline void
V3D21_LOAD_TILE_BUFFER_GENERAL_unpack(const uint8_t * restrict cl,struct V3D21_LOAD_TILE_BUFFER_GENERAL * restrict values)622 V3D21_LOAD_TILE_BUFFER_GENERAL_unpack(const uint8_t * restrict cl,
623                                       struct V3D21_LOAD_TILE_BUFFER_GENERAL * restrict values)
624 {
625    values->opcode = __gen_unpack_uint(cl, 0, 7);
626    values->memory_base_address_of_frame_tile_dump_buffer = __gen_unpack_address(cl, 28, 55);
627    values->disable_vg_mask_buffer_load = __gen_unpack_uint(cl, 26, 26);
628    values->disable_z_stencil_buffer_load = __gen_unpack_uint(cl, 25, 25);
629    values->disable_color_buffer_load = __gen_unpack_uint(cl, 24, 24);
630    values->pixel_color_format = __gen_unpack_uint(cl, 16, 17);
631    values->mode = __gen_unpack_uint(cl, 14, 15);
632    values->format = __gen_unpack_uint(cl, 12, 13);
633    values->buffer_to_store = __gen_unpack_uint(cl, 8, 10);
634 }
635 #endif
636 
637 
638 #define V3D21_INDEXED_PRIMITIVE_LIST_opcode     32
639 #define V3D21_INDEXED_PRIMITIVE_LIST_header     \
640    .opcode                              =     32
641 
642 struct V3D21_INDEXED_PRIMITIVE_LIST {
643    uint32_t                             opcode;
644    uint32_t                             maximum_index;
645    uint32_t                             address_of_indices_list;
646    uint32_t                             length;
647    uint32_t                             index_type;
648 #define _8_BIT                                   0
649 #define _16_BIT                                  1
650    enum V3D21_Primitive                 primitive_mode;
651 };
652 
653 static inline void
V3D21_INDEXED_PRIMITIVE_LIST_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_INDEXED_PRIMITIVE_LIST * restrict values)654 V3D21_INDEXED_PRIMITIVE_LIST_pack(__gen_user_data *data, uint8_t * restrict cl,
655                                   const struct V3D21_INDEXED_PRIMITIVE_LIST * restrict values)
656 {
657    cl[ 0] = __gen_uint(values->opcode, 0, 7);
658 
659    cl[ 1] = __gen_uint(values->index_type, 4, 7) |
660             __gen_uint(values->primitive_mode, 0, 3);
661 
662 
663    memcpy(&cl[2], &values->length, sizeof(values->length));
664 
665    memcpy(&cl[6], &values->address_of_indices_list, sizeof(values->address_of_indices_list));
666 
667    memcpy(&cl[10], &values->maximum_index, sizeof(values->maximum_index));
668 }
669 
670 #define V3D21_INDEXED_PRIMITIVE_LIST_length     14
671 #ifdef __gen_unpack_address
672 static inline void
V3D21_INDEXED_PRIMITIVE_LIST_unpack(const uint8_t * restrict cl,struct V3D21_INDEXED_PRIMITIVE_LIST * restrict values)673 V3D21_INDEXED_PRIMITIVE_LIST_unpack(const uint8_t * restrict cl,
674                                     struct V3D21_INDEXED_PRIMITIVE_LIST * restrict values)
675 {
676    values->opcode = __gen_unpack_uint(cl, 0, 7);
677    values->maximum_index = __gen_unpack_uint(cl, 80, 111);
678    values->address_of_indices_list = __gen_unpack_uint(cl, 48, 79);
679    values->length = __gen_unpack_uint(cl, 16, 47);
680    values->index_type = __gen_unpack_uint(cl, 12, 15);
681    values->primitive_mode = __gen_unpack_uint(cl, 8, 11);
682 }
683 #endif
684 
685 
686 #define V3D21_VERTEX_ARRAY_PRIMITIVES_opcode     33
687 #define V3D21_VERTEX_ARRAY_PRIMITIVES_header    \
688    .opcode                              =     33
689 
690 struct V3D21_VERTEX_ARRAY_PRIMITIVES {
691    uint32_t                             opcode;
692    uint32_t                             index_of_first_vertex;
693    uint32_t                             length;
694    enum V3D21_Primitive                 primitive_mode;
695 };
696 
697 static inline void
V3D21_VERTEX_ARRAY_PRIMITIVES_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_VERTEX_ARRAY_PRIMITIVES * restrict values)698 V3D21_VERTEX_ARRAY_PRIMITIVES_pack(__gen_user_data *data, uint8_t * restrict cl,
699                                    const struct V3D21_VERTEX_ARRAY_PRIMITIVES * restrict values)
700 {
701    cl[ 0] = __gen_uint(values->opcode, 0, 7);
702 
703    cl[ 1] = __gen_uint(values->primitive_mode, 0, 3);
704 
705 
706    memcpy(&cl[2], &values->length, sizeof(values->length));
707 
708    memcpy(&cl[6], &values->index_of_first_vertex, sizeof(values->index_of_first_vertex));
709 }
710 
711 #define V3D21_VERTEX_ARRAY_PRIMITIVES_length     10
712 #ifdef __gen_unpack_address
713 static inline void
V3D21_VERTEX_ARRAY_PRIMITIVES_unpack(const uint8_t * restrict cl,struct V3D21_VERTEX_ARRAY_PRIMITIVES * restrict values)714 V3D21_VERTEX_ARRAY_PRIMITIVES_unpack(const uint8_t * restrict cl,
715                                      struct V3D21_VERTEX_ARRAY_PRIMITIVES * restrict values)
716 {
717    values->opcode = __gen_unpack_uint(cl, 0, 7);
718    values->index_of_first_vertex = __gen_unpack_uint(cl, 48, 79);
719    values->length = __gen_unpack_uint(cl, 16, 47);
720    values->primitive_mode = __gen_unpack_uint(cl, 8, 11);
721 }
722 #endif
723 
724 
725 #define V3D21_PRIMITIVE_LIST_FORMAT_opcode     56
726 #define V3D21_PRIMITIVE_LIST_FORMAT_header      \
727    .opcode                              =     56
728 
729 struct V3D21_PRIMITIVE_LIST_FORMAT {
730    uint32_t                             opcode;
731    uint32_t                             data_type;
732 #define _16_BIT_INDEX                            1
733 #define _32_BIT_X_Y                              3
734    uint32_t                             primitive_type;
735 #define POINTS_LIST                              0
736 #define LINES_LIST                               1
737 #define TRIANGLES_LIST                           2
738 #define RHY_LIST                                 3
739 };
740 
741 static inline void
V3D21_PRIMITIVE_LIST_FORMAT_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_PRIMITIVE_LIST_FORMAT * restrict values)742 V3D21_PRIMITIVE_LIST_FORMAT_pack(__gen_user_data *data, uint8_t * restrict cl,
743                                  const struct V3D21_PRIMITIVE_LIST_FORMAT * restrict values)
744 {
745    cl[ 0] = __gen_uint(values->opcode, 0, 7);
746 
747    cl[ 1] = __gen_uint(values->data_type, 4, 7) |
748             __gen_uint(values->primitive_type, 0, 3);
749 
750 }
751 
752 #define V3D21_PRIMITIVE_LIST_FORMAT_length      2
753 #ifdef __gen_unpack_address
754 static inline void
V3D21_PRIMITIVE_LIST_FORMAT_unpack(const uint8_t * restrict cl,struct V3D21_PRIMITIVE_LIST_FORMAT * restrict values)755 V3D21_PRIMITIVE_LIST_FORMAT_unpack(const uint8_t * restrict cl,
756                                    struct V3D21_PRIMITIVE_LIST_FORMAT * restrict values)
757 {
758    values->opcode = __gen_unpack_uint(cl, 0, 7);
759    values->data_type = __gen_unpack_uint(cl, 12, 15);
760    values->primitive_type = __gen_unpack_uint(cl, 8, 11);
761 }
762 #endif
763 
764 
765 #define V3D21_GL_SHADER_STATE_opcode          64
766 #define V3D21_GL_SHADER_STATE_header            \
767    .opcode                              =     64
768 
769 struct V3D21_GL_SHADER_STATE {
770    uint32_t                             opcode;
771    uint32_t                             address;
772    bool                                 extended_shader_record;
773    uint32_t                             number_of_attribute_arrays;
774 };
775 
776 static inline void
V3D21_GL_SHADER_STATE_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_GL_SHADER_STATE * restrict values)777 V3D21_GL_SHADER_STATE_pack(__gen_user_data *data, uint8_t * restrict cl,
778                            const struct V3D21_GL_SHADER_STATE * restrict values)
779 {
780    cl[ 0] = __gen_uint(values->opcode, 0, 7);
781 
782    cl[ 1] = __gen_uint(values->address, 0, 27) |
783             __gen_uint(values->extended_shader_record, 3, 3) |
784             __gen_uint(values->number_of_attribute_arrays, 0, 2);
785 
786    cl[ 2] = __gen_uint(values->address, 0, 27) >> 8;
787 
788    cl[ 3] = __gen_uint(values->address, 0, 27) >> 16;
789 
790    cl[ 4] = __gen_uint(values->address, 0, 27) >> 24;
791 
792 }
793 
794 #define V3D21_GL_SHADER_STATE_length           5
795 #ifdef __gen_unpack_address
796 static inline void
V3D21_GL_SHADER_STATE_unpack(const uint8_t * restrict cl,struct V3D21_GL_SHADER_STATE * restrict values)797 V3D21_GL_SHADER_STATE_unpack(const uint8_t * restrict cl,
798                              struct V3D21_GL_SHADER_STATE * restrict values)
799 {
800    values->opcode = __gen_unpack_uint(cl, 0, 7);
801    values->address = __gen_unpack_uint(cl, 8, 35);
802    values->extended_shader_record = __gen_unpack_uint(cl, 11, 11);
803    values->number_of_attribute_arrays = __gen_unpack_uint(cl, 8, 10);
804 }
805 #endif
806 
807 
808 #define V3D21_CLEAR_COLORS_opcode            114
809 #define V3D21_CLEAR_COLORS_header               \
810    .opcode                              =    114
811 
812 struct V3D21_CLEAR_COLORS {
813    uint32_t                             opcode;
814    uint32_t                             clear_stencil;
815    uint32_t                             clear_vg_mask;
816    uint32_t                             clear_zs;
817    uint64_t                             clear_color;
818 };
819 
820 static inline void
V3D21_CLEAR_COLORS_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_CLEAR_COLORS * restrict values)821 V3D21_CLEAR_COLORS_pack(__gen_user_data *data, uint8_t * restrict cl,
822                         const struct V3D21_CLEAR_COLORS * restrict values)
823 {
824    cl[ 0] = __gen_uint(values->opcode, 0, 7);
825 
826    cl[ 1] = __gen_uint(values->clear_color, 0, 63);
827 
828    cl[ 2] = __gen_uint(values->clear_color, 0, 63) >> 8;
829 
830    cl[ 3] = __gen_uint(values->clear_color, 0, 63) >> 16;
831 
832    cl[ 4] = __gen_uint(values->clear_color, 0, 63) >> 24;
833 
834    cl[ 5] = __gen_uint(values->clear_color, 0, 63) >> 32;
835 
836    cl[ 6] = __gen_uint(values->clear_color, 0, 63) >> 40;
837 
838    cl[ 7] = __gen_uint(values->clear_color, 0, 63) >> 48;
839 
840    cl[ 8] = __gen_uint(values->clear_color, 0, 63) >> 56;
841 
842    cl[ 9] = __gen_uint(values->clear_zs, 0, 23);
843 
844    cl[10] = __gen_uint(values->clear_zs, 0, 23) >> 8;
845 
846    cl[11] = __gen_uint(values->clear_zs, 0, 23) >> 16;
847 
848    cl[12] = __gen_uint(values->clear_vg_mask, 0, 7);
849 
850    cl[13] = __gen_uint(values->clear_stencil, 0, 7);
851 
852 }
853 
854 #define V3D21_CLEAR_COLORS_length             14
855 #ifdef __gen_unpack_address
856 static inline void
V3D21_CLEAR_COLORS_unpack(const uint8_t * restrict cl,struct V3D21_CLEAR_COLORS * restrict values)857 V3D21_CLEAR_COLORS_unpack(const uint8_t * restrict cl,
858                           struct V3D21_CLEAR_COLORS * restrict values)
859 {
860    values->opcode = __gen_unpack_uint(cl, 0, 7);
861    values->clear_stencil = __gen_unpack_uint(cl, 104, 111);
862    values->clear_vg_mask = __gen_unpack_uint(cl, 96, 103);
863    values->clear_zs = __gen_unpack_uint(cl, 72, 95);
864    values->clear_color = __gen_unpack_uint(cl, 8, 71);
865 }
866 #endif
867 
868 
869 #define V3D21_CONFIGURATION_BITS_opcode       96
870 #define V3D21_CONFIGURATION_BITS_header         \
871    .opcode                              =     96
872 
873 struct V3D21_CONFIGURATION_BITS {
874    uint32_t                             opcode;
875    bool                                 early_z_updates_enable;
876    bool                                 early_z_enable;
877    bool                                 z_updates_enable;
878    enum V3D21_Compare_Function          depth_test_function;
879    uint32_t                             coverage_read_mode;
880    bool                                 coverage_pipe_select;
881    uint32_t                             rasteriser_oversample_mode;
882    uint32_t                             coverage_read_type;
883    bool                                 antialiased_points_and_lines;
884    bool                                 enable_depth_offset;
885    bool                                 clockwise_primitives;
886    bool                                 enable_reverse_facing_primitive;
887    bool                                 enable_forward_facing_primitive;
888 };
889 
890 static inline void
V3D21_CONFIGURATION_BITS_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_CONFIGURATION_BITS * restrict values)891 V3D21_CONFIGURATION_BITS_pack(__gen_user_data *data, uint8_t * restrict cl,
892                               const struct V3D21_CONFIGURATION_BITS * restrict values)
893 {
894    cl[ 0] = __gen_uint(values->opcode, 0, 7);
895 
896    cl[ 1] = __gen_uint(values->rasteriser_oversample_mode, 6, 7) |
897             __gen_uint(values->coverage_read_type, 5, 5) |
898             __gen_uint(values->antialiased_points_and_lines, 4, 4) |
899             __gen_uint(values->enable_depth_offset, 3, 3) |
900             __gen_uint(values->clockwise_primitives, 2, 2) |
901             __gen_uint(values->enable_reverse_facing_primitive, 1, 1) |
902             __gen_uint(values->enable_forward_facing_primitive, 0, 0);
903 
904    cl[ 2] = __gen_uint(values->z_updates_enable, 7, 7) |
905             __gen_uint(values->depth_test_function, 4, 6) |
906             __gen_uint(values->coverage_read_mode, 3, 3) |
907             __gen_uint(values->coverage_pipe_select, 0, 0);
908 
909    cl[ 3] = __gen_uint(values->early_z_updates_enable, 1, 1) |
910             __gen_uint(values->early_z_enable, 0, 0);
911 
912 }
913 
914 #define V3D21_CONFIGURATION_BITS_length        4
915 #ifdef __gen_unpack_address
916 static inline void
V3D21_CONFIGURATION_BITS_unpack(const uint8_t * restrict cl,struct V3D21_CONFIGURATION_BITS * restrict values)917 V3D21_CONFIGURATION_BITS_unpack(const uint8_t * restrict cl,
918                                 struct V3D21_CONFIGURATION_BITS * restrict values)
919 {
920    values->opcode = __gen_unpack_uint(cl, 0, 7);
921    values->early_z_updates_enable = __gen_unpack_uint(cl, 25, 25);
922    values->early_z_enable = __gen_unpack_uint(cl, 24, 24);
923    values->z_updates_enable = __gen_unpack_uint(cl, 23, 23);
924    values->depth_test_function = __gen_unpack_uint(cl, 20, 22);
925    values->coverage_read_mode = __gen_unpack_uint(cl, 19, 19);
926    values->coverage_pipe_select = __gen_unpack_uint(cl, 16, 16);
927    values->rasteriser_oversample_mode = __gen_unpack_uint(cl, 14, 15);
928    values->coverage_read_type = __gen_unpack_uint(cl, 13, 13);
929    values->antialiased_points_and_lines = __gen_unpack_uint(cl, 12, 12);
930    values->enable_depth_offset = __gen_unpack_uint(cl, 11, 11);
931    values->clockwise_primitives = __gen_unpack_uint(cl, 10, 10);
932    values->enable_reverse_facing_primitive = __gen_unpack_uint(cl, 9, 9);
933    values->enable_forward_facing_primitive = __gen_unpack_uint(cl, 8, 8);
934 }
935 #endif
936 
937 
938 #define V3D21_FLAT_SHADE_FLAGS_opcode         97
939 #define V3D21_FLAT_SHADE_FLAGS_header           \
940    .opcode                              =     97
941 
942 struct V3D21_FLAT_SHADE_FLAGS {
943    uint32_t                             opcode;
944    uint32_t                             flat_shading_flags;
945 };
946 
947 static inline void
V3D21_FLAT_SHADE_FLAGS_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_FLAT_SHADE_FLAGS * restrict values)948 V3D21_FLAT_SHADE_FLAGS_pack(__gen_user_data *data, uint8_t * restrict cl,
949                             const struct V3D21_FLAT_SHADE_FLAGS * restrict values)
950 {
951    cl[ 0] = __gen_uint(values->opcode, 0, 7);
952 
953 
954    memcpy(&cl[1], &values->flat_shading_flags, sizeof(values->flat_shading_flags));
955 }
956 
957 #define V3D21_FLAT_SHADE_FLAGS_length          5
958 #ifdef __gen_unpack_address
959 static inline void
V3D21_FLAT_SHADE_FLAGS_unpack(const uint8_t * restrict cl,struct V3D21_FLAT_SHADE_FLAGS * restrict values)960 V3D21_FLAT_SHADE_FLAGS_unpack(const uint8_t * restrict cl,
961                               struct V3D21_FLAT_SHADE_FLAGS * restrict values)
962 {
963    values->opcode = __gen_unpack_uint(cl, 0, 7);
964    values->flat_shading_flags = __gen_unpack_uint(cl, 8, 39);
965 }
966 #endif
967 
968 
969 #define V3D21_POINT_SIZE_opcode               98
970 #define V3D21_POINT_SIZE_header                 \
971    .opcode                              =     98
972 
973 struct V3D21_POINT_SIZE {
974    uint32_t                             opcode;
975    float                                point_size;
976 };
977 
978 static inline void
V3D21_POINT_SIZE_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_POINT_SIZE * restrict values)979 V3D21_POINT_SIZE_pack(__gen_user_data *data, uint8_t * restrict cl,
980                       const struct V3D21_POINT_SIZE * restrict values)
981 {
982    cl[ 0] = __gen_uint(values->opcode, 0, 7);
983 
984 
985    memcpy(&cl[1], &values->point_size, sizeof(values->point_size));
986 }
987 
988 #define V3D21_POINT_SIZE_length                5
989 #ifdef __gen_unpack_address
990 static inline void
V3D21_POINT_SIZE_unpack(const uint8_t * restrict cl,struct V3D21_POINT_SIZE * restrict values)991 V3D21_POINT_SIZE_unpack(const uint8_t * restrict cl,
992                         struct V3D21_POINT_SIZE * restrict values)
993 {
994    values->opcode = __gen_unpack_uint(cl, 0, 7);
995    values->point_size = __gen_unpack_float(cl, 8, 39);
996 }
997 #endif
998 
999 
1000 #define V3D21_LINE_WIDTH_opcode               99
1001 #define V3D21_LINE_WIDTH_header                 \
1002    .opcode                              =     99
1003 
1004 struct V3D21_LINE_WIDTH {
1005    uint32_t                             opcode;
1006    float                                line_width;
1007 };
1008 
1009 static inline void
V3D21_LINE_WIDTH_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_LINE_WIDTH * restrict values)1010 V3D21_LINE_WIDTH_pack(__gen_user_data *data, uint8_t * restrict cl,
1011                       const struct V3D21_LINE_WIDTH * restrict values)
1012 {
1013    cl[ 0] = __gen_uint(values->opcode, 0, 7);
1014 
1015 
1016    memcpy(&cl[1], &values->line_width, sizeof(values->line_width));
1017 }
1018 
1019 #define V3D21_LINE_WIDTH_length                5
1020 #ifdef __gen_unpack_address
1021 static inline void
V3D21_LINE_WIDTH_unpack(const uint8_t * restrict cl,struct V3D21_LINE_WIDTH * restrict values)1022 V3D21_LINE_WIDTH_unpack(const uint8_t * restrict cl,
1023                         struct V3D21_LINE_WIDTH * restrict values)
1024 {
1025    values->opcode = __gen_unpack_uint(cl, 0, 7);
1026    values->line_width = __gen_unpack_float(cl, 8, 39);
1027 }
1028 #endif
1029 
1030 
1031 #define V3D21_RHT_X_BOUNDARY_opcode          100
1032 #define V3D21_RHT_X_BOUNDARY_header             \
1033    .opcode                              =    100
1034 
1035 struct V3D21_RHT_X_BOUNDARY {
1036    uint32_t                             opcode;
1037    int32_t                              rht_primitive_x_boundary;
1038 };
1039 
1040 static inline void
V3D21_RHT_X_BOUNDARY_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_RHT_X_BOUNDARY * restrict values)1041 V3D21_RHT_X_BOUNDARY_pack(__gen_user_data *data, uint8_t * restrict cl,
1042                           const struct V3D21_RHT_X_BOUNDARY * restrict values)
1043 {
1044    cl[ 0] = __gen_uint(values->opcode, 0, 7);
1045 
1046    cl[ 1] = __gen_sint(values->rht_primitive_x_boundary, 0, 15);
1047 
1048    cl[ 2] = __gen_sint(values->rht_primitive_x_boundary, 0, 15) >> 8;
1049 
1050 }
1051 
1052 #define V3D21_RHT_X_BOUNDARY_length            3
1053 #ifdef __gen_unpack_address
1054 static inline void
V3D21_RHT_X_BOUNDARY_unpack(const uint8_t * restrict cl,struct V3D21_RHT_X_BOUNDARY * restrict values)1055 V3D21_RHT_X_BOUNDARY_unpack(const uint8_t * restrict cl,
1056                             struct V3D21_RHT_X_BOUNDARY * restrict values)
1057 {
1058    values->opcode = __gen_unpack_uint(cl, 0, 7);
1059    values->rht_primitive_x_boundary = __gen_unpack_sint(cl, 8, 23);
1060 }
1061 #endif
1062 
1063 
1064 #define V3D21_DEPTH_OFFSET_opcode            101
1065 #define V3D21_DEPTH_OFFSET_header               \
1066    .opcode                              =    101
1067 
1068 struct V3D21_DEPTH_OFFSET {
1069    uint32_t                             opcode;
1070    uint32_t                             depth_offset_units;
1071    uint32_t                             depth_offset_factor;
1072 };
1073 
1074 static inline void
V3D21_DEPTH_OFFSET_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_DEPTH_OFFSET * restrict values)1075 V3D21_DEPTH_OFFSET_pack(__gen_user_data *data, uint8_t * restrict cl,
1076                         const struct V3D21_DEPTH_OFFSET * restrict values)
1077 {
1078    cl[ 0] = __gen_uint(values->opcode, 0, 7);
1079 
1080    cl[ 1] = __gen_uint(values->depth_offset_factor, 0, 15);
1081 
1082    cl[ 2] = __gen_uint(values->depth_offset_factor, 0, 15) >> 8;
1083 
1084    cl[ 3] = __gen_uint(values->depth_offset_units, 0, 15);
1085 
1086    cl[ 4] = __gen_uint(values->depth_offset_units, 0, 15) >> 8;
1087 
1088 }
1089 
1090 #define V3D21_DEPTH_OFFSET_length              5
1091 #ifdef __gen_unpack_address
1092 static inline void
V3D21_DEPTH_OFFSET_unpack(const uint8_t * restrict cl,struct V3D21_DEPTH_OFFSET * restrict values)1093 V3D21_DEPTH_OFFSET_unpack(const uint8_t * restrict cl,
1094                           struct V3D21_DEPTH_OFFSET * restrict values)
1095 {
1096    values->opcode = __gen_unpack_uint(cl, 0, 7);
1097    values->depth_offset_units = __gen_unpack_uint(cl, 24, 39);
1098    values->depth_offset_factor = __gen_unpack_uint(cl, 8, 23);
1099 }
1100 #endif
1101 
1102 
1103 #define V3D21_CLIP_WINDOW_opcode             102
1104 #define V3D21_CLIP_WINDOW_header                \
1105    .opcode                              =    102
1106 
1107 struct V3D21_CLIP_WINDOW {
1108    uint32_t                             opcode;
1109    uint32_t                             clip_window_height_in_pixels;
1110    uint32_t                             clip_window_width_in_pixels;
1111    uint32_t                             clip_window_bottom_pixel_coordinate;
1112    uint32_t                             clip_window_left_pixel_coordinate;
1113 };
1114 
1115 static inline void
V3D21_CLIP_WINDOW_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_CLIP_WINDOW * restrict values)1116 V3D21_CLIP_WINDOW_pack(__gen_user_data *data, uint8_t * restrict cl,
1117                        const struct V3D21_CLIP_WINDOW * restrict values)
1118 {
1119    cl[ 0] = __gen_uint(values->opcode, 0, 7);
1120 
1121    cl[ 1] = __gen_uint(values->clip_window_left_pixel_coordinate, 0, 15);
1122 
1123    cl[ 2] = __gen_uint(values->clip_window_left_pixel_coordinate, 0, 15) >> 8;
1124 
1125    cl[ 3] = __gen_uint(values->clip_window_bottom_pixel_coordinate, 0, 15);
1126 
1127    cl[ 4] = __gen_uint(values->clip_window_bottom_pixel_coordinate, 0, 15) >> 8;
1128 
1129    cl[ 5] = __gen_uint(values->clip_window_width_in_pixels, 0, 15);
1130 
1131    cl[ 6] = __gen_uint(values->clip_window_width_in_pixels, 0, 15) >> 8;
1132 
1133    cl[ 7] = __gen_uint(values->clip_window_height_in_pixels, 0, 15);
1134 
1135    cl[ 8] = __gen_uint(values->clip_window_height_in_pixels, 0, 15) >> 8;
1136 
1137 }
1138 
1139 #define V3D21_CLIP_WINDOW_length               9
1140 #ifdef __gen_unpack_address
1141 static inline void
V3D21_CLIP_WINDOW_unpack(const uint8_t * restrict cl,struct V3D21_CLIP_WINDOW * restrict values)1142 V3D21_CLIP_WINDOW_unpack(const uint8_t * restrict cl,
1143                          struct V3D21_CLIP_WINDOW * restrict values)
1144 {
1145    values->opcode = __gen_unpack_uint(cl, 0, 7);
1146    values->clip_window_height_in_pixels = __gen_unpack_uint(cl, 56, 71);
1147    values->clip_window_width_in_pixels = __gen_unpack_uint(cl, 40, 55);
1148    values->clip_window_bottom_pixel_coordinate = __gen_unpack_uint(cl, 24, 39);
1149    values->clip_window_left_pixel_coordinate = __gen_unpack_uint(cl, 8, 23);
1150 }
1151 #endif
1152 
1153 
1154 #define V3D21_VIEWPORT_OFFSET_opcode         103
1155 #define V3D21_VIEWPORT_OFFSET_header            \
1156    .opcode                              =    103
1157 
1158 struct V3D21_VIEWPORT_OFFSET {
1159    uint32_t                             opcode;
1160    float                                viewport_centre_y_coordinate;
1161    float                                viewport_centre_x_coordinate;
1162 };
1163 
1164 static inline void
V3D21_VIEWPORT_OFFSET_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_VIEWPORT_OFFSET * restrict values)1165 V3D21_VIEWPORT_OFFSET_pack(__gen_user_data *data, uint8_t * restrict cl,
1166                            const struct V3D21_VIEWPORT_OFFSET * restrict values)
1167 {
1168    cl[ 0] = __gen_uint(values->opcode, 0, 7);
1169 
1170    cl[ 1] = __gen_sfixed(values->viewport_centre_x_coordinate, 0, 15, 4);
1171 
1172    cl[ 2] = __gen_sfixed(values->viewport_centre_x_coordinate, 0, 15, 4) >> 8;
1173 
1174    cl[ 3] = __gen_sfixed(values->viewport_centre_y_coordinate, 0, 15, 4);
1175 
1176    cl[ 4] = __gen_sfixed(values->viewport_centre_y_coordinate, 0, 15, 4) >> 8;
1177 
1178 }
1179 
1180 #define V3D21_VIEWPORT_OFFSET_length           5
1181 #ifdef __gen_unpack_address
1182 static inline void
V3D21_VIEWPORT_OFFSET_unpack(const uint8_t * restrict cl,struct V3D21_VIEWPORT_OFFSET * restrict values)1183 V3D21_VIEWPORT_OFFSET_unpack(const uint8_t * restrict cl,
1184                              struct V3D21_VIEWPORT_OFFSET * restrict values)
1185 {
1186    values->opcode = __gen_unpack_uint(cl, 0, 7);
1187    values->viewport_centre_y_coordinate = __gen_unpack_sfixed(cl, 24, 39, 4);
1188    values->viewport_centre_x_coordinate = __gen_unpack_sfixed(cl, 8, 23, 4);
1189 }
1190 #endif
1191 
1192 
1193 #define V3D21_Z_MIN_AND_MAX_CLIPPING_PLANES_opcode    104
1194 #define V3D21_Z_MIN_AND_MAX_CLIPPING_PLANES_header\
1195    .opcode                              =    104
1196 
1197 struct V3D21_Z_MIN_AND_MAX_CLIPPING_PLANES {
1198    uint32_t                             opcode;
1199    float                                maximum_zw;
1200    float                                minimum_zw;
1201 };
1202 
1203 static inline void
V3D21_Z_MIN_AND_MAX_CLIPPING_PLANES_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_Z_MIN_AND_MAX_CLIPPING_PLANES * restrict values)1204 V3D21_Z_MIN_AND_MAX_CLIPPING_PLANES_pack(__gen_user_data *data, uint8_t * restrict cl,
1205                                          const struct V3D21_Z_MIN_AND_MAX_CLIPPING_PLANES * restrict values)
1206 {
1207    cl[ 0] = __gen_uint(values->opcode, 0, 7);
1208 
1209 
1210    memcpy(&cl[1], &values->minimum_zw, sizeof(values->minimum_zw));
1211 
1212    memcpy(&cl[5], &values->maximum_zw, sizeof(values->maximum_zw));
1213 }
1214 
1215 #define V3D21_Z_MIN_AND_MAX_CLIPPING_PLANES_length      9
1216 #ifdef __gen_unpack_address
1217 static inline void
V3D21_Z_MIN_AND_MAX_CLIPPING_PLANES_unpack(const uint8_t * restrict cl,struct V3D21_Z_MIN_AND_MAX_CLIPPING_PLANES * restrict values)1218 V3D21_Z_MIN_AND_MAX_CLIPPING_PLANES_unpack(const uint8_t * restrict cl,
1219                                            struct V3D21_Z_MIN_AND_MAX_CLIPPING_PLANES * restrict values)
1220 {
1221    values->opcode = __gen_unpack_uint(cl, 0, 7);
1222    values->maximum_zw = __gen_unpack_float(cl, 40, 71);
1223    values->minimum_zw = __gen_unpack_float(cl, 8, 39);
1224 }
1225 #endif
1226 
1227 
1228 #define V3D21_CLIPPER_XY_SCALING_opcode      105
1229 #define V3D21_CLIPPER_XY_SCALING_header         \
1230    .opcode                              =    105
1231 
1232 struct V3D21_CLIPPER_XY_SCALING {
1233    uint32_t                             opcode;
1234    float                                viewport_half_height_in_1_16th_of_pixel;
1235    float                                viewport_half_width_in_1_16th_of_pixel;
1236 };
1237 
1238 static inline void
V3D21_CLIPPER_XY_SCALING_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_CLIPPER_XY_SCALING * restrict values)1239 V3D21_CLIPPER_XY_SCALING_pack(__gen_user_data *data, uint8_t * restrict cl,
1240                               const struct V3D21_CLIPPER_XY_SCALING * restrict values)
1241 {
1242    cl[ 0] = __gen_uint(values->opcode, 0, 7);
1243 
1244 
1245    memcpy(&cl[1], &values->viewport_half_width_in_1_16th_of_pixel, sizeof(values->viewport_half_width_in_1_16th_of_pixel));
1246 
1247    memcpy(&cl[5], &values->viewport_half_height_in_1_16th_of_pixel, sizeof(values->viewport_half_height_in_1_16th_of_pixel));
1248 }
1249 
1250 #define V3D21_CLIPPER_XY_SCALING_length        9
1251 #ifdef __gen_unpack_address
1252 static inline void
V3D21_CLIPPER_XY_SCALING_unpack(const uint8_t * restrict cl,struct V3D21_CLIPPER_XY_SCALING * restrict values)1253 V3D21_CLIPPER_XY_SCALING_unpack(const uint8_t * restrict cl,
1254                                 struct V3D21_CLIPPER_XY_SCALING * restrict values)
1255 {
1256    values->opcode = __gen_unpack_uint(cl, 0, 7);
1257    values->viewport_half_height_in_1_16th_of_pixel = __gen_unpack_float(cl, 40, 71);
1258    values->viewport_half_width_in_1_16th_of_pixel = __gen_unpack_float(cl, 8, 39);
1259 }
1260 #endif
1261 
1262 
1263 #define V3D21_CLIPPER_Z_SCALE_AND_OFFSET_opcode    106
1264 #define V3D21_CLIPPER_Z_SCALE_AND_OFFSET_header \
1265    .opcode                              =    106
1266 
1267 struct V3D21_CLIPPER_Z_SCALE_AND_OFFSET {
1268    uint32_t                             opcode;
1269    float                                viewport_z_offset_zc_to_zs;
1270    float                                viewport_z_scale_zc_to_zs;
1271 };
1272 
1273 static inline void
V3D21_CLIPPER_Z_SCALE_AND_OFFSET_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_CLIPPER_Z_SCALE_AND_OFFSET * restrict values)1274 V3D21_CLIPPER_Z_SCALE_AND_OFFSET_pack(__gen_user_data *data, uint8_t * restrict cl,
1275                                       const struct V3D21_CLIPPER_Z_SCALE_AND_OFFSET * restrict values)
1276 {
1277    cl[ 0] = __gen_uint(values->opcode, 0, 7);
1278 
1279 
1280    memcpy(&cl[1], &values->viewport_z_scale_zc_to_zs, sizeof(values->viewport_z_scale_zc_to_zs));
1281 
1282    memcpy(&cl[5], &values->viewport_z_offset_zc_to_zs, sizeof(values->viewport_z_offset_zc_to_zs));
1283 }
1284 
1285 #define V3D21_CLIPPER_Z_SCALE_AND_OFFSET_length      9
1286 #ifdef __gen_unpack_address
1287 static inline void
V3D21_CLIPPER_Z_SCALE_AND_OFFSET_unpack(const uint8_t * restrict cl,struct V3D21_CLIPPER_Z_SCALE_AND_OFFSET * restrict values)1288 V3D21_CLIPPER_Z_SCALE_AND_OFFSET_unpack(const uint8_t * restrict cl,
1289                                         struct V3D21_CLIPPER_Z_SCALE_AND_OFFSET * restrict values)
1290 {
1291    values->opcode = __gen_unpack_uint(cl, 0, 7);
1292    values->viewport_z_offset_zc_to_zs = __gen_unpack_float(cl, 40, 71);
1293    values->viewport_z_scale_zc_to_zs = __gen_unpack_float(cl, 8, 39);
1294 }
1295 #endif
1296 
1297 
1298 #define V3D21_TILE_BINNING_MODE_CONFIGURATION_opcode    112
1299 #define V3D21_TILE_BINNING_MODE_CONFIGURATION_header\
1300    .opcode                              =    112
1301 
1302 struct V3D21_TILE_BINNING_MODE_CONFIGURATION {
1303    uint32_t                             opcode;
1304    bool                                 double_buffer_in_non_ms_mode;
1305    uint32_t                             tile_allocation_block_size;
1306 #define BLOCK_SIZE_32                            0
1307 #define BLOCK_SIZE_64                            1
1308 #define BLOCK_SIZE_128                           2
1309 #define BLOCK_SIZE_256                           3
1310    uint32_t                             tile_allocation_initial_block_size;
1311 #define BLOCK_SIZE_32                            0
1312 #define BLOCK_SIZE_64                            1
1313 #define BLOCK_SIZE_128                           2
1314 #define BLOCK_SIZE_256                           3
1315    bool                                 auto_initialise_tile_state_data_array;
1316    bool                                 tile_buffer_64_bit_color_depth;
1317    bool                                 multisample_mode_4x;
1318    uint32_t                             height_in_tiles;
1319    uint32_t                             width_in_tiles;
1320    uint32_t                             tile_state_data_array_address;
1321    uint32_t                             tile_allocation_memory_size;
1322    uint32_t                             tile_allocation_memory_address;
1323 };
1324 
1325 static inline void
V3D21_TILE_BINNING_MODE_CONFIGURATION_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_TILE_BINNING_MODE_CONFIGURATION * restrict values)1326 V3D21_TILE_BINNING_MODE_CONFIGURATION_pack(__gen_user_data *data, uint8_t * restrict cl,
1327                                            const struct V3D21_TILE_BINNING_MODE_CONFIGURATION * restrict values)
1328 {
1329    cl[ 0] = __gen_uint(values->opcode, 0, 7);
1330 
1331 
1332    memcpy(&cl[1], &values->tile_allocation_memory_address, sizeof(values->tile_allocation_memory_address));
1333 
1334    memcpy(&cl[5], &values->tile_allocation_memory_size, sizeof(values->tile_allocation_memory_size));
1335 
1336    memcpy(&cl[9], &values->tile_state_data_array_address, sizeof(values->tile_state_data_array_address));
1337    cl[13] = __gen_uint(values->width_in_tiles, 0, 7);
1338 
1339    cl[14] = __gen_uint(values->height_in_tiles, 0, 7);
1340 
1341    cl[15] = __gen_uint(values->double_buffer_in_non_ms_mode, 7, 7) |
1342             __gen_uint(values->tile_allocation_block_size, 5, 6) |
1343             __gen_uint(values->tile_allocation_initial_block_size, 3, 4) |
1344             __gen_uint(values->auto_initialise_tile_state_data_array, 2, 2) |
1345             __gen_uint(values->tile_buffer_64_bit_color_depth, 1, 1) |
1346             __gen_uint(values->multisample_mode_4x, 0, 0);
1347 
1348 }
1349 
1350 #define V3D21_TILE_BINNING_MODE_CONFIGURATION_length     16
1351 #ifdef __gen_unpack_address
1352 static inline void
V3D21_TILE_BINNING_MODE_CONFIGURATION_unpack(const uint8_t * restrict cl,struct V3D21_TILE_BINNING_MODE_CONFIGURATION * restrict values)1353 V3D21_TILE_BINNING_MODE_CONFIGURATION_unpack(const uint8_t * restrict cl,
1354                                              struct V3D21_TILE_BINNING_MODE_CONFIGURATION * restrict values)
1355 {
1356    values->opcode = __gen_unpack_uint(cl, 0, 7);
1357    values->double_buffer_in_non_ms_mode = __gen_unpack_uint(cl, 127, 127);
1358    values->tile_allocation_block_size = __gen_unpack_uint(cl, 125, 126);
1359    values->tile_allocation_initial_block_size = __gen_unpack_uint(cl, 123, 124);
1360    values->auto_initialise_tile_state_data_array = __gen_unpack_uint(cl, 122, 122);
1361    values->tile_buffer_64_bit_color_depth = __gen_unpack_uint(cl, 121, 121);
1362    values->multisample_mode_4x = __gen_unpack_uint(cl, 120, 120);
1363    values->height_in_tiles = __gen_unpack_uint(cl, 112, 119);
1364    values->width_in_tiles = __gen_unpack_uint(cl, 104, 111);
1365    values->tile_state_data_array_address = __gen_unpack_uint(cl, 72, 103);
1366    values->tile_allocation_memory_size = __gen_unpack_uint(cl, 40, 71);
1367    values->tile_allocation_memory_address = __gen_unpack_uint(cl, 8, 39);
1368 }
1369 #endif
1370 
1371 
1372 #define V3D21_TILE_RENDERING_MODE_CONFIGURATION_opcode    113
1373 #define V3D21_TILE_RENDERING_MODE_CONFIGURATION_header\
1374    .opcode                              =    113
1375 
1376 struct V3D21_TILE_RENDERING_MODE_CONFIGURATION {
1377    uint32_t                             opcode;
1378    bool                                 double_buffer_in_non_ms_mode;
1379    bool                                 early_z_early_cov_disable;
1380    bool                                 early_z_update_direction_gt_ge;
1381    bool                                 select_coverage_mode;
1382    bool                                 enable_vg_mask_buffer;
1383    uint32_t                             memory_format;
1384 #define RASTER                                   0
1385 #define T                                        1
1386 #define LT                                       2
1387    uint32_t                             decimate_mode;
1388    uint32_t                             non_hdr_frame_buffer_color_format;
1389 #define RENDERING_CONFIG_BGR565_DITHERED         0
1390 #define RENDERING_CONFIG_RGBA8888                1
1391 #define RENDERING_CONFIG_BGR565_NO_DITHER        2
1392    bool                                 tile_buffer_64_bit_color_depth;
1393    bool                                 multisample_mode_4x;
1394    uint32_t                             height_pixels;
1395    uint32_t                             width_pixels;
1396    __gen_address_type                   memory_address;
1397 };
1398 
1399 static inline void
V3D21_TILE_RENDERING_MODE_CONFIGURATION_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_TILE_RENDERING_MODE_CONFIGURATION * restrict values)1400 V3D21_TILE_RENDERING_MODE_CONFIGURATION_pack(__gen_user_data *data, uint8_t * restrict cl,
1401                                              const struct V3D21_TILE_RENDERING_MODE_CONFIGURATION * restrict values)
1402 {
1403    cl[ 0] = __gen_uint(values->opcode, 0, 7);
1404 
1405    __gen_emit_reloc(data, &values->memory_address);
1406    cl[ 1] = __gen_address_offset(&values->memory_address);
1407 
1408    cl[ 2] = __gen_address_offset(&values->memory_address) >> 8;
1409 
1410    cl[ 3] = __gen_address_offset(&values->memory_address) >> 16;
1411 
1412    cl[ 4] = __gen_address_offset(&values->memory_address) >> 24;
1413 
1414    cl[ 5] = __gen_uint(values->width_pixels, 0, 15);
1415 
1416    cl[ 6] = __gen_uint(values->width_pixels, 0, 15) >> 8;
1417 
1418    cl[ 7] = __gen_uint(values->height_pixels, 0, 15);
1419 
1420    cl[ 8] = __gen_uint(values->height_pixels, 0, 15) >> 8;
1421 
1422    cl[ 9] = __gen_uint(values->memory_format, 6, 7) |
1423             __gen_uint(values->decimate_mode, 4, 5) |
1424             __gen_uint(values->non_hdr_frame_buffer_color_format, 2, 3) |
1425             __gen_uint(values->tile_buffer_64_bit_color_depth, 1, 1) |
1426             __gen_uint(values->multisample_mode_4x, 0, 0);
1427 
1428    cl[10] = __gen_uint(values->double_buffer_in_non_ms_mode, 4, 4) |
1429             __gen_uint(values->early_z_early_cov_disable, 3, 3) |
1430             __gen_uint(values->early_z_update_direction_gt_ge, 2, 2) |
1431             __gen_uint(values->select_coverage_mode, 1, 1) |
1432             __gen_uint(values->enable_vg_mask_buffer, 0, 0);
1433 
1434 }
1435 
1436 #define V3D21_TILE_RENDERING_MODE_CONFIGURATION_length     11
1437 #ifdef __gen_unpack_address
1438 static inline void
V3D21_TILE_RENDERING_MODE_CONFIGURATION_unpack(const uint8_t * restrict cl,struct V3D21_TILE_RENDERING_MODE_CONFIGURATION * restrict values)1439 V3D21_TILE_RENDERING_MODE_CONFIGURATION_unpack(const uint8_t * restrict cl,
1440                                                struct V3D21_TILE_RENDERING_MODE_CONFIGURATION * restrict values)
1441 {
1442    values->opcode = __gen_unpack_uint(cl, 0, 7);
1443    values->double_buffer_in_non_ms_mode = __gen_unpack_uint(cl, 84, 84);
1444    values->early_z_early_cov_disable = __gen_unpack_uint(cl, 83, 83);
1445    values->early_z_update_direction_gt_ge = __gen_unpack_uint(cl, 82, 82);
1446    values->select_coverage_mode = __gen_unpack_uint(cl, 81, 81);
1447    values->enable_vg_mask_buffer = __gen_unpack_uint(cl, 80, 80);
1448    values->memory_format = __gen_unpack_uint(cl, 78, 79);
1449    values->decimate_mode = __gen_unpack_uint(cl, 76, 77);
1450    values->non_hdr_frame_buffer_color_format = __gen_unpack_uint(cl, 74, 75);
1451    values->tile_buffer_64_bit_color_depth = __gen_unpack_uint(cl, 73, 73);
1452    values->multisample_mode_4x = __gen_unpack_uint(cl, 72, 72);
1453    values->height_pixels = __gen_unpack_uint(cl, 56, 71);
1454    values->width_pixels = __gen_unpack_uint(cl, 40, 55);
1455    values->memory_address = __gen_unpack_address(cl, 8, 39);
1456 }
1457 #endif
1458 
1459 
1460 #define V3D21_TILE_COORDINATES_opcode        115
1461 #define V3D21_TILE_COORDINATES_header           \
1462    .opcode                              =    115
1463 
1464 struct V3D21_TILE_COORDINATES {
1465    uint32_t                             opcode;
1466    uint32_t                             tile_row_number;
1467    uint32_t                             tile_column_number;
1468 };
1469 
1470 static inline void
V3D21_TILE_COORDINATES_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_TILE_COORDINATES * restrict values)1471 V3D21_TILE_COORDINATES_pack(__gen_user_data *data, uint8_t * restrict cl,
1472                             const struct V3D21_TILE_COORDINATES * restrict values)
1473 {
1474    cl[ 0] = __gen_uint(values->opcode, 0, 7);
1475 
1476    cl[ 1] = __gen_uint(values->tile_column_number, 0, 7);
1477 
1478    cl[ 2] = __gen_uint(values->tile_row_number, 0, 7);
1479 
1480 }
1481 
1482 #define V3D21_TILE_COORDINATES_length          3
1483 #ifdef __gen_unpack_address
1484 static inline void
V3D21_TILE_COORDINATES_unpack(const uint8_t * restrict cl,struct V3D21_TILE_COORDINATES * restrict values)1485 V3D21_TILE_COORDINATES_unpack(const uint8_t * restrict cl,
1486                               struct V3D21_TILE_COORDINATES * restrict values)
1487 {
1488    values->opcode = __gen_unpack_uint(cl, 0, 7);
1489    values->tile_row_number = __gen_unpack_uint(cl, 16, 23);
1490    values->tile_column_number = __gen_unpack_uint(cl, 8, 15);
1491 }
1492 #endif
1493 
1494 
1495 #define V3D21_GEM_RELOCATIONS_opcode         254
1496 #define V3D21_GEM_RELOCATIONS_header            \
1497    .opcode                              =    254
1498 
1499 struct V3D21_GEM_RELOCATIONS {
1500    uint32_t                             opcode;
1501    uint32_t                             buffer_1;
1502    uint32_t                             buffer_0;
1503 };
1504 
1505 static inline void
V3D21_GEM_RELOCATIONS_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_GEM_RELOCATIONS * restrict values)1506 V3D21_GEM_RELOCATIONS_pack(__gen_user_data *data, uint8_t * restrict cl,
1507                            const struct V3D21_GEM_RELOCATIONS * restrict values)
1508 {
1509    cl[ 0] = __gen_uint(values->opcode, 0, 7);
1510 
1511 
1512    memcpy(&cl[1], &values->buffer_0, sizeof(values->buffer_0));
1513 
1514    memcpy(&cl[5], &values->buffer_1, sizeof(values->buffer_1));
1515 }
1516 
1517 #define V3D21_GEM_RELOCATIONS_length           9
1518 #ifdef __gen_unpack_address
1519 static inline void
V3D21_GEM_RELOCATIONS_unpack(const uint8_t * restrict cl,struct V3D21_GEM_RELOCATIONS * restrict values)1520 V3D21_GEM_RELOCATIONS_unpack(const uint8_t * restrict cl,
1521                              struct V3D21_GEM_RELOCATIONS * restrict values)
1522 {
1523    values->opcode = __gen_unpack_uint(cl, 0, 7);
1524    values->buffer_1 = __gen_unpack_uint(cl, 40, 71);
1525    values->buffer_0 = __gen_unpack_uint(cl, 8, 39);
1526 }
1527 #endif
1528 
1529 
1530 #define V3D21_SHADER_RECORD_header              \
1531 
1532 
1533 struct V3D21_SHADER_RECORD {
1534    bool                                 fragment_shader_is_single_threaded;
1535    bool                                 point_size_included_in_shaded_vertex_data;
1536    bool                                 enable_clipping;
1537    uint32_t                             fragment_shader_number_of_uniforms_not_used_currently;
1538    uint32_t                             fragment_shader_number_of_varyings;
1539    __gen_address_type                   fragment_shader_code_address;
1540    uint32_t                             fragment_shader_uniforms_address;
1541    uint32_t                             vertex_shader_number_of_uniforms_not_used_currently;
1542    uint32_t                             vertex_shader_attribute_array_select_bits;
1543    uint32_t                             vertex_shader_total_attributes_size;
1544    __gen_address_type                   vertex_shader_code_address;
1545    uint32_t                             vertex_shader_uniforms_address;
1546    uint32_t                             coordinate_shader_number_of_uniforms_not_used_currently;
1547    uint32_t                             coordinate_shader_attribute_array_select_bits;
1548    uint32_t                             coordinate_shader_total_attributes_size;
1549    __gen_address_type                   coordinate_shader_code_address;
1550    uint32_t                             coordinate_shader_uniforms_address;
1551 };
1552 
1553 static inline void
V3D21_SHADER_RECORD_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_SHADER_RECORD * restrict values)1554 V3D21_SHADER_RECORD_pack(__gen_user_data *data, uint8_t * restrict cl,
1555                          const struct V3D21_SHADER_RECORD * restrict values)
1556 {
1557    cl[ 0] = __gen_uint(values->fragment_shader_is_single_threaded, 0, 0) |
1558             __gen_uint(values->point_size_included_in_shaded_vertex_data, 1, 1) |
1559             __gen_uint(values->enable_clipping, 2, 2);
1560 
1561    cl[ 1] = 0;
1562    cl[ 2] = __gen_uint(values->fragment_shader_number_of_uniforms_not_used_currently, 0, 15);
1563 
1564    cl[ 3] = __gen_uint(values->fragment_shader_number_of_uniforms_not_used_currently, 0, 15) >> 8 |
1565             __gen_uint(values->fragment_shader_number_of_varyings, 0, 7);
1566 
1567    __gen_emit_reloc(data, &values->fragment_shader_code_address);
1568    cl[ 4] = __gen_address_offset(&values->fragment_shader_code_address);
1569 
1570    cl[ 5] = __gen_address_offset(&values->fragment_shader_code_address) >> 8;
1571 
1572    cl[ 6] = __gen_address_offset(&values->fragment_shader_code_address) >> 16;
1573 
1574    cl[ 7] = __gen_address_offset(&values->fragment_shader_code_address) >> 24;
1575 
1576 
1577    memcpy(&cl[8], &values->fragment_shader_uniforms_address, sizeof(values->fragment_shader_uniforms_address));
1578    cl[12] = __gen_uint(values->vertex_shader_number_of_uniforms_not_used_currently, 0, 15);
1579 
1580    cl[13] = __gen_uint(values->vertex_shader_number_of_uniforms_not_used_currently, 0, 15) >> 8;
1581 
1582    cl[14] = __gen_uint(values->vertex_shader_attribute_array_select_bits, 0, 7);
1583 
1584    cl[15] = __gen_uint(values->vertex_shader_total_attributes_size, 0, 7);
1585 
1586    __gen_emit_reloc(data, &values->vertex_shader_code_address);
1587    cl[16] = __gen_address_offset(&values->vertex_shader_code_address) |
1588             __gen_uint(values->vertex_shader_uniforms_address, 0, 31);
1589 
1590    cl[17] = __gen_address_offset(&values->vertex_shader_code_address) >> 8 |
1591             __gen_uint(values->vertex_shader_uniforms_address, 0, 31) >> 8;
1592 
1593    cl[18] = __gen_address_offset(&values->vertex_shader_code_address) >> 16 |
1594             __gen_uint(values->vertex_shader_uniforms_address, 0, 31) >> 16;
1595 
1596    cl[19] = __gen_address_offset(&values->vertex_shader_code_address) >> 24 |
1597             __gen_uint(values->vertex_shader_uniforms_address, 0, 31) >> 24;
1598 
1599    cl[20] = 0;
1600    cl[21] = 0;
1601    cl[22] = 0;
1602    cl[23] = 0;
1603    cl[24] = __gen_uint(values->coordinate_shader_number_of_uniforms_not_used_currently, 0, 15);
1604 
1605    cl[25] = __gen_uint(values->coordinate_shader_number_of_uniforms_not_used_currently, 0, 15) >> 8;
1606 
1607    cl[26] = __gen_uint(values->coordinate_shader_attribute_array_select_bits, 0, 7);
1608 
1609    cl[27] = __gen_uint(values->coordinate_shader_total_attributes_size, 0, 7);
1610 
1611    __gen_emit_reloc(data, &values->coordinate_shader_code_address);
1612    cl[28] = __gen_address_offset(&values->coordinate_shader_code_address);
1613 
1614    cl[29] = __gen_address_offset(&values->coordinate_shader_code_address) >> 8;
1615 
1616    cl[30] = __gen_address_offset(&values->coordinate_shader_code_address) >> 16;
1617 
1618    cl[31] = __gen_address_offset(&values->coordinate_shader_code_address) >> 24;
1619 
1620 
1621    memcpy(&cl[32], &values->coordinate_shader_uniforms_address, sizeof(values->coordinate_shader_uniforms_address));
1622 }
1623 
1624 #define V3D21_SHADER_RECORD_length            36
1625 #ifdef __gen_unpack_address
1626 static inline void
V3D21_SHADER_RECORD_unpack(const uint8_t * restrict cl,struct V3D21_SHADER_RECORD * restrict values)1627 V3D21_SHADER_RECORD_unpack(const uint8_t * restrict cl,
1628                            struct V3D21_SHADER_RECORD * restrict values)
1629 {
1630    values->fragment_shader_is_single_threaded = __gen_unpack_uint(cl, 0, 0);
1631    values->point_size_included_in_shaded_vertex_data = __gen_unpack_uint(cl, 1, 1);
1632    values->enable_clipping = __gen_unpack_uint(cl, 2, 2);
1633    values->fragment_shader_number_of_uniforms_not_used_currently = __gen_unpack_uint(cl, 16, 31);
1634    values->fragment_shader_number_of_varyings = __gen_unpack_uint(cl, 24, 31);
1635    values->fragment_shader_code_address = __gen_unpack_address(cl, 32, 63);
1636    values->fragment_shader_uniforms_address = __gen_unpack_uint(cl, 64, 95);
1637    values->vertex_shader_number_of_uniforms_not_used_currently = __gen_unpack_uint(cl, 96, 111);
1638    values->vertex_shader_attribute_array_select_bits = __gen_unpack_uint(cl, 112, 119);
1639    values->vertex_shader_total_attributes_size = __gen_unpack_uint(cl, 120, 127);
1640    values->vertex_shader_code_address = __gen_unpack_address(cl, 128, 159);
1641    values->vertex_shader_uniforms_address = __gen_unpack_uint(cl, 128, 159);
1642    values->coordinate_shader_number_of_uniforms_not_used_currently = __gen_unpack_uint(cl, 192, 207);
1643    values->coordinate_shader_attribute_array_select_bits = __gen_unpack_uint(cl, 208, 215);
1644    values->coordinate_shader_total_attributes_size = __gen_unpack_uint(cl, 216, 223);
1645    values->coordinate_shader_code_address = __gen_unpack_address(cl, 224, 255);
1646    values->coordinate_shader_uniforms_address = __gen_unpack_uint(cl, 256, 287);
1647 }
1648 #endif
1649 
1650 
1651 #define V3D21_ATTRIBUTE_RECORD_header           \
1652 
1653 
1654 struct V3D21_ATTRIBUTE_RECORD {
1655    __gen_address_type                   address;
1656    uint32_t                             number_of_bytes_minus_1;
1657    uint32_t                             stride;
1658    uint32_t                             vertex_shader_vpm_offset;
1659    uint32_t                             coordinate_shader_vpm_offset;
1660 };
1661 
1662 static inline void
V3D21_ATTRIBUTE_RECORD_pack(__gen_user_data * data,uint8_t * restrict cl,const struct V3D21_ATTRIBUTE_RECORD * restrict values)1663 V3D21_ATTRIBUTE_RECORD_pack(__gen_user_data *data, uint8_t * restrict cl,
1664                             const struct V3D21_ATTRIBUTE_RECORD * restrict values)
1665 {
1666    __gen_emit_reloc(data, &values->address);
1667    cl[ 0] = __gen_address_offset(&values->address);
1668 
1669    cl[ 1] = __gen_address_offset(&values->address) >> 8;
1670 
1671    cl[ 2] = __gen_address_offset(&values->address) >> 16;
1672 
1673    cl[ 3] = __gen_address_offset(&values->address) >> 24;
1674 
1675    cl[ 4] = __gen_uint(values->number_of_bytes_minus_1, 0, 7);
1676 
1677    cl[ 5] = __gen_uint(values->stride, 0, 7);
1678 
1679    cl[ 6] = __gen_uint(values->vertex_shader_vpm_offset, 0, 7);
1680 
1681    cl[ 7] = __gen_uint(values->coordinate_shader_vpm_offset, 0, 7);
1682 
1683 }
1684 
1685 #define V3D21_ATTRIBUTE_RECORD_length          8
1686 #ifdef __gen_unpack_address
1687 static inline void
V3D21_ATTRIBUTE_RECORD_unpack(const uint8_t * restrict cl,struct V3D21_ATTRIBUTE_RECORD * restrict values)1688 V3D21_ATTRIBUTE_RECORD_unpack(const uint8_t * restrict cl,
1689                               struct V3D21_ATTRIBUTE_RECORD * restrict values)
1690 {
1691    values->address = __gen_unpack_address(cl, 0, 31);
1692    values->number_of_bytes_minus_1 = __gen_unpack_uint(cl, 32, 39);
1693    values->stride = __gen_unpack_uint(cl, 40, 47);
1694    values->vertex_shader_vpm_offset = __gen_unpack_uint(cl, 48, 55);
1695    values->coordinate_shader_vpm_offset = __gen_unpack_uint(cl, 56, 63);
1696 }
1697 #endif
1698 
1699 
1700 #endif /* V3D21_PACK_H */
1701