17ec681f3Smrg/*
27ec681f3Smrg * Copyright © 2020 Raspberry Pi
37ec681f3Smrg *
47ec681f3Smrg * Permission is hereby granted, free of charge, to any person obtaining a
57ec681f3Smrg * copy of this software and associated documentation files (the "Software"),
67ec681f3Smrg * to deal in the Software without restriction, including without limitation
77ec681f3Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
87ec681f3Smrg * and/or sell copies of the Software, and to permit persons to whom the
97ec681f3Smrg * Software is furnished to do so, subject to the following conditions:
107ec681f3Smrg *
117ec681f3Smrg * The above copyright notice and this permission notice (including the next
127ec681f3Smrg * paragraph) shall be included in all copies or substantial portions of the
137ec681f3Smrg * Software.
147ec681f3Smrg *
157ec681f3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
167ec681f3Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
177ec681f3Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
187ec681f3Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
197ec681f3Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
207ec681f3Smrg * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
217ec681f3Smrg * IN THE SOFTWARE.
227ec681f3Smrg */
237ec681f3Smrg#ifndef V3DV_LIMITS_H
247ec681f3Smrg#define V3DV_LIMITS_H
257ec681f3Smrg
267ec681f3Smrg#define NSEC_PER_SEC 1000000000ull
277ec681f3Smrg
287ec681f3Smrg/* From vulkan spec "If the multiple viewports feature is not enabled,
297ec681f3Smrg * scissorCount must be 1", ditto for viewportCount. For now we don't support
307ec681f3Smrg * that feature.
317ec681f3Smrg */
327ec681f3Smrg#define MAX_VIEWPORTS 1
337ec681f3Smrg#define MAX_SCISSORS  1
347ec681f3Smrg
357ec681f3Smrg#define MAX_VBS 16
367ec681f3Smrg#define MAX_VERTEX_ATTRIBS 16
377ec681f3Smrg
387ec681f3Smrg#define MAX_SETS 16
397ec681f3Smrg
407ec681f3Smrg#define MAX_PUSH_CONSTANTS_SIZE 128
417ec681f3Smrg
427ec681f3Smrg#define MAX_SAMPLED_IMAGES 16
437ec681f3Smrg#define MAX_STORAGE_IMAGES 4
447ec681f3Smrg#define MAX_INPUT_ATTACHMENTS 4
457ec681f3Smrg
467ec681f3Smrg#define MAX_UNIFORM_BUFFERS 12
477ec681f3Smrg#define MAX_STORAGE_BUFFERS 8
487ec681f3Smrg
497ec681f3Smrg#define MAX_DYNAMIC_UNIFORM_BUFFERS 8
507ec681f3Smrg#define MAX_DYNAMIC_STORAGE_BUFFERS 4
517ec681f3Smrg#define MAX_DYNAMIC_BUFFERS (MAX_DYNAMIC_UNIFORM_BUFFERS + \
527ec681f3Smrg                             MAX_DYNAMIC_STORAGE_BUFFERS)
537ec681f3Smrg
547ec681f3Smrg#define MAX_RENDER_TARGETS 4
557ec681f3Smrg
567ec681f3Smrg#define MAX_MULTIVIEW_VIEW_COUNT 16
577ec681f3Smrg
587ec681f3Smrg/* These are tunable parameters in the HW design, but all the V3D
597ec681f3Smrg * implementations agree.
607ec681f3Smrg */
617ec681f3Smrg#define V3D_UIFCFG_BANKS 8
627ec681f3Smrg#define V3D_UIFCFG_PAGE_SIZE 4096
637ec681f3Smrg#define V3D_UIFCFG_XOR_VALUE (1 << 4)
647ec681f3Smrg#define V3D_PAGE_CACHE_SIZE (V3D_UIFCFG_PAGE_SIZE * V3D_UIFCFG_BANKS)
657ec681f3Smrg#define V3D_UBLOCK_SIZE 64
667ec681f3Smrg#define V3D_UIFBLOCK_SIZE (4 * V3D_UBLOCK_SIZE)
677ec681f3Smrg#define V3D_UIFBLOCK_ROW_SIZE (4 * V3D_UIFBLOCK_SIZE)
687ec681f3Smrg
697ec681f3Smrg#define PAGE_UB_ROWS (V3D_UIFCFG_PAGE_SIZE / V3D_UIFBLOCK_ROW_SIZE)
707ec681f3Smrg#define PAGE_UB_ROWS_TIMES_1_5 ((PAGE_UB_ROWS * 3) >> 1)
717ec681f3Smrg#define PAGE_CACHE_UB_ROWS (V3D_PAGE_CACHE_SIZE / V3D_UIFBLOCK_ROW_SIZE)
727ec681f3Smrg#define PAGE_CACHE_MINUS_1_5_UB_ROWS (PAGE_CACHE_UB_ROWS - PAGE_UB_ROWS_TIMES_1_5)
737ec681f3Smrg
747ec681f3Smrg#endif /* V3DV_LIMITS_H */
75