| 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_INDIRECTARRAYS1_H |
| 25 |
#define PVR_DRAW_INDIRECTARRAYS1_H |
| 26 |
|
| 27 |
/* Initially generated from ARB_draw_indirect_arrays.pds */ |
| 28 |
|
| 29 |
static const uint32_t pvr_draw_indirect_arrays1_code[15] = { |
| 30 |
0xd0000000, /* LD const[0].64: dst(?) <= mem(?) */ |
| 31 |
0xd1000000, /* WDF */ |
| 32 |
0xc8000001, /* BRA if keep 1 ( setc = p0 ) */ |
| 33 |
0xd1940000, /* LIMM temp[5].32 = 0000 */ |
| 34 |
0x50141004, /* SFTLP32 temp[4].32 = temp[2].32 << 0 */ |
| 35 |
0xb1880000, /* CMP P0 = (temp[4].64 = 0000) */ |
| 36 |
0xd9840000, /* LIMM ? temp[1].32 = 0000 */ |
| 37 |
0xd9880000, /* LIMM ? temp[2].32 = 0000 */ |
| 38 |
0x04101023, /* MAD temp[6].64 = (temp[2].32 * const[2].32) + |
| 39 |
const[4].64 */ |
| 40 |
0x50343002, /* SFTLP32 temp[2].32 = temp[6].32 << 0 */ |
| 41 |
0x912080c2, /* ADD32 temp[2].32 = temp[2].32 - const[3].32 */ |
| 42 |
0xd0800003, /* ST const[6].64: mem(?) <= src(?) */ |
| 43 |
0xd0000004, /* LD const[8].64: dst(?) <= mem(?) */ |
| 44 |
0xd1000000, /* WDF */ |
| 45 |
0xf40a4003, /* DOUT doutv = temp[0].64, const[10].32; HALT */ |
| 46 |
}; |
| 47 |
|
| 48 |
static const struct pvr_psc_program_output pvr_draw_indirect_arrays1_program = { |
| 49 |
pvr_draw_indirect_arrays1_code, /* code segment */ |
| 50 |
0, /* constant mappings, zeroed since we use the macros below */ |
| 51 |
4, /* number of constant mappings */ |
| 52 |
|
| 53 |
12, /* size of data segment, in dwords, aligned to 4 */ |
| 54 |
16, /* size of code segment, in dwords, aligned to 4 */ |
| 55 |
12, /* size of temp segment, in dwords, aligned to 4 */ |
| 56 |
11, /* size of data segment, in dwords */ |
| 57 |
15, /* size of code segment, in dwords */ |
| 58 |
10, /* size of temp segment, in dwords */ |
| 59 |
NULL /* function pointer to write data segment */ |
| 60 |
}; |
| 61 |
|
| 62 |
#define pvr_write_draw_indirect_arrays1_di_data(buffer, addr, device) \ |
| 63 |
do { \ |
| 64 |
uint64_t data = ((addr) | (0x40000000000ULL) | \ |
| 65 |
ENABLE_SLC_MCU_CACHE_CONTROLS(device)); \ |
| 66 |
PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ARRAYS", data, 0); \ |
| 67 |
memcpy(buffer + 0, &data, sizeof(data)); \ |
| 68 |
} while (0) |
| 69 |
#define pvr_write_draw_indirect_arrays1_write_vdm(buffer, addr) \ |
| 70 |
do { \ |
| 71 |
uint64_t data = ((addr) | (0x430000000000ULL)); \ |
| 72 |
PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ARRAYS", data, 0); \ |
| 73 |
memcpy(buffer + 6, &data, sizeof(data)); \ |
| 74 |
} while (0) |
| 75 |
#define pvr_write_draw_indirect_arrays1_flush_vdm(buffer, addr) \ |
| 76 |
do { \ |
| 77 |
uint64_t data = ((addr) | (0x1940000000000ULL)); \ |
| 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_arrays1_num_views(buffer, value) \ |
| 82 |
do { \ |
| 83 |
uint32_t data = value; \ |
| 84 |
PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ARRAYS", data, 0); \ |
| 85 |
memcpy(buffer + 2, &data, sizeof(data)); \ |
| 86 |
} while (0) |
| 87 |
#define pvr_write_draw_indirect_arrays1_immediates(buffer) \ |
| 88 |
do { \ |
| 89 |
{ \ |
| 90 |
uint64_t data = 0x0; \ |
| 91 |
PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ARRAYS", data, 0); \ |
| 92 |
memcpy(buffer + 4, &data, sizeof(data)); \ |
| 93 |
} \ |
| 94 |
{ \ |
| 95 |
uint32_t data = 0x1; \ |
| 96 |
PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ARRAYS", data, 0); \ |
| 97 |
memcpy(buffer + 3, &data, sizeof(data)); \ |
| 98 |
} \ |
| 99 |
{ \ |
| 100 |
uint32_t data = 0x0; \ |
| 101 |
PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ARRAYS", data, 0); \ |
| 102 |
memcpy(buffer + 10, &data, sizeof(data)); \ |
| 103 |
} \ |
| 104 |
} while (0) |
| 105 |
#endif |