1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Copyright © 2022 Imagination Technologies Ltd. 3bf215546Sopenharmony_ci * 4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a copy 5bf215546Sopenharmony_ci * of this software and associated documentation files (the "Software"), to deal 6bf215546Sopenharmony_ci * in the Software without restriction, including without limitation the rights 7bf215546Sopenharmony_ci * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8bf215546Sopenharmony_ci * copies of the Software, and to permit persons to whom the Software is 9bf215546Sopenharmony_ci * furnished to do so, subject to the following conditions: 10bf215546Sopenharmony_ci * 11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next 12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 13bf215546Sopenharmony_ci * Software. 14bf215546Sopenharmony_ci * 15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18bf215546Sopenharmony_ci * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20bf215546Sopenharmony_ci * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21bf215546Sopenharmony_ci * SOFTWARE. 22bf215546Sopenharmony_ci */ 23bf215546Sopenharmony_ci 24bf215546Sopenharmony_ci/* This file is based on rgxdefs.h and should only contain object-like macros. 25bf215546Sopenharmony_ci * Any function-like macros or inline functions should instead appear in 26bf215546Sopenharmony_ci * rogue_hw_utils.h. 27bf215546Sopenharmony_ci */ 28bf215546Sopenharmony_ci 29bf215546Sopenharmony_ci#ifndef ROGUE_HW_DEFS_H 30bf215546Sopenharmony_ci#define ROGUE_HW_DEFS_H 31bf215546Sopenharmony_ci 32bf215546Sopenharmony_ci#include <stdint.h> 33bf215546Sopenharmony_ci 34bf215546Sopenharmony_ci#include "util/macros.h" 35bf215546Sopenharmony_ci 36bf215546Sopenharmony_ci#define ROGUE_BIF_PM_PHYSICAL_PAGE_SHIFT 12U 37bf215546Sopenharmony_ci#define ROGUE_BIF_PM_PHYSICAL_PAGE_SIZE \ 38bf215546Sopenharmony_ci BITFIELD_BIT(ROGUE_BIF_PM_PHYSICAL_PAGE_SHIFT) 39bf215546Sopenharmony_ci 40bf215546Sopenharmony_ci/* ISP triangle merging constants. */ 41bf215546Sopenharmony_ci/* tan(15) (0x3E8930A3) */ 42bf215546Sopenharmony_ci#define ROGUE_ISP_MERGE_LOWER_LIMIT_NUMERATOR 0.267949f 43bf215546Sopenharmony_ci/* tan(60) (0x3FDDB3D7) */ 44bf215546Sopenharmony_ci#define ROGUE_ISP_MERGE_UPPER_LIMIT_NUMERATOR 1.732051f 45bf215546Sopenharmony_ci#define ROGUE_ISP_MERGE_SCALE_FACTOR 16.0f 46bf215546Sopenharmony_ci 47bf215546Sopenharmony_ci#define ROGUE_MAX_INSTR_BYTES 32U 48bf215546Sopenharmony_ci 49bf215546Sopenharmony_ci/* MList entry stride in bytes */ 50bf215546Sopenharmony_ci#define ROGUE_MLIST_ENTRY_STRIDE 4U 51bf215546Sopenharmony_ci 52bf215546Sopenharmony_ci/* VCE & TE share virtual space and Alist. */ 53bf215546Sopenharmony_ci#define ROGUE_NUM_PM_ADDRESS_SPACES 2U 54bf215546Sopenharmony_ci 55bf215546Sopenharmony_ci/* PM Maximum addressable limit (as determined by the size field of the 56bf215546Sopenharmony_ci * PM_*_FSTACK registers). 57bf215546Sopenharmony_ci */ 58bf215546Sopenharmony_ci#define ROGUE_PM_MAX_PB_VIRT_ADDR_SPACE UINT64_C(0x400000000) 59bf215546Sopenharmony_ci 60bf215546Sopenharmony_ci/* Vheap entry size in bytes. */ 61bf215546Sopenharmony_ci#define ROGUE_PM_VHEAP_ENTRY_SIZE 4U 62bf215546Sopenharmony_ci 63bf215546Sopenharmony_ci#define ROGUE_RTC_SIZE_IN_BYTES 256U 64bf215546Sopenharmony_ci 65bf215546Sopenharmony_ci#define ROGUE_NUM_VCE 1U 66bf215546Sopenharmony_ci 67bf215546Sopenharmony_ci#define ROGUE_NUM_TEAC 1U 68bf215546Sopenharmony_ci 69bf215546Sopenharmony_ci#define ROGUE_NUM_TE 1U 70bf215546Sopenharmony_ci 71bf215546Sopenharmony_ci/* Tail pointer size in bytes. */ 72bf215546Sopenharmony_ci#define ROGUE_TAIL_POINTER_SIZE 8U 73bf215546Sopenharmony_ci 74bf215546Sopenharmony_ci/* Tail pointer cache line size. */ 75bf215546Sopenharmony_ci#define ROGUE_TE_TPC_CACHE_LINE_SIZE 64U 76bf215546Sopenharmony_ci 77bf215546Sopenharmony_ci#define ROGUE_MAX_VERTEX_SHARED_REGISTERS 1024U 78bf215546Sopenharmony_ci 79bf215546Sopenharmony_ci#define ROGUE_MAX_PIXEL_SHARED_REGISTERS 1024U 80bf215546Sopenharmony_ci 81bf215546Sopenharmony_ci/* Number of CR_PDS_BGRND values that need setting up. */ 82bf215546Sopenharmony_ci#define ROGUE_NUM_CR_PDS_BGRND_WORDS 3U 83bf215546Sopenharmony_ci 84bf215546Sopenharmony_ci/* Number of PBESTATE_REG_WORD values that need setting up. */ 85bf215546Sopenharmony_ci#define ROGUE_NUM_PBESTATE_REG_WORDS 3U 86bf215546Sopenharmony_ci 87bf215546Sopenharmony_ci/* Number of PBESTATE_STATE_WORD values that need setting up. */ 88bf215546Sopenharmony_ci#define ROGUE_NUM_PBESTATE_STATE_WORDS 2U 89bf215546Sopenharmony_ci 90bf215546Sopenharmony_ci/* Number of TEXSTATE_IMAGE_WORD values that need setting up. */ 91bf215546Sopenharmony_ci#define ROGUE_NUM_TEXSTATE_IMAGE_WORDS 2U 92bf215546Sopenharmony_ci 93bf215546Sopenharmony_ci/* Number of TEXSTATE_SAMPLER state words that need setting up. */ 94bf215546Sopenharmony_ci#define ROGUE_NUM_TEXSTATE_SAMPLER_WORDS 2U 95bf215546Sopenharmony_ci 96bf215546Sopenharmony_ci#define ROGUE_MAX_RENDER_TARGETS 2048U 97bf215546Sopenharmony_ci 98bf215546Sopenharmony_ci/* 12 dwords reserved for shared register management. The first dword is the 99bf215546Sopenharmony_ci * number of shared register blocks to reload. Should be a multiple of 4 dwords, 100bf215546Sopenharmony_ci * size in bytes. 101bf215546Sopenharmony_ci */ 102bf215546Sopenharmony_ci#define ROGUE_LLS_SHARED_REGS_RESERVE_SIZE 48U 103bf215546Sopenharmony_ci 104bf215546Sopenharmony_ci#define ROGUE_USC_TASK_PROGRAM_SIZE 512U 105bf215546Sopenharmony_ci 106bf215546Sopenharmony_ci#define ROGUE_CSRM_LINE_SIZE_IN_DWORDS (64U * 4U * 4U) 107bf215546Sopenharmony_ci 108bf215546Sopenharmony_ci/* The maximum amount of local memory which can be allocated by a single kernel 109bf215546Sopenharmony_ci * (in dwords/32-bit registers). 110bf215546Sopenharmony_ci * 111bf215546Sopenharmony_ci * ROGUE_CDMCTRL_USC_COMMON_SIZE_UNIT_SIZE is in bytes so we divide by four. 112bf215546Sopenharmony_ci */ 113bf215546Sopenharmony_ci#define ROGUE_MAX_PER_KERNEL_LOCAL_MEM_SIZE_REGS \ 114bf215546Sopenharmony_ci ((ROGUE_CDMCTRL_KERNEL0_USC_COMMON_SIZE_UNIT_SIZE * \ 115bf215546Sopenharmony_ci ROGUE_CDMCTRL_KERNEL0_USC_COMMON_SIZE_MAX_SIZE) >> \ 116bf215546Sopenharmony_ci 2) 117bf215546Sopenharmony_ci 118bf215546Sopenharmony_ci#define ROGUE_MAX_INSTANCES_PER_TASK \ 119bf215546Sopenharmony_ci (ROGUE_CDMCTRL_KERNEL8_MAX_INSTANCES_MAX_SIZE + 1U) 120bf215546Sopenharmony_ci 121bf215546Sopenharmony_ci/* Optimal number for packing work groups into a slot. */ 122bf215546Sopenharmony_ci#define ROGUE_CDM_MAX_PACKED_WORKGROUPS_PER_TASK 8U 123bf215546Sopenharmony_ci 124bf215546Sopenharmony_ci/* The maximum number of pixel task instances which might be running overlapped 125bf215546Sopenharmony_ci * with compute. Once we have 8 pixel task instances we have a complete set and 126bf215546Sopenharmony_ci * task will be able to run and allocations will be freed. 127bf215546Sopenharmony_ci */ 128bf215546Sopenharmony_ci#define ROGUE_MAX_OVERLAPPED_PIXEL_TASK_INSTANCES 7U 129bf215546Sopenharmony_ci 130bf215546Sopenharmony_ci#endif /* ROGUE_HW_DEFS_H */ 131