• 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_INDIRECTELEMENTS_BASE_INSTANCE_DRAWID3_H
25 #define PVR_DRAW_INDIRECTELEMENTS_BASE_INSTANCE_DRAWID3_H
26 
27 /* Initially generated from ARB_draw_indirect_elements.pds */
28 
29 static const uint32_t
30    pvr_draw_indirect_elements_base_instance_drawid3_code[23] = {
31       0xd0000000, /* LD              const[0].64: dst(?) <= mem(?) */
32       0xd1000000, /* WDF              */
33       0x9000a1a0, /* ADD32           ptemp[0].32 = const[2].32 + temp[6].32  */
34       0x9000a1e1, /* ADD32           ptemp[1].32 = const[2].32 + temp[7].32  */
35       0x9030c0e3, /* ADD32           ptemp[3].32 = ptemp[3].32 + const[3].32  */
36       0x04282030, /* MAD             temp[0].64 = (temp[5].32 * const[4].32) +
37                                                   const[6].64 */
38       0x53082808, /* SFTLP32         temp[8].32 = (temp[1].32 | const[5].32) <<
39                    * 0
40                    */
41       0x50040009, /* SFTLP32         temp[9].32 = temp[0].32 << 0 */
42       0x04204050, /* MAD             temp[0].64 = (temp[4].32 * const[8].32) +
43                                                   const[10].64 */
44       0x50040004, /* SFTLP32         temp[4].32 = temp[0].32 << 0 */
45       0x501c180a, /* SFTLP32         temp[10].32 = temp[3].32 << 0 */
46       0x912100cb, /* ADD32           temp[11].32 = temp[4].32 - const[3].32  */
47       0x5034300c, /* SFTLP32         temp[12].32 = temp[6].32 << 0 */
48       0xc8000001, /* BRA             if keep 1 ( setc = p0 ) */
49       0xd1840000, /* LIMM            temp[1].32 = 0000 */
50       0x50242000, /* SFTLP32         temp[0].32 = temp[4].32 << 0 */
51       0xb1800000, /* CMP             P0 = (temp[0].64 = 0000) */
52       0xd9a80000, /* LIMM            ? temp[10].32 = 0000 */
53       0xd9ac0000, /* LIMM            ? temp[11].32 = 0000 */
54       0xd0800006, /* ST              const[12].64: mem(?) <= src(?) */
55       0xd0000007, /* LD              const[14].64: dst(?) <= mem(?) */
56       0xd1000000, /* WDF              */
57       0xf4024003, /* DOUT            doutv = temp[0].64, const[2].32; HALT */
58    };
59 
60 static const struct pvr_psc_program_output
61    pvr_draw_indirect_elements_base_instance_drawid3_program = {
62       pvr_draw_indirect_elements_base_instance_drawid3_code, /* code segment
63                                                               */
64       0, /* constant mappings, zeroed since we use the macros below */
65       7, /* number of constant mappings */
66 
67       16, /* size of data segment, in dwords, aligned to 4 */
68       24, /* size of code segment, in dwords, aligned to 4 */
69       20, /* size of temp segment, in dwords, aligned to 4 */
70       16, /* size of data segment, in dwords */
71       23, /* size of code segment, in dwords */
72       20, /* size of temp segment, in dwords */
73       NULL /* function pointer to write data segment */
74    };
75 
76 #define pvr_write_draw_indirect_elements_base_instance_drawid3_di_data(buffer, \
77                                                                        addr,   \
78                                                                        device) \
79    do {                                                                        \
80       uint64_t data = ((addr) | (0x80000000000ULL) |                           \
81                        ENABLE_SLC_MCU_CACHE_CONTROLS(device));                 \
82       PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ELEMENTS", data, 0);                   \
83       memcpy(buffer + 0, &data, sizeof(data));                                 \
84    } while (0)
85 #define pvr_write_draw_indirect_elements_base_instance_drawid3_write_vdm( \
86    buffer,                                                                \
87    addr)                                                                  \
88    do {                                                                   \
89       uint64_t data = ((addr) | (0x2050000000000ULL));                    \
90       PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ELEMENTS", data, 0);              \
91       memcpy(buffer + 12, &data, sizeof(data));                           \
92    } while (0)
93 #define pvr_write_draw_indirect_elements_base_instance_drawid3_flush_vdm( \
94    buffer,                                                                \
95    addr)                                                                  \
96    do {                                                                   \
97       uint64_t data = ((addr) | (0x3960000000000ULL));                    \
98       PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ELEMENTS", data, 0);              \
99       memcpy(buffer + 14, &data, sizeof(data));                           \
100    } while (0)
101 #define pvr_write_draw_indirect_elements_base_instance_drawid3_idx_stride( \
102    buffer,                                                                 \
103    value)                                                                  \
104    do {                                                                    \
105       uint32_t data = value;                                               \
106       PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ELEMENTS", data, 0);               \
107       memcpy(buffer + 4, &data, sizeof(data));                             \
108    } while (0)
109 #define pvr_write_draw_indirect_elements_base_instance_drawid3_idx_base( \
110    buffer,                                                               \
111    value)                                                                \
112    do {                                                                  \
113       uint64_t data = value;                                             \
114       PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ELEMENTS", data, 0);             \
115       memcpy(buffer + 6, &data, sizeof(data));                           \
116    } while (0)
117 #define pvr_write_draw_indirect_elements_base_instance_drawid3_idx_header( \
118    buffer,                                                                 \
119    value)                                                                  \
120    do {                                                                    \
121       uint32_t data = value;                                               \
122       PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ELEMENTS", data, 0);               \
123       memcpy(buffer + 5, &data, sizeof(data));                             \
124    } while (0)
125 #define pvr_write_draw_indirect_elements_base_instance_drawid3_num_views( \
126    buffer,                                                                \
127    value)                                                                 \
128    do {                                                                   \
129       uint32_t data = value;                                              \
130       PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ELEMENTS", data, 0);              \
131       memcpy(buffer + 8, &data, sizeof(data));                            \
132    } while (0)
133 #define pvr_write_draw_indirect_elements_base_instance_drawid3_immediates( \
134    buffer)                                                                 \
135    do {                                                                    \
136       {                                                                    \
137          uint32_t data = 0x0;                                              \
138          PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ELEMENTS", data, 0);            \
139          memcpy(buffer + 2, &data, sizeof(data));                          \
140       }                                                                    \
141       {                                                                    \
142          uint32_t data = 0x1;                                              \
143          PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ELEMENTS", data, 0);            \
144          memcpy(buffer + 3, &data, sizeof(data));                          \
145       }                                                                    \
146       {                                                                    \
147          uint64_t data = 0x0;                                              \
148          PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ELEMENTS", data, 0);            \
149          memcpy(buffer + 10, &data, sizeof(data));                         \
150       }                                                                    \
151    } while (0)
152 #endif
153