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_INSTANCE_DRAWID3_H 25 #define PVR_DRAW_INDIRECTARRAYS_BASE_INSTANCE_DRAWID3_H 26 27 /* Initially generated from ARB_draw_indirect_arrays.pds */ 28 29 static const uint32_t pvr_draw_indirect_arrays_base_instance_drawid3_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 0x9030c0e3, /* ADD32 ptemp[3].32 = ptemp[3].32 + const[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_instance_drawid3_program = { 53 pvr_draw_indirect_arrays_base_instance_drawid3_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_instance_drawid3_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_instance_drawid3_write_vdm(buffer, \ 76 addr) \ 77 do { \ 78 uint64_t data = ((addr) | (0xc30000000000ULL)); \ 79 PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ARRAYS", data, 0); \ 80 memcpy(buffer + 8, &data, sizeof(data)); \ 81 } while (0) 82 #define pvr_write_draw_indirect_arrays_base_instance_drawid3_flush_vdm(buffer, \ 83 addr) \ 84 do { \ 85 uint64_t data = ((addr) | (0x2140000000000ULL)); \ 86 PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ARRAYS", data, 0); \ 87 memcpy(buffer + 10, &data, sizeof(data)); \ 88 } while (0) 89 #define pvr_write_draw_indirect_arrays_base_instance_drawid3_num_views(buffer, \ 90 value) \ 91 do { \ 92 uint32_t data = value; \ 93 PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ARRAYS", data, 0); \ 94 memcpy(buffer + 2, &data, sizeof(data)); \ 95 } while (0) 96 #define pvr_write_draw_indirect_arrays_base_instance_drawid3_immediates( \ 97 buffer) \ 98 do { \ 99 { \ 100 uint64_t data = 0x0; \ 101 PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ARRAYS", data, 0); \ 102 memcpy(buffer + 4, &data, sizeof(data)); \ 103 } \ 104 { \ 105 uint32_t data = 0x1; \ 106 PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ARRAYS", data, 0); \ 107 memcpy(buffer + 3, &data, sizeof(data)); \ 108 } \ 109 { \ 110 uint32_t data = 0x0; \ 111 PVR_PDS_PRINT_DATA("DRAW_INDIRECT_ARRAYS", data, 0); \ 112 memcpy(buffer + 6, &data, sizeof(data)); \ 113 } \ 114 } while (0) 115 #endif 116