1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Copyright © 2016 Red Hat. 3bf215546Sopenharmony_ci * Copyright © 2016 Bas Nieuwenhuizen 4bf215546Sopenharmony_ci * 5bf215546Sopenharmony_ci * based in part on anv driver which is: 6bf215546Sopenharmony_ci * Copyright © 2015 Intel Corporation 7bf215546Sopenharmony_ci * 8bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 9bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 10bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation 11bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 12bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 13bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 14bf215546Sopenharmony_ci * 15bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next 16bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 17bf215546Sopenharmony_ci * Software. 18bf215546Sopenharmony_ci * 19bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 22bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24bf215546Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 25bf215546Sopenharmony_ci * IN THE SOFTWARE. 26bf215546Sopenharmony_ci */ 27bf215546Sopenharmony_ci 28bf215546Sopenharmony_ci#ifndef RADV_CONSTANTS_H 29bf215546Sopenharmony_ci#define RADV_CONSTANTS_H 30bf215546Sopenharmony_ci 31bf215546Sopenharmony_ci#define ATI_VENDOR_ID 0x1002 32bf215546Sopenharmony_ci 33bf215546Sopenharmony_ci#define MAX_VBS 32 34bf215546Sopenharmony_ci#define MAX_VERTEX_ATTRIBS 32 35bf215546Sopenharmony_ci#define MAX_RTS 8 36bf215546Sopenharmony_ci#define MAX_VIEWPORTS 16 37bf215546Sopenharmony_ci#define MAX_SCISSORS 16 38bf215546Sopenharmony_ci#define MAX_DISCARD_RECTANGLES 4 39bf215546Sopenharmony_ci#define MAX_SAMPLE_LOCATIONS 32 40bf215546Sopenharmony_ci#define MAX_PUSH_CONSTANTS_SIZE 256 41bf215546Sopenharmony_ci#define MAX_PUSH_DESCRIPTORS 32 42bf215546Sopenharmony_ci#define MAX_DYNAMIC_UNIFORM_BUFFERS 16 43bf215546Sopenharmony_ci#define MAX_DYNAMIC_STORAGE_BUFFERS 8 44bf215546Sopenharmony_ci#define MAX_DYNAMIC_BUFFERS (MAX_DYNAMIC_UNIFORM_BUFFERS + MAX_DYNAMIC_STORAGE_BUFFERS) 45bf215546Sopenharmony_ci#define MAX_SAMPLES_LOG2 4 46bf215546Sopenharmony_ci#define NUM_META_FS_KEYS 12 47bf215546Sopenharmony_ci#define RADV_MAX_DRM_DEVICES 8 48bf215546Sopenharmony_ci#define MAX_VIEWS 8 49bf215546Sopenharmony_ci#define MAX_SO_STREAMS 4 50bf215546Sopenharmony_ci#define MAX_SO_BUFFERS 4 51bf215546Sopenharmony_ci#define MAX_SO_OUTPUTS 64 52bf215546Sopenharmony_ci#define MAX_INLINE_UNIFORM_BLOCK_SIZE (4ull * 1024 * 1024) 53bf215546Sopenharmony_ci#define MAX_INLINE_UNIFORM_BLOCK_COUNT 64 54bf215546Sopenharmony_ci#define MAX_BIND_POINTS 3 /* compute + graphics + raytracing */ 55bf215546Sopenharmony_ci 56bf215546Sopenharmony_ci#define NUM_DEPTH_CLEAR_PIPELINES 2 57bf215546Sopenharmony_ci#define NUM_DEPTH_DECOMPRESS_PIPELINES 3 58bf215546Sopenharmony_ci#define MAX_FRAMEBUFFER_WIDTH (1u << 14) 59bf215546Sopenharmony_ci#define MAX_FRAMEBUFFER_HEIGHT (1u << 14) 60bf215546Sopenharmony_ci 61bf215546Sopenharmony_ci/* 62bf215546Sopenharmony_ci * This is the point we switch from using CP to compute shader 63bf215546Sopenharmony_ci * for certain buffer operations. 64bf215546Sopenharmony_ci */ 65bf215546Sopenharmony_ci#define RADV_BUFFER_OPS_CS_THRESHOLD 4096 66bf215546Sopenharmony_ci 67bf215546Sopenharmony_ci#define RADV_BUFFER_UPDATE_THRESHOLD 1024 68bf215546Sopenharmony_ci 69bf215546Sopenharmony_ci/* descriptor index into scratch ring offsets */ 70bf215546Sopenharmony_ci#define RING_SCRATCH 0 71bf215546Sopenharmony_ci#define RING_ESGS_VS 1 72bf215546Sopenharmony_ci#define RING_ESGS_GS 2 73bf215546Sopenharmony_ci#define RING_GSVS_VS 3 74bf215546Sopenharmony_ci#define RING_GSVS_GS 4 75bf215546Sopenharmony_ci#define RING_HS_TESS_FACTOR 5 76bf215546Sopenharmony_ci#define RING_HS_TESS_OFFCHIP 6 77bf215546Sopenharmony_ci#define RING_TS_DRAW 7 78bf215546Sopenharmony_ci#define RING_TS_PAYLOAD 8 79bf215546Sopenharmony_ci#define RING_MS_SCRATCH 9 80bf215546Sopenharmony_ci#define RING_PS_SAMPLE_POSITIONS 10 81bf215546Sopenharmony_ci 82bf215546Sopenharmony_ci/* max number of descriptor sets */ 83bf215546Sopenharmony_ci#define MAX_SETS 32 84bf215546Sopenharmony_ci 85bf215546Sopenharmony_ci/* Make sure everything is addressable by a signed 32-bit int, and 86bf215546Sopenharmony_ci * our largest descriptors are 96 bytes. 87bf215546Sopenharmony_ci */ 88bf215546Sopenharmony_ci#define RADV_MAX_PER_SET_DESCRIPTORS ((1ull << 31) / 96) 89bf215546Sopenharmony_ci 90bf215546Sopenharmony_ci/* Our buffer size fields allow only 2**32 - 1. We round that down to a multiple 91bf215546Sopenharmony_ci * of 4 bytes so we can align buffer sizes up. 92bf215546Sopenharmony_ci */ 93bf215546Sopenharmony_ci#define RADV_MAX_MEMORY_ALLOCATION_SIZE 0xFFFFFFFCull 94bf215546Sopenharmony_ci 95bf215546Sopenharmony_ci/* Number of entries in the mesh shader scratch ring. 96bf215546Sopenharmony_ci * This depends on VGT_GS_MAX_WAVE_ID which is set by the kernel 97bf215546Sopenharmony_ci * and is impossible to query. We leave it on its maximum value 98bf215546Sopenharmony_ci * because real applications are unlikely to use it. 99bf215546Sopenharmony_ci * 100bf215546Sopenharmony_ci * The maximum ID on GFX10.3 is 2047 (0x7ff), so we need 2048 entries. 101bf215546Sopenharmony_ci */ 102bf215546Sopenharmony_ci#define RADV_MESH_SCRATCH_NUM_ENTRIES 2048 103bf215546Sopenharmony_ci 104bf215546Sopenharmony_ci/* Size of each entry in the mesh shader scratch ring. 105bf215546Sopenharmony_ci * We must ensure that the absolute maximum mesh shader output fits here. 106bf215546Sopenharmony_ci * 107bf215546Sopenharmony_ci * Mesh shaders can create up to 256 vertices/primitives per workgroup, 108bf215546Sopenharmony_ci * and up to the following amount of outputs: 109bf215546Sopenharmony_ci * - 32 parameters 110bf215546Sopenharmony_ci * - 4 positions (clip/cull distance, etc.) 111bf215546Sopenharmony_ci * - 4 per-primitive built-in outputs (layer, view index, prim id, VRS rate) 112bf215546Sopenharmony_ci * - primitive indices which are always kept in LDS 113bf215546Sopenharmony_ci * That is a total of 32+4+4=40 output slots x 16 bytes per slot x 256 = 160K bytes. 114bf215546Sopenharmony_ci */ 115bf215546Sopenharmony_ci#define RADV_MESH_SCRATCH_ENTRY_BYTES (160 * 1024) 116bf215546Sopenharmony_ci 117bf215546Sopenharmony_ci/* Number of invocations in each subgroup. */ 118bf215546Sopenharmony_ci#define RADV_SUBGROUP_SIZE 64 119bf215546Sopenharmony_ci 120bf215546Sopenharmony_ci/* The spec requires this to be 32. */ 121bf215546Sopenharmony_ci#define RADV_RT_HANDLE_SIZE 32 122bf215546Sopenharmony_ci 123bf215546Sopenharmony_ci#define RADV_MAX_HIT_ATTRIB_SIZE 32 124bf215546Sopenharmony_ci 125bf215546Sopenharmony_ci#define RADV_SHADER_ALLOC_ALIGNMENT 256 126bf215546Sopenharmony_ci#define RADV_SHADER_ALLOC_MIN_ARENA_SIZE (256 * 1024) 127bf215546Sopenharmony_ci/* 256 KiB << 5 = 8 MiB */ 128bf215546Sopenharmony_ci#define RADV_SHADER_ALLOC_MAX_ARENA_SIZE_SHIFT 5u 129bf215546Sopenharmony_ci#define RADV_SHADER_ALLOC_MIN_SIZE_CLASS 8 130bf215546Sopenharmony_ci#define RADV_SHADER_ALLOC_MAX_SIZE_CLASS 15 131bf215546Sopenharmony_ci#define RADV_SHADER_ALLOC_NUM_FREE_LISTS \ 132bf215546Sopenharmony_ci (RADV_SHADER_ALLOC_MAX_SIZE_CLASS - RADV_SHADER_ALLOC_MIN_SIZE_CLASS + 1) 133bf215546Sopenharmony_ci 134bf215546Sopenharmony_ci#define PERF_CTR_MAX_PASSES 512 135bf215546Sopenharmony_ci#define PERF_CTR_BO_PASS_OFFSET 16 136bf215546Sopenharmony_ci#define PERF_CTR_BO_LOCK_OFFSET 0 137bf215546Sopenharmony_ci#define PERF_CTR_BO_FENCE_OFFSET 8 138bf215546Sopenharmony_ci 139bf215546Sopenharmony_ci#endif /* RADV_CONSTANTS_H */ 140