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