• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2022 Imagination Technologies Ltd.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21  * SOFTWARE.
22  */
23 
24 #ifndef PVR_DRAW_INDIRECTARRAYS_BASE_INSTANCE3_H
25 #define PVR_DRAW_INDIRECTARRAYS_BASE_INSTANCE3_H
26 
27 /* Initially generated from ARB_draw_indirect_arrays.pds */
28 
29 static const uint32_t pvr_draw_indirect_arrays_base_instance3_code[18] = {
30    0xd0000000, /* LD              const[0].64: dst(?) <= mem(?) */
31    0xd1000000, /* WDF              */
32    0xc8000001, /* BRA             if keep 1 ( setc = p0 ) */
33    0xd1840000, /* LIMM            temp[1].32 = 0000 */
34    0x50242000, /* SFTLP32         temp[0].32 = temp[4].32 << 0 */
35    0xb1800000, /* CMP             P0 = (temp[0].64 = 0000) */
36    0xd98c0000, /* LIMM            ? temp[3].32 = 0000 */
37    0xd9900000, /* LIMM            ? temp[4].32 = 0000 */
38    0x04201024, /* MAD             temp[8].64 = (temp[4].32 * const[2].32) +
39                                                const[4].64 */
40    0x50444004, /* SFTLP32         temp[4].32 = temp[8].32 << 0 */
41    0x912100c4, /* ADD32           temp[4].32 = temp[4].32 - const[3].32  */
42    0x9001a160, /* ADD32           ptemp[0].32 = const[6].32 + temp[5].32  */
43    0xd0800004, /* ST              const[8].64: mem(?) <= src(?) */
44    0x9001a1a1, /* ADD32           ptemp[1].32 = const[6].32 + temp[6].32  */
45    0x9130f0e3, /* ADD32           ptemp[3].32 = ptemp[3].32 - ptemp[3].32  */
46    0xd0000005, /* LD              const[10].64: dst(?) <= mem(?) */
47    0xd1000000, /* WDF              */
48    0xf4064003, /* DOUT            doutv = temp[0].64, const[6].32; HALT */
49 };
50 
51 static const struct pvr_psc_program_output
52    pvr_draw_indirect_arrays_base_instance3_program = {
53       pvr_draw_indirect_arrays_base_instance3_code, /* code segment */
54       0, /* constant mappings, zeroed since we use the macros below */
55       4, /* number of constant mappings */
56 
57       12, /* size of data segment, in dwords, aligned to 4 */
58       20, /* size of code segment, in dwords, aligned to 4 */
59       12, /* size of temp segment, in dwords, aligned to 4 */
60       12, /* size of data segment, in dwords */
61       18, /* size of code segment, in dwords */
62       12, /* size of temp segment, in dwords */
63       NULL /* function pointer to write data segment */
64    };
65 
66 #define pvr_write_draw_indirect_arrays_base_instance3_di_data(buffer, \
67                                                               addr,   \
68                                                               device) \
69    do {                                                               \
70       uint64_t data = ((addr) | (0x80000000000ULL) |                  \
71                        ENABLE_SLC_MCU_CACHE_CONTROLS(device));        \
72       PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ARRAYS", data, 0);            \
73       memcpy(buffer + 0, &data, sizeof(data));                        \
74    } while (0)
75 #define pvr_write_draw_indirect_arrays_base_instance3_write_vdm(buffer, addr) \
76    do {                                                                       \
77       uint64_t data = ((addr) | (0xc30000000000ULL));                         \
78       PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ARRAYS", data, 0);                    \
79       memcpy(buffer + 8, &data, sizeof(data));                                \
80    } while (0)
81 #define pvr_write_draw_indirect_arrays_base_instance3_flush_vdm(buffer, addr) \
82    do {                                                                       \
83       uint64_t data = ((addr) | (0x2140000000000ULL));                        \
84       PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ARRAYS", data, 0);                    \
85       memcpy(buffer + 10, &data, sizeof(data));                               \
86    } while (0)
87 #define pvr_write_draw_indirect_arrays_base_instance3_num_views(buffer, value) \
88    do {                                                                        \
89       uint32_t data = value;                                                   \
90       PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ARRAYS", data, 0);                     \
91       memcpy(buffer + 2, &data, sizeof(data));                                 \
92    } while (0)
93 #define pvr_write_draw_indirect_arrays_base_instance3_immediates(buffer) \
94    do {                                                                  \
95       {                                                                  \
96          uint64_t data = 0x0;                                            \
97          PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ARRAYS", data, 0);            \
98          memcpy(buffer + 4, &data, sizeof(data));                        \
99       }                                                                  \
100       {                                                                  \
101          uint32_t data = 0x1;                                            \
102          PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ARRAYS", data, 0);            \
103          memcpy(buffer + 3, &data, sizeof(data));                        \
104       }                                                                  \
105       {                                                                  \
106          uint32_t data = 0x0;                                            \
107          PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ARRAYS", data, 0);            \
108          memcpy(buffer + 6, &data, sizeof(data));                        \
109       }                                                                  \
110    } while (0)
111 #endif
112