| 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 |
/* This file is based on rgxdefs.h and should only contain object-like macros. |
| 25 |
* Any function-like macros or inline functions should instead appear in |
| 26 |
* rogue_hw_utils.h. |
| 27 |
*/ |
| 28 |
|
| 29 |
#ifndef ROGUE_HW_DEFS_H |
| 30 |
#define ROGUE_HW_DEFS_H |
| 31 |
|
| 32 |
#include <stdint.h> |
| 33 |
|
| 34 |
#include "util/macros.h" |
| 35 |
|
| 36 |
#define ROGUE_BIF_PM_PHYSICAL_PAGE_SHIFT 12U |
| 37 |
#define ROGUE_BIF_PM_PHYSICAL_PAGE_SIZE \ |
| 38 |
BITFIELD_BIT(ROGUE_BIF_PM_PHYSICAL_PAGE_SHIFT) |
| 39 |
|
| 40 |
/* ISP triangle merging constants. */ |
| 41 |
/* tan(15) (0x3E8930A3) */ |
| 42 |
#define ROGUE_ISP_MERGE_LOWER_LIMIT_NUMERATOR 0.267949f |
| 43 |
/* tan(60) (0x3FDDB3D7) */ |
| 44 |
#define ROGUE_ISP_MERGE_UPPER_LIMIT_NUMERATOR 1.732051f |
| 45 |
#define ROGUE_ISP_MERGE_SCALE_FACTOR 16.0f |
| 46 |
|
| 47 |
#define ROGUE_MAX_INSTR_BYTES 32U |
| 48 |
|
| 49 |
#define ROGUE_ICACHE_ALIGN 8U |
| 50 |
|
| 51 |
#define ROGUE_OQUERY_ALIGN 16U |
| 52 |
|
| 53 |
#define ROGUE_MAX_ALU_INPUTS 6U |
| 54 |
#define ROGUE_ALU_INPUT_GROUP_SIZE (ROGUE_MAX_ALU_INPUTS / 2) |
| 55 |
#define ROGUE_MAX_ALU_OUTPUTS 2U |
| 56 |
#define ROGUE_MAX_ALU_INTERNAL_SOURCES 6U |
| 57 |
|
| 58 |
/* MList entry stride in bytes */ |
| 59 |
#define ROGUE_MLIST_ENTRY_STRIDE 4U |
| 60 |
|
| 61 |
/* VCE & TE share virtual space and Alist. */ |
| 62 |
#define ROGUE_NUM_PM_ADDRESS_SPACES 2U |
| 63 |
|
| 64 |
/* PM Maximum addressable limit (as determined by the size field of the |
| 65 |
* PM_*_FSTACK registers). |
| 66 |
*/ |
| 67 |
#define ROGUE_PM_MAX_PB_VIRT_ADDR_SPACE UINT64_C(0x400000000) |
| 68 |
|
| 69 |
/* Vheap entry size in bytes. */ |
| 70 |
#define ROGUE_PM_VHEAP_ENTRY_SIZE 4U |
| 71 |
|
| 72 |
#define ROGUE_RTC_SIZE_IN_BYTES 256U |
| 73 |
|
| 74 |
#define ROGUE_NUM_VCE 1U |
| 75 |
|
| 76 |
#define ROGUE_NUM_TEAC 1U |
| 77 |
|
| 78 |
#define ROGUE_NUM_TE 1U |
| 79 |
|
| 80 |
/* Tail pointer size in bytes. */ |
| 81 |
#define ROGUE_TAIL_POINTER_SIZE 8U |
| 82 |
|
| 83 |
/* Tail pointer cache line size. */ |
| 84 |
#define ROGUE_TE_TPC_CACHE_LINE_SIZE 64U |
| 85 |
|
| 86 |
#define ROGUE_MAX_VERTEX_SHARED_REGISTERS 1024U |
| 87 |
|
| 88 |
#define ROGUE_MAX_PIXEL_SHARED_REGISTERS 1024U |
| 89 |
|
| 90 |
#define ROGUE_MAX_COMPUTE_SHARED_REGISTERS (2U * 1024U) |
| 91 |
|
| 92 |
/* Number of CR_PDS_BGRND values that need setting up. */ |
| 93 |
#define ROGUE_NUM_CR_PDS_BGRND_WORDS 3U |
| 94 |
|
| 95 |
/* Number of PBESTATE_REG_WORD values that need setting up. */ |
| 96 |
#define ROGUE_NUM_PBESTATE_REG_WORDS 3U |
| 97 |
|
| 98 |
/* Number of PBESTATE_REG_WORD used in transfer. |
| 99 |
* The last word is not used. |
| 100 |
*/ |
| 101 |
#define ROGUE_NUM_PBESTATE_REG_WORDS_FOR_TRANSFER 2U |
| 102 |
|
| 103 |
/* Number of PBESTATE_STATE_WORD values that need setting up. */ |
| 104 |
#define ROGUE_NUM_PBESTATE_STATE_WORDS 2U |
| 105 |
|
| 106 |
/* Number of TEXSTATE_IMAGE_WORD values that need setting up. */ |
| 107 |
#define ROGUE_NUM_TEXSTATE_IMAGE_WORDS 2U |
| 108 |
|
| 109 |
/* Number of TEXSTATE_SAMPLER state words that need setting up. */ |
| 110 |
#define ROGUE_NUM_TEXSTATE_SAMPLER_WORDS 2U |
| 111 |
|
| 112 |
#define ROGUE_NUM_TEXSTATE_DWORDS 4U |
| 113 |
|
| 114 |
/* 12 dwords reserved for shared register management. The first dword is the |
| 115 |
* number of shared register blocks to reload. Should be a multiple of 4 dwords, |
| 116 |
* size in bytes. |
| 117 |
*/ |
| 118 |
#define ROGUE_LLS_SHARED_REGS_RESERVE_SIZE 48U |
| 119 |
|
| 120 |
#define ROGUE_CSRM_LINE_SIZE_IN_DWORDS (64U * 4U * 4U) |
| 121 |
|
| 122 |
/* The maximum amount of local memory which can be allocated by a single kernel |
| 123 |
* (in dwords/32-bit registers). |
| 124 |
* |
| 125 |
* ROGUE_CDMCTRL_USC_COMMON_SIZE_UNIT_SIZE is in bytes so we divide by four. |
| 126 |
*/ |
| 127 |
#define ROGUE_MAX_PER_KERNEL_LOCAL_MEM_SIZE_REGS \ |
| 128 |
((ROGUE_CDMCTRL_KERNEL0_USC_COMMON_SIZE_UNIT_SIZE * \ |
| 129 |
ROGUE_CDMCTRL_KERNEL0_USC_COMMON_SIZE_MAX_SIZE) >> \ |
| 130 |
2) |
| 131 |
|
| 132 |
#define ROGUE_MAX_INSTANCES_PER_TASK \ |
| 133 |
(ROGUE_CDMCTRL_KERNEL8_MAX_INSTANCES_MAX_SIZE + 1U) |
| 134 |
|
| 135 |
/* Optimal number for packing work groups into a slot. */ |
| 136 |
#define ROGUE_CDM_MAX_PACKED_WORKGROUPS_PER_TASK 8U |
| 137 |
|
| 138 |
/* The maximum number of pixel task instances which might be running overlapped |
| 139 |
* with compute. Once we have 8 pixel task instances we have a complete set and |
| 140 |
* task will be able to run and allocations will be freed. |
| 141 |
*/ |
| 142 |
#define ROGUE_MAX_OVERLAPPED_PIXEL_TASK_INSTANCES 7U |
| 143 |
|
| 144 |
/* Size of the image state in 64-bit units. */ |
| 145 |
#define ROGUE_MAXIMUM_IMAGE_STATE_SIZE_IN_ULONGLONGS 2U |
| 146 |
|
| 147 |
/* Size of the image state in dwords. The last 64-bit word is optional for |
| 148 |
* non-YUV textures. |
| 149 |
*/ |
| 150 |
#define ROGUE_MAXIMUM_IMAGE_STATE_SIZE \ |
| 151 |
(ROGUE_MAXIMUM_IMAGE_STATE_SIZE_IN_ULONGLONGS * \ |
| 152 |
(sizeof(uint64_t) / sizeof(uint32_t))) |
| 153 |
|
| 154 |
#define PVR_NUM_PBE_EMIT_REGS 8U |
| 155 |
|
| 156 |
#define ROGUE_USRM_GRANULARITY_IN_REGISTERS 4U |
| 157 |
|
| 158 |
#define ROGUE_RESERVED_USRM_LINES 2U |
| 159 |
|
| 160 |
#define ROGUE_USC_NUM_UNIFIED_STORE_BANKS 8U |
| 161 |
|
| 162 |
#define ROGUE_PDS_US_REGISTER_ALLOCATION_GRANULARITY 8U |
| 163 |
|
| 164 |
#define ROGUE_PDS_US_TEMP_ALLOCATION_GRANULARITY \ |
| 165 |
ROGUE_PDS_US_REGISTER_ALLOCATION_GRANULARITY |
| 166 |
|
| 167 |
#define ROGUE_USRM_LINE_SIZE 16U |
| 168 |
|
| 169 |
#define ROGUE_USRM_LINE_SIZE_PER_INSTANCE \ |
| 170 |
(ROGUE_PDS_US_TEMP_ALLOCATION_GRANULARITY * ROGUE_USRM_LINE_SIZE) |
| 171 |
|
| 172 |
enum { |
| 173 |
ROGUE_USC_COEFFICIENT_SET_A = 0, |
| 174 |
ROGUE_USC_COEFFICIENT_SET_B, |
| 175 |
ROGUE_USC_COEFFICIENT_SET_C, |
| 176 |
ROGUE_USC_COEFFICIENT_SET_PAD, |
| 177 |
ROGUE_USC_COEFFICIENT_SET_SIZE, |
| 178 |
}; |
| 179 |
|
| 180 |
enum { |
| 181 |
ROGUE_SMP_COEFF_UFRAC = 0, |
| 182 |
ROGUE_SMP_COEFF_VFRAC, |
| 183 |
ROGUE_SMP_COEFF_SFRAC, |
| 184 |
ROGUE_SMP_COEFF_LOD_DVAL_POST_CLAMP, |
| 185 |
ROGUE_SMP_COEFF_LOD_DVAL_PRE_CLAMP, |
| 186 |
ROGUE_SMP_COEFF_TFRAC_POST_CLAMP, |
| 187 |
ROGUE_SMP_COEFF_TFRAC_PRE_CLAMP, |
| 188 |
ROGUE_SMP_COEFF_COUNT, |
| 189 |
}; |
| 190 |
|
| 191 |
#define ROGUE_SMP_MAX_DATA_WORDS 18U |
| 192 |
|
| 193 |
#define ROGUE_SMP_LOOKUP_MS_NUM_START 16U |
| 194 |
#define ROGUE_SMP_LOOKUP_MS_NUM_BITS 3U |
| 195 |
|
| 196 |
#define ROGUE_SMP_LOOKUP_W_OFF_START 12U |
| 197 |
#define ROGUE_SMP_LOOKUP_W_OFF_BITS 4U |
| 198 |
|
| 199 |
#define ROGUE_SMP_LOOKUP_V_OFF_START 6U |
| 200 |
#define ROGUE_SMP_LOOKUP_V_OFF_BITS 6U |
| 201 |
|
| 202 |
#define ROGUE_SMP_LOOKUP_U_OFF_START 0U |
| 203 |
#define ROGUE_SMP_LOOKUP_U_OFF_BITS 6U |
| 204 |
|
| 205 |
#define ROGUE_REG_SIZE_BYTES 4U |
| 206 |
|
| 207 |
#endif /* ROGUE_HW_DEFS_H */ |