1/*
2 * Copyright © 2020 Raspberry Pi
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is 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
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23#ifndef V3DV_LIMITS_H
24#define V3DV_LIMITS_H
25
26#define NSEC_PER_SEC 1000000000ull
27
28/* From vulkan spec "If the multiple viewports feature is not enabled,
29 * scissorCount must be 1", ditto for viewportCount. For now we don't support
30 * that feature.
31 */
32#define MAX_VIEWPORTS 1
33#define MAX_SCISSORS  1
34
35#define MAX_VBS 16
36#define MAX_VERTEX_ATTRIBS 16
37
38#define MAX_SETS 16
39
40#define MAX_PUSH_CONSTANTS_SIZE 128
41
42#define MAX_SAMPLED_IMAGES 16
43#define MAX_STORAGE_IMAGES 4
44#define MAX_INPUT_ATTACHMENTS 4
45
46#define MAX_UNIFORM_BUFFERS 12
47#define MAX_STORAGE_BUFFERS 8
48
49#define MAX_DYNAMIC_UNIFORM_BUFFERS 8
50#define MAX_DYNAMIC_STORAGE_BUFFERS 4
51#define MAX_DYNAMIC_BUFFERS (MAX_DYNAMIC_UNIFORM_BUFFERS + \
52                             MAX_DYNAMIC_STORAGE_BUFFERS)
53
54#define MAX_RENDER_TARGETS 4
55
56#define MAX_MULTIVIEW_VIEW_COUNT 16
57
58/* These are tunable parameters in the HW design, but all the V3D
59 * implementations agree.
60 */
61#define V3D_UIFCFG_BANKS 8
62#define V3D_UIFCFG_PAGE_SIZE 4096
63#define V3D_UIFCFG_XOR_VALUE (1 << 4)
64#define V3D_PAGE_CACHE_SIZE (V3D_UIFCFG_PAGE_SIZE * V3D_UIFCFG_BANKS)
65#define V3D_UBLOCK_SIZE 64
66#define V3D_UIFBLOCK_SIZE (4 * V3D_UBLOCK_SIZE)
67#define V3D_UIFBLOCK_ROW_SIZE (4 * V3D_UIFBLOCK_SIZE)
68
69#define PAGE_UB_ROWS (V3D_UIFCFG_PAGE_SIZE / V3D_UIFBLOCK_ROW_SIZE)
70#define PAGE_UB_ROWS_TIMES_1_5 ((PAGE_UB_ROWS * 3) >> 1)
71#define PAGE_CACHE_UB_ROWS (V3D_PAGE_CACHE_SIZE / V3D_UIFBLOCK_ROW_SIZE)
72#define PAGE_CACHE_MINUS_1_5_UB_ROWS (PAGE_CACHE_UB_ROWS - PAGE_UB_ROWS_TIMES_1_5)
73
74#endif /* V3DV_LIMITS_H */
75